/[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 10 by dpavlin, Mon Oct 8 16:18:27 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 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-2006  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.140 2005/06/27 17:31:50 debug Exp $  #  $Id: configure,v 1.198 2006/02/18 13:15:20 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 49  Line 49 
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)  #    o)  binary translation (on supported platforms)
 #    o)  prefetch capability  (TODO: this is assumed on Alpha, but not all  
 #                              Alphas have it...)  
52  #  #
53  #  TODO:  #  TODO:
 #    o)  do not enable prefetch on Alpha ev4 or ev5, only on pca56 and newer  
54  #    o)  X11 libs and includes via command line options?  #    o)  X11 libs and includes via command line options?
55  #  #
56  ###############################################################################  ###############################################################################
57    
58  ENABLEARM=YES  #  Figure out if this is a stable version (0.x.x).
59  ENABLEMIPS=YES  X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2`
60  ENABLEPPC=YES  if [ z"$X" = z0. ]; then
61  ENABLEURISC=YES          #  Stable:
62  ENABLEX86=NO          ENABLEARM=YES
63  STABLE=NO          ENABLEMIPS=YES
64            ENABLEPPC=YES
65    else
66            #  Development:
67            UNSTABLE=YES
68            DYNTRANSBACKEND=NO #YES
69            ENABLEALPHA=YES
70            ENABLEARM=YES
71            ENABLEAVR=YES
72            ENABLEHPPA=YES
73            ENABLEI960=YES
74            ENABLEIA64=YES
75            ENABLEM68K=YES
76            ENABLEMIPS=YES
77            NEWMIPS=NO
78            ENABLEPPC=YES
79            ENABLESH=YES
80            ENABLESPARC=YES
81            ENABLEX86=YES
82    fi
83    
84    if [ z"$UNSTABLE" = zYES ]; then
85            printf "###  DEVELOPMENT (UNSTABLE)\n\n"
86    fi
87    
88  if [ z"$*" != z ]; then  if [ z"$*" != z ]; then
89          #  Parse command line options:          #  Parse command line options:
# Line 82  if [ z"$*" != z ]; then Line 102  if [ z"$*" != z ]; then
102                          MIPS16=NO                          MIPS16=NO
103                  else if [ z$a = z--enable-mips16 ]; then                  else if [ z$a = z--enable-mips16 ]; then
104                          MIPS16=YES                          MIPS16=YES
105                  else if [ z$a = z--disable-arm ]; then                  else if [ z$a = z--disable-dyntransbackend ]; then
106                          ENABLEARM=NO                          DYNTRANSBACKEND=NO
107                  else if [ z$a = z--enable-arm ]; then                  else if [ z$a = z--enable-dyntransbackend ]; then
108                          ENABLEARM=YES                          DYNTRANSBACKEND=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-ppc ]; then  
                         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-x86 ]; then  
                         ENABLEX86=NO  
                 else if [ z$a = z--enable-x86 ]; then  
                         ENABLEX86=YES  
109                  else if [ z$a = z--disable-delays ]; then                  else if [ z$a = z--disable-delays ]; then
110                          DELAYS=NO                          DELAYS=NO
111                  else if [ z$a = z--enable-delays ]; then                  else if [ z$a = z--enable-delays ]; then
# Line 110  if [ z"$*" != z ]; then Line 114  if [ z"$*" != z ]; then
114                          CACHES=NO                          CACHES=NO
115                  else if [ z$a = z--enable-caches ]; then                  else if [ z$a = z--enable-caches ]; then
116                          CACHES=YES                          CACHES=YES
117                    else if [ z$a = z--disable-newmips ]; then
118                            NEWMIPS=NO
119                    else if [ z$a = z--enable-newmips ]; then
120                            NEWMIPS=YES
121                    else if [ z$a = z--disable-1k-pages ]; then
122                            ONEKPAGE=NO
123                    else if [ z$a = z--enable-1k-pages ]; then
124                            ONEKPAGE=YES
125                  else if [ z$a = z--help ]; then                  else if [ z$a = z--help ]; then
126                          echo "usage: $0 [options]"                          echo "usage: $0 [options]"
127                          printf "\nDevelopment (debug) options:\n"  
128                          echo "  --always32         enable" \                          printf "\nGeneral options:\n\n"
129                              "ALWAYS_SIGNEXTEND_32 (for hunting down"  
130                          echo "                     32/64-bit bugs)"                          echo "  --disable-bintrans  configure without the" \
131                          echo "  --tracenull        enable" \                              "old binary translation subsystem,"
132                              "TRACE_NULL_CRASHES (for bug hunting)"                          echo "                      even if the host" \
133                          printf "\nGeneral options:\n"                              "supports it"
134                          echo "  --disable-bintrans configure without" \                          echo "  --disable-x         don't include X11 support"
135                              "bintrans, even if the host supports it"  
136                            printf "\nDevelopment (debug) options:\n\n"
137    
138                            echo "  --always32         enable ALWAYS_SIGNEXTEND_32"\
139                                "(for hunting down 32-bit bugs)"
140                          printf "  --enable-caches    enable cache emulation"                          printf "  --enable-caches    enable cache emulation"
141                          printf " (BUGGY)\n"                          printf " (BUGGY)\n"
142                          echo "  --enable-delays    enable instruction" \                          echo "  --enable-delays    enable instruction" \
143                              "latency/delay emulation"                              "latency/delay emulation"
144                          echo "  --disable-x        don't include X11 support"  
145                          printf "\nCPU selection options:\n"                          if [ z$DYNTRANSBACKEND = zYES ]; then
146                          echo "  --disable-arm      disable ARM CPU emulation"                                  printf "  --disable-dyntransbackend  disable "
147                          echo "  --disable-mips     disable MIPS CPU emulation"                          else
148                          echo "  --disable-ppc      disable PPC CPU emulation"                                  printf "  --enable-dyntransbackend  enable"
                         echo "  --disable-urisc    disable URISC CPU emulation"  
                         if [ z$STABLE = zNO ]; then  
                                 printf "  --enable-x86       "  
                                 printf "enable x86 CPU emulation"  
                                 printf " (NOT YET)\n"  
149                          fi                          fi
150                          printf "\nMIPS-specific options:\n"                          printf "dyntrans backend\n"
151                          printf "  --enable-mips16    enable MIPS16 instruction"  
152                          printf " support (NOT YET)\n\n"                          echo "  --enable-mips16    enable MIPS16 support"
153                            echo "  --enable-newmips   use new MIPS dyntrans code"
154                            #printf "  --enable-1k-pages  allow 1KB dyntrans pages"
155                            #printf " (default: 4KB)\n"
156    
157                            printf "\n(Pretty much all of these options are only"
158                            printf " meaningful during the development of\nthe"
159                            printf " emulator, and should not be used when "
160                            printf "compiling a stable version.)\n"
161                          exit                          exit
162                  else                  else
163                          echo "Invalid option: $a"                          echo "Invalid option: $a"
164                          echo "Run  $0 --help  to get a list of" \                          echo "Run  $0 --help  to get a list of" \
165                              "available options."                              "available options."
166                          exit                          exit
167                  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
168                  fi; fi; fi; fi; fi; fi; fi                  fi; fi
169          done          done
170  fi  fi
171    
# Line 187  if [ z$MIPS16 = zYES ]; then Line 206  if [ z$MIPS16 = zYES ]; then
206          printf 'NOTE: MIPS16 support is not really working yet.\n'          printf 'NOTE: MIPS16 support is not really working yet.\n'
207          printf "#define ENABLE_MIPS16\n" >> config.h          printf "#define ENABLE_MIPS16\n" >> config.h
208  fi  fi
209    if [ z$ENABLEALPHA = zYES ]; then
210            printf "#define ENABLE_ALPHA\n" >> config.h
211            CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o"
212            CPU_TOOLS="$CPU_TOOLS generate_alpha_misc"
213    fi
214  if [ z$ENABLEARM = zYES ]; then  if [ z$ENABLEARM = zYES ]; then
215          printf "#define ENABLE_ARM\n" >> config.h          printf "#define ENABLE_ARM\n" >> config.h
216            CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o "
217            CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o tmp_arm_r.o"
218            CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o"
219            CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o"
220            CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o"
221            CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o"
222            CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o"
223            CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o"
224            CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o"
225            CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o tmp_arm_multi.o"
226            CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r"
227            CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi"
228    fi
229    if [ z$ENABLEAVR = zYES ]; then
230            printf "#define ENABLE_AVR\n" >> config.h
231            CPU_ARCHS="$CPU_ARCHS cpu_avr.o"
232    fi
233    if [ z$ENABLEHPPA = zYES ]; then
234            printf "#define ENABLE_HPPA\n" >> config.h
235            CPU_ARCHS="$CPU_ARCHS cpu_hppa.o"
236    fi
237    if [ z$ENABLEI960 = zYES ]; then
238            printf "#define ENABLE_I960\n" >> config.h
239            CPU_ARCHS="$CPU_ARCHS cpu_i960.o"
240    fi
241    if [ z$ENABLEIA64 = zYES ]; then
242            printf "#define ENABLE_IA64\n" >> config.h
243            CPU_ARCHS="$CPU_ARCHS cpu_ia64.o"
244    fi
245    if [ z$ENABLEM68K = zYES ]; then
246            printf "#define ENABLE_M68K\n" >> config.h
247            CPU_ARCHS="$CPU_ARCHS cpu_m68k.o"
248  fi  fi
249  if [ z$ENABLEMIPS = zYES ]; then  if [ z$ENABLEMIPS = zYES ]; then
250          printf "#define ENABLE_MIPS\n" >> config.h          printf "#define ENABLE_MIPS\n" >> config.h
251            if [ z$NEWMIPS = zYES ]; then
252                    echo 'Enabling the _EXPERIMENTAL_ MIPS dyntrans code.'
253                    printf "#define EXPERIMENTAL_NEWMIPS\n" >> config.h
254            fi
255  fi  fi
256  if [ z$ENABLEPPC = zYES ]; then  if [ z$ENABLEPPC = zYES ]; then
257          printf "#define ENABLE_PPC\n" >> config.h          printf "#define ENABLE_PPC\n" >> config.h
258            CPU_ARCHS="$CPU_ARCHS cpu_ppc.o"
259            CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore"
260  fi  fi
261  if [ z$ENABLEURISC = zYES ]; then  if [ z$ENABLESH = zYES ]; then
262          printf "#define ENABLE_URISC\n" >> config.h          printf "#define ENABLE_SH\n" >> config.h
263            CPU_ARCHS="$CPU_ARCHS cpu_sh.o"
264    fi
265    if [ z$ENABLESPARC = zYES ]; then
266            printf "#define ENABLE_SPARC\n" >> config.h
267            CPU_ARCHS="$CPU_ARCHS cpu_sparc.o"
268  fi  fi
269  if [ z$ENABLEX86 = zYES ]; then  if [ z$ENABLEX86 = zYES ]; then
270          printf "#define ENABLE_X86\n" >> config.h          printf "#define ENABLE_X86\n" >> config.h
271          if [ z$STABLE = zNO ]; then          CPU_ARCHS="$CPU_ARCHS cpu_x86.o"
                 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  
272  fi  fi
273    
274    
# Line 226  if [ z$ALWAYS32 = zYES ]; then Line 287  if [ z$ALWAYS32 = zYES ]; then
287  fi  fi
288    
289    
290  #  Development option: TRACE_NULL_CRASHES  #  1KB page emulation:
291  if [ z$TRACENULL = zYES ]; then  if [ z$ONEKPAGE = zYES ]; then
292          echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \          echo '1 KB pages: not yet.'
293              'This slows down the emulator.)'          exit
294          printf "#define TRACE_NULL_CRASHES\n" >> config.h          echo 'Enabling 1 KB page dyntrans support. (NOTE:' \
295                'This slows down everything.)'
296            printf "#define ONEKPAGE\n" >> config.h
297  fi  fi
298    
299    
300  #  Cache emulation:  #  Cache emulation:
301  if [ z$CACHES = zYES ]; then  if [ z$CACHES = zYES ]; then
302          echo 'Enabling Cache emulation. (EXPERIMENTAL)'          echo 'Enabling Cache emulation. (EXPERIMENTAL and BUGGY)'
303          printf "#define ENABLE_CACHE_EMULATION\n" >> config.h          printf "#define ENABLE_CACHE_EMULATION\n" >> config.h
304    
305          if [ z$DELAYS != zYES ]; then          if [ z$DELAYS != zYES ]; then
# Line 325  if [ z"$CC" = z ]; then Line 388  if [ z"$CC" = z ]; then
388          fi          fi
389          rm -f _testprog          rm -f _testprog
390    
391          #  Try ccc (FreeBSD/Alpha):  #       #  Try ccc (FreeBSD/Alpha):
392          printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh  #       printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh
393          printf " /dev/null 2> /dev/null\n" >> _test.sh  #       printf " /dev/null 2> /dev/null\n" >> _test.sh
394          chmod 755 _test.sh  #       chmod 755 _test.sh
395          ./_test.sh > /dev/null 2> /dev/null  #       ./_test.sh > /dev/null 2> /dev/null
396          if [ -x _testprog ]; then  #       if [ -x _testprog ]; then
397                  CC="ccc"  #               CC="ccc"
398          fi  #       fi
399          rm -f _testprog  #       rm -f _testprog
400    
401          rm -f _test.sh          rm -f _test.sh
402  fi  fi
# Line 448  if [ z$OSF1 = zYES ]; then Line 511  if [ z$OSF1 = zYES ]; then
511  fi  fi
512    
513    
514  #  Check for weird 'alpha' define.  #  Check for 'alpha' define.
515  printf "checking for weird 'alpha' define... "  printf "checking for 'alpha' define... "
516  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
517  #ifdef alpha  #ifdef alpha
518  printf(\"1\");  printf(\"1\");
# Line 479  fi Line 542  fi
542  rm -f _testm*  rm -f _testm*
543    
544    
 #  Check for weird 'hppa' define.  
 printf "checking for weird 'hppa' define... "  
 printf "#include <stdio.h>\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*  
   
   
545  #  Some OSes on MIPS seems to define 'mips' to 1. (eg OpenBSD/arc)  #  Some OSes on MIPS seems to define 'mips' to 1. (eg OpenBSD/arc)
546  printf "checking for weird 'mips' define... "  printf "checking for 'mips' define... "
547  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
548  #ifdef mips  #ifdef mips
549  printf(\"1\");  printf(\"1\");
# Line 543  rm -f _testm* Line 575  rm -f _testm*
575    
576  #  Similar to the mips define check above, although I don't know if  #  Similar to the mips define check above, although I don't know if
577  #  any OS actually defined ppc like this.  #  any OS actually defined ppc like this.
578  printf "checking for weird 'ppc' define... "  printf "checking for 'ppc' define... "
579  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
580  #ifdef ppc  #ifdef ppc
581  printf(\"1\");  printf(\"1\");
# Line 575  rm -f _testm* Line 607  rm -f _testm*
607    
608  #  Similar to the mips define check above, although I don't know if  #  Similar to the mips define check above, although I don't know if
609  #  any OS actually defined sparc like this.  #  any OS actually defined sparc like this.
610  printf "checking for weird 'sparc' define... "  printf "checking for 'sparc' define... "
611  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
612  #ifdef sparc  #ifdef sparc
613  printf(\"1\");  printf(\"1\");
# Line 618  if [ -x _testprog ]; then Line 650  if [ -x _testprog ]; then
650          if [ z"$COMPAQCC" = zYES ]; then          if [ z"$COMPAQCC" = zYES ]; then
651                  CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop"                  CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop"
652          fi          fi
653    
654            if [ z"$UNSTABLE" = zYES ]; then
655                    printf "checking whether -Werror can be used... "
656                    rm -f _testprog
657                    $CC $CFLAGS $CWARNINGS _testprog.c -o _testprog -Werror 2> /dev/null
658                    if [ -x _testprog ]; then
659                            printf "yes\n"
660                            CWARNINGS="$CWARNINGS -Werror"
661                    else
662                            printf "no\n"
663                    fi
664            fi
665  else  else
666          printf "no\n"          printf "no\n"
667  fi  fi
# Line 625  rm -f _testprog Line 669  rm -f _testprog
669    
670    
671  if [ z"$COMPAQCC" = zYES ]; then  if [ z"$COMPAQCC" = zYES ]; then
672          #  -O4 is possible, but is -O3 better?          #  -O4 is possible, but sometimes -O3 is better?
673          CFLAGS="-O4 $CFLAGS"          CFLAGS="-O4 $CFLAGS"
674  else  else
675          if [ z"`uname`" = zSunOS ]; then          if [ z"`uname`" = zSunOS ]; then
# Line 640  else Line 684  else
684                  $CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null                  $CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null
685                  if [ -x _testprog ]; then                  if [ -x _testprog ]; then
686                          rm -f _testprog                          rm -f _testprog
687                          $CC $CFLAGS _testprog.c -o _testprog -O2 2> /dev/null                          $CC $CFLAGS _testprog.c -o _testprog -O3 2> /dev/null
688                          if [ -x _testprog ]; then                          if [ -x _testprog ]; then
689                                  CFLAGS="-O2 $CFLAGS"                                  CFLAGS="-O3 $CFLAGS"
690                          else                          else
691                                  CFLAGS="-O $CFLAGS"                                  CFLAGS="-O $CFLAGS"
692                          fi                          fi
# Line 730  fi Line 774  fi
774  rm -f _testprog _testprog.error _testprog.stdout  rm -f _testprog _testprog.error _testprog.stdout
775    
776    
777    #  -g
778    printf "checking whether -g can be used... "
779    if [ z"$COMPAQCC" = zYES ]; then
780            printf "skipping\n"
781    else
782            $CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1
783            cat _testprog.stdout >> _testprog.error
784            if [ -x _testprog ]; then
785                    CFLAGS="-g $CFLAGS"
786                    printf "yes\n"
787            else
788                    printf "no\n"
789            fi
790    fi
791    rm -f _testprog _testprog.error _testprog.stdout
792    
793    
794  #  -lrt for nanosleep?  #  -lrt for nanosleep?
795  printf "checking whether -lrt is required for nanosleep... "  printf "checking whether -lrt is required for nanosleep... "
796  printf "#include <time.h>\n#include <stdio.h>  printf "#include <time.h>\n#include <stdio.h>
# Line 961  rm -f _testoff.c _testoff Line 1022  rm -f _testoff.c _testoff
1022    
1023    
1024  #  Check for u_int8_t etc:  #  Check for u_int8_t etc:
1025    #  These are needed because some header files in src/include/ use u_int*
1026    #  instead of uint*, and I don't have time to rewrite them all.
1027  printf "checking for u_int8_t... "  printf "checking for u_int8_t... "
1028  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
1029  int main(int argc, char *argv[]){printf(\"%%i\\\n\",  int main(int argc, char *argv[]){printf(\"%%i\\\n\",
# Line 982  if [ ! -x _testuint ]; then Line 1045  if [ ! -x _testuint ]; then
1045          printf "typedef uint8_t u_int8_t;\n" >> config.h          printf "typedef uint8_t u_int8_t;\n" >> config.h
1046          printf "typedef uint16_t u_int16_t;\n" >> config.h          printf "typedef uint16_t u_int16_t;\n" >> config.h
1047          printf "typedef uint32_t u_int32_t;\n" >> config.h          printf "typedef uint32_t u_int32_t;\n" >> config.h
         printf "typedef uint64_t u_int64_t;\n" >> config.h  
1048          printf "uint8_t\n"          printf "uint8_t\n"
1049  else  else
1050          printf "yes\n"          printf "yes\n"
1051  fi  fi
1052  rm -f _testuint.c _testuint  rm -f _testuint.c _testuint
1053    
1054    printf "checking for u_int64_t... "
1055    printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n
1056    int main(int argc, char *argv[]){printf(\"%%i\\\n\",
1057     (int)sizeof(u_int64_t));return 0;}\n" > _testuint.c
1058    $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
1059    if [ ! -x _testuint ]; then
1060            rm -f _testuint*
1061            printf "#include <stdio.h>\n#include <inttypes.h>
1062            \n#include <sys/types.h>\nint main(int argc, char *argv[])
1063            {printf(\"%%i\\\n\", (int)sizeof(uint64_t));return 0;}\n" > _testuint.c
1064            $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
1065            if [ ! -x _testuint ]; then
1066                    printf "no\n\nERROR: No u_int64_t or uint64_t. Aborting\n"
1067                    #  TODO: Automagically detect using various combinations
1068                    #  of char, int, short, long etc.
1069                    exit
1070            fi
1071    
1072            printf "typedef uint64_t u_int64_t;\n" >> config.h
1073            printf "uint64_t\n"
1074    else
1075            printf "yes\n"
1076    fi
1077    rm -f _testuint.c _testuint
1078    
1079    
1080  ###############################################################################  ###############################################################################
1081  #  #
1082  #  Dynamic binary translation (BINTRANS):  #  OLD binary translation (BINTRANS):
1083  #  #
1084  ###############################################################################  ###############################################################################
1085    
# Line 1017  else Line 1104  else
1104                  BINTRANS=YES                  BINTRANS=YES
1105          fi          fi
1106    
1107          #  x86:  (all machines ending in "86" are treated as i386)          #  x86:
1108          if [ z"`uname -m|rev|cut -c1-2`" = z68 ]; then          if `uname -m|grep -v 64|grep -q 86`; then
1109                  printf "#define I386\n" >> config.h                  printf "#define I386\n" >> config.h
1110                  printf "#define BINTRANS\n" >> config.h                  printf "#define BINTRANS\n" >> config.h
1111                  printf "i386\n"                  printf "i386\n"
# Line 1056  fi Line 1143  fi
1143    
1144    
1145  ###############################################################################  ###############################################################################
1146    #
1147    #  Dyntrans recompilation (native backend) support:
1148    #
1149    ###############################################################################
1150    
1151    if [ z$DYNTRANSBACKEND = zYES ]; then
1152            printf "Dyntrans: Not yet.\n"
1153            exit
1154    
1155  #  Prefetch support?          printf "checking for dyntrans backend... "
1156  printf "checking for asm prefetch support... "          DBFOUND=NO
1157  if [ z"`uname -m`" = zalpha ]; then  
1158          rm -f _alpha_asm_test.c _alpha_asm_test          #  Alpha:
1159          printf 'int main(int argc, char *argv[])          if [ z"`uname -m`" = zalpha ]; then
1160           { int x; int *y = &x; asm ("ldl $31,0(%%0)" : : "g" (y));                  printf "#define DYNTRANS_BACKEND_ALPHA\n" >> config.h
1161            return 0; }\n' > _alpha_asm_test.c                  printf "Alpha\n"
1162          $CC $CFLAGS -O2 _alpha_asm_test.c -o _alpha_asm_test \                  CPU_BACKENDS="$CPU_BACKENDS backend_alpha.o"
1163              > /dev/null 2> /dev/null                  DBFOUND=YES
1164          if [ -x _alpha_asm_test ]; then          fi
1165  #               printf "#define HAVE_PREFETCH\n" >> config.h  
1166                  printf "#define PREFETCH(x) asm(\"ldl" >> config.h          #  AMD64:
1167                  printf " \$31,0(%%0)\" : : \"g\" (x))\n" >> config.h          #  TODO
1168                  echo "yes"  
1169                  PREFSUP=YES  #       #  UltraSPARC:
1170          fi  #       if [ z"`uname -m`" = zsun4u ]; then
1171          rm -f _alpha_asm_test.c _alpha_asm_test  #               printf "#define DYNTRANS_BACKEND_SPARC64\n" >> config.h
1172  fi  #               printf "UltraSPARC\n"
1173  if [ z$PREFSUP = z ]; then  #               CPU_BACKENDS="$CPU_BACKENDS backend_sparc.o"
1174          printf "#define PREFETCH(x) { }\n" >> config.h  #               DBFOUND=YES
1175          echo "no"  #       fi
1176    #       if [ z"`uname -m`" = zsparc64 ]; then
1177    #               printf "#define DYNTRANS_BACKEND_SPARC64\n" >> config.h
1178    #               printf "UltraSPARC\n"
1179    #               CPU_BACKENDS="$CPU_BACKENDS backend_sparc.o"
1180    #               DBFOUND=YES
1181    #       fi
1182    
1183            #  x86:
1184            if `uname -m|grep -q -v 64|grep -q 86`; then
1185                    printf "#define DYNTRANS_BACKEND_I386\n" >> config.h
1186                    printf "i386\n"
1187                    CPU_BACKENDS="$CPU_BACKENDS backend_i386.o"
1188                    DBFOUND=YES
1189            fi
1190    
1191            if [ z$DBFOUND = zYES ]; then
1192                    printf "#define DYNTRANS_BACKEND\n" >> config.h
1193            else
1194                    printf "not supported yet on this arch ("
1195                    printf `uname -m`
1196                    printf ")\n"
1197            fi
1198  fi  fi
1199    
1200    
1201  ###############################################################################  ###############################################################################
1202    
1203    #  Host byte order?
1204    printf "checking host endianness... "
1205    rm -f _test_end*
1206    printf '#include <stdio.h>
1207    int main(int argc, char *argv[])
1208    {  int x = 1; void *xp = (void *)&x; char *p = (char *)xp;
1209    if (*p) printf("little\\\n"); else printf("big\\\n"); }
1210    ' > _test_end.c
1211    $CC $CFLAGS _test_end.c -o _test_end 2> /dev/null
1212    X=`./_test_end`
1213    echo $X
1214    if [ z$X = zlittle ]; then
1215            printf "#define HOST_LITTLE_ENDIAN\n" >> config.h
1216    else
1217            if [ z$X = zbig ]; then
1218                    printf "#define HOST_BIG_ENDIAN\n" >> config.h
1219            else
1220                    echo "Error! Could not determine host's endianness."
1221                    exit
1222            fi
1223    fi
1224    rm -f _test_end*
1225    
1226    ###############################################################################
1227    
1228  INCLUDE=-Iinclude/  INCLUDE=-Iinclude/
1229  DINCLUDE=-I../include/  DINCLUDE=-I../include/
1230    
1231    rm -f _testprog.c
1232    
1233  echo C compiler flags: $CFLAGS $CWARNINGS  echo C compiler flags: $CFLAGS $CWARNINGS
1234  echo Linker flags: $OTHERLIBS  echo Linker flags: $OTHERLIBS
1235  echo "CWARNINGS=$CWARNINGS" >> _Makefile.header  echo "CWARNINGS=$CWARNINGS" >> _Makefile.header
# Line 1094  echo "INCLUDE=$INCLUDE" >> _Makefile.hea Line 1238  echo "INCLUDE=$INCLUDE" >> _Makefile.hea
1238  echo "DINCLUDE=$DINCLUDE" >> _Makefile.header  echo "DINCLUDE=$DINCLUDE" >> _Makefile.header
1239  echo "CC=$CC" >> _Makefile.header  echo "CC=$CC" >> _Makefile.header
1240  echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header  echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header
1241    echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header
1242    echo "CPU_BACKENDS=$CPU_BACKENDS" >> _Makefile.header
1243    echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header
1244  echo "" >> _Makefile.header  echo "" >> _Makefile.header
1245    
1246    
 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  
   
   
1247  #  Create the Makefiles:  #  Create the Makefiles:
1248    D=". src src/include src/cpus src/devices src/devices/fonts"
1249  for a in . src src/devices src/devices/fonts tests; do  D="$D src/machines src/promemul"
1250    for a in $D; do
1251          echo "creating $a/Makefile"          echo "creating $a/Makefile"
1252          touch $a/Makefile          touch $a/Makefile
1253          cat _Makefile.header > $a/Makefile          cat _Makefile.header > $a/Makefile

Legend:
Removed from v.10  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26