1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_MACRO_DIRS([../.. ../../config])
8 # Put a plausible default for CC_FOR_BUILD in Makefile.
9 if test "x$cross_compiling" = "xno"; then
14 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
16 dnl We don't use gettext, but bfd does. So we do the appropriate checks
17 dnl to see if there are intl libraries we should link against.
19 ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
22 AC_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="";;
28 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
29 echo "Setting bitsize flags = $sim_bitsize" 6>&1
30 fi],[sim_bitsize=""])dnl
33 AC_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"
42 AC_MSG_ERROR("Config file $enableval was not found");
43 sim_config=std-config.h
46 if test x"$silent" != x"yes" && test x"$sim_config" != x""; then
47 echo "Setting config flags = $sim_config" 6>&1
48 fi],[sim_config="std-config.h"
49 if test x"$silent" != x"yes"; then
50 echo "Setting config flags = $sim_config" 6>&1
54 AC_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";;
62 if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then
63 echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1
64 fi],[sim_decode_mechanism=""
65 if test x"$silent" != x"yes"; then
66 echo "Setting decode mechanism flags = $sim_decode_mechanism"
70 AC_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}";;
76 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
77 echo "Setting default-model flags = $sim_default_model" 6>&1
78 fi],[sim_default_model=""])dnl
81 AC_ARG_ENABLE(sim-duplicate,
82 [ --enable-sim-duplicate Expand (duplicate) semantic functions.],
83 [case "${enableval}" in
86 *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
88 if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
89 echo "Setting duplicate flags = $sim_dup" 6>&1
91 if test x"$silent" != x"yes"; then
92 echo "Setting duplicate flags = $sim_dup" 6>&1
96 AC_ARG_ENABLE(sim-endian,
97 [ --enable-sim-endian=endian Specify target byte endian orientation.],
98 [case "${enableval}" in
99 yes) case "$target" in
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";;
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";;
107 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
109 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
110 echo "Setting endian flags = $sim_endian" 6>&1
111 fi],[sim_endian=""])dnl
114 AC_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="";;
119 *) sim_filter="-F $enableval";;
121 if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
122 echo "Setting filter flags = $sim_filter" 6>&1
123 fi],[sim_filter="-F 32,f,o"
124 if test x"$silent" != x"yes"; then
125 echo "Setting filter flags = $sim_filter" 6>&1
129 AC_ARG_ENABLE(sim-float,
130 [ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
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";;
134 altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
135 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
136 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
138 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
139 echo "Setting float flags = $sim_float" 6>&1
142 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
143 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
148 AC_CACHE_CHECK([if union semun defined],
149 ac_cv_HAS_UNION_SEMUN,
151 #include <sys/types.h>
153 #include <sys/sem.h>],
155 [ac_cv_has_union_semun="yes"],
156 [ac_cv_has_union_semun="no"])
157 AC_MSG_RESULT($ac_cv_has_union_semun)
161 if test "$ac_cv_has_union_semun" = "yes"; then
162 AC_CACHE_CHECK(whether System V semaphores are supported,
167 #include <sys/types.h>
173 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
176 arg.val = 0; /* avoid implicit type cast to union */
177 if (semctl(id, 0, IPC_RMID, arg) == -1)
182 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
184 else # semun is not defined
185 AC_CACHE_CHECK(whether System V semaphores are supported,
190 #include <sys/types.h>
195 struct semid_ds *buf;
201 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
204 arg.val = 0; /* avoid implicit type cast to union */
205 if (semctl(id, 0, IPC_RMID, arg) == -1)
210 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
214 AC_CACHE_CHECK(whether System V shared memory is supported,
218 #include <sys/types.h>
222 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
225 if (shmctl(id, IPC_RMID, 0) == -1)
230 ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
233 if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
234 sim_sysv_ipc_hw=",sem,shm";
239 if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
240 AC_DEFINE(HAVE_UNION_SEMUN, 1,
241 [Define if union semun is defined in <sys/sem.h>])
245 AC_ARG_ENABLE(sim-hardware,
246 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
247 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
248 case "${enableval}" in
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}"'';;
255 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
256 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
257 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
258 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
259 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
260 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
261 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
262 if test x"$silent" != x"yes"; then
263 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
266 AC_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="";;
272 if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
273 echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
274 fi],[sim_hostbitsize=""])dnl
277 AC_ARG_ENABLE(sim-icache,
278 [ --enable-sim-icache=size Specify instruction-decode cache size and type.],
280 case "${enableval}" in
281 yes) icache="1024"; sim_icache="-I $icache";;
282 no) sim_icache="-R";;
285 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
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="";;
294 sim_icache="${sim_icache}I $icache";;
296 if test x"$silent" != x"yes" && test x"$icache" != x""; then
297 echo "Setting instruction cache size to $icache ($sim_icache)"
298 fi],[sim_icache="-CSRI 1024"
299 if test x"$silent" != x"yes"; then
300 echo "Setting instruction cache size to 1024 ($sim_icache)"
304 AC_ARG_ENABLE(sim-inline,
305 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
308 no) sim_inline="-DDEFAULT_INLINE=0";;
309 0) sim_inline="-DDEFAULT_INLINE=0";;
310 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
311 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";;
312 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
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";;
320 if test x"$sim_inline" = x""; then
321 sim_inline="$new_flag"
323 sim_inline="$sim_inline $new_flag"
327 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
328 echo "Setting inline flags = $sim_inline" 6>&1
329 fi],[if test x"$GCC" != ""; then
330 sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS"
331 if test x"$silent" != x"yes"; then
332 echo "Setting inline flags = $sim_inline" 6>&1
339 AC_ARG_ENABLE(sim-jump,
340 [ --enable-sim-jump Jump between semantic code (instead of call/return).],
341 [case "${enableval}" in
344 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
346 if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
347 echo "Setting jump flag = $sim_jump" 6>&1
349 if test x"$silent" != x"yes"; then
350 echo "Setting jump flag = $sim_jump" 6>&1
354 AC_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="";;
361 if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
362 echo "Setting warning flags = $sim_line_nr" 6>&1
363 fi],[sim_line_nr=""])dnl
366 AC_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}";;
372 if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
373 echo "Setting model flags = $sim_model" 6>&1
374 fi],[sim_model=""])dnl
377 AC_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="";;
384 if test x"$silent" != x"yes"; then
385 echo "Setting model-issue flags = $sim_model_issue" 6>&1
386 fi],[sim_model_issue=""])dnl
389 AC_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";;
396 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
398 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
399 echo "Setting monitor flags = $sim_monitor" 6>&1
400 fi],[sim_monitor=""])dnl
403 AC_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}"
412 AC_MSG_ERROR("File $enableval is not an opcode rules file");
413 sim_opcode="dc-complex"
416 if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
417 echo "Setting opcode flags = $sim_opcode" 6>&1
418 fi],[sim_opcode="dc-complex"
419 if test x"$silent" != x"yes"; then
420 echo "Setting opcode flags = $sim_opcode"
424 AC_ARG_ENABLE(sim-packages,
425 [ --enable-sim-packages=list Specify the packages to be included in the build.],
427 case "${enableval}" in
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}"'';;
434 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
435 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
436 if test x"$silent" != x"yes" && test x"$packages" != x""; then
437 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
438 fi],[packages=disklabel
439 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
440 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
441 if test x"$silent" != x"yes"; then
442 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
446 AC_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="";;
453 if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
454 echo "Setting reserved flags = $sim_reserved" 6>&1
455 fi],[sim_reserved=""])dnl
458 AC_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";;
465 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
466 echo "Setting smp flags = $sim_smp" 6>&1
467 fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
468 if test x"$silent" != x"yes"; then
469 echo "Setting smp flags = $sim_smp" 6>&1
473 AC_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";;
478 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
480 if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
481 echo "Setting switch flags = $sim_switch" 6>&1
483 if test x"$silent" != x"yes"; then
484 echo "Setting switch flags = $sim_switch" 6>&1
488 AC_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="";;
495 if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
496 echo "Setting timebase flags = $sim_timebase" 6>&1
497 fi],[sim_timebase=""])dnl
500 AC_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) ;;
507 # Enable -Werror by default when using gcc
508 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
512 if test "${ERROR_ON_WARNING}" = yes ; then
513 WERROR_CFLAGS="-Werror"
515 dnl Enable -Wno-format by default when using gcc on mingw since many
516 dnl GCC versions complain about %I64.
518 *-*-mingw32*) WERROR_CFLAGS="$WERROR_CFLAGS -Wno-format" ;;
520 AC_SUBST(WERROR_CFLAGS)
522 AC_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"`;;
529 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
530 echo "Setting warning flags = $sim_warnings" 6>&1
531 fi],[sim_warnings=""])dnl
534 AC_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";;
541 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
542 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
543 fi],[sim_xor_endian=""])dnl
549 # BFD conditionally uses zlib, so we must link it in if libbfd does, by
550 # using the same condition.
553 # BFD uses libdl when when plugins enabled.
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
566 AC_CONFIG_HEADER(config.h:config.in)
569 dnl Figure out what type of termio/termios support there is
571 AC_MSG_CHECKING(for struct termios)
572 AC_CACHE_VAL(ac_cv_termios_struct,
573 [AC_TRY_COMPILE([#include <sys/types.h>
574 #include <sys/termios.h>],
575 [static struct termios x;
581 ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
582 AC_MSG_RESULT($ac_cv_termios_struct)
583 if test $ac_cv_termios_struct = yes; then
584 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
587 if 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)])
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"
600 ac_cv_termios_cline=no
603 if 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;
614 ac_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"
620 ac_cv_termio_struct=no
623 if 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)])
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"
636 ac_cv_termio_cline=no
639 dnl Check for struct statfs
640 AC_MSG_CHECKING(for struct statfs)
641 AC_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>
646 #ifdef HAVE_SYS_MOUNT_H
647 #include <sys/mount.h>
649 #ifdef HAVE_SYS_VFS_H
652 #ifdef HAVE_SYS_STATFS_H
653 #include <sys/statfs.h>
655 [static struct statfs s;],
656 ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
657 AC_MSG_RESULT($ac_cv_struct_statfs)
658 if 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>])
663 AC_CHECK_TYPES(long long)
665 dnl Figure out if /dev/zero exists or not
667 AC_MSG_CHECKING(for /dev/zero)
668 AC_CACHE_VAL(ac_cv_devzero,
669 [AC_TRY_RUN([#include <fcntl.h>
673 int fd = open ("/dev/zero", O_RDONLY);
676 for (i = 0; i < sizeof (buf); i++)
678 if (read (fd, buf, sizeof (buf)) != sizeof (buf))
680 for (i = 0; i < sizeof (buf); i++)
684 }],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
685 AC_MSG_RESULT($ac_cv_devzero)
686 if test $ac_cv_devzero = yes; then
687 sim_devzero="-DHAVE_DEVZERO"
692 dnl Figure out if we are in the new Cygnus tree with a common directory or not
693 AC_MSG_CHECKING(for common simulator directory)
694 if test -f "${srcdir}/../common/callback.c"; then
696 sim_callback="callback.o targ-map.o"
697 sim_targ_vals="targ-vals.h targ-map.c targ-vals.def"
704 AC_MSG_CHECKING(for common simulator directory fpu implementation)
705 if test -f "${srcdir}/../common/sim-fpu.c"; then
707 sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
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.
717 if test x$host = x$build; then
718 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
725 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
726 *) realsrcdir=../${srcdir};;
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
740 AC_SUBST(CC_FOR_BUILD)
741 AC_SUBST(CFLAGS_FOR_BUILD)
746 AC_SUBST(sim_warnings)
747 AC_SUBST(sim_line_nr)
752 AC_SUBST(sim_decode_mechanism)
762 AC_SUBST(sim_xor_endian)
764 AC_SUBST(sim_igen_smp)
765 AC_SUBST(sim_bitsize)
766 AC_SUBST(sim_hostbitsize)
767 AC_SUBST(sim_timebase)
769 AC_SUBST(sim_reserved)
770 AC_SUBST(sim_monitor)
772 AC_SUBST(sim_default_model)
773 AC_SUBST(sim_model_issue)
775 AC_SUBST(sim_devzero)
776 AC_SUBST(sim_callback)
777 AC_SUBST(sim_targ_vals)
778 AC_SUBST(sim_fpu_cflags)
782 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])