1 |
#!/bin/sh |
#!/bin/sh |
2 |
############################################################################### |
############################################################################### |
3 |
# |
# |
4 |
# Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
# Copyright (C) 2003-2007 Anders Gavare. All rights reserved. |
5 |
# |
# |
6 |
# Redistribution and use in source and binary forms, with or without |
# Redistribution and use in source and binary forms, with or without |
7 |
# modification, are permitted provided that the following conditions are met: |
# modification, are permitted provided that the following conditions are met: |
27 |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
28 |
# |
# |
29 |
# |
# |
30 |
# $Id: configure,v 1.132 2005/06/04 12:05:50 debug Exp $ |
# $Id: configure,v 1.243 2007/02/10 14:29:54 debug Exp $ |
31 |
# |
# |
32 |
# This is a minimal configure script, hardcoded for GXemul. This script |
# This is a minimal configure script, hardcoded for GXemul. This script |
33 |
# figures out which compiler flags will work, and creates Makefiles in |
# figures out which compiler flags will work, and creates Makefiles in |
47 |
# o) special hacks for some OSes |
# o) special hacks for some OSes |
48 |
# o) which compiler to use (overridden by setting CC) |
# o) which compiler to use (overridden by setting CC) |
49 |
# o) which compiler flags to use (overridden by setting CFLAGS) |
# o) which compiler flags to use (overridden by setting CFLAGS) |
50 |
# o) X11 flags and libraries (TODO: should be possible to override) |
# o) X11 flags and libraries (TODO: should be possible to override |
51 |
# o) binary translation (on supported platforms) |
# via command line options?) |
52 |
# o) prefetch capability (TODO: this is assumed on Alpha, but not all |
# o) native code generation backend (i.e. detect host architecture) |
53 |
# Alphas have it...) |
# |
54 |
|
# |
55 |
|
# The general philosophy regarding command line switches is that anything |
56 |
|
# which can be incorporated into the program as a runtime command line option |
57 |
|
# should be, instead of requiring a recompile. |
58 |
# |
# |
59 |
############################################################################### |
############################################################################### |
60 |
|
|
61 |
ENABLEALPHA=NO |
# Figure out if this is a stable version (0.x.x). |
62 |
ENABLEARM=NO |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
63 |
ENABLEHPPA=NO |
if [ z"$X" = z0. ]; then |
64 |
ENABLEMIPS=YES |
# Stable: |
65 |
ENABLEPPC=YES |
ENABLEALPHA=YES |
66 |
ENABLESPARC=NO |
ENABLEARM=YES |
67 |
ENABLEURISC=YES |
ENABLEMIPS=YES |
68 |
ENABLEX86=NO |
ENABLEPPC=YES |
69 |
STABLE=YES |
ENABLESH=YES |
70 |
|
else |
71 |
|
# Development: |
72 |
|
UNSTABLE=YES |
73 |
|
ENABLEALPHA=YES |
74 |
|
ENABLEARM=YES |
75 |
|
ENABLEAVR=YES |
76 |
|
ENABLEM68K=YES |
77 |
|
ENABLEMIPS=YES |
78 |
|
ENABLEPPC=YES |
79 |
|
ENABLERCA180X=YES |
80 |
|
ENABLESH=YES |
81 |
|
ENABLESPARC=YES |
82 |
|
ENABLETRANSPUTER=YES |
83 |
|
fi |
84 |
|
|
85 |
|
if [ z"$UNSTABLE" = zYES ]; then |
86 |
|
printf "###\n### DEVELOPMENT (UNSTABLE)\n###\n\n" |
87 |
|
fi |
88 |
|
|
89 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
90 |
# Parse command line options: |
# Parse command line options: |
91 |
for a in $*; do |
for a in $*; do |
92 |
if [ z$a = z--disable-x ]; then |
if [ z$a = z--disable-x ]; then |
93 |
NOX11=YES |
NOX11=YES |
|
else if [ z$a = z--always32 ]; then |
|
|
ALWAYS32=YES |
|
|
else if [ z$a = z--disable-bintrans ]; then |
|
|
NOBINTRANS=YES |
|
|
else if [ z$a = z--enable-bintrans ]; then |
|
|
NOBINTRANS=NO |
|
|
else if [ z$a = z--disable-mips16 ]; then |
|
|
MIPS16=NO |
|
|
else if [ z$a = z--enable-mips16 ]; then |
|
|
MIPS16=YES |
|
|
else if [ z$a = z--disable-alpha ]; then |
|
|
ENABLEALPHA=NO |
|
|
else if [ z$a = z--enable-alpha ]; then |
|
|
ENABLEALPHA=YES |
|
|
else if [ z$a = z--disable-arm ]; then |
|
|
ENABLEARM=NO |
|
|
else if [ z$a = z--enable-arm ]; then |
|
|
ENABLEARM=YES |
|
|
else if [ z$a = z--disable-hppa ]; then |
|
|
ENABLEHPPA=NO |
|
|
else if [ z$a = z--enable-hppa ]; then |
|
|
ENABLEHPPA=YES |
|
|
else if [ z$a = z--disable-mips ]; then |
|
|
ENABLEMIPS=NO |
|
|
else if [ z$a = z--enable-mips ]; then |
|
|
ENABLEMIPS=YES |
|
|
else if [ z$a = z--disable-ppc ]; then |
|
|
ENABLEPPC=NO |
|
|
else if [ z$a = z--enable-ppc ]; then |
|
|
ENABLEPPC=YES |
|
|
else if [ z$a = z--disable-sparc ]; then |
|
|
ENABLESPARC=NO |
|
|
else if [ z$a = z--enable-sparc ]; then |
|
|
ENABLESPARC=YES |
|
|
else if [ z$a = z--disable-urisc ]; then |
|
|
ENABLEURISC=NO |
|
|
else if [ z$a = z--enable-urisc ]; then |
|
|
ENABLEURISC=YES |
|
|
else if [ z$a = z--disable-x86 ]; then |
|
|
ENABLEX86=NO |
|
|
else if [ z$a = z--enable-x86 ]; then |
|
|
ENABLEX86=YES |
|
|
else if [ z$a = z--disable-delays ]; then |
|
|
DELAYS=NO |
|
|
else if [ z$a = z--enable-delays ]; then |
|
|
DELAYS=YES |
|
|
else if [ z$a = z--disable-caches ]; then |
|
|
CACHES=NO |
|
|
else if [ z$a = z--enable-caches ]; then |
|
|
CACHES=YES |
|
94 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
95 |
echo "usage: $0 [options]" |
printf "usage: $0 [options]\n\n" |
96 |
printf "\nDevelopment (debug) options:\n" |
echo " --disable-x don't include X11 support,"\ |
97 |
echo " --always32 enable" \ |
"even if the host supports it" |
98 |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
echo |
|
echo " 32/64-bit bugs)" |
|
|
printf "\nGeneral options:\n" |
|
|
echo " --disable-bintrans configure without" \ |
|
|
"bintrans, even if the host supports it" |
|
|
printf " --enable-caches enable cache emulation" |
|
|
printf " (BUGGY)\n" |
|
|
echo " --enable-delays enable instruction" \ |
|
|
"latency/delay emulation" |
|
|
echo " --disable-x don't include X11 support" |
|
|
printf "\nCPU selection options:\n" |
|
|
if [ z$STABLE = zNO ]; then |
|
|
printf " --enable-alpha " |
|
|
printf "enable Alpha CPU emulation" |
|
|
printf " (NOT YET)\n" |
|
|
printf " --enable-arm " |
|
|
printf "enable ARM CPU emulation" |
|
|
printf " (NOT YET)\n" |
|
|
printf " --enable-hppa " |
|
|
printf "enable HPPA CPU emulation" |
|
|
printf " (NOT YET)\n" |
|
|
fi |
|
|
echo " --disable-mips disable MIPS CPU emulation" |
|
|
echo " --disable-ppc disable PPC CPU emulation" |
|
|
if [ z$STABLE = zNO ]; then |
|
|
printf " --enable-sparc " |
|
|
printf "enable SPARC CPU emulation" |
|
|
printf " (NOT YET)\n" |
|
|
fi |
|
|
echo " --disable-urisc disable URISC CPU emulation" |
|
|
if [ z$STABLE = zNO ]; then |
|
|
printf " --enable-x86 " |
|
|
printf "enable x86 CPU emulation" |
|
|
printf " (NOT YET)\n" |
|
|
fi |
|
|
printf "\nMIPS-specific options:\n" |
|
|
printf " --enable-mips16 enable MIPS16 instruction" |
|
|
printf " support (NOT YET)\n\n" |
|
99 |
exit |
exit |
100 |
else |
else |
101 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
102 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
103 |
"available options." |
"available options." |
104 |
exit |
exit |
105 |
fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi |
fi; fi |
|
fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi |
|
106 |
done |
done |
107 |
fi |
fi |
108 |
|
|
126 |
# Figure out if VERSION should be defined. |
# Figure out if VERSION should be defined. |
127 |
X=`basename \`pwd\`|cut -d \- -f 2-` |
X=`basename \`pwd\`|cut -d \- -f 2-` |
128 |
if [ z"$X" = zgxemul ]; then |
if [ z"$X" = zgxemul ]; then |
129 |
echo '# No VERSION defined.' >> _Makefile.header |
echo '/* No VERSION defined. */' >> config.h |
130 |
else |
else |
131 |
printf "#define VERSION \"$X\"\n" >> config.h |
printf "#define VERSION \"$X\"\n" >> config.h |
132 |
fi |
fi |
133 |
|
|
134 |
|
|
135 |
|
if [ z"$UNSTABLE" = zYES ]; then |
136 |
|
printf "#define UNSTABLE_DEVEL\n" >> config.h |
137 |
|
fi |
138 |
|
|
139 |
|
|
140 |
ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\`` |
ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\`` |
141 |
printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h |
printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
# Support for various CPU types: |
# Support for various CPU types: |
|
if [ z$MIPS16 = zYES ]; then |
|
|
printf 'Enabling MIPS16 support. ' |
|
|
printf 'NOTE: MIPS16 support is not really working yet.\n' |
|
|
printf "#define ENABLE_MIPS16\n" >> config.h |
|
|
fi |
|
146 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
147 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ALPHA\n" >> config.h |
148 |
if [ z$STABLE = zNO ]; then |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o memory_alpha.o" |
149 |
printf "\nWARNING: Alpha emulation enabled, but it isn't really" |
CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" |
|
printf " implemented yet.\n\n" |
|
|
else |
|
|
printf "Not in the stable release.\n" |
|
|
exit |
|
|
fi |
|
150 |
fi |
fi |
151 |
if [ z$ENABLEARM = zYES ]; then |
if [ z$ENABLEARM = zYES ]; then |
152 |
printf "#define ENABLE_ARM\n" >> config.h |
printf "#define ENABLE_ARM\n" >> config.h |
153 |
if [ z$STABLE = zNO ]; then |
CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o " |
154 |
printf "\nWARNING: ARM emulation enabled, but it isn't really" |
CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o tmp_arm_r.o" |
155 |
printf " implemented yet.\n\n" |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o" |
156 |
else |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o" |
157 |
printf "Not in the stable release.\n" |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o" |
158 |
exit |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o" |
159 |
fi |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o" |
160 |
fi |
CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o" |
161 |
if [ z$ENABLEHPPA = zYES ]; then |
CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o" |
162 |
printf "#define ENABLE_HPPA\n" >> config.h |
CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o tmp_arm_multi.o" |
163 |
if [ z$STABLE = zNO ]; then |
CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r" |
164 |
printf "\nWARNING: HPPA emulation enabled, but it isn't really" |
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi" |
165 |
printf " implemented yet.\n\n" |
fi |
166 |
else |
if [ z$ENABLEAVR = zYES ]; then |
167 |
printf "Not in the stable release.\n" |
printf "#define ENABLE_AVR\n" >> config.h |
168 |
exit |
CPU_ARCHS="$CPU_ARCHS cpu_avr.o" |
169 |
fi |
fi |
170 |
|
if [ z$ENABLEM68K = zYES ]; then |
171 |
|
printf "#define ENABLE_M68K\n" >> config.h |
172 |
|
CPU_ARCHS="$CPU_ARCHS cpu_m68k.o" |
173 |
fi |
fi |
174 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
175 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
176 |
|
CPU_ARCHS="$CPU_ARCHS cpu_mips.o cpu_mips_coproc.o " |
177 |
|
CPU_ARCHS="$CPU_ARCHS cpu_mips_instr_unaligned.o" |
178 |
|
CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore" |
179 |
|
CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore_multi" |
180 |
fi |
fi |
181 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
182 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
183 |
|
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
184 |
|
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
185 |
|
fi |
186 |
|
if [ z$ENABLERCA180X = zYES ]; then |
187 |
|
printf "#define ENABLE_RCA180X\n" >> config.h |
188 |
|
CPU_ARCHS="$CPU_ARCHS cpu_rca180x.o" |
189 |
|
fi |
190 |
|
if [ z$ENABLESH = zYES ]; then |
191 |
|
printf "#define ENABLE_SH\n" >> config.h |
192 |
|
CPU_ARCHS="$CPU_ARCHS cpu_sh.o memory_sh.o" |
193 |
fi |
fi |
194 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
195 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
196 |
if [ z$STABLE = zNO ]; then |
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o memory_sparc.o" |
197 |
printf "\nWARNING: SPARC emulation enabled, but it isn't really" |
CPU_TOOLS="$CPU_TOOLS generate_sparc_loadstore" |
|
printf " implemented yet.\n\n" |
|
|
else |
|
|
printf "Not in the stable release.\n" |
|
|
exit |
|
|
fi |
|
|
fi |
|
|
if [ z$ENABLEURISC = zYES ]; then |
|
|
printf "#define ENABLE_URISC\n" >> config.h |
|
|
fi |
|
|
if [ z$ENABLEX86 = zYES ]; then |
|
|
printf "#define ENABLE_X86\n" >> config.h |
|
|
if [ z$STABLE = zNO ]; then |
|
|
printf "\nWARNING: X86 emulation enabled, but it isn't really" |
|
|
printf " working yet.\n\n" |
|
|
else |
|
|
printf "Not in the stable release.\n" |
|
|
exit |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
# Instruction delay/latency emulation: |
|
|
if [ z$DELAYS = zYES ]; then |
|
|
echo 'Enabling Instruction delay/latency emulation.' |
|
|
printf "#define ENABLE_INSTRUCTION_DELAYS\n" >> config.h |
|
|
fi |
|
|
|
|
|
|
|
|
# Instruction delay/latency emulation: |
|
|
if [ z$ALWAYS32 = zYES ]; then |
|
|
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
|
|
'This slows down everything.)' |
|
|
printf "#define ALWAYS_SIGNEXTEND_32\n" >> config.h |
|
198 |
fi |
fi |
199 |
|
if [ z$ENABLETRANSPUTER = zYES ]; then |
200 |
|
printf "#define ENABLE_TRANSPUTER\n" >> config.h |
201 |
# Cache emulation: |
CPU_ARCHS="$CPU_ARCHS cpu_transputer.o" |
|
if [ z$CACHES = zYES ]; then |
|
|
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
|
|
printf "#define ENABLE_CACHE_EMULATION\n" >> config.h |
|
|
|
|
|
if [ z$DELAYS != zYES ]; then |
|
|
printf 'WARNING: Cache emulation without instruction ' |
|
|
printf 'delay/latency emulation\n' |
|
|
printf ' (--delays) will not produce correct ' |
|
|
printf 'cache miss penalties and such.\n' |
|
|
fi |
|
|
|
|
|
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
|
|
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
|
202 |
fi |
fi |
203 |
|
|
204 |
|
|
276 |
fi |
fi |
277 |
rm -f _testprog |
rm -f _testprog |
278 |
|
|
279 |
# Try ccc (FreeBSD/Alpha): |
# # Try ccc (FreeBSD/Alpha): |
280 |
printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
# printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
281 |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
# printf " /dev/null 2> /dev/null\n" >> _test.sh |
282 |
chmod 755 _test.sh |
# chmod 755 _test.sh |
283 |
./_test.sh > /dev/null 2> /dev/null |
# ./_test.sh > /dev/null 2> /dev/null |
284 |
if [ -x _testprog ]; then |
# if [ -x _testprog ]; then |
285 |
CC="ccc" |
# CC="ccc" |
286 |
fi |
# fi |
287 |
rm -f _testprog |
# rm -f _testprog |
288 |
|
|
289 |
rm -f _test.sh |
rm -f _test.sh |
290 |
fi |
fi |
346 |
|
|
347 |
rm -f _test_x11 _test_x11.o |
rm -f _test_x11 _test_x11.o |
348 |
|
|
349 |
|
# Special case for some 64-bit Linux/x86_64 systems: |
350 |
|
if [ z$XOK = z0 ]; then |
351 |
|
XLIB="-L/usr/X11R6/lib64 -lX11" |
352 |
|
$CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null |
353 |
|
|
354 |
|
if [ -x _test_x11 ]; then |
355 |
|
XOK=1 |
356 |
|
fi |
357 |
|
fi |
358 |
|
rm -f _test_x11 _test_x11.o |
359 |
|
|
360 |
if [ z$XOK = z0 ]; then |
if [ z$XOK = z0 ]; then |
361 |
XINCLUDE="" |
XINCLUDE="" |
362 |
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
410 |
fi |
fi |
411 |
|
|
412 |
|
|
413 |
# Check for weird 'alpha' define. |
# Check for 'alpha' define. |
414 |
printf "checking for weird 'alpha' define... " |
printf "checking for 'alpha' define... " |
415 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
416 |
#ifdef alpha |
#ifdef alpha |
417 |
printf(\"1\"); |
printf(\"1\"); |
441 |
rm -f _testm* |
rm -f _testm* |
442 |
|
|
443 |
|
|
|
# Check for weird 'hppa' define. |
|
|
printf "checking for weird 'hppa' define... " |
|
|
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
|
|
#ifdef hppa |
|
|
printf(\"1\"); |
|
|
#undef hppa |
|
|
#ifdef hppa |
|
|
printf(\"2\"); |
|
|
#endif |
|
|
#endif |
|
|
printf(\"\\\n\");return 0;}\n" > _testm.c |
|
|
$CC $CFLAGS _testm.c -o _testm 2> /dev/null |
|
|
if [ ! -x _testm ]; then |
|
|
printf "\nWARNING! COULD NOT COMPILE hppa define TEST" |
|
|
printf " PROGRAM AT ALL!\n" |
|
|
else |
|
|
if [ z`./_testm` = z1 ]; then |
|
|
printf "yes, workaround applied\n" |
|
|
echo "#undef hppa" >> config.h |
|
|
else |
|
|
if [ z`./_testm` = z12 ]; then |
|
|
printf "yes, but workaround not possible\n" |
|
|
exit |
|
|
else |
|
|
printf "no\n" |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
rm -f _testm* |
|
|
|
|
|
|
|
444 |
# Some OSes on MIPS seems to define 'mips' to 1. (eg OpenBSD/arc) |
# Some OSes on MIPS seems to define 'mips' to 1. (eg OpenBSD/arc) |
445 |
printf "checking for weird 'mips' define... " |
printf "checking for 'mips' define... " |
446 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
447 |
#ifdef mips |
#ifdef mips |
448 |
printf(\"1\"); |
printf(\"1\"); |
474 |
|
|
475 |
# Similar to the mips define check above, although I don't know if |
# Similar to the mips define check above, although I don't know if |
476 |
# any OS actually defined ppc like this. |
# any OS actually defined ppc like this. |
477 |
printf "checking for weird 'ppc' define... " |
printf "checking for 'ppc' define... " |
478 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
479 |
#ifdef ppc |
#ifdef ppc |
480 |
printf(\"1\"); |
printf(\"1\"); |
506 |
|
|
507 |
# Similar to the mips define check above, although I don't know if |
# Similar to the mips define check above, although I don't know if |
508 |
# any OS actually defined sparc like this. |
# any OS actually defined sparc like this. |
509 |
printf "checking for weird 'sparc' define... " |
printf "checking for 'sparc' define... " |
510 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
511 |
#ifdef sparc |
#ifdef sparc |
512 |
printf(\"1\"); |
printf(\"1\"); |
549 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ z"$COMPAQCC" = zYES ]; then |
550 |
CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop" |
CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop" |
551 |
fi |
fi |
552 |
|
|
553 |
|
if [ z"$UNSTABLE" = zYES ]; then |
554 |
|
printf "checking whether -Werror can be used... " |
555 |
|
rm -f _testprog |
556 |
|
$CC $CFLAGS $CWARNINGS _testprog.c -o _testprog -Werror 2> /dev/null |
557 |
|
if [ -x _testprog ]; then |
558 |
|
printf "yes\n" |
559 |
|
CWARNINGS="$CWARNINGS -Werror" |
560 |
|
else |
561 |
|
printf "no\n" |
562 |
|
fi |
563 |
|
fi |
564 |
else |
else |
565 |
printf "no\n" |
printf "no\n" |
566 |
fi |
fi |
568 |
|
|
569 |
|
|
570 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ z"$COMPAQCC" = zYES ]; then |
571 |
# -O4 is possible, but is -O3 better? |
# -O4 is possible, but sometimes -O3 is better? |
572 |
CFLAGS="-O4 $CFLAGS" |
CFLAGS="-O4 $CFLAGS" |
573 |
else |
else |
574 |
if [ z"`uname`" = zSunOS ]; then |
if [ z"`uname`" = zSunOS ]; then |
583 |
$CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null |
$CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null |
584 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
585 |
rm -f _testprog |
rm -f _testprog |
586 |
$CC $CFLAGS _testprog.c -o _testprog -O2 2> /dev/null |
$CC $CFLAGS _testprog.c -o _testprog -O3 2> /dev/null |
587 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
588 |
CFLAGS="-O2 $CFLAGS" |
CFLAGS="-O3 $CFLAGS" |
589 |
else |
else |
590 |
CFLAGS="-O $CFLAGS" |
CFLAGS="-O $CFLAGS" |
591 |
fi |
fi |
673 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
674 |
|
|
675 |
|
|
676 |
|
# -g, for development builds |
677 |
|
if [ z"$UNSTABLE" = zYES ]; then |
678 |
|
printf "checking whether -g can be used... " |
679 |
|
if [ z"$COMPAQCC" = zYES ]; then |
680 |
|
printf "skipping\n" |
681 |
|
else |
682 |
|
$CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1 |
683 |
|
cat _testprog.stdout >> _testprog.error |
684 |
|
if [ -x _testprog ]; then |
685 |
|
CFLAGS="-g $CFLAGS" |
686 |
|
printf "yes\n" |
687 |
|
else |
688 |
|
printf "no\n" |
689 |
|
fi |
690 |
|
fi |
691 |
|
rm -f _testprog _testprog.error _testprog.stdout |
692 |
|
fi |
693 |
|
|
694 |
|
|
695 |
# -lrt for nanosleep? |
# -lrt for nanosleep? |
696 |
printf "checking whether -lrt is required for nanosleep... " |
printf "checking whether -lrt is required for nanosleep... " |
697 |
printf "#include <time.h>\n#include <stdio.h> |
printf "#include <time.h>\n#include <stdio.h> |
770 |
rm -f _testr.[co] _testr |
rm -f _testr.[co] _testr |
771 |
|
|
772 |
|
|
773 |
|
# strlcpy missing? |
774 |
|
printf "checking for strlcpy... " |
775 |
|
printf "#include <string.h> |
776 |
|
int main(int argc, char *argv[]) { char *p; char *q; size_t x; |
777 |
|
x = strlcpy(p, q, 50); return 0;}\n" > _tests.c |
778 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
779 |
|
if [ ! -x _tests ]; then |
780 |
|
printf "missing, using mystrlcpy\n" |
781 |
|
printf "#define strlcpy mystrlcpy\n" >> config.h |
782 |
|
printf "#define strlcat mystrlcat\n" >> config.h |
783 |
|
printf "#define USE_STRLCPY_REPLACEMENTS\n" >> config.h |
784 |
|
else |
785 |
|
printf "found\n" |
786 |
|
fi |
787 |
|
rm -f _tests.[co] _tests |
788 |
|
|
789 |
|
|
790 |
# strtoull missing? |
# strtoull missing? |
791 |
printf "checking for strtoull... " |
printf "checking for strtoull... " |
792 |
printf "#include <stdlib.h> |
printf "#include <stdlib.h> |
826 |
#include <stdio.h> |
#include <stdio.h> |
827 |
#include <sys/types.h> |
#include <sys/types.h> |
828 |
int main(int argc, char *argv[]) { fseeko(NULL, 0, 0); return 0;}\n" > _tests.c |
int main(int argc, char *argv[]) { fseeko(NULL, 0, 0); return 0;}\n" > _tests.c |
829 |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
$CC $CFLAGS $CWARNINGS _tests.c -o _tests 2> /dev/null |
830 |
if [ ! -x _tests ]; then |
if [ ! -x _tests ]; then |
831 |
printf "missing\n" |
# Try with _LARGEFILE_SOURCE (hack to make fseeko |
832 |
printf "WARNING! fseeko missing from libc. Using a hack, " |
# work on 64-bit Linux): |
833 |
printf "which probably doesn't work.\n" |
$CC $CFLAGS -D_LARGEFILE_SOURCE $CWARNINGS _tests.c -o _tests 2> /dev/null |
834 |
printf "#define HACK_FSEEKO\n" >> config.h |
if [ ! -x _tests ]; then |
835 |
|
printf "missing\n" |
836 |
|
printf "WARNING! fseeko missing from libc. Using a hack, " |
837 |
|
printf "which probably doesn't work.\n" |
838 |
|
printf "#define HACK_FSEEKO\n" >> config.h |
839 |
|
else |
840 |
|
printf "using -D_LARGEFILE_SOURCE hack\n" |
841 |
|
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE" |
842 |
|
fi |
843 |
else |
else |
844 |
printf "found\n" |
printf "found\n" |
845 |
fi |
fi |
896 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
897 |
|
|
898 |
|
|
899 |
|
# Check for PRIx64 in inttypes.h: |
900 |
|
printf "checking for PRIx64 in inttypes.h... " |
901 |
|
printf "#include <inttypes.h>\nint main(int argc, char *argv[])\n |
902 |
|
{\n#ifdef PRIx64\nreturn 0;\n#else\nreturn 1;\n#endif\n}\n" > _testpri.c |
903 |
|
$CC $CFLAGS _testpri.c -o _testpri 2> /dev/null |
904 |
|
if [ ! -x _testpri ]; then |
905 |
|
printf "\nERROR! COULD NOT COMPILE PRIx64 TEST PROGRAM AT ALL!\n" |
906 |
|
exit |
907 |
|
else |
908 |
|
if ./_testpri; then |
909 |
|
printf "yes\n" |
910 |
|
else |
911 |
|
printf "no, using an ugly hack instead, " |
912 |
|
printf "#define NO_C99_PRINTF_DEFINES\n" >> config.h |
913 |
|
|
914 |
|
# Try llx first: |
915 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){ |
916 |
|
printf(\"%%llx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c |
917 |
|
rm -f _testpri |
918 |
|
$CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null |
919 |
|
if [ z`./_testpri` = z80 ]; then |
920 |
|
printf "PRIx64=llx\n" |
921 |
|
printf "#define NO_C99_64BIT_LONGLONG\n" >> config.h |
922 |
|
else |
923 |
|
# Try lx too: |
924 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){ |
925 |
|
printf(\"%%lx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c |
926 |
|
rm -f _testpri |
927 |
|
$CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null |
928 |
|
if [ z`./_testpri` = z80 ]; then |
929 |
|
printf "PRIx64=lx\n" |
930 |
|
else |
931 |
|
printf "\nFailed, neither lx nor llx worked!\n" |
932 |
|
exit |
933 |
|
fi |
934 |
|
fi |
935 |
|
fi |
936 |
|
fi |
937 |
|
rm -f _testpri.c _testpri |
938 |
|
|
939 |
|
|
940 |
# Check for 64-bit off_t: |
# Check for 64-bit off_t: |
941 |
printf "checking for 64-bit off_t... " |
printf "checking for 64-bit off_t... " |
942 |
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
972 |
|
|
973 |
|
|
974 |
# Check for u_int8_t etc: |
# Check for u_int8_t etc: |
975 |
|
# These are needed because some header files in src/include/ use u_int* |
976 |
|
# instead of uint*, and I don't have time to rewrite them all. |
977 |
printf "checking for u_int8_t... " |
printf "checking for u_int8_t... " |
978 |
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
979 |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
995 |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
996 |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
997 |
printf "typedef uint32_t u_int32_t;\n" >> config.h |
printf "typedef uint32_t u_int32_t;\n" >> config.h |
|
printf "typedef uint64_t u_int64_t;\n" >> config.h |
|
998 |
printf "uint8_t\n" |
printf "uint8_t\n" |
999 |
else |
else |
1000 |
printf "yes\n" |
printf "yes\n" |
1001 |
fi |
fi |
1002 |
rm -f _testuint.c _testuint |
rm -f _testuint.c _testuint |
1003 |
|
|
1004 |
|
printf "checking for u_int64_t... " |
1005 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
1006 |
|
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1007 |
|
(int)sizeof(u_int64_t));return 0;}\n" > _testuint.c |
1008 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1009 |
|
if [ ! -x _testuint ]; then |
1010 |
|
rm -f _testuint* |
1011 |
|
printf "#include <stdio.h>\n#include <inttypes.h> |
1012 |
|
\n#include <sys/types.h>\nint main(int argc, char *argv[]) |
1013 |
|
{printf(\"%%i\\\n\", (int)sizeof(uint64_t));return 0;}\n" > _testuint.c |
1014 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1015 |
|
if [ ! -x _testuint ]; then |
1016 |
|
printf "no\n\nERROR: No u_int64_t or uint64_t. Aborting\n" |
1017 |
|
# TODO: Automagically detect using various combinations |
1018 |
|
# of char, int, short, long etc. |
1019 |
|
exit |
1020 |
|
fi |
1021 |
|
|
1022 |
############################################################################### |
printf "typedef uint64_t u_int64_t;\n" >> config.h |
1023 |
# |
printf "uint64_t\n" |
1024 |
# Dynamic binary translation (BINTRANS): |
else |
1025 |
# |
printf "yes\n" |
1026 |
############################################################################### |
fi |
1027 |
|
rm -f _testuint.c _testuint |
|
printf "checking for bintrans backend... " |
|
|
|
|
|
BINTRANS=NO |
|
1028 |
|
|
|
if [ z$ENABLEMIPS = zNO ]; then |
|
|
printf "NO!\nTEMPORARY HACK/PROBLEM: Disabling bintrans for now,\n" |
|
|
printf "until things have stabilized.\n" |
|
|
NOBINTRANS=YES |
|
|
fi |
|
|
|
|
|
if [ z$NOBINTRANS = zYES ]; then |
|
|
printf "disabled\n" |
|
|
else |
|
|
# Alpha: |
|
|
if [ z"`uname -m`" = zalpha ]; then |
|
|
printf "#define ALPHA\n" >> config.h |
|
|
printf "#define BINTRANS\n" >> config.h |
|
|
printf "Alpha\n" |
|
|
BINTRANS=YES |
|
|
fi |
|
|
|
|
|
# x86: (all machines ending in "86" are treated as i386) |
|
|
if [ z"`uname -m|rev|cut -c1-2`" = z68 ]; then |
|
|
printf "#define I386\n" >> config.h |
|
|
printf "#define BINTRANS\n" >> config.h |
|
|
printf "i386\n" |
|
|
BINTRANS=YES |
|
|
fi |
|
|
|
|
|
# MIPS not yet |
|
|
# # MIPS: |
|
|
# if [ z"`uname -m`" = zmips ]; then |
|
|
# printf "#define MIPS\n" >> config.h |
|
|
# printf "#define BINTRANS\n" >> config.h |
|
|
# printf "MIPS\n" |
|
|
# BINTRANS=YES |
|
|
# fi |
|
1029 |
|
|
1030 |
# # UltraSPARC: |
############################################################################### |
|
# if [ z"`uname -m`" = zsun4u ]; then |
|
|
# printf "#define SPARCV9\n" >> config.h |
|
|
# printf "#define BINTRANS\n" >> config.h |
|
|
# printf "SPARC V9\n" |
|
|
# BINTRANS=YES |
|
|
# else |
|
|
# if [ z"`uname -m`" = zsparc64 ]; then |
|
|
# printf "#define SPARCV9\n" >> config.h |
|
|
# printf "#define BINTRANS\n" >> config.h |
|
|
# printf "SPARC V9\n" |
|
|
# BINTRANS=YES |
|
|
# fi |
|
|
# fi |
|
1031 |
|
|
1032 |
if [ z$BINTRANS = zNO ]; then |
# Host byte order? |
1033 |
printf "not supported yet on this arch\n" |
printf "checking host endianness... " |
1034 |
|
rm -f _test_end* |
1035 |
|
printf '#include <stdio.h> |
1036 |
|
int main(int argc, char *argv[]) |
1037 |
|
{ int x = 1; void *xp = (void *)&x; char *p = (char *)xp; |
1038 |
|
if (*p) printf("little\\\n"); else printf("big\\\n"); } |
1039 |
|
' > _test_end.c |
1040 |
|
$CC $CFLAGS _test_end.c -o _test_end 2> /dev/null |
1041 |
|
X=`./_test_end` |
1042 |
|
echo $X |
1043 |
|
if [ z$X = zlittle ]; then |
1044 |
|
printf "#define HOST_LITTLE_ENDIAN\n" >> config.h |
1045 |
|
else |
1046 |
|
if [ z$X = zbig ]; then |
1047 |
|
printf "#define HOST_BIG_ENDIAN\n" >> config.h |
1048 |
|
else |
1049 |
|
echo "Error! Could not determine host's endianness." |
1050 |
|
exit |
1051 |
fi |
fi |
1052 |
fi |
fi |
1053 |
|
rm -f _test_end* |
1054 |
|
|
1055 |
|
|
1056 |
############################################################################### |
############################################################################### |
1057 |
|
# |
1058 |
|
# Native code generation backend: (Detect host architecture.) |
1059 |
|
# |
1060 |
|
############################################################################### |
1061 |
|
|
1062 |
|
if [ z$UNSTABLE = zYES ]; then |
1063 |
|
printf "native code generation backend... " |
1064 |
|
|
1065 |
|
if [ z"`uname -m`" = zamd64 ]; then |
1066 |
|
NATIVE_CODE_GENERATION=YES |
1067 |
|
printf "amd64\n" |
1068 |
|
printf "#define NATIVE_CODE_GENERATION\n" >> config.h |
1069 |
|
printf "#define HOST_ARCH_AMD64\n" >> config.h |
1070 |
|
fi |
1071 |
|
|
1072 |
|
if [ z"`uname -m`" = zx86_64 ]; then |
1073 |
|
NATIVE_CODE_GENERATION=YES |
1074 |
|
printf "amd64\n" |
1075 |
|
printf "#define NATIVE_CODE_GENERATION\n" >> config.h |
1076 |
|
printf "#define HOST_ARCH_AMD64\n" >> config.h |
1077 |
|
fi |
1078 |
|
|
1079 |
# Prefetch support? |
if [ z$NATIVE_CODE_GENERATION = z ]; then |
1080 |
printf "checking for asm prefetch support... " |
printf "not yet for this host platform\n" |
1081 |
if [ z"`uname -m`" = zalpha ]; then |
fi |
|
rm -f _alpha_asm_test.c _alpha_asm_test |
|
|
printf 'int main(int argc, char *argv[]) |
|
|
{ int x; int *y = &x; asm ("ldl $31,0(%%0)" : : "g" (y)); |
|
|
return 0; }\n' > _alpha_asm_test.c |
|
|
$CC $CFLAGS -O2 _alpha_asm_test.c -o _alpha_asm_test \ |
|
|
> /dev/null 2> /dev/null |
|
|
if [ -x _alpha_asm_test ]; then |
|
|
# printf "#define HAVE_PREFETCH\n" >> config.h |
|
|
printf "#define PREFETCH(x) asm(\"ldl" >> config.h |
|
|
printf " \$31,0(%%0)\" : : \"g\" (x))\n" >> config.h |
|
|
echo "yes" |
|
|
PREFSUP=YES |
|
|
fi |
|
|
rm -f _alpha_asm_test.c _alpha_asm_test |
|
|
fi |
|
|
if [ z$PREFSUP = z ]; then |
|
|
printf "#define PREFETCH(x) { }\n" >> config.h |
|
|
echo "no" |
|
1082 |
fi |
fi |
1083 |
|
|
1084 |
|
|
1087 |
INCLUDE=-Iinclude/ |
INCLUDE=-Iinclude/ |
1088 |
DINCLUDE=-I../include/ |
DINCLUDE=-I../include/ |
1089 |
|
|
1090 |
|
rm -f _testprog.c |
1091 |
|
|
1092 |
echo C compiler flags: $CFLAGS $CWARNINGS |
echo C compiler flags: $CFLAGS $CWARNINGS |
1093 |
echo Linker flags: $OTHERLIBS |
echo Linker flags: $OTHERLIBS |
1094 |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
1097 |
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
1098 |
echo "CC=$CC" >> _Makefile.header |
echo "CC=$CC" >> _Makefile.header |
1099 |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
1100 |
|
echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header |
1101 |
|
echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header |
1102 |
echo "" >> _Makefile.header |
echo "" >> _Makefile.header |
1103 |
|
|
1104 |
|
|
|
printf "Regression test setup: (not really needed to build gxemul)\n" |
|
|
|
|
|
|
|
|
## 64-bit HPPA cross-assembler: |
|
|
# |
|
|
#HPPA='' |
|
|
#if [ z$ENABLEHPPA = zYES ]; then |
|
|
# printf "Checking for a GNU cross-assembler for 64-bit HPPA... " |
|
|
# echo 'nop' > _testprog.s |
|
|
# |
|
|
# for HPPA_TRY in hppa64-unknown-elf hppa64-elf; do |
|
|
# printf '#!/bin/sh\n'$HPPA_TRY'-as _testprog.s' > _test.sh |
|
|
# printf ' -o _testprog.o\n' >> _test.sh |
|
|
# chmod 755 _test.sh |
|
|
# rm -f _testprog.o |
|
|
# ./_test.sh > /dev/null 2> /dev/null |
|
|
# if [ -f _testprog.o ]; then |
|
|
# HPPA=$HPPA_TRY |
|
|
# break |
|
|
# fi |
|
|
# rm -f _testprog.o |
|
|
# done |
|
|
# |
|
|
# if [ z$HPPA = z ]; then |
|
|
# echo "none" |
|
|
# else |
|
|
# echo $HPPA"-gcc" |
|
|
# fi |
|
|
#fi |
|
|
#rm -f _testprog* _test.sh |
|
|
# |
|
|
## TODO: are these ok? 64-bit mode! |
|
|
##echo "HPPA_CC="$HPPA"-gcc -g -O2 -fno-builtin -fschedule-insns" \ |
|
|
## >> _Makefile.header |
|
|
#echo "HPPA_AS="$HPPA"-as " >> _Makefile.header |
|
|
#echo "HPPA_LD="$HPPA"-ld -Ttext 0xa800000000030000 -e main" \ |
|
|
# "--oformat=elf64-bigmips" >> _Makefile.header |
|
|
#echo "" >> _Makefile.header |
|
|
|
|
|
|
|
|
# 64-bit MIPS cross-compiler: |
|
|
|
|
|
MIPS='' |
|
|
if [ z$ENABLEMIPS = zYES ]; then |
|
|
printf "Checking for a GNU cross-compiler for 64-bit MIPS... " |
|
|
echo 'int f(int x) { return x; }' > _testprog.c |
|
|
|
|
|
for MIPS_TRY in mips64-unknown-elf mips64-elf mips-unknown-elf64; do |
|
|
printf '#!/bin/sh\n'$MIPS_TRY'-gcc _testprog.c -c\n' > _test.sh |
|
|
chmod 755 _test.sh |
|
|
rm -f _testprog.o |
|
|
./_test.sh > /dev/null 2> /dev/null |
|
|
if [ -f _testprog.o ]; then |
|
|
MIPS=$MIPS_TRY |
|
|
break |
|
|
fi |
|
|
rm -f _testprog.o |
|
|
done |
|
|
|
|
|
if [ z$MIPS = z ]; then |
|
|
echo "none" |
|
|
else |
|
|
echo $MIPS"-gcc" |
|
|
fi |
|
|
fi |
|
|
rm -f _testprog* _test.sh |
|
|
|
|
|
echo "MIPS_CC="$MIPS"-gcc -g -O2 -fno-builtin -fschedule-insns" \ |
|
|
"-mips64 -mabi=64" >> _Makefile.header |
|
|
echo "MIPS_AS="$MIPS"-as -mabi=64 -mips64" >> _Makefile.header |
|
|
echo "MIPS_LD="$MIPS"-ld -Ttext 0xa800000000030000 -e main" \ |
|
|
"--oformat=elf64-bigmips" >> _Makefile.header |
|
|
echo "" >> _Makefile.header |
|
|
|
|
|
|
|
|
## PPC64 cross-assembler: |
|
|
# |
|
|
#PPC='' |
|
|
#if [ z$ENABLEPPC = zYES ]; then |
|
|
# printf "Checking for a GNU cross-assembler for 64-bit PPC... " |
|
|
# echo 'nop' > _testprog.s |
|
|
# |
|
|
# for a in ppc64 powerpc64; do |
|
|
# for b in unknown; do |
|
|
# for c in elf elf64 linux linux64 aix aix5; do |
|
|
# PPC_TRY=$a-$b-$c |
|
|
# printf '#!/bin/sh\n'$PPC_TRY'-as _testprog.s' > _test.sh |
|
|
# printf ' -o _testprog.o\n' >> _test.sh |
|
|
# chmod 755 _test.sh |
|
|
# rm -f _testprog.o |
|
|
# ./_test.sh > /dev/null 2> /dev/null |
|
|
# if [ -f _testprog.o ]; then |
|
|
# PPC=$PPC_TRY |
|
|
# break |
|
|
# fi |
|
|
# rm -f _testprog.o |
|
|
# done |
|
|
# done |
|
|
# done |
|
|
# |
|
|
# if [ z$PPC = z ]; then |
|
|
# echo "none" |
|
|
# else |
|
|
# echo $PPC"-as" |
|
|
# fi |
|
|
#fi |
|
|
#rm -f _testprog* _test.sh |
|
|
# |
|
|
##echo "PPC_CC="$PPC"-gcc -g -O2 -fno-builtin" >> _Makefile.header |
|
|
#echo "PPC_AS="$PPC"-as" >> _Makefile.header |
|
|
#echo "PPC_LD="$PPC"-ld -e main" >> _Makefile.header |
|
|
#echo "" >> _Makefile.header |
|
|
|
|
|
|
|
|
## SPARC64 cross-compiler: |
|
|
# |
|
|
#SPARC='' |
|
|
#if [ z$ENABLESPARC = zYES ]; then |
|
|
# printf "Checking for a GNU cross-compiler for 64-bit SPARC... " |
|
|
# echo 'int f(int x) { return x; }' > _testprog.c |
|
|
# |
|
|
# for a in sparc64; do |
|
|
# for b in unknown; do |
|
|
# for c in elf elf64; do |
|
|
# SPARC_TRY=$a-$b-$c |
|
|
# printf '#!/bin/sh\n'$SPARC_TRY'-gcc _testprog.c -c' > _test.sh |
|
|
# printf ' -o _testprog.o\n' >> _test.sh |
|
|
# chmod 755 _test.sh |
|
|
# rm -f _testprog.o |
|
|
# ./_test.sh > /dev/null 2> /dev/null |
|
|
# if [ -f _testprog.o ]; then |
|
|
# SPARC=$SPARC_TRY |
|
|
# break |
|
|
# fi |
|
|
# rm -f _testprog.o |
|
|
# done |
|
|
# done |
|
|
# done |
|
|
# |
|
|
# if [ z$SPARC = z ]; then |
|
|
# echo "none" |
|
|
# else |
|
|
# echo $SPARC"-gcc" |
|
|
# fi |
|
|
#fi |
|
|
#rm -f _testprog* _test.sh |
|
|
# |
|
|
#echo "SPARC_CC="$SPARC"-gcc -g -O2 -fno-builtin" >> _Makefile.header |
|
|
#echo "SPARC_AS="$SPARC"-as" >> _Makefile.header |
|
|
#echo "SPARC_LD="$SPARC"-ld -e main" >> _Makefile.header |
|
|
#echo "" >> _Makefile.header |
|
|
|
|
|
|
|
1105 |
# Create the Makefiles: |
# Create the Makefiles: |
1106 |
|
D=". src src/include src/cpus src/debugger src/devices src/devices/fonts" |
1107 |
for a in . src src/devices src/devices/fonts tests; do |
D="$D src/machines src/native src/net src/promemul" |
1108 |
|
for a in $D; do |
1109 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1110 |
touch $a/Makefile |
touch $a/Makefile |
1111 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |