-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.in
executable file
·235 lines (212 loc) · 6.18 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
dnl Process this file with autoconf to produce a configure script.
AC_INIT(vmips.cc)
dnl Get the canonical and user-supplied names for the host and target.
AC_CANONICAL_SYSTEM
program_prefix=NONE
AM_INIT_AUTOMAKE(prophet_vmips, 1.3.2)
AM_CONFIG_HEADER(config.h)
dnl Look for mips tool installation:
AC_ARG_WITH(mips,
[ --with-mips=MDIR specify installation prefix of mips cross tools
(default MDIR = /opt/mips)],
[mipsdir="$withval"],
[mipsdir="/opt/mips"])dnl
dnl Look for mips tool binaries:
AC_ARG_WITH(mips-bin,
[ --with-mips-bin=DIR specify path to mips cross tools' executables
(default MDIR/bin)],
[mipsbin="$withval"],
[mipsbin="${mipsdir}/bin"])dnl
dnl Sanity check the above settings.
test -d "$mipsdir" || \
AC_MSG_WARN([--with-mips directory \"$mipsdir\" does not exist])
test -d "$mipsbin" || \
AC_MSG_WARN([--with-mips-bin directory \"$mipsbin\" does not exist])
dnl Check for C compiler.
dnl We have to do this early because AC_TRY_CPP depends on it.
AC_PROG_CC
dnl Checks for interesting flavors of Unix.
AC_AIX
AC_ISC_POSIX
AC_MINIX
dnl Check for executable extension.
dnl Note that this is also required for the testsuite to function (see the
dnl automake-1.7.8 manual) because the testsuite Makefile.am files
dnl explicitly set EXEEXT.
AC_EXEEXT
AC_MSG_CHECKING([for mips tool prefix])
mipstoolprefix=""
for file in ${mipsdir}/mips*/bin/*gcc$EXEEXT ${mipsbin}/*gcc$EXEEXT
do
case $file in
*\**) mipstoolprefix="";;
*\*) mipstoolprefix="";;
*) mipstoolprefix=`echo "$file" |sed "s/gcc$EXEEXT//"`;;
esac
done
AC_MSG_RESULT($mipstoolprefix)
TESTCODE_DIR="test_code"
SAMPLE_CODE_TARGETS="setup.o build_xmboot"
if test "x$mipstoolprefix" = "x"
then
AC_MSG_WARN([cannot seem to find any mips tools under $mipsbin])
AC_MSG_WARN([xmboot and test_code will not be built])
TESTCODE_DIR=""
SAMPLE_CODE_TARGETS=""
fi
MIPSTOOLPREFIX="mipstoolprefix='${mipstoolprefix}'"
AC_SUBST(TESTCODE_DIR)
AC_SUBST(SAMPLE_CODE_TARGETS)
AC_SUBST(mipsbin)
AC_SUBST(MIPSTOOLPREFIX)
sharedstatedir="${prefix}/com"
AC_SUBST(sharedstatedir)
AC_MSG_CHECKING([for cross tools target endianness])
AC_ARG_WITH(mips-endianness,
[ --with-mips-endianness=VAL specify mips cross tools target endianness
(defaults to guessing from objdump -i)],
[mipsendianness="$withval"],
[mipsendianness=no
objdump="${mipstoolprefix}objdump"
if test -x "$objdump"
then
mipsendianness=`$objdump -i | awk '/endian/ { print; exit }'`
fi
case $mipsendianness in
*data\ big\ endian*) mipsendianness="big" ;;
*data\ little\ endian*) mipsendianness="little" ;;
*) mipsendianness="no" ;;
esac])dnl
case $mipsendianness in
big) BIGENDIAN="bigendian" ;;
little) BIGENDIAN="nobigendian" ;;
no) BIGENDIAN="nobigendian"
AC_MSG_WARN([defaulting to little-endian VMIPS]) ;;
*) AC_MSG_ERROR([endianness, if specified, must be 'big' or 'little']) ;;
esac
AC_MSG_RESULT($mipsendianness)
AC_SUBST(BIGENDIAN)
dnl Are we building a debugging version?
debug_flags="-g"
optimize_flags="-O2"
AC_ARG_ENABLE(debug,
[ --disable-debug build an optimized (vs. default=debugging) VMIPS])
AC_MSG_CHECKING([whether to build an optimized or a debugging version])
case "x$enable_debug" in
x|xyes)
if test "x$CXXFLAGS" = "x"
then
CXXFLAGS="${debug_flags}"
fi
if test "x$CFLAGS" = "x"
then
CFLAGS="${debug_flags}"
fi
enable_debug=debugging
AC_DEFINE(INTENTIONAL_CONFUSION,1,
[Define to initialize registers to random values instead of zero.])
;;
xno|x*)
if test "x$CXXFLAGS" = "x"
then
CXXFLAGS="${optimize_flags}"
fi
if test "x$CFLAGS" = "x"
then
CFLAGS="${optimize_flags}"
fi
enable_debug=optimized
AC_DEFINE(NDEBUG,1,
[Define if you don't want any assertions checked at runtime.])
;;
esac
AC_MSG_RESULT($enable_debug)
AC_ARG_ENABLE(profiling,
[ --enable-profiling build profiled VMIPS executable for gprof/gcov])
AC_MSG_CHECKING([whether to build a profiled version])
case "x$enable_profiling" in
xyes)
CXXFLAGS="$CXXFLAGS -pg -fprofile-arcs -ftest-coverage"
CFLAGS="$CFLAGS -pg -fprofile-arcs -ftest-coverage"
LDFLAGS="$LDFLAGS -pg"
enable_profiling="yes"
;;
*)
enable_profiling="no"
;;
esac
AC_MSG_RESULT($enable_profiling)
# strip binary if optimizing and not profiling:
if test $enable_profiling = no
then
if test $enable_debug = optimized
then
LDFLAGS="$LDFLAGS -s"
fi
fi
AC_SUBST(LDFLAGS)
AC_PROG_AWK
AC_PROG_CXX
if test "x$GXX" = "xyes"
then
CXXFLAGS="$CXXFLAGS -Wall -fno-strict-aliasing"
CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
fi
VMIPS_CXX_TEMPLATE_FUNCTIONS
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_GCC_TRADITIONAL
AM_PROG_AS
dnl We run our tests using the C compiler, because it turns out that
dnl lots of autoconf tests are broken using the C++ compiler, and using the
dnl C results can actually get us farther.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
VMIPS_TYPE_SOCKLEN_T
VMIPS_CXX_ATTRIBUTE_NORETURN
VMIPS_CXX_ATTRIBUTE_FORMAT
dnl Cross compiling will assume 32-bit target...
dnl we can probably figure out a better way to do this, though.
AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(char, 1)
dnl Checks for library functions.
AC_FUNC_MMAP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday strdup strerror random select)
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(inet_ntoa, nsl)
AC_SEARCH_LIBS(XtAppInitialize, Xaw)
dnl Work around automake 1.5 and 1.6 bugs.
AC_DEFINE(ASFLAGS,[],[Currently not used.])
AC_SUBST(ASFLAGS)
AC_DEFINE(AS,[],[Currently not used.])
AC_SUBST(AS)
AC_DEFINE(CCASFLAGS,[],[Currently not used.])
AC_SUBST(CCASFLAGS)
AC_DEFINE(CCAS,[],[Currently not used.])
AC_SUBST(CCAS)
AC_OUTPUT([Makefile
vmips.spec
vmipsrc
doc/Makefile
libopcodes_mips/Makefile
sample_code/Makefile
sample_code/xmboot/Makefile
test_code/Makefile
test_code/vmips.misc-tests/Makefile
test_code/vmips.outcheck/Makefile
test_code/vmips.regcheck/Makefile])