/[gxemul]/trunk/configure
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/configure

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 40 by dpavlin, Mon Oct 8 16:22:11 2007 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  ###############################################################################  ###############################################################################
3  #  #
4  #  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.  #  Copyright (C) 2003-2007  Anders Gavare.  All rights reserved.
5  #  #
6  #  Redistribution and use in source and binary forms, with or without  #  Redistribution and use in source and binary forms, with or without
7  #  modification, are permitted provided that the following conditions are met:  #  modification, are permitted provided that the following conditions are met:
# Line 27  Line 27 
27  #  SUCH DAMAGE.  #  SUCH DAMAGE.
28  #  #
29  #  #
30  #  $Id: configure,v 1.180 2005/11/23 22:03:23 debug Exp $  #  $Id: configure,v 1.254 2007/04/19 15:18:15 debug Exp $
31  #  #
32  #  This is a minimal configure script, hardcoded for GXemul. This script  #  This is a minimal configure script, hardcoded for GXemul. This script
33  #  figures out which compiler flags will work, and creates Makefiles in  #  figures out which compiler flags will work, and creates Makefiles in
# Line 47  Line 47 
47  #    o)  special hacks for some OSes  #    o)  special hacks for some OSes
48  #    o)  which compiler to use  (overridden by setting CC)  #    o)  which compiler to use  (overridden by setting CC)
49  #    o)  which compiler flags to use  (overridden by setting CFLAGS)  #    o)  which compiler flags to use  (overridden by setting CFLAGS)
50  #    o)  X11 flags and libraries  (TODO: should be possible to override)  #    o)  X11 flags and libraries  (TODO: should be possible to override
51  #    o)  binary translation (on supported platforms)  #        via command line options?)
52  #    o)  prefetch capability  (TODO: this is assumed on Alpha, but not all  #    o)  native code generation backend (i.e. detect host ABI)
53  #                              Alphas have it...)  #
54  #  #
55  #  TODO:  #  The general philosophy regarding command line switches is that anything
56  #    o)  do not enable prefetch on Alpha ev4 or ev5, only on pca56 and newer  #  which can be incorporated into the program as a runtime command line option
57  #    o)  X11 libs and includes via command line options?  #  should be, instead of requiring a recompile.
58  #  #
59  ###############################################################################  ###############################################################################
60    
61  #  Figure out if this is a stable version (0.x.x).  #  Figure out if this is a stable version (0.x.x).
62  X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2`  X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2`
63  if [ z"$X" = z0. ]; then  if [ z"$X" = z0. ]; then
64          #  Stable:          #  Stable.
65          ENABLEARM=YES          :
         ENABLEMIPS=YES  
         ENABLEPPC=YES  
66  else  else
67          #  Development:          #  Development.
68          ENABLEALPHA=YES          UNSTABLE=YES
         ENABLEARM=YES  
         ENABLEAVR=NO  
         ENABLEHPPA=NO  
         ENABLEI960=NO  
         ENABLEIA64=NO  
         ENABLEM68K=NO  
         ENABLEMIPS=YES  
         ENABLENEWMIPS=NO  
         ENABLEPPC=YES  
         ENABLESH=NO  
         ENABLESPARC=NO  
         ENABLEX86=NO  
