/[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 12 by dpavlin, Mon Oct 8 16:18:38 2007 UTC
# 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.155 2005/08/16 05:37:08 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 58  Line 58 
58  #  #
59  ###############################################################################  ###############################################################################
60    
61  ENABLEARM=YES  #  Figure out if this is a stable version (0.x.x).
62  ENABLEMIPS=YES  X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2`
63  ENABLEPPC=YES  if [ z"$X" = z0. ]; then
64  ENABLEURISC=YES          #  Stable:
65  ENABLEX86=NO          ENABLEMIPS=YES
66  STABLE=NO  else
67            #  Development:
68            ENABLEALPHA=YES
69            ENABLEARM=YES
70            ENABLEIA64=YES
71            ENABLEM68K=YES
72            ENABLEMIPS=YES
73            ENABLEPPC=YES
74            ENABLESPARC=YES
75            ENABLEX86=YES
76    fi
77    
78  if [ z"$*" != z ]; then  if [ z"$*" != z ]; then
79          #  Parse command line options:          #  Parse command line options:
# Line 82  if [ z"$*" != z ]; then Line 92  if [ z"$*" != z ]; then
92                          MIPS16=NO                          MIPS16=NO
93                  else if [ z$a = z--enable-mips16 ]; then                  else if [ z$a = z--enable-mips16 ]; then
94                          MIPS16=YES                          MIPS16=YES
95                    else if [ z$a = z--disable-alpha ]; then
96                            ENABLEALPHA=NO
97                    else if [ z$a = z--enable-alpha ]; then
98                            ENABLEALPHA=YES
99                  else if [ z$a = z--disable-arm ]; then                  else if [ z$a = z--disable-arm ]; then
100                          ENABLEARM=NO                          ENABLEARM=NO
101                  else if [ z$a = z--enable-arm ]; then                  else if [ z$a = z--enable-arm ]; then
102                          ENABLEARM=YES                          ENABLEARM=YES
103                    else if [ z$a = z--disable-ia64 ]; then
104                            ENABLEIA64=NO
105                    else if [ z$a = z--enable-ia64 ]; then
106                            ENABLEIA64=YES
107                    else if [ z$a = z--disable-m68k ]; then
108                            ENABLEM68K=NO
109                    else if [ z$a = z--enable-m68k ]; then
110                            ENABLEM86K=YES
111                  else if [ z$a = z--disable-mips ]; then                  else if [ z$a = z--disable-mips ]; then
112                          ENABLEMIPS=NO                          ENABLEMIPS=NO
113                  else if [ z$a = z--enable-mips ]; then                  else if [ z$a = z--enable-mips ]; then
# Line 94  if [ z"$*" != z ]; then Line 116  if [ z"$*" != z ]; then
116                          ENABLEPPC=NO                          ENABLEPPC=NO
117                  else if [ z$a = z--enable-ppc ]; then                  else if [ z$a = z--enable-ppc ]; then
118                          ENABLEPPC=YES                          ENABLEPPC=YES
119                  else if [ z$a = z--disable-urisc ]; then                  else if [ z$a = z--disable-sparc ]; then
120                          ENABLEURISC=NO                          ENABLESPARC=NO
121                  else if [ z$a = z--enable-urisc ]; then                  else if [ z$a = z--enable-sparc ]; then
122                          ENABLEURISC=YES                          ENABLESPARC=YES
123                  else if [ z$a = z--disable-x86 ]; then                  else if [ z$a = z--disable-x86 ]; then
124                          ENABLEX86=NO                          ENABLEX86=NO
125                  else if [ z$a = z--enable-x86 ]; then                  else if [ z$a = z--enable-x86 ]; then
# Line 112  if [ z"$*" != z ]; then Line 134  if [ z"$*" != z ]; then
134                          CACHES=YES                          CACHES=YES
135                  else if [ z$a = z--help ]; then                  else if [ z$a = z--help ]; then
136                          echo "usage: $0 [options]"                          echo "usage: $0 [options]"
137                          printf "\nDevelopment (debug) options:\n"  
138                          echo "  --always32         enable" \                          printf "\nGeneral options:\n\n"
139                              "ALWAYS_SIGNEXTEND_32 (for hunting down"  
140                          echo "                     32/64-bit bugs)"                          echo "  --disable-bintrans  configure without the" \
141                                "old binary translation subsystem,"
142                            echo "                      even if the host" \
143                                "supports it"
144                            echo "  --disable-x         don't include X11 support"
145    
146                            printf "\nDevelopment (debug) options:\n\n"
147    
148                            echo "  --always32         enable ALWAYS_SIGNEXTEND_32"\
149                                "(for hunting down 32-bit bugs)"
150                          echo "  --tracenull        enable" \                          echo "  --tracenull        enable" \
151                              "TRACE_NULL_CRASHES (for bug hunting)"                              "TRACE_NULL_CRASHES (for bug hunting)"
                         printf "\nGeneral options:\n"  
                         echo "  --disable-bintrans configure without" \  
                             "bintrans, even if the host supports it"  
152                          printf "  --enable-caches    enable cache emulation"                          printf "  --enable-caches    enable cache emulation"
153                          printf " (BUGGY)\n"                          printf " (BUGGY)\n"
154                          echo "  --enable-delays    enable instruction" \                          echo "  --enable-delays    enable instruction" \
155                              "latency/delay emulation"                              "latency/delay emulation"
156                          echo "  --disable-x        don't include X11 support"  
157                          printf "\nCPU selection options:\n"                          if [ z$ENABLEALPHA = zYES ]; then
158                          echo "  --disable-arm      disable ARM CPU emulation"                                  printf "  --disable-alpha    disable "
159                          echo "  --disable-mips     disable MIPS CPU emulation"                          else
160                          echo "  --disable-ppc      disable PPC CPU emulation"                                  printf "  --enable-alpha     enable "
161                          echo "  --disable-urisc    disable URISC CPU emulation"                          fi
162                          if [ z$STABLE = zNO ]; then                          printf "Alpha CPU emulation\n"
163                                  printf "  --enable-x86       "  
164                                  printf "enable x86 CPU emulation"                          if [ z$ENABLEARM = zYES ]; then
165                                  printf " (NOT YET)\n"                                  printf "  --disable-arm      disable "
166                            else
167                                    printf "  --enable-arm       enable "
168                            fi
169                            printf "ARM CPU emulation\n"
170    
171                            if [ z$ENABLEIA64 = zYES ]; then
172                                    printf "  --disable-ia64     disable "
173                            else
174                                    printf "  --enable-ia64      enable "
175                            fi
176                            printf "IA64 CPU emulation\n"
177    
178                            if [ z$ENABLEM68K = zYES ]; then
179                                    printf "  --disable-m68k     disable "
180                            else
181                                    printf "  --enable-m68k      enable "
182                            fi
183                            printf "M68K CPU emulation\n"
184    
185                            if [ z$ENABLEMIPS = zYES ]; then
186                                    printf "  --disable-mips     disable "
187                            else
188                                    printf "  --enable-mips      enable "
189                            fi
190                            printf "MIPS CPU emulation\n"
191    
192                            if [ z$ENABLEPPC = zYES ]; then
193                                    printf "  --disable-ppc      disable "
194                            else
195                                    printf "  --enable-ppc       enable "
196                            fi
197                            printf "POWER/PPC CPU emulation\n"
198    
199                            if [ z$ENABLESPARC = zYES ]; then
200                                    printf "  --disable-sparc    disable "
201                            else
202                                    printf "  --enable-sparc     enable "
203                          fi                          fi
204                          printf "\nMIPS-specific options:\n"                          printf "SPARC CPU emulation\n"
205                          printf "  --enable-mips16    enable MIPS16 instruction"  
206                          printf " support (NOT YET)\n\n"                          if [ z$ENABLEX86 = zYES ]; then
207                                    printf "  --disable-x86      disable "
208                            else
209                                    printf "  --enable-x86       enable "
210                            fi
211                            printf "x86 CPU emulation\n"
212    
213                            echo "  --enable-mips16    enable MIPS16 support"
214    
215                            printf "\n(Pretty much all of these options are only"
216                            printf " meaningful during the development of\nthe"
217                            printf " emulator, and should not be used when "
218                            printf "compiling a stable version.)\n"
219                          exit                          exit
220                  else                  else
221                          echo "Invalid option: $a"                          echo "Invalid option: $a"
222                          echo "Run  $0 --help  to get a list of" \                          echo "Run  $0 --help  to get a list of" \
223                              "available options."                              "available options."
224                          exit                          exit
225                  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
226                  fi; fi; fi; fi; fi; fi; fi                  fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi
227          done          done
228  fi  fi
229    
# Line 187  if [ z$MIPS16 = zYES ]; then Line 264  if [ z$MIPS16 = zYES ]; then
264          printf 'NOTE: MIPS16 support is not really working yet.\n'          printf 'NOTE: MIPS16 support is not really working yet.\n'
265          printf "#define ENABLE_MIPS16\n" >> config.h          printf "#define ENABLE_MIPS16\n" >> config.h
266  fi  fi
267    if [ z$ENABLEALPHA = zYES ]; then
268            printf "#define ENABLE_ALPHA\n" >> config.h
269            CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o"
270    fi
271  if [ z$ENABLEARM = zYES ]; then  if [ z$ENABLEARM = zYES ]; then
272          printf "#define ENABLE_ARM\n" >> config.h          printf "#define ENABLE_ARM\n" >> config.h
273            CPU_ARCHS="$CPU_ARCHS cpu_arm.o"
274    fi
275    if [ z$ENABLEIA64 = zYES ]; then
276            printf "#define ENABLE_IA64\n" >> config.h
277            CPU_ARCHS="$CPU_ARCHS cpu_ia64.o"
278    fi
279    if [ z$ENABLEM68K = zYES ]; then
280            printf "#define ENABLE_M68K\n" >> config.h
281            CPU_ARCHS="$CPU_ARCHS cpu_m68k.o"
282  fi  fi
283  if [ z$ENABLEMIPS = zYES ]; then  if [ z$ENABLEMIPS = zYES ]; then
284          printf "#define ENABLE_MIPS\n" >> config.h          printf "#define ENABLE_MIPS\n" >> config.h
285  fi  fi
286  if [ z$ENABLEPPC = zYES ]; then  if [ z$ENABLEPPC = zYES ]; then
287          printf "#define ENABLE_PPC\n" >> config.h          printf "#define ENABLE_PPC\n" >> config.h
288            CPU_ARCHS="$CPU_ARCHS cpu_ppc.o"
289  fi  fi
290  if [ z$ENABLEURISC = zYES ]; then  if [ z$ENABLESPARC = zYES ]; then
291          printf "#define ENABLE_URISC\n" >> config.h          printf "#define ENABLE_SPARC\n" >> config.h
292            CPU_ARCHS="$CPU_ARCHS cpu_sparc.o"
293  fi  fi
294  if [ z$ENABLEX86 = zYES ]; then  if [ z$ENABLEX86 = zYES ]; then
295          printf "#define ENABLE_X86\n" >> config.h          printf "#define ENABLE_X86\n" >> config.h
296          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  
297  fi  fi
298    
299    
# Line 448  if [ z$OSF1 = zYES ]; then Line 534  if [ z$OSF1 = zYES ]; then
534  fi  fi
535    
536    
537  #  Check for weird 'alpha' define.  #  Check for 'alpha' define.
538  printf "checking for weird 'alpha' define... "  printf "checking for 'alpha' define... "
539  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
540  #ifdef alpha  #ifdef alpha
541  printf(\"1\");  printf(\"1\");
# Line 479  fi Line 565  fi
565  rm -f _testm*  rm -f _testm*
566    
567    
 #  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*  
   
   
568  #  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)
569  printf "checking for weird 'mips' define... "  printf "checking for 'mips' define... "
570  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
571  #ifdef mips  #ifdef mips
572  printf(\"1\");  printf(\"1\");
# Line 543  rm -f _testm* Line 598  rm -f _testm*
598    
599  #  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
600  #  any OS actually defined ppc like this.  #  any OS actually defined ppc like this.
601  printf "checking for weird 'ppc' define... "  printf "checking for 'ppc' define... "
602  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
603  #ifdef ppc  #ifdef ppc
604  printf(\"1\");  printf(\"1\");
# Line 575  rm -f _testm* Line 630  rm -f _testm*
630    
631  #  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
632  #  any OS actually defined sparc like this.  #  any OS actually defined sparc like this.
633  printf "checking for weird 'sparc' define... "  printf "checking for 'sparc' define... "
634  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
635  #ifdef sparc  #ifdef sparc
636  printf(\"1\");  printf(\"1\");
# Line 1057  fi Line 1112  fi
1112    
1113  ###############################################################################  ###############################################################################
1114    
1115    #  Host byte order?
1116    printf "checking host endianness... "
1117    rm -f _test_end*
1118    printf '#include <stdio.h>
1119    int main(int argc, char *argv[])
1120    {  int x = 1; void *xp = (void *)&x; char *p = (char *)xp;
1121    if (*p) printf("little\\\n"); else printf("big\\\n"); }
1122    ' > _test_end.c
1123    $CC $CFLAGS _test_end.c -o _test_end 2> /dev/null
1124    X=`./_test_end`
1125    echo $X
1126    if [ z$X = zlittle ]; then
1127            printf "#define HOST_LITTLE_ENDIAN\n" >> config.h
1128    else
1129            if [ z$X = zbig ]; then
1130                    printf "#define HOST_BIG_ENDIAN\n" >> config.h
1131            else
1132                    echo "Error! Could not determine host's endianness."
1133                    exit
1134            fi
1135    fi
1136    rm -f _test_end*
1137    
1138    ###############################################################################
1139    
1140  #  Prefetch support?  #  Prefetch support?
1141  printf "checking for asm prefetch support... "  printf "checking for asm prefetch support... "
1142  if [ z"`uname -m`" = zalpha ]; then  if [ z"`uname -m`" = zalpha ]; then
# Line 1086  fi Line 1166  fi
1166  INCLUDE=-Iinclude/  INCLUDE=-Iinclude/
1167  DINCLUDE=-I../include/  DINCLUDE=-I../include/
1168    
1169    rm -f _testprog.c
1170    
1171  echo C compiler flags: $CFLAGS $CWARNINGS  echo C compiler flags: $CFLAGS $CWARNINGS
1172  echo Linker flags: $OTHERLIBS  echo Linker flags: $OTHERLIBS
1173  echo "CWARNINGS=$CWARNINGS" >> _Makefile.header  echo "CWARNINGS=$CWARNINGS" >> _Makefile.header
# Line 1094  echo "INCLUDE=$INCLUDE" >> _Makefile.hea Line 1176  echo "INCLUDE=$INCLUDE" >> _Makefile.hea
1176  echo "DINCLUDE=$DINCLUDE" >> _Makefile.header  echo "DINCLUDE=$DINCLUDE" >> _Makefile.header
1177  echo "CC=$CC" >> _Makefile.header  echo "CC=$CC" >> _Makefile.header
1178  echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header  echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header
1179    echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header
1180  echo "" >> _Makefile.header  echo "" >> _Makefile.header
1181    
1182    
 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  
   
   
1183  #  Create the Makefiles:  #  Create the Makefiles:
1184    
1185  for a in . src src/devices src/devices/fonts tests; do  for a in . src src/devices src/devices/fonts; do
1186          echo "creating $a/Makefile"          echo "creating $a/Makefile"
1187          touch $a/Makefile          touch $a/Makefile
1188          cat _Makefile.header > $a/Makefile          cat _Makefile.header > $a/Makefile

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

  ViewVC Help
Powered by ViewVC 1.1.26