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"
218 AC_ARG_ENABLE(sim-icache,
219 [ --enable-sim-icache=size Specify instruction-decode cache size and type.],
221 case "${enableval}" in
222 yes) icache="1024"; sim_icache="-I $icache";;
223 no) sim_icache="-R";;
226 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
228 define) sim_icache="${sim_icache}R";;
229 semantic) sim_icache="${sim_icache}C";;
230 insn) sim_icache="${sim_icache}S";;
231 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
232 *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
235 sim_icache="${sim_icache}I $icache";;
237 if test x"$silent" != x"yes" && test x"$icache" != x""; then
238 echo "Setting instruction cache size to $icache ($sim_icache)"
239 fi],[sim_icache="-CSRI 1024"
240 if test x"$silent" != x"yes"; then
241 echo "Setting instruction cache size to 1024 ($sim_icache)"
245 AC_ARG_ENABLE(sim-jump,
246 [ --enable-sim-jump Jump between semantic code (instead of call/return).],
247 [case "${enableval}" in
250 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
252 if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
253 echo "Setting jump flag = $sim_jump" 6>&1
255 if test x"$silent" != x"yes"; then
256 echo "Setting jump flag = $sim_jump" 6>&1
260 AC_ARG_ENABLE(sim-line-nr,
261 [ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
262 [case "${enableval}" in
263 yes) sim_line_nr="";;
264 no) sim_line_nr="-L";;
265 *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
267 if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
268 echo "Setting warning flags = $sim_line_nr" 6>&1
269 fi],[sim_line_nr=""])dnl
272 AC_ARG_ENABLE(sim-model,
273 [ --enable-sim-model=which Specify PowerPC to model.],
274 [case "${enableval}" in
275 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
276 *) sim_model="-DWITH_MODEL=${enableval}";;
278 if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
279 echo "Setting model flags = $sim_model" 6>&1
280 fi],[sim_model=""])dnl
283 AC_ARG_ENABLE(sim-model-issue,
284 [ --enable-sim-model-issue Specify whether to simulate model specific actions],
285 [case "${enableval}" in
286 yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
287 no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
288 *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
290 if test x"$silent" != x"yes"; then
291 echo "Setting model-issue flags = $sim_model_issue" 6>&1
292 fi],[sim_model_issue=""])dnl
295 AC_ARG_ENABLE(sim-monitor,
296 [ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
297 [case "${enableval}" in
298 yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
299 no) sim_monitor="-DWITH_MON=0";;
300 instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
301 memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
302 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
304 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
305 echo "Setting monitor flags = $sim_monitor" 6>&1
306 fi],[sim_monitor=""])dnl
309 AC_ARG_ENABLE(sim-opcode,
310 [ --enable-sim-opcode=which Override default opcode lookup.],
311 [case "${enableval}" in
312 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
313 *) if test -f "${srcdir}/${enableval}"; then
314 sim_opcode="${enableval}"
315 elif test -f "${srcdir}/dc-${enableval}"; then
316 sim_opcode="dc-${enableval}"
318 AC_MSG_ERROR("File $enableval is not an opcode rules file");
319 sim_opcode="dc-complex"
322 if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
323 echo "Setting opcode flags = $sim_opcode" 6>&1
324 fi],[sim_opcode="dc-complex"
325 if test x"$silent" != x"yes"; then
326 echo "Setting opcode flags = $sim_opcode"
330 AC_ARG_ENABLE(sim-smp,
331 [ --enable-sim-smp=n Specify number of processors to configure for.],
332 [case "${enableval}" in
333 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
334 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
335 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
337 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
338 echo "Setting smp flags = $sim_smp" 6>&1
339 fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
340 if test x"$silent" != x"yes"; then
341 echo "Setting smp flags = $sim_smp" 6>&1
345 AC_ARG_ENABLE(sim-switch,
346 [ --enable-sim-switch Use a switch instead of a table for instruction call.],
347 [case "${enableval}" in
348 yes) sim_switch="-DWITH_SPREG_SWITCH_TABLE";;
350 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
352 if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
353 echo "Setting switch flags = $sim_switch" 6>&1
355 if test x"$silent" != x"yes"; then
356 echo "Setting switch flags = $sim_switch" 6>&1
360 AC_ARG_ENABLE(sim-timebase,
361 [ --enable-sim-timebase Specify whether the PPC timebase is supported.],
362 [case "${enableval}" in
363 yes) sim_timebase="-DWITH_TIME_BASE=1";;
364 no) sim_timebase="-DWITH_TIME_BASE=0";;
365 *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
367 if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
368 echo "Setting timebase flags = $sim_timebase" 6>&1
369 fi],[sim_timebase=""])dnl
372 AC_ARG_ENABLE(sim-xor-endian,
373 [ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
374 [case "${enableval}" in
375 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
376 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
377 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
379 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
380 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
381 fi],[sim_xor_endian=""])dnl
384 AC_CONFIG_HEADER(config.h:config.in)
387 dnl Figure out what type of termio/termios support there is
389 AC_MSG_CHECKING(for struct termios)
390 AC_CACHE_VAL(ac_cv_termios_struct,
391 [AC_TRY_COMPILE([#include <sys/types.h>
392 #include <sys/termios.h>],
393 [static struct termios x;
399 ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
400 AC_MSG_RESULT($ac_cv_termios_struct)
401 if test $ac_cv_termios_struct = yes; then
402 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
405 if test "$ac_cv_termios_struct" = "yes"; then
406 AC_MSG_CHECKING(for c_line field in struct termios)
407 AC_CACHE_VAL(ac_cv_termios_cline,
408 [AC_TRY_COMPILE([#include <sys/types.h>
409 #include <sys/termios.h>],
410 [static struct termios x; x.c_line = 0;],
411 ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
413 AC_MSG_RESULT($ac_cv_termios_cline)
414 if test $ac_cv_termios_cline = yes; then
415 sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
418 ac_cv_termios_cline=no
421 if test "$ac_cv_termios_struct" != "yes"; then
422 AC_MSG_CHECKING(for struct termio)
423 AC_CACHE_VAL(ac_cv_termio_struct,
424 [AC_TRY_COMPILE([#include <sys/types.h>
425 #include <sys/termio.h>],
426 [static struct termio x;
432 ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
433 AC_MSG_RESULT($ac_cv_termio_struct)
434 if test $ac_cv_termio_struct = yes; then
435 sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
438 ac_cv_termio_struct=no
441 if test "$ac_cv_termio_struct" = "yes"; then
442 AC_MSG_CHECKING(for c_line field in struct termio)
443 AC_CACHE_VAL(ac_cv_termio_cline,
444 [AC_TRY_COMPILE([#include <sys/types.h>
445 #include <sys/termio.h>],
446 [static struct termio x; x.c_line = 0;],
447 ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
449 AC_MSG_RESULT($ac_cv_termio_cline)
450 if test $ac_cv_termio_cline = yes; then
451 sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
454 ac_cv_termio_cline=no
457 dnl Check for struct statfs
458 AC_MSG_CHECKING(for struct statfs)
459 AC_CACHE_VAL(ac_cv_struct_statfs,
460 [AC_TRY_COMPILE([#include <sys/types.h>
461 #ifdef HAVE_SYS_PARAM_H
462 #include <sys/param.h>
464 #ifdef HAVE_SYS_MOUNT_H
465 #include <sys/mount.h>
467 #ifdef HAVE_SYS_VFS_H
470 #ifdef HAVE_SYS_STATFS_H
471 #include <sys/statfs.h>
473 [static struct statfs s;],
474 ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
475 AC_MSG_RESULT($ac_cv_struct_statfs)
476 if test $ac_cv_struct_statfs = yes; then
477 AC_DEFINE(HAVE_STRUCT_STATFS, 1,
478 [Define if struct statfs is defined in <sys/mount.h>])
481 AC_CHECK_TYPES(long long)
483 # Since we run commands on the build system, we have to create a
484 # separate config header for the build system if build != host.
485 if test x$host = x$build; then
486 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
493 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
494 *) realsrcdir=../${srcdir};;
496 saved_CFLAGS="${CFLAGS}"
497 # Put a plausible default for CC_FOR_BUILD in Makefile.
498 if test "x$cross_compiling" = "xno"; then
503 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD-${CFLAGS}}" \
504 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
505 ${realsrcdir}/configure \
506 --enable-languages=${enable_languages-all} \
507 --target=$target_alias --host=$build_alias --build=$build_alias
508 CFLAGS="${saved_CFLAGS}"
509 mv config.h ../build-config.h
514 AC_SUBST(sim_line_nr)
518 AC_SUBST(sim_decode_mechanism)
524 AC_SUBST(sim_xor_endian)
526 AC_SUBST(sim_igen_smp)
527 AC_SUBST(sim_bitsize)
528 AC_SUBST(sim_hostbitsize)
529 AC_SUBST(sim_timebase)
531 AC_SUBST(sim_monitor)
533 AC_SUBST(sim_default_model)
534 AC_SUBST(sim_model_issue)
538 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])