69  fi  fi
70    
71  if [ z"$*" != z ]; then  if [ z"$*" != z ]; then
# Line 87  if [ z"$*" != z ]; then Line 73  if [ z"$*" != z ]; then
73          for a in $*; do          for a in $*; do
74                  if [ z$a = z--disable-x ]; then                  if [ z$a = z--disable-x ]; then
75                          NOX11=YES                          NOX11=YES
76                  else if [ z$a = z--always32 ]; then                  else if [ z$a = z--debug ]; then
77                          ALWAYS32=YES                          DEBUG=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-all ]; then  
                         ENABLEALPHA=YES  
                         ENABLEARM=YES  
                         ENABLEAVR=YES  
                         ENABLEHPPA=YES  
                         ENABLEI960=YES  
                         ENABLEIA64=YES  
                         ENABLEM68K=YES  
                         ENABLEMIPS=YES  
                         ENABLENEWMIPS=YES  
                         ENABLEPPC=YES  
                         ENABLESH=YES  
                         ENABLESPARC=YES  
                         ENABLEX86=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-avr ]; then  
                         ENABLEAVR=NO  
                 else if [ z$a = z--enable-avr ]; then  
                         ENABLEAVR=YES  
                 else if [ z$a = z--disable-hppa ]; then  
                         ENABLEHPPA=NO  
                 else if [ z$a = z--enable-hppa ]; then  
                         ENABLEHPPA=YES  
                 else if [ z$a = z--disable-i960 ]; then  
                         ENABLEI960=NO  
                 else if [ z$a = z--enable-i960 ]; then  
                         ENABLEI960=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  
                         ENABLEMIPS=YES  
                 else if [ z$a = z--disable-newmips ]; then  
                         ENABLENEWMIPS=NO  
                 else if [ z$a = z--enable-newmips ]; then  
                         ENABLENEWMIPS=YES  
                 else if [ z$a = z--disable-ppc ]; then  
                         ENABLEPPC=NO  
                 else if [ z$a = z--enable-ppc ]; then  
                         ENABLEPPC=YES  
                 else if [ z$a = z--disable-sh ]; then  
                         ENABLESH=NO  
                 else if [ z$a = z--enable-sh ]; then  
                         ENABLESH=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  
                         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  
78                  else if [ z$a = z--help ]; then                  else if [ z$a = z--help ]; then
79                          echo "usage: $0 [options]"                          printf "usage: $0 [options]\n\n"
80                            echo "  --disable-x         don't include X11 support,"\
81                          printf "\nGeneral options:\n\n"                              "even if the host supports it"
82                            if [ z"$UNSTABLE" = zYES ]; then
83                          echo "  --disable-bintrans  configure without the" \                                  echo "  --debug             configure" \
84                              "old binary translation subsystem,"                                          "for a debug build"
                         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 "  --enable-caches    enable cache emulation"  
                         printf " (BUGGY)\n"  
                         echo "  --enable-delays    enable instruction" \  
                             "latency/delay emulation"  
   
                         printf "  --enable-all       enable everything\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$ENABLEAVR = zYES ]; then  
                                 printf "  --disable-avr      disable "  
                         else  
                                 printf "  --enable-avr       enable "  
                         fi  
                         printf "Atmel AVR CPU emulation\n"  
   
                         if [ z$ENABLEHPPA = zYES ]; then  
                                 printf "  --disable-hppa     disable "  
                         else  
                                 printf "  --enable-hppa      enable "  
                         fi  
                         printf "HPPA CPU emulation\n"  
   
                         if [ z$ENABLEI960 = zYES ]; then  
                                 printf "  --disable-i960     disable "  
                         else  
                                 printf "  --enable-i960      enable "  
                         fi  
                         printf "i960 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$ENABLENEWMIPS = zYES ]; then  
                                 printf "  --disable-newmips  disable "  
                         else  
                                 printf "  --enable-newmips   enable "  
                         fi  
                         printf "(New, dyntrans) 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$ENABLESH = zYES ]; then  
                                 printf "  --disable-sh       disable "  
                         else  
                                 printf "  --enable-sh        enable "  
                         fi  
                         printf "SH CPU emulation\n"  
   
                         if [ z$ENABLESPARC = zYES ]; then  
                                 printf "  --disable-sparc    disable "  
                         else  
                                 printf "  --enable-sparc     enable "  
                         fi  
                         printf "SPARC CPU emulation\n"  
   
                         if [ z$ENABLEX86 = zYES ]; then  
                                 printf "  --disable-x86      disable "  
                         else  
                                 printf "  --enable-x86       enable "  
85                          fi                          fi
86                          printf "x86 CPU emulation\n"                          echo
   
                         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"  
