/[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 22 - (hide annotations)
Mon Oct 8 16:19:37 2007 UTC (12 years, 7 months ago) by dpavlin
File size: 33849 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1121 2006/02/18 21:03:08 debug Exp $
20051126	Cobalt and PReP now work with the 21143 NIC.
		Continuing on Alpha dyntrans things.
		Fixing some more left-shift-by-24 to unsigned.
20051127	Working on OpenFirmware emulation; major cleanup/redesign.
		Progress on MacPPC emulation: NetBSD detects two CPUs (when
		running with -n 2), framebuffer output (for text) works.
		Adding quick-hack Bandit PCI controller and "gc" interrupt
		controller for MacPPC.
20051128	Changing from a Bandit to a Uni-North controller for macppc.
		Continuing on OpenFirmware and MacPPC emulation in general
		(obio controller, and wdc attached to the obio seems to work).
20051129	More work on MacPPC emulation (adding a dummy ADB controller).
		Continuing the PCI bus cleanup (endianness and tag composition)
		and rewriting all PCI controllers' access functions.
20051130	Various minor PPC dyntrans optimizations.
		Manually inlining some parts of the framebuffer redraw routine.
		Slowly beginning the conversion of the old MIPS emulation into
		dyntrans (but this will take quite some time to get right).
		Generalizing quick_pc_to_pointers.
20051201	Documentation update (David Muse has made available a kernel
		which simplifies Debian/DECstation installation).
		Continuing on the ADB bus controller.
20051202	Beginning a rewrite of the Zilog serial controller (dev_zs).
20051203	Continuing on the zs rewrite (now called dev_z8530); conversion
		to devinit style.
		Reworking some of the input-only vs output-only vs input-output
		details of src/console.c, better warning messages, and adding
		a debug dump.
		Removing the concept of "device state"; it wasn't really used.
		Changing some debug output (-vv should now be used to show all
		details about devices and busses; not shown during normal
		startup anymore).
		Beginning on some SPARC instruction disassembly support.
20051204	Minor PPC updates (WALNUT skeleton stuff).
		Continuing on the MIPS dyntrans rewrite.
		More progress on the ADB controller (a keyboard is "detected"
		by NetBSD and OpenBSD).
		Downgrading OpenBSD/arc as a guest OS from "working" to
		"almost working" in the documentation.
		Progress on Algor emulation ("v3" PCI controller).
20051205	Minor updates.
20051207	Sorting devices according to address; this reduces complexity
		of device lookups from O(n) to O(log n) in memory_rw (but no
		real performance increase (yet) in experiments).
20051210	Beginning the work on native dyntrans backends (by making a
		simple skeleton; so far only for Alpha hosts).
20051211	Some very minor SPARC updates.
20051215	Fixing a bug in the MIPS mul (note: not mult) instruction,
		so it also works with non-64-bit emulation. (Thanks to Alec
		Voropay for noticing the problem.)
20051216	More work on the fake/empty/simple/skeleton/whatever backend;
		performance doesn't increase, so this isn't really worth it,
		but it was probably worth it to prepare for a real backend
		later.
20051219	More instr call statistics gathering and analysis stuff.
20051220	Another fix for MIPS 'mul'. Also converting mul and {d,}cl{o,z}
		to dyntrans.
		memory_ppc.c syntax error fix (noticed by Peter Valchev).
		Beginning to move out machines from src/machine.c into
		individual files in src/machines (in a way similar to the
		autodev system for devices).
20051222	Updating the documentation regarding NetBSD/pmax 3.0.
20051223	- " - NetBSD/cats 3.0.
20051225	- " - NetBSD/hpcmips 3.0.
20051226	Continuing on the machine registry redesign.
		Adding support for ARM rrx (33-bit rotate).
		Fixing some signed/unsigned issues (exposed by gcc -W).
20051227	Fixing the bug which prevented a NetBSD/prep 3.0 install kernel
		from starting (triggered when an mtmsr was the last instruction
		on a page). Unfortunately not enough to get the kernel to run
		as well as the 2.1 kernels did.
20051230	Some dyntrans refactoring.
20051231	Continuing on the machine registry redesign.
20060101-10	Continuing... moving more machines. Moving MD interrupt stuff
		from machine.c into a new src/machines/interrupts.c.
20060114	Adding various mvmeppc machine skeletons.
20060115	Continuing on mvme* stuff. NetBSD/mvmeppc prints boot messages
		(for MVME1600) and reaches the root device prompt, but no
		specific hardware devices are emulated yet.
20060116	Minor updates to the mvme1600 emulation mode; the Eagle PCI bus
		seems to work without much modification, and a 21143 can be
		detected, interrupts might work (but untested so far).
		Adding a fake MK48Txx (mkclock) device, for NetBSD/mvmeppc.
20060121	Adding an aux control register for ARM. (A BIG thank you to
		Olivier Houchard for tracking down this bug.)
20060122	Adding more ARM instructions (smulXY), and dev_iq80321_7seg.
20060124	Adding disassembly of more ARM instructions (mia*, mra/mar),
		and some semi-bogus XScale and i80321 registers.
20060201-02	Various minor updates. Moving the last machines out of
		machine.c.
20060204	Adding a -c command line option, for running debugger commands
		before the simulation starts, but after all files have been
		loaded.
		Minor iq80321-related updates.
20060209	Minor hacks (DEVINIT macro, etc).
		Preparing for the generalization of the 64-bit dyntrans address
		translation subsystem.
20060216	Adding ARM ldrd (double-register load).
20060217	Continuing on various ARM-related stuff.
20060218	More progress on the ATA/wdc emulation for NetBSD/iq80321.
		NetBSD/evbarm can now be installed :-)  Updating the docs, etc.
		Continuing on Algor emulation.

==============  RELEASE 0.3.8  ==============


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26