/[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 14 - (hide annotations)
Mon Oct 8 16:18:51 2007 UTC (16 years, 6 months ago) by dpavlin
File size: 35208 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.982 2005/10/07 22:45:32 debug Exp $
20050816	Some success in decoding the way the SGI O2 PROM draws graphics
		during bootup; lines/rectangles and bitmaps work, enough to
		show the bootlogo etc. :-)
		Adding more PPC instructions, and (dummy) BAT registers.
20050817	Updating the pckbc to support scancode type 3 keyboards
		(required in order to interact with the SGI O2 PROM).
		Adding more PPC instructions.
20050818	Adding more ARM instructions; general register forms.
		Importing armreg.h from NetBSD (ARM cpu ids). Adding a (dummy)
		CATS machine mode (using SA110 as the default CPU).
		Continuing on general dyntrans related stuff.
20050819	Register forms for ARM load/stores. Gaah! The Compaq C Compiler
		bug is triggered for ARM loads as well, not just PPC :-(
		Adding full support for ARM PC-relative load/stores, and load/
		stores where the PC register is the destination register.
		Adding support for ARM a.out binaries.
20050820	Continuing to add more ARM instructions, and correcting some
		bugs. Continuing on CATS emulation.
		More work on the PPC stuff.
20050821	Minor PPC and ARM updates. Adding more machine types.
20050822	All ARM "data processing instructions" are now generated
		automatically.
20050824	Beginning the work on the ARM system control coprocessor.
		Adding support for ARM halfword load/stores, and signed loads.
20050825	Fixing an important bug related to the ARM condition codes.
		OpenBSD/zaurus and NetBSD/netwinder now print some boot
		messages. :)
		Adding a dummy SH (Hitachi SuperH) cpu family.
		Beginning to add some ARM virtual address translation.
		MIPS bugfixes: unaligned PC now cause an ADEL exception (at
		least for non-bintrans execution), and ADEL/ADES (not
		TLBL/TLBS) are used if userland tries to access kernel space.
		(Thanks to Joshua Wise for making me aware of these bugs.)
20050827	More work on the ARM emulation, and various other updates.
20050828	More ARM updates.
		Finally taking the time to work on translation invalidation
		(i.e. invalidating translated code mappings when memory is
		written to). Hopefully this doesn't break anything.
20050829	Moving CPU related files from src/ to a new subdir, src/cpus/.
		Moving PROM emulation stuff from src/ to src/promemul/.
		Better debug instruction trace for ARM loads and stores.
20050830	Various ARM updates (correcting CMP flag calculation, etc).
20050831	PPC instruction updates. (Flag fixes, etc.)
20050901	Various minor PPC and ARM instruction emulation updates.
		Minor OpenFirmware emulation updates.
20050903	Adding support for adding arbitrary ARM coprocessors (with
		the i80321 I/O coprocessor as a first test).
		Various other ARM and PPC updates.
20050904	Adding some SHcompact disassembly routines.
20050907	(Re)adding a dummy HPPA CPU module, and a dummy i960 module.
20050908	Began hacking on some Apple Partition Table support.
20050909	Adding support for loading Mach-O (Darwin PPC) binaries.
20050910	Fixing an ARM bug (Carry flag was incorrectly updated for some
		data processing instructions); OpenBSD/cats and NetBSD/
		netwinder get quite a bit further now.
		Applying a patch to dev_wdc, and a one-liner to dev_pcic, to
		make them work better when emulating new versions of OpenBSD.
		(Thanks to Alexander Yurchenko for the patches.)
		Also doing some other minor updates to dev_wdc. (Some cleanup,
		and finally converting to devinit, etc.)
20050912	IRIX doesn't have u_int64_t by default (noticed by Andreas
		<avr@gnulinux.nl>); configure updated to reflect this.
		Working on ARM register bank switching, CPSR vs SPSR issues,
		and beginning the work on interrupt/exception support.
20050913	Various minor ARM updates (speeding up load/store multiple,
		and fixing a ROR bug in R(); NetBSD/cats now boots as far as
		OpenBSD/cats).
20050917	Adding a dummy Atmel AVR (8-bit) cpu family skeleton.
20050918	Various minor updates.
20050919	Symbols are now loaded from Mach-O executables.
		Continuing the work on adding ARM exception support.
20050920	More work on ARM stuff: OpenBSD/cats and NetBSD/cats reach
		userland! :-)
20050921	Some more progress on ARM interrupt specifics.
20050923	Fixing linesize for VR4121 (patch by Yurchenko). Also fixing
		linesizes/cachesizes for some other VR4xxx.
		Adding a dummy Acer Labs M1543 PCI-ISA bridge (for CATS) and a
		dummy Symphony Labs 83C553 bridge (for Netwinder), usable by 
		dev_footbridge.
20050924	Some PPC progress.
20050925	More PPC progress.
20050926	PPC progress (fixing some bugs etc); Darwin's kernel gets
		slightly further than before.
20050928	Various updates: footbridge/ISA/pciide stuff, and finally
		fixing the VGA text scroll-by-changing-the-base-offset bug.
20050930	Adding a dummy S3 ViRGE pci card for CATS emulation, which
		both NetBSD and OpenBSD detects as VGA.
		Continuing on Footbridge (timers, ISA interrupt stuff).
20051001	Continuing... there are still bugs, probably interrupt-
		related.
20051002	More work on the Footbridge (interrupt stuff).
20051003	Various minor updates. (Trying to find the bug(s).)
20051004	Continuing on the ARM stuff.
20051005	More ARM-related fixes.
20051007	FINALLY! Found and fixed 2 ARM bugs: 1 memory related, and the
		other was because of an error in the ARM manual (load multiple
		with the S-bit set should _NOT_ load usermode registers, as the
		manual says, but it should load saved registers, which may or
		may not happen to be usermode registers).
		NetBSD/cats and OpenBSD/cats seem to install fine now :-)
		except for a minor bug at the end of the OpenBSD/cats install.
		Updating the documentation, preparing for the next release.
20051008	Continuing with release testing and cleanup.

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26