87                          exit                          exit
88                  else                  else
89                          echo "Invalid option: $a"                          echo "Invalid option: $a"
90                          echo "Run  $0 --help  to get a list of" \                          echo "Run  $0 --help  to get a list of" \
91                              "available options."                              "available options."
92                          exit                          exit
93                  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  
94          done          done
95  fi  fi
96    
97    
98    #  Stable releases:
99    ENABLEARM=YES
100    ENABLEMIPS=YES
101    ENABLEPPC=YES
102    ENABLESH=YES
103    
104    if [ z"$UNSTABLE" = zYES ]; then
105            #  Development:
106            printf "###\n###  DEVELOPMENT (UNSTABLE)\n###\n### "
107            printf "(Enabling some archs that are not working yet.)\n###\n\n"
108            ENABLEALPHA=YES
109            ENABLEAVR=YES
110            ENABLEM88K=YES
111            ENABLESPARC=YES
112    fi
113    
114    
115  ###############################################################################  ###############################################################################
116  #  #
117  #  Configure options:  #  Configure options:
# Line 332  else Line 137  else
137  fi  fi
138    
139    
140    if [ z"$UNSTABLE" = zYES ]; then
141            printf "#define UNSTABLE_DEVEL\n" >> config.h
142    fi
143    
144    
145  ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\``  ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\``
146  printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h  printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h
147    
148    
149    
150  #  Support for various CPU types:  #  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  
151  if [ z$ENABLEALPHA = zYES ]; then  if [ z$ENABLEALPHA = zYES ]; then
152          printf "#define ENABLE_ALPHA\n" >> config.h          printf "#define ENABLE_ALPHA\n" >> config.h
153          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"
154          CPU_TOOLS="$CPU_TOOLS generate_alpha_misc"          CPU_TOOLS="$CPU_TOOLS generate_alpha_misc"
155  fi  fi
156  if [ z$ENABLEARM = zYES ]; then  if [ z$ENABLEARM = zYES ]; then
# Line 367  if [ z$ENABLEAVR = zYES ]; then Line 172  if [ z$ENABLEAVR = zYES ]; then
172          printf "#define ENABLE_AVR\n" >> config.h          printf "#define ENABLE_AVR\n" >> config.h
173          CPU_ARCHS="$CPU_ARCHS cpu_avr.o"          CPU_ARCHS="$CPU_ARCHS cpu_avr.o"
174  fi  fi
175  if [ z$ENABLEHPPA = zYES ]; then  if [ z$ENABLEM88K = zYES ]; then
176          printf "#define ENABLE_HPPA\n" >> config.h          printf "#define ENABLE_M88K\n" >> config.h
177          CPU_ARCHS="$CPU_ARCHS cpu_hppa.o"          CPU_ARCHS="$CPU_ARCHS cpu_m88k.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"  
178  fi  fi
179  if [ z$ENABLEMIPS = zYES ]; then  if [ z$ENABLEMIPS = zYES ]; then
180          printf "#define ENABLE_MIPS\n" >> config.h          printf "#define ENABLE_MIPS\n" >> config.h
181  fi          CPU_ARCHS="$CPU_ARCHS cpu_mips.o cpu_mips_coproc.o "
182  if [ z$ENABLENEWMIPS = zYES ]; then          CPU_ARCHS="$CPU_ARCHS cpu_mips_instr_unaligned.o"
183          printf "#define ENABLE_NEWMIPS\n" >> config.h          CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore"
184          CPU_ARCHS="$CPU_ARCHS cpu_newmips.o"          CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore_multi"
185  fi  fi
186  if [ z$ENABLEPPC = zYES ]; then  if [ z$ENABLEPPC = zYES ]; then
187          printf "#define ENABLE_PPC\n" >> config.h          printf "#define ENABLE_PPC\n" >> config.h
# Line 397  if [ z$ENABLEPPC = zYES ]; then Line 190  if [ z$ENABLEPPC = zYES ]; then
190  fi  fi
191  if [ z$ENABLESH = zYES ]; then  if [ z$ENABLESH = zYES ]; then
192          printf "#define ENABLE_SH\n" >> config.h          printf "#define ENABLE_SH\n" >> config.h
193          CPU_ARCHS="$CPU_ARCHS cpu_sh.o"          CPU_ARCHS="$CPU_ARCHS cpu_sh.o memory_sh.o"
194  fi  fi
195  if [ z$ENABLESPARC = zYES ]; then  if [ z$ENABLESPARC = zYES ]; then
196          printf "#define ENABLE_SPARC\n" >> config.h          printf "#define ENABLE_SPARC\n" >> config.h
197          CPU_ARCHS="$CPU_ARCHS cpu_sparc.o"          CPU_ARCHS="$CPU_ARCHS cpu_sparc.o memory_sparc.o"
198  fi          CPU_TOOLS="$CPU_TOOLS generate_sparc_loadstore"
 if [ z$ENABLEX86 = zYES ]; then  
         printf "#define ENABLE_X86\n" >> config.h  
         CPU_ARCHS="$CPU_ARCHS cpu_x86.o"  
 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  
   
   
 #  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)'  
         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"  
