--- trunk/configure 2007/10/08 16:18:00 4 +++ trunk/configure 2007/10/08 16:18:27 10 @@ -27,7 +27,7 @@ # SUCH DAMAGE. # # -# $Id: configure,v 1.123 2005/04/17 01:42:21 debug Exp $ +# $Id: configure,v 1.140 2005/06/27 17:31:50 debug Exp $ # # This is a minimal configure script, hardcoded for GXemul. This script # figures out which compiler flags will work, and creates Makefiles in @@ -52,15 +52,18 @@ # o) prefetch capability (TODO: this is assumed on Alpha, but not all # Alphas have it...) # +# TODO: +# o) do not enable prefetch on Alpha ev4 or ev5, only on pca56 and newer +# o) X11 libs and includes via command line options? +# ############################################################################### -ENABLEALPHA=NO -ENABLEHPPA=NO +ENABLEARM=YES ENABLEMIPS=YES ENABLEPPC=YES -ENABLESPARC=NO ENABLEURISC=YES ENABLEX86=NO +STABLE=NO if [ z"$*" != z ]; then # Parse command line options: @@ -69,62 +72,81 @@ NOX11=YES else if [ z$a = z--always32 ]; then ALWAYS32=YES + else if [ z$a = z--tracenull ]; then + TRACENULL=YES else if [ z$a = z--disable-bintrans ]; then NOBINTRANS=YES + else if [ z$a = z--enable-bintrans ]; then + NOBINTRANS=NO + else if [ z$a = z--disable-mips16 ]; then + MIPS16=NO else if [ z$a = z--enable-mips16 ]; then MIPS16=YES - else if [ z$a = z--enable-alpha ]; then - ENABLEALPHA=YES - else if [ z$a = z--enable-hppa ]; then - ENABLEHPPA=YES + else if [ z$a = z--disable-arm ]; then + ENABLEARM=NO + else if [ z$a = z--enable-arm ]; then + ENABLEARM=YES else if [ z$a = z--disable-mips ]; then ENABLEMIPS=NO + else if [ z$a = z--enable-mips ]; then + ENABLEMIPS=YES else if [ z$a = z--disable-ppc ]; then ENABLEPPC=NO - else if [ z$a = z--enable-sparc ]; then - ENABLESPARC=YES + else if [ z$a = z--enable-ppc ]; then + ENABLEPPC=YES else if [ z$a = z--disable-urisc ]; then ENABLEURISC=NO + else if [ z$a = z--enable-urisc ]; then + ENABLEURISC=YES + else if [ z$a = z--disable-x86 ]; then + ENABLEX86=NO else if [ z$a = z--enable-x86 ]; then ENABLEX86=YES + else if [ z$a = z--disable-delays ]; then + DELAYS=NO else if [ z$a = z--enable-delays ]; then DELAYS=YES + else if [ z$a = z--disable-caches ]; then + CACHES=NO else if [ z$a = z--enable-caches ]; then CACHES=YES else if [ z$a = z--help ]; then echo "usage: $0 [options]" printf "\nDevelopment (debug) options:\n" - echo " --always32 enable" \ + echo " --always32 enable" \ "ALWAYS_SIGNEXTEND_32 (for hunting down" - echo " 32/64-bit bugs)" + echo " 32/64-bit bugs)" + echo " --tracenull enable" \ + "TRACE_NULL_CRASHES (for bug hunting)" printf "\nGeneral options:\n" - echo " --disable-bintrans configure without" \ + echo " --disable-bintrans configure without" \ "bintrans, even if the host supports it" - echo " --enable-caches enable cache emulation" \ - "(experimental)" - echo " --enable-delays enable instruction" \ + printf " --enable-caches enable cache emulation" + printf " (BUGGY)\n" + echo " --enable-delays enable instruction" \ "latency/delay emulation" - echo " --disable-x don't include X11 support" - printf "\nCPU selection options: (most of these" - printf " are experimental)\n" - echo " --enable-alpha enable Alpha CPU emulation" - echo " --enable-hppa enable HPPA CPU emulation" - echo " --disable-mips disable MIPS CPU emulation" - echo " --disable-ppc disable PPC CPU emulation" - echo " --enable-sparc enable SPARC CPU emulation" - echo " --disable-urisc disable URISC CPU emulation" - echo " --enable-x86 enable x86 CPU emulation" + echo " --disable-x don't include X11 support" + printf "\nCPU selection options:\n" + echo " --disable-arm disable ARM CPU emulation" + echo " --disable-mips disable MIPS CPU emulation" + echo " --disable-ppc disable PPC CPU emulation" + echo " --disable-urisc disable URISC CPU emulation" + if [ z$STABLE = zNO ]; then + printf " --enable-x86 " + printf "enable x86 CPU emulation" + printf " (NOT YET)\n" + fi printf "\nMIPS-specific options:\n" - echo " --enable-mips16 enable MIPS16 instruction" \ - "support (experimental)" - printf "\n" + printf " --enable-mips16 enable MIPS16 instruction" + printf " support (NOT YET)\n\n" exit else echo "Invalid option: $a" echo "Run $0 --help to get a list of" \ "available options." exit - fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi + fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi + fi; fi; fi; fi; fi; fi; fi done fi @@ -148,7 +170,7 @@ # Figure out if VERSION should be defined. X=`basename \`pwd\`|cut -d \- -f 2-` if [ z"$X" = zgxemul ]; then - echo '# No VERSION defined.' >> _Makefile.header + echo '/* No VERSION defined. */' >> config.h else printf "#define VERSION \"$X\"\n" >> config.h fi @@ -165,11 +187,8 @@ printf 'NOTE: MIPS16 support is not really working yet.\n' printf "#define ENABLE_MIPS16\n" >> config.h fi -if [ z$ENABLEALPHA = zYES ]; then - printf "#define ENABLE_ALPHA\n" >> config.h -fi -if [ z$ENABLEHPPA = zYES ]; then - printf "#define ENABLE_HPPA\n" >> config.h +if [ z$ENABLEARM = zYES ]; then + printf "#define ENABLE_ARM\n" >> config.h fi if [ z$ENABLEMIPS = zYES ]; then printf "#define ENABLE_MIPS\n" >> config.h @@ -177,14 +196,18 @@ if [ z$ENABLEPPC = zYES ]; then printf "#define ENABLE_PPC\n" >> config.h fi -if [ z$ENABLESPARC = zYES ]; then - printf "#define ENABLE_SPARC\n" >> config.h -fi if [ z$ENABLEURISC = zYES ]; then printf "#define ENABLE_URISC\n" >> config.h fi if [ z$ENABLEX86 = zYES ]; then printf "#define ENABLE_X86\n" >> config.h + if [ z$STABLE = zNO ]; then + printf "\nWARNING: X86 emulation enabled, but it isn't really" + printf " working yet.\n\n" + else + printf "Not in the stable release.\n" + exit + fi fi @@ -195,7 +218,7 @@ fi -# Instruction delay/latency emulation: +# Development option: ALWAYS_SIGNEXTEND_32 if [ z$ALWAYS32 = zYES ]; then echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ 'This slows down everything.)' @@ -203,6 +226,14 @@ fi +# Development option: TRACE_NULL_CRASHES +if [ z$TRACENULL = zYES ]; then + echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \ + 'This slows down the emulator.)' + printf "#define TRACE_NULL_CRASHES\n" >> config.h +fi + + # Cache emulation: if [ z$CACHES = zYES ]; then echo 'Enabling Cache emulation. (EXPERIMENTAL)' @@ -214,6 +245,9 @@ printf ' (--delays) will not produce correct ' printf 'cache miss penalties and such.\n' fi + + printf "\nNOTE: Cache emulation enabled, but right now it triggers " + printf "weird bugs in the\n emulator. You have been warned.\n\n" fi @@ -678,24 +712,6 @@ rm -f _testprog _testprog.error _testprog.stdout -# -fmove-all-movables -printf "checking whether -fmove-all-movables can be used... " -$CC $CFLAGS -fmove-all-movables _testprog.c -o \ - _testprog > _testprog.stdout 2>&1 -cat _testprog.stdout >> _testprog.error -if grep movables _testprog.error > /dev/null 2>&1; then - printf "no\n" -else - if [ -x _testprog ]; then - CFLAGS="-fmove-all-movables $CFLAGS" - printf "yes\n" - else - printf "no\n" - fi -fi -rm -f _testprog _testprog.error _testprog.stdout - - # -fomit-frame-pointer printf "checking whether -fomit-frame-pointer can be used... " $CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ @@ -792,6 +808,23 @@ rm -f _testr.[co] _testr +# strlcpy missing? +printf "checking for strlcpy... " +printf "#include +int main(int argc, char *argv[]) { char *p; char *q; size_t x; + x = strlcpy(p, q, 50); return 0;}\n" > _tests.c +$CC $CFLAGS _tests.c -o _tests 2> /dev/null +if [ ! -x _tests ]; then + printf "missing, using mystrlcpy\n" + printf "#define strlcpy mystrlcpy\n" >> config.h + printf "#define strlcat mystrlcat\n" >> config.h + printf "#define USE_STRLCPY_REPLACEMENTS\n" >> config.h +else + printf "found\n" +fi +rm -f _tests.[co] _tests + + # strtoull missing? printf "checking for strtoull... " printf "#include @@ -804,9 +837,24 @@ printf "missing, using mystrtoull\n" printf "#define strtoull mystrtoull\n" >> config.h else - printf "yes\n" + printf "found\n" fi -rm -f _testlong* _tests.[co] _tests +rm -f _tests.[co] _tests + + +# mkstemp missing? +printf "checking for mkstemp... " +printf "#include +int main(int argc, char *argv[]) { int x; char *y = \"abc\"; +x = mkstemp(y); return 0;}\n" > _tests.c +$CC $CFLAGS _tests.c -o _tests 2> /dev/null +if [ ! -x _tests ]; then + printf "missing, using workaround\n" + printf "#define mkstemp mymkstemp\n" >> config.h +else + printf "found\n" +fi +rm -f _tests.[co] _tests # fseeko missing? @@ -818,12 +866,12 @@ int main(int argc, char *argv[]) { fseeko(NULL, 0, 0); return 0;}\n" > _tests.c $CC $CFLAGS _tests.c -o _tests 2> /dev/null if [ ! -x _tests ]; then - printf "no\n" + printf "missing\n" printf "WARNING! fseeko missing from libc. Using a hack, " printf "which probably doesn't work.\n" printf "#define HACK_FSEEKO\n" >> config.h else - printf "yes\n" + printf "found\n" fi rm -f _tests.[co] _tests @@ -841,7 +889,7 @@ printf "no, using int\n" CFLAGS="$CFLAGS -Dsocklen_t=int" else - printf "yes\n" + printf "socklen_t\n" fi rm -f _tests.[co] _tests @@ -1052,43 +1100,6 @@ printf "Regression test setup: (not really needed to build gxemul)\n" -## 64-bit HPPA cross-assembler: -# -#HPPA='' -#if [ z$ENABLEHPPA = zYES ]; then -# printf "Checking for a GNU cross-assembler for 64-bit HPPA... " -# echo 'nop' > _testprog.s -# -# for HPPA_TRY in hppa64-unknown-elf hppa64-elf; do -# printf '#!/bin/sh\n'$HPPA_TRY'-as _testprog.s' > _test.sh -# printf ' -o _testprog.o\n' >> _test.sh -# chmod 755 _test.sh -# rm -f _testprog.o -# ./_test.sh > /dev/null 2> /dev/null -# if [ -f _testprog.o ]; then -# HPPA=$HPPA_TRY -# break -# fi -# rm -f _testprog.o -# done -# -# if [ z$HPPA = z ]; then -# echo "none" -# else -# echo $HPPA"-gcc" -# fi -#fi -#rm -f _testprog* _test.sh -# -## TODO: are these ok? 64-bit mode! -##echo "HPPA_CC="$HPPA"-gcc -g -O2 -fno-builtin -fschedule-insns" \ -## >> _Makefile.header -#echo "HPPA_AS="$HPPA"-as " >> _Makefile.header -#echo "HPPA_LD="$HPPA"-ld -Ttext 0xa800000000030000 -e main" \ -# "--oformat=elf64-bigmips" >> _Makefile.header -#echo "" >> _Makefile.header - - # 64-bit MIPS cross-compiler: MIPS=''