--- trunk/configure 2007/10/08 16:18:31 11 +++ trunk/configure 2007/10/08 16:18:38 12 @@ -27,7 +27,7 @@ # SUCH DAMAGE. # # -# $Id: configure,v 1.140 2005/06/27 17:31:50 debug Exp $ +# $Id: configure,v 1.155 2005/08/16 05:37:08 debug Exp $ # # This is a minimal configure script, hardcoded for GXemul. This script # figures out which compiler flags will work, and creates Makefiles in @@ -58,12 +58,22 @@ # ############################################################################### -ENABLEARM=YES -ENABLEMIPS=YES -ENABLEPPC=YES -ENABLEURISC=YES -ENABLEX86=NO -STABLE=NO +# 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: + ENABLEMIPS=YES +else + # Development: + ENABLEALPHA=YES + ENABLEARM=YES + ENABLEIA64=YES + ENABLEM68K=YES + ENABLEMIPS=YES + ENABLEPPC=YES + ENABLESPARC=YES + ENABLEX86=YES +fi if [ z"$*" != z ]; then # Parse command line options: @@ -82,10 +92,22 @@ MIPS16=NO else if [ z$a = z--enable-mips16 ]; then MIPS16=YES + else if [ z$a = z--disable-alpha ]; then + ENABLEALPHA=NO + else if [ z$a = z--enable-alpha ]; then + ENABLEALPHA=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-ia64 ]; then + ENABLEIA64=NO + else if [ z$a = z--enable-ia64 ]; then + ENABLEIA64=YES + else if [ z$a = z--disable-m68k ]; then + ENABLEM68K=NO + else if [ z$a = z--enable-m68k ]; then + ENABLEM86K=YES else if [ z$a = z--disable-mips ]; then ENABLEMIPS=NO else if [ z$a = z--enable-mips ]; then @@ -94,10 +116,10 @@ ENABLEPPC=NO 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-sparc ]; then + ENABLESPARC=NO + else if [ z$a = z--enable-sparc ]; then + ENABLESPARC=YES else if [ z$a = z--disable-x86 ]; then ENABLEX86=NO else if [ z$a = z--enable-x86 ]; then @@ -112,41 +134,96 @@ CACHES=YES else if [ z$a = z--help ]; then echo "usage: $0 [options]" - printf "\nDevelopment (debug) options:\n" - echo " --always32 enable" \ - "ALWAYS_SIGNEXTEND_32 (for hunting down" - echo " 32/64-bit bugs)" + + 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)" echo " --tracenull enable" \ "TRACE_NULL_CRASHES (for bug hunting)" - printf "\nGeneral options:\n" - echo " --disable-bintrans configure without" \ - "bintrans, even if the host supports it" 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:\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" + + if [ z$ENABLEALPHA = zYES ]; then + printf " --disable-alpha disable " + else + printf " --enable-alpha enable " + fi + printf "Alpha CPU emulation\n" + + if [ z$ENABLEARM = zYES ]; then + printf " --disable-arm disable " + else + printf " --enable-arm enable " + fi + printf "ARM CPU emulation\n" + + if [ z$ENABLEIA64 = zYES ]; then + printf " --disable-ia64 disable " + else + printf " --enable-ia64 enable " + fi + printf "IA64 CPU emulation\n" + + if [ z$ENABLEM68K = zYES ]; then + printf " --disable-m68k disable " + else + printf " --enable-m68k enable " + fi + printf "M68K CPU emulation\n" + + if [ z$ENABLEMIPS = zYES ]; then + printf " --disable-mips disable " + else + printf " --enable-mips enable " + fi + printf "MIPS CPU emulation\n" + + if [ z$ENABLEPPC = zYES ]; then + printf " --disable-ppc disable " + else + printf " --enable-ppc enable " + fi + printf "POWER/PPC CPU emulation\n" + + if [ z$ENABLESPARC = zYES ]; then + printf " --disable-sparc disable " + else + printf " --enable-sparc enable " fi - printf "\nMIPS-specific options:\n" - printf " --enable-mips16 enable MIPS16 instruction" - printf " support (NOT YET)\n\n" + printf "SPARC CPU emulation\n" + + if [ z$ENABLEX86 = zYES ]; then + printf " --disable-x86 disable " + else + printf " --enable-x86 enable " + fi + printf "x86 CPU emulation\n" + + echo " --enable-mips16 enable MIPS16 support" + + 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" 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 + fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi done fi @@ -187,27 +264,36 @@ 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" +fi if [ z$ENABLEARM = zYES ]; then printf "#define ENABLE_ARM\n" >> config.h + CPU_ARCHS="$CPU_ARCHS cpu_arm.o" +fi +if [ z$ENABLEIA64 = zYES ]; then + printf "#define ENABLE_IA64\n" >> config.h + CPU_ARCHS="$CPU_ARCHS cpu_ia64.o" +fi +if [ z$ENABLEM68K = zYES ]; then + printf "#define ENABLE_M68K\n" >> config.h + CPU_ARCHS="$CPU_ARCHS cpu_m68k.o" fi if [ z$ENABLEMIPS = zYES ]; then printf "#define ENABLE_MIPS\n" >> config.h fi if [ z$ENABLEPPC = zYES ]; then printf "#define ENABLE_PPC\n" >> config.h + CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" fi -if [ z$ENABLEURISC = zYES ]; then - printf "#define ENABLE_URISC\n" >> config.h +if [ z$ENABLESPARC = zYES ]; then + printf "#define ENABLE_SPARC\n" >> config.h + CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" 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 + CPU_ARCHS="$CPU_ARCHS cpu_x86.o" fi @@ -448,8 +534,8 @@ fi -# Check for weird 'alpha' define. -printf "checking for weird 'alpha' define... " +# Check for 'alpha' define. +printf "checking for 'alpha' define... " printf "#include \nint main(int argc, char *argv[]){ #ifdef alpha printf(\"1\"); @@ -479,39 +565,8 @@ rm -f _testm* -# Check for weird 'hppa' define. -printf "checking for weird 'hppa' define... " -printf "#include \nint main(int argc, char *argv[]){ -#ifdef hppa -printf(\"1\"); -#undef hppa -#ifdef hppa -printf(\"2\"); -#endif -#endif -printf(\"\\\n\");return 0;}\n" > _testm.c -$CC $CFLAGS _testm.c -o _testm 2> /dev/null -if [ ! -x _testm ]; then - printf "\nWARNING! COULD NOT COMPILE hppa define TEST" - printf " PROGRAM AT ALL!\n" -else - if [ z`./_testm` = z1 ]; then - printf "yes, workaround applied\n" - echo "#undef hppa" >> config.h - else - if [ z`./_testm` = z12 ]; then - printf "yes, but workaround not possible\n" - exit - else - printf "no\n" - fi - fi -fi -rm -f _testm* - - # Some OSes on MIPS seems to define 'mips' to 1. (eg OpenBSD/arc) -printf "checking for weird 'mips' define... " +printf "checking for 'mips' define... " printf "#include \nint main(int argc, char *argv[]){ #ifdef mips printf(\"1\"); @@ -543,7 +598,7 @@ # Similar to the mips define check above, although I don't know if # any OS actually defined ppc like this. -printf "checking for weird 'ppc' define... " +printf "checking for 'ppc' define... " printf "#include \nint main(int argc, char *argv[]){ #ifdef ppc printf(\"1\"); @@ -575,7 +630,7 @@ # Similar to the mips define check above, although I don't know if # any OS actually defined sparc like this. -printf "checking for weird 'sparc' define... " +printf "checking for 'sparc' define... " printf "#include \nint main(int argc, char *argv[]){ #ifdef sparc printf(\"1\"); @@ -1057,6 +1112,31 @@ ############################################################################### +# Host byte order? +printf "checking host endianness... " +rm -f _test_end* +printf '#include +int main(int argc, char *argv[]) +{ int x = 1; void *xp = (void *)&x; char *p = (char *)xp; +if (*p) printf("little\\\n"); else printf("big\\\n"); } +' > _test_end.c +$CC $CFLAGS _test_end.c -o _test_end 2> /dev/null +X=`./_test_end` +echo $X +if [ z$X = zlittle ]; then + printf "#define HOST_LITTLE_ENDIAN\n" >> config.h +else + if [ z$X = zbig ]; then + printf "#define HOST_BIG_ENDIAN\n" >> config.h + else + echo "Error! Could not determine host's endianness." + exit + fi +fi +rm -f _test_end* + +############################################################################### + # Prefetch support? printf "checking for asm prefetch support... " if [ z"`uname -m`" = zalpha ]; then @@ -1086,6 +1166,8 @@ INCLUDE=-Iinclude/ DINCLUDE=-I../include/ +rm -f _testprog.c + echo C compiler flags: $CFLAGS $CWARNINGS echo Linker flags: $OTHERLIBS echo "CWARNINGS=$CWARNINGS" >> _Makefile.header @@ -1094,128 +1176,13 @@ echo "DINCLUDE=$DINCLUDE" >> _Makefile.header echo "CC=$CC" >> _Makefile.header echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header +echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header echo "" >> _Makefile.header -printf "Regression test setup: (not really needed to build gxemul)\n" - - -# 64-bit MIPS cross-compiler: - -MIPS='' -if [ z$ENABLEMIPS = zYES ]; then - printf "Checking for a GNU cross-compiler for 64-bit MIPS... " - echo 'int f(int x) { return x; }' > _testprog.c - - for MIPS_TRY in mips64-unknown-elf mips64-elf mips-unknown-elf64; do - printf '#!/bin/sh\n'$MIPS_TRY'-gcc _testprog.c -c\n' > _test.sh - chmod 755 _test.sh - rm -f _testprog.o - ./_test.sh > /dev/null 2> /dev/null - if [ -f _testprog.o ]; then - MIPS=$MIPS_TRY - break - fi - rm -f _testprog.o - done - - if [ z$MIPS = z ]; then - echo "none" - else - echo $MIPS"-gcc" - fi -fi -rm -f _testprog* _test.sh - -echo "MIPS_CC="$MIPS"-gcc -g -O2 -fno-builtin -fschedule-insns" \ - "-mips64 -mabi=64" >> _Makefile.header -echo "MIPS_AS="$MIPS"-as -mabi=64 -mips64" >> _Makefile.header -echo "MIPS_LD="$MIPS"-ld -Ttext 0xa800000000030000 -e main" \ - "--oformat=elf64-bigmips" >> _Makefile.header -echo "" >> _Makefile.header - - -## PPC64 cross-assembler: -# -#PPC='' -#if [ z$ENABLEPPC = zYES ]; then -# printf "Checking for a GNU cross-assembler for 64-bit PPC... " -# echo 'nop' > _testprog.s -# -# for a in ppc64 powerpc64; do -# for b in unknown; do -# for c in elf elf64 linux linux64 aix aix5; do -# PPC_TRY=$a-$b-$c -# printf '#!/bin/sh\n'$PPC_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 -# PPC=$PPC_TRY -# break -# fi -# rm -f _testprog.o -# done -# done -# done -# -# if [ z$PPC = z ]; then -# echo "none" -# else -# echo $PPC"-as" -# fi -#fi -#rm -f _testprog* _test.sh -# -##echo "PPC_CC="$PPC"-gcc -g -O2 -fno-builtin" >> _Makefile.header -#echo "PPC_AS="$PPC"-as" >> _Makefile.header -#echo "PPC_LD="$PPC"-ld -e main" >> _Makefile.header -#echo "" >> _Makefile.header - - -## SPARC64 cross-compiler: -# -#SPARC='' -#if [ z$ENABLESPARC = zYES ]; then -# printf "Checking for a GNU cross-compiler for 64-bit SPARC... " -# echo 'int f(int x) { return x; }' > _testprog.c -# -# for a in sparc64; do -# for b in unknown; do -# for c in elf elf64; do -# SPARC_TRY=$a-$b-$c -# printf '#!/bin/sh\n'$SPARC_TRY'-gcc _testprog.c -c' > _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 -# SPARC=$SPARC_TRY -# break -# fi -# rm -f _testprog.o -# done -# done -# done -# -# if [ z$SPARC = z ]; then -# echo "none" -# else -# echo $SPARC"-gcc" -# fi -#fi -#rm -f _testprog* _test.sh -# -#echo "SPARC_CC="$SPARC"-gcc -g -O2 -fno-builtin" >> _Makefile.header -#echo "SPARC_AS="$SPARC"-as" >> _Makefile.header -#echo "SPARC_LD="$SPARC"-ld -e main" >> _Makefile.header -#echo "" >> _Makefile.header - - # Create the Makefiles: -for a in . src src/devices src/devices/fonts tests; do +for a in . src src/devices src/devices/fonts; do echo "creating $a/Makefile" touch $a/Makefile cat _Makefile.header > $a/Makefile