199  fi  fi
200    
201    
# Line 593  if [ z$NOX11 = z ]; then Line 343  if [ z$NOX11 = z ]; then
343    
344          rm -f _test_x11 _test_x11.o          rm -f _test_x11 _test_x11.o
345    
346            #  Special case for some 64-bit Linux/x86_64 systems:
347            if [ z$XOK = z0 ]; then
348                    $CC $CFLAGS _test_x11.c -c -o _test_x11.o \
349                        $XINCLUDE 2> /dev/null
350    
351                    XLIB="-L/usr/X11R6/lib64 -lX11"
352                    $CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null
353    
354                    if [ -x _test_x11 ]; then
355                            XOK=1
356                    fi
357            fi
358            rm -f _test_x11 _test_x11.o
359    
360          if [ z$XOK = z0 ]; then          if [ z$XOK = z0 ]; then
361                  XINCLUDE=""                  XINCLUDE=""
362                  $CC $CFLAGS _test_x11.c -c -o _test_x11.o \                  $CC $CFLAGS _test_x11.c -c -o _test_x11.o \
# Line 785  if [ -x _testprog ]; then Line 549  if [ -x _testprog ]; then
549          if [ z"$COMPAQCC" = zYES ]; then          if [ z"$COMPAQCC" = zYES ]; then
550                  CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop"                  CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop"
551          fi          fi
552    
553            if [ z"$UNSTABLE" = zYES ]; then
554                    printf "checking whether -Werror can be used... "
555                    rm -f _testprog
556                    $CC $CFLAGS $CWARNINGS _testprog.c -o _testprog -Werror 2> /dev/null
557                    if [ -x _testprog ]; then
558                            printf "yes\n"
559                            CWARNINGS="$CWARNINGS -Werror"
560                    else
561                            printf "no\n"
562                    fi
563            fi
564  else  else
565          printf "no\n"          printf "no\n"
566  fi  fi
# Line 792  rm -f _testprog Line 568  rm -f _testprog
568    
569    
570  if [ z"$COMPAQCC" = zYES ]; then  if [ z"$COMPAQCC" = zYES ]; then
571          #  -O4 is possible, but is -O3 better?          #  -O4 is possible, but sometimes -O3 is better?
572          CFLAGS="-O4 $CFLAGS"          if [ ! z"$DEBUG" = zYES ]; then
573                    CFLAGS="-O4 $CFLAGS"
574            fi
575  else  else
576          if [ z"`uname`" = zSunOS ]; then          if [ z"`uname`" = zSunOS ]; then
577                  #  "cc", the system's default compiler:                  #  "cc", the system's default compiler:
578                  if [ z"$SUNCC" = zYES ]; then                  if [ ! z"$DEBUG" = zYES ]; then
579                          CFLAGS="-xO5 -xdepend $CFLAGS"                          if [ z"$SUNCC" = zYES ]; then
580                                    CFLAGS="-xO5 -xdepend $CFLAGS"
581                            fi
582                  fi                  fi
583                  printf "#define SOLARIS\n" >> config.h                  printf "#define SOLARIS\n" >> config.h
584                  OTHERLIBS="-lsocket $OTHERLIBS"                  OTHERLIBS="-lsocket $OTHERLIBS"
585          else          else
586                  #  gcc or something else:                  #  gcc or something else:
587                  $CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null                  if [ ! z"$DEBUG" = zYES ]; then
588                  if [ -x _testprog ]; then                          $CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null
                         rm -f _testprog  
                         $CC $CFLAGS _testprog.c -o _testprog -O2 2> /dev/null  
