--- trunk/configure 2007/10/08 16:19:37 22 +++ trunk/configure 2007/10/08 16:19:56 24 @@ -27,7 +27,7 @@ # SUCH DAMAGE. # # -# $Id: configure,v 1.198 2006/02/18 13:15:20 debug Exp $ +# $Id: configure,v 1.224 2006/06/23 08:54:56 debug Exp $ # # This is a minimal configure script, hardcoded for GXemul. This script # figures out which compiler flags will work, and creates Makefiles in @@ -47,11 +47,13 @@ # o) special hacks for some OSes # o) which compiler to use (overridden by setting CC) # o) which compiler flags to use (overridden by setting CFLAGS) -# o) X11 flags and libraries (TODO: should be possible to override) -# o) binary translation (on supported platforms) +# o) X11 flags and libraries (TODO: should be possible to override +# via command line options?) # -# TODO: -# o) X11 libs and includes via command line options? +# +# The general philosophy regarding command line switches is that anything +# which can be incorporated into the program as a runtime command line option +# should be, instead of requiring a recompile. # ############################################################################### @@ -59,13 +61,13 @@ X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` if [ z"$X" = z0. ]; then # Stable: + ENABLEALPHA=YES ENABLEARM=YES ENABLEMIPS=YES ENABLEPPC=YES else # Development: UNSTABLE=YES - DYNTRANSBACKEND=NO #YES ENABLEALPHA=YES ENABLEARM=YES ENABLEAVR=YES @@ -74,7 +76,6 @@ ENABLEIA64=YES ENABLEM68K=YES ENABLEMIPS=YES - NEWMIPS=NO ENABLEPPC=YES ENABLESH=YES ENABLESPARC=YES @@ -82,7 +83,7 @@ fi if [ z"$UNSTABLE" = zYES ]; then - printf "### DEVELOPMENT (UNSTABLE)\n\n" + printf "###\n### DEVELOPMENT (UNSTABLE)\n###\n\n" fi if [ z"$*" != z ]; then @@ -90,81 +91,17 @@ for a in $*; do if [ z$a = z--disable-x ]; then 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--disable-dyntransbackend ]; then - DYNTRANSBACKEND=NO - else if [ z$a = z--enable-dyntransbackend ]; then - DYNTRANSBACKEND=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--disable-newmips ]; then - NEWMIPS=NO - else if [ z$a = z--enable-newmips ]; then - NEWMIPS=YES - else if [ z$a = z--disable-1k-pages ]; then - ONEKPAGE=NO - else if [ z$a = z--enable-1k-pages ]; then - ONEKPAGE=YES else if [ z$a = z--help ]; then - echo "usage: $0 [options]" - - printf "\nGeneral options:\n\n" - - echo " --disable-bintrans configure without the" \ - "old binary translation subsystem," - echo " even if the host" \ - "supports it" - echo " --disable-x don't include X11 support" - - printf "\nDevelopment (debug) options:\n\n" - - echo " --always32 enable ALWAYS_SIGNEXTEND_32"\ - "(for hunting down 32-bit bugs)" - printf " --enable-caches enable cache emulation" - printf " (BUGGY)\n" - echo " --enable-delays enable instruction" \ - "latency/delay emulation" - - if [ z$DYNTRANSBACKEND = zYES ]; then - printf " --disable-dyntransbackend disable " - else - printf " --enable-dyntransbackend enable" - fi - printf "dyntrans backend\n" - - echo " --enable-mips16 enable MIPS16 support" - echo " --enable-newmips use new MIPS dyntrans code" - #printf " --enable-1k-pages allow 1KB dyntrans pages" - #printf " (default: 4KB)\n" - - printf "\n(Pretty much all of these options are only" - printf " meaningful during the development of\nthe" - printf " emulator, and should not be used when " - printf "compiling a stable version.)\n" + printf "usage: $0 [options]\n\n" + echo " --disable-x don't include X11 support,"\ + "even if the host supports it" + echo 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 done fi @@ -195,20 +132,20 @@ fi +if [ z"$UNSTABLE" = zYES ]; then + printf "#define UNSTABLE_DEVEL\n" >> config.h +fi + + ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\`` printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h # Support for various CPU types: -if [ z$MIPS16 = zYES ]; then - printf 'Enabling MIPS16 support. ' - 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 - CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" + CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o memory_alpha.o" CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" fi if [ z$ENABLEARM = zYES ]; then @@ -248,10 +185,9 @@ fi if [ z$ENABLEMIPS = zYES ]; then printf "#define ENABLE_MIPS\n" >> config.h - if [ z$NEWMIPS = zYES ]; then - echo 'Enabling the _EXPERIMENTAL_ MIPS dyntrans code.' - printf "#define EXPERIMENTAL_NEWMIPS\n" >> config.h - fi + CPU_ARCHS="$CPU_ARCHS cpu_mips.o cpu_mips_coproc.o " + CPU_ARCHS="$CPU_ARCHS cpu_mips_instr_unaligned.o" + CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore" fi if [ z$ENABLEPPC = zYES ]; then printf "#define ENABLE_PPC\n" >> config.h @@ -272,43 +208,11 @@ fi -# Instruction delay/latency emulation: -if [ z$DELAYS = zYES ]; then - echo 'Enabling Instruction delay/latency emulation.' - printf "#define ENABLE_INSTRUCTION_DELAYS\n" >> config.h -fi - - -# Development option: ALWAYS_SIGNEXTEND_32 -if [ z$ALWAYS32 = zYES ]; then - echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ - 'This slows down everything.)' - printf "#define ALWAYS_SIGNEXTEND_32\n" >> config.h -fi - - -# 1KB page emulation: -if [ z$ONEKPAGE = zYES ]; then - echo '1 KB pages: not yet.' - exit - echo 'Enabling 1 KB page dyntrans support. (NOTE:' \ - 'This slows down everything.)' - printf "#define ONEKPAGE\n" >> config.h -fi - - # Cache emulation: if [ z$CACHES = zYES ]; then echo 'Enabling Cache emulation. (EXPERIMENTAL and BUGGY)' printf "#define ENABLE_CACHE_EMULATION\n" >> config.h - if [ z$DELAYS != zYES ]; then - printf 'WARNING: Cache emulation without instruction ' - printf 'delay/latency emulation\n' - 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 @@ -925,12 +829,20 @@ #include #include int main(int argc, char *argv[]) { fseeko(NULL, 0, 0); return 0;}\n" > _tests.c -$CC $CFLAGS _tests.c -o _tests 2> /dev/null +$CC $CFLAGS $CWARNINGS _tests.c -o _tests 2> /dev/null if [ ! -x _tests ]; then - 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 + # Try with _LARGEFILE_SOURCE (hack to make fseeko + # work on 64-bit Linux): + $CC $CFLAGS -D_LARGEFILE_SOURCE $CWARNINGS _tests.c -o _tests 2> /dev/null + if [ ! -x _tests ]; then + 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 "using -D_LARGEFILE_SOURCE hack\n" + CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE" + fi else printf "found\n" fi @@ -987,6 +899,47 @@ rm -f _tests.[co] _tests +# Check for PRIx64 in inttypes.h: +printf "checking for PRIx64 in inttypes.h... " +printf "#include \nint main(int argc, char *argv[])\n +{\n#ifdef PRIx64\nreturn 0;\n#else\nreturn 1;\n#endif\n}\n" > _testpri.c +$CC $CFLAGS _testpri.c -o _testpri 2> /dev/null +if [ ! -x _testpri ]; then + printf "\nERROR! COULD NOT COMPILE PRIx64 TEST PROGRAM AT ALL!\n" + exit +else + if ./_testpri; then + printf "yes\n" + else + printf "no, using an ugly hack instead, " + printf "#define NO_C99_PRINTF_DEFINES\n" >> config.h + + # Try llx first: + printf "#include \n#include \nint main(int argc, char *argv[]){ + printf(\"%%llx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c + rm -f _testpri + $CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null + if [ z`./_testpri` = z80 ]; then + printf "PRIx64=llx\n" + printf "#define NO_C99_64BIT_LONGLONG\n" >> config.h + else + # Try lx too: + printf "#include \n#include \nint main(int argc, char *argv[]){ + printf(\"%%lx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c + rm -f _testpri + $CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null + if [ z`./_testpri` = z80 ]; then + printf "PRIx64=lx\n" + else + printf "\nFailed, neither lx nor llx worked!\n" + exit + fi + fi + fi +fi +rm -f _testpri.c _testpri + + # Check for 64-bit off_t: printf "checking for 64-bit off_t... " printf "#include \n#include \n#include \n @@ -1078,127 +1031,6 @@ ############################################################################### -# -# OLD binary translation (BINTRANS): -# -############################################################################### - -printf "checking for bintrans backend... " - -BINTRANS=NO - -if [ z$ENABLEMIPS = zNO ]; then - printf "NO!\nTEMPORARY HACK/PROBLEM: Disabling bintrans for now,\n" - printf "until things have stabilized.\n" - NOBINTRANS=YES -fi - -if [ z$NOBINTRANS = zYES ]; then - printf "disabled\n" -else - # Alpha: - if [ z"`uname -m`" = zalpha ]; then - printf "#define ALPHA\n" >> config.h - printf "#define BINTRANS\n" >> config.h - printf "Alpha\n" - BINTRANS=YES - fi - - # x86: - if `uname -m|grep -v 64|grep -q 86`; then - printf "#define I386\n" >> config.h - printf "#define BINTRANS\n" >> config.h - printf "i386\n" - BINTRANS=YES - fi - -# MIPS not yet -# # MIPS: -# if [ z"`uname -m`" = zmips ]; then -# printf "#define MIPS\n" >> config.h -# printf "#define BINTRANS\n" >> config.h -# printf "MIPS\n" -# BINTRANS=YES -# fi - -# # UltraSPARC: -# if [ z"`uname -m`" = zsun4u ]; then -# printf "#define SPARCV9\n" >> config.h -# printf "#define BINTRANS\n" >> config.h -# printf "SPARC V9\n" -# BINTRANS=YES -# else -# if [ z"`uname -m`" = zsparc64 ]; then -# printf "#define SPARCV9\n" >> config.h -# printf "#define BINTRANS\n" >> config.h -# printf "SPARC V9\n" -# BINTRANS=YES -# fi -# fi - - if [ z$BINTRANS = zNO ]; then - printf "not supported yet on this arch\n" - fi -fi - - -############################################################################### -# -# Dyntrans recompilation (native backend) support: -# -############################################################################### - -if [ z$DYNTRANSBACKEND = zYES ]; then - printf "Dyntrans: Not yet.\n" - exit - - printf "checking for dyntrans backend... " - DBFOUND=NO - - # Alpha: - if [ z"`uname -m`" = zalpha ]; then - printf "#define DYNTRANS_BACKEND_ALPHA\n" >> config.h - printf "Alpha\n" - CPU_BACKENDS="$CPU_BACKENDS backend_alpha.o" - DBFOUND=YES - fi - - # AMD64: - # TODO - -# # UltraSPARC: -# if [ z"`uname -m`" = zsun4u ]; then -# printf "#define DYNTRANS_BACKEND_SPARC64\n" >> config.h -# printf "UltraSPARC\n" -# CPU_BACKENDS="$CPU_BACKENDS backend_sparc.o" -# DBFOUND=YES -# fi -# if [ z"`uname -m`" = zsparc64 ]; then -# printf "#define DYNTRANS_BACKEND_SPARC64\n" >> config.h -# printf "UltraSPARC\n" -# CPU_BACKENDS="$CPU_BACKENDS backend_sparc.o" -# DBFOUND=YES -# fi - - # x86: - if `uname -m|grep -q -v 64|grep -q 86`; then - printf "#define DYNTRANS_BACKEND_I386\n" >> config.h - printf "i386\n" - CPU_BACKENDS="$CPU_BACKENDS backend_i386.o" - DBFOUND=YES - fi - - if [ z$DBFOUND = zYES ]; then - printf "#define DYNTRANS_BACKEND\n" >> config.h - else - printf "not supported yet on this arch (" - printf `uname -m` - printf ")\n" - fi -fi - - -############################################################################### # Host byte order? printf "checking host endianness... " @@ -1239,14 +1071,13 @@ echo "CC=$CC" >> _Makefile.header echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header -echo "CPU_BACKENDS=$CPU_BACKENDS" >> _Makefile.header echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header echo "" >> _Makefile.header # Create the Makefiles: -D=". src src/include src/cpus src/devices src/devices/fonts" -D="$D src/machines src/promemul" +D=". src src/include src/cpus src/debugger src/devices src/devices/fonts" +D="$D src/machines src/promemul doc" for a in $D; do echo "creating $a/Makefile" touch $a/Makefile