1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_MACRO_DIRS([../.. ../../config])
8 dnl The sim shouldn't be checking $target and changing behavior. But it is,
9 dnl and until we clean that up, we need to expand --target for use below.
12 AC_ARG_ENABLE(sim-bitsize,
13 [ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
14 [case "${enableval}" in
15 32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
16 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
18 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
19 echo "Setting bitsize flags = $sim_bitsize" 6>&1
20 fi],[sim_bitsize=""])dnl
23 AC_ARG_ENABLE(sim-decode-mechanism,
24 [ --enable-sim-decode-mechanism=which Specify the instruction decode mechanism.],
25 [case "${enableval}" in
26 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-decode-mechanism=file");;
27 array|switch|padded-switch|goto-switch) sim_decode_mechanism="-T ${enableval}";;
28 *) AC_MSG_ERROR("File $enableval is not an opcode rules file");
29 sim_decode_mechanism="switch";;
31 if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then
32 echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1
33 fi],[sim_decode_mechanism=""
34 if test x"$silent" != x"yes"; then
35 echo "Setting decode mechanism flags = $sim_decode_mechanism"
39 AC_ARG_ENABLE(sim-default-model,
40 [ --enable-sim-default-model=which Specify default PowerPC to model.],
41 [case "${enableval}" in
42 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-default-model=model");;
43 *) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
45 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
46 echo "Setting default-model flags = $sim_default_model" 6>&1
47 fi],[sim_default_model=""])dnl
50 AC_ARG_ENABLE(sim-duplicate,
51 [ --enable-sim-duplicate Expand (duplicate) semantic functions.],
52 [case "${enableval}" in
55 *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
57 if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
58 echo "Setting duplicate flags = $sim_dup" 6>&1
60 if test x"$silent" != x"yes"; then
61 echo "Setting duplicate flags = $sim_dup" 6>&1
65 AC_ARG_ENABLE(sim-filter,
66 [ --enable-sim-filter=rule Specify filter rules.],
67 [case "${enableval}" in
68 yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
70 *) sim_filter="-F $enableval";;
72 if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
73 echo "Setting filter flags = $sim_filter" 6>&1
74 fi],[sim_filter="-F 32,f,o"
75 if test x"$silent" != x"yes"; then
76 echo "Setting filter flags = $sim_filter" 6>&1
80 AC_ARG_ENABLE(sim-float,
81 [ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
82 [case "${enableval}" in
83 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
84 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
85 altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
86 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
87 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
89 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
90 echo "Setting float flags = $sim_float" 6>&1
93 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
94 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
99 AC_CACHE_CHECK([if union semun defined],
100 ac_cv_HAS_UNION_SEMUN,
102 #include <sys/types.h>
104 #include <sys/sem.h>],
106 [ac_cv_has_union_semun="yes"],
107 [ac_cv_has_union_semun="no"])
108 AC_MSG_RESULT($ac_cv_has_union_semun)
112 if test "$ac_cv_has_union_semun" = "yes"; then
113 AC_CACHE_CHECK(whether System V semaphores are supported,
118 #include <sys/types.h>
124 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
127 arg.val = 0; /* avoid implicit type cast to union */
128 if (semctl(id, 0, IPC_RMID, arg) == -1)
133 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
135 else # semun is not defined
136 AC_CACHE_CHECK(whether System V semaphores are supported,
141 #include <sys/types.h>
146 struct semid_ds *buf;
152 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
155 arg.val = 0; /* avoid implicit type cast to union */
156 if (semctl(id, 0, IPC_RMID, arg) == -1)
161 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
165 AC_CACHE_CHECK(whether System V shared memory is supported,
169 #include <sys/types.h>
173 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
176 if (shmctl(id, IPC_RMID, 0) == -1)
181 ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
184 if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
185 sim_sysv_ipc_hw=",sem,shm";
190 if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
191 AC_DEFINE(HAVE_UNION_SEMUN, 1,
192 [Define if union semun is defined in <sys/sem.h>])
196 AC_ARG_ENABLE(sim-hardware,
197 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
198 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
199 case "${enableval}" in
201 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
202 ,*) hardware="${hardware}${enableval}";;
203 *,) hardware="${enableval}${hardware}";;
204 *) hardware="${enableval}"'';;
206 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
207 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
208 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
209 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
210 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
211 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
212 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
213 if test x"$silent" != x"yes"; then
214 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
217 AC_ARG_ENABLE(sim-hostbitsize,
218 [ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
219 [case "${enableval}" in
220 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
221 *) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval. Expected 32 or 64"); sim_hostbitsize="";;
223 if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
224 echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
225 fi],[sim_hostbitsize=""])dnl
228 AC_ARG_ENABLE(sim-icache,
229 [ --enable-sim-icache=size Specify instruction-decode cache size and type.],
231 case "${enableval}" in
232 yes) icache="1024"; sim_icache="-I $icache";;
233 no) sim_icache="-R";;
236 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
238 define) sim_icache="${sim_icache}R";;
239 semantic) sim_icache="${sim_icache}C";;
240 insn) sim_icache="${sim_icache}S";;
241 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
242 *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
245 sim_icache="${sim_icache}I $icache";;
247 if test x"$silent" != x"yes" && test x"$icache" != x""; then
248 echo "Setting instruction cache size to $icache ($sim_icache)"
249 fi],[sim_icache="-CSRI 1024"
250 if test x"$silent" != x"yes"; then
251 echo "Setting instruction cache size to 1024 ($sim_icache)"
255 AC_ARG_ENABLE(sim-jump,
256 [ --enable-sim-jump Jump between semantic code (instead of call/return).],
257 [case "${enableval}" in
260 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
262 if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
263 echo "Setting jump flag = $sim_jump" 6>&1
265 if test x"$silent" != x"yes"; then
266 echo "Setting jump flag = $sim_jump" 6>&1
270 AC_ARG_ENABLE(sim-line-nr,
271 [ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
272 [case "${enableval}" in
273 yes) sim_line_nr="";;
274 no) sim_line_nr="-L";;
275 *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
277 if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
278 echo "Setting warning flags = $sim_line_nr" 6>&1
279 fi],[sim_line_nr=""])dnl
282 AC_ARG_ENABLE(sim-model,
283 [ --enable-sim-model=which Specify PowerPC to model.],
284 [case "${enableval}" in
285 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
286 *) sim_model="-DWITH_MODEL=${enableval}";;
288 if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
289 echo "Setting model flags = $sim_model" 6>&1
290 fi],[sim_model=""])dnl
293 AC_ARG_ENABLE(sim-model-issue,
294 [ --enable-sim-model-issue Specify whether to simulate model specific actions],
295 [case "${enableval}" in
296 yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
297 no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
298 *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
300 if test x"$silent" != x"yes"; then
301 echo "Setting model-issue flags = $sim_model_issue" 6>&1
302 fi],[sim_model_issue=""])dnl
305 AC_ARG_ENABLE(sim-monitor,
306 [ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
307 [case "${enableval}" in
308 yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
309 no) sim_monitor="-DWITH_MON=0";;
310 instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
311 memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
312 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
314 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
315 echo "Setting monitor flags = $sim_monitor" 6>&1
316 fi],[sim_monitor=""])dnl
319 AC_ARG_ENABLE(sim-opcode,
320 [ --enable-sim-opcode=which Override default opcode lookup.],
321 [case "${enableval}" in
322 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
323 *) if test -f "${srcdir}/${enableval}"; then
324 sim_opcode="${enableval}"
325 elif test -f "${srcdir}/dc-${enableval}"; then
326 sim_opcode="dc-${enableval}"
328 AC_MSG_ERROR("File $enableval is not an opcode rules file");
329 sim_opcode="dc-complex"
332 if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
333 echo "Setting opcode flags = $sim_opcode" 6>&1
334 fi],[sim_opcode="dc-complex"
335 if test x"$silent" != x"yes"; then
336 echo "Setting opcode flags = $sim_opcode"
340 AC_ARG_ENABLE(sim-smp,
341 [ --enable-sim-smp=n Specify number of processors to configure for.],
342 [case "${enableval}" in
343 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
344 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
345 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
347 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
348 echo "Setting smp flags = $sim_smp" 6>&1
349 fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
350 if test x"$silent" != x"yes"; then
351 echo "Setting smp flags = $sim_smp" 6>&1
355 AC_ARG_ENABLE(sim-switch,
356 [ --enable-sim-switch Use a switch instead of a table for instruction call.],
357 [case "${enableval}" in
358 yes) sim_switch="-s";;
360 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
362 if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
363 echo "Setting switch flags = $sim_switch" 6>&1
365 if test x"$silent" != x"yes"; then
366 echo "Setting switch flags = $sim_switch" 6>&1
370 AC_ARG_ENABLE(sim-timebase,
371 [ --enable-sim-timebase Specify whether the PPC timebase is supported.],
372 [case "${enableval}" in
373 yes) sim_timebase="-DWITH_TIME_BASE=1";;
374 no) sim_timebase="-DWITH_TIME_BASE=0";;
375 *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
377 if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
378 echo "Setting timebase flags = $sim_timebase" 6>&1
379 fi],[sim_timebase=""])dnl
382 AC_ARG_ENABLE(sim-xor-endian,
383 [ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
384 [case "${enableval}" in
385 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
386 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
387 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
389 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
390 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
391 fi],[sim_xor_endian=""])dnl
396 AC_DEFINE(USE_WIN32API, 1,
397 [Define if we should use the Windows API, instead of the
398 POSIX API. On Windows, we use the Windows API when
399 building for MinGW, but the POSIX API when building
404 AC_CONFIG_HEADER(config.h:config.in)
407 dnl Figure out what type of termio/termios support there is
409 AC_MSG_CHECKING(for struct termios)
410 AC_CACHE_VAL(ac_cv_termios_struct,
411 [AC_TRY_COMPILE([#include <sys/types.h>
412 #include <sys/termios.h>],
413 [static struct termios x;
419 ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
420 AC_MSG_RESULT($ac_cv_termios_struct)
421 if test $ac_cv_termios_struct = yes; then
422 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
425 if test "$ac_cv_termios_struct" = "yes"; then
426 AC_MSG_CHECKING(for c_line field in struct termios)
427 AC_CACHE_VAL(ac_cv_termios_cline,
428 [AC_TRY_COMPILE([#include <sys/types.h>
429 #include <sys/termios.h>],
430 [static struct termios x; x.c_line = 0;],
431 ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
433 AC_MSG_RESULT($ac_cv_termios_cline)
434 if test $ac_cv_termios_cline = yes; then
435 sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
438 ac_cv_termios_cline=no
441 if test "$ac_cv_termios_struct" != "yes"; then
442 AC_MSG_CHECKING(for struct termio)
443 AC_CACHE_VAL(ac_cv_termio_struct,
444 [AC_TRY_COMPILE([#include <sys/types.h>
445 #include <sys/termio.h>],
446 [static struct termio x;
452 ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
453 AC_MSG_RESULT($ac_cv_termio_struct)
454 if test $ac_cv_termio_struct = yes; then
455 sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
458 ac_cv_termio_struct=no
461 if test "$ac_cv_termio_struct" = "yes"; then
462 AC_MSG_CHECKING(for c_line field in struct termio)
463 AC_CACHE_VAL(ac_cv_termio_cline,
464 [AC_TRY_COMPILE([#include <sys/types.h>
465 #include <sys/termio.h>],
466 [static struct termio x; x.c_line = 0;],
467 ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
469 AC_MSG_RESULT($ac_cv_termio_cline)
470 if test $ac_cv_termio_cline = yes; then
471 sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
474 ac_cv_termio_cline=no
477 dnl Check for struct statfs
478 AC_MSG_CHECKING(for struct statfs)
479 AC_CACHE_VAL(ac_cv_struct_statfs,
480 [AC_TRY_COMPILE([#include <sys/types.h>
481 #ifdef HAVE_SYS_PARAM_H
482 #include <sys/param.h>
484 #ifdef HAVE_SYS_MOUNT_H
485 #include <sys/mount.h>
487 #ifdef HAVE_SYS_VFS_H
490 #ifdef HAVE_SYS_STATFS_H
491 #include <sys/statfs.h>
493 [static struct statfs s;],
494 ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
495 AC_MSG_RESULT($ac_cv_struct_statfs)
496 if test $ac_cv_struct_statfs = yes; then
497 AC_DEFINE(HAVE_STRUCT_STATFS, 1,
498 [Define if struct statfs is defined in <sys/mount.h>])
501 AC_CHECK_TYPES(long long)
503 dnl Figure out if /dev/zero exists or not
505 AC_MSG_CHECKING(for /dev/zero)
506 AC_CACHE_VAL(ac_cv_devzero,
507 [AC_TRY_RUN([#include <fcntl.h>
511 int fd = open ("/dev/zero", O_RDONLY);
514 for (i = 0; i < sizeof (buf); i++)
516 if (read (fd, buf, sizeof (buf)) != sizeof (buf))
518 for (i = 0; i < sizeof (buf); i++)
522 }],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
523 AC_MSG_RESULT($ac_cv_devzero)
524 if test $ac_cv_devzero = yes; then
525 sim_devzero="-DHAVE_DEVZERO"
530 # Since we run commands on the build system, we have to create a
531 # separate config header for the build system if build != host.
532 if test x$host = x$build; then
533 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
540 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
541 *) realsrcdir=../${srcdir};;
543 saved_CFLAGS="${CFLAGS}"
544 # Put a plausible default for CC_FOR_BUILD in Makefile.
545 if test "x$cross_compiling" = "xno"; then
550 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD-${CFLAGS}}" \
551 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
552 ${realsrcdir}/configure \
553 --enable-languages=${enable_languages-all} \
554 --target=$target_alias --host=$build_alias --build=$build_alias
555 CFLAGS="${saved_CFLAGS}"
556 mv config.h ../build-config.h
561 AC_SUBST(sim_line_nr)
565 AC_SUBST(sim_decode_mechanism)
571 AC_SUBST(sim_xor_endian)
573 AC_SUBST(sim_igen_smp)
574 AC_SUBST(sim_bitsize)
575 AC_SUBST(sim_hostbitsize)
576 AC_SUBST(sim_timebase)
578 AC_SUBST(sim_monitor)
580 AC_SUBST(sim_default_model)
581 AC_SUBST(sim_model_issue)
583 AC_SUBST(sim_devzero)
586 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])