/[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 32 - (hide annotations)
Mon Oct 8 16:20:58 2007 UTC (16 years, 6 months ago) by dpavlin
File size: 30010 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1421 2006/11/06 05:32:37 debug Exp $
20060816	Adding a framework for emulated/virtual timers (src/timer.c),
		using only setitimer().
		Rewriting the mc146818 to use the new timer framework.
20060817	Adding a call to gettimeofday() every now and then (once every
		second, at the moment) to resynch the timer if it drifts.
		Beginning to convert the ISA timer interrupt mechanism (8253
		and 8259) to use the new timer framework.
		Removing the -I command line option.
20060819	Adding the -I command line option again, with new semantics.
		Working on Footbridge timer interrupts; NetBSD/NetWinder and
		NetBSD/CATS now run at correct speed, but unfortunately with
		HUGE delays during bootup.
20060821	Some minor m68k updates. Adding the first instruction: nop. :)
		Minor Alpha emulation updates.
20060822	Adding a FreeBSD development specific YAMON environment
		variable ("khz") (as suggested by Bruce M. Simpson).
		Moving YAMON environment variable initialization from
		machine_evbmips.c into promemul/yamon.c, and adding some more
		variables.
		Continuing on the LCA PCI bus controller (for Alpha machines).
20060823	Continuing on the timer stuff: experimenting with MIPS count/
		compare interrupts connected to the timer framework.
20060825	Adding bogus SCSI commands 0x51 (SCSICDROM_READ_DISCINFO) and
		0x52 (SCSICDROM_READ_TRACKINFO) to the SCSI emulation layer,
		to allow NetBSD/pmax 4.0_BETA to be installed from CDROM.
		Minor updates to the LCA PCI controller.
20060827	Implementing a CHIP8 cpu mode, and a corresponding CHIP8
		machine, for fun. Disassembly support for all instructions,
		and most of the common instructions have been implemented: mvi,
		mov_imm, add_imm, jmp, rand, cls, sprite, skeq_imm, jsr,
		skne_imm, bcd, rts, ldr, str, mov, or, and, xor, add, sub,
		font, ssound, sdelay, gdelay, bogus skup/skpr, skeq, skne.
20060828	Beginning to convert the CHIP8 cpu in the CHIP8 machine to a
		(more correct) RCA 180x cpu. (Disassembly for all 1802
		instructions has been implemented, but no execution yet, and
		no 1805 extended instructions.)
20060829	Minor Alpha emulation updates.
20060830	Beginning to experiment a little with PCI IDE for SGI O2.
		Fixing the cursor key mappings for MobilePro 770 emulation.
		Fixing the LK201 warning caused by recent NetBSD/pmax.
		The MIPS R41xx standby, suspend, and hibernate instructions now
		behave like the RM52xx/MIPS32/MIPS64 wait instruction.
		Fixing dev_wdc so it calculates correct (64-bit) offsets before
		giving them to diskimage_access().
20060831	Continuing on Alpha emulation (OSF1 PALcode).
20060901	Minor Alpha updates; beginning on virtual memory pagetables.
		Removed the limit for max nr of devices (in preparation for
		allowing devices' base addresses to be changed during runtime).
		Adding a hack for MIPS [d]mfc0 select 0 (except the count
		register), so that the coproc register is simply copied.
		The MIPS suspend instruction now exits the emulator, instead
		of being treated as a wait instruction (this causes NetBSD/
		hpcmips to get correct 'halt' behavior).
		The VR41xx RTC now returns correct time.
		Connecting the VR41xx timer to the timer framework (fixed at
		128 Hz, for now).
		Continuing on SPARC emulation, adding more instructions:
		restore, ba_xcc, ble. The rectangle drawing demo works :)
		Removing the last traces of the old ENABLE_CACHE_EMULATION
		MIPS stuff (not usable with dyntrans anyway).
20060902	Splitting up src/net.c into several smaller files in its own
		subdirectory (src/net/).
20060903	Cleanup of the files in src/net/, to make them less ugly.
20060904	Continuing on the 'settings' subsystem.
		Minor progress on the SPARC emulation mode.
20060905	Cleanup of various things, and connecting the settings
		infrastructure to various subsystems (emul, machine, cpu, etc).
		Changing the lk201 mouse update routine to not rely on any
		emulated hardware framebuffer cursor coordinates, but instead
		always do (semi-usable) relative movements.
20060906	Continuing on the lk201 mouse stuff. Mouse behaviour with
		multiple framebuffers (which was working in Ultrix) is now
		semi-broken (but it still works, in a way).
		Moving the documentation about networking into its own file
		(networking.html), and refreshing it a bit. Adding an example
		of how to use ethernet frame direct-access (udp_snoop).
20060907	Continuing on the settings infrastructure.
20060908	Minor updates to SH emulation: for 32-bit emulation: delay
		slots and the 'jsr @Rn' instruction. I'm putting 64-bit SH5 on
		ice, for now.
20060909-10	Implementing some more 32-bit SH instructions. Removing the
		64-bit mode completely. Enough has now been implemented to run
		the rectangle drawing demo. :-)
20060912	Adding more SH instructions.
20060916	Continuing on SH emulation (some more instructions: div0u,
		div1, rotcl/rotcr, more mov instructions, dt, braf, sets, sett,
		tst_imm, dmuls.l, subc, ldc_rm_vbr, movt, clrt, clrs, clrmac).
		Continuing on the settings subsystem (beginning on reading/
		writing settings, removing bugs, and connecting more cpus to
		the framework).
20060919	More work on SH emulation; adding an ldc banked instruction,
		and attaching a 640x480 framebuffer to the Dreamcast machine
		mode (NetBSD/dreamcast prints the NetBSD copyright banner :-),
		and then panics).
20060920	Continuing on the settings subsystem.
20060921	Fixing the Footbridge timer stuff so that NetBSD/cats and
		NetBSD/netwinder boot up without the delays.
20060922	Temporarily hardcoding MIPS timer interrupt to 100 Hz. With
		'wait' support disabled, NetBSD/malta and Linux/malta run at
		correct speed.
20060923	Connecting dev_gt to the timer framework, so that NetBSD/cobalt
		runs at correct speed.
		Moving SH4-specific memory mapped registers into its own
		device (dev_sh4.c).
		Running with -N now prints "idling" instead of bogus nr of
		instrs/second (which isn't valid anyway) while idling.
20060924	Algor emulation should now run at correct speed.
		Adding disassembly support for some MIPS64 revision 2
		instructions: ext, dext, dextm, dextu.
20060926	The timer framework now works also when the MIPS wait
		instruction is used.
20060928	Re-implementing checks for coprocessor availability for MIPS
		cop0 instructions. (Thanks to Carl van Schaik for noticing the
		lack of cop0 availability checks.)
20060929	Implementing an instruction combination hack which treats
		NetBSD/pmax' idle loop as a wait-like instruction.
20060930	The ENTRYHI_R_MASK was missing in (at least) memory_mips_v2p.c,
		causing TLB lookups to sometimes succeed when they should have
		failed. (A big thank you to Juli Mallett for noticing the
		problem.)
		Adding disassembly support for more MIPS64 revision 2 opcodes
		(seb, seh, wsbh, jalr.hb, jr.hb, synci, ins, dins, dinsu,
		dinsm, dsbh, dshd, ror, dror, rorv, drorv, dror32). Also
		implementing seb, seh, dsbh, dshd, and wsbh.
		Implementing an instruction combination hack for Linux/pmax'
		idle loop, similar to the NetBSD/pmax case.
20061001	Changing the NetBSD/sgimips install instructions to extract
		files from an iso image, instead of downloading them via ftp.
20061002	More-than-31-bit userland addresses in memory_mips_v2p.c were
		not actually working; applying a fix from Carl van Schaik to
		enable them to work + making some other updates (adding kuseg
		support).
		Fixing hpcmips (vr41xx) timer initialization.
		Experimenting with O(n)->O(1) reduction in the MIPS TLB lookup
		loop. Seems to work both for R3000 and non-R3000.
20061003	Continuing a little on SH emulation (adding more control
		registers; mini-cleanup of memory_sh.c).
20061004	Beginning on a dev_rtc, a clock/timer device for the test
		machines; also adding a demo, and some documentation.
		Fixing a bug in SH "mov.w @(disp,pc),Rn" (the result wasn't
		sign-extended), and adding the addc and ldtlb instructions.
20061005	Contining on SH emulation: virtual to physical address
		translation, and a skeleton exception mechanism.
20061006	Adding more SH instructions (various loads and stores, rte,
		negc, muls.w, various privileged register-move instructions).
20061007	More SH instructions: various move instructions, trapa, div0s,
		float, fdiv, ftrc.
		Continuing on dev_rtc; removing the rtc demo.
20061008	Adding a dummy Dreamcast PROM module. (Homebrew Dreamcast
		programs using KOS libs need this.)
		Adding more SH instructions: "stc vbr,rn", rotl, rotr, fsca,
		fmul, fadd, various floating-point moves, etc. A 256-byte
		demo for Dreamcast runs :-)
20061012	Adding the SH "lds Rm,pr" and bsr instructions.
20061013	More SH instructions: "sts fpscr,rn", tas.b, and some more
		floating point instructions, cmp/str, and more moves.
		Adding a dummy dev_pvr (Dreamcast graphics controller).
20061014	Generalizing the expression evaluator (used in the built-in
		debugger) to support parentheses and +-*/%^&|.
20061015	Removing the experimental tlb index hint code in
		mips_memory_v2p.c, since it didn't really have any effect.
20061017	Minor SH updates; adding the "sts pr,Rn", fcmp/gt, fneg,
		frchg, and some other instructions. Fixing missing sign-
		extension in an 8-bit load instruction.
20061019	Adding a simple dev_dreamcast_rtc.
		Implementing memory-mapped access to the SH ITLB/UTLB arrays.
20061021	Continuing on various SH and Dreamcast things: sh4 timers,
		debug messages for dev_pvr, fixing some virtual address
		translation bugs, adding the bsrf instruction.
		The NetBSD/dreamcast GENERIC_MD kernel now reaches userland :)
		Adding a dummy dev_dreamcast_asic.c (not really useful yet).
		Implementing simple support for Store Queues.
		Beginning on the PVR Tile Accelerator.
20061022	Generalizing the PVR framebuffer to support off-screen drawing,
		multiple bit-depths, etc. (A small speed penalty, but most
		likely worth it.)
		Adding more SH instructions (mulu.w, fcmp/eq, fsub, fmac,
		fschg, and some more); correcting bugs in "fsca" and "float".
20061024	Adding the SH ftrv (matrix * vector) instruction. Marcus
		Comstedt's "tatest" example runs :) (wireframe only).
		Correcting disassembly for SH floating point instructions that
		use the xd* registers.
		Adding the SH fsts instruction.
		In memory_device_dyntrans_access(), only the currently used
		range is now invalidated, and not the entire device range.
20061025	Adding a dummy AVR32 cpu mode skeleton.
20061026	Various Dreamcast updates; beginning on a Maple bus controller.
20061027	Continuing on the Maple bus. A bogus Controller, Keyboard, and
		Mouse can now be detected by NetBSD and KOS homebrew programs.
		Cleaning up the SH4 Timer Management Unit, and beginning on
		SH4 interrupts.
		Implementing the Dreamcast SYSASIC.
20061028	Continuing on the SYSASIC.
		Adding the SH fsqrt instruction.
		memory_sh.c now actually scans the ITLB.
		Fixing a bug in dev_sh4.c, related to associative writes into
		the memory-mapped UTLB array. NetBSD/dreamcast now reaches
		userland stably, and prints the "Terminal type?" message :-]
		Implementing enough of the Dreamcast keyboard to make NetBSD
		accept it for input.
		Enabling SuperH for stable (non-development) builds.
		Adding NetBSD/dreamcast to the documentation, although it
		doesn't support root-on-nfs yet.
20061029	Changing usleep(1) calls in the debugger to to usleep(10000)
		(according to Brian Foley, this makes GXemul run better on
		MacOS X).
		Making the Maple "Controller" do something (enough to barely
		interact with dcircus.elf).
20061030-31	Some progress on the PVR. More test programs start running (but
		with strange output).
		Various other SH4-related updates.
20061102	Various Dreamcast and SH4 updates; more KOS demos run now.
20061104	Adding a skeleton dev_mb8696x.c (the Dreamcast's LAN adapter).
20061105	Continuing on the MB8696x; NetBSD/dreamcast detects it as mbe0.
		Testing for the release.

==============  RELEASE 0.4.3  ==============


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26