1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_MACRO_DIRS([../.. ../../config])
8 AC_ARG_ENABLE(sim-bitsize,
9 [ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
10 [case "${enableval}" in
11 32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
12 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
14 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
15 echo "Setting bitsize flags = $sim_bitsize" 6>&1
16 fi],[sim_bitsize=""])dnl
19 AC_ARG_ENABLE(sim-decode-mechanism,
20 [ --enable-sim-decode-mechanism=which Specify the instruction decode mechanism.],
21 [case "${enableval}" in
22 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-decode-mechanism=file");;
23 array|switch|padded-switch|goto-switch) sim_decode_mechanism="-T ${enableval}";;
24 *) AC_MSG_ERROR("File $enableval is not an opcode rules file");
25 sim_decode_mechanism="switch";;
27 if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then
28 echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1
29 fi],[sim_decode_mechanism=""
30 if test x"$silent" != x"yes"; then
31 echo "Setting decode mechanism flags = $sim_decode_mechanism"
35 AC_ARG_ENABLE(sim-default-model,
36 [ --enable-sim-default-model=which Specify default PowerPC to model.],
37 [case "${enableval}" in
38 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-default-model=model");;
39 *) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
41 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
42 echo "Setting default-model flags = $sim_default_model" 6>&1
43 fi],[sim_default_model=""])dnl
46 AC_ARG_ENABLE(sim-duplicate,
47 [ --enable-sim-duplicate Expand (duplicate) semantic functions.],
48 [case "${enableval}" in
51 *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
53 if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
54 echo "Setting duplicate flags = $sim_dup" 6>&1
56 if test x"$silent" != x"yes"; then
57 echo "Setting duplicate flags = $sim_dup" 6>&1
61 AC_ARG_ENABLE(sim-filter,
62 [ --enable-sim-filter=rule Specify filter rules.],
63 [case "${enableval}" in
64 yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
66 *) sim_filter="-F $enableval";;
68 if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
69 echo "Setting filter flags = $sim_filter" 6>&1
70 fi],[sim_filter="-F 32,f,o"
71 if test x"$silent" != x"yes"; then
72 echo "Setting filter flags = $sim_filter" 6>&1
76 AC_ARG_ENABLE(sim-float,
77 [ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
78 [case "${enableval}" in
79 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
80 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
81 altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
82 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
83 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
85 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
86 echo "Setting float flags = $sim_float" 6>&1
89 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
90 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
95 AC_CACHE_CHECK([if union semun defined],
96 ac_cv_HAS_UNION_SEMUN,
98 #include <sys/types.h>
100 #include <sys/sem.h>],
102 [ac_cv_has_union_semun="yes"],
103 [ac_cv_has_union_semun="no"])
104 AC_MSG_RESULT($ac_cv_has_union_semun)
108 if test "$ac_cv_has_union_semun" = "yes"; then
109 AC_CACHE_CHECK(whether System V semaphores are supported,
114 #include <sys/types.h>
120 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
123 arg.val = 0; /* avoid implicit type cast to union */
124 if (semctl(id, 0, IPC_RMID, arg) == -1)
129 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
131 else # semun is not defined
132 AC_CACHE_CHECK(whether System V semaphores are supported,
137 #include <sys/types.h>
142 struct semid_ds *buf;
148 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
151 arg.val = 0; /* avoid implicit type cast to union */
152 if (semctl(id, 0, IPC_RMID, arg) == -1)
157 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
161 AC_CACHE_CHECK(whether System V shared memory is supported,
165 #include <sys/types.h>
169 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
172 if (shmctl(id, IPC_RMID, 0) == -1)
177 ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
180 if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
181 sim_sysv_ipc_hw=",sem,shm";
186 if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
187 AC_DEFINE(HAVE_UNION_SEMUN, 1,
188 [Define if union semun is defined in <sys/sem.h>])
192 AC_ARG_ENABLE(sim-hardware,
193 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
194 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
195 case "${enableval}" in
197 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
198 ,*) hardware="${hardware}${enableval}";;
199 *,) hardware="${enableval}${hardware}";;
200 *) hardware="${enableval}"'';;
202 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
203 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
204 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
205 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
206 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
207 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
208 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
209 if test x"$silent" != x"yes"; then
210 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
213 AC_ARG_ENABLE(sim-hostbitsize,
214 [ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
215 [case "${enableval}" in
216 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
217 *) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval. Expected 32 or 64"); sim_hostbitsize="";;
219 if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
220 echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
221 fi],[sim_hostbitsize=""])dnl
224 AC_ARG_ENABLE(sim-icache,
225 [ --enable-sim-icache=size Specify instruction-decode cache size and type.],
227 case "${enableval}" in
228 yes) icache="1024"; sim_icache="-I $icache";;
229 no) sim_icache="-R";;
232 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
234 define) sim_icache="${sim_icache}R";;
235 semantic) sim_icache="${sim_icache}C";;
236 insn) sim_icache="${sim_icache}S";;
237 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
238 *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
241 sim_icache="${sim_icache}I $icache";;
243 if test x"$silent" != x"yes" && test x"$icache" != x""; then
244 echo "Setting instruction cache size to $icache ($sim_icache)"
245 fi],[sim_icache="-CSRI 1024"
246 if test x"$silent" != x"yes"; then
247 echo "Setting instruction cache size to 1024 ($sim_icache)"
251 AC_ARG_ENABLE(sim-jump,
252 [ --enable-sim-jump Jump between semantic code (instead of call/return).],
253 [case "${enableval}" in
256 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
258 if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
259 echo "Setting jump flag = $sim_jump" 6>&1
261 if test x"$silent" != x"yes"; then
262 echo "Setting jump flag = $sim_jump" 6>&1
266 AC_ARG_ENABLE(sim-line-nr,
267 [ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
268 [case "${enableval}" in
269 yes) sim_line_nr="";;
270 no) sim_line_nr="-L";;
271 *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
273 if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
274 echo "Setting warning flags = $sim_line_nr" 6>&1
275 fi],[sim_line_nr=""])dnl
278 AC_ARG_ENABLE(sim-model,
279 [ --enable-sim-model=which Specify PowerPC to model.],
280 [case "${enableval}" in
281 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
282 *) sim_model="-DWITH_MODEL=${enableval}";;
284 if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
285 echo "Setting model flags = $sim_model" 6>&1
286 fi],[sim_model=""])dnl
289 AC_ARG_ENABLE(sim-model-issue,
290 [ --enable-sim-model-issue Specify whether to simulate model specific actions],
291 [case "${enableval}" in
292 yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
293 no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
294 *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
296 if test x"$silent" != x"yes"; then
297 echo "Setting model-issue flags = $sim_model_issue" 6>&1
298 fi],[sim_model_issue=""])dnl
301 AC_ARG_ENABLE(sim-monitor,
302 [ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
303 [case "${enableval}" in
304 yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
305 no) sim_monitor="-DWITH_MON=0";;
306 instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
307 memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
308 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
310 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
311 echo "Setting monitor flags = $sim_monitor" 6>&1
312 fi],[sim_monitor=""])dnl
315 AC_ARG_ENABLE(sim-opcode,
316 [ --enable-sim-opcode=which Override default opcode lookup.],
317 [case "${enableval}" in
318 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
319 *) if test -f "${srcdir}/${enableval}"; then
320 sim_opcode="${enableval}"
321 elif test -f "${srcdir}/dc-${enableval}"; then
322 sim_opcode="dc-${enableval}"
324 AC_MSG_ERROR("File $enableval is not an opcode rules file");
325 sim_opcode="dc-complex"
328 if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
329 echo "Setting opcode flags = $sim_opcode" 6>&1
330 fi],[sim_opcode="dc-complex"
331 if test x"$silent" != x"yes"; then
332 echo "Setting opcode flags = $sim_opcode"
336 AC_ARG_ENABLE(sim-packages,
337 [ --enable-sim-packages=list Specify the packages to be included in the build.],
339 case "${enableval}" in
341 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
342 ,*) packages="${packages}${enableval}";;
343 *,) packages="${enableval}${packages}";;
344 *) packages="${enableval}"'';;
346 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
347 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
348 if test x"$silent" != x"yes" && test x"$packages" != x""; then
349 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
350 fi],[packages=disklabel
351 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
352 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
353 if test x"$silent" != x"yes"; then
354 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
358 AC_ARG_ENABLE(sim-smp,
359 [ --enable-sim-smp=n Specify number of processors to configure for.],
360 [case "${enableval}" in
361 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
362 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
363 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
365 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
366 echo "Setting smp flags = $sim_smp" 6>&1
367 fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
368 if test x"$silent" != x"yes"; then
369 echo "Setting smp flags = $sim_smp" 6>&1
373 AC_ARG_ENABLE(sim-switch,
374 [ --enable-sim-switch Use a switch instead of a table for instruction call.],
375 [case "${enableval}" in
376 yes) sim_switch="-s";;
378 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
380 if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
381 echo "Setting switch flags = $sim_switch" 6>&1
383 if test x"$silent" != x"yes"; then
384 echo "Setting switch flags = $sim_switch" 6>&1
388 AC_ARG_ENABLE(sim-timebase,
389 [ --enable-sim-timebase Specify whether the PPC timebase is supported.],
390 [case "${enableval}" in
391 yes) sim_timebase="-DWITH_TIME_BASE=1";;
392 no) sim_timebase="-DWITH_TIME_BASE=0";;
393 *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
395 if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
396 echo "Setting timebase flags = $sim_timebase" 6>&1
397 fi],[sim_timebase=""])dnl
400 AC_ARG_ENABLE(sim-xor-endian,
401 [ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
402 [case "${enableval}" in
403 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
404 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
405 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
407 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
408 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
409 fi],[sim_xor_endian=""])dnl
414 AC_DEFINE(USE_WIN32API, 1,
415 [Define if we should use the Windows API, instead of the
416 POSIX API. On Windows, we use the Windows API when
417 building for MinGW, but the POSIX API when building
422 AC_CONFIG_HEADER(config.h:config.in)
425 dnl Figure out what type of termio/termios support there is
427 AC_MSG_CHECKING(for struct termios)
428 AC_CACHE_VAL(ac_cv_termios_struct,
429 [AC_TRY_COMPILE([#include <sys/types.h>
430 #include <sys/termios.h>],
431 [static struct termios x;
437 ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
438 AC_MSG_RESULT($ac_cv_termios_struct)
439 if test $ac_cv_termios_struct = yes; then
440 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
443 if test "$ac_cv_termios_struct" = "yes"; then
444 AC_MSG_CHECKING(for c_line field in struct termios)
445 AC_CACHE_VAL(ac_cv_termios_cline,
446 [AC_TRY_COMPILE([#include <sys/types.h>
447 #include <sys/termios.h>],
448 [static struct termios x; x.c_line = 0;],
449 ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
451 AC_MSG_RESULT($ac_cv_termios_cline)
452 if test $ac_cv_termios_cline = yes; then
453 sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
456 ac_cv_termios_cline=no
459 if test "$ac_cv_termios_struct" != "yes"; then
460 AC_MSG_CHECKING(for struct termio)
461 AC_CACHE_VAL(ac_cv_termio_struct,
462 [AC_TRY_COMPILE([#include <sys/types.h>
463 #include <sys/termio.h>],
464 [static struct termio x;
470 ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
471 AC_MSG_RESULT($ac_cv_termio_struct)
472 if test $ac_cv_termio_struct = yes; then
473 sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
476 ac_cv_termio_struct=no
479 if test "$ac_cv_termio_struct" = "yes"; then
480 AC_MSG_CHECKING(for c_line field in struct termio)
481 AC_CACHE_VAL(ac_cv_termio_cline,
482 [AC_TRY_COMPILE([#include <sys/types.h>
483 #include <sys/termio.h>],
484 [static struct termio x; x.c_line = 0;],
485 ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
487 AC_MSG_RESULT($ac_cv_termio_cline)
488 if test $ac_cv_termio_cline = yes; then
489 sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
492 ac_cv_termio_cline=no
495 dnl Check for struct statfs
496 AC_MSG_CHECKING(for struct statfs)
497 AC_CACHE_VAL(ac_cv_struct_statfs,
498 [AC_TRY_COMPILE([#include <sys/types.h>
499 #ifdef HAVE_SYS_PARAM_H
500 #include <sys/param.h>
502 #ifdef HAVE_SYS_MOUNT_H
503 #include <sys/mount.h>
505 #ifdef HAVE_SYS_VFS_H
508 #ifdef HAVE_SYS_STATFS_H
509 #include <sys/statfs.h>
511 [static struct statfs s;],
512 ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
513 AC_MSG_RESULT($ac_cv_struct_statfs)
514 if test $ac_cv_struct_statfs = yes; then
515 AC_DEFINE(HAVE_STRUCT_STATFS, 1,
516 [Define if struct statfs is defined in <sys/mount.h>])
519 AC_CHECK_TYPES(long long)
521 dnl Figure out if /dev/zero exists or not
523 AC_MSG_CHECKING(for /dev/zero)
524 AC_CACHE_VAL(ac_cv_devzero,
525 [AC_TRY_RUN([#include <fcntl.h>
529 int fd = open ("/dev/zero", O_RDONLY);
532 for (i = 0; i < sizeof (buf); i++)
534 if (read (fd, buf, sizeof (buf)) != sizeof (buf))
536 for (i = 0; i < sizeof (buf); i++)
540 }],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
541 AC_MSG_RESULT($ac_cv_devzero)
542 if test $ac_cv_devzero = yes; then
543 sim_devzero="-DHAVE_DEVZERO"
548 # Since we run commands on the build system, we have to create a
549 # separate config header for the build system if build != host.
550 if test x$host = x$build; then
551 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
558 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
559 *) realsrcdir=../${srcdir};;
561 saved_CFLAGS="${CFLAGS}"
562 # Put a plausible default for CC_FOR_BUILD in Makefile.
563 if test "x$cross_compiling" = "xno"; then
568 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD-${CFLAGS}}" \
569 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
570 ${realsrcdir}/configure \
571 --enable-languages=${enable_languages-all} \
572 --target=$target_alias --host=$build_alias --build=$build_alias
573 CFLAGS="${saved_CFLAGS}"
574 mv config.h ../build-config.h
579 AC_SUBST(sim_line_nr)
583 AC_SUBST(sim_decode_mechanism)
591 AC_SUBST(sim_xor_endian)
593 AC_SUBST(sim_igen_smp)
594 AC_SUBST(sim_bitsize)
595 AC_SUBST(sim_hostbitsize)
596 AC_SUBST(sim_timebase)
598 AC_SUBST(sim_monitor)
600 AC_SUBST(sim_default_model)
601 AC_SUBST(sim_model_issue)
603 AC_SUBST(sim_devzero)
606 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])