/[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 6 - (hide annotations)
Mon Oct 8 16:18:11 2007 UTC (12 years, 9 months ago) by dpavlin
File size: 34372 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.772 2005/06/04 12:02:16 debug Exp $
20050428	Disabling the "-fmove-all-movables" option in the configure
		script, because it causes the compile to fail on OpenBSD/sgi.
20050502	Minor updates.
20050503	Removing the WRT54G mode (it was bogus anyway), and adding a
		comment about Windows NT for MIPS in doc/experiments.html.
		Minor updates to the x86 instruction decoding.
20050504	Adding some more x86 instructions.
		Adding support for reading files from ISO9660 CDROMs (including
		gzipped files). It's an ugly hack, but it seems to work.
		Various other minor updates (dev_vga.c, pc_bios.c etc).
20050505	Some more x86-related updates.
		Beginning (what I hope will be) a major code cleanup phase.
		"bootris" (an x86 bootsector) runs :-)
20050506	Adding some more x86 instructions.
20050507	tmpnam => mkstemp.
		Working on a hack to allow VGA charcells to be shown even when
		not running with X11.
		Adding more x86 instructions.
20050508	x86 32-bit SIB addressing fix, and more instructions.
20050509	Adding more x86 instructions.
20050510	Minor documentation updates, and other updates (x86 stuff etc.)
20050511	More x86-related updates.
20050513	Various updates, mostly x86-related. (Trying to fix flag 
		calculation, factoring out the ugly shift/rotate code, and
		some other things.)
20050514	Adding support for loading some old i386 a.out executables.
		Finally beginning the cleanup of machine/PROM/bios dependant
		info.
		Some minor documentation updates.
		Trying to clean up ARCBIOS stuff a little.
20050515	Trying to make it possible to actually use more than one disk
		type per machine (floppy, ide, scsi).
		Trying to clean up the kbd vs PROM console stuff. (For PC and
		ARC emulation modes, mostly.)
		Beginning to add an 8259 interrupt controller, and connecting
		it to the x86 emulation.
20050516	The first x86 interrupts seem to work (keyboard stuff).
		Adding a 8253/8254 programmable interval timer skeleton.
		FreeDOS now reaches a command prompt and can be interacted
		with.
20050517	After some bugfixes, MS-DOS also (sometimes) reaches a
		command prompt now.
		Trying to fix the pckbc to work with MS-DOS' keyb.com, but no
		success yet.
20050518	Adding a simple 32-bit x86 MMU skeleton.
20050519	Some more work on the x86 stuff. (Beginning the work on paging,
		and various other fixes).
20050520	More updates. Working on dev_vga (4-bit graphics modes), adding
		40 columns support to the PC bios emulation.
		Trying to add support for resizing windows when switching
		between graphics modes.
20050521	Many more x86-related updates.
20050522	Correcting the initial stack pointer's sign-extension for
		ARCBIOS emulation (thanks to Alec Voropay for noticing the
		error).
		Continuing on the cleanup (ARCBIOS etc).
		dev_vga updates.
20050523	More x86 updates: trying to add some support for protected mode
		interrupts (via gate descriptors) and many other fixes.
		More ARCBIOS cleanup.
		Adding a device flag which indicates that reads cause no
		side-effects. (Useful for the "dump" command in the debugger,
		and other things.)
		Adding support for directly starting up x86 ELFs, skipping the
		bootloader stage. (Most ELFs, however, are not suitable for
		this.)
20050524	Adding simple 32-bit x86 TSS task switching, but no privilege
		level support yet.
		More work on dev_vga. A small "Copper bars" demo works. :-)
		Adding support for Trap Flag (single-step exceptions), at least
		in real mode, and various other x86-related fixes.
20050525	Adding a new disk image prefix (gH;S;) which can be used to
		override the default nr of heads and sectors per track.
20050527	Various bug fixes, more work on the x86 mode (stack change on
		interrupts between different priv.levels), and some minor
		documentation updates.
20050528	Various fixes (x86 stuff).
20050529	More x86 fixes. An OpenBSD/i386 bootfloppy reaches userland
		and can be interacted with (although there are problems with
		key repetition). NetBSD/i386 triggers a serious CISC-related
		problem: instruction fetches across page boundaries, where
		the later part isn't actually part of the instruction.
20050530	Various minor updates. (Documentation updates, etc.)
20050531	Adding some experimental code (experiments/new_test_*) which
		could be useful for dynamic (but not binary) translation in
		the future.
20050602	Adding a dummy ARM skeleton.
		Fixing the pckbc key repetition problem (by adding release
		scancodes for all keypresses).
20050603	Minor updates for the next release.
20050604	Release testing. Minor updates.

==============  RELEASE 0.3.3  ==============

20050604	There'll probably be a 0.3.3.1 release soon, with some very
		very tiny updates.


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26