1dnl Process this file with autoconf to produce a configure script. 2AC_INIT(Makefile.in) 3AC_CONFIG_MACRO_DIRS([../.. ../../config]) 4 5AC_PROG_INSTALL 6AC_PROG_CC 7 8dnl The sim shouldn't be checking $target and changing behavior. But it is, 9dnl and until we clean that up, we need to expand --target for use below. 10AC_CANONICAL_SYSTEM 11 12AC_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="";; 17esac 18if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then 19 echo "Setting bitsize flags = $sim_bitsize" 6>&1 20fi],[sim_bitsize=""])dnl 21 22 23AC_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";; 30esac 31if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then 32 echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1 33fi],[sim_decode_mechanism="" 34if test x"$silent" != x"yes"; then 35 echo "Setting decode mechanism flags = $sim_decode_mechanism" 36fi])dnl 37 38 39AC_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}";; 44esac 45if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then 46 echo "Setting default-model flags = $sim_default_model" 6>&1 47fi],[sim_default_model=""])dnl 48 49 50AC_ARG_ENABLE(sim-duplicate, 51[ --enable-sim-duplicate Expand (duplicate) semantic functions.], 52[case "${enableval}" in 53 yes) sim_dup="-E";; 54 no) sim_dup="";; 55 *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";; 56esac 57if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then 58 echo "Setting duplicate flags = $sim_dup" 6>&1 59fi],[sim_dup="-E" 60if test x"$silent" != x"yes"; then 61 echo "Setting duplicate flags = $sim_dup" 6>&1 62fi])dnl 63 64 65AC_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="";; 69 no) sim_filter="";; 70 *) sim_filter="-F $enableval";; 71esac 72if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then 73 echo "Setting filter flags = $sim_filter" 6>&1 74fi],[sim_filter="-F 32,f,o" 75if test x"$silent" != x"yes"; then 76 echo "Setting filter flags = $sim_filter" 6>&1 77fi])dnl 78 79 80AC_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="";; 88esac 89if test x"$silent" != x"yes" && test x"$sim_float" != x""; then 90 echo "Setting float flags = $sim_float" 6>&1 91fi],[ 92case "${target}" in 93 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;; 94 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;; 95 *) sim_float="" 96esac 97])dnl 98 99AC_CACHE_CHECK([if union semun defined], 100 ac_cv_HAS_UNION_SEMUN, 101 [AC_TRY_COMPILE([ 102#include <sys/types.h> 103#include <sys/ipc.h> 104#include <sys/sem.h>], 105[union semun arg ;], 106[ac_cv_has_union_semun="yes"], 107[ac_cv_has_union_semun="no"]) 108AC_MSG_RESULT($ac_cv_has_union_semun) 109]) 110 111 112if test "$ac_cv_has_union_semun" = "yes"; then 113 AC_CACHE_CHECK(whether System V semaphores are supported, 114 ac_cv_sysv_sem, 115 [ 116 AC_TRY_RUN( 117 [ 118 #include <sys/types.h> 119 #include <sys/ipc.h> 120 #include <sys/sem.h> 121 int main () { 122 union semun arg ; 123 124 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); 125 if (id == -1) 126 exit(1); 127 arg.val = 0; /* avoid implicit type cast to union */ 128 if (semctl(id, 0, IPC_RMID, arg) == -1) 129 exit(1); 130 exit(0); 131 } 132 ], 133 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :) 134 ]) 135else # semun is not defined 136 AC_CACHE_CHECK(whether System V semaphores are supported, 137 ac_cv_sysv_sem, 138 [ 139 AC_TRY_RUN( 140 [ 141 #include <sys/types.h> 142 #include <sys/ipc.h> 143 #include <sys/sem.h> 144 union semun { 145 int val; 146 struct semid_ds *buf; 147 ushort *array; 148 }; 149 int main () { 150 union semun arg ; 151 152 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); 153 if (id == -1) 154 exit(1); 155 arg.val = 0; /* avoid implicit type cast to union */ 156 if (semctl(id, 0, IPC_RMID, arg) == -1) 157 exit(1); 158 exit(0); 159 } 160 ], 161 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :) 162 ]) 163fi 164 165AC_CACHE_CHECK(whether System V shared memory is supported, 166ac_cv_sysv_shm, 167[ 168AC_TRY_RUN([ 169#include <sys/types.h> 170#include <sys/ipc.h> 171#include <sys/shm.h> 172int main () { 173 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400); 174 if (id == -1) 175 exit(1); 176 if (shmctl(id, IPC_RMID, 0) == -1) 177 exit(1); 178 exit(0); 179} 180], 181ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :) 182]) 183 184if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then 185 sim_sysv_ipc_hw=",sem,shm"; 186else 187 sim_sysv_ipc_hw=""; 188fi 189 190if 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>]) 193fi 194 195 196AC_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}" 199case "${enableval}" in 200 yes) ;; 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}"'';; 205esac 206sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` 207sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` 208if test x"$silent" != x"yes" && test x"$hardware" != x""; then 209 echo "Setting hardware to $sim_hw_src, $sim_hw_obj" 210fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}" 211sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` 212sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` 213if test x"$silent" != x"yes"; then 214 echo "Setting hardware to $sim_hw_src, $sim_hw_obj" 215fi])dnl 216 217 218AC_ARG_ENABLE(sim-icache, 219[ --enable-sim-icache=size Specify instruction-decode cache size and type.], 220[icache="-R" 221 case "${enableval}" in 222 yes) icache="1024"; sim_icache="-I $icache";; 223 no) sim_icache="-R";; 224 *) icache=1024 225 sim_icache="-" 226 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do 227 case "$x" in 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="";; 233 esac 234 done 235 sim_icache="${sim_icache}I $icache";; 236esac 237if test x"$silent" != x"yes" && test x"$icache" != x""; then 238 echo "Setting instruction cache size to $icache ($sim_icache)" 239fi],[sim_icache="-CSRI 1024" 240if test x"$silent" != x"yes"; then 241 echo "Setting instruction cache size to 1024 ($sim_icache)" 242fi])dnl 243 244 245AC_ARG_ENABLE(sim-jump, 246[ --enable-sim-jump Jump between semantic code (instead of call/return).], 247[case "${enableval}" in 248 yes) sim_jump="-J";; 249 no) sim_jump="";; 250 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";; 251esac 252if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then 253 echo "Setting jump flag = $sim_jump" 6>&1 254fi],[sim_jump="" 255if test x"$silent" != x"yes"; then 256 echo "Setting jump flag = $sim_jump" 6>&1 257fi])dnl 258 259 260AC_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="";; 266esac 267if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then 268 echo "Setting warning flags = $sim_line_nr" 6>&1 269fi],[sim_line_nr=""])dnl 270 271 272AC_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}";; 277esac 278if test x"$silent" != x"yes" && test x"$sim_model" != x""; then 279 echo "Setting model flags = $sim_model" 6>&1 280fi],[sim_model=""])dnl 281 282 283AC_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="";; 289esac 290if test x"$silent" != x"yes"; then 291 echo "Setting model-issue flags = $sim_model_issue" 6>&1 292fi],[sim_model_issue=""])dnl 293 294 295AC_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");; 303esac 304if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then 305 echo "Setting monitor flags = $sim_monitor" 6>&1 306fi],[sim_monitor=""])dnl 307 308 309AC_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}" 317 else 318 AC_MSG_ERROR("File $enableval is not an opcode rules file"); 319 sim_opcode="dc-complex" 320 fi;; 321esac 322if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then 323 echo "Setting opcode flags = $sim_opcode" 6>&1 324fi],[sim_opcode="dc-complex" 325if test x"$silent" != x"yes"; then 326 echo "Setting opcode flags = $sim_opcode" 327fi])dnl 328 329 330AC_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";; 336esac 337if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then 338 echo "Setting smp flags = $sim_smp" 6>&1 339fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5" 340if test x"$silent" != x"yes"; then 341 echo "Setting smp flags = $sim_smp" 6>&1 342fi])dnl 343 344 345AC_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="-s";; 349 no) sim_switch="";; 350 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";; 351esac 352if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then 353 echo "Setting switch flags = $sim_switch" 6>&1 354fi],[sim_switch=""; 355if test x"$silent" != x"yes"; then 356 echo "Setting switch flags = $sim_switch" 6>&1 357fi])dnl 358 359 360AC_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="";; 366esac 367if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then 368 echo "Setting timebase flags = $sim_timebase" 6>&1 369fi],[sim_timebase=""])dnl 370 371 372AC_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";; 378esac 379if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then 380 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1 381fi],[sim_xor_endian=""])dnl 382 383 384AC_CONFIG_HEADER(config.h:config.in) 385 386 387dnl Figure out what type of termio/termios support there is 388sim_termio="" 389AC_MSG_CHECKING(for struct termios) 390AC_CACHE_VAL(ac_cv_termios_struct, 391[AC_TRY_COMPILE([#include <sys/types.h> 392#include <sys/termios.h>], 393[static struct termios x; 394 x.c_iflag = 0; 395 x.c_oflag = 0; 396 x.c_cflag = 0; 397 x.c_lflag = 0; 398 x.c_cc[NCCS] = 0;], 399ac_cv_termios_struct=yes, ac_cv_termios_struct=no)]) 400AC_MSG_RESULT($ac_cv_termios_struct) 401if test $ac_cv_termios_struct = yes; then 402 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE" 403fi 404 405if 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)]) 412 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" 416 fi 417else 418 ac_cv_termios_cline=no 419fi 420 421if 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; 427 x.c_iflag = 0; 428 x.c_oflag = 0; 429 x.c_cflag = 0; 430 x.c_lflag = 0; 431 x.c_cc[NCC] = 0;], 432ac_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" 436 fi 437else 438 ac_cv_termio_struct=no 439fi 440 441if 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)]) 448 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" 452 fi 453else 454 ac_cv_termio_cline=no 455fi 456 457dnl Check for struct statfs 458AC_MSG_CHECKING(for struct statfs) 459AC_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> 463#endif 464#ifdef HAVE_SYS_MOUNT_H 465#include <sys/mount.h> 466#endif 467#ifdef HAVE_SYS_VFS_H 468#include <sys/vfs.h> 469#endif 470#ifdef HAVE_SYS_STATFS_H 471#include <sys/statfs.h> 472#endif], 473[static struct statfs s;], 474ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)]) 475AC_MSG_RESULT($ac_cv_struct_statfs) 476if 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>]) 479fi 480 481AC_CHECK_TYPES(long long) 482 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. 485if test x$host = x$build; then 486 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h]) 487else 488 tempdir=build.$$ 489 rm -rf $tempdir 490 mkdir $tempdir 491 cd $tempdir 492 case ${srcdir} in 493 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};; 494 *) realsrcdir=../${srcdir};; 495 esac 496 saved_CFLAGS="${CFLAGS}" 497 # Put a plausible default for CC_FOR_BUILD in Makefile. 498 if test "x$cross_compiling" = "xno"; then 499 CC_FOR_BUILD='$(CC)' 500 else 501 CC_FOR_BUILD=gcc 502 fi 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 510 cd .. 511 rm -rf $tempdir 512fi 513 514AC_SUBST(sim_line_nr) 515AC_SUBST(sim_opcode) 516AC_SUBST(sim_switch) 517AC_SUBST(sim_dup) 518AC_SUBST(sim_decode_mechanism) 519AC_SUBST(sim_jump) 520AC_SUBST(sim_filter) 521AC_SUBST(sim_icache) 522AC_SUBST(sim_hw_src) 523AC_SUBST(sim_hw_obj) 524AC_SUBST(sim_xor_endian) 525AC_SUBST(sim_smp) 526AC_SUBST(sim_igen_smp) 527AC_SUBST(sim_bitsize) 528AC_SUBST(sim_hostbitsize) 529AC_SUBST(sim_timebase) 530AC_SUBST(sim_float) 531AC_SUBST(sim_monitor) 532AC_SUBST(sim_model) 533AC_SUBST(sim_default_model) 534AC_SUBST(sim_model_issue) 535AC_SUBST(sim_termio) 536 537AC_OUTPUT(Makefile, 538[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) 539