27 |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
28 |
# |
# |
29 |
# |
# |
30 |
# $Id: configure,v 1.123 2005/04/17 01:42:21 debug Exp $ |
# $Id: configure,v 1.173 2005/10/21 15:19:24 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 |
52 |
# o) prefetch capability (TODO: this is assumed on Alpha, but not all |
# o) prefetch capability (TODO: this is assumed on Alpha, but not all |
53 |
# Alphas have it...) |
# 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 |
ENABLEALPHA=NO |
# Figure out if this is a stable version (0.x.x). |
62 |
ENABLEHPPA=NO |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
63 |
ENABLEMIPS=YES |
if [ z"$X" = z0. ]; then |
64 |
ENABLEPPC=YES |
# Stable: |
65 |
ENABLESPARC=NO |
ENABLEARM=YES |
66 |
ENABLEURISC=YES |
ENABLEMIPS=YES |
67 |
ENABLEX86=NO |
else |
68 |
|
# Development: |
69 |
|
ENABLEALPHA=YES |
70 |
|
ENABLEARM=YES |
71 |
|
ENABLEAVR=NO |
72 |
|
ENABLEHPPA=NO |
73 |
|
ENABLEI960=NO |
74 |
|
ENABLEIA64=NO |
75 |
|
ENABLEM68K=NO |
76 |
|
ENABLEMIPS=YES |
77 |
|
ENABLEPPC=YES |
78 |
|
ENABLESH=NO |
79 |
|
ENABLESPARC=NO |
80 |
|
ENABLEX86=NO |
81 |
|
fi |
82 |
|
|
83 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
84 |
# Parse command line options: |
# Parse command line options: |
87 |
NOX11=YES |
NOX11=YES |
88 |
else if [ z$a = z--always32 ]; then |
else if [ z$a = z--always32 ]; then |
89 |
ALWAYS32=YES |
ALWAYS32=YES |
90 |
|
else if [ z$a = z--tracenull ]; then |
91 |
|
TRACENULL=YES |
92 |
else if [ z$a = z--disable-bintrans ]; then |
else if [ z$a = z--disable-bintrans ]; then |
93 |
NOBINTRANS=YES |
NOBINTRANS=YES |
94 |
|
else if [ z$a = z--enable-bintrans ]; then |
95 |
|
NOBINTRANS=NO |
96 |
|
else if [ z$a = z--disable-mips16 ]; then |
97 |
|
MIPS16=NO |
98 |
else if [ z$a = z--enable-mips16 ]; then |
else if [ z$a = z--enable-mips16 ]; then |
99 |
MIPS16=YES |
MIPS16=YES |
100 |
|
else if [ z$a = z--enable-all ]; then |
101 |
|
ENABLEALPHA=YES |
102 |
|
ENABLEARM=YES |
103 |
|
ENABLEAVR=YES |
104 |
|
ENABLEHPPA=YES |
105 |
|
ENABLEI960=YES |
106 |
|
ENABLEIA64=YES |
107 |
|
ENABLEM68K=YES |
108 |
|
ENABLEMIPS=YES |
109 |
|
ENABLEPPC=YES |
110 |
|
ENABLESH=YES |
111 |
|
ENABLESPARC=YES |
112 |
|
ENABLEX86=YES |
113 |
|
else if [ z$a = z--disable-alpha ]; then |
114 |
|
ENABLEALPHA=NO |
115 |
else if [ z$a = z--enable-alpha ]; then |
else if [ z$a = z--enable-alpha ]; then |
116 |
ENABLEALPHA=YES |
ENABLEALPHA=YES |
117 |
|
else if [ z$a = z--disable-arm ]; then |
118 |
|
ENABLEARM=NO |
119 |
|
else if [ z$a = z--enable-arm ]; then |
120 |
|
ENABLEARM=YES |
121 |
|
else if [ z$a = z--disable-avr ]; then |
122 |
|
ENABLEAVR=NO |
123 |
|
else if [ z$a = z--enable-avr ]; then |
124 |
|
ENABLEAVR=YES |
125 |
|
else if [ z$a = z--disable-hppa ]; then |
126 |
|
ENABLEHPPA=NO |
127 |
else if [ z$a = z--enable-hppa ]; then |
else if [ z$a = z--enable-hppa ]; then |
128 |
ENABLEHPPA=YES |
ENABLEHPPA=YES |
129 |
|
else if [ z$a = z--disable-i960 ]; then |
130 |
|
ENABLEI960=NO |
131 |
|
else if [ z$a = z--enable-i960 ]; then |
132 |
|
ENABLEI960=YES |
133 |
|
else if [ z$a = z--disable-ia64 ]; then |
134 |
|
ENABLEIA64=NO |
135 |
|
else if [ z$a = z--enable-ia64 ]; then |
136 |
|
ENABLEIA64=YES |
137 |
|
else if [ z$a = z--disable-m68k ]; then |
138 |
|
ENABLEM68K=NO |
139 |
|
else if [ z$a = z--enable-m68k ]; then |
140 |
|
ENABLEM86K=YES |
141 |
else if [ z$a = z--disable-mips ]; then |
else if [ z$a = z--disable-mips ]; then |
142 |
ENABLEMIPS=NO |
ENABLEMIPS=NO |
143 |
|
else if [ z$a = z--enable-mips ]; then |
144 |
|
ENABLEMIPS=YES |
145 |
else if [ z$a = z--disable-ppc ]; then |
else if [ z$a = z--disable-ppc ]; then |
146 |
ENABLEPPC=NO |
ENABLEPPC=NO |
147 |
|
else if [ z$a = z--enable-ppc ]; then |
148 |
|
ENABLEPPC=YES |
149 |
|
else if [ z$a = z--disable-sh ]; then |
150 |
|
ENABLESH=NO |
151 |
|
else if [ z$a = z--enable-sh ]; then |
152 |
|
ENABLESH=YES |
153 |
|
else if [ z$a = z--disable-sparc ]; then |
154 |
|
ENABLESPARC=NO |
155 |
else if [ z$a = z--enable-sparc ]; then |
else if [ z$a = z--enable-sparc ]; then |
156 |
ENABLESPARC=YES |
ENABLESPARC=YES |
157 |
else if [ z$a = z--disable-urisc ]; then |
else if [ z$a = z--disable-x86 ]; then |
158 |
ENABLEURISC=NO |
ENABLEX86=NO |
159 |
else if [ z$a = z--enable-x86 ]; then |
else if [ z$a = z--enable-x86 ]; then |
160 |
ENABLEX86=YES |
ENABLEX86=YES |
161 |
|
else if [ z$a = z--disable-delays ]; then |
162 |
|
DELAYS=NO |
163 |
else if [ z$a = z--enable-delays ]; then |
else if [ z$a = z--enable-delays ]; then |
164 |
DELAYS=YES |
DELAYS=YES |
165 |
|
else if [ z$a = z--disable-caches ]; then |
166 |
|
CACHES=NO |
167 |
else if [ z$a = z--enable-caches ]; then |
else if [ z$a = z--enable-caches ]; then |
168 |
CACHES=YES |
CACHES=YES |
169 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
170 |
echo "usage: $0 [options]" |
echo "usage: $0 [options]" |
171 |
printf "\nDevelopment (debug) options:\n" |
|
172 |
echo " --always32 enable" \ |
printf "\nGeneral options:\n\n" |
173 |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
|
174 |
echo " 32/64-bit bugs)" |
echo " --disable-bintrans configure without the" \ |
175 |
printf "\nGeneral options:\n" |
"old binary translation subsystem," |
176 |
echo " --disable-bintrans configure without" \ |
echo " even if the host" \ |
177 |
"bintrans, even if the host supports it" |
"supports it" |
|
echo " --enable-caches enable cache emulation" \ |
|
|
"(experimental)" |
|
|
echo " --enable-delays enable instruction" \ |
|
|
"latency/delay emulation" |
|
178 |
echo " --disable-x don't include X11 support" |
echo " --disable-x don't include X11 support" |
179 |
printf "\nCPU selection options: (most of these" |
|
180 |
printf " are experimental)\n" |
printf "\nDevelopment (debug) options:\n\n" |
181 |
echo " --enable-alpha enable Alpha CPU emulation" |
|
182 |
echo " --enable-hppa enable HPPA CPU emulation" |
echo " --always32 enable ALWAYS_SIGNEXTEND_32"\ |
183 |
echo " --disable-mips disable MIPS CPU emulation" |
"(for hunting down 32-bit bugs)" |
184 |
echo " --disable-ppc disable PPC CPU emulation" |
echo " --tracenull enable" \ |
185 |
echo " --enable-sparc enable SPARC CPU emulation" |
"TRACE_NULL_CRASHES (for bug hunting)" |
186 |
echo " --disable-urisc disable URISC CPU emulation" |
printf " --enable-caches enable cache emulation" |
187 |
echo " --enable-x86 enable x86 CPU emulation" |
printf " (BUGGY)\n" |
188 |
printf "\nMIPS-specific options:\n" |
echo " --enable-delays enable instruction" \ |
189 |
echo " --enable-mips16 enable MIPS16 instruction" \ |
"latency/delay emulation" |
190 |
"support (experimental)" |
|
191 |
printf "\n" |
printf " --enable-all enable everything\n" |
192 |
|
|
193 |
|
if [ z$ENABLEALPHA = zYES ]; then |
194 |
|
printf " --disable-alpha disable " |
195 |
|
else |
196 |
|
printf " --enable-alpha enable " |
197 |
|
fi |
198 |
|
printf "Alpha CPU emulation\n" |
199 |
|
|
200 |
|
if [ z$ENABLEARM = zYES ]; then |
201 |
|
printf " --disable-arm disable " |
202 |
|
else |
203 |
|
printf " --enable-arm enable " |
204 |
|
fi |
205 |
|
printf "ARM CPU emulation\n" |
206 |
|
|
207 |
|
if [ z$ENABLEAVR = zYES ]; then |
208 |
|
printf " --disable-avr disable " |
209 |
|
else |
210 |
|
printf " --enable-avr enable " |
211 |
|
fi |
212 |
|
printf "Atmel AVR CPU emulation\n" |
213 |
|
|
214 |
|
if [ z$ENABLEHPPA = zYES ]; then |
215 |
|
printf " --disable-hppa disable " |
216 |
|
else |
217 |
|
printf " --enable-hppa enable " |
218 |
|
fi |
219 |
|
printf "HPPA CPU emulation\n" |
220 |
|
|
221 |
|
if [ z$ENABLEI960 = zYES ]; then |
222 |
|
printf " --disable-i960 disable " |
223 |
|
else |
224 |
|
printf " --enable-i960 enable " |
225 |
|
fi |
226 |
|
printf "i960 CPU emulation\n" |
227 |
|
|
228 |
|
if [ z$ENABLEIA64 = zYES ]; then |
229 |
|
printf " --disable-ia64 disable " |
230 |
|
else |
231 |
|
printf " --enable-ia64 enable " |
232 |
|
fi |
233 |
|
printf "IA64 CPU emulation\n" |
234 |
|
|
235 |
|
if [ z$ENABLEM68K = zYES ]; then |
236 |
|
printf " --disable-m68k disable " |
237 |
|
else |
238 |
|
printf " --enable-m68k enable " |
239 |
|
fi |
240 |
|
printf "M68K CPU emulation\n" |
241 |
|
|
242 |
|
if [ z$ENABLEMIPS = zYES ]; then |
243 |
|
printf " --disable-mips disable " |
244 |
|
else |
245 |
|
printf " --enable-mips enable " |
246 |
|
fi |
247 |
|
printf "MIPS CPU emulation\n" |
248 |
|
|
249 |
|
if [ z$ENABLEPPC = zYES ]; then |
250 |
|
printf " --disable-ppc disable " |
251 |
|
else |
252 |
|
printf " --enable-ppc enable " |
253 |
|
fi |
254 |
|
printf "POWER/PPC CPU emulation\n" |
255 |
|
|
256 |
|
if [ z$ENABLESH = zYES ]; then |
257 |
|
printf " --disable-sh disable " |
258 |
|
else |
259 |
|
printf " --enable-sh enable " |
260 |
|
fi |
261 |
|
printf "SH CPU emulation\n" |
262 |
|
|
263 |
|
if [ z$ENABLESPARC = zYES ]; then |
264 |
|
printf " --disable-sparc disable " |
265 |
|
else |
266 |
|
printf " --enable-sparc enable " |
267 |
|
fi |
268 |
|
printf "SPARC CPU emulation\n" |
269 |
|
|
270 |
|
if [ z$ENABLEX86 = zYES ]; then |
271 |
|
printf " --disable-x86 disable " |
272 |
|
else |
273 |
|
printf " --enable-x86 enable " |
274 |
|
fi |
275 |
|
printf "x86 CPU emulation\n" |
276 |
|
|
277 |
|
echo " --enable-mips16 enable MIPS16 support" |
278 |
|
|
279 |
|
printf "\n(Pretty much all of these options are only" |
280 |
|
printf " meaningful during the development of\nthe" |
281 |
|
printf " emulator, and should not be used when " |
282 |
|
printf "compiling a stable version.)\n" |
283 |
exit |
exit |
284 |
else |
else |
285 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
286 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
287 |
"available options." |
"available options." |
288 |
exit |
exit |
289 |
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; fi |
290 |
|
fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi |
291 |
|
fi; fi; fi; fi; fi |
292 |
done |
done |
293 |
fi |
fi |
294 |
|
|
312 |
# Figure out if VERSION should be defined. |
# Figure out if VERSION should be defined. |
313 |
X=`basename \`pwd\`|cut -d \- -f 2-` |
X=`basename \`pwd\`|cut -d \- -f 2-` |
314 |
if [ z"$X" = zgxemul ]; then |
if [ z"$X" = zgxemul ]; then |
315 |
echo '# No VERSION defined.' >> _Makefile.header |
echo '/* No VERSION defined. */' >> config.h |
316 |
else |
else |
317 |
printf "#define VERSION \"$X\"\n" >> config.h |
printf "#define VERSION \"$X\"\n" >> config.h |
318 |
fi |
fi |
331 |
fi |
fi |
332 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
333 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ALPHA\n" >> config.h |
334 |
|
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" |
335 |
|
CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" |
336 |
|
fi |
337 |
|
if [ z$ENABLEARM = zYES ]; then |
338 |
|
printf "#define ENABLE_ARM\n" >> config.h |
339 |
|
CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o " |
340 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o tmp_arm_r.o" |
341 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o" |
342 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o" |
343 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o" |
344 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o" |
345 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o" |
346 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o" |
347 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o" |
348 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o" |
349 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r" |
350 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi" |
351 |
|
fi |
352 |
|
if [ z$ENABLEAVR = zYES ]; then |
353 |
|
printf "#define ENABLE_AVR\n" >> config.h |
354 |
|
CPU_ARCHS="$CPU_ARCHS cpu_avr.o" |
355 |
fi |
fi |
356 |
if [ z$ENABLEHPPA = zYES ]; then |
if [ z$ENABLEHPPA = zYES ]; then |
357 |
printf "#define ENABLE_HPPA\n" >> config.h |
printf "#define ENABLE_HPPA\n" >> config.h |
358 |
|
CPU_ARCHS="$CPU_ARCHS cpu_hppa.o" |
359 |
|
fi |
360 |
|
if [ z$ENABLEI960 = zYES ]; then |
361 |
|
printf "#define ENABLE_I960\n" >> config.h |
362 |
|
CPU_ARCHS="$CPU_ARCHS cpu_i960.o" |
363 |
|
fi |
364 |
|
if [ z$ENABLEIA64 = zYES ]; then |
365 |
|
printf "#define ENABLE_IA64\n" >> config.h |
366 |
|
CPU_ARCHS="$CPU_ARCHS cpu_ia64.o" |
367 |
|
fi |
368 |
|
if [ z$ENABLEM68K = zYES ]; then |
369 |
|
printf "#define ENABLE_M68K\n" >> config.h |
370 |
|
CPU_ARCHS="$CPU_ARCHS cpu_m68k.o" |
371 |
fi |
fi |
372 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
373 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
374 |
fi |
fi |
375 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
376 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
377 |
|
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
378 |
|
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
379 |
|
fi |
380 |
|
if [ z$ENABLESH = zYES ]; then |
381 |
|
printf "#define ENABLE_SH\n" >> config.h |
382 |
|
CPU_ARCHS="$CPU_ARCHS cpu_sh.o" |
383 |
fi |
fi |
384 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
385 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
386 |
fi |
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" |
|
if [ z$ENABLEURISC = zYES ]; then |
|
|
printf "#define ENABLE_URISC\n" >> config.h |
|
387 |
fi |
fi |
388 |
if [ z$ENABLEX86 = zYES ]; then |
if [ z$ENABLEX86 = zYES ]; then |
389 |
printf "#define ENABLE_X86\n" >> config.h |
printf "#define ENABLE_X86\n" >> config.h |
390 |
|
CPU_ARCHS="$CPU_ARCHS cpu_x86.o" |
391 |
fi |
fi |
392 |
|
|
393 |
|
|
398 |
fi |
fi |
399 |
|
|
400 |
|
|
401 |
# Instruction delay/latency emulation: |
# Development option: ALWAYS_SIGNEXTEND_32 |
402 |
if [ z$ALWAYS32 = zYES ]; then |
if [ z$ALWAYS32 = zYES ]; then |
403 |
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
404 |
'This slows down everything.)' |
'This slows down everything.)' |
406 |
fi |
fi |
407 |
|
|
408 |
|
|
409 |
|
# Development option: TRACE_NULL_CRASHES |
410 |
|
if [ z$TRACENULL = zYES ]; then |
411 |
|
echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \ |
412 |
|
'This slows down the emulator.)' |
413 |
|
printf "#define TRACE_NULL_CRASHES\n" >> config.h |
414 |
|
fi |
415 |
|
|
416 |
|
|
417 |
# Cache emulation: |
# Cache emulation: |
418 |
if [ z$CACHES = zYES ]; then |
if [ z$CACHES = zYES ]; then |
419 |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
425 |
printf ' (--delays) will not produce correct ' |
printf ' (--delays) will not produce correct ' |
426 |
printf 'cache miss penalties and such.\n' |
printf 'cache miss penalties and such.\n' |
427 |
fi |
fi |
428 |
|
|
429 |
|
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
430 |
|
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
431 |
fi |
fi |
432 |
|
|
433 |
|
|
505 |
fi |
fi |
506 |
rm -f _testprog |
rm -f _testprog |
507 |
|
|
508 |
# Try ccc (FreeBSD/Alpha): |
# # Try ccc (FreeBSD/Alpha): |
509 |
printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
# printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
510 |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
# printf " /dev/null 2> /dev/null\n" >> _test.sh |
511 |
chmod 755 _test.sh |
# chmod 755 _test.sh |
512 |
./_test.sh > /dev/null 2> /dev/null |
# ./_test.sh > /dev/null 2> /dev/null |
513 |
if [ -x _testprog ]; then |
# if [ -x _testprog ]; then |
514 |
CC="ccc" |
# CC="ccc" |
515 |
fi |
# fi |
516 |
rm -f _testprog |
# rm -f _testprog |
517 |
|
|
518 |
rm -f _test.sh |
rm -f _test.sh |
519 |
fi |
fi |
628 |
fi |
fi |
629 |
|
|
630 |
|
|
631 |
# Check for weird 'alpha' define. |
# Check for 'alpha' define. |
632 |
printf "checking for weird 'alpha' define... " |
printf "checking for 'alpha' define... " |
633 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
634 |
#ifdef alpha |
#ifdef alpha |
635 |
printf(\"1\"); |
printf(\"1\"); |
659 |
rm -f _testm* |
rm -f _testm* |
660 |
|
|
661 |
|
|
|
# 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* |
|
|
|
|
|
|
|
662 |
# 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) |
663 |
printf "checking for weird 'mips' define... " |
printf "checking for 'mips' define... " |
664 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
665 |
#ifdef mips |
#ifdef mips |
666 |
printf(\"1\"); |
printf(\"1\"); |
692 |
|
|
693 |
# 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 |
694 |
# any OS actually defined ppc like this. |
# any OS actually defined ppc like this. |
695 |
printf "checking for weird 'ppc' define... " |
printf "checking for 'ppc' define... " |
696 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
697 |
#ifdef ppc |
#ifdef ppc |
698 |
printf(\"1\"); |
printf(\"1\"); |
724 |
|
|
725 |
# 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 |
726 |
# any OS actually defined sparc like this. |
# any OS actually defined sparc like this. |
727 |
printf "checking for weird 'sparc' define... " |
printf "checking for 'sparc' define... " |
728 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
729 |
#ifdef sparc |
#ifdef sparc |
730 |
printf(\"1\"); |
printf(\"1\"); |
861 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
862 |
|
|
863 |
|
|
|
# -fmove-all-movables |
|
|
printf "checking whether -fmove-all-movables can be used... " |
|
|
$CC $CFLAGS -fmove-all-movables _testprog.c -o \ |
|
|
_testprog > _testprog.stdout 2>&1 |
|
|
cat _testprog.stdout >> _testprog.error |
|
|
if grep movables _testprog.error > /dev/null 2>&1; then |
|
|
printf "no\n" |
|
|
else |
|
|
if [ -x _testprog ]; then |
|
|
CFLAGS="-fmove-all-movables $CFLAGS" |
|
|
printf "yes\n" |
|
|
else |
|
|
printf "no\n" |
|
|
fi |
|
|
fi |
|
|
rm -f _testprog _testprog.error _testprog.stdout |
|
|
|
|
|
|
|
864 |
# -fomit-frame-pointer |
# -fomit-frame-pointer |
865 |
printf "checking whether -fomit-frame-pointer can be used... " |
printf "checking whether -fomit-frame-pointer can be used... " |
866 |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
957 |
rm -f _testr.[co] _testr |
rm -f _testr.[co] _testr |
958 |
|
|
959 |
|
|
960 |
|
# strlcpy missing? |
961 |
|
printf "checking for strlcpy... " |
962 |
|
printf "#include <string.h> |
963 |
|
int main(int argc, char *argv[]) { char *p; char *q; size_t x; |
964 |
|
x = strlcpy(p, q, 50); return 0;}\n" > _tests.c |
965 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
966 |
|
if [ ! -x _tests ]; then |
967 |
|
printf "missing, using mystrlcpy\n" |
968 |
|
printf "#define strlcpy mystrlcpy\n" >> config.h |
969 |
|
printf "#define strlcat mystrlcat\n" >> config.h |
970 |
|
printf "#define USE_STRLCPY_REPLACEMENTS\n" >> config.h |
971 |
|
else |
972 |
|
printf "found\n" |
973 |
|
fi |
974 |
|
rm -f _tests.[co] _tests |
975 |
|
|
976 |
|
|
977 |
# strtoull missing? |
# strtoull missing? |
978 |
printf "checking for strtoull... " |
printf "checking for strtoull... " |
979 |
printf "#include <stdlib.h> |
printf "#include <stdlib.h> |
986 |
printf "missing, using mystrtoull\n" |
printf "missing, using mystrtoull\n" |
987 |
printf "#define strtoull mystrtoull\n" >> config.h |
printf "#define strtoull mystrtoull\n" >> config.h |
988 |
else |
else |
989 |
printf "yes\n" |
printf "found\n" |
990 |
|
fi |
991 |
|
rm -f _tests.[co] _tests |
992 |
|
|
993 |
|
|
994 |
|
# mkstemp missing? |
995 |
|
printf "checking for mkstemp... " |
996 |
|
printf "#include <unistd.h> |
997 |
|
int main(int argc, char *argv[]) { int x; char *y = \"abc\"; |
998 |
|
x = mkstemp(y); return 0;}\n" > _tests.c |
999 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
1000 |
|
if [ ! -x _tests ]; then |
1001 |
|
printf "missing, using workaround\n" |
1002 |
|
printf "#define mkstemp mymkstemp\n" >> config.h |
1003 |
|
else |
1004 |
|
printf "found\n" |
1005 |
fi |
fi |
1006 |
rm -f _testlong* _tests.[co] _tests |
rm -f _tests.[co] _tests |
1007 |
|
|
1008 |
|
|
1009 |
# fseeko missing? |
# fseeko missing? |
1015 |
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 |
1016 |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
1017 |
if [ ! -x _tests ]; then |
if [ ! -x _tests ]; then |
1018 |
printf "no\n" |
printf "missing\n" |
1019 |
printf "WARNING! fseeko missing from libc. Using a hack, " |
printf "WARNING! fseeko missing from libc. Using a hack, " |
1020 |
printf "which probably doesn't work.\n" |
printf "which probably doesn't work.\n" |
1021 |
printf "#define HACK_FSEEKO\n" >> config.h |
printf "#define HACK_FSEEKO\n" >> config.h |
1022 |
else |
else |
1023 |
printf "yes\n" |
printf "found\n" |
1024 |
fi |
fi |
1025 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
1026 |
|
|
1038 |
printf "no, using int\n" |
printf "no, using int\n" |
1039 |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
1040 |
else |
else |
1041 |
printf "yes\n" |
printf "socklen_t\n" |
1042 |
fi |
fi |
1043 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
1044 |
|
|
1110 |
|
|
1111 |
|
|
1112 |
# Check for u_int8_t etc: |
# Check for u_int8_t etc: |
1113 |
|
# These are needed because some header files in src/include/ use u_int* |
1114 |
|
# instead of uint*, and I don't have time to rewrite them all. |
1115 |
printf "checking for u_int8_t... " |
printf "checking for u_int8_t... " |
1116 |
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 |
1117 |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1133 |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
1134 |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
1135 |
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 |
|
1136 |
printf "uint8_t\n" |
printf "uint8_t\n" |
1137 |
else |
else |
1138 |
printf "yes\n" |
printf "yes\n" |
1139 |
fi |
fi |
1140 |
rm -f _testuint.c _testuint |
rm -f _testuint.c _testuint |
1141 |
|
|
1142 |
|
printf "checking for u_int64_t... " |
1143 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
1144 |
|
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1145 |
|
(int)sizeof(u_int64_t));return 0;}\n" > _testuint.c |
1146 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1147 |
|
if [ ! -x _testuint ]; then |
1148 |
|
rm -f _testuint* |
1149 |
|
printf "#include <stdio.h>\n#include <inttypes.h> |
1150 |
|
\n#include <sys/types.h>\nint main(int argc, char *argv[]) |
1151 |
|
{printf(\"%%i\\\n\", (int)sizeof(uint64_t));return 0;}\n" > _testuint.c |
1152 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1153 |
|
if [ ! -x _testuint ]; then |
1154 |
|
printf "no\n\nERROR: No u_int64_t or uint64_t. Aborting\n" |
1155 |
|
# TODO: Automagically detect using various combinations |
1156 |
|
# of char, int, short, long etc. |
1157 |
|
exit |
1158 |
|
fi |
1159 |
|
|
1160 |
|
printf "typedef uint64_t u_int64_t;\n" >> config.h |
1161 |
|
printf "uint64_t\n" |
1162 |
|
else |
1163 |
|
printf "yes\n" |
1164 |
|
fi |
1165 |
|
rm -f _testuint.c _testuint |
1166 |
|
|
1167 |
|
|
1168 |
############################################################################### |
############################################################################### |
1169 |
# |
# |
1232 |
|
|
1233 |
############################################################################### |
############################################################################### |
1234 |
|
|
1235 |
|
# Host byte order? |
1236 |
|
printf "checking host endianness... " |
1237 |
|
rm -f _test_end* |
1238 |
|
printf '#include <stdio.h> |
1239 |
|
int main(int argc, char *argv[]) |
1240 |
|
{ int x = 1; void *xp = (void *)&x; char *p = (char *)xp; |
1241 |
|
if (*p) printf("little\\\n"); else printf("big\\\n"); } |
1242 |
|
' > _test_end.c |
1243 |
|
$CC $CFLAGS _test_end.c -o _test_end 2> /dev/null |
1244 |
|
X=`./_test_end` |
1245 |
|
echo $X |
1246 |
|
if [ z$X = zlittle ]; then |
1247 |
|
printf "#define HOST_LITTLE_ENDIAN\n" >> config.h |
1248 |
|
else |
1249 |
|
if [ z$X = zbig ]; then |
1250 |
|
printf "#define HOST_BIG_ENDIAN\n" >> config.h |
1251 |
|
else |
1252 |
|
echo "Error! Could not determine host's endianness." |
1253 |
|
exit |
1254 |
|
fi |
1255 |
|
fi |
1256 |
|
rm -f _test_end* |
1257 |
|
|
1258 |
|
############################################################################### |
1259 |
|
|
1260 |
# Prefetch support? |
# Prefetch support? |
1261 |
printf "checking for asm prefetch support... " |
printf "checking for asm prefetch support... " |
1262 |
if [ z"`uname -m`" = zalpha ]; then |
if [ z"`uname -m`" = zalpha ]; then |
1286 |
INCLUDE=-Iinclude/ |
INCLUDE=-Iinclude/ |
1287 |
DINCLUDE=-I../include/ |
DINCLUDE=-I../include/ |
1288 |
|
|
1289 |
|
rm -f _testprog.c |
1290 |
|
|
1291 |
echo C compiler flags: $CFLAGS $CWARNINGS |
echo C compiler flags: $CFLAGS $CWARNINGS |
1292 |
echo Linker flags: $OTHERLIBS |
echo Linker flags: $OTHERLIBS |
1293 |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
1296 |
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
1297 |
echo "CC=$CC" >> _Makefile.header |
echo "CC=$CC" >> _Makefile.header |
1298 |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
1299 |
|
echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header |
1300 |
|
echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header |
1301 |
echo "" >> _Makefile.header |
echo "" >> _Makefile.header |
1302 |
|
|
1303 |
|
|
|
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 |
|
|
|
|
|
|
|
1304 |
# Create the Makefiles: |
# Create the Makefiles: |
1305 |
|
|
1306 |
for a in . src src/devices src/devices/fonts tests; do |
for a in . src src/cpus src/devices src/devices/fonts src/promemul; do |
1307 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1308 |
touch $a/Makefile |
touch $a/Makefile |
1309 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |