]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/ppc/configure.ac
sim: drop obsolete AC_EXEEXT call
[thirdparty/binutils-gdb.git] / sim / ppc / configure.ac
CommitLineData
c906108c 1dnl Process this file with autoconf to produce a configure script.
c906108c 2AC_INIT(Makefile.in)
760b3e8b 3AC_CONFIG_MACRO_DIRS([../.. ../../config])
c906108c
SS
4
5AC_PROG_INSTALL
6AC_PROG_CC
7
8# Put a plausible default for CC_FOR_BUILD in Makefile.
9if test "x$cross_compiling" = "xno"; then
10 CC_FOR_BUILD='$(CC)'
11else
12 CC_FOR_BUILD=gcc
13fi
4b164edf 14CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
c906108c
SS
15
16dnl We don't use gettext, but bfd does. So we do the appropriate checks
17dnl to see if there are intl libraries we should link against.
18ALL_LINGUAS=
29035cbe 19ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
c906108c
SS
20
21
c906108c
SS
22AC_ARG_ENABLE(sim-bitsize,
23[ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
24[case "${enableval}" in
25 32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
26 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
27esac
28if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
29 echo "Setting bitsize flags = $sim_bitsize" 6>&1
30fi],[sim_bitsize=""])dnl
31
32
c906108c
SS
33AC_ARG_ENABLE(sim-config,
34[ --enable-sim-config=file Override default config file],
35[case "${enableval}" in
36 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-config=file");;
37 *) if test -f "${srcdir}/${enableval}"; then
38 sim_config="${enableval}";
39 elif test -f "${srcdir}/${enableval}-config.h"; then
40 sim_config="${enableval}-config.h"
41 else
42 AC_MSG_ERROR("Config file $enableval was not found");
43 sim_config=std-config.h
44 fi;;
45esac
46if test x"$silent" != x"yes" && test x"$sim_config" != x""; then
47 echo "Setting config flags = $sim_config" 6>&1
48fi],[sim_config="std-config.h"
49if test x"$silent" != x"yes"; then
50 echo "Setting config flags = $sim_config" 6>&1
51fi])dnl
52
53
54AC_ARG_ENABLE(sim-decode-mechanism,
55[ --enable-sim-decode-mechanism=which Specify the instruction decode mechanism.],
56[case "${enableval}" in
57 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-decode-mechanism=file");;
58 array|switch|padded-switch|goto-switch) sim_decode_mechanism="-T ${enableval}";;
59 *) AC_MSG_ERROR("File $enableval is not an opcode rules file");
60 sim_decode_mechanism="switch";;
61esac
62if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then
63 echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1
64fi],[sim_decode_mechanism=""
65if test x"$silent" != x"yes"; then
66 echo "Setting decode mechanism flags = $sim_decode_mechanism"
67fi])dnl
68
69
70AC_ARG_ENABLE(sim-default-model,
71[ --enable-sim-default-model=which Specify default PowerPC to model.],
72[case "${enableval}" in
73 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-default-model=model");;
74 *) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
75esac
76if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
77 echo "Setting default-model flags = $sim_default_model" 6>&1
78fi],[sim_default_model=""])dnl
79
80
81AC_ARG_ENABLE(sim-duplicate,
82[ --enable-sim-duplicate Expand (duplicate) semantic functions.],
83[case "${enableval}" in
84 yes) sim_dup="-E";;
85 no) sim_dup="";;
86 *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
87esac
88if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
89 echo "Setting duplicate flags = $sim_dup" 6>&1
90fi],[sim_dup="-E"
91if test x"$silent" != x"yes"; then
92 echo "Setting duplicate flags = $sim_dup" 6>&1
93fi])dnl
94
95
96AC_ARG_ENABLE(sim-endian,
97[ --enable-sim-endian=endian Specify target byte endian orientation.],
98[case "${enableval}" in
99 yes) case "$target" in
956f0bab
MF
100 *powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_BIG";;
101 *powerpcle-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE";;
102 *) echo "Unknown target $target" 1>&6; sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN";;
c906108c 103 esac;;
956f0bab
MF
104 no) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN";;
105 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_BIG";;
106 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE";;
c906108c
SS
107 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
108esac
109if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
110 echo "Setting endian flags = $sim_endian" 6>&1
111fi],[sim_endian=""])dnl
112
113
c906108c
SS
114AC_ARG_ENABLE(sim-filter,
115[ --enable-sim-filter=rule Specify filter rules.],
116[case "${enableval}" in
117 yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
118 no) sim_filter="";;
119 *) sim_filter="-F $enableval";;
120esac
121if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
122 echo "Setting filter flags = $sim_filter" 6>&1
123fi],[sim_filter="-F 32,f,o"
124if test x"$silent" != x"yes"; then
125 echo "Setting filter flags = $sim_filter" 6>&1
126fi])dnl
127
128
129AC_ARG_ENABLE(sim-float,
345d88d9 130[ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
c906108c
SS
131[case "${enableval}" in
132 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
133 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
345d88d9
AC
134 altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
135 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
c906108c
SS
136 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
137esac
138if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
139 echo "Setting float flags = $sim_float" 6>&1
345d88d9
AC
140fi],[
141case "${target}" in
142 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
143 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
144 *) sim_float=""
145esac
146])dnl
c906108c 147
00a0b122
JS
148AC_CACHE_CHECK([if union semun defined],
149 ac_cv_HAS_UNION_SEMUN,
150 [AC_TRY_COMPILE([
151#include <sys/types.h>
152#include <sys/ipc.h>
153#include <sys/sem.h>],
154[union semun arg ;],
155[ac_cv_has_union_semun="yes"],
156[ac_cv_has_union_semun="no"])
157AC_MSG_RESULT($ac_cv_has_union_semun)
158])
159
160
161if test "$ac_cv_has_union_semun" = "yes"; then
162 AC_CACHE_CHECK(whether System V semaphores are supported,
163 ac_cv_sysv_sem,
164 [
165 AC_TRY_RUN(
166 [
167 #include <sys/types.h>
168 #include <sys/ipc.h>
169 #include <sys/sem.h>
170 int main () {
171 union semun arg ;
172
173 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
174 if (id == -1)
175 exit(1);
176 arg.val = 0; /* avoid implicit type cast to union */
177 if (semctl(id, 0, IPC_RMID, arg) == -1)
178 exit(1);
179 exit(0);
180 }
181 ],
182 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
183 ])
184else # semun is not defined
185 AC_CACHE_CHECK(whether System V semaphores are supported,
186 ac_cv_sysv_sem,
187 [
188 AC_TRY_RUN(
189 [
190 #include <sys/types.h>
191 #include <sys/ipc.h>
192 #include <sys/sem.h>
193 union semun {
194 int val;
195 struct semid_ds *buf;
196 ushort *array;
197 };
198 int main () {
199 union semun arg ;
200
201 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
202 if (id == -1)
203 exit(1);
204 arg.val = 0; /* avoid implicit type cast to union */
205 if (semctl(id, 0, IPC_RMID, arg) == -1)
206 exit(1);
207 exit(0);
208 }
209 ],
210 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
211 ])
212fi
213
214AC_CACHE_CHECK(whether System V shared memory is supported,
215ac_cv_sysv_shm,
216[
217AC_TRY_RUN([
218#include <sys/types.h>
219#include <sys/ipc.h>
220#include <sys/shm.h>
221int main () {
222 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
223 if (id == -1)
224 exit(1);
225 if (shmctl(id, IPC_RMID, 0) == -1)
226 exit(1);
227 exit(0);
228}
229],
230ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
231])
232
233if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
234 sim_sysv_ipc_hw=",sem,shm";
235else
236 sim_sysv_ipc_hw="";
237fi
238
239if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
bf0275b1
DE
240 AC_DEFINE(HAVE_UNION_SEMUN, 1,
241 [Define if union semun is defined in <sys/sem.h>])
00a0b122
JS
242fi
243
c906108c
SS
244
245AC_ARG_ENABLE(sim-hardware,
246[ --enable-sim-hardware=list Specify the hardware to be included in the build.],
00a0b122 247[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
c906108c
SS
248case "${enableval}" in
249 yes) ;;
250 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
251 ,*) hardware="${hardware}${enableval}";;
252 *,) hardware="${enableval}${hardware}";;
253 *) hardware="${enableval}"'';;
254esac
255sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
256sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
257if test x"$silent" != x"yes" && test x"$hardware" != x""; then
258 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
00a0b122 259fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
c906108c
SS
260sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
261sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
262if test x"$silent" != x"yes"; then
263 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
264fi])dnl
265
c906108c
SS
266AC_ARG_ENABLE(sim-hostbitsize,
267[ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
268[case "${enableval}" in
269 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
270 *) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval. Expected 32 or 64"); sim_hostbitsize="";;
271esac
272if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
273 echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
274fi],[sim_hostbitsize=""])dnl
275
276
c906108c
SS
277AC_ARG_ENABLE(sim-icache,
278[ --enable-sim-icache=size Specify instruction-decode cache size and type.],
279[icache="-R"
280 case "${enableval}" in
281 yes) icache="1024"; sim_icache="-I $icache";;
282 no) sim_icache="-R";;
283 *) icache=1024
284 sim_icache="-"
285 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
286 case "$x" in
287 define) sim_icache="${sim_icache}R";;
288 semantic) sim_icache="${sim_icache}C";;
289 insn) sim_icache="${sim_icache}S";;
290 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
291 *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
292 esac
293 done
294 sim_icache="${sim_icache}I $icache";;
295esac
296if test x"$silent" != x"yes" && test x"$icache" != x""; then
297 echo "Setting instruction cache size to $icache ($sim_icache)"
298fi],[sim_icache="-CSRI 1024"
299if test x"$silent" != x"yes"; then
300 echo "Setting instruction cache size to 1024 ($sim_icache)"
301fi])dnl
302
303
304AC_ARG_ENABLE(sim-inline,
305[ --enable-sim-inline=inlines Specify which functions should be inlined.],
306[sim_inline=""
307case "$enableval" in
308 no) sim_inline="-DDEFAULT_INLINE=0";;
309 0) sim_inline="-DDEFAULT_INLINE=0";;
310 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
d29d5195 311 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";;
c906108c
SS
312 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
313 new_flag=""
314 case "$x" in
315 *_INLINE=*) new_flag="-D$x";;
316 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
317 *_INLINE) new_flag="-D$x=ALL_INLINE";;
318 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
319 esac
320 if test x"$sim_inline" = x""; then
321 sim_inline="$new_flag"
322 else
323 sim_inline="$sim_inline $new_flag"
324 fi
325 done;;
326esac
327if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
328 echo "Setting inline flags = $sim_inline" 6>&1
329fi],[if test x"$GCC" != ""; then
d29d5195 330 sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS"
c906108c
SS
331 if test x"$silent" != x"yes"; then
332 echo "Setting inline flags = $sim_inline" 6>&1
333 fi
334else
335 sim_inline=""
336fi])dnl
337
338
339AC_ARG_ENABLE(sim-jump,
340[ --enable-sim-jump Jump between semantic code (instead of call/return).],
341[case "${enableval}" in
342 yes) sim_jump="-J";;
343 no) sim_jump="";;
344 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
345esac
346if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
347 echo "Setting jump flag = $sim_jump" 6>&1
348fi],[sim_jump=""
349if test x"$silent" != x"yes"; then
350 echo "Setting jump flag = $sim_jump" 6>&1
351fi])dnl
352
353
354AC_ARG_ENABLE(sim-line-nr,
355[ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
356[case "${enableval}" in
357 yes) sim_line_nr="";;
358 no) sim_line_nr="-L";;
359 *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
360esac
361if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
362 echo "Setting warning flags = $sim_line_nr" 6>&1
363fi],[sim_line_nr=""])dnl
364
365
366AC_ARG_ENABLE(sim-model,
367[ --enable-sim-model=which Specify PowerPC to model.],
368[case "${enableval}" in
369 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
370 *) sim_model="-DWITH_MODEL=${enableval}";;
371esac
372if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
373 echo "Setting model flags = $sim_model" 6>&1
374fi],[sim_model=""])dnl
375
376
377AC_ARG_ENABLE(sim-model-issue,
378[ --enable-sim-model-issue Specify whether to simulate model specific actions],
379[case "${enableval}" in
380 yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
381 no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
382 *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
383esac
384if test x"$silent" != x"yes"; then
385 echo "Setting model-issue flags = $sim_model_issue" 6>&1
386fi],[sim_model_issue=""])dnl
387
388
389AC_ARG_ENABLE(sim-monitor,
390[ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
391[case "${enableval}" in
392 yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
393 no) sim_monitor="-DWITH_MON=0";;
394 instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
395 memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
5629cf2b 396 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
c906108c
SS
397esac
398if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
399 echo "Setting monitor flags = $sim_monitor" 6>&1
400fi],[sim_monitor=""])dnl
401
402
403AC_ARG_ENABLE(sim-opcode,
404[ --enable-sim-opcode=which Override default opcode lookup.],
405[case "${enableval}" in
406 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
407 *) if test -f "${srcdir}/${enableval}"; then
408 sim_opcode="${enableval}"
409 elif test -f "${srcdir}/dc-${enableval}"; then
410 sim_opcode="dc-${enableval}"
411 else
412 AC_MSG_ERROR("File $enableval is not an opcode rules file");
413 sim_opcode="dc-complex"
414 fi;;
415esac
416if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
417 echo "Setting opcode flags = $sim_opcode" 6>&1
418fi],[sim_opcode="dc-complex"
419if test x"$silent" != x"yes"; then
420 echo "Setting opcode flags = $sim_opcode"
421fi])dnl
422
423
424AC_ARG_ENABLE(sim-packages,
425[ --enable-sim-packages=list Specify the packages to be included in the build.],
426[packages=disklabel
427case "${enableval}" in
428 yes) ;;
429 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
430 ,*) packages="${packages}${enableval}";;
431 *,) packages="${enableval}${packages}";;
432 *) packages="${enableval}"'';;
433esac
434sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
435sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
436if test x"$silent" != x"yes" && test x"$packages" != x""; then
437 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
438fi],[packages=disklabel
439sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
440sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
441if test x"$silent" != x"yes"; then
442 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
443fi])dnl
444
445
c906108c
SS
446AC_ARG_ENABLE(sim-reserved-bits,
447[ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
448[case "${enableval}" in
449 yes) sim_reserved="-DWITH_RESERVED_BITS=1";;
450 no) sim_reserved="-DWITH_RESERVED_BITS=0";;
451 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved="";;
452esac
453if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
454 echo "Setting reserved flags = $sim_reserved" 6>&1
455fi],[sim_reserved=""])dnl
456
457
458AC_ARG_ENABLE(sim-smp,
459[ --enable-sim-smp=n Specify number of processors to configure for.],
460[case "${enableval}" in
461 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
462 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
463 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
464esac
465if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
466 echo "Setting smp flags = $sim_smp" 6>&1
467fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
468if test x"$silent" != x"yes"; then
469 echo "Setting smp flags = $sim_smp" 6>&1
470fi])dnl
471
472
c906108c
SS
473AC_ARG_ENABLE(sim-switch,
474[ --enable-sim-switch Use a switch instead of a table for instruction call.],
475[case "${enableval}" in
476 yes) sim_switch="-s";;
477 no) sim_switch="";;
478 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
479esac
480if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
481 echo "Setting switch flags = $sim_switch" 6>&1
482fi],[sim_switch="";
483if test x"$silent" != x"yes"; then
484 echo "Setting switch flags = $sim_switch" 6>&1
485fi])dnl
486
487
488AC_ARG_ENABLE(sim-timebase,
489[ --enable-sim-timebase Specify whether the PPC timebase is supported.],
490[case "${enableval}" in
491 yes) sim_timebase="-DWITH_TIME_BASE=1";;
492 no) sim_timebase="-DWITH_TIME_BASE=0";;
493 *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
494esac
495if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
496 echo "Setting timebase flags = $sim_timebase" 6>&1
497fi],[sim_timebase=""])dnl
498
499
be2bc30f
MF
500AC_ARG_ENABLE(werror,
501 AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
502 [case "${enableval}" in
503 yes | y) ERROR_ON_WARNING="yes" ;;
504 no | n) ERROR_ON_WARNING="no" ;;
505 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
506 esac])
507# Enable -Werror by default when using gcc
508if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
509 ERROR_ON_WARNING=yes
510fi
511WERROR_CFLAGS=""
512if test "${ERROR_ON_WARNING}" = yes ; then
513 WERROR_CFLAGS="-Werror"
514fi
c5b349e1
MF
515dnl Enable -Wno-format by default when using gcc on mingw since many
516dnl GCC versions complain about %I64.
517case "${host}" in
518 *-*-mingw32*) WERROR_CFLAGS="$WERROR_CFLAGS -Wno-format" ;;
519esac
be2bc30f
MF
520AC_SUBST(WERROR_CFLAGS)
521
c906108c
SS
522AC_ARG_ENABLE(sim-warnings,
523[ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o],
524[case "${enableval}" in
525 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
526 no) sim_warnings="-w";;
527 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
528esac
529if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
530 echo "Setting warning flags = $sim_warnings" 6>&1
531fi],[sim_warnings=""])dnl
532
533
534AC_ARG_ENABLE(sim-xor-endian,
535[ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
536[case "${enableval}" in
537 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
538 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
539 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
540esac
541if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
542 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
543fi],[sim_xor_endian=""])dnl
544
545
c906108c
SS
546AC_CANONICAL_SYSTEM
547AC_ARG_PROGRAM
548
35689115
HPN
549# BFD conditionally uses zlib, so we must link it in if libbfd does, by
550# using the same condition.
5912fadd 551AM_ZLIB
35689115 552
2974be62
AM
553# BFD uses libdl when when plugins enabled.
554AC_PLUGINS
555
058ad269
MM
556case ${host} in
557 *mingw32*)
558 AC_DEFINE(USE_WIN32API, 1,
559 [Define if we should use the Windows API, instead of the
560 POSIX API. On Windows, we use the Windows API when
561 building for MinGW, but the POSIX API when building
562 for Cygwin.])
563 ;;
564esac
565
c906108c
SS
566AC_CONFIG_HEADER(config.h:config.in)
567
c906108c
SS
568
569dnl Figure out what type of termio/termios support there is
570sim_termio=""
571AC_MSG_CHECKING(for struct termios)
572AC_CACHE_VAL(ac_cv_termios_struct,
573[AC_TRY_COMPILE([#include <sys/types.h>
574#include <sys/termios.h>],
575[static struct termios x;
576 x.c_iflag = 0;
577 x.c_oflag = 0;
578 x.c_cflag = 0;
579 x.c_lflag = 0;
580 x.c_cc[NCCS] = 0;],
581ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
582AC_MSG_RESULT($ac_cv_termios_struct)
583if test $ac_cv_termios_struct = yes; then
584 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
585fi
586
587if test "$ac_cv_termios_struct" = "yes"; then
588 AC_MSG_CHECKING(for c_line field in struct termios)
589 AC_CACHE_VAL(ac_cv_termios_cline,
590 [AC_TRY_COMPILE([#include <sys/types.h>
591#include <sys/termios.h>],
592[static struct termios x; x.c_line = 0;],
593 ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
594
595 AC_MSG_RESULT($ac_cv_termios_cline)
596 if test $ac_cv_termios_cline = yes; then
597 sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
598 fi
599else
600 ac_cv_termios_cline=no
601fi
602
603if test "$ac_cv_termios_struct" != "yes"; then
604 AC_MSG_CHECKING(for struct termio)
605 AC_CACHE_VAL(ac_cv_termio_struct,
606 [AC_TRY_COMPILE([#include <sys/types.h>
607#include <sys/termio.h>],
608[static struct termio x;
609 x.c_iflag = 0;
610 x.c_oflag = 0;
611 x.c_cflag = 0;
612 x.c_lflag = 0;
613 x.c_cc[NCC] = 0;],
614ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
615 AC_MSG_RESULT($ac_cv_termio_struct)
616 if test $ac_cv_termio_struct = yes; then
617 sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
618 fi
619else
620 ac_cv_termio_struct=no
621fi
622
623if test "$ac_cv_termio_struct" = "yes"; then
624 AC_MSG_CHECKING(for c_line field in struct termio)
625 AC_CACHE_VAL(ac_cv_termio_cline,
626 [AC_TRY_COMPILE([#include <sys/types.h>
627#include <sys/termio.h>],
628[static struct termio x; x.c_line = 0;],
629 ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
630
631 AC_MSG_RESULT($ac_cv_termio_cline)
632 if test $ac_cv_termio_cline = yes; then
633 sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
634 fi
635else
636 ac_cv_termio_cline=no
637fi
638
1f362c96
AC
639dnl Check for struct statfs
640AC_MSG_CHECKING(for struct statfs)
641AC_CACHE_VAL(ac_cv_struct_statfs,
642[AC_TRY_COMPILE([#include <sys/types.h>
643#ifdef HAVE_SYS_PARAM_H
644#include <sys/param.h>
645#endif
646#ifdef HAVE_SYS_MOUNT_H
647#include <sys/mount.h>
648#endif
649#ifdef HAVE_SYS_VFS_H
650#include <sys/vfs.h>
651#endif
652#ifdef HAVE_SYS_STATFS_H
653#include <sys/statfs.h>
654#endif],
655[static struct statfs s;],
656ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
657AC_MSG_RESULT($ac_cv_struct_statfs)
658if test $ac_cv_struct_statfs = yes; then
659 AC_DEFINE(HAVE_STRUCT_STATFS, 1,
660 [Define if struct statfs is defined in <sys/mount.h>])
661fi
662
30e66173
MI
663AC_CHECK_TYPES(long long)
664
c906108c
SS
665dnl Figure out if /dev/zero exists or not
666sim_devzero=""
667AC_MSG_CHECKING(for /dev/zero)
668AC_CACHE_VAL(ac_cv_devzero,
669[AC_TRY_RUN([#include <fcntl.h>
670main () {
671 char buf[2048];
672 int i;
673 int fd = open ("/dev/zero", O_RDONLY);
674 if (fd < 0)
675 return 1;
676 for (i = 0; i < sizeof (buf); i++)
677 buf[i] = 1;
678 if (read (fd, buf, sizeof (buf)) != sizeof (buf))
679 return 1;
680 for (i = 0; i < sizeof (buf); i++)
681 if (buf[i])
682 return 1;
683 return 0;
684}],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
685AC_MSG_RESULT($ac_cv_devzero)
686if test $ac_cv_devzero = yes; then
687 sim_devzero="-DHAVE_DEVZERO"
688else
689 sim_devzero=""
690fi
691
692dnl Figure out if we are in the new Cygnus tree with a common directory or not
693AC_MSG_CHECKING(for common simulator directory)
694if test -f "${srcdir}/../common/callback.c"; then
695 AC_MSG_RESULT(yes)
696 sim_callback="callback.o targ-map.o"
697 sim_targ_vals="targ-vals.h targ-map.c targ-vals.def"
698else
699 AC_MSG_RESULT(no)
700 sim_callback=""
701 sim_targ_vals=""
702fi
703
d29d5195
MG
704AC_MSG_CHECKING(for common simulator directory fpu implementation)
705if test -f "${srcdir}/../common/sim-fpu.c"; then
706 AC_MSG_RESULT(yes)
3e5e53f9 707 sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
3a11ea24 708 sim_fpu="sim-fpu.o"
d29d5195
MG
709else
710 AC_MSG_RESULT(no)
711 sim_fpu_cflags=
712 sim_fpu=
713fi
714
68a3e151
NF
715# Since we run commands on the build system, we have to create a
716# separate config header for the build system if build != host.
717if test x$host = x$build; then
718 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
719else
720 tempdir=build.$$
721 rm -rf $tempdir
722 mkdir $tempdir
723 cd $tempdir
724 case ${srcdir} in
725 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
726 *) realsrcdir=../${srcdir};;
727 esac
728 saved_CFLAGS="${CFLAGS}"
729 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
730 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
731 ${realsrcdir}/configure \
732 --enable-languages=${enable_languages-all} \
733 --target=$target_alias --host=$build_alias --build=$build_alias
734 CFLAGS="${saved_CFLAGS}"
735 mv config.h ../build-config.h
736 cd ..
737 rm -rf $tempdir
738fi
739
c906108c 740AC_SUBST(CC_FOR_BUILD)
4b164edf 741AC_SUBST(CFLAGS_FOR_BUILD)
c906108c 742AC_SUBST(CFLAGS)
c906108c
SS
743AR=${AR-ar}
744AC_SUBST(AR)
745AC_PROG_RANLIB
c906108c
SS
746AC_SUBST(sim_warnings)
747AC_SUBST(sim_line_nr)
748AC_SUBST(sim_config)
749AC_SUBST(sim_opcode)
750AC_SUBST(sim_switch)
751AC_SUBST(sim_dup)
752AC_SUBST(sim_decode_mechanism)
753AC_SUBST(sim_jump)
754AC_SUBST(sim_filter)
755AC_SUBST(sim_icache)
756AC_SUBST(sim_hw_src)
757AC_SUBST(sim_hw_obj)
758AC_SUBST(sim_pk_src)
759AC_SUBST(sim_pk_obj)
760AC_SUBST(sim_inline)
c906108c 761AC_SUBST(sim_endian)
c906108c 762AC_SUBST(sim_xor_endian)
c906108c
SS
763AC_SUBST(sim_smp)
764AC_SUBST(sim_igen_smp)
765AC_SUBST(sim_bitsize)
766AC_SUBST(sim_hostbitsize)
c906108c 767AC_SUBST(sim_timebase)
c906108c 768AC_SUBST(sim_float)
c906108c
SS
769AC_SUBST(sim_reserved)
770AC_SUBST(sim_monitor)
771AC_SUBST(sim_model)
772AC_SUBST(sim_default_model)
773AC_SUBST(sim_model_issue)
c906108c
SS
774AC_SUBST(sim_termio)
775AC_SUBST(sim_devzero)
776AC_SUBST(sim_callback)
777AC_SUBST(sim_targ_vals)
d29d5195
MG
778AC_SUBST(sim_fpu_cflags)
779AC_SUBST(sim_fpu)
c906108c
SS
780
781AC_OUTPUT(Makefile,
782[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])