--- trunk/configure 2007/10/08 16:21:34 36 +++ trunk/configure 2007/10/08 16:21:53 38 @@ -27,7 +27,7 @@ # SUCH DAMAGE. # # -# $Id: configure,v 1.245 2007/03/16 14:13:59 debug Exp $ +# $Id: configure,v 1.252 2007/04/10 17:52:27 debug Exp $ # # This is a minimal configure script, hardcoded for GXemul. This script # figures out which compiler flags will work, and creates Makefiles in @@ -49,7 +49,7 @@ # o) which compiler flags to use (overridden by setting CFLAGS) # o) X11 flags and libraries (TODO: should be possible to override # via command line options?) -# o) native code generation backend (i.e. detect host architecture) +# o) native code generation backend (i.e. detect host ABI) # # # The general philosophy regarding command line switches is that anything @@ -61,29 +61,11 @@ # Figure out if this is a stable version (0.x.x). X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` if [ z"$X" = z0. ]; then - # Stable: - ENABLEALPHA=YES - ENABLEARM=YES - ENABLEMIPS=YES - ENABLEPPC=YES - ENABLESH=YES + # Stable. + : else - # Development: + # Development. UNSTABLE=YES - ENABLEALPHA=YES - ENABLEARM=YES - ENABLEAVR=YES - ENABLEM68K=YES - ENABLEMIPS=YES - ENABLEPPC=YES - ENABLERCA180X=YES - ENABLESH=YES - ENABLESPARC=YES - ENABLETRANSPUTER=YES -fi - -if [ z"$UNSTABLE" = zYES ]; then - printf "###\n### DEVELOPMENT (UNSTABLE)\n###\n\n" fi if [ z"$*" != z ]; then @@ -91,10 +73,16 @@ for a in $*; do if [ z$a = z--disable-x ]; then NOX11=YES + else if [ z$a = z--debug ]; then + DEBUG=YES else if [ z$a = z--help ]; then printf "usage: $0 [options]\n\n" echo " --disable-x don't include X11 support,"\ "even if the host supports it" + if [ z"$UNSTABLE" = zYES ]; then + echo " --debug configure" \ + "for a debug build" + fi echo exit else @@ -102,11 +90,28 @@ echo "Run $0 --help to get a list of" \ "available options." exit - fi; fi + fi; fi; fi done fi +# Stable releases: +ENABLEARM=YES +ENABLEMIPS=YES +ENABLEPPC=YES +ENABLESH=YES + +if [ z"$UNSTABLE" = zYES ]; then + # Development: + printf "###\n### DEVELOPMENT (UNSTABLE)\n###\n### " + printf "(Enabling some archs that are not working yet.)\n###\n\n" + ENABLEALPHA=YES + ENABLEAVR=YES + ENABLEM68K=YES + ENABLESPARC=YES +fi + + ############################################################################### # # Configure options: @@ -183,10 +188,6 @@ CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" fi -if [ z$ENABLERCA180X = zYES ]; then - printf "#define ENABLE_RCA180X\n" >> config.h - CPU_ARCHS="$CPU_ARCHS cpu_rca180x.o" -fi if [ z$ENABLESH = zYES ]; then printf "#define ENABLE_SH\n" >> config.h CPU_ARCHS="$CPU_ARCHS cpu_sh.o memory_sh.o" @@ -196,10 +197,6 @@ CPU_ARCHS="$CPU_ARCHS cpu_sparc.o memory_sparc.o" CPU_TOOLS="$CPU_TOOLS generate_sparc_loadstore" fi -if [ z$ENABLETRANSPUTER = zYES ]; then - printf "#define ENABLE_TRANSPUTER\n" >> config.h - CPU_ARCHS="$CPU_ARCHS cpu_transputer.o" -fi ############################################################################### @@ -572,25 +569,32 @@ if [ z"$COMPAQCC" = zYES ]; then # -O4 is possible, but sometimes -O3 is better? - CFLAGS="-O4 $CFLAGS" + if [ ! z"$DEBUG" = zYES ]; then + CFLAGS="-O4 $CFLAGS" + fi else if [ z"`uname`" = zSunOS ]; then # "cc", the system's default compiler: - if [ z"$SUNCC" = zYES ]; then - CFLAGS="-xO5 -xdepend $CFLAGS" + if [ ! z"$DEBUG" = zYES ]; then + if [ z"$SUNCC" = zYES ]; then + CFLAGS="-xO5 -xdepend $CFLAGS" + fi fi printf "#define SOLARIS\n" >> config.h OTHERLIBS="-lsocket $OTHERLIBS" else # gcc or something else: - $CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null - if [ -x _testprog ]; then - rm -f _testprog - $CC $CFLAGS _testprog.c -o _testprog -O3 2> /dev/null + if [ ! z"$DEBUG" = zYES ]; then + $CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null if [ -x _testprog ]; then - CFLAGS="-O3 $CFLAGS" - else - CFLAGS="-O $CFLAGS" + rm -f _testprog + $CC $CFLAGS _testprog.c -o _testprog \ + -O3 2> /dev/null + if [ -x _testprog ]; then + CFLAGS="-O3 $CFLAGS" + else + CFLAGS="-O $CFLAGS" + fi fi fi fi @@ -600,7 +604,8 @@ # -fschedule-insns causes bugs on i386 with gcc, # but works OK on my alpha with ccc (compaq's cc). -if [ z"$COMPAQCC" = zYES ]; then +if [ ! z"$DEBUG" = zYES ]; then + if [ z"$COMPAQCC" = zYES ]; then printf "checking whether -fschedule-insns2 can be used... " $CC $CFLAGS _testprog.c -o _testprog -fschedule-insns2 2> /dev/null if [ -x _testprog ]; then @@ -638,42 +643,46 @@ printf "no\n" fi rm -f _testprog -fi +fi; fi # -fpeephole -printf "checking whether -fpeephole can be used... " -$CC $CFLAGS -fpeephole _testprog.c -o _testprog > _testprog.stdout 2>&1 -cat _testprog.stdout >> _testprog.error -if grep peephole _testprog.error > /dev/null 2>&1; then - printf "no\n" -else - if [ -x _testprog ]; then - CFLAGS="-fpeephole $CFLAGS" - printf "yes\n" - else +if [ ! z"$DEBUG" = zYES ]; then + printf "checking whether -fpeephole can be used... " + $CC $CFLAGS -fpeephole _testprog.c -o _testprog > _testprog.stdout 2>&1 + cat _testprog.stdout >> _testprog.error + if grep peephole _testprog.error > /dev/null 2>&1; then printf "no\n" + else + if [ -x _testprog ]; then + CFLAGS="-fpeephole $CFLAGS" + printf "yes\n" + else + printf "no\n" + fi fi + rm -f _testprog _testprog.error _testprog.stdout 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 \ - _testprog 1> _testprog.stdout 2>&1 -cat _testprog.stdout >> _testprog.error -if grep frame _testprog.error > /dev/null 2>&1; then - printf "no\n" -else - if [ -x _testprog ]; then - CFLAGS="-fomit-frame-pointer $CFLAGS" - printf "yes\n" - else +if [ ! z"$DEBUG" = zYES ]; then + printf "checking whether -fomit-frame-pointer can be used... " + $CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ + _testprog 1> _testprog.stdout 2>&1 + cat _testprog.stdout >> _testprog.error + if grep frame _testprog.error > /dev/null 2>&1; then printf "no\n" + else + if [ -x _testprog ]; then + CFLAGS="-fomit-frame-pointer $CFLAGS" + printf "yes\n" + else + printf "no\n" + fi fi + rm -f _testprog _testprog.error _testprog.stdout fi -rm -f _testprog _testprog.error _testprog.stdout # -g, for development builds @@ -748,7 +757,7 @@ # -lm? printf "checking for math libs..." printf "#include \nint main(int argc, char *argv[]) { " > _testr.c -printf "double x = sqrt((double)argc); return (int)x; }\n" >> _testr.c +printf "double x = sqrt(sin((double)argc)); return (int)x; }\n" >> _testr.c $CC $CFLAGS _testr.c -o _testr 2> /dev/null if [ ! -x _testr ]; then $CC $CFLAGS _testr.c -lm -o _testr 2> /dev/null @@ -1058,12 +1067,19 @@ ############################################################################### # -# Native code generation backend: (Detect host architecture.) +# Native code generation backend: (Detect host ABI.) # ############################################################################### if [ z$UNSTABLE = zYES ]; then - printf "native code generation backend... " + printf "detecting native code generation ABI... " + + if [ z"`uname -m`" = zalpha ]; then + NATIVE_CODE_GENERATION=YES + printf "Alpha\n" + printf "#define NATIVE_CODE_GENERATION\n" >> config.h + printf "#define HOST_ARCH_ALPHA\n" >> config.h + fi if [ z"`uname -m`" = zamd64 ]; then NATIVE_CODE_GENERATION=YES @@ -1080,7 +1096,7 @@ fi if [ z$NATIVE_CODE_GENERATION = z ]; then - printf "not yet for this host platform\n" + printf "not supported yet for this host platform\n" fi fi @@ -1107,7 +1123,7 @@ # Create the Makefiles: D=". src src/include src/cpus src/debugger src/devices src/devices/fonts" -D="$D src/disk src/machines src/native src/net src/promemul" +D="$D src/disk src/file src/machines src/native src/net src/promemul" for a in $D; do echo "creating $a/Makefile" touch $a/Makefile