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

Contents of /trunk/configure

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations)
Mon Oct 8 16:21:17 2007 UTC (12 years, 7 months ago) by dpavlin
File size: 30535 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1480 2007/02/19 01:34:42 debug Exp $
20061029	Changing usleep(1) calls in the debugger to usleep(10000)
20061107	Adding a new disk image option (-d o...) which sets the ISO9660
		filesystem base offset; also making some other hacks to allow
		NetBSD/dreamcast and homebrew demos/games to boot directly
		from a filesystem image.
		Moving Dreamcast-specific stuff in the documentation to its
		own page (dreamcast.html).
		Adding a border to the Dreamcast PVR framebuffer.
20061108	Adding a -T command line option (again?), for halting the
		emulator on unimplemented memory accesses.
20061109	Continuing on various SH4 and Dreamcast related things.
		The emulator should now halt on more unimplemented device
		accesses, instead of just printing a warning, forcing me to
		actually implement missing stuff :)
20061111	Continuing on SH4 and Dreamcast stuff.
		Adding a bogus Landisk (SH4) machine mode.
20061112	Implementing some parts of the Dreamcast GDROM device. With
		some ugly hacks, NetBSD can (barely) mount an ISO image.
20061113	NetBSD/dreamcast now starts booting from the Live CD image,
		but crashes randomly quite early on in the boot process.
20061122	Beginning on a skeleton interrupt.h and interrupt.c for the
		new interrupt subsystem.
20061124	Continuing on the new interrupt system; taking the first steps
		to attempt to connect CPUs (SuperH and MIPS) and devices
		(dev_cons and SH4 timer interrupts) to it. Many things will
		probably break from now on.
20061125	Converting dev_ns16550, dev_8253 to the new interrupt system.
		Attempting to begin to convert the ISA bus.
20061130	Incorporating a patch from Brian Foley for the configure
		script, which checks for X11 libs in /usr/X11R6/lib64 (which
		is used on some Linux systems).
20061227	Adding a note in the man page about booting from Dreamcast
		CDROM images (i.e. that no external kernel is needed).
20061229	Continuing on the interrupt system rewrite: beginning to
		convert more devices, adding abort() calls for legacy interrupt
		system calls so that everything now _has_ to be rewritten!
		Almost all machine modes are now completely broken.
20061230	More progress on removing old interrupt code, mostly related
		to the ISA bus + devices, the LCA bus (on AlphaBook1), and
		the Footbridge bus (for CATS). And some minor PCI stuff.
		Connecting the ARM cpu to the new interrupt system.
		The CATS, NetWinder, and QEMU_MIPS machine modes now work with
		the new interrupt system :)
20061231	Connecting PowerPC CPUs to the new interrupt system.
		Making PReP machines (IBM 6050) work again.
		Beginning to convert the GT PCI controller (for e.g. Malta
		and Cobalt emulation). Some things work, but not everything.
		Updating Copyright notices for 2007.
20070101	Converting dev_kn02 from legacy style to devinit; the 3max
		machine mode now works with the new interrupt system :-]
20070105	Beginning to convert the SGI O2 machine to the new interrupt
		system; finally converting O2 (IP32) devices to devinit, etc.
20070106	Continuing on the interrupt system redesign/rewrite; KN01
		(PMAX), KN230, and Dreamcast ASIC interrupts should work again,
		moving out stuff from machine.h and devices.h into the
		corresponding devices, beginning the rewrite of i80321
		interrupts, etc.
20070107	Beginning on the rewrite of Eagle interrupt stuff (PReP, etc).
20070117	Beginning the rewrite of Algor (V3) interrupts (finally
		changing dev_v3 into devinit style).
20070118	Removing the "bus" registry concept from machine.h, because
		it was practically meaningless.
		Continuing on the rewrite of Algor V3 ISA interrupts.
20070121	More work on Algor interrupts; they are now working again,
		well enough to run NetBSD/algor. :-)
20070122	Converting VR41xx (HPCmips) interrupts. NetBSD/hpcmips
		can be installed using the new interrupt system :-)
20070123	Making the testmips mode work with the new interrupt system.
20070127	Beginning to convert DEC5800 devices to devinit, and to the
		new interrupt system.
		Converting Playstation 2 devices to devinit, and converting
		the interrupt system. Also fixing a severe bug: the interrupt
		mask register on Playstation 2 is bitwise _toggled_ on writes.
20070128	Removing the dummy NetGear machine mode and the 8250 device
		(which was only used by the NetGear machine).
		Beginning to convert the MacPPC GC (Grand Central) interrupt
		controller to the new interrupt system.
		Converting Jazz interrupts (PICA61 etc.) to the new interrupt
		system. NetBSD/arc can be installed again :-)
		Fixing the JAZZ timer (hardcoding it at 100 Hz, works with
		NetBSD and it is better than a completely dummy timer as it
		was before).
		Converting dev_mp to the new interrupt system, although I
		haven't had time to actually test it yet.
		Completely removing src/machines/interrupts.c, cpu_interrupt
		and cpu_interrupt_ack in src/cpu.c, and
		src/include/machine_interrupts.h! Adding fatal error messages
		+ abort() in the few places that are left to fix.
		Converting dev_z8530 to the new interrupt system.
		FINALLY removing the md_int struct completely from the
		machine struct.
		SH4 fixes (adding a PADDR invalidation in the ITLB replacement
		code in memory_sh.c); the NetBSD/dreamcast LiveCD now runs
		all the way to the login prompt, and can be interacted with :-)
		Converting the CPC700 controller (PCI and interrupt controller
		for PM/PPC) to the new interrupt system.
20070129	Fixing MACE ISA interrupts (SGI IP32 emulation). Both NetBSD/
		sgimips' and OpenBSD/sgi's ramdisk kernels can now be
		interacted with again.
20070130	Moving out the MIPS multi_lw and _sw instruction combinations
		so that they are auto-generated at compile time instead.
20070131	Adding detection of amd64/x86_64 hosts in the configure script,
		for doing initial experiments (again :-) with native code
		generation.
		Adding a -k command line option to set the size of the dyntrans
		cache, and a -B command line option to disable native code
		generation, even if GXemul was compiled with support for
		native code generation for the specific host CPU architecture.
20070201	Experimenting with a skeleton for native code generation.
		Changing the default behaviour, so that native code generation
		is now disabled by default, and has to be enabled by using
		-b on the command line.
20070202	Continuing the native code generation experiments.
		Making PCI interrupts work for Footbridge again.
20070203	More native code generation experiments.
		Removing most of the native code generation experimental code,
		it does not make sense to include any quick hacks like this.
		Minor cleanup/removal of some more legacy MIPS interrupt code.
20070204	Making i80321 interrupts work again (for NetBSD/evbarm etc.),
		and fixing the timer at 100 Hz.
20070206	Experimenting with removing the wdc interrupt slowness hack.
20070207	Lowering the number of dyntrans TLB entries for MIPS from
		192 to 128, resulting in a minor speed improvement.
		Minor optimization to the code invalidation routine in
		cpu_dyntrans.c.
20070208	Increasing (experimentally) the nr of dyntrans instructions per
		loop from 60 to 120.
20070210	Commenting out (experimentally) the dyntrans_device_danger
		detection in memory_rw.c.
		Changing the testmips and baremips machines to use a revision 2
		MIPS64 CPU by default, instead of revision 1.
		Removing the dummy i960, IA64, x86, AVR32, and HP PA-RISC
		files, the PC bios emulation, and the Olivetti M700 (ARC) and
		db64360 emulation modes.
20070211	Adding an "mp" demo to the demos directory, which tests the
		SMP functionality of the testmips machine.
		Fixing PReP interrupts some more. NetBSD/prep now boots again.
20070216	Adding a "nop workaround" for booting Mach/PMAX to the
		documentation; thanks to Artur Bujdoso for the values.
		Converting more of the MacPPC interrupt stuff to the new
		system.
		Beginning to convert BeBox interrupts to the new system.
		PPC603e should NOT have the PPC_NO_DEC flag! Removing it.
		Correcting BeBox clock speed (it was set to 100 in the NetBSD
		bootinfo block, but should be 33000000/4), allowing NetBSD
		to start without using the (incorrect) PPC_NO_DEC hack.
20070217	Implementing (slow) AltiVec vector loads and stores, allowing
		NetBSD/macppc to finally boot using the GENERIC kernel :-)
		Updating the documentation with install instructions for
		NetBSD/macppc.
20070218-19	Regression testing for the release.

==============  RELEASE 0.4.4  ==============


1 #!/bin/sh
2 ###############################################################################
3 #
4 # Copyright (C) 2003-2007 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 # $Id: configure,v 1.243 2007/02/10 14:29:54 debug Exp $
31 #
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 # via command line options?)
52 # o) native code generation backend (i.e. detect host architecture)
53 #
54 #
55 # The general philosophy regarding command line switches is that anything
56 # which can be incorporated into the program as a runtime command line option
57 # should be, instead of requiring a recompile.
58 #
59 ###############################################################################
60
61 # 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 ENABLEALPHA=YES
66 ENABLEARM=YES
67 ENABLEMIPS=YES
68 ENABLEPPC=YES
69 ENABLESH=YES
70 else
71 # Development:
72 UNSTABLE=YES
73 ENABLEALPHA=YES
74 ENABLEARM=YES
75 ENABLEAVR=YES
76 ENABLEM68K=YES
77 ENABLEMIPS=YES
78 ENABLEPPC=YES
79 ENABLERCA180X=YES
80 ENABLESH=YES
81 ENABLESPARC=YES
82 ENABLETRANSPUTER=YES
83 fi
84
85 if [ z"$UNSTABLE" = zYES ]; then
86 printf "###\n### DEVELOPMENT (UNSTABLE)\n###\n\n"
87 fi
88
89 if [ z"$*" != z ]; then
90 # Parse command line options:
91 for a in $*; do
92 if [ z$a = z--disable-x ]; then
93 NOX11=YES
94 else if [ z$a = z--help ]; then
95 printf "usage: $0 [options]\n\n"
96 echo " --disable-x don't include X11 support,"\
97 "even if the host supports it"
98 echo
99 exit
100 else
101 echo "Invalid option: $a"
102 echo "Run $0 --help to get a list of" \
103 "available options."
104 exit
105 fi; fi
106 done
107 fi
108
109
110 ###############################################################################
111 #
112 # Configure options:
113 #
114 # This creates a config.h file, which is then included from include/misc.h.
115 #
116 ###############################################################################
117
118 # Head of config.h:
119 printf "/*
120 * THIS FILE IS AUTOMATICALLY CREATED BY configure!
121 * DON'T EDIT THIS FILE MANUALLY, IT WILL BE OVERWRITTEN.
122 */
123 \n#ifndef CONFIG_H\n#define CONFIG_H\n\n" > config.h
124
125
126 # Figure out if VERSION should be defined.
127 X=`basename \`pwd\`|cut -d \- -f 2-`
128 if [ z"$X" = zgxemul ]; then
129 echo '/* No VERSION defined. */' >> config.h
130 else
131 printf "#define VERSION \"$X\"\n" >> config.h
132 fi
133
134
135 if [ z"$UNSTABLE" = zYES ]; then
136 printf "#define UNSTABLE_DEVEL\n" >> config.h
137 fi
138
139
140 ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\``
141 printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h
142
143
144
145 # Support for various CPU types:
146 if [ z$ENABLEALPHA = zYES ]; then
147 printf "#define ENABLE_ALPHA\n" >> config.h
148 CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o memory_alpha.o"
149 CPU_TOOLS="$CPU_TOOLS generate_alpha_misc"
150 fi
151 if [ z$ENABLEARM = zYES ]; then
152 printf "#define ENABLE_ARM\n" >> config.h
153 CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o "
154 CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o tmp_arm_r.o"
155 CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o"
156 CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o"
157 CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o"
158 CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o"
159 CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o"
160 CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o"
161 CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o"
162 CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o tmp_arm_multi.o"
163 CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r"
164 CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi"
165 fi
166 if [ z$ENABLEAVR = zYES ]; then
167 printf "#define ENABLE_AVR\n" >> config.h
168 CPU_ARCHS="$CPU_ARCHS cpu_avr.o"
169 fi
170 if [ z$ENABLEM68K = zYES ]; then
171 printf "#define ENABLE_M68K\n" >> config.h
172 CPU_ARCHS="$CPU_ARCHS cpu_m68k.o"
173 fi
174 if [ z$ENABLEMIPS = zYES ]; then
175 printf "#define ENABLE_MIPS\n" >> config.h
176 CPU_ARCHS="$CPU_ARCHS cpu_mips.o cpu_mips_coproc.o "
177 CPU_ARCHS="$CPU_ARCHS cpu_mips_instr_unaligned.o"
178 CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore"
179 CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore_multi"
180 fi
181 if [ z$ENABLEPPC = zYES ]; then
182 printf "#define ENABLE_PPC\n" >> config.h
183 CPU_ARCHS="$CPU_ARCHS cpu_ppc.o"
184 CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore"
185 fi
186 if [ z$ENABLERCA180X = zYES ]; then
187 printf "#define ENABLE_RCA180X\n" >> config.h
188 CPU_ARCHS="$CPU_ARCHS cpu_rca180x.o"
189 fi
190 if [ z$ENABLESH = zYES ]; then
191 printf "#define ENABLE_SH\n" >> config.h
192 CPU_ARCHS="$CPU_ARCHS cpu_sh.o memory_sh.o"
193 fi
194 if [ z$ENABLESPARC = zYES ]; then
195 printf "#define ENABLE_SPARC\n" >> config.h
196 CPU_ARCHS="$CPU_ARCHS cpu_sparc.o memory_sparc.o"
197 CPU_TOOLS="$CPU_TOOLS generate_sparc_loadstore"
198 fi
199 if [ z$ENABLETRANSPUTER = zYES ]; then
200 printf "#define ENABLE_TRANSPUTER\n" >> config.h
201 CPU_ARCHS="$CPU_ARCHS cpu_transputer.o"
202 fi
203
204
205 ###############################################################################
206 #
207 # Special hacks for some host OSes:
208 #
209 ###############################################################################
210
211 if [ z"`uname|cut -c 1-6`" = zCYGWIN ]; then
212 CYGWIN=YES
213
214 if [ z"$CC" = z ]; then
215 # Assume gcc on Cygwin (Windows) systems.
216 CC=gcc
217 fi
218 fi
219
220 if [ z"`uname`" = zHP-UX ]; then
221 HPUX=YES
222
223 if [ z$CC = z ]; then
224 if [ -f /usr/local/pa64/bin/gcc ]; then
225 CC=/usr/local/pa64/bin/gcc
226 fi
227 fi
228 fi
229
230 if [ z"`uname`" = zOSF1 ]; then
231 OSF1=YES
232 fi
233
234
235 ###############################################################################
236 #
237 # Create the Makefile header:
238 #
239 ###############################################################################
240
241 rm -f _Makefile.header
242
243 printf "#
244 # DO NOT EDIT THIS FILE! It is automagically created by
245 # the configure script, based on Makefile.skel.
246 #\n\n" >> _Makefile.header
247
248
249 echo 'int main(int argc, char *argv[]) { return 0; }' > _testprog.c
250
251
252 # Try to detect which C compiler to use, if CC is not set:
253 printf "checking which C compiler to use... "
254
255 if [ z"$CC" = z ]; then
256 CC=cc
257
258 # Try gcc first:
259 printf "#!/bin/sh\ngcc _testprog.c -o _testprog >" > _test.sh
260 printf " /dev/null 2> /dev/null\n" >> _test.sh
261 chmod 755 _test.sh
262 ./_test.sh > /dev/null 2> /dev/null
263 if [ -x _testprog ]; then
264 CC=gcc
265 fi
266 rm -f _testprog
267
268 # If both gcc and cc exist, then cc might be a vendor specific
269 # compiler which produces faster code than gcc (eg on Solaris):
270 printf "#!/bin/sh\ncc _testprog.c -o _testprog >" > _test.sh
271 printf " /dev/null 2> /dev/null\n" >> _test.sh
272 chmod 755 _test.sh
273 ./_test.sh > /dev/null 2> /dev/null
274 if [ -x _testprog ]; then
275 CC=cc
276 fi
277 rm -f _testprog
278
279 # # Try ccc (FreeBSD/Alpha):
280 # printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh
281 # printf " /dev/null 2> /dev/null\n" >> _test.sh
282 # chmod 755 _test.sh
283 # ./_test.sh > /dev/null 2> /dev/null
284 # if [ -x _testprog ]; then
285 # CC="ccc"
286 # fi
287 # rm -f _testprog
288
289 rm -f _test.sh
290 fi
291
292
293 rm -f _testprog
294 printf "$CC $CFLAGS"
295
296
297 CCTYPE="generic"
298
299 if $CC $CFLAGS -V 2> /dev/null | grep ompaq 1> /dev/null 2> /dev/null; then
300 COMPAQCC=YES
301 CCTYPE="Compaq CC"
302 fi
303
304 if $CC $CFLAGS -V 2>&1 | grep Sun 1> /dev/null 2> /dev/null; then
305 SUNCC=YES
306 CCTYPE="Solaris CC"
307 fi
308
309 if $CC $CFLAGS -v 2>&1 | grep gcc 1> /dev/null 2> /dev/null; then
310 GCCCC=YES
311 CCTYPE="GNU CC"
312 fi
313
314 if [ z$CYGWIN = zYES ]; then
315 CCTYPE="$CCTYPE (Cygwin)"
316 fi
317
318 echo " ($CCTYPE)"
319
320
321 if [ z$NOX11 = z ]; then
322 printf "checking for X11 headers and libs\n"
323
324 # Try to compile a small X11 test program:
325 printf "#include <X11/Xlib.h>
326 #include <stdio.h>
327 Display *dis;
328 void f(void) {
329 dis = XOpenDisplay(NULL);
330 }
331 int main(int argc, char *argv[])
332 { return 0; }
333 " > _test_x11.c
334
335 XOK=0
336
337 XINCLUDE=-I/usr/X11R6/include
338 $CC $CFLAGS _test_x11.c -c -o _test_x11.o $XINCLUDE 2> /dev/null
339
340 XLIB="-L/usr/X11R6/lib -lX11"
341 $CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null
342
343 if [ -x _test_x11 ]; then
344 XOK=1
345 fi
346
347 rm -f _test_x11 _test_x11.o
348
349 # Special case for some 64-bit Linux/x86_64 systems:
350 if [ z$XOK = z0 ]; then
351 XLIB="-L/usr/X11R6/lib64 -lX11"
352 $CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null
353
354 if [ -x _test_x11 ]; then
355 XOK=1
356 fi
357 fi
358 rm -f _test_x11 _test_x11.o
359
360 if [ z$XOK = z0 ]; then
361 XINCLUDE=""
362 $CC $CFLAGS _test_x11.c -c -o _test_x11.o \
363 $XINCLUDE 2> /dev/null
364
365 # -lsocket for Solaris
366 XLIB="-lX11 -lsocket"
367 $CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null
368
369 if [ -x _test_x11 ]; then
370 XOK=1
371 fi
372 rm -f _test_x11 _test_x11.o
373 fi
374
375 if [ z`uname` = zNetBSD ]; then
376 echo "Using NetBSD hack for X11 libs..."
377 XLIB="$XLIB -Wl,-rpath,/usr/X11R6/lib"
378 fi
379
380 if [ z`uname` = zOpenBSD ]; then
381 if [ z`uname -m` = zarc ]; then
382 echo "Using old OpenBSD/arc hack for X11 libs..."
383 XLIB="$XLIB -Wl,-rpath,/usr/X11R6/lib"
384 fi
385 fi
386
387 if [ z$XOK = z0 ]; then
388 echo "Failed to compile X11 test program." \
389 "Configuring without X11."
390 else
391 printf "X11 headers: $XINCLUDE\n"
392 printf "X11 libraries: $XLIB\n"
393 echo "XINCLUDE=$XINCLUDE" >> _Makefile.header
394 echo "XLIB=$XLIB" >> _Makefile.header
395 printf "#define WITH_X11\n" >> config.h
396 fi
397
398 rm -f _test_x11.c
399 fi
400
401
402 if [ z$HPUX = zYES ]; then
403 CFLAGS="-D_XOPEN_SOURCE_EXTENDED $CFLAGS"
404 printf "#define HPUX\n" >> config.h
405 fi
406
407
408 if [ z$OSF1 = zYES ]; then
409 CFLAGS="-D_XOPEN_SOURCE=500 -D_OSF_SOURCE -D_POSIX_PII_SOCKET $CFLAGS"
410 fi
411
412
413 # Check for 'alpha' define.
414 printf "checking for 'alpha' define... "
415 printf "#include <stdio.h>\nint main(int argc, char *argv[]){
416 #ifdef alpha
417 printf(\"1\");
418 #undef alpha
419 #ifdef alpha
420 printf(\"2\");
421 #endif
422 #endif
423 printf(\"\\\n\");return 0;}\n" > _testm.c
424 $CC $CFLAGS _testm.c -o _testm 2> /dev/null
425 if [ ! -x _testm ]; then
426 printf "\nWARNING! COULD NOT COMPILE alpha define TEST"
427 printf " PROGRAM AT ALL!\n"
428 else
429 if [ z`./_testm` = z1 ]; then
430 printf "yes, workaround applied\n"
431 echo "#undef alpha" >> config.h
432 else
433 if [ z`./_testm` = z12 ]; then
434 printf "yes, but workaround not possible\n"
435 exit
436 else
437 printf "no\n"
438 fi
439 fi
440 fi
441 rm -f _testm*
442
443
444 # Some OSes on MIPS seems to define 'mips' to 1. (eg OpenBSD/arc)
445 printf "checking for 'mips' define... "
446 printf "#include <stdio.h>\nint main(int argc, char *argv[]){
447 #ifdef mips
448 printf(\"1\");
449 #undef mips
450 #ifdef mips
451 printf(\"2\");
452 #endif
453 #endif
454 printf(\"\\\n\");return 0;}\n" > _testm.c
455 $CC $CFLAGS _testm.c -o _testm 2> /dev/null
456 if [ ! -x _testm ]; then
457 printf "\nWARNING! COULD NOT COMPILE mips define TEST"
458 printf " PROGRAM AT ALL!\n"
459 else
460 if [ z`./_testm` = z1 ]; then
461 printf "yes, workaround applied\n"
462 echo "#undef mips" >> config.h
463 else
464 if [ z`./_testm` = z12 ]; then
465 printf "yes, but workaround not possible\n"
466 exit
467 else
468 printf "no\n"
469 fi
470 fi
471 fi
472 rm -f _testm*
473
474
475 # Similar to the mips define check above, although I don't know if
476 # any OS actually defined ppc like this.
477 printf "checking for 'ppc' define... "
478 printf "#include <stdio.h>\nint main(int argc, char *argv[]){
479 #ifdef ppc
480 printf(\"1\");
481 #undef ppc
482 #ifdef ppc
483 printf(\"2\");
484 #endif
485 #endif
486 printf(\"\\\n\");return 0;}\n" > _testm.c
487 $CC $CFLAGS _testm.c -o _testm 2> /dev/null
488 if [ ! -x _testm ]; then
489 printf "\nWARNING! COULD NOT COMPILE ppc define TEST"
490 printf " PROGRAM AT ALL!\n"
491 else
492 if [ z`./_testm` = z1 ]; then
493 printf "yes, workaround applied\n"
494 echo "#undef ppc" >> config.h
495 else
496 if [ z`./_testm` = z12 ]; then
497 printf "yes, but workaround not possible\n"
498 exit
499 else
500 printf "no\n"
501 fi
502 fi
503 fi
504 rm -f _testm*
505
506
507 # Similar to the mips define check above, although I don't know if
508 # any OS actually defined sparc like this.
509 printf "checking for 'sparc' define... "
510 printf "#include <stdio.h>\nint main(int argc, char *argv[]){
511 #ifdef sparc
512 printf(\"1\");
513 #undef sparc
514 #ifdef sparc
515 printf(\"2\");
516 #endif
517 #endif
518 printf(\"\\\n\");return 0;}\n" > _testm.c
519 $CC $CFLAGS _testm.c -o _testm 2> /dev/null
520 if [ ! -x _testm ]; then
521 printf "\nWARNING! COULD NOT COMPILE sparc define TEST "
522 printf "PROGRAM AT ALL!\n"
523 else
524 if [ z`./_testm` = z1 ]; then
525 printf "yes, workaround applied\n"
526 echo "#undef sparc" >> config.h
527 else
528 if [ z`./_testm` = z12 ]; then
529 printf "yes, but workaround not possible\n"
530 exit
531 else
532 printf "no\n"
533 fi
534 fi
535 fi
536 rm -f _testm*
537
538
539 # CWARNINGS:
540 printf "checking whether -Wall can be used... "
541 $CC $CFLAGS _testprog.c -o _testprog -Wall 2> /dev/null
542 if [ -x _testprog ]; then
543 printf "yes\n"
544 CWARNINGS="-Wall $CWARNINGS"
545
546 # Compaq's compiler always seems to warn about the long long type,
547 # and unusedtop suppresses warnings about include files being
548 # included more than once.
549 if [ z"$COMPAQCC" = zYES ]; then
550 CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop"
551 fi
552
553 if [ z"$UNSTABLE" = zYES ]; then
554 printf "checking whether -Werror can be used... "
555 rm -f _testprog
556 $CC $CFLAGS $CWARNINGS _testprog.c -o _testprog -Werror 2> /dev/null
557 if [ -x _testprog ]; then
558 printf "yes\n"
559 CWARNINGS="$CWARNINGS -Werror"
560 else
561 printf "no\n"
562 fi
563 fi
564 else
565 printf "no\n"
566 fi
567 rm -f _testprog
568
569
570 if [ z"$COMPAQCC" = zYES ]; then
571 # -O4 is possible, but sometimes -O3 is better?
572 CFLAGS="-O4 $CFLAGS"
573 else
574 if [ z"`uname`" = zSunOS ]; then
575 # "cc", the system's default compiler:
576 if [ z"$SUNCC" = zYES ]; then
577 CFLAGS="-xO5 -xdepend $CFLAGS"
578 fi
579 printf "#define SOLARIS\n" >> config.h
580 OTHERLIBS="-lsocket $OTHERLIBS"
581 else
582 # gcc or something else:
583 $CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null
584 if [ -x _testprog ]; then
585 rm -f _testprog
586 $CC $CFLAGS _testprog.c -o _testprog -O3 2> /dev/null
587 if [ -x _testprog ]; then
588 CFLAGS="-O3 $CFLAGS"
589 else
590 CFLAGS="-O $CFLAGS"
591 fi
592 fi
593 fi
594 fi
595 rm -f _testprog
596
597
598 # -fschedule-insns causes bugs on i386 with gcc,
599 # but works OK on my alpha with ccc (compaq's cc).
600 if [ z"$COMPAQCC" = zYES ]; then
601 printf "checking whether -fschedule-insns2 can be used... "
602 $CC $CFLAGS _testprog.c -o _testprog -fschedule-insns2 2> /dev/null
603 if [ -x _testprog ]; then
604 CFLAGS="-fschedule-insns2 $CFLAGS"
605 printf "yes\n"
606 else
607 printf "no\n"
608 fi
609 rm -f _testprog
610
611 printf "checking whether -fschedule-insns can be used... "
612 $CC $CFLAGS _testprog.c -o _testprog -fschedule-insns 2> /dev/null
613 if [ -x _testprog ]; then
614 CFLAGS="-fschedule-insns $CFLAGS"
615 printf "yes\n"
616 else
617 printf "no\n"
618 fi
619 rm -f _testprog
620
621 # # -intrinsics
622 # $CC $CFLAGS _testprog.c -o _testprog -intrinsics 2> /dev/null
623 # if [ -x _testprog ]; then
624 # CFLAGS="-intrinsics $CFLAGS"
625 # fi
626 # rm -f _testprog
627
628 # -fast
629 printf "checking whether -fast can be used... "
630 $CC $CFLAGS _testprog.c -o _testprog -fast 2> /dev/null
631 if [ -x _testprog ]; then
632 CFLAGS="-fast $CFLAGS"
633 printf "yes\n"
634 else
635 printf "no\n"
636 fi
637 rm -f _testprog
638 fi
639
640
641 # -fpeephole
642 printf "checking whether -fpeephole can be used... "
643 $CC $CFLAGS -fpeephole _testprog.c -o _testprog > _testprog.stdout 2>&1
644 cat _testprog.stdout >> _testprog.error
645 if grep peephole _testprog.error > /dev/null 2>&1; then
646 printf "no\n"
647 else
648 if [ -x _testprog ]; then
649 CFLAGS="-fpeephole $CFLAGS"
650 printf "yes\n"
651 else
652 printf "no\n"
653 fi
654 fi
655 rm -f _testprog _testprog.error _testprog.stdout
656
657
658 # -fomit-frame-pointer
659 printf "checking whether -fomit-frame-pointer can be used... "
660 $CC $CFLAGS -fomit-frame-pointer _testprog.c -o \
661 _testprog 1> _testprog.stdout 2>&1
662 cat _testprog.stdout >> _testprog.error
663 if grep frame _testprog.error > /dev/null 2>&1; then
664 printf "no\n"
665 else
666 if [ -x _testprog ]; then
667 CFLAGS="-fomit-frame-pointer $CFLAGS"
668 printf "yes\n"
669 else
670 printf "no\n"
671 fi
672 fi
673 rm -f _testprog _testprog.error _testprog.stdout
674
675
676 # -g, for development builds
677 if [ z"$UNSTABLE" = zYES ]; then
678 printf "checking whether -g can be used... "
679 if [ z"$COMPAQCC" = zYES ]; then
680 printf "skipping\n"
681 else
682 $CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1
683 cat _testprog.stdout >> _testprog.error
684 if [ -x _testprog ]; then
685 CFLAGS="-g $CFLAGS"
686 printf "yes\n"
687 else
688 printf "no\n"
689 fi
690 fi
691 rm -f _testprog _testprog.error _testprog.stdout
692 fi
693
694
695 # -lrt for nanosleep?
696 printf "checking whether -lrt is required for nanosleep... "
697 printf "#include <time.h>\n#include <stdio.h>
698 int main(int argc, char *argv[]){nanosleep(NULL,NULL);return 0;}\n" > _testns.c
699 $CC $CFLAGS _testns.c -o _testns 2> /dev/null
700 if [ ! -x _testns ]; then
701 $CC $CFLAGS -lrt _testns.c -o _testns 2> /dev/null
702 if [ ! -x _testns ]; then
703 printf "WARNING! COULD NOT COMPILE WITH nanosleep AT ALL!\n"
704 else
705 # -lrt for nanosleep
706 OTHERLIBS="-lrt $OTHERLIBS"
707 printf "yes\n"
708 fi
709 else
710 printf "no\n"
711 fi
712 rm -f _testns.c _testns
713
714
715 # -lresolv for inet_pton?
716 printf "checking whether -lresolv is required for inet_pton... "
717 printf "int inet_pton(void); int main(int argc, " > _testr.c
718 printf "char *argv[]) { return inet_pton(); }\n" >> _testr.c
719 $CC $CFLAGS _testr.c -o _testr 2> /dev/null
720 if [ ! -x _testr ]; then
721 $CC $CFLAGS _testr.c -lresolv -o _testr 2> /dev/null
722 if [ ! -x _testr ]; then
723 $CC $CFLAGS _testr.c -lresolv -lnsl -o _testr 2> /dev/null
724 if [ ! -x _testr ]; then
725 printf "no, using inet_aton\n"
726 else
727 # -lresolv -lnsl for inet_pton
728 OTHERLIBS="-lresolv -lnsl $OTHERLIBS"
729 printf "yes (and -lnsl)\n"
730 printf "#define HAVE_INET_PTON\n" >> config.h
731 fi
732 else
733 # -lresolv for inet_pton
734 OTHERLIBS="-lresolv $OTHERLIBS"
735 printf "yes\n"
736 printf "#define HAVE_INET_PTON\n" >> config.h
737 fi
738 else
739 printf "no\n"
740 printf "#define HAVE_INET_PTON\n" >> config.h
741 fi
742 rm -f _testr.[co] _testr
743
744
745 # -lm?
746 printf "checking for math libs..."
747 printf "#include <math.h>\nint main(int argc, char *argv[]) { " > _testr.c
748 printf "double x = sqrt((double)argc); return (int)x; }\n" >> _testr.c
749 $CC $CFLAGS _testr.c -o _testr 2> /dev/null
750 if [ ! -x _testr ]; then
751 $CC $CFLAGS _testr.c -lm -o _testr 2> /dev/null
752 if [ ! -x _testr ]; then
753 $CC $CFLAGS _testr.c -lm -lcpml -o _testr 2> /dev/null
754 if [ ! -x _testr ]; then
755 printf "\nWARNING! Could not compile math test "
756 printf "at all!\nContinuing anyway.\n\n"
757 else
758 # -lm AND -lcpml
759 OTHERLIBS="-lm -lcpml $OTHERLIBS"
760 printf " -lm -lcpml\n"
761 fi
762 else
763 # Normal -lm
764 OTHERLIBS="-lm $OTHERLIBS"
765 printf " -lm\n"
766 fi
767 else
768 printf " none needed\n"
769 fi
770 rm -f _testr.[co] _testr
771
772
773 # strlcpy missing?
774 printf "checking for strlcpy... "
775 printf "#include <string.h>
776 int main(int argc, char *argv[]) { char *p; char *q; size_t x;
777 x = strlcpy(p, q, 50); return 0;}\n" > _tests.c
778 $CC $CFLAGS _tests.c -o _tests 2> /dev/null
779 if [ ! -x _tests ]; then
780 printf "missing, using mystrlcpy\n"
781 printf "#define strlcpy mystrlcpy\n" >> config.h
782 printf "#define strlcat mystrlcat\n" >> config.h
783 printf "#define USE_STRLCPY_REPLACEMENTS\n" >> config.h
784 else
785 printf "found\n"
786 fi
787 rm -f _tests.[co] _tests
788
789
790 # strtoull missing?
791 printf "checking for strtoull... "
792 printf "#include <stdlib.h>
793 #include <limits.h>
794 #include <stdio.h>
795 int main(int argc, char *argv[]) {
796 long long x = strtoull(argv[1], NULL, 0); return 0;}\n" > _tests.c
797 $CC $CFLAGS _tests.c -o _tests 2> /dev/null
798 if [ ! -x _tests ]; then
799 printf "missing, using mystrtoull\n"
800 printf "#define strtoull mystrtoull\n" >> config.h
801 else
802 printf "found\n"
803 fi
804 rm -f _tests.[co] _tests
805
806
807 # mkstemp missing?
808 printf "checking for mkstemp... "
809 printf "#include <unistd.h>
810 int main(int argc, char *argv[]) { int x; char *y = \"abc\";
811 x = mkstemp(y); return 0;}\n" > _tests.c
812 $CC $CFLAGS _tests.c -o _tests 2> /dev/null
813 if [ ! -x _tests ]; then
814 printf "missing, using workaround\n"
815 printf "#define mkstemp mymkstemp\n" >> config.h
816 else
817 printf "found\n"
818 fi
819 rm -f _tests.[co] _tests
820
821
822 # fseeko missing?
823 printf "checking for fseeko... "
824 printf "#include <stdlib.h>
825 #include <limits.h>
826 #include <stdio.h>
827 #include <sys/types.h>
828 int main(int argc, char *argv[]) { fseeko(NULL, 0, 0); return 0;}\n" > _tests.c
829 $CC $CFLAGS $CWARNINGS _tests.c -o _tests 2> /dev/null
830 if [ ! -x _tests ]; then
831 # Try with _LARGEFILE_SOURCE (hack to make fseeko
832 # work on 64-bit Linux):
833 $CC $CFLAGS -D_LARGEFILE_SOURCE $CWARNINGS _tests.c -o _tests 2> /dev/null
834 if [ ! -x _tests ]; then
835 printf "missing\n"
836 printf "WARNING! fseeko missing from libc. Using a hack, "
837 printf "which probably doesn't work.\n"
838 printf "#define HACK_FSEEKO\n" >> config.h
839 else
840 printf "using -D_LARGEFILE_SOURCE hack\n"
841 CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE"
842 fi
843 else
844 printf "found\n"
845 fi
846 rm -f _tests.[co] _tests
847
848
849 # socklen_t missing?
850 # (for example really old OpenBSD/arc 2.3, inside the emulator)
851 printf "checking for socklen_t... "
852 printf "#include <stdlib.h>
853 #include <stdio.h>
854 #include <sys/types.h>
855 #include <sys/socket.h>
856 int main(int argc, char *argv[]) { socklen_t x; return 0;}\n" > _tests.c
857 $CC $CFLAGS _tests.c -o _tests 2> /dev/null
858 if [ ! -x _tests ]; then
859 printf "no, using int\n"
860 CFLAGS="$CFLAGS -Dsocklen_t=int"
861 else
862 printf "socklen_t\n"
863 fi
864 rm -f _tests.[co] _tests
865
866
867 # MAP_ANON missing? (On some HP-UX systems? Use MAP_ANONYMOUS instead.)
868 printf "checking for MAP_ANON... "
869 rm -f _tests
870 printf "#include <stdio.h>
871 #include <sys/types.h>
872 #include <sys/mman.h>
873 int main(int argc, char *argv[]) { int x = MAP_ANON; return 0;}\n" > _tests.c
874 $CC $CFLAGS _tests.c -o _tests 2> /dev/null
875 if [ ! -x _tests ]; then
876 printf "#include <stdio.h>
877 #include <sys/types.h>
878 #include <sys/mman.h>
879 int main(int argc, char *argv[])
880 { int x = MAP_ANONYMOUS; return 0;}\n" > _tests.c
881 $CC $CFLAGS _tests.c -o _tests 2> /dev/null
882 if [ ! -x _tests ]; then
883 printf "no\n\n"
884 printf "WARNING! Neither MAP_ANON nor MAP_ANONYMOUS work on "
885 printf "this system.\nPlease try to compile anyway, and report"
886 printf " to me whether it builds/runs or not.\n\n"
887 printf "#define MAP_ANON 0\n" >> config.h
888 printf "#define NO_MAP_ANON\n" >> config.h
889 else
890 printf "using MAP_ANONYMOUS\n"
891 printf "#define MAP_ANON MAP_ANONYMOUS\n" >> config.h
892 fi
893 else
894 printf "yes\n"
895 fi
896 rm -f _tests.[co] _tests
897
898
899 # Check for PRIx64 in inttypes.h:
900 printf "checking for PRIx64 in inttypes.h... "
901 printf "#include <inttypes.h>\nint main(int argc, char *argv[])\n
902 {\n#ifdef PRIx64\nreturn 0;\n#else\nreturn 1;\n#endif\n}\n" > _testpri.c
903 $CC $CFLAGS _testpri.c -o _testpri 2> /dev/null
904 if [ ! -x _testpri ]; then
905 printf "\nERROR! COULD NOT COMPILE PRIx64 TEST PROGRAM AT ALL!\n"
906 exit
907 else
908 if ./_testpri; then
909 printf "yes\n"
910 else
911 printf "no, using an ugly hack instead, "
912 printf "#define NO_C99_PRINTF_DEFINES\n" >> config.h
913
914 # Try llx first:
915 printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){
916 printf(\"%%llx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c
917 rm -f _testpri
918 $CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null
919 if [ z`./_testpri` = z80 ]; then
920 printf "PRIx64=llx\n"
921 printf "#define NO_C99_64BIT_LONGLONG\n" >> config.h
922 else
923 # Try lx too:
924 printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){
925 printf(\"%%lx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c
926 rm -f _testpri
927 $CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null
928 if [ z`./_testpri` = z80 ]; then
929 printf "PRIx64=lx\n"
930 else
931 printf "\nFailed, neither lx nor llx worked!\n"
932 exit
933 fi
934 fi
935 fi
936 fi
937 rm -f _testpri.c _testpri
938
939
940 # Check for 64-bit off_t:
941 printf "checking for 64-bit off_t... "
942 printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n
943 int main(int argc, char *argv[]){printf(\"%%i\\\n\",
944 (int)sizeof(off_t));return 0;}\n" > _testoff.c
945 $CC $CFLAGS _testoff.c -o _testoff 2> /dev/null
946 if [ ! -x _testoff ]; then
947 printf "\nWARNING! COULD NOT COMPILE off_t TEST PROGRAM AT ALL!\n"
948 else
949 if [ z`./_testoff` = z8 ]; then
950 printf "yes\n"
951 else
952 $CC $CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
953 _testoff.c -o _testoff 2> /dev/null
954 if [ ! -x _testoff ]; then
955 printf "\nWARNING! COULD NOT COMPILE off_t TEST "
956 printf "PROGRAM!\n"
957 else
958 if [ z`./_testoff` = z8 ]; then
959 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
960 CFLAGS="-D_LARGEFILE_SOURCE $CFLAGS"
961 printf "using -D_FILE_OFFSET_BITS=64"
962 printf " -D_LARGEFILE_SOURCE\n"
963 else
964 printf "NO\n"
965 printf "Warning! No 64-bit off_t. Continuing "
966 printf "anyway.\n"
967 fi
968 fi
969 fi
970 fi
971 rm -f _testoff.c _testoff
972
973
974 # Check for u_int8_t etc:
975 # These are needed because some header files in src/include/ use u_int*
976 # instead of uint*, and I don't have time to rewrite them all.
977 printf "checking for u_int8_t... "
978 printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n
979 int main(int argc, char *argv[]){printf(\"%%i\\\n\",
980 (int)sizeof(u_int8_t));return 0;}\n" > _testuint.c
981 $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
982 if [ ! -x _testuint ]; then
983 rm -f _testuint*
984 printf "#include <stdio.h>\n#include <inttypes.h>
985 \n#include <sys/types.h>\nint main(int argc, char *argv[])
986 {printf(\"%%i\\\n\", (int)sizeof(uint8_t));return 0;}\n" > _testuint.c
987 $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
988 if [ ! -x _testuint ]; then
989 printf "no\n\nERROR: No u_int8_t or uint8_t. Aborting\n"
990 # TODO: Automagically detect using various combinations
991 # of char, int, short, long etc.
992 exit
993 fi
994
995 printf "typedef uint8_t u_int8_t;\n" >> config.h
996 printf "typedef uint16_t u_int16_t;\n" >> config.h
997 printf "typedef uint32_t u_int32_t;\n" >> config.h
998 printf "uint8_t\n"
999 else
1000 printf "yes\n"
1001 fi
1002 rm -f _testuint.c _testuint
1003
1004 printf "checking for u_int64_t... "
1005 printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n
1006 int main(int argc, char *argv[]){printf(\"%%i\\\n\",
1007 (int)sizeof(u_int64_t));return 0;}\n" > _testuint.c
1008 $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
1009 if [ ! -x _testuint ]; then
1010 rm -f _testuint*
1011 printf "#include <stdio.h>\n#include <inttypes.h>
1012 \n#include <sys/types.h>\nint main(int argc, char *argv[])
1013 {printf(\"%%i\\\n\", (int)sizeof(uint64_t));return 0;}\n" > _testuint.c
1014 $CC $CFLAGS _testuint.c -o _testuint 2> /dev/null
1015 if [ ! -x _testuint ]; then
1016 printf "no\n\nERROR: No u_int64_t or uint64_t. Aborting\n"
1017 # TODO: Automagically detect using various combinations
1018 # of char, int, short, long etc.
1019 exit
1020 fi
1021
1022 printf "typedef uint64_t u_int64_t;\n" >> config.h
1023 printf "uint64_t\n"
1024 else
1025 printf "yes\n"
1026 fi
1027 rm -f _testuint.c _testuint
1028
1029
1030 ###############################################################################
1031
1032 # Host byte order?
1033 printf "checking host endianness... "
1034 rm -f _test_end*
1035 printf '#include <stdio.h>
1036 int main(int argc, char *argv[])
1037 { int x = 1; void *xp = (void *)&x; char *p = (char *)xp;
1038 if (*p) printf("little\\\n"); else printf("big\\\n"); }
1039 ' > _test_end.c
1040 $CC $CFLAGS _test_end.c -o _test_end 2> /dev/null
1041 X=`./_test_end`
1042 echo $X
1043 if [ z$X = zlittle ]; then
1044 printf "#define HOST_LITTLE_ENDIAN\n" >> config.h
1045 else
1046 if [ z$X = zbig ]; then
1047 printf "#define HOST_BIG_ENDIAN\n" >> config.h
1048 else
1049 echo "Error! Could not determine host's endianness."
1050 exit
1051 fi
1052 fi
1053 rm -f _test_end*
1054
1055
1056 ###############################################################################
1057 #
1058 # Native code generation backend: (Detect host architecture.)
1059 #
1060 ###############################################################################
1061
1062 if [ z$UNSTABLE = zYES ]; then
1063 printf "native code generation backend... "
1064
1065 if [ z"`uname -m`" = zamd64 ]; then
1066 NATIVE_CODE_GENERATION=YES
1067 printf "amd64\n"
1068 printf "#define NATIVE_CODE_GENERATION\n" >> config.h
1069 printf "#define HOST_ARCH_AMD64\n" >> config.h
1070 fi
1071
1072 if [ z"`uname -m`" = zx86_64 ]; then
1073 NATIVE_CODE_GENERATION=YES
1074 printf "amd64\n"
1075 printf "#define NATIVE_CODE_GENERATION\n" >> config.h
1076 printf "#define HOST_ARCH_AMD64\n" >> config.h
1077 fi
1078
1079 if [ z$NATIVE_CODE_GENERATION = z ]; then
1080 printf "not yet for this host platform\n"
1081 fi
1082 fi
1083
1084
1085 ###############################################################################
1086
1087 INCLUDE=-Iinclude/
1088 DINCLUDE=-I../include/
1089
1090 rm -f _testprog.c
1091
1092 echo C compiler flags: $CFLAGS $CWARNINGS
1093 echo Linker flags: $OTHERLIBS
1094 echo "CWARNINGS=$CWARNINGS" >> _Makefile.header
1095 echo "COPTIM=$CFLAGS" >> _Makefile.header
1096 echo "INCLUDE=$INCLUDE" >> _Makefile.header
1097 echo "DINCLUDE=$DINCLUDE" >> _Makefile.header
1098 echo "CC=$CC" >> _Makefile.header
1099 echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header
1100 echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header
1101 echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header
1102 echo "" >> _Makefile.header
1103
1104
1105 # Create the Makefiles:
1106 D=". src src/include src/cpus src/debugger src/devices src/devices/fonts"
1107 D="$D src/machines src/native src/net src/promemul"
1108 for a in $D; do
1109 echo "creating $a/Makefile"
1110 touch $a/Makefile
1111 cat _Makefile.header > $a/Makefile
1112 cat $a/Makefile.skel >> $a/Makefile
1113 done
1114
1115 # Tail of config.h:
1116 printf "\n#endif /* CONFIG_H */\n" >> config.h
1117
1118 # Remove temporary Makefile header:
1119 rm -f _Makefile.header
1120
1121 echo Configured. You may now run make to build gxemul.

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26