--- trunk/configure 2007/10/08 16:20:40 30 +++ trunk/configure 2007/10/08 16:21:34 36 @@ -1,7 +1,7 @@ #!/bin/sh ############################################################################### # -# Copyright (C) 2003-2006 Anders Gavare. All rights reserved. +# Copyright (C) 2003-2007 Anders Gavare. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -27,7 +27,7 @@ # SUCH DAMAGE. # # -# $Id: configure,v 1.228 2006/07/25 21:49:14 debug Exp $ +# $Id: configure,v 1.245 2007/03/16 14:13:59 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,6 +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) # # # The general philosophy regarding command line switches is that anything @@ -65,22 +66,20 @@ ENABLEARM=YES ENABLEMIPS=YES ENABLEPPC=YES + ENABLESH=YES else # Development: UNSTABLE=YES ENABLEALPHA=YES ENABLEARM=YES ENABLEAVR=YES - ENABLEHPPA=YES - ENABLEI960=YES - ENABLEIA64=YES ENABLEM68K=YES ENABLEMIPS=YES ENABLEPPC=YES + ENABLERCA180X=YES ENABLESH=YES ENABLESPARC=YES ENABLETRANSPUTER=YES - ENABLEX86=YES fi if [ z"$UNSTABLE" = zYES ]; then @@ -168,18 +167,6 @@ printf "#define ENABLE_AVR\n" >> config.h CPU_ARCHS="$CPU_ARCHS cpu_avr.o" fi -if [ z$ENABLEHPPA = zYES ]; then - printf "#define ENABLE_HPPA\n" >> config.h - CPU_ARCHS="$CPU_ARCHS cpu_hppa.o" -fi -if [ z$ENABLEI960 = zYES ]; then - printf "#define ENABLE_I960\n" >> config.h - CPU_ARCHS="$CPU_ARCHS cpu_i960.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" @@ -189,39 +176,30 @@ 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" + CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore_multi" fi if [ z$ENABLEPPC = zYES ]; then printf "#define ENABLE_PPC\n" >> config.h 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" fi if [ z$ENABLESPARC = zYES ]; then printf "#define ENABLE_SPARC\n" >> config.h - CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" + 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 -if [ z$ENABLEX86 = zYES ]; then - printf "#define ENABLE_X86\n" >> config.h - CPU_ARCHS="$CPU_ARCHS cpu_x86.o" -fi - - -# Cache emulation: -if [ z$CACHES = zYES ]; then - echo 'Enabling Cache emulation. (EXPERIMENTAL and BUGGY)' - printf "#define ENABLE_CACHE_EMULATION\n" >> config.h - - printf "\nNOTE: Cache emulation enabled, but right now it triggers " - printf "weird bugs in the\n emulator. You have been warned.\n\n" -fi ############################################################################### @@ -368,6 +346,20 @@ rm -f _test_x11 _test_x11.o + # Special case for some 64-bit Linux/x86_64 systems: + if [ z$XOK = z0 ]; then + $CC $CFLAGS _test_x11.c -c -o _test_x11.o \ + $XINCLUDE 2> /dev/null + + XLIB="-L/usr/X11R6/lib64 -lX11" + $CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null + + if [ -x _test_x11 ]; then + XOK=1 + fi + fi + rm -f _test_x11 _test_x11.o + if [ z$XOK = z0 ]; then XINCLUDE="" $CC $CFLAGS _test_x11.c -c -o _test_x11.o \ @@ -1063,6 +1055,36 @@ fi rm -f _test_end* + +############################################################################### +# +# Native code generation backend: (Detect host architecture.) +# +############################################################################### + +if [ z$UNSTABLE = zYES ]; then + printf "native code generation backend... " + + if [ z"`uname -m`" = zamd64 ]; then + NATIVE_CODE_GENERATION=YES + printf "amd64\n" + printf "#define NATIVE_CODE_GENERATION\n" >> config.h + printf "#define HOST_ARCH_AMD64\n" >> config.h + fi + + if [ z"`uname -m`" = zx86_64 ]; then + NATIVE_CODE_GENERATION=YES + printf "amd64\n" + printf "#define NATIVE_CODE_GENERATION\n" >> config.h + printf "#define HOST_ARCH_AMD64\n" >> config.h + fi + + if [ z$NATIVE_CODE_GENERATION = z ]; then + printf "not yet for this host platform\n" + fi +fi + + ############################################################################### INCLUDE=-Iinclude/ @@ -1085,7 +1107,7 @@ # Create the Makefiles: D=". src src/include src/cpus src/debugger src/devices src/devices/fonts" -D="$D src/machines src/promemul doc" +D="$D src/disk src/machines src/native src/net src/promemul" for a in $D; do echo "creating $a/Makefile" touch $a/Makefile