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_MSG_CHECKING([whether to enable sim asserts])
24 AC_ARG_ENABLE(sim-assert,
25 [ --enable-sim-assert Specify whether to perform random assertions.],
26 [case "${enableval}" in
29 *) AC_MSG_ERROR([--enable-sim-assert does not take a value]);;
31 AC_DEFINE_UNQUOTED([WITH_ASSERT], [$sim_assert], [Sim assert settings])
32 AC_MSG_RESULT($sim_assert)
35 AC_ARG_ENABLE(sim-bitsize,
36 [ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
37 [case "${enableval}" in
38 32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
39 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
41 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
42 echo "Setting bitsize flags = $sim_bitsize" 6>&1
43 fi],[sim_bitsize=""])dnl
46 AC_ARG_ENABLE(sim-config,
47 [ --enable-sim-config=file Override default config file],
48 [case "${enableval}" in
49 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-config=file");;
50 *) if test -f "${srcdir}/${enableval}"; then
51 sim_config="${enableval}";
52 elif test -f "${srcdir}/${enableval}-config.h"; then
53 sim_config="${enableval}-config.h"
55 AC_MSG_ERROR("Config file $enableval was not found");
56 sim_config=std-config.h
59 if test x"$silent" != x"yes" && test x"$sim_config" != x""; then
60 echo "Setting config flags = $sim_config" 6>&1
61 fi],[sim_config="std-config.h"
62 if test x"$silent" != x"yes"; then
63 echo "Setting config flags = $sim_config" 6>&1
67 AC_ARG_ENABLE(sim-decode-mechanism,
68 [ --enable-sim-decode-mechanism=which Specify the instruction decode mechanism.],
69 [case "${enableval}" in
70 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-decode-mechanism=file");;
71 array|switch|padded-switch|goto-switch) sim_decode_mechanism="-T ${enableval}";;
72 *) AC_MSG_ERROR("File $enableval is not an opcode rules file");
73 sim_decode_mechanism="switch";;
75 if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then
76 echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1
77 fi],[sim_decode_mechanism=""
78 if test x"$silent" != x"yes"; then
79 echo "Setting decode mechanism flags = $sim_decode_mechanism"
83 AC_ARG_ENABLE(sim-default-model,
84 [ --enable-sim-default-model=which Specify default PowerPC to model.],
85 [case "${enableval}" in
86 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-default-model=model");;
87 *) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
89 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
90 echo "Setting default-model flags = $sim_default_model" 6>&1
91 fi],[sim_default_model=""])dnl
94 AC_ARG_ENABLE(sim-duplicate,
95 [ --enable-sim-duplicate Expand (duplicate) semantic functions.],
96 [case "${enableval}" in
99 *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
101 if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
102 echo "Setting duplicate flags = $sim_dup" 6>&1
104 if test x"$silent" != x"yes"; then
105 echo "Setting duplicate flags = $sim_dup" 6>&1
109 AC_ARG_ENABLE(sim-endian,
110 [ --enable-sim-endian=endian Specify target byte endian orientation.],
111 [case "${enableval}" in
112 yes) case "$target" in
113 *powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
114 *powerpcle-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
115 *) echo "Unknown target $target" 1>&6; sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
117 no) sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
118 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
119 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
120 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
122 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
123 echo "Setting endian flags = $sim_endian" 6>&1
124 fi],[sim_endian=""])dnl
127 AC_ARG_ENABLE(sim-filter,
128 [ --enable-sim-filter=rule Specify filter rules.],
129 [case "${enableval}" in
130 yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
132 *) sim_filter="-F $enableval";;
134 if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
135 echo "Setting filter flags = $sim_filter" 6>&1
136 fi],[sim_filter="-F 32,f,o"
137 if test x"$silent" != x"yes"; then
138 echo "Setting filter flags = $sim_filter" 6>&1
142 AC_ARG_ENABLE(sim-float,
143 [ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
144 [case "${enableval}" in
145 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
146 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
147 altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
148 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
149 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
151 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
152 echo "Setting float flags = $sim_float" 6>&1
155 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
156 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
161 AC_CACHE_CHECK([if union semun defined],
162 ac_cv_HAS_UNION_SEMUN,
164 #include <sys/types.h>
166 #include <sys/sem.h>],
168 [ac_cv_has_union_semun="yes"],
169 [ac_cv_has_union_semun="no"])
170 AC_MSG_RESULT($ac_cv_has_union_semun)
174 if test "$ac_cv_has_union_semun" = "yes"; then
175 AC_CACHE_CHECK(whether System V semaphores are supported,
180 #include <sys/types.h>
186 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
189 arg.val = 0; /* avoid implicit type cast to union */
190 if (semctl(id, 0, IPC_RMID, arg) == -1)
195 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
197 else # semun is not defined
198 AC_CACHE_CHECK(whether System V semaphores are supported,
203 #include <sys/types.h>
208 struct semid_ds *buf;
214 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
217 arg.val = 0; /* avoid implicit type cast to union */
218 if (semctl(id, 0, IPC_RMID, arg) == -1)
223 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
227 AC_CACHE_CHECK(whether System V shared memory is supported,
231 #include <sys/types.h>
235 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
238 if (shmctl(id, IPC_RMID, 0) == -1)
243 ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
246 if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
247 sim_sysv_ipc_hw=",sem,shm";
252 if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
253 AC_DEFINE(HAVE_UNION_SEMUN, 1,
254 [Define if union semun is defined in <sys/sem.h>])
258 AC_ARG_ENABLE(sim-hardware,
259 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
260 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
261 case "${enableval}" in
263 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
264 ,*) hardware="${hardware}${enableval}";;
265 *,) hardware="${enableval}${hardware}";;
266 *) hardware="${enableval}"'';;
268 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
269 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
270 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
271 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
272 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
273 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
274 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
275 if test x"$silent" != x"yes"; then
276 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
279 AC_ARG_ENABLE(sim-hostbitsize,
280 [ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
281 [case "${enableval}" in
282 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
283 *) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval. Expected 32 or 64"); sim_hostbitsize="";;
285 if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
286 echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
287 fi],[sim_hostbitsize=""])dnl
290 AC_ARG_ENABLE(sim-icache,
291 [ --enable-sim-icache=size Specify instruction-decode cache size and type.],
293 case "${enableval}" in
294 yes) icache="1024"; sim_icache="-I $icache";;
295 no) sim_icache="-R";;
298 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
300 define) sim_icache="${sim_icache}R";;
301 semantic) sim_icache="${sim_icache}C";;
302 insn) sim_icache="${sim_icache}S";;
303 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
304 *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
307 sim_icache="${sim_icache}I $icache";;
309 if test x"$silent" != x"yes" && test x"$icache" != x""; then
310 echo "Setting instruction cache size to $icache ($sim_icache)"
311 fi],[sim_icache="-CSRI 1024"
312 if test x"$silent" != x"yes"; then
313 echo "Setting instruction cache size to 1024 ($sim_icache)"
317 AC_ARG_ENABLE(sim-inline,
318 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
321 no) sim_inline="-DDEFAULT_INLINE=0";;
322 0) sim_inline="-DDEFAULT_INLINE=0";;
323 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
324 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";;
325 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
328 *_INLINE=*) new_flag="-D$x";;
329 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
330 *_INLINE) new_flag="-D$x=ALL_INLINE";;
331 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
333 if test x"$sim_inline" = x""; then
334 sim_inline="$new_flag"
336 sim_inline="$sim_inline $new_flag"
340 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
341 echo "Setting inline flags = $sim_inline" 6>&1
342 fi],[if test x"$GCC" != ""; then
343 sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS"
344 if test x"$silent" != x"yes"; then
345 echo "Setting inline flags = $sim_inline" 6>&1
352 AC_ARG_ENABLE(sim-jump,
353 [ --enable-sim-jump Jump between semantic code (instead of call/return).],
354 [case "${enableval}" in
357 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
359 if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
360 echo "Setting jump flag = $sim_jump" 6>&1
362 if test x"$silent" != x"yes"; then
363 echo "Setting jump flag = $sim_jump" 6>&1
367 AC_ARG_ENABLE(sim-line-nr,
368 [ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
369 [case "${enableval}" in
370 yes) sim_line_nr="";;
371 no) sim_line_nr="-L";;
372 *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
374 if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
375 echo "Setting warning flags = $sim_line_nr" 6>&1
376 fi],[sim_line_nr=""])dnl
379 AC_ARG_ENABLE(sim-model,
380 [ --enable-sim-model=which Specify PowerPC to model.],
381 [case "${enableval}" in
382 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
383 *) sim_model="-DWITH_MODEL=${enableval}";;
385 if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
386 echo "Setting model flags = $sim_model" 6>&1
387 fi],[sim_model=""])dnl
390 AC_ARG_ENABLE(sim-model-issue,
391 [ --enable-sim-model-issue Specify whether to simulate model specific actions],
392 [case "${enableval}" in
393 yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
394 no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
395 *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
397 if test x"$silent" != x"yes"; then
398 echo "Setting model-issue flags = $sim_model_issue" 6>&1
399 fi],[sim_model_issue=""])dnl
402 AC_ARG_ENABLE(sim-monitor,
403 [ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
404 [case "${enableval}" in
405 yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
406 no) sim_monitor="-DWITH_MON=0";;
407 instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
408 memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
409 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
411 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
412 echo "Setting monitor flags = $sim_monitor" 6>&1
413 fi],[sim_monitor=""])dnl
416 AC_ARG_ENABLE(sim-opcode,
417 [ --enable-sim-opcode=which Override default opcode lookup.],
418 [case "${enableval}" in
419 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
420 *) if test -f "${srcdir}/${enableval}"; then
421 sim_opcode="${enableval}"
422 elif test -f "${srcdir}/dc-${enableval}"; then
423 sim_opcode="dc-${enableval}"
425 AC_MSG_ERROR("File $enableval is not an opcode rules file");
426 sim_opcode="dc-complex"
429 if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
430 echo "Setting opcode flags = $sim_opcode" 6>&1
431 fi],[sim_opcode="dc-complex"
432 if test x"$silent" != x"yes"; then
433 echo "Setting opcode flags = $sim_opcode"
437 AC_ARG_ENABLE(sim-packages,
438 [ --enable-sim-packages=list Specify the packages to be included in the build.],
440 case "${enableval}" in
442 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
443 ,*) packages="${packages}${enableval}";;
444 *,) packages="${enableval}${packages}";;
445 *) packages="${enableval}"'';;
447 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
448 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
449 if test x"$silent" != x"yes" && test x"$packages" != x""; then
450 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
451 fi],[packages=disklabel
452 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
453 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
454 if test x"$silent" != x"yes"; then
455 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
459 AC_ARG_ENABLE(sim-reserved-bits,
460 [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
461 [case "${enableval}" in
462 yes) sim_reserved="-DWITH_RESERVED_BITS=1";;
463 no) sim_reserved="-DWITH_RESERVED_BITS=0";;
464 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved="";;
466 if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
467 echo "Setting reserved flags = $sim_reserved" 6>&1
468 fi],[sim_reserved=""])dnl
471 AC_ARG_ENABLE(sim-smp,
472 [ --enable-sim-smp=n Specify number of processors to configure for.],
473 [case "${enableval}" in
474 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
475 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
476 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
478 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
479 echo "Setting smp flags = $sim_smp" 6>&1
480 fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
481 if test x"$silent" != x"yes"; then
482 echo "Setting smp flags = $sim_smp" 6>&1
486 AC_ARG_ENABLE(sim-switch,
487 [ --enable-sim-switch Use a switch instead of a table for instruction call.],
488 [case "${enableval}" in
489 yes) sim_switch="-s";;
491 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
493 if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
494 echo "Setting switch flags = $sim_switch" 6>&1
496 if test x"$silent" != x"yes"; then
497 echo "Setting switch flags = $sim_switch" 6>&1
501 AC_ARG_ENABLE(sim-timebase,
502 [ --enable-sim-timebase Specify whether the PPC timebase is supported.],
503 [case "${enableval}" in
504 yes) sim_timebase="-DWITH_TIME_BASE=1";;
505 no) sim_timebase="-DWITH_TIME_BASE=0";;
506 *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
508 if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
509 echo "Setting timebase flags = $sim_timebase" 6>&1
510 fi],[sim_timebase=""])dnl
513 AC_ARG_ENABLE(werror,
514 AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
515 [case "${enableval}" in
516 yes | y) ERROR_ON_WARNING="yes" ;;
517 no | n) ERROR_ON_WARNING="no" ;;
518 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
520 # Enable -Werror by default when using gcc
521 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
525 if test "${ERROR_ON_WARNING}" = yes ; then
526 WERROR_CFLAGS="-Werror"
528 dnl Enable -Wno-format by default when using gcc on mingw since many
529 dnl GCC versions complain about %I64.
531 *-*-mingw32*) WERROR_CFLAGS="$WERROR_CFLAGS -Wno-format" ;;
533 AC_SUBST(WERROR_CFLAGS)
535 AC_ARG_ENABLE(sim-warnings,
536 [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o],
537 [case "${enableval}" in
538 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
539 no) sim_warnings="-w";;
540 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
542 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
543 echo "Setting warning flags = $sim_warnings" 6>&1
544 fi],[sim_warnings=""])dnl
547 AC_ARG_ENABLE(sim-xor-endian,
548 [ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
549 [case "${enableval}" in
550 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
551 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
552 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
554 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
555 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
556 fi],[sim_xor_endian=""])dnl
562 # BFD conditionally uses zlib, so we must link it in if libbfd does, by
563 # using the same condition.
566 # BFD uses libdl when when plugins enabled.
571 AC_DEFINE(USE_WIN32API, 1,
572 [Define if we should use the Windows API, instead of the
573 POSIX API. On Windows, we use the Windows API when
574 building for MinGW, but the POSIX API when building
579 AC_CONFIG_HEADER(config.h:config.in)
582 dnl Figure out what type of termio/termios support there is
584 AC_MSG_CHECKING(for struct termios)
585 AC_CACHE_VAL(ac_cv_termios_struct,
586 [AC_TRY_COMPILE([#include <sys/types.h>
587 #include <sys/termios.h>],
588 [static struct termios x;
594 ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
595 AC_MSG_RESULT($ac_cv_termios_struct)
596 if test $ac_cv_termios_struct = yes; then
597 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
600 if test "$ac_cv_termios_struct" = "yes"; then
601 AC_MSG_CHECKING(for c_line field in struct termios)
602 AC_CACHE_VAL(ac_cv_termios_cline,
603 [AC_TRY_COMPILE([#include <sys/types.h>
604 #include <sys/termios.h>],
605 [static struct termios x; x.c_line = 0;],
606 ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
608 AC_MSG_RESULT($ac_cv_termios_cline)
609 if test $ac_cv_termios_cline = yes; then
610 sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
613 ac_cv_termios_cline=no
616 if test "$ac_cv_termios_struct" != "yes"; then
617 AC_MSG_CHECKING(for struct termio)
618 AC_CACHE_VAL(ac_cv_termio_struct,
619 [AC_TRY_COMPILE([#include <sys/types.h>
620 #include <sys/termio.h>],
621 [static struct termio x;
627 ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
628 AC_MSG_RESULT($ac_cv_termio_struct)
629 if test $ac_cv_termio_struct = yes; then
630 sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
633 ac_cv_termio_struct=no
636 if test "$ac_cv_termio_struct" = "yes"; then
637 AC_MSG_CHECKING(for c_line field in struct termio)
638 AC_CACHE_VAL(ac_cv_termio_cline,
639 [AC_TRY_COMPILE([#include <sys/types.h>
640 #include <sys/termio.h>],
641 [static struct termio x; x.c_line = 0;],
642 ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
644 AC_MSG_RESULT($ac_cv_termio_cline)
645 if test $ac_cv_termio_cline = yes; then
646 sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
649 ac_cv_termio_cline=no
652 dnl Check for struct statfs
653 AC_MSG_CHECKING(for struct statfs)
654 AC_CACHE_VAL(ac_cv_struct_statfs,
655 [AC_TRY_COMPILE([#include <sys/types.h>
656 #ifdef HAVE_SYS_PARAM_H
657 #include <sys/param.h>
659 #ifdef HAVE_SYS_MOUNT_H
660 #include <sys/mount.h>
662 #ifdef HAVE_SYS_VFS_H
665 #ifdef HAVE_SYS_STATFS_H
666 #include <sys/statfs.h>
668 [static struct statfs s;],
669 ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
670 AC_MSG_RESULT($ac_cv_struct_statfs)
671 if test $ac_cv_struct_statfs = yes; then
672 AC_DEFINE(HAVE_STRUCT_STATFS, 1,
673 [Define if struct statfs is defined in <sys/mount.h>])
676 AC_CHECK_TYPES(long long)
678 dnl Figure out if /dev/zero exists or not
680 AC_MSG_CHECKING(for /dev/zero)
681 AC_CACHE_VAL(ac_cv_devzero,
682 [AC_TRY_RUN([#include <fcntl.h>
686 int fd = open ("/dev/zero", O_RDONLY);
689 for (i = 0; i < sizeof (buf); i++)
691 if (read (fd, buf, sizeof (buf)) != sizeof (buf))
693 for (i = 0; i < sizeof (buf); i++)
697 }],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
698 AC_MSG_RESULT($ac_cv_devzero)
699 if test $ac_cv_devzero = yes; then
700 sim_devzero="-DHAVE_DEVZERO"
705 dnl Figure out if we are in the new Cygnus tree with a common directory or not
706 AC_MSG_CHECKING(for common simulator directory)
707 if test -f "${srcdir}/../common/callback.c"; then
709 sim_callback="callback.o targ-map.o"
710 sim_targ_vals="targ-vals.h targ-map.c targ-vals.def"
717 AC_MSG_CHECKING(for common simulator directory fpu implementation)
718 if test -f "${srcdir}/../common/sim-fpu.c"; then
720 sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
728 # Since we run commands on the build system, we have to create a
729 # separate config header for the build system if build != host.
730 if test x$host = x$build; then
731 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
738 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
739 *) realsrcdir=../${srcdir};;
741 saved_CFLAGS="${CFLAGS}"
742 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
743 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
744 ${realsrcdir}/configure \
745 --enable-languages=${enable_languages-all} \
746 --target=$target_alias --host=$build_alias --build=$build_alias
747 CFLAGS="${saved_CFLAGS}"
748 mv config.h ../build-config.h
753 dnl Check for exe extension
756 AC_SUBST(CC_FOR_BUILD)
757 AC_SUBST(CFLAGS_FOR_BUILD)
762 AC_SUBST(sim_warnings)
763 AC_SUBST(sim_line_nr)
768 AC_SUBST(sim_decode_mechanism)
778 AC_SUBST(sim_xor_endian)
780 AC_SUBST(sim_igen_smp)
781 AC_SUBST(sim_bitsize)
782 AC_SUBST(sim_hostbitsize)
783 AC_SUBST(sim_timebase)
785 AC_SUBST(sim_reserved)
786 AC_SUBST(sim_monitor)
788 AC_SUBST(sim_default_model)
789 AC_SUBST(sim_model_issue)
791 AC_SUBST(sim_devzero)
792 AC_SUBST(sim_callback)
793 AC_SUBST(sim_targ_vals)
794 AC_SUBST(sim_fpu_cflags)
798 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])