/[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

Annotation of /trunk/configure

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (hide annotations)
Mon Oct 8 16:18:19 2007 UTC (16 years, 5 months ago) by dpavlin
File size: 34736 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.777 2005/06/12 12:31:52 debug Exp $
==============  RELEASE 0.3.3.1  ==============

20050609	Adding simple MIPS IPIs (to dev_mp).
20050611	Adding an ugly hack to track down low-reference bugs
		(define TRACE_NULL_CRASHES, or configure --tracenull).
		Other minor updates.
20050612	Adding a dummy evbmips mode.

==============  RELEASE 0.3.3.2  ==============


1 dpavlin 2 #!/bin/sh
2     ###############################################################################
3     #
4     # Copyright (C) 2003-2005 Anders Gavare. All rights reserved.
5     #
6     # Redistribution and use in source and binary forms, with or without
7     # modification, are permitted provided that the following conditions are met:
8     #
9     # 1. Redistributions of source code must retain the above copyright
10     # notice, this list of conditions and the following disclaimer.
11     # 2. Redistributions in binary form must reproduce the above copyright
12     # notice, this list of conditions and the following disclaimer in the
13     # documentation and/or other materials provided with the distribution.
14     # 3. The name of the author may not be used to endorse or promote products
15     # derived from this software without specific prior written permission.
16     #
17     # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18     # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19     # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20     # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21     # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22     # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23     # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24     # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25     # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26     # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27     # SUCH DAMAGE.
28     #
29     #
30 dpavlin 8 # $Id: configure,v 1.134 2005/06/11 20:59:10 debug Exp $
31 dpavlin 2 #
32     # This is a minimal configure script, hardcoded for GXemul. This script
33     # figures out which compiler flags will work, and creates Makefiles in
34     # sub-directories. A config.h file is also created.
35     #
36     #
37     # ---> FOR NORMAL USE, JUST RUN ./configure WITHOUT OPTIONS!
38     #
39     #
40     # To compile the emulator with profiling (during development), use
41     # CFLAGS="-pg", run the emulator, and then run 'gprof gxemul' and study
42     # the results.
43     #
44     #
45     # The main things that are detected by this script:
46     #
47     # o) special hacks for some OSes
48     # o) which compiler to use (overridden by setting CC)
49     # o) which compiler flags to use (overridden by setting CFLAGS)
50     # o) X11 flags and libraries (TODO: should be possible to override)
51     # o) binary translation (on supported platforms)
52     # o) prefetch capability (TODO: this is assumed on Alpha, but not all
53     # Alphas have it...)
54     #
55     ###############################################################################
56    
57 dpavlin 4 ENABLEALPHA=NO
58 dpavlin 6 ENABLEARM=NO
59 dpavlin 4 ENABLEHPPA=NO
60 dpavlin 2 ENABLEMIPS=YES
61     ENABLEPPC=YES
62 dpavlin 4 ENABLESPARC=NO
63 dpavlin 2 ENABLEURISC=YES
64 dpavlin 4 ENABLEX86=NO
65 dpavlin 6 STABLE=YES
66 dpavlin 2
67     if [ z"$*" != z ]; then
68     # Parse command line options:
69     for a in $*; do
70     if [ z$a = z--disable-x ]; then
71     NOX11=YES
72     else if [ z$a = z--always32 ]; then
73     ALWAYS32=YES
74 dpavlin 8 else if [ z$a = z--tracenull ]; then
75     TRACENULL=YES
76 dpavlin 2 else if [ z$a = z--disable-bintrans ]; then
77     NOBINTRANS=YES
78 dpavlin 6 else if [ z$a = z--enable-bintrans ]; then
79     NOBINTRANS=NO
80     else if [ z$a = z--disable-mips16 ]; then
81     MIPS16=NO
82 dpavlin 2 else if [ z$a = z--enable-mips16 ]; then
83     MIPS16=YES
84 dpavlin 6 else if [ z$a = z--disable-alpha ]; then
85     ENABLEALPHA=NO
86 dpavlin 4 else if [ z$a = z--enable-alpha ]; then
87     ENABLEALPHA=YES
88 dpavlin 6 else if [ z$a = z--disable-arm ]; then
89     ENABLEARM=NO
90     else if [ z$a = z--enable-arm ]; then
91     ENABLEARM=YES
92     else if [ z$a = z--disable-hppa ]; then
93     ENABLEHPPA=NO
94 dpavlin 4 else if [ z$a = z--enable-hppa ]; then
95     ENABLEHPPA=YES
96 dpavlin 2 else if [ z$a = z--disable-mips ]; then
97     ENABLEMIPS=NO
98 dpavlin 6 else if [ z$a = z--enable-mips ]; then
99     ENABLEMIPS=YES
100 dpavlin 2 else if [ z$a = z--disable-ppc ]; then
101     ENABLEPPC=NO
102 dpavlin 6 else if [ z$a = z--enable-ppc ]; then
103     ENABLEPPC=YES
104     else if [ z$a = z--disable-sparc ]; then
105     ENABLESPARC=NO
106 dpavlin 4 else if [ z$a = z--enable-sparc ]; then
107     ENABLESPARC=YES
108 dpavlin 2 else if [ z$a = z--disable-urisc ]; then
109     ENABLEURISC=NO
110 dpavlin 6 else if [ z$a = z--enable-urisc ]; then
111     ENABLEURISC=YES
112     else if [ z$a = z--disable-x86 ]; then
113     ENABLEX86=NO
114 dpavlin 4 else if [ z$a = z--enable-x86 ]; then
115     ENABLEX86=YES
116 dpavlin 6 else if [ z$a = z--disable-delays ]; then
117     DELAYS=NO
118 dpavlin 2 else if [ z$a = z--enable-delays ]; then
119     DELAYS=YES
120 dpavlin 6 else if [ z$a = z--disable-caches ]; then
121     CACHES=NO
122 dpavlin 2 else if [ z$a = z--enable-caches ]; then
123     CACHES=YES
124     else if [ z$a = z--help ]; then
125     echo "usage: $0 [options]"
126     printf "\nDevelopment (debug) options:\n"
127 dpavlin 6 echo " --always32 enable" \
128 dpavlin 2 "ALWAYS_SIGNEXTEND_32 (for hunting down"
129 dpavlin 6 echo " 32/64-bit bugs)"
130 dpavlin 8 echo " --tracenull enable" \
131     "TRACE_NULL_CRASHES (for bug hunting)"
132 dpavlin 2 printf "\nGeneral options:\n"
133 dpavlin 6 echo " --disable-bintrans configure without" \
134 dpavlin 2 "bintrans, even if the host supports it"
135 dpavlin 6 printf " --enable-caches enable cache emulation"
136     printf " (BUGGY)\n"
137     echo " --enable-delays enable instruction" \
138 dpavlin 2 "latency/delay emulation"
139 dpavlin 6 echo " --disable-x don't include X11 support"
140     printf "\nCPU selection options:\n"
141     if [ z$STABLE = zNO ]; then
142     printf " --enable-alpha "
143     printf "enable Alpha CPU emulation"
144     printf " (NOT YET)\n"
145     printf " --enable-arm "
146     printf "enable ARM CPU emulation"
147     printf " (NOT YET)\n"
148     printf " --enable-hppa "
149     printf "enable HPPA CPU emulation"
150     printf " (NOT YET)\n"
151     fi
152     echo " --disable-mips disable MIPS CPU emulation"
153     echo " --disable-ppc disable PPC CPU emulation"
154     if [ z$STABLE = zNO ]; then
155     printf " --enable-sparc "
156     printf "enable SPARC CPU emulation"
157     printf " (NOT YET)\n"
158     fi
159     echo " --disable-urisc disable URISC CPU emulation"
160     if [ z$STABLE = zNO ]; then
161     printf " --enable-x86 "
162     printf "enable x86 CPU emulation"
163     printf " (NOT YET)\n"
164     fi
165 dpavlin 2 printf "\nMIPS-specific options:\n"
166 dpavlin 6 printf " --enable-mips16 enable MIPS16 instruction"
167     printf " support (NOT YET)\n\n"
168 dpavlin 2 exit
169     else
170     echo "Invalid option: $a"
171     echo "Run $0 --help to get a list of" \
172     "available options."
173     exit
174 dpavlin 6 fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi
175 dpavlin 8 fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi
176 dpavlin 2 done
177     fi
178    
179    
180     ###############################################################################
181     #
182     # Configure options:
183     #
184     # This creates a config.h file, which is then included from include/misc.h.
185     #
186     ###############################################################################
187    
188     # Head of config.h:
189     printf "/*
190     * THIS FILE IS AUTOMATICALLY CREATED BY configure!
191     * DON'T EDIT THIS FILE MANUALLY, IT WILL BE OVERWRITTEN.
192     */
193     \n#ifndef CONFIG_H\n#define CONFIG_H\n\n" > config.h
194    
195    
196     # Figure out if VERSION should be defined.
197     X=`basename \`pwd\`|cut -d \- -f 2-`
198     if [ z"$X" = zgxemul ]; then
199     echo '# No VERSION defined.' >> _Makefile.header
200     else
201     printf "#define VERSION \"$X\"\n" >> config.h
202     fi
203    
204    
205     ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\``
206     printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h
207    
208    
209    
210     # Support for various CPU types:
211     if [ z$MIPS16 = zYES ]; then
212     printf 'Enabling MIPS16 support. '
213     printf 'NOTE: MIPS16 support is not really working yet.\n'
214     printf "#define ENABLE_MIPS16\n" >> config.h
215     fi
216     if [ z$ENABLEALPHA = zYES ]; then
217     printf "#define ENABLE_ALPHA\n" >> config.h
218 dpavlin 6 if [ z$STABLE = zNO ]; then
219     printf "\nWARNING: Alpha emulation enabled, but it isn't really"
220     printf " implemented yet.\n\n"
221     else
222     printf "Not in the stable release.\n"
223     exit
224     fi
225 dpavlin 2 fi
226 dpavlin 6 if [ z$ENABLEARM = zYES ]; then
227     printf "#define ENABLE_ARM\n" >> config.h
228     if [ z$STABLE = zNO ]; then
229     printf "\nWARNING: ARM emulation enabled, but it isn't really"
230     printf " implemented yet.\n\n"
231     else
232     printf "Not in the stable release.\n"
233     exit
234     fi
235     fi
236 dpavlin 2 if [ z$ENABLEHPPA = zYES ]; then
237     printf "#define ENABLE_HPPA\n" >> config.h
238 dpavlin 6 if [ z$STABLE = zNO ]; then
239     printf "\nWARNING: HPPA emulation enabled, but it isn't really"
240     printf " implemented yet.\n\n"
241     else
242     printf "Not in the stable release.\n"
243     exit
244     fi
245 dpavlin 2 fi
246     if [ z$ENABLEMIPS = zYES ]; then
247     printf "#define ENABLE_MIPS\n" >> config.h
248     fi
249     if [ z$ENABLEPPC = zYES ]; then
250     printf "#define ENABLE_PPC\n" >> config.h
251     fi
252     if [ z$ENABLESPARC = zYES ]; then
253     printf "#define ENABLE_SPARC\n" >> config.h
254 dpavlin 6 if [ z$STABLE = zNO ]; then
255     printf "\nWARNING: SPARC emulation enabled, but it isn't really"
256     printf " implemented yet.\n\n"
257     else
258     printf "Not in the stable release.\n"
259     exit
260     fi
261 dpavlin 2 fi
262     if [ z$ENABLEURISC = zYES ]; then
263     printf "#define ENABLE_URISC\n" >> config.h
264     fi
265 dpavlin 4 if [ z$ENABLEX86 = zYES ]; then
266     printf "#define ENABLE_X86\n" >> config.h
267 dpavlin 6 if [ z$STABLE = zNO ]; then
268     printf "\nWARNING: X86 emulation enabled, but it isn't really"
269     printf " working yet.\n\n"
270     else
271     printf "Not in the stable release.\n"
272     exit
273     fi
274 dpavlin 4 fi
275 dpavlin 2
276    
277     # Instruction delay/latency emulation:
278     if [ z$DELAYS = zYES ]; then
279     echo 'Enabling Instruction delay/latency emulation.'
280     printf "#define ENABLE_INSTRUCTION_DELAYS\n" >> config.h
281     fi
282    
283    
284 dpavlin 8 # Development option: ALWAYS_SIGNEXTEND_32
285 dpavlin 2 if [ z$ALWAYS32 = zYES ]; then
286     echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \
287     'This slows down everything.)'
288     printf "#define ALWAYS_SIGNEXTEND_32\n" >> config.h
289     fi
290    
291    
292 dpavlin 8 # Development option: TRACE_NULL_CRASHES
293     if [ z$TRACENULL = zYES ]; then
294     echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \
295     'This slows down the emulator.)'
296     printf "#define TRACE_NULL_CRASHES\n" >> config.h
297     fi
298    
299    
300 dpavlin 2 # Cache emulation:
301     if [ z$CACHES = zYES ]; then
302     echo 'Enabling Cache emulation. (EXPERIMENTAL)'
303     printf "#define ENABLE_CACHE_EMULATION\n" >> config.h
304    
305     if [ z$DELAYS != zYES ]; then
306     printf 'WARNING: Cache emulation without instruction '
307     printf 'delay/latency emulation\n'
308     printf ' (--delays) will not produce correct '
309     printf 'cache miss penalties and such.\n'
310     fi
311 dpavlin 6
312     printf "\nNOTE: Cache emulation enabled, but right now it triggers "
313     printf "weird bugs in the\n emulator. You have been warned.\n\n"
314 dpavlin 2 fi
315    
316    
317     ###############################################################################
318     #
319     # Special hacks for some host OSes:
320     #
321     ###############################################################################
322    
323     if [ z"`uname|cut -c 1-6`" = zCYGWIN ]; then
324     CYGWIN=YES
325    
326     if [ z"$CC" = z ]; then
327     # Assume gcc on Cygwin (Windows) systems.
328     CC=gcc
329     fi
330     fi
331    
332     if [ z"`uname`" = zHP-UX ]; then
333     HPUX=YES
334    
335     if [ z$CC = z ]; then
336     if [ -f /usr/local/pa64/bin/gcc ]; then
337     CC=/usr/local/pa64/bin/gcc
338     fi
339     fi
340     fi
341    
342     if [ z"`uname`" = zOSF1 ]; then
343     OSF1=YES
344     fi
345    
346    
347     ###############################################################################
348     #
349     # Create the Makefile header:
350     #
351     ###############################################################################
352    
353     rm -f _Makefile.header
354    
355     printf "#
356     # DO NOT EDIT THIS FILE! It is automagically created by
357     # the configure script, based on Makefile.skel.
358     #\n\n" >> _Makefile.header
359    
360    
361     echo 'int main(int argc, char *argv[]) { return 0; }' > _testprog.c
362    
363    
364     # Try to detect which C compiler to use, if CC is not set:
365     printf "checking which C compiler to use... "
366    
367     if [ z"$CC" = z ]; then
368     CC=cc
369    
370     # Try gcc first:
371     printf "#!/bin/sh\ngcc _testprog.c -o _testprog >" > _test.sh
372     printf " /dev/null 2> /dev/null\n" >> _test.sh
373     chmod 755 _test.sh
374     ./_test.sh > /dev/null 2> /dev/null
375     if [ -x _testprog ]; then
376     CC=gcc
377     fi
378     rm -f _testprog
379    
380     # If both gcc and cc exist, then cc might be a vendor specific
381     # compiler which produces faster code than gcc (eg on Solaris):
382     printf "#!/bin/sh\ncc _testprog.c -o _testprog >" > _test.sh
383     printf " /dev/null 2> /dev/null\n" >> _test.sh
384     chmod 755 _test.sh
385     ./_test.sh > /dev/null 2> /dev/null
386     if [ -x _testprog ]; then
387     CC=cc
388     fi
389     rm -f _testprog
390    
391     # Try ccc (FreeBSD/Alpha):
392     printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh
393     printf " /dev/null 2> /dev/null\n" >> _test.sh
394     chmod 755 _test.sh
395     ./_test.sh > /dev/null 2> /dev/null
396     if [ -x _testprog ]; then
397     CC="ccc"
398     fi
399     rm -f _testprog
400    
401     rm -f _test.sh
402     fi
403    
404    
405     rm -f _testprog
406     printf "$CC $CFLAGS"
407    
408    
409     CCTYPE="generic"
410    
411     if $CC $CFLAGS -V 2> /dev/null | grep ompaq 1> /dev/null 2> /dev/null; then
412     COMPAQCC=YES
413     CCTYPE="Compaq CC"
414     fi
415    
416     if $CC $CFLAGS -V 2>&1 | grep Sun 1> /dev/null 2> /dev/null; then
417     SUNCC=YES
418     CCTYPE="Solaris CC"
419     fi
420    
421     if $CC $CFLAGS -v 2>&1 | grep gcc 1> /dev/null 2> /dev/null; then
422     GCCCC=YES
423     CCTYPE="GNU CC"
424     fi
425    
426     if [ z$CYGWIN = zYES ]; then
427     CCTYPE="$CCTYPE (Cygwin)"
428     fi
429    
430     echo " ($CCTYPE)"
431    
432    
433     if [ z$NOX11 = z ]; then
434     printf "checking for X11 headers and libs\n"
435    
436     # Try to compile a small X11 test program:
437     printf "#include <X11/Xlib.h>
438     #include <stdio.h>
439     Display *dis;
440     void f(void) {
441     dis = XOpenDisplay(NULL);
442     }
443     int main(int argc, char *argv[])
444     { return 0; }
445     " > _test_x11.c
446    
447     XOK=0
448    
449     XINCLUDE=-I/usr/X11R6/include
450     $CC $CFLAGS _test_x11.c -c -o _test_x11.o $XINCLUDE 2> /dev/null
451    
452     XLIB="-L/usr/X11R6/lib -lX11"
453     $CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null
454    
455     if [ -x _test_x11 ]; then
456     XOK=1
457     fi
458    
459     rm -f _test_x11 _test_x11.o
460    
461     if [ z$XOK = z0 ]; then
462     XINCLUDE=""
463     $CC $CFLAGS _test_x11.c -c -o _test_x11.o \
464     $XINCLUDE 2> /dev/null
465    
466     # -lsocket for Solaris
467     XLIB="-lX11 -lsocket"
468     $CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null
469    
470     if [ -x _test_x11 ]; then
471     XOK=1
472     fi
473     rm -f _test_x11 _test_x11.o
474     fi
475    
476     if [ z`uname` = zNetBSD ]; then
477     echo "Using NetBSD hack for X11 libs..."
478     XLIB="$XLIB -Wl,-rpath,/usr/X11R6/lib"
479     fi
480    
481     if [ z`uname` = zOpenBSD ]; then
482     if [ z`uname -m` = zarc ]; then
483     echo "Using old OpenBSD/arc hack for X11 libs..."
484     XLIB="$XLIB -Wl,-rpath,/usr/X11R6/lib"
485     fi
486     fi
487    
488     if [ z$XOK = z0 ]; then
489     echo "Failed to compile X11 test program." \
490     "Configuring without X11."
491     else
492     printf "X11 headers: $XINCLUDE\n"
493     printf "X11 libraries: $XLIB\n"
494     echo "XINCLUDE=$XINCLUDE" >> _Makefile.header
495     echo "XLIB=$XLIB" >> _Makefile.header
496     printf "#define WITH_X11\n" >> config.h
497     fi
498    
499     rm -f _test_x11.c
500     fi
501    
502    
503     if [ z$HPUX = zYES ]; then
504     CFLAGS="-D_XOPEN_SOURCE_EXTENDED $CFLAGS"
505     printf "#define HPUX\n" >> config.h
506     fi
507    
508    
509     if [ z$OSF1 = zYES ]; then
510     CFLAGS="-D_XOPEN_SOURCE=500 -D_OSF_SOURCE -D_POSIX_PII_SOCKET $CFLAGS"
511     fi
512    
513    
514     # Check for weird 'alpha' define.
515     printf "checking for weird 'alpha' define... "
516     printf "#include <stdio.h>\nint main(int argc, char *argv[]){
517     #ifdef alpha
518     printf(\"1\");
519     #undef alpha
520     #ifdef alpha
521     printf(\"2\");
522     #endif
523     #endif
524     printf(\"\\\n\");return 0;}\n" > _testm.c
525     $CC $CFLAGS _testm.c -o _testm 2> /dev/null
526     if [ ! -x _testm ]; then
527     printf "\nWARNING! COULD NOT COMPILE alpha define TEST"
528     printf " PROGRAM AT ALL!\n"
529     else
530     if [ z`./_testm` = z1 ]; then
531     printf "yes, workaround applied\n"
532     echo "#undef alpha" >> config.h
533     else
534     if [ z`./_testm` = z12 ]; then
535     printf "yes, but workaround not possible\n"
536     exit
537     else
538     printf "no\n"
539     fi
540     fi
541     fi
542     rm -f _testm*
543    
544    
545     # Check for weird 'hppa' define.
546     printf "checking for weird 'hppa' define... "
547     printf "#include <stdio.h>\nint main(int argc, char *argv[]){
548     #ifdef hppa
549     printf(\"1\");
550     #undef hppa
551     #ifdef hppa
552     printf(\"2\");
553     #endif
554     #endif
555     printf(\"\\\n\");return 0;}\n" > _testm.c
556     $CC $CFLAGS _testm.c -o _testm 2> /dev/null
557     if [ ! -x _testm ]; then
558     printf "\nWARNING! COULD NOT COMPILE hppa define TEST"
559     printf " PROGRAM AT ALL!\n"
560     else
561     if [ z`./_testm` = z1 ]; then
562     printf "yes, workaround applied\n"
563     echo "#undef hppa" >> config.h
564     else
565     if [ z`./_testm` = z12 ]; then
566     printf "yes, but workaround not possible\n"
567     exit
568     else
569     printf "no\n"
570     fi
571     fi
572     fi
573     rm -f _testm*
574    
575    
576     # Some OSes on MIPS seems to define 'mips' to 1. (eg OpenBSD/arc)
577     printf "checking for weird 'mips' define... "
578     printf "#include <stdio.h>\nint main(int argc, char *argv[]){
579     #ifdef mips
580     printf(\"1\");
581     #undef mips
582     #ifdef mips
583     printf(\"2\");
584     #endif
585     #endif
586     printf(\"\\\n\");return 0;}\n" > _testm.c
587     $CC $CFLAGS _testm.c -o _testm 2> /dev/null
588     if [ ! -x _testm ]; then
589     printf "\nWARNING! COULD NOT COMPILE mips define TEST"
590     printf " PROGRAM AT ALL!\n"
591     else
592     if [ z`./_testm` = z1 ]; then
593     printf "yes, workaround applied\n"
594     echo "#undef mips" >> config.h
595     else
596     if [ z`./_testm` = z12 ]; then
597     printf "yes, but workaround not possible\n"
598     exit
599     else
600     printf "no\n"
601     fi
602     fi
603     fi
604     rm -f _testm*
605    
606    
607     # Similar to the mips define check above, although I don't know if
608     # any OS actually defined ppc like this.
609     printf "checking for weird 'ppc' define... "
610     printf "#include <stdio.h>\nint main(int argc, char *argv[]){
611     #ifdef ppc
612     printf(\"1\");
613     #undef ppc
614     #ifdef ppc
615     printf(\"2\");
616     #endif
617     #endif
618     printf(\"\\\n\");return 0;}\n" > _testm.c
619     $CC $CFLAGS _testm.c -o _testm 2> /dev/null
620     if [ ! -x _testm ]; then
621     printf "\nWARNING! COULD NOT COMPILE ppc define TEST"
622     printf " PROGRAM AT ALL!\n"
623     else
624     if [ z`./_testm` = z1 ]; then
625     printf "yes, workaround applied\n"
626     echo "#undef ppc" >> config.h
627     else
628     if [ z`./_testm` = z12 ]; then
629     printf "yes, but workaround not possible\n"
630     exit
631     else
632     printf "no\n"
633     fi
634     fi
635     fi
636     rm -f _testm*
637    
638    
639     # Similar to the mips define check above, although I don't know if
640     # any OS actually defined sparc like this.
641     printf "checking for weird 'sparc' define... "
642     printf "#include <stdio.h>\nint main(int argc, char *argv[]){
643     #ifdef sparc
644     printf(\"1\");
645     #undef sparc
646     #ifdef sparc
647     printf(\"2\");
648     #endif
649     #endif
650     printf(\"\\\n\");return 0;}\n" > _testm.c
651     $CC $CFLAGS _testm.c -o _testm 2> /dev/null
652     if [ ! -x _testm ]; then
653     printf "\nWARNING! COULD NOT COMPILE sparc define TEST "
654     printf "PROGRAM AT ALL!\n"
655     else
656     if [ z`./_testm` = z1 ]; then
657     printf "yes, workaround applied\n"
658     echo "#undef sparc" >> config.h
659     else
660     if [ z`./_testm` = z12 ]; then
661     printf "yes, but workaround not possible\n"
662     exit
663     else
664     printf "no\n"
665     fi
666     fi
667     fi
668     rm -f _testm*
669    
670    
671     # CWARNINGS:
672     printf "checking whether -Wall can be used... "
673     $CC $CFLAGS _testprog.c -o _testprog -Wall 2> /dev/null
674     if [ -x _testprog ]; then
675     printf "yes\n"
676     CWARNINGS="-Wall $CWARNINGS"
677    
678     # Compaq's compiler always seems to warn about the long long type,
679     # and unusedtop suppresses warnings about include files being
680     # included more than once.
681     if [ z"$COMPAQCC" = zYES ]; then
682     CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop"
683     fi
684     else
685     printf "no\n"
686     fi
687     rm -f _testprog
688    
689    
690     if [ z"$COMPAQCC" = zYES ]; then
691     # -O4 is possible, but is -O3 better?
692     CFLAGS="-O4 $CFLAGS"
693     else
694     if [ z"`uname`" = zSunOS ]; then
695     # "cc", the system's default compiler:
696     if [ z"$SUNCC" = zYES ]; then
697     CFLAGS="-xO5 -xdepend $CFLAGS"
698     fi
699     printf "#define SOLARIS\n" >> config.h
700     OTHERLIBS="-lsocket $OTHERLIBS"
701     else
702     # gcc or something else:
703     $CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null
704     if [ -x _testprog ]; then
705     rm -f _testprog
706     $CC $CFLAGS _testprog.c -o _testprog -O2 2> /dev/null
707     if [ -x _testprog ]; then
708     CFLAGS="-O2 $CFLAGS"
709     else
710     CFLAGS="-O $CFLAGS"
711     fi
712     fi
713     fi
714     fi
715     rm -f _testprog
716    
717    
718     # -fschedule-insns causes bugs on i386 with gcc,
719     # but works OK on my alpha with ccc (compaq's cc).
720     if [ z"$COMPAQCC" = zYES ]; then
721     printf "checking whether -fschedule-insns2 can be used... "
722     $CC $CFLAGS _testprog.c -o _testprog -fschedule-insns2 2> /dev/null
723     if [ -x _testprog ]; then
724     CFLAGS="-fschedule-insns2 $CFLAGS"
725     printf "yes\n"
726     else
727     printf "no\n"
728     fi
729     rm -f _testprog
730    
731     printf "checking whether -fschedule-insns can be used... "
732     $CC $CFLAGS _testprog.c -o _testprog -fschedule-insns 2> /dev/null
733     if [ -x _testprog ]; then
734     CFLAGS="-fschedule-insns $CFLAGS"
735     printf "yes\n"
736     else
737     printf "no\n"
738     fi
739     rm -f _testprog
740    
741     # # -intrinsics
742     # $CC $CFLAGS _testprog.c -o _testprog -intrinsics 2> /dev/null
743     # if [ -x _testprog ]; then
744     # CFLAGS="-intrinsics $CFLAGS"
745     # fi
746     # rm -f _testprog
747    
748     # -fast
749     printf "checking whether -fast can be used... "
750     $CC $CFLAGS _testprog.c -o _testprog -fast 2> /dev/null
751     if [ -x _testprog ]; then
752     CFLAGS="-fast $CFLAGS"
753     printf "yes\n"
754     else
755     printf "no\n"
756     fi
757     rm -f _testprog
758     fi
759    
760    
761     # -fpeephole
762     printf "checking whether -fpeephole can be used... "
763     $CC $CFLAGS -fpeephole _testprog.c -o _testprog > _testprog.stdout 2>&1
764     cat _testprog.stdout >> _testprog.error
765     if grep peephole _testprog.error > /dev/null 2>&1; then
766     printf "no\n"
767     else
768     if [ -x _testprog ]; then
769     CFLAGS="-fpeephole $CFLAGS"
770     printf "yes\n"
771     else
772     printf "no\n"
773     fi
774     fi
775     rm -f _testprog _testprog.error _testprog.stdout
776    
777    
778     # -fomit-frame-pointer
779     printf "checking whether -fomit-frame-pointer can be used... "
780     $CC $CFLAGS -fomit-frame-pointer _testprog.c -o \
781     _testprog 1> _testprog.stdout 2>&1
782     cat _testprog.stdout >> _testprog.error
783     if grep frame _testprog.error > /dev/null 2>&1; then
784     printf "no\n"
785     else
786     if [ -x _testprog ]; then
787     CFLAGS="-fomit-frame-pointer $CFLAGS"
788     printf "yes\n"
789     else
790     printf "no\n"
791     fi
792     fi
793     rm -f _testprog _testprog.error _testprog.stdout
794    
795    
796     # -lrt for nanosleep?
797     printf "checking whether -lrt is required for nanosleep... "
798     printf "#include <time.h>\n#include <stdio.h>
799     int main(int argc, char *argv[]){nanosleep(NULL,NULL);return 0;}\n" > _testns.c
800     $CC $CFLAGS _testns.c -o _testns 2> /dev/null
801     if [ ! -x _testns ]; then
802     $CC $CFLAGS -lrt _testns.c -o _testns 2> /dev/null
803     if [ ! -x _testns ]; then
804     printf "WARNING! COULD NOT COMPILE WITH nanosleep AT ALL!\n"
805     else
806     # -lrt for nanosleep
807     OTHERLIBS="-lrt $OTHERLIBS"
808     printf "yes\n"
809     fi
810     else
811     printf "no\n"
812     fi
813     rm -f _testns.c _testns
814    
815    
816     # -lresolv for inet_pton?
817     printf "checking whether -lresolv is required for inet_pton... "
818     printf "int inet_pton(void); int main(int argc, " > _testr.c
819     printf "char *argv[]) { return inet_pton(); }\n" >> _testr.c
820     $CC $CFLAGS _testr.c -o _testr 2> /dev/null
821     if [ ! -x _testr ]; then
822     $CC $CFLAGS _testr.c -lresolv -o _testr 2> /dev/null
823     if [ ! -x _testr ]; then
824     $CC $CFLAGS _testr.c -lresolv -lnsl -o _testr 2> /dev/null
825     if [ ! -x _testr ]; then
826     printf "no, using inet_aton\n"
827     else
828     # -lresolv -lnsl for inet_pton
829     OTHERLIBS="-lresolv -lnsl $OTHERLIBS"
830     printf "yes (and -lnsl)\n"
831     printf "#define HAVE_INET_PTON\n" >> config.h
832     fi
833     else
834     # -lresolv for inet_pton
835     OTHERLIBS="-lresolv $OTHERLIBS"
836     printf "yes\n"
837     printf "#define HAVE_INET_PTON\n" >> config.h
838     fi
839     else
840     printf "no\n"
841     printf "#define HAVE_INET_PTON\n" >> config.h
842     fi
843     rm -f _testr.[co] _testr
844    
845    
846     # -lm?
847     printf "checking for math libs..."
848     printf "#include <math.h>\nint main(int argc, char *argv[]) { " > _testr.c
849     printf "double x = sqrt((double)argc); return (int)x; }\n" >> _testr.c
850     $CC $CFLAGS _testr.c -o _testr 2> /dev/null
851     if [ ! -x _testr ]; then
852     $CC $CFLAGS _testr.c -lm -o _testr 2> /dev/null
853     if [ ! -x _testr ]; then
854     $CC $CFLAGS _testr.c -lm -lcpml -o _testr 2> /dev/null
855     if [ ! -x _testr ]; then
856     printf "\nWARNING! Could not compile math test "
857     printf "at all!\nContinuing anyway.\n\n"
858     else
859     # -lm AND -lcpml
860     OTHERLIBS="-lm -lcpml $OTHERLIBS"
861     printf " -lm -lcpml\n"
862     fi
863     else
864     # Normal -lm
865     OTHERLIBS="-lm $OTHERLIBS"
866     printf " -lm\n"
867     fi
868     else
869     printf " none needed\n"
870     fi
871     rm -f _testr.[co] _testr
872    
873    
874     # strtoull missing?
875     printf "checking for strtoull... "
876     printf "#include <stdlib.h>
877     #include <limits.h>
878     #include <stdio.h>
879     int main(int argc, char *argv[]) {
880     long long x = strtoull(argv[1], NULL, 0); return 0;}\n" > _tests.c
881     $CC $CFLAGS _tests.c -o _tests 2> /dev/null
882     if [ ! -x _tests ]; then
883     printf "missing, using mystrtoull\n"
884     printf "#define strtoull mystrtoull\n" >> config.h
885     else
886 dpavlin 6 printf "found\n"
887 dpavlin 2 fi
888 dpavlin 6 rm -f _tests.[co] _tests
889 dpavlin 2
890    
891 dpavlin 6 # mkstemp missing?
892     printf "checking for mkstemp... "
893     printf "#include <unistd.h>
894     int main(int argc, char *argv[]) { int x; char *y = \"abc\";
895     x = mkstemp(y); return 0;}\n" > _tests.c
896     $CC $CFLAGS _tests.c -o _tests 2> /dev/null
897     if [ ! -x _tests ]; then
898     printf "missing, using workaround\n"
899     printf "#define mkstemp mymkstemp\n" >> config.h
900     else
901     printf "found\n"
902     fi
903     rm -f _tests.[co] _tests
904    
905    
906 dpavlin 2 # fseeko missing?
907     printf "checking for fseeko... "
908     printf "#include <stdlib.h>
909     #include <limits.h>
910     #include <stdio.h>
911     #include <sys/types.h>
912     int main(int argc, char *argv[]) { fseeko(NULL, 0, 0); return 0;}\n" > _tests.c
913     $CC $CFLAGS _tests.c -o _tests 2> /dev/null
914     if [ ! -x _tests ]; then
915 dpavlin 6 printf "missing\n"
916 dpavlin 2 printf "WARNING! fseeko missing from libc. Using a hack, "
917     printf "which probably doesn't work.\n"
918     printf "#define HACK_FSEEKO\n" >> config.h
919     else
920 dpavlin 6 printf "found\n"
921 dpavlin 2 fi
922     rm -f _tests.[co] _tests
923    
924    
925     # socklen_t missing?
926     # (for example really old OpenBSD/arc 2.3, inside the emulator)
927     printf "checking for socklen_t... "
928     printf "#include <stdlib.h>
929     #include <stdio.h>
930     #include <sys/types.h>
931     #include <sys/socket.h>
932     int main(int argc, char *argv[]) { socklen_t x; return 0;}\n" > _tests.c
933     $CC $CFLAGS _tests.c -o _tests 2> /dev/null
934     if [ ! -x _tests ]; then
935     printf "no, using int\n"
936     CFLAGS="$CFLAGS -Dsocklen_t=int"
937     else
938 dpavlin 6 printf "socklen_t\n"
939 dpavlin 2 fi
940     rm -f _tests.[co] _tests
941    
942    
943     # MAP_ANON missing? (On some HP-UX systems? Use MAP_ANONYMOUS instead.)
944     printf "checking for MAP_ANON... "
945     rm -f _tests
946     printf "#include <stdio.h>
947     #include <sys/types.h>
948     #include <sys/mman.h>
949     int main(int argc, char *argv[]) { int x = MAP_ANON; return 0;}\n" > _tests.c
950     $CC $CFLAGS _tests.c -o _tests 2> /dev/null
951     if [ ! -x _tests ]; then
952     printf "#include <stdio.h>
953     #include <sys/types.h>
954     #include <sys/mman.h>
955     int main(int argc, char *argv[])
956     { int x = MAP_ANONYMOUS; return 0;}\n" > _tests.c
957     $CC $CFLAGS _tests.c -o _tests 2> /dev/null
958     if [ ! -x _tests ]; then
959     printf "no\n\n"
960     printf "WARNING! Neither MAP_ANON nor MAP_ANONYMOUS work on "
961     printf "this system.\nPlease try to compile anyway, and report"
962     printf " to me whether it builds/runs or not.\n\n"
963     printf "#define MAP_ANON 0\n" >> config.h
964     printf "#define NO_MAP_ANON\n" >> config.h
965     else
966     printf "using MAP_ANONYMOUS\n"
967     printf "#define MAP_ANON MAP_ANONYMOUS\n" >> config.h
968     fi
969     else
970     printf "yes\n"
971     fi
972     rm -f _tests.[co] _tests
973    
974    
975     # Check for 64-bit off_t:
976     printf "checking for 64-bit off_t... "
977     printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n
978     int main(int argc, char *argv[]){printf(\"%%i\\\n\",
979     (int)sizeof(off_t));return 0;}\n" > _testoff.c
980     $CC $CFLAGS _testoff.c -o _testoff 2> /dev/null
981     if [ ! -x _testoff ]; then
982     printf "\nWARNING! COULD NOT COMPILE off_t TEST PROGRAM AT ALL!\n"
983     else
984     if [ z`./_testoff` = z8 ]; then
985     printf "yes\n"
986     else
987     $CC $CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
988     _testoff.c -o _testoff 2> /dev/null
989     if [ ! -x _testoff ]; then
990     printf "\nWARNING! COULD NOT COMPILE off_t TEST "
991     printf "PROGRAM!\n"
992     else
993     if [ z`./_testoff` = z8 ]; then
994     CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
995     CFLAGS="-D_LARGEFILE_SOURCE $CFLAGS"
996     printf "using -D_FILE_OFFSET_BITS=64"
997     printf " -D_LARGEFILE_SOURCE\n"
998     else
999     printf "NO\n"
1000     printf "Warning! No 64-bit off_t. Continuing "
1001     printf "anyway.\n"
1002     fi
1003     fi
1004     fi
1005     fi
1006     rm -f _testoff.c _testoff
1007    
1008    
1009     # Check for u_int8_t etc:
1010     printf "checking for u_int8_t... "
1011     printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n
1012     int main(int argc, char *argv[]){printf(\"%%i\\\n\",
1013     (int)sizeof(u_int8_t));return 0;}\n" > _testuint.c
1014     $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
1015     if [ ! -x _testuint ]; then
1016     rm -f _testuint*
1017     printf "#include <stdio.h>\n#include <inttypes.h>
1018     \n#include <sys/types.h>\nint main(int argc, char *argv[])
1019     {printf(\"%%i\\\n\", (int)sizeof(uint8_t));return 0;}\n" > _testuint.c
1020     $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
1021     if [ ! -x _testuint ]; then
1022     printf "no\n\nERROR: No u_int8_t or uint8_t. Aborting\n"
1023     # TODO: Automagically detect using various combinations
1024     # of char, int, short, long etc.
1025     exit
1026     fi
1027    
1028     printf "typedef uint8_t u_int8_t;\n" >> config.h
1029     printf "typedef uint16_t u_int16_t;\n" >> config.h
1030     printf "typedef uint32_t u_int32_t;\n" >> config.h
1031     printf "typedef uint64_t u_int64_t;\n" >> config.h
1032     printf "uint8_t\n"
1033     else
1034     printf "yes\n"
1035     fi
1036     rm -f _testuint.c _testuint
1037    
1038    
1039     ###############################################################################
1040     #
1041     # Dynamic binary translation (BINTRANS):
1042     #
1043     ###############################################################################
1044    
1045     printf "checking for bintrans backend... "
1046    
1047     BINTRANS=NO
1048    
1049     if [ z$ENABLEMIPS = zNO ]; then
1050     printf "NO!\nTEMPORARY HACK/PROBLEM: Disabling bintrans for now,\n"
1051     printf "until things have stabilized.\n"
1052     NOBINTRANS=YES
1053     fi
1054    
1055     if [ z$NOBINTRANS = zYES ]; then
1056     printf "disabled\n"
1057     else
1058     # Alpha:
1059     if [ z"`uname -m`" = zalpha ]; then
1060     printf "#define ALPHA\n" >> config.h
1061     printf "#define BINTRANS\n" >> config.h
1062     printf "Alpha\n"
1063     BINTRANS=YES
1064     fi
1065    
1066     # x86: (all machines ending in "86" are treated as i386)
1067     if [ z"`uname -m|rev|cut -c1-2`" = z68 ]; then
1068     printf "#define I386\n" >> config.h
1069     printf "#define BINTRANS\n" >> config.h
1070     printf "i386\n"
1071     BINTRANS=YES
1072     fi
1073    
1074     # MIPS not yet
1075     # # MIPS:
1076     # if [ z"`uname -m`" = zmips ]; then
1077     # printf "#define MIPS\n" >> config.h
1078     # printf "#define BINTRANS\n" >> config.h
1079     # printf "MIPS\n"
1080     # BINTRANS=YES
1081     # fi
1082    
1083     # # UltraSPARC:
1084     # if [ z"`uname -m`" = zsun4u ]; then
1085     # printf "#define SPARCV9\n" >> config.h
1086     # printf "#define BINTRANS\n" >> config.h
1087     # printf "SPARC V9\n"
1088     # BINTRANS=YES
1089     # else
1090     # if [ z"`uname -m`" = zsparc64 ]; then
1091     # printf "#define SPARCV9\n" >> config.h
1092     # printf "#define BINTRANS\n" >> config.h
1093     # printf "SPARC V9\n"
1094     # BINTRANS=YES
1095     # fi
1096     # fi
1097    
1098     if [ z$BINTRANS = zNO ]; then
1099     printf "not supported yet on this arch\n"
1100     fi
1101     fi
1102    
1103    
1104     ###############################################################################
1105    
1106     # Prefetch support?
1107     printf "checking for asm prefetch support... "
1108     if [ z"`uname -m`" = zalpha ]; then
1109     rm -f _alpha_asm_test.c _alpha_asm_test
1110     printf 'int main(int argc, char *argv[])
1111     { int x; int *y = &x; asm ("ldl $31,0(%%0)" : : "g" (y));
1112     return 0; }\n' > _alpha_asm_test.c
1113     $CC $CFLAGS -O2 _alpha_asm_test.c -o _alpha_asm_test \
1114     > /dev/null 2> /dev/null
1115     if [ -x _alpha_asm_test ]; then
1116     # printf "#define HAVE_PREFETCH\n" >> config.h
1117     printf "#define PREFETCH(x) asm(\"ldl" >> config.h
1118     printf " \$31,0(%%0)\" : : \"g\" (x))\n" >> config.h
1119     echo "yes"
1120     PREFSUP=YES
1121     fi
1122     rm -f _alpha_asm_test.c _alpha_asm_test
1123     fi
1124     if [ z$PREFSUP = z ]; then
1125     printf "#define PREFETCH(x) { }\n" >> config.h
1126     echo "no"
1127     fi
1128    
1129    
1130     ###############################################################################
1131    
1132 dpavlin 4 INCLUDE=-Iinclude/
1133     DINCLUDE=-I../include/
1134 dpavlin 2
1135 dpavlin 4 echo C compiler flags: $CFLAGS $CWARNINGS
1136 dpavlin 2 echo Linker flags: $OTHERLIBS
1137     echo "CWARNINGS=$CWARNINGS" >> _Makefile.header
1138     echo "COPTIM=$CFLAGS" >> _Makefile.header
1139     echo "INCLUDE=$INCLUDE" >> _Makefile.header
1140 dpavlin 4 echo "DINCLUDE=$DINCLUDE" >> _Makefile.header
1141 dpavlin 2 echo "CC=$CC" >> _Makefile.header
1142     echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header
1143     echo "" >> _Makefile.header
1144    
1145    
1146     printf "Regression test setup: (not really needed to build gxemul)\n"
1147    
1148    
1149     ## 64-bit HPPA cross-assembler:
1150     #
1151     #HPPA=''
1152     #if [ z$ENABLEHPPA = zYES ]; then
1153     # printf "Checking for a GNU cross-assembler for 64-bit HPPA... "
1154     # echo 'nop' > _testprog.s
1155     #
1156     # for HPPA_TRY in hppa64-unknown-elf hppa64-elf; do
1157     # printf '#!/bin/sh\n'$HPPA_TRY'-as _testprog.s' > _test.sh
1158     # printf ' -o _testprog.o\n' >> _test.sh
1159     # chmod 755 _test.sh
1160     # rm -f _testprog.o
1161     # ./_test.sh > /dev/null 2> /dev/null
1162     # if [ -f _testprog.o ]; then
1163     # HPPA=$HPPA_TRY
1164     # break
1165     # fi
1166     # rm -f _testprog.o
1167     # done
1168     #
1169     # if [ z$HPPA = z ]; then
1170     # echo "none"
1171     # else
1172     # echo $HPPA"-gcc"
1173     # fi
1174     #fi
1175     #rm -f _testprog* _test.sh
1176     #
1177     ## TODO: are these ok? 64-bit mode!
1178     ##echo "HPPA_CC="$HPPA"-gcc -g -O2 -fno-builtin -fschedule-insns" \
1179     ## >> _Makefile.header
1180     #echo "HPPA_AS="$HPPA"-as " >> _Makefile.header
1181     #echo "HPPA_LD="$HPPA"-ld -Ttext 0xa800000000030000 -e main" \
1182     # "--oformat=elf64-bigmips" >> _Makefile.header
1183     #echo "" >> _Makefile.header
1184    
1185    
1186     # 64-bit MIPS cross-compiler:
1187    
1188     MIPS=''
1189     if [ z$ENABLEMIPS = zYES ]; then
1190     printf "Checking for a GNU cross-compiler for 64-bit MIPS... "
1191     echo 'int f(int x) { return x; }' > _testprog.c
1192    
1193     for MIPS_TRY in mips64-unknown-elf mips64-elf mips-unknown-elf64; do
1194     printf '#!/bin/sh\n'$MIPS_TRY'-gcc _testprog.c -c\n' > _test.sh
1195     chmod 755 _test.sh
1196     rm -f _testprog.o
1197     ./_test.sh > /dev/null 2> /dev/null
1198     if [ -f _testprog.o ]; then
1199     MIPS=$MIPS_TRY
1200     break
1201     fi
1202     rm -f _testprog.o
1203     done
1204    
1205     if [ z$MIPS = z ]; then
1206     echo "none"
1207     else
1208     echo $MIPS"-gcc"
1209     fi
1210     fi
1211     rm -f _testprog* _test.sh
1212    
1213     echo "MIPS_CC="$MIPS"-gcc -g -O2 -fno-builtin -fschedule-insns" \
1214     "-mips64 -mabi=64" >> _Makefile.header
1215     echo "MIPS_AS="$MIPS"-as -mabi=64 -mips64" >> _Makefile.header
1216     echo "MIPS_LD="$MIPS"-ld -Ttext 0xa800000000030000 -e main" \
1217     "--oformat=elf64-bigmips" >> _Makefile.header
1218     echo "" >> _Makefile.header
1219    
1220    
1221     ## PPC64 cross-assembler:
1222     #
1223     #PPC=''
1224     #if [ z$ENABLEPPC = zYES ]; then
1225     # printf "Checking for a GNU cross-assembler for 64-bit PPC... "
1226     # echo 'nop' > _testprog.s
1227     #
1228     # for a in ppc64 powerpc64; do
1229     # for b in unknown; do
1230     # for c in elf elf64 linux linux64 aix aix5; do
1231     # PPC_TRY=$a-$b-$c
1232     # printf '#!/bin/sh\n'$PPC_TRY'-as _testprog.s' > _test.sh
1233     # printf ' -o _testprog.o\n' >> _test.sh
1234     # chmod 755 _test.sh
1235     # rm -f _testprog.o
1236     # ./_test.sh > /dev/null 2> /dev/null
1237     # if [ -f _testprog.o ]; then
1238     # PPC=$PPC_TRY
1239     # break
1240     # fi
1241     # rm -f _testprog.o
1242     # done
1243     # done
1244     # done
1245     #
1246     # if [ z$PPC = z ]; then
1247     # echo "none"
1248     # else
1249     # echo $PPC"-as"
1250     # fi
1251     #fi
1252     #rm -f _testprog* _test.sh
1253     #
1254     ##echo "PPC_CC="$PPC"-gcc -g -O2 -fno-builtin" >> _Makefile.header
1255     #echo "PPC_AS="$PPC"-as" >> _Makefile.header
1256     #echo "PPC_LD="$PPC"-ld -e main" >> _Makefile.header
1257     #echo "" >> _Makefile.header
1258    
1259    
1260     ## SPARC64 cross-compiler:
1261     #
1262     #SPARC=''
1263     #if [ z$ENABLESPARC = zYES ]; then
1264     # printf "Checking for a GNU cross-compiler for 64-bit SPARC... "
1265     # echo 'int f(int x) { return x; }' > _testprog.c
1266     #
1267     # for a in sparc64; do
1268     # for b in unknown; do
1269     # for c in elf elf64; do
1270     # SPARC_TRY=$a-$b-$c
1271     # printf '#!/bin/sh\n'$SPARC_TRY'-gcc _testprog.c -c' > _test.sh
1272     # printf ' -o _testprog.o\n' >> _test.sh
1273     # chmod 755 _test.sh
1274     # rm -f _testprog.o
1275     # ./_test.sh > /dev/null 2> /dev/null
1276     # if [ -f _testprog.o ]; then
1277     # SPARC=$SPARC_TRY
1278     # break
1279     # fi
1280     # rm -f _testprog.o
1281     # done
1282     # done
1283     # done
1284     #
1285     # if [ z$SPARC = z ]; then
1286     # echo "none"
1287     # else
1288     # echo $SPARC"-gcc"
1289     # fi
1290     #fi
1291     #rm -f _testprog* _test.sh
1292     #
1293     #echo "SPARC_CC="$SPARC"-gcc -g -O2 -fno-builtin" >> _Makefile.header
1294     #echo "SPARC_AS="$SPARC"-as" >> _Makefile.header
1295     #echo "SPARC_LD="$SPARC"-ld -e main" >> _Makefile.header
1296     #echo "" >> _Makefile.header
1297    
1298    
1299     # Create the Makefiles:
1300    
1301 dpavlin 4 for a in . src src/devices src/devices/fonts tests; do
1302 dpavlin 2 echo "creating $a/Makefile"
1303     touch $a/Makefile
1304     cat _Makefile.header > $a/Makefile
1305     cat $a/Makefile.skel >> $a/Makefile
1306     done
1307    
1308     # Tail of config.h:
1309     printf "\n#endif /* CONFIG_H */\n" >> config.h
1310    
1311     # Remove temporary Makefile header:
1312     rm -f _Makefile.header
1313    
1314     echo Configured. You may now run make to build gxemul.

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26