589                          if [ -x _testprog ]; then                          if [ -x _testprog ]; then
590                                  CFLAGS="-O2 $CFLAGS"                                  rm -f _testprog
591                          else                                  $CC $CFLAGS _testprog.c -o _testprog    \
592                                  CFLAGS="-O $CFLAGS"                                          -O3 2> /dev/null
593                                    if [ -x _testprog ]; then
594                                            CFLAGS="-O3 $CFLAGS"
595                                    else
596                                            CFLAGS="-O $CFLAGS"
597                                    fi
598                          fi                          fi
599                  fi                  fi
600          fi          fi
# Line 821  rm -f _testprog Line 604  rm -f _testprog
604    
605  #  -fschedule-insns causes bugs on i386 with gcc,  #  -fschedule-insns causes bugs on i386 with gcc,
606  #  but works OK on my alpha with ccc (compaq's cc).  #  but works OK on my alpha with ccc (compaq's cc).
607  if [ z"$COMPAQCC" = zYES ]; then  if [ ! z"$DEBUG" = zYES ]; then
608        if [ z"$COMPAQCC" = zYES ]; then
609          printf "checking whether -fschedule-insns2 can be used... "          printf "checking whether -fschedule-insns2 can be used... "
610          $CC $CFLAGS _testprog.c -o _testprog -fschedule-insns2 2> /dev/null          $CC $CFLAGS _testprog.c -o _testprog -fschedule-insns2 2> /dev/null
611          if [ -x _testprog ]; then          if [ -x _testprog ]; then
# Line 859  if [ z"$COMPAQCC" = zYES ]; then Line 643  if [ z"$COMPAQCC" = zYES ]; then
643                  printf "no\n"                  printf "no\n"
644          fi          fi
645          rm -f _testprog          rm -f _testprog
646  fi  fi; fi
647    
648    
649  #  -fpeephole  #  -fpeephole
650  printf "checking whether -fpeephole can be used... "  if [ ! z"$DEBUG" = zYES ]; then
651  $CC $CFLAGS -fpeephole _testprog.c -o _testprog > _testprog.stdout 2>&1          printf "checking whether -fpeephole can be used... "
652  cat _testprog.stdout >> _testprog.error          $CC $CFLAGS -fpeephole _testprog.c -o _testprog > _testprog.stdout 2>&1
653  if grep peephole _testprog.error > /dev/null 2>&1; then          cat _testprog.stdout >> _testprog.error
654          printf "no\n"          if grep peephole _testprog.error > /dev/null 2>&1; then
 else  
         if [ -x _testprog ]; then  
                 CFLAGS="-fpeephole $CFLAGS"  
                 printf "yes\n"  
         else  
655                  printf "no\n"                  printf "no\n"
656            else
657                    if [ -x _testprog ]; then
658                            CFLAGS="-fpeephole $CFLAGS"
659                            printf "yes\n"
660                    else
661                            printf "no\n"
662                    fi
663          fi          fi
664            rm -f _testprog _testprog.error _testprog.stdout
665  fi  fi
 rm -f _testprog _testprog.error _testprog.stdout  
666    
667    
668  #  -fomit-frame-pointer  #  -fomit-frame-pointer
669  printf "checking whether -fomit-frame-pointer can be used... "  if [ ! z"$DEBUG" = zYES ]; then
670  $CC $CFLAGS -fomit-frame-pointer _testprog.c -o \          printf "checking whether -fomit-frame-pointer can be used... "
671      _testprog 1> _testprog.stdout 2>&1          $CC $CFLAGS -fomit-frame-pointer _testprog.c -o \
672  cat _testprog.stdout >> _testprog.error              _testprog 1> _testprog.stdout 2>&1
673  if grep frame _testprog.error > /dev/null 2>&1; then          cat _testprog.stdout >> _testprog.error
674          printf "no\n"          if grep frame _testprog.error > /dev/null 2>&1; then
675  else                  printf "no\n"
676          if [ -x _testprog ]; then          else
677                  CFLAGS="-fomit-frame-pointer $CFLAGS"                  if [ -x _testprog ]; then
678                  printf "yes\n"                          CFLAGS="-fomit-frame-pointer $CFLAGS"
679                            printf "yes\n"
680                    else
681                            printf "no\n"
682                    fi
683            fi
684            rm -f _testprog _testprog.error _testprog.stdout
685    fi
686    
687    
688    #  -g, for development builds
689    if [ z"$UNSTABLE" = zYES ]; then
690            printf "checking whether -g can be used... "
691            if [ z"$COMPAQCC" = zYES ]; then
692                    printf "skipping\n"
693          else          else
694                    $CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1
695                    cat _testprog.stdout >> _testprog.error
696                    if [ -x _testprog ]; then
697                            CFLAGS="-g $CFLAGS"
698                            printf "yes\n"
699                    else
700                  printf "no\n"                  printf "no\n"
701                            fi
702          fi          fi
703            rm -f _testprog _testprog.error _testprog.stdout
704  fi  fi
 rm -f _testprog _testprog.error _testprog.stdout  
705    
706    
707  #  -lrt for nanosleep?  #  -lrt for nanosleep?
# Line 950  rm -f _testr.[co] _testr Line 757  rm -f _testr.[co] _testr
757  #  -lm?  #  -lm?
758  printf "checking for math libs..."  printf "checking for math libs..."
759  printf "#include <math.h>\nint main(int argc, char *argv[]) { " > _testr.c  printf "#include <math.h>\nint main(int argc, char *argv[]) { " > _testr.c
760  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
761  $CC $CFLAGS _testr.c -o _testr 2> /dev/null  $CC $CFLAGS _testr.c -o _testr 2> /dev/null
762  if [ ! -x _testr ]; then  if [ ! -x _testr ]; then
763          $CC $CFLAGS _testr.c -lm -o _testr 2> /dev/null          $CC $CFLAGS _testr.c -lm -o _testr 2> /dev/null
# Line 1031  printf "#include <stdlib.h> Line 838  printf "#include <stdlib.h>
838  #include <stdio.h>  #include <stdio.h>
839  #include <sys/types.h>  #include <sys/types.h>
840  int main(int argc, char *argv[]) { fseeko(NULL, 0, 0); return 0;}\n" > _tests.c  int main(int argc, char *argv[]) { fseeko(NULL, 0, 0); return 0;}\n" > _tests.c
841  $CC $CFLAGS _tests.c -o _tests 2> /dev/null  $CC $CFLAGS $CWARNINGS _tests.c -o _tests 2> /dev/null
842  if [ ! -x _tests ]; then  if [ ! -x _tests ]; then
843          printf "missing\n"          # Try with _LARGEFILE_SOURCE (hack to make fseeko
844          printf "WARNING! fseeko missing from libc. Using a hack, "          # work on 64-bit Linux):
845          printf "which probably doesn't work.\n"          $CC $CFLAGS -D_LARGEFILE_SOURCE $CWARNINGS _tests.c -o _tests 2> /dev/null
846          printf "#define HACK_FSEEKO\n" >> config.h          if [ ! -x _tests ]; then
847                    printf "missing\n"
848                    printf "WARNING! fseeko missing from libc. Using a hack, "
849                    printf "which probably doesn't work.\n"
850                    printf "#define HACK_FSEEKO\n" >> config.h
851            else
852                    printf "using -D_LARGEFILE_SOURCE hack\n"
853                    CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE"
854            fi
855  else  else
856          printf "found\n"          printf "found\n"
857  fi  fi
# Line 1093  fi Line 908  fi
908  rm -f _tests.[co] _tests  rm -f _tests.[co] _tests
909    
910    
911    #  Check for PRIx64 in inttypes.h:
912    printf "checking for PRIx64 in inttypes.h... "
913    printf "#include <inttypes.h>\nint main(int argc, char *argv[])\n
914    {\n#ifdef PRIx64\nreturn 0;\n#else\nreturn 1;\n#endif\n}\n" > _testpri.c
915    $CC $CFLAGS _testpri.c -o _testpri 2> /dev/null
916    if [ ! -x _testpri ]; then
917            printf "\nERROR! COULD NOT COMPILE PRIx64 TEST PROGRAM AT ALL!\n"
918            exit
919    else
920            if ./_testpri; then
921                    printf "yes\n"
922            else
923                    printf "no, using an ugly hack instead, "
924                    printf "#define NO_C99_PRINTF_DEFINES\n" >> config.h
925    
926                    # Try llx first:
927                    printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){
928                        printf(\"%%llx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c
929                    rm -f _testpri
930                    $CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null
931                    if [ z`./_testpri` = z80 ]; then
932                            printf "PRIx64=llx\n"
933                            printf "#define NO_C99_64BIT_LONGLONG\n" >> config.h
934                    else
935                            # Try lx too:
936                            printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){
937                                printf(\"%%lx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c
938                            rm -f _testpri
939                            $CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null
940                            if [ z`./_testpri` = z80 ]; then
941                                    printf "PRIx64=lx\n"
942                            else
943                                    printf "\nFailed, neither lx nor llx worked!\n"
944                                    exit
945                            fi
946                    fi
947            fi
948    fi
949    rm -f _testpri.c _testpri
950    
951    
952  #  Check for 64-bit off_t:  #  Check for 64-bit off_t:
953  printf "checking for 64-bit off_t... "  printf "checking for 64-bit off_t... "
954  printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n  printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n
# Line 1184  rm -f _testuint.c _testuint Line 1040  rm -f _testuint.c _testuint
1040    
1041    
1042  ###############################################################################  ###############################################################################
 #  
 #  Dynamic 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:  (all machines ending in "86" are treated as i386)  
         if [ z"`uname -m|rev|cut -c1-2`" = z68 ]; 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  
   
   
 ###############################################################################  
1043    
1044  #  Host byte order?  #  Host byte order?
1045  printf "checking host endianness... "  printf "checking host endianness... "
# Line 1273  else Line 1064  else
1064  fi  fi
1065  rm -f _test_end*  rm -f _test_end*
1066    
1067    
1068    ###############################################################################
1069    #
1070    #  Native code generation backend:  (Detect host ABI.)
1071    #
1072  ###############################################################################  ###############################################################################
1073    
1074  #  Prefetch support?  if [ z$UNSTABLE = zYES ]; then
1075  printf "checking for asm prefetch support... "          printf "detecting native code generation ABI... "
1076  if [ z"`uname -m`" = zalpha ]; then  
1077          rm -f _alpha_asm_test.c _alpha_asm_test          if [ z"`uname -m`" = zalpha ]; then
1078          printf 'int main(int argc, char *argv[])                  NATIVE_CODE_GENERATION=YES
1079           { int x; int *y = &x; asm ("ldl $31,0(%%0)" : : "g" (y));                  printf "Alpha\n"
1080            return 0; }\n' > _alpha_asm_test.c                  printf "#define NATIVE_CODE_GENERATION\n" >> config.h
1081          $CC $CFLAGS -O2 _alpha_asm_test.c -o _alpha_asm_test \                  printf "#define HOST_ARCH_ALPHA\n" >> config.h
1082              > /dev/null 2> /dev/null          fi
1083          if [ -x _alpha_asm_test ]; then  
1084  #               printf "#define HAVE_PREFETCH\n" >> config.h          if [ z"`uname -m`" = zamd64 ]; then
1085                  printf "#define PREFETCH(x) asm(\"ldl" >> config.h                  NATIVE_CODE_GENERATION=YES
1086                  printf " \$31,0(%%0)\" : : \"g\" (x))\n" >> config.h                  printf "amd64\n"
1087                  echo "yes"                  printf "#define NATIVE_CODE_GENERATION\n" >> config.h
1088                  PREFSUP=YES                  printf "#define HOST_ARCH_AMD64\n" >> config.h
1089          fi          fi
1090          rm -f _alpha_asm_test.c _alpha_asm_test  
1091  fi          if [ z"`uname -m`" = zx86_64 ]; then
1092  if [ z$PREFSUP = z ]; then                  NATIVE_CODE_GENERATION=YES
1093          printf "#define PREFETCH(x) { }\n" >> config.h                  printf "amd64\n"
1094          echo "no"                  printf "#define NATIVE_CODE_GENERATION\n" >> config.h
1095                    printf "#define HOST_ARCH_AMD64\n" >> config.h
1096            fi
1097    
1098            if [ z$NATIVE_CODE_GENERATION = z ]; then
1099                    printf "not supported yet for this host platform\n"
1100            fi
1101  fi  fi
1102    
1103    
# Line 1320  echo "" >> _Makefile.header Line 1122  echo "" >> _Makefile.header
1122    
1123    
1124  #  Create the Makefiles:  #  Create the Makefiles:
1125  D=". src src/include src/cpus src/devices src/devices/fonts src/promemul"  D=". src src/include src/cpus src/debugger src/devices src/devices/fonts"
1126    D="$D src/disk src/file src/machines src/native src/net src/promemul"
1127  for a in $D; do  for a in $D; do
1128          echo "creating $a/Makefile"          echo "creating $a/Makefile"
1129          touch $a/Makefile          touch $a/Makefile

Legend:
Removed from v.20  
changed lines
  Added in v.40

  ViewVC Help
Powered by ViewVC 1.1.26