/[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 10 - (hide annotations)
Mon Oct 8 16:18:27 2007 UTC (16 years, 6 months ago) by dpavlin
File size: 32623 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.815 2005/06/27 23:04:35 debug Exp $
20050617	Experimenting some more with netbooting OpenBSD/sgi. Adding
		a hack which allows emulated ethernet networks to be
		distributed across multiple emulator processes.
20050618	Minor updates (documentation, dummy YAMON emulation, etc).
20050620	strcpy/strcat -> strlcpy/strlcat updates.
		Some more progress on evbmips (Malta).
20050621	Adding a section to doc/configfiles.html about ethernet
		emulation across multiple hosts.
		Beginning the work on the ARM translation engine (using the
		dynamic-but-not-binary translation method).
		Fixing a bintrans bug: 0x9fc00000 should always be treated as
		PROM area, just as 0xbfc00000 is.
		Minor progress on Malta emulation (the PCI-ISA bus).
20050622	NetBSD/evbmips can now be installed (using another emulated
		machine) and run (including userland and so on). :-)
		Spliting up the bintrans haddr_entry field into two (one for
		read, one for write). Probably not much of a speed increase,
		though.
		Updating some NetBSD 2.0 -> 2.0.2 in the documentation.
20050623	Minor updates (documentation, the TODO file, etc).
		gzipped kernels are now always automagically gunzipped when
		loaded.
20050624	Adding a dummy Playstation Portable (PSP) mode, just barely
		enough to run Hello World (in weird colors :-).
		Removing the -b command line option; old bintrans is enabled
		by default instead. It makes more sense.
		Trying to finally fix the non-working performance measurement
		thing (instr/second etc).
20050625	Continuing on the essential basics for ARM emulation. Two
		instructions seem to work, a branch and a simple "mov". (The
		mov arguments are not correct yet.) Performance is definitely
		reasonable.
		Various other minor updates.
		Adding the ARM "bl" instruction.
		Adding support for combining multiple ARM instructions into one
		function call. ("mov" + "mov" is the only one implemented so
		far, but it seems to work.)
		Cleaning up some IP32 interrupt things (crime/mace); disabling
		the PS/2 keyboard controller on IP32, so that NetBSD/sgimips
		boots into userland again.
20050626	Finally! NetBSD/sgimips netboots. Adding instructions to
		doc/guestoses.html on how to set up an nfs server etc.
		Various other minor fixes.
		Playstation Portable ".pbp" files can now be used directly.
		(The ELF part of the .pbp is extracted transparently.)
		Converting some sprintf -> snprintf.
		Adding some more instructions to the ARM disassembler.
20050627	More ARM updates. Adding some simple ldr(b), str(b),
		cmps, and conditional branch instructions, enough to run
		a simple Hello World program.
		All ARM instructions are now inlined/generated for all possible
		condition codes.
		Adding add and sub, and more load/store instructions.
		Removing dummy files: cpu_alpha.c, cpu_hppa.c, and cpu_sparc.c.
		Some minor documentation updates; preparing for a 0.3.4
		release. Updating some URLs.

==============  RELEASE 0.3.4  ==============


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26