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-filter,
97 [ --enable-sim-filter=rule Specify filter rules.],
98 [case "${enableval}" in
99 yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
101 *) sim_filter="-F $enableval";;
103 if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
104 echo "Setting filter flags = $sim_filter" 6>&1
105 fi],[sim_filter="-F 32,f,o"
106 if test x"$silent" != x"yes"; then
107 echo "Setting filter flags = $sim_filter" 6>&1
111 AC_ARG_ENABLE(sim-float,
112 [ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
113 [case "${enableval}" in
114 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
115 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
116 altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
117 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
118 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
120 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
121 echo "Setting float flags = $sim_float" 6>&1
124 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
125 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
130 AC_CACHE_CHECK([if union semun defined],
131 ac_cv_HAS_UNION_SEMUN,
133 #include <sys/types.h>
135 #include <sys/sem.h>],
137 [ac_cv_has_union_semun="yes"],
138 [ac_cv_has_union_semun="no"])
139 AC_MSG_RESULT($ac_cv_has_union_semun)
143 if test "$ac_cv_has_union_semun" = "yes"; then
144 AC_CACHE_CHECK(whether System V semaphores are supported,
149 #include <sys/types.h>
155 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
158 arg.val = 0; /* avoid implicit type cast to union */
159 if (semctl(id, 0, IPC_RMID, arg) == -1)
164 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
166 else # semun is not defined
167 AC_CACHE_CHECK(whether System V semaphores are supported,
172 #include <sys/types.h>
177 struct semid_ds *buf;
183 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
186 arg.val = 0; /* avoid implicit type cast to union */
187 if (semctl(id, 0, IPC_RMID, arg) == -1)
192 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
196 AC_CACHE_CHECK(whether System V shared memory is supported,
200 #include <sys/types.h>
204 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
207 if (shmctl(id, IPC_RMID, 0) == -1)
212 ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
215 if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
216 sim_sysv_ipc_hw=",sem,shm";
221 if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
222 AC_DEFINE(HAVE_UNION_SEMUN, 1,
223 [Define if union semun is defined in <sys/sem.h>])
227 AC_ARG_ENABLE(sim-hardware,
228 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
229 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
230 case "${enableval}" in
232 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
233 ,*) hardware="${hardware}${enableval}";;
234 *,) hardware="${enableval}${hardware}";;
235 *) hardware="${enableval}"'';;
237 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
238 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
239 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
240 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
241 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
242 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
243 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
244 if test x"$silent" != x"yes"; then
245 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
248 AC_ARG_ENABLE(sim-hostbitsize,
249 [ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
250 [case "${enableval}" in
251 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
252 *) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval. Expected 32 or 64"); sim_hostbitsize="";;
254 if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
255 echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
256 fi],[sim_hostbitsize=""])dnl
259 AC_ARG_ENABLE(sim-icache,
260 [ --enable-sim-icache=size Specify instruction-decode cache size and type.],
262 case "${enableval}" in
263 yes) icache="1024"; sim_icache="-I $icache";;
264 no) sim_icache="-R";;
267 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
269 define) sim_icache="${sim_icache}R";;
270 semantic) sim_icache="${sim_icache}C";;
271 insn) sim_icache="${sim_icache}S";;
272 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
273 *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
276 sim_icache="${sim_icache}I $icache";;
278 if test x"$silent" != x"yes" && test x"$icache" != x""; then
279 echo "Setting instruction cache size to $icache ($sim_icache)"
280 fi],[sim_icache="-CSRI 1024"
281 if test x"$silent" != x"yes"; then
282 echo "Setting instruction cache size to 1024 ($sim_icache)"
286 AC_ARG_ENABLE(sim-inline,
287 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
290 no) sim_inline="-DDEFAULT_INLINE=0";;
291 0) sim_inline="-DDEFAULT_INLINE=0";;
292 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
293 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";;
294 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
297 *_INLINE=*) new_flag="-D$x";;
298 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
299 *_INLINE) new_flag="-D$x=ALL_INLINE";;
300 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
302 if test x"$sim_inline" = x""; then
303 sim_inline="$new_flag"
305 sim_inline="$sim_inline $new_flag"
309 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
310 echo "Setting inline flags = $sim_inline" 6>&1
311 fi],[if test x"$GCC" != ""; then
312 sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS"
313 if test x"$silent" != x"yes"; then
314 echo "Setting inline flags = $sim_inline" 6>&1
321 AC_ARG_ENABLE(sim-jump,
322 [ --enable-sim-jump Jump between semantic code (instead of call/return).],
323 [case "${enableval}" in
326 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
328 if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
329 echo "Setting jump flag = $sim_jump" 6>&1
331 if test x"$silent" != x"yes"; then
332 echo "Setting jump flag = $sim_jump" 6>&1
336 AC_ARG_ENABLE(sim-line-nr,
337 [ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
338 [case "${enableval}" in
339 yes) sim_line_nr="";;
340 no) sim_line_nr="-L";;
341 *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
343 if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
344 echo "Setting warning flags = $sim_line_nr" 6>&1
345 fi],[sim_line_nr=""])dnl
348 AC_ARG_ENABLE(sim-model,
349 [ --enable-sim-model=which Specify PowerPC to model.],
350 [case "${enableval}" in
351 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
352 *) sim_model="-DWITH_MODEL=${enableval}";;
354 if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
355 echo "Setting model flags = $sim_model" 6>&1
356 fi],[sim_model=""])dnl
359 AC_ARG_ENABLE(sim-model-issue,
360 [ --enable-sim-model-issue Specify whether to simulate model specific actions],
361 [case "${enableval}" in
362 yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
363 no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
364 *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
366 if test x"$silent" != x"yes"; then
367 echo "Setting model-issue flags = $sim_model_issue" 6>&1
368 fi],[sim_model_issue=""])dnl
371 AC_ARG_ENABLE(sim-monitor,
372 [ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
373 [case "${enableval}" in
374 yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
375 no) sim_monitor="-DWITH_MON=0";;
376 instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
377 memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
378 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
380 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
381 echo "Setting monitor flags = $sim_monitor" 6>&1
382 fi],[sim_monitor=""])dnl
385 AC_ARG_ENABLE(sim-opcode,
386 [ --enable-sim-opcode=which Override default opcode lookup.],
387 [case "${enableval}" in
388 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
389 *) if test -f "${srcdir}/${enableval}"; then
390 sim_opcode="${enableval}"
391 elif test -f "${srcdir}/dc-${enableval}"; then
392 sim_opcode="dc-${enableval}"
394 AC_MSG_ERROR("File $enableval is not an opcode rules file");
395 sim_opcode="dc-complex"
398 if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
399 echo "Setting opcode flags = $sim_opcode" 6>&1
400 fi],[sim_opcode="dc-complex"
401 if test x"$silent" != x"yes"; then
402 echo "Setting opcode flags = $sim_opcode"
406 AC_ARG_ENABLE(sim-packages,
407 [ --enable-sim-packages=list Specify the packages to be included in the build.],
409 case "${enableval}" in
411 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
412 ,*) packages="${packages}${enableval}";;
413 *,) packages="${enableval}${packages}";;
414 *) packages="${enableval}"'';;
416 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
417 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
418 if test x"$silent" != x"yes" && test x"$packages" != x""; then
419 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
420 fi],[packages=disklabel
421 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
422 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
423 if test x"$silent" != x"yes"; then
424 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
428 AC_ARG_ENABLE(sim-reserved-bits,
429 [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
430 [case "${enableval}" in
431 yes) sim_reserved="-DWITH_RESERVED_BITS=1";;
432 no) sim_reserved="-DWITH_RESERVED_BITS=0";;
433 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved="";;
435 if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
436 echo "Setting reserved flags = $sim_reserved" 6>&1
437 fi],[sim_reserved=""])dnl
440 AC_ARG_ENABLE(sim-smp,
441 [ --enable-sim-smp=n Specify number of processors to configure for.],
442 [case "${enableval}" in
443 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
444 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
445 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
447 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
448 echo "Setting smp flags = $sim_smp" 6>&1
449 fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
450 if test x"$silent" != x"yes"; then
451 echo "Setting smp flags = $sim_smp" 6>&1
455 AC_ARG_ENABLE(sim-switch,
456 [ --enable-sim-switch Use a switch instead of a table for instruction call.],
457 [case "${enableval}" in
458 yes) sim_switch="-s";;
460 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
462 if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
463 echo "Setting switch flags = $sim_switch" 6>&1
465 if test x"$silent" != x"yes"; then
466 echo "Setting switch flags = $sim_switch" 6>&1
470 AC_ARG_ENABLE(sim-timebase,
471 [ --enable-sim-timebase Specify whether the PPC timebase is supported.],
472 [case "${enableval}" in
473 yes) sim_timebase="-DWITH_TIME_BASE=1";;
474 no) sim_timebase="-DWITH_TIME_BASE=0";;
475 *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
477 if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
478 echo "Setting timebase flags = $sim_timebase" 6>&1
479 fi],[sim_timebase=""])dnl
482 AC_ARG_ENABLE(werror,
483 AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
484 [case "${enableval}" in
485 yes | y) ERROR_ON_WARNING="yes" ;;
486 no | n) ERROR_ON_WARNING="no" ;;
487 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
489 # Enable -Werror by default when using gcc
490 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
494 if test "${ERROR_ON_WARNING}" = yes ; then
495 WERROR_CFLAGS="-Werror"
497 dnl Enable -Wno-format by default when using gcc on mingw since many
498 dnl GCC versions complain about %I64.
500 *-*-mingw32*) WERROR_CFLAGS="$WERROR_CFLAGS -Wno-format" ;;
502 AC_SUBST(WERROR_CFLAGS)
504 AC_ARG_ENABLE(sim-warnings,
505 [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o],
506 [case "${enableval}" in
507 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
508 no) sim_warnings="-w";;
509 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
511 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
512 echo "Setting warning flags = $sim_warnings" 6>&1
513 fi],[sim_warnings=""])dnl
516 AC_ARG_ENABLE(sim-xor-endian,
517 [ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
518 [case "${enableval}" in
519 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
520 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
521 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
523 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
524 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
525 fi],[sim_xor_endian=""])dnl
531 # BFD conditionally uses zlib, so we must link it in if libbfd does, by
532 # using the same condition.
535 # BFD uses libdl when when plugins enabled.
540 AC_DEFINE(USE_WIN32API, 1,
541 [Define if we should use the Windows API, instead of the
542 POSIX API. On Windows, we use the Windows API when
543 building for MinGW, but the POSIX API when building
548 AC_CONFIG_HEADER(config.h:config.in)
551 dnl Figure out what type of termio/termios support there is
553 AC_MSG_CHECKING(for struct termios)
554 AC_CACHE_VAL(ac_cv_termios_struct,
555 [AC_TRY_COMPILE([#include <sys/types.h>
556 #include <sys/termios.h>],
557 [static struct termios x;
563 ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
564 AC_MSG_RESULT($ac_cv_termios_struct)
565 if test $ac_cv_termios_struct = yes; then
566 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
569 if test "$ac_cv_termios_struct" = "yes"; then
570 AC_MSG_CHECKING(for c_line field in struct termios)
571 AC_CACHE_VAL(ac_cv_termios_cline,
572 [AC_TRY_COMPILE([#include <sys/types.h>
573 #include <sys/termios.h>],
574 [static struct termios x; x.c_line = 0;],
575 ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
577 AC_MSG_RESULT($ac_cv_termios_cline)
578 if test $ac_cv_termios_cline = yes; then
579 sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
582 ac_cv_termios_cline=no
585 if test "$ac_cv_termios_struct" != "yes"; then
586 AC_MSG_CHECKING(for struct termio)
587 AC_CACHE_VAL(ac_cv_termio_struct,
588 [AC_TRY_COMPILE([#include <sys/types.h>
589 #include <sys/termio.h>],
590 [static struct termio x;
596 ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
597 AC_MSG_RESULT($ac_cv_termio_struct)
598 if test $ac_cv_termio_struct = yes; then
599 sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
602 ac_cv_termio_struct=no
605 if test "$ac_cv_termio_struct" = "yes"; then
606 AC_MSG_CHECKING(for c_line field in struct termio)
607 AC_CACHE_VAL(ac_cv_termio_cline,
608 [AC_TRY_COMPILE([#include <sys/types.h>
609 #include <sys/termio.h>],
610 [static struct termio x; x.c_line = 0;],
611 ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
613 AC_MSG_RESULT($ac_cv_termio_cline)
614 if test $ac_cv_termio_cline = yes; then
615 sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
618 ac_cv_termio_cline=no
621 dnl Check for struct statfs
622 AC_MSG_CHECKING(for struct statfs)
623 AC_CACHE_VAL(ac_cv_struct_statfs,
624 [AC_TRY_COMPILE([#include <sys/types.h>
625 #ifdef HAVE_SYS_PARAM_H
626 #include <sys/param.h>
628 #ifdef HAVE_SYS_MOUNT_H
629 #include <sys/mount.h>
631 #ifdef HAVE_SYS_VFS_H
634 #ifdef HAVE_SYS_STATFS_H
635 #include <sys/statfs.h>
637 [static struct statfs s;],
638 ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
639 AC_MSG_RESULT($ac_cv_struct_statfs)
640 if test $ac_cv_struct_statfs = yes; then
641 AC_DEFINE(HAVE_STRUCT_STATFS, 1,
642 [Define if struct statfs is defined in <sys/mount.h>])
645 AC_CHECK_TYPES(long long)
647 dnl Figure out if /dev/zero exists or not
649 AC_MSG_CHECKING(for /dev/zero)
650 AC_CACHE_VAL(ac_cv_devzero,
651 [AC_TRY_RUN([#include <fcntl.h>
655 int fd = open ("/dev/zero", O_RDONLY);
658 for (i = 0; i < sizeof (buf); i++)
660 if (read (fd, buf, sizeof (buf)) != sizeof (buf))
662 for (i = 0; i < sizeof (buf); i++)
666 }],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
667 AC_MSG_RESULT($ac_cv_devzero)
668 if test $ac_cv_devzero = yes; then
669 sim_devzero="-DHAVE_DEVZERO"
674 dnl Figure out if we are in the new Cygnus tree with a common directory or not
675 AC_MSG_CHECKING(for common simulator directory)
676 if test -f "${srcdir}/../common/callback.c"; then
678 sim_callback="callback.o targ-map.o"
679 sim_targ_vals="targ-vals.h targ-map.c targ-vals.def"
686 AC_MSG_CHECKING(for common simulator directory fpu implementation)
687 if test -f "${srcdir}/../common/sim-fpu.c"; then
689 sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
697 # Since we run commands on the build system, we have to create a
698 # separate config header for the build system if build != host.
699 if test x$host = x$build; then
700 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
707 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
708 *) realsrcdir=../${srcdir};;
710 saved_CFLAGS="${CFLAGS}"
711 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
712 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
713 ${realsrcdir}/configure \
714 --enable-languages=${enable_languages-all} \
715 --target=$target_alias --host=$build_alias --build=$build_alias
716 CFLAGS="${saved_CFLAGS}"
717 mv config.h ../build-config.h
722 AC_SUBST(CC_FOR_BUILD)
723 AC_SUBST(CFLAGS_FOR_BUILD)
728 AC_SUBST(sim_warnings)
729 AC_SUBST(sim_line_nr)
734 AC_SUBST(sim_decode_mechanism)
743 AC_SUBST(sim_xor_endian)
745 AC_SUBST(sim_igen_smp)
746 AC_SUBST(sim_bitsize)
747 AC_SUBST(sim_hostbitsize)
748 AC_SUBST(sim_timebase)
750 AC_SUBST(sim_reserved)
751 AC_SUBST(sim_monitor)
753 AC_SUBST(sim_default_model)
754 AC_SUBST(sim_model_issue)
756 AC_SUBST(sim_devzero)
757 AC_SUBST(sim_callback)
758 AC_SUBST(sim_targ_vals)
759 AC_SUBST(sim_fpu_cflags)
763 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])