/[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 12 - (show annotations)
Mon Oct 8 16:18:38 2007 UTC (16 years, 6 months ago) by dpavlin
File size: 31930 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.905 2005/08/16 09:16:24 debug Exp $
20050628	Continuing the work on the ARM translation engine. end_of_page
		works. Experimenting with load/store translation caches
		(virtual -> physical -> host).
20050629	More ARM stuff (memory access translation cache, mostly). This
		might break a lot of stuff elsewhere, probably some MIPS-
		related translation things.
20050630	Many load/stores are now automatically generated and included
		into cpu_arm_instr.c; 1024 functions in total (!).
		Fixes based on feedback from Alec Voropay: only print 8 hex
		digits instead of 16 in some cases when emulating 32-bit
		machines; similar 8 vs 16 digit fix for breakpoint addresses;
		4Kc has 16 TLB entries, not 48; the MIPS config select1
		register is now printed with "reg ,0".
		Also changing many other occurances of 16 vs 8 digit output.
		Adding cache associativity fields to mips_cpu_types.h; updating
		some other cache fields; making the output of
		mips_cpu_dumpinfo() look nicer.
		Generalizing the bintrans stuff for device accesses to also
		work with the new translation system. (This might also break
		some MIPS things.)
		Adding multi-load/store instructions to the ARM disassembler
		and the translator, and some optimizations of various kinds.
20050701	Adding a simple dev_disk (it can read/write sectors from
		disk images).
20050712	Adding dev_ether (a simple ethernet send/receive device).
		Debugger command "ninstrs" for toggling show_nr_of_instructions
		during runtime.
		Removing the framebuffer logo.
20050713	Continuing on dev_ether.
		Adding a dummy cpu_alpha (again).
20050714	More work on cpu_alpha.
20050715	More work on cpu_alpha. Many instructions work, enough to run
		a simple framebuffer fill test (similar to the ARM test).
20050716	More Alpha stuff.
20050717	Minor updates (Alpha stuff).
20050718	Minor updates (Alpha stuff).
20050719	Generalizing some Alpha instructions.
20050720	More Alpha-related updates.
20050721	Continuing on cpu_alpha. Importing rpb.h from NetBSD/alpha.
20050722	Alpha-related updates: userland stuff (Hello World using
		write() compiled statically for FreeBSD/Alpha runs fine), and
		more instructions are now implemented.
20050723	Fixing ldq_u and stq_u.
		Adding more instructions (conditional moves, masks, extracts,
		shifts).
20050724	More FreeBSD/Alpha userland stuff, and adding some more
		instructions (inserts).
20050725	Continuing on the Alpha stuff. (Adding dummy ldt/stt.)
		Adding a -A command line option to turn off alignment checks
		in some cases (for translated code).
		Trying to remove the old bintrans code which updated the pc
		and nr_of_executed_instructions for every instruction.
20050726	Making another attempt att removing the pc/nr of instructions
		code. This time it worked, huge performance increase for
		artificial test code, but performance loss for real-world
		code :-( so I'm scrapping that code for now.
		Tiny performance increase on Alpha (by using ret instead of
		jmp, to play nice with the Alpha's branch prediction) for the
		old MIPS bintrans backend.
20050727	Various minor fixes and cleanups.
20050728	Switching from a 2-level virtual to host/physical translation
		system for ARM emulation, to a 1-level translation.
		Trying to switch from 2-level to 1-level for the MIPS bintrans
		system as well (Alpha only, so far), but there is at least one
		problem: caches and/or how they work with device mappings.
20050730	Doing the 2-level to 1-level conversion for the i386 backend.
		The cache/device bug is still there for R2K/3K :(
		Various other minor updates (Malta etc).
		The mc146818 clock now updates the UIP bit in a way which works
		better with Linux for at least sgimips and Malta emulation.
		Beginning the work on refactoring the dyntrans system.
20050731	Continuing the dyntrans refactoring.
		Fixing a small but serious host alignment bug in memory_rw.
		Adding support for big-endian load/stores to the i386 bintrans
		backend.
		Another minor i386 bintrans backend update: stores from the
		zero register are now one (or two) loads shorter.
		The slt and sltu instructions were incorrectly implemented for
		the i386 backend; only using them for 32-bit mode for now.
20050801	Continuing the dyntrans refactoring.
		Cleanup of the ns16550 serial controller (removing unnecessary
		code).
		Bugfix (memory corruption bug) in dev_gt, and a patch/hack from
		Alec Voropay for Linux/Malta.
20050802	More cleanup/refactoring of the dyntrans subsystem: adding
		phys_page pointers to the lookup tables, for quick jumps
		between translated pages.
		Better fix for the ns16550 device (but still no real FIFO
		functionality).
		Converting cpu_ppc to the new dyntrans system. This means that
		I will have to start from scratch with implementing each
		instruction, and figure out how to implement dual 64/32-bit
		modes etc.
		Removing the URISC CPU family, because it was useless.
20050803	When selecting a machine type, the main type can now be omitted
		if the subtype name is unique. (I.e. -E can be omitted.)
		Fixing a dyntrans/device update bug. (Writes to offset 0 of
		a device could sometimes go unnoticed.)
		Adding an experimental "instruction combination" hack for
		ARM for memset-like byte fill loops.
20050804	Minor progress on cpu_alpha and related things.
		Finally fixing the MIPS dmult/dmultu bugs.
		Fixing some minor TODOs.
20050805	Generalizing the 8259 PIC. It now also works with Cobalt
		and evbmips emulation, in addition to the x86 hack.
		Finally converting the ns16550 device to use devinit.
		Continuing the work on the dyntrans system. Thinking about
		how to add breakpoints.
20050806	More dyntrans updates. Breakpoints seem to work now.
20050807	Minor updates: cpu_alpha and related things; removing
		dev_malta (as it isn't used any more).
		Dyntrans: working on general "show trace tree" support.
		The trace tree stuff now works with both the old MIPS code and
		with newer dyntrans modes. :)
		Continuing on Alpha-related stuff (trying to get *BSD to boot
		a bit further, adding more instructions, etc).
20050808	Adding a dummy IA64 cpu family, and continuing the refactoring
		of the dyntrans system.
		Removing the regression test stuff, because it was more or
		less useless.
		Adding loadlinked/storeconditional type instructions to the
		Alpha emulation. (Needed for Linux/alpha. Not very well tested
		yet.)
20050809	The function call trace tree now prints a per-function nr of
		arguments. (Semi-meaningless, since that data isn't read yet
		from the ELFs; some hardcoded symbols such as memcpy() and
		strlen() work fine, though.)
		More dyntrans refactoring; taking out more of the things that
		are common to all cpu families.
20050810	Working on adding support for "dual mode" for PPC dyntrans
		(i.e. both 64-bit and 32-bit modes).
		(Re)adding some simple PPC instructions.
20050811	Adding a dummy M68K cpu family. The dyntrans system isn't ready
		for variable-length ISAs yet, so it's completely bogus so far.
		Re-adding more PPC instructions.
		Adding a hack to src/file.c which allows OpenBSD/mac68k a.out
		kernels to be loaded.
		Beginning to add PPC loads/stores. So far they only work in
		32-bit mode.
20050812	The configure file option "add_remote" now accepts symbolic
		host names, in addition to numeric IPv4 addresses.
		Re-adding more PPC instructions.
20050814	Continuing to port back more PPC instructions.
		Found and fixed the cache/device write-update bug for 32-bit
		MIPS bintrans. :-)
		Triggered a really weird and annoying bug in Compaq's C
		compiler; ccc sometimes outputs code which loads from an
		address _before_ checking whether the pointer was NULL or not.
		(I'm not sure how to handle this problem.)
20050815	Removing all of the old x86 instruction execution code; adding
		a new (dummy) dyntrans module for x86.
		Taking the first steps to extend the dyntrans system to support
		variable-length instructions.
		Slowly preparing for the next release.
20050816	Adding a dummy SPARC cpu module.
		Minor updates (documentation etc) for the release.

==============  RELEASE 0.3.5  ==============


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26