/[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 2 by dpavlin, Mon Oct 8 16:17:48 2007 UTC revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC
# Line 27  Line 27 
27  #  SUCH DAMAGE.  #  SUCH DAMAGE.
28  #  #
29  #  #
30  #  $Id: configure,v 1.119 2005/03/14 12:13:49 debug Exp $  #  $Id: configure,v 1.180 2005/11/23 22:03:23 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 52  Line 52 
52  #    o)  prefetch capability  (TODO: this is assumed on Alpha, but not all  #    o)  prefetch capability  (TODO: this is assumed on Alpha, but not all
53  #                              Alphas have it...)  #                              Alphas have it...)
54  #  #
55    #  TODO:
56    #    o)  do not enable prefetch on Alpha ev4 or ev5, only on pca56 and newer
57    #    o)  X11 libs and includes via command line options?
58    #
59  ###############################################################################  ###############################################################################
60    
61  ENABLEALPHA=YES  #  Figure out if this is a stable version (0.x.x).
62  ENABLEHPPA=YES  X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2`
63  ENABLEMIPS=YES  if [ z"$X" = z0. ]; then
64  ENABLEPPC=YES          #  Stable:
65  ENABLESPARC=YES          ENABLEARM=YES
66  ENABLEURISC=YES          ENABLEMIPS=YES
67            ENABLEPPC=YES
68    else
69            #  Development:
70            ENABLEALPHA=YES
71            ENABLEARM=YES
72            ENABLEAVR=NO
73            ENABLEHPPA=NO
74            ENABLEI960=NO
75            ENABLEIA64=NO
76            ENABLEM68K=NO
77            ENABLEMIPS=YES
78            ENABLENEWMIPS=NO
79            ENABLEPPC=YES
80            ENABLESH=NO
81            ENABLESPARC=NO
82            ENABLEX86=NO
83    fi
84    
85  if [ z"$*" != z ]; then  if [ z"$*" != z ]; then
86          #  Parse command line options:          #  Parse command line options:
# Line 68  if [ z"$*" != z ]; then Line 89  if [ z"$*" != z ]; then
89                          NOX11=YES                          NOX11=YES
90                  else if [ z$a = z--always32 ]; then                  else if [ z$a = z--always32 ]; then
91                          ALWAYS32=YES                          ALWAYS32=YES
92                    else if [ z$a = z--tracenull ]; then
93                            TRACENULL=YES
94                  else if [ z$a = z--disable-bintrans ]; then                  else if [ z$a = z--disable-bintrans ]; then
95                          NOBINTRANS=YES                          NOBINTRANS=YES
96                    else if [ z$a = z--enable-bintrans ]; then
97                            NOBINTRANS=NO
98                    else if [ z$a = z--disable-mips16 ]; then
99                            MIPS16=NO
100                  else if [ z$a = z--enable-mips16 ]; then                  else if [ z$a = z--enable-mips16 ]; then
101                          MIPS16=YES                          MIPS16=YES
102                    else if [ z$a = z--enable-all ]; then
103                            ENABLEALPHA=YES
104                            ENABLEARM=YES
105                            ENABLEAVR=YES
106                            ENABLEHPPA=YES
107                            ENABLEI960=YES
108                            ENABLEIA64=YES
109                            ENABLEM68K=YES
110                            ENABLEMIPS=YES
111                            ENABLENEWMIPS=YES
112                            ENABLEPPC=YES
113                            ENABLESH=YES
114                            ENABLESPARC=YES
115                            ENABLEX86=YES
116                  else if [ z$a = z--disable-alpha ]; then                  else if [ z$a = z--disable-alpha ]; then
117                          ENABLEALPHA=NO                          ENABLEALPHA=NO
118                    else if [ z$a = z--enable-alpha ]; then
119                            ENABLEALPHA=YES
120                    else if [ z$a = z--disable-arm ]; then
121                            ENABLEARM=NO
122                    else if [ z$a = z--enable-arm ]; then
123                            ENABLEARM=YES
124                    else if [ z$a = z--disable-avr ]; then
125                            ENABLEAVR=NO
126                    else if [ z$a = z--enable-avr ]; then
127                            ENABLEAVR=YES
128                  else if [ z$a = z--disable-hppa ]; then                  else if [ z$a = z--disable-hppa ]; then
129                          ENABLEHPPA=NO                          ENABLEHPPA=NO
130                    else if [ z$a = z--enable-hppa ]; then
131                            ENABLEHPPA=YES
132                    else if [ z$a = z--disable-i960 ]; then
133                            ENABLEI960=NO
134                    else if [ z$a = z--enable-i960 ]; then
135                            ENABLEI960=YES
136                    else if [ z$a = z--disable-ia64 ]; then
137                            ENABLEIA64=NO
138                    else if [ z$a = z--enable-ia64 ]; then
139                            ENABLEIA64=YES
140                    else if [ z$a = z--disable-m68k ]; then
141                            ENABLEM68K=NO
142                    else if [ z$a = z--enable-m68k ]; then
143                            ENABLEM86K=YES
144                  else if [ z$a = z--disable-mips ]; then                  else if [ z$a = z--disable-mips ]; then
145                          ENABLEMIPS=NO                          ENABLEMIPS=NO
146                    else if [ z$a = z--enable-mips ]; then
147                            ENABLEMIPS=YES
148                    else if [ z$a = z--disable-newmips ]; then
149                            ENABLENEWMIPS=NO
150                    else if [ z$a = z--enable-newmips ]; then
151                            ENABLENEWMIPS=YES
152                  else if [ z$a = z--disable-ppc ]; then                  else if [ z$a = z--disable-ppc ]; then
153                          ENABLEPPC=NO                          ENABLEPPC=NO
154                    else if [ z$a = z--enable-ppc ]; then
155                            ENABLEPPC=YES
156                    else if [ z$a = z--disable-sh ]; then
157                            ENABLESH=NO
158                    else if [ z$a = z--enable-sh ]; then
159                            ENABLESH=YES
160                  else if [ z$a = z--disable-sparc ]; then                  else if [ z$a = z--disable-sparc ]; then
161                          ENABLESPARC=NO                          ENABLESPARC=NO
162                  else if [ z$a = z--disable-urisc ]; then                  else if [ z$a = z--enable-sparc ]; then
163                          ENABLEURISC=NO                          ENABLESPARC=YES
164                    else if [ z$a = z--disable-x86 ]; then
165                            ENABLEX86=NO
166                    else if [ z$a = z--enable-x86 ]; then
167                            ENABLEX86=YES
168                    else if [ z$a = z--disable-delays ]; then
169                            DELAYS=NO
170                  else if [ z$a = z--enable-delays ]; then                  else if [ z$a = z--enable-delays ]; then
171                          DELAYS=YES                          DELAYS=YES
172                    else if [ z$a = z--disable-caches ]; then
173                            CACHES=NO
174                  else if [ z$a = z--enable-caches ]; then                  else if [ z$a = z--enable-caches ]; then
175                          CACHES=YES                          CACHES=YES
176                  else if [ z$a = z--help ]; then                  else if [ z$a = z--help ]; then
177                          echo "usage: $0 [options]"                          echo "usage: $0 [options]"
178                          printf "\nDevelopment (debug) options:\n"  
179                          echo "  --always32          enable" \                          printf "\nGeneral options:\n\n"
180                              "ALWAYS_SIGNEXTEND_32 (for hunting down"  
181                          echo "                      32/64-bit bugs)"                          echo "  --disable-bintrans  configure without the" \
182                          printf "\nGeneral options:\n"                              "old binary translation subsystem,"
183                          echo "  --disable-bintrans  configure without" \                          echo "                      even if the host" \
184                              "bintrans, even if the host supports it"                              "supports it"
                         echo "  --enable-caches     enable cache emulation" \  
                             "(experimental)"  
                         echo "  --enable-delays     enable instruction" \  
                             "latency/delay emulation"  
185                          echo "  --disable-x         don't include X11 support"                          echo "  --disable-x         don't include X11 support"
186                          printf "\nCPU selection options:\n"  
187                          echo "  --disable-alpha     disable Alpha CPU emulation"                          printf "\nDevelopment (debug) options:\n\n"
188                          echo "  --disable-hppa      disable HPPA CPU emulation"  
189                          echo "  --disable-mips      disable MIPS CPU emulation"                          echo "  --always32         enable ALWAYS_SIGNEXTEND_32"\
190                          echo "  --disable-ppc       disable PPC CPU emulation"                              "(for hunting down 32-bit bugs)"
191                          echo "  --disable-sparc     disable SPARC CPU emulation"                          echo "  --tracenull        enable" \
192                          echo "  --disable-urisc     disable URISC CPU emulation"                              "TRACE_NULL_CRASHES (for bug hunting)"
193                          printf "\nMIPS-specific options:\n"                          printf "  --enable-caches    enable cache emulation"
194                          echo "  --enable-mips16     enable MIPS16 instruction" \                          printf " (BUGGY)\n"
195                              "support (experimental)"                          echo "  --enable-delays    enable instruction" \
196                          printf "\n"                              "latency/delay emulation"
197    
198                            printf "  --enable-all       enable everything\n"
199    
200                            if [ z$ENABLEALPHA = zYES ]; then
201                                    printf "  --disable-alpha    disable "
202                            else
203                                    printf "  --enable-alpha     enable "
204                            fi
205                            printf "Alpha CPU emulation\n"
206    
207                            if [ z$ENABLEARM = zYES ]; then
208                                    printf "  --disable-arm      disable "
209                            else
210                                    printf "  --enable-arm       enable "
211                            fi
212                            printf "ARM CPU emulation\n"
213    
214                            if [ z$ENABLEAVR = zYES ]; then
215                                    printf "  --disable-avr      disable "
216                            else
217                                    printf "  --enable-avr       enable "
218                            fi
219                            printf "Atmel AVR CPU emulation\n"
220    
221                            if [ z$ENABLEHPPA = zYES ]; then
222                                    printf "  --disable-hppa     disable "
223                            else
224                                    printf "  --enable-hppa      enable "
225                            fi
226                            printf "HPPA CPU emulation\n"
227    
228                            if [ z$ENABLEI960 = zYES ]; then
229                                    printf "  --disable-i960     disable "
230                            else
231                                    printf "  --enable-i960      enable "
232                            fi
233                            printf "i960 CPU emulation\n"
234    
235                            if [ z$ENABLEIA64 = zYES ]; then
236                                    printf "  --disable-ia64     disable "
237                            else
238                                    printf "  --enable-ia64      enable "
239                            fi
240                            printf "IA64 CPU emulation\n"
241    
242                            if [ z$ENABLEM68K = zYES ]; then
243                                    printf "  --disable-m68k     disable "
244                            else
245                                    printf "  --enable-m68k      enable "
246                            fi
247                            printf "M68K CPU emulation\n"
248    
249                            if [ z$ENABLEMIPS = zYES ]; then
250                                    printf "  --disable-mips     disable "
251                            else
252                                    printf "  --enable-mips      enable "
253                            fi
254                            printf "MIPS CPU emulation\n"
255    
256                            if [ z$ENABLENEWMIPS = zYES ]; then
257                                    printf "  --disable-newmips  disable "
258                            else
259                                    printf "  --enable-newmips   enable "
260                            fi
261                            printf "(New, dyntrans) MIPS CPU emulation\n"
262    
263                            if [ z$ENABLEPPC = zYES ]; then
264                                    printf "  --disable-ppc      disable "
265                            else
266                                    printf "  --enable-ppc       enable "
267                            fi
268                            printf "POWER/PPC CPU emulation\n"
269    
270                            if [ z$ENABLESH = zYES ]; then
271                                    printf "  --disable-sh       disable "
272                            else
273                                    printf "  --enable-sh        enable "
274                            fi
275                            printf "SH CPU emulation\n"
276    
277                            if [ z$ENABLESPARC = zYES ]; then
278                                    printf "  --disable-sparc    disable "
279                            else
280                                    printf "  --enable-sparc     enable "
281                            fi
282                            printf "SPARC CPU emulation\n"
283    
284                            if [ z$ENABLEX86 = zYES ]; then
285                                    printf "  --disable-x86      disable "
286                            else
287                                    printf "  --enable-x86       enable "
288                            fi
289                            printf "x86 CPU emulation\n"
290    
291                            echo "  --enable-mips16    enable MIPS16 support"
292    
293                            printf "\n(Pretty much all of these options are only"
294                            printf " meaningful during the development of\nthe"
295                            printf " emulator, and should not be used when "
296                            printf "compiling a stable version.)\n"
297                          exit                          exit
298                  else                  else
299                          echo "Invalid option: $a"                          echo "Invalid option: $a"
300                          echo "Run  $0 --help  to get a list of" \                          echo "Run  $0 --help  to get a list of" \
301                              "available options."                              "available options."
302                          exit                          exit
303                  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
304                    fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi
305                    fi; fi; fi; fi; fi; fi; fi
306          done          done
307  fi  fi
308    
# Line 143  printf "/* Line 326  printf "/*
326  #  Figure out if VERSION should be defined.  #  Figure out if VERSION should be defined.
327  X=`basename \`pwd\`|cut -d \- -f 2-`  X=`basename \`pwd\`|cut -d \- -f 2-`
328  if [ z"$X" = zgxemul ]; then  if [ z"$X" = zgxemul ]; then
329          echo '#  No VERSION defined.' >> _Makefile.header          echo '/*  No VERSION defined.  */' >> config.h
330  else  else
331          printf "#define VERSION \"$X\"\n" >> config.h          printf "#define VERSION \"$X\"\n" >> config.h
332  fi  fi
# Line 162  if [ z$MIPS16 = zYES ]; then Line 345  if [ z$MIPS16 = zYES ]; then
345  fi  fi
346  if [ z$ENABLEALPHA = zYES ]; then  if [ z$ENABLEALPHA = zYES ]; then
347          printf "#define ENABLE_ALPHA\n" >> config.h          printf "#define ENABLE_ALPHA\n" >> config.h
348  else          CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o"
349          echo 'Disabling Alpha emulation support.'          CPU_TOOLS="$CPU_TOOLS generate_alpha_misc"
350    fi
351    if [ z$ENABLEARM = zYES ]; then
352            printf "#define ENABLE_ARM\n" >> config.h
353            CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o "
354            CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o tmp_arm_r.o"
355            CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o"
356            CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o"
357            CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o"
358            CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o"
359            CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o"
360            CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o"
361            CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o"
362            CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o tmp_arm_multi.o"
363            CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r"
364            CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi"
365    fi
366    if [ z$ENABLEAVR = zYES ]; then
367            printf "#define ENABLE_AVR\n" >> config.h
368            CPU_ARCHS="$CPU_ARCHS cpu_avr.o"
369  fi  fi
370  if [ z$ENABLEHPPA = zYES ]; then  if [ z$ENABLEHPPA = zYES ]; then
371          printf "#define ENABLE_HPPA\n" >> config.h          printf "#define ENABLE_HPPA\n" >> config.h
372  else          CPU_ARCHS="$CPU_ARCHS cpu_hppa.o"
373          echo 'Disabling HPPA emulation support.'  fi
374    if [ z$ENABLEI960 = zYES ]; then
375            printf "#define ENABLE_I960\n" >> config.h
376            CPU_ARCHS="$CPU_ARCHS cpu_i960.o"
377    fi
378    if [ z$ENABLEIA64 = zYES ]; then
379            printf "#define ENABLE_IA64\n" >> config.h
380            CPU_ARCHS="$CPU_ARCHS cpu_ia64.o"
381    fi
382    if [ z$ENABLEM68K = zYES ]; then
383            printf "#define ENABLE_M68K\n" >> config.h
384            CPU_ARCHS="$CPU_ARCHS cpu_m68k.o"
385  fi  fi
386  if [ z$ENABLEMIPS = zYES ]; then  if [ z$ENABLEMIPS = zYES ]; then
387          printf "#define ENABLE_MIPS\n" >> config.h          printf "#define ENABLE_MIPS\n" >> config.h
388  else  fi
389          echo 'Disabling MIPS emulation support.'  if [ z$ENABLENEWMIPS = zYES ]; then
390            printf "#define ENABLE_NEWMIPS\n" >> config.h
391            CPU_ARCHS="$CPU_ARCHS cpu_newmips.o"
392  fi  fi
393  if [ z$ENABLEPPC = zYES ]; then  if [ z$ENABLEPPC = zYES ]; then
394          printf "#define ENABLE_PPC\n" >> config.h          printf "#define ENABLE_PPC\n" >> config.h
395  else          CPU_ARCHS="$CPU_ARCHS cpu_ppc.o"
396          echo 'Disabling PPC emulation support.'          CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore"
397    fi
398    if [ z$ENABLESH = zYES ]; then
399            printf "#define ENABLE_SH\n" >> config.h
400            CPU_ARCHS="$CPU_ARCHS cpu_sh.o"
401  fi  fi
402  if [ z$ENABLESPARC = zYES ]; then  if [ z$ENABLESPARC = zYES ]; then
403          printf "#define ENABLE_SPARC\n" >> config.h          printf "#define ENABLE_SPARC\n" >> config.h
404  else          CPU_ARCHS="$CPU_ARCHS cpu_sparc.o"
         echo 'Disabling SPARC emulation support.'  
405  fi  fi
406  if [ z$ENABLEURISC = zYES ]; then  if [ z$ENABLEX86 = zYES ]; then
407          printf "#define ENABLE_URISC\n" >> config.h          printf "#define ENABLE_X86\n" >> config.h
408  else          CPU_ARCHS="$CPU_ARCHS cpu_x86.o"
         echo 'Disabling URISC emulation support.'  
409  fi  fi
410    
411    
# Line 199  if [ z$DELAYS = zYES ]; then Line 416  if [ z$DELAYS = zYES ]; then
416  fi  fi
417    
418    
419  #  Instruction delay/latency emulation:  #  Development option: ALWAYS_SIGNEXTEND_32
420  if [ z$ALWAYS32 = zYES ]; then  if [ z$ALWAYS32 = zYES ]; then
421          echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \          echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \
422              'This slows down everything.)'              'This slows down everything.)'
# Line 207  if [ z$ALWAYS32 = zYES ]; then Line 424  if [ z$ALWAYS32 = zYES ]; then
424  fi  fi
425    
426    
427    #  Development option: TRACE_NULL_CRASHES
428    if [ z$TRACENULL = zYES ]; then
429            echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \
430                'This slows down the emulator.)'
431            printf "#define TRACE_NULL_CRASHES\n" >> config.h
432    fi
433    
434    
435  #  Cache emulation:  #  Cache emulation:
436  if [ z$CACHES = zYES ]; then  if [ z$CACHES = zYES ]; then
437          echo 'Enabling Cache emulation. (EXPERIMENTAL)'          echo 'Enabling Cache emulation. (EXPERIMENTAL)'
# Line 218  if [ z$CACHES = zYES ]; then Line 443  if [ z$CACHES = zYES ]; then
443                  printf '         (--delays) will not produce correct '                  printf '         (--delays) will not produce correct '
444                  printf 'cache miss penalties and such.\n'                  printf 'cache miss penalties and such.\n'
445          fi          fi
446    
447            printf "\nNOTE: Cache emulation enabled, but right now it triggers "
448            printf "weird bugs in the\n      emulator. You have been warned.\n\n"
449  fi  fi
450    
451    
# Line 295  if [ z"$CC" = z ]; then Line 523  if [ z"$CC" = z ]; then
523          fi          fi
524          rm -f _testprog          rm -f _testprog
525    
526          #  Try ccc (FreeBSD/Alpha):  #       #  Try ccc (FreeBSD/Alpha):
527          printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh  #       printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh
528          printf " /dev/null 2> /dev/null\n" >> _test.sh  #       printf " /dev/null 2> /dev/null\n" >> _test.sh
529          chmod 755 _test.sh  #       chmod 755 _test.sh
530          ./_test.sh > /dev/null 2> /dev/null  #       ./_test.sh > /dev/null 2> /dev/null
531          if [ -x _testprog ]; then  #       if [ -x _testprog ]; then
532                  CC="ccc"  #               CC="ccc"
533          fi  #       fi
534          rm -f _testprog  #       rm -f _testprog
535    
536          rm -f _test.sh          rm -f _test.sh
537  fi  fi
# Line 418  if [ z$OSF1 = zYES ]; then Line 646  if [ z$OSF1 = zYES ]; then
646  fi  fi
647    
648    
649  #  Check for weird 'alpha' define.  #  Check for 'alpha' define.
650  printf "checking for weird 'alpha' define... "  printf "checking for 'alpha' define... "
651  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
652  #ifdef alpha  #ifdef alpha
653  printf(\"1\");  printf(\"1\");
# Line 449  fi Line 677  fi
677  rm -f _testm*  rm -f _testm*
678    
679    
 #  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*  
   
   
680  #  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)
681  printf "checking for weird 'mips' define... "  printf "checking for 'mips' define... "
682  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
683  #ifdef mips  #ifdef mips
684  printf(\"1\");  printf(\"1\");
# Line 513  rm -f _testm* Line 710  rm -f _testm*
710    
711  #  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
712  #  any OS actually defined ppc like this.  #  any OS actually defined ppc like this.
713  printf "checking for weird 'ppc' define... "  printf "checking for 'ppc' define... "
714  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
715  #ifdef ppc  #ifdef ppc
716  printf(\"1\");  printf(\"1\");
# Line 545  rm -f _testm* Line 742  rm -f _testm*
742    
743  #  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
744  #  any OS actually defined sparc like this.  #  any OS actually defined sparc like this.
745  printf "checking for weird 'sparc' define... "  printf "checking for 'sparc' define... "
746  printf "#include <stdio.h>\nint main(int argc, char *argv[]){  printf "#include <stdio.h>\nint main(int argc, char *argv[]){
747  #ifdef sparc  #ifdef sparc
748  printf(\"1\");  printf(\"1\");
# Line 682  fi Line 879  fi
879  rm -f _testprog _testprog.error _testprog.stdout  rm -f _testprog _testprog.error _testprog.stdout
880    
881    
 #  -fmove-all-movables  
 printf "checking whether -fmove-all-movables can be used... "  
 $CC $CFLAGS -fmove-all-movables _testprog.c -o \  
     _testprog > _testprog.stdout 2>&1  
 cat _testprog.stdout >> _testprog.error  
 if grep movables _testprog.error > /dev/null 2>&1; then  
         printf "no\n"  
 else  
         if [ -x _testprog ]; then  
                 CFLAGS="-fmove-all-movables $CFLAGS"  
                 printf "yes\n"  
         else  
                 printf "no\n"  
         fi  
 fi  
 rm -f _testprog _testprog.error _testprog.stdout  
   
   
882  #  -fomit-frame-pointer  #  -fomit-frame-pointer
883  printf "checking whether -fomit-frame-pointer can be used... "  printf "checking whether -fomit-frame-pointer can be used... "
884  $CC $CFLAGS -fomit-frame-pointer _testprog.c -o \  $CC $CFLAGS -fomit-frame-pointer _testprog.c -o \
# Line 796  fi Line 975  fi
975  rm -f _testr.[co] _testr  rm -f _testr.[co] _testr
976    
977    
978    #  strlcpy missing?
979    printf "checking for strlcpy... "
980    printf "#include <string.h>
981    int main(int argc, char *argv[]) { char *p; char *q; size_t x;
982      x = strlcpy(p, q, 50); return 0;}\n" > _tests.c
983    $CC $CFLAGS _tests.c -o _tests 2> /dev/null
984    if [ ! -x _tests ]; then
985            printf "missing, using mystrlcpy\n"
986            printf "#define strlcpy mystrlcpy\n" >> config.h
987            printf "#define strlcat mystrlcat\n" >> config.h
988            printf "#define USE_STRLCPY_REPLACEMENTS\n" >> config.h
989    else
990            printf "found\n"
991    fi
992    rm -f _tests.[co] _tests
993    
994    
995  #  strtoull missing?  #  strtoull missing?
996  printf "checking for strtoull... "  printf "checking for strtoull... "
997  printf "#include <stdlib.h>  printf "#include <stdlib.h>
# Line 808  if [ ! -x _tests ]; then Line 1004  if [ ! -x _tests ]; then
1004          printf "missing, using mystrtoull\n"          printf "missing, using mystrtoull\n"
1005          printf "#define strtoull mystrtoull\n" >> config.h          printf "#define strtoull mystrtoull\n" >> config.h
1006  else  else
1007          printf "yes\n"          printf "found\n"
1008  fi  fi
1009  rm -f _testlong* _tests.[co] _tests  rm -f _tests.[co] _tests
1010    
1011    
1012    #  mkstemp missing?
1013    printf "checking for mkstemp... "
1014    printf "#include <unistd.h>
1015    int main(int argc, char *argv[]) { int x; char *y = \"abc\";
1016    x = mkstemp(y); return 0;}\n" > _tests.c
1017    $CC $CFLAGS _tests.c -o _tests 2> /dev/null
1018    if [ ! -x _tests ]; then
1019            printf "missing, using workaround\n"
1020            printf "#define mkstemp mymkstemp\n" >> config.h
1021    else
1022            printf "found\n"
1023    fi
1024    rm -f _tests.[co] _tests
1025    
1026    
1027  #  fseeko missing?  #  fseeko missing?
# Line 822  printf "#include <stdlib.h> Line 1033  printf "#include <stdlib.h>
1033  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
1034  $CC $CFLAGS _tests.c -o _tests 2> /dev/null  $CC $CFLAGS _tests.c -o _tests 2> /dev/null
1035  if [ ! -x _tests ]; then  if [ ! -x _tests ]; then
1036          printf "no\n"          printf "missing\n"
1037          printf "WARNING! fseeko missing from libc. Using a hack, "          printf "WARNING! fseeko missing from libc. Using a hack, "
1038          printf "which probably doesn't work.\n"          printf "which probably doesn't work.\n"
1039          printf "#define HACK_FSEEKO\n" >> config.h          printf "#define HACK_FSEEKO\n" >> config.h
1040  else  else
1041          printf "yes\n"          printf "found\n"
1042  fi  fi
1043  rm -f _tests.[co] _tests  rm -f _tests.[co] _tests
1044    
# Line 845  if [ ! -x _tests ]; then Line 1056  if [ ! -x _tests ]; then
1056          printf "no, using int\n"          printf "no, using int\n"
1057          CFLAGS="$CFLAGS -Dsocklen_t=int"          CFLAGS="$CFLAGS -Dsocklen_t=int"
1058  else  else
1059          printf "yes\n"          printf "socklen_t\n"
1060  fi  fi
1061  rm -f _tests.[co] _tests  rm -f _tests.[co] _tests
1062    
# Line 917  rm -f _testoff.c _testoff Line 1128  rm -f _testoff.c _testoff
1128    
1129    
1130  #  Check for u_int8_t etc:  #  Check for u_int8_t etc:
1131    #  These are needed because some header files in src/include/ use u_int*
1132    #  instead of uint*, and I don't have time to rewrite them all.
1133  printf "checking for u_int8_t... "  printf "checking for u_int8_t... "
1134  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
1135  int main(int argc, char *argv[]){printf(\"%%i\\\n\",  int main(int argc, char *argv[]){printf(\"%%i\\\n\",
# Line 938  if [ ! -x _testuint ]; then Line 1151  if [ ! -x _testuint ]; then
1151          printf "typedef uint8_t u_int8_t;\n" >> config.h          printf "typedef uint8_t u_int8_t;\n" >> config.h
1152          printf "typedef uint16_t u_int16_t;\n" >> config.h          printf "typedef uint16_t u_int16_t;\n" >> config.h
1153          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  
1154          printf "uint8_t\n"          printf "uint8_t\n"
1155  else  else
1156          printf "yes\n"          printf "yes\n"
1157  fi  fi
1158  rm -f _testuint.c _testuint  rm -f _testuint.c _testuint
1159    
1160    printf "checking for u_int64_t... "
1161    printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n
1162    int main(int argc, char *argv[]){printf(\"%%i\\\n\",
1163     (int)sizeof(u_int64_t));return 0;}\n" > _testuint.c
1164    $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
1165    if [ ! -x _testuint ]; then
1166            rm -f _testuint*
1167            printf "#include <stdio.h>\n#include <inttypes.h>
1168            \n#include <sys/types.h>\nint main(int argc, char *argv[])
1169            {printf(\"%%i\\\n\", (int)sizeof(uint64_t));return 0;}\n" > _testuint.c
1170            $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
1171            if [ ! -x _testuint ]; then
1172                    printf "no\n\nERROR: No u_int64_t or uint64_t. Aborting\n"
1173                    #  TODO: Automagically detect using various combinations
1174                    #  of char, int, short, long etc.
1175                    exit
1176            fi
1177    
1178            printf "typedef uint64_t u_int64_t;\n" >> config.h
1179            printf "uint64_t\n"
1180    else
1181            printf "yes\n"
1182    fi
1183    rm -f _testuint.c _testuint
1184    
1185    
1186  ###############################################################################  ###############################################################################
1187  #  #
# Line 1013  fi Line 1250  fi
1250    
1251  ###############################################################################  ###############################################################################
1252    
1253    #  Host byte order?
1254    printf "checking host endianness... "
1255    rm -f _test_end*
1256    printf '#include <stdio.h>
1257    int main(int argc, char *argv[])
1258    {  int x = 1; void *xp = (void *)&x; char *p = (char *)xp;
1259    if (*p) printf("little\\\n"); else printf("big\\\n"); }
1260    ' > _test_end.c
1261    $CC $CFLAGS _test_end.c -o _test_end 2> /dev/null
1262    X=`./_test_end`
1263    echo $X
1264    if [ z$X = zlittle ]; then
1265            printf "#define HOST_LITTLE_ENDIAN\n" >> config.h
1266    else
1267            if [ z$X = zbig ]; then
1268                    printf "#define HOST_BIG_ENDIAN\n" >> config.h
1269            else
1270                    echo "Error! Could not determine host's endianness."
1271                    exit
1272            fi
1273    fi
1274    rm -f _test_end*
1275    
1276    ###############################################################################
1277    
1278  #  Prefetch support?  #  Prefetch support?
1279  printf "checking for asm prefetch support... "  printf "checking for asm prefetch support... "
1280  if [ z"`uname -m`" = zalpha ]; then  if [ z"`uname -m`" = zalpha ]; then
# Line 1039  fi Line 1301  fi
1301    
1302  ###############################################################################  ###############################################################################
1303    
1304  INCLUDE=-I../include/  INCLUDE=-Iinclude/
1305    DINCLUDE=-I../include/
1306    
1307    rm -f _testprog.c
1308    
1309  echo C compiler flags: $CFLAGS $CWARNINGS $INCLUDE  echo C compiler flags: $CFLAGS $CWARNINGS
1310  echo Linker flags: $OTHERLIBS  echo Linker flags: $OTHERLIBS
1311  echo "CWARNINGS=$CWARNINGS" >> _Makefile.header  echo "CWARNINGS=$CWARNINGS" >> _Makefile.header
1312  echo "COPTIM=$CFLAGS" >> _Makefile.header  echo "COPTIM=$CFLAGS" >> _Makefile.header
1313  echo "INCLUDE=$INCLUDE" >> _Makefile.header  echo "INCLUDE=$INCLUDE" >> _Makefile.header
1314    echo "DINCLUDE=$DINCLUDE" >> _Makefile.header
1315  echo "CC=$CC" >> _Makefile.header  echo "CC=$CC" >> _Makefile.header
1316  echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header  echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header
1317    echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header
1318    echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header
1319  echo "" >> _Makefile.header  echo "" >> _Makefile.header
1320    
1321    
 printf "Regression test setup: (not really needed to build gxemul)\n"  
   
   
 ##  64-bit HPPA cross-assembler:  
 #  
 #HPPA=''  
 #if [ z$ENABLEHPPA = zYES ]; then  
 #       printf "Checking for a GNU cross-assembler for 64-bit HPPA... "  
 #       echo 'nop' > _testprog.s  
 #  
 #       for HPPA_TRY in hppa64-unknown-elf hppa64-elf; do  
 #               printf '#!/bin/sh\n'$HPPA_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  
 #                       HPPA=$HPPA_TRY  
 #                       break  
 #               fi  
 #               rm -f _testprog.o  
 #       done  
 #  
 #       if [ z$HPPA = z ]; then  
 #               echo "none"  
 #       else  
 #               echo $HPPA"-gcc"  
 #       fi  
 #fi  
 #rm -f _testprog* _test.sh  
 #  
 ## TODO: are these ok?  64-bit mode!  
 ##echo "HPPA_CC="$HPPA"-gcc -g -O2 -fno-builtin -fschedule-insns" \  
 ##      >> _Makefile.header  
 #echo "HPPA_AS="$HPPA"-as " >> _Makefile.header  
 #echo "HPPA_LD="$HPPA"-ld -Ttext 0xa800000000030000 -e main" \  
 #    "--oformat=elf64-bigmips" >> _Makefile.header  
 #echo "" >> _Makefile.header  
   
   
 #  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  
   
   
1322  #  Create the Makefiles:  #  Create the Makefiles:
1323    D=". src src/include src/cpus src/devices src/devices/fonts src/promemul"
1324  for a in . src devices devices/fonts tests; do  for a in $D; do
1325          echo "creating $a/Makefile"          echo "creating $a/Makefile"
1326          touch $a/Makefile          touch $a/Makefile
1327          cat _Makefile.header > $a/Makefile          cat _Makefile.header > $a/Makefile

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

  ViewVC Help
Powered by ViewVC 1.1.26