27 |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
28 |
# |
# |
29 |
# |
# |
30 |
# $Id: configure,v 1.134 2005/06/11 20:59:10 debug Exp $ |
# $Id: configure,v 1.180 2005/11/23 22:03:23 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 |
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 |
ENABLEARM=YES |
66 |
ENABLESPARC=NO |
ENABLEMIPS=YES |
67 |
ENABLEURISC=YES |
ENABLEPPC=YES |
68 |
ENABLEX86=NO |
else |
69 |
STABLE=YES |
# Development: |
70 |
|
ENABLEALPHA=YES |
71 |
|
ENABLEARM=YES |
72 |
|
ENABLEAVR=NO |
73 |
|
ENABLEHPPA=NO |
74 |
|
ENABLEI960=NO |
75 |
|
ENABLEIA64=NO |
76 |
|
ENABLEM68K=NO |
77 |
|
ENABLEMIPS=YES |
78 |
|
ENABLENEWMIPS=NO |
79 |
|
ENABLEPPC=YES |
80 |
|
ENABLESH=NO |
81 |
|
ENABLESPARC=NO |
82 |
|
ENABLEX86=NO |
83 |
|
fi |
84 |
|
|
85 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
86 |
# Parse command line options: |
# Parse command line options: |
99 |
MIPS16=NO |
MIPS16=NO |
100 |
else if [ z$a = z--enable-mips16 ]; then |
else if [ z$a = z--enable-mips16 ]; then |
101 |
MIPS16=YES |
MIPS16=YES |
102 |
|
else if [ z$a = z--enable-all ]; then |
103 |
|
ENABLEALPHA=YES |
104 |
|
ENABLEARM=YES |
105 |
|
ENABLEAVR=YES |
106 |
|
ENABLEHPPA=YES |
107 |
|
ENABLEI960=YES |
108 |
|
ENABLEIA64=YES |
109 |
|
ENABLEM68K=YES |
110 |
|
ENABLEMIPS=YES |
111 |
|
ENABLENEWMIPS=YES |
112 |
|
ENABLEPPC=YES |
113 |
|
ENABLESH=YES |
114 |
|
ENABLESPARC=YES |
115 |
|
ENABLEX86=YES |
116 |
else if [ z$a = z--disable-alpha ]; then |
else if [ z$a = z--disable-alpha ]; then |
117 |
ENABLEALPHA=NO |
ENABLEALPHA=NO |
118 |
else if [ z$a = z--enable-alpha ]; then |
else if [ z$a = z--enable-alpha ]; then |
121 |
ENABLEARM=NO |
ENABLEARM=NO |
122 |
else if [ z$a = z--enable-arm ]; then |
else if [ z$a = z--enable-arm ]; then |
123 |
ENABLEARM=YES |
ENABLEARM=YES |
124 |
|
else if [ z$a = z--disable-avr ]; then |
125 |
|
ENABLEAVR=NO |
126 |
|
else if [ z$a = z--enable-avr ]; then |
127 |
|
ENABLEAVR=YES |
128 |
else if [ z$a = z--disable-hppa ]; then |
else if [ z$a = z--disable-hppa ]; then |
129 |
ENABLEHPPA=NO |
ENABLEHPPA=NO |
130 |
else if [ z$a = z--enable-hppa ]; then |
else if [ z$a = z--enable-hppa ]; then |
131 |
ENABLEHPPA=YES |
ENABLEHPPA=YES |
132 |
|
else if [ z$a = z--disable-i960 ]; then |
133 |
|
ENABLEI960=NO |
134 |
|
else if [ z$a = z--enable-i960 ]; then |
135 |
|
ENABLEI960=YES |
136 |
|
else if [ z$a = z--disable-ia64 ]; then |
137 |
|
ENABLEIA64=NO |
138 |
|
else if [ z$a = z--enable-ia64 ]; then |
139 |
|
ENABLEIA64=YES |
140 |
|
else if [ z$a = z--disable-m68k ]; then |
141 |
|
ENABLEM68K=NO |
142 |
|
else if [ z$a = z--enable-m68k ]; then |
143 |
|
ENABLEM86K=YES |
144 |
else if [ z$a = z--disable-mips ]; then |
else if [ z$a = z--disable-mips ]; then |
145 |
ENABLEMIPS=NO |
ENABLEMIPS=NO |
146 |
else if [ z$a = z--enable-mips ]; then |
else if [ z$a = z--enable-mips ]; then |
147 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
148 |
|
else if [ z$a = z--disable-newmips ]; then |
149 |
|
ENABLENEWMIPS=NO |
150 |
|
else if [ z$a = z--enable-newmips ]; then |
151 |
|
ENABLENEWMIPS=YES |
152 |
else if [ z$a = z--disable-ppc ]; then |
else if [ z$a = z--disable-ppc ]; then |
153 |
ENABLEPPC=NO |
ENABLEPPC=NO |
154 |
else if [ z$a = z--enable-ppc ]; then |
else if [ z$a = z--enable-ppc ]; then |
155 |
ENABLEPPC=YES |
ENABLEPPC=YES |
156 |
|
else if [ z$a = z--disable-sh ]; then |
157 |
|
ENABLESH=NO |
158 |
|
else if [ z$a = z--enable-sh ]; then |
159 |
|
ENABLESH=YES |
160 |
else if [ z$a = z--disable-sparc ]; then |
else if [ z$a = z--disable-sparc ]; then |
161 |
ENABLESPARC=NO |
ENABLESPARC=NO |
162 |
else if [ z$a = z--enable-sparc ]; then |
else if [ z$a = z--enable-sparc ]; then |
163 |
ENABLESPARC=YES |
ENABLESPARC=YES |
|
else if [ z$a = z--disable-urisc ]; then |
|
|
ENABLEURISC=NO |
|
|
else if [ z$a = z--enable-urisc ]; then |
|
|
ENABLEURISC=YES |
|
164 |
else if [ z$a = z--disable-x86 ]; then |
else if [ z$a = z--disable-x86 ]; then |
165 |
ENABLEX86=NO |
ENABLEX86=NO |
166 |
else if [ z$a = z--enable-x86 ]; then |
else if [ z$a = z--enable-x86 ]; then |
175 |
CACHES=YES |
CACHES=YES |
176 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
177 |
echo "usage: $0 [options]" |
echo "usage: $0 [options]" |
178 |
printf "\nDevelopment (debug) options:\n" |
|
179 |
echo " --always32 enable" \ |
printf "\nGeneral options:\n\n" |
180 |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
|
181 |
echo " 32/64-bit bugs)" |
echo " --disable-bintrans configure without the" \ |
182 |
|
"old binary translation subsystem," |
183 |
|
echo " even if the host" \ |
184 |
|
"supports it" |
185 |
|
echo " --disable-x don't include X11 support" |
186 |
|
|
187 |
|
printf "\nDevelopment (debug) options:\n\n" |
188 |
|
|
189 |
|
echo " --always32 enable ALWAYS_SIGNEXTEND_32"\ |
190 |
|
"(for hunting down 32-bit bugs)" |
191 |
echo " --tracenull enable" \ |
echo " --tracenull enable" \ |
192 |
"TRACE_NULL_CRASHES (for bug hunting)" |
"TRACE_NULL_CRASHES (for bug hunting)" |
|
printf "\nGeneral options:\n" |
|
|
echo " --disable-bintrans configure without" \ |
|
|
"bintrans, even if the host supports it" |
|
193 |
printf " --enable-caches enable cache emulation" |
printf " --enable-caches enable cache emulation" |
194 |
printf " (BUGGY)\n" |
printf " (BUGGY)\n" |
195 |
echo " --enable-delays enable instruction" \ |
echo " --enable-delays enable instruction" \ |
196 |
"latency/delay emulation" |
"latency/delay emulation" |
197 |
echo " --disable-x don't include X11 support" |
|
198 |
printf "\nCPU selection options:\n" |
printf " --enable-all enable everything\n" |
199 |
if [ z$STABLE = zNO ]; then |
|
200 |
printf " --enable-alpha " |
if [ z$ENABLEALPHA = zYES ]; then |
201 |
printf "enable Alpha CPU emulation" |
printf " --disable-alpha disable " |
202 |
printf " (NOT YET)\n" |
else |
203 |
printf " --enable-arm " |
printf " --enable-alpha enable " |
204 |
printf "enable ARM CPU emulation" |
fi |
205 |
printf " (NOT YET)\n" |
printf "Alpha CPU emulation\n" |
206 |
printf " --enable-hppa " |
|
207 |
printf "enable HPPA CPU emulation" |
if [ z$ENABLEARM = zYES ]; then |
208 |
printf " (NOT YET)\n" |
printf " --disable-arm disable " |
209 |
|
else |
210 |
|
printf " --enable-arm enable " |
211 |
|
fi |
212 |
|
printf "ARM CPU emulation\n" |
213 |
|
|
214 |
|
if [ z$ENABLEAVR = zYES ]; then |
215 |
|
printf " --disable-avr disable " |
216 |
|
else |
217 |
|
printf " --enable-avr enable " |
218 |
|
fi |
219 |
|
printf "Atmel AVR CPU emulation\n" |
220 |
|
|
221 |
|
if [ z$ENABLEHPPA = zYES ]; then |
222 |
|
printf " --disable-hppa disable " |
223 |
|
else |
224 |
|
printf " --enable-hppa enable " |
225 |
|
fi |
226 |
|
printf "HPPA CPU emulation\n" |
227 |
|
|
228 |
|
if [ z$ENABLEI960 = zYES ]; then |
229 |
|
printf " --disable-i960 disable " |
230 |
|
else |
231 |
|
printf " --enable-i960 enable " |
232 |
|
fi |
233 |
|
printf "i960 CPU emulation\n" |
234 |
|
|
235 |
|
if [ z$ENABLEIA64 = zYES ]; then |
236 |
|
printf " --disable-ia64 disable " |
237 |
|
else |
238 |
|
printf " --enable-ia64 enable " |
239 |
|
fi |
240 |
|
printf "IA64 CPU emulation\n" |
241 |
|
|
242 |
|
if [ z$ENABLEM68K = zYES ]; then |
243 |
|
printf " --disable-m68k disable " |
244 |
|
else |
245 |
|
printf " --enable-m68k enable " |
246 |
|
fi |
247 |
|
printf "M68K CPU emulation\n" |
248 |
|
|
249 |
|
if [ z$ENABLEMIPS = zYES ]; then |
250 |
|
printf " --disable-mips disable " |
251 |
|
else |
252 |
|
printf " --enable-mips enable " |
253 |
|
fi |
254 |
|
printf "MIPS CPU emulation\n" |
255 |
|
|
256 |
|
if [ z$ENABLENEWMIPS = zYES ]; then |
257 |
|
printf " --disable-newmips disable " |
258 |
|
else |
259 |
|
printf " --enable-newmips enable " |
260 |
|
fi |
261 |
|
printf "(New, dyntrans) MIPS CPU emulation\n" |
262 |
|
|
263 |
|
if [ z$ENABLEPPC = zYES ]; then |
264 |
|
printf " --disable-ppc disable " |
265 |
|
else |
266 |
|
printf " --enable-ppc enable " |
267 |
|
fi |
268 |
|
printf "POWER/PPC CPU emulation\n" |
269 |
|
|
270 |
|
if [ z$ENABLESH = zYES ]; then |
271 |
|
printf " --disable-sh disable " |
272 |
|
else |
273 |
|
printf " --enable-sh enable " |
274 |
fi |
fi |
275 |
echo " --disable-mips disable MIPS CPU emulation" |
printf "SH CPU emulation\n" |
276 |
echo " --disable-ppc disable PPC CPU emulation" |
|
277 |
if [ z$STABLE = zNO ]; then |
if [ z$ENABLESPARC = zYES ]; then |
278 |
printf " --enable-sparc " |
printf " --disable-sparc disable " |
279 |
printf "enable SPARC CPU emulation" |
else |
280 |
printf " (NOT YET)\n" |
printf " --enable-sparc enable " |
281 |
fi |
fi |
282 |
echo " --disable-urisc disable URISC CPU emulation" |
printf "SPARC CPU emulation\n" |
283 |
if [ z$STABLE = zNO ]; then |
|
284 |
printf " --enable-x86 " |
if [ z$ENABLEX86 = zYES ]; then |
285 |
printf "enable x86 CPU emulation" |
printf " --disable-x86 disable " |
286 |
printf " (NOT YET)\n" |
else |
287 |
|
printf " --enable-x86 enable " |
288 |
fi |
fi |
289 |
printf "\nMIPS-specific options:\n" |
printf "x86 CPU emulation\n" |
290 |
printf " --enable-mips16 enable MIPS16 instruction" |
|
291 |
printf " support (NOT YET)\n\n" |
echo " --enable-mips16 enable MIPS16 support" |
292 |
|
|
293 |
|
printf "\n(Pretty much all of these options are only" |
294 |
|
printf " meaningful during the development of\nthe" |
295 |
|
printf " emulator, and should not be used when " |
296 |
|
printf "compiling a stable version.)\n" |
297 |
exit |
exit |
298 |
else |
else |
299 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
300 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
301 |
"available options." |
"available options." |
302 |
exit |
exit |
303 |
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; fi |
304 |
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 |
305 |
|
fi; fi; fi; fi; fi; fi; fi |
306 |
done |
done |
307 |
fi |
fi |
308 |
|
|
326 |
# Figure out if VERSION should be defined. |
# Figure out if VERSION should be defined. |
327 |
X=`basename \`pwd\`|cut -d \- -f 2-` |
X=`basename \`pwd\`|cut -d \- -f 2-` |
328 |
if [ z"$X" = zgxemul ]; then |
if [ z"$X" = zgxemul ]; then |
329 |
echo '# No VERSION defined.' >> _Makefile.header |
echo '/* No VERSION defined. */' >> config.h |
330 |
else |
else |
331 |
printf "#define VERSION \"$X\"\n" >> config.h |
printf "#define VERSION \"$X\"\n" >> config.h |
332 |
fi |
fi |
345 |
fi |
fi |
346 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
347 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ALPHA\n" >> config.h |
348 |
if [ z$STABLE = zNO ]; then |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" |
349 |
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 |
|
350 |
fi |
fi |
351 |
if [ z$ENABLEARM = zYES ]; then |
if [ z$ENABLEARM = zYES ]; then |
352 |
printf "#define ENABLE_ARM\n" >> config.h |
printf "#define ENABLE_ARM\n" >> config.h |
353 |
if [ z$STABLE = zNO ]; then |
CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o " |
354 |
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" |
355 |
printf " implemented yet.\n\n" |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o" |
356 |
else |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o" |
357 |
printf "Not in the stable release.\n" |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o" |
358 |
exit |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o" |
359 |
fi |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o" |
360 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o" |
361 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o" |
362 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o tmp_arm_multi.o" |
363 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r" |
364 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi" |
365 |
|
fi |
366 |
|
if [ z$ENABLEAVR = zYES ]; then |
367 |
|
printf "#define ENABLE_AVR\n" >> config.h |
368 |
|
CPU_ARCHS="$CPU_ARCHS cpu_avr.o" |
369 |
fi |
fi |
370 |
if [ z$ENABLEHPPA = zYES ]; then |
if [ z$ENABLEHPPA = zYES ]; then |
371 |
printf "#define ENABLE_HPPA\n" >> config.h |
printf "#define ENABLE_HPPA\n" >> config.h |
372 |
if [ z$STABLE = zNO ]; then |
CPU_ARCHS="$CPU_ARCHS cpu_hppa.o" |
373 |
printf "\nWARNING: HPPA emulation enabled, but it isn't really" |
fi |
374 |
printf " implemented yet.\n\n" |
if [ z$ENABLEI960 = zYES ]; then |
375 |
else |
printf "#define ENABLE_I960\n" >> config.h |
376 |
printf "Not in the stable release.\n" |
CPU_ARCHS="$CPU_ARCHS cpu_i960.o" |
377 |
exit |
fi |
378 |
fi |
if [ z$ENABLEIA64 = zYES ]; then |
379 |
|
printf "#define ENABLE_IA64\n" >> config.h |
380 |
|
CPU_ARCHS="$CPU_ARCHS cpu_ia64.o" |
381 |
|
fi |
382 |
|
if [ z$ENABLEM68K = zYES ]; then |
383 |
|
printf "#define ENABLE_M68K\n" >> config.h |
384 |
|
CPU_ARCHS="$CPU_ARCHS cpu_m68k.o" |
385 |
fi |
fi |
386 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
387 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
388 |
fi |
fi |
389 |
|
if [ z$ENABLENEWMIPS = zYES ]; then |
390 |
|
printf "#define ENABLE_NEWMIPS\n" >> config.h |
391 |
|
CPU_ARCHS="$CPU_ARCHS cpu_newmips.o" |
392 |
|
fi |
393 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
394 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
395 |
|
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
396 |
|
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
397 |
|
fi |
398 |
|
if [ z$ENABLESH = zYES ]; then |
399 |
|
printf "#define ENABLE_SH\n" >> config.h |
400 |
|
CPU_ARCHS="$CPU_ARCHS cpu_sh.o" |
401 |
fi |
fi |
402 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
403 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
404 |
if [ z$STABLE = zNO ]; then |
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" |
|
printf "\nWARNING: SPARC emulation enabled, but it isn't really" |
|
|
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 |
|
405 |
fi |
fi |
406 |
if [ z$ENABLEX86 = zYES ]; then |
if [ z$ENABLEX86 = zYES ]; then |
407 |
printf "#define ENABLE_X86\n" >> config.h |
printf "#define ENABLE_X86\n" >> config.h |
408 |
if [ z$STABLE = zNO ]; then |
CPU_ARCHS="$CPU_ARCHS cpu_x86.o" |
|
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 |
|
409 |
fi |
fi |
410 |
|
|
411 |
|
|
523 |
fi |
fi |
524 |
rm -f _testprog |
rm -f _testprog |
525 |
|
|
526 |
# Try ccc (FreeBSD/Alpha): |
# # Try ccc (FreeBSD/Alpha): |
527 |
printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
# printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
528 |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
# printf " /dev/null 2> /dev/null\n" >> _test.sh |
529 |
chmod 755 _test.sh |
# chmod 755 _test.sh |
530 |
./_test.sh > /dev/null 2> /dev/null |
# ./_test.sh > /dev/null 2> /dev/null |
531 |
if [ -x _testprog ]; then |
# if [ -x _testprog ]; then |
532 |
CC="ccc" |
# CC="ccc" |
533 |
fi |
# fi |
534 |
rm -f _testprog |
# rm -f _testprog |
535 |
|
|
536 |
rm -f _test.sh |
rm -f _test.sh |
537 |
fi |
fi |
646 |
fi |
fi |
647 |
|
|
648 |
|
|
649 |
# Check for weird 'alpha' define. |
# Check for 'alpha' define. |
650 |
printf "checking for weird 'alpha' define... " |
printf "checking for 'alpha' define... " |
651 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
652 |
#ifdef alpha |
#ifdef alpha |
653 |
printf(\"1\"); |
printf(\"1\"); |
677 |
rm -f _testm* |
rm -f _testm* |
678 |
|
|
679 |
|
|
|
# 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* |
|
|
|
|
|
|
|
680 |
# 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) |
681 |
printf "checking for weird 'mips' define... " |
printf "checking for 'mips' define... " |
682 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
683 |
#ifdef mips |
#ifdef mips |
684 |
printf(\"1\"); |
printf(\"1\"); |
710 |
|
|
711 |
# 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 |
712 |
# any OS actually defined ppc like this. |
# any OS actually defined ppc like this. |
713 |
printf "checking for weird 'ppc' define... " |
printf "checking for 'ppc' define... " |
714 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
715 |
#ifdef ppc |
#ifdef ppc |
716 |
printf(\"1\"); |
printf(\"1\"); |
742 |
|
|
743 |
# 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 |
744 |
# any OS actually defined sparc like this. |
# any OS actually defined sparc like this. |
745 |
printf "checking for weird 'sparc' define... " |
printf "checking for 'sparc' define... " |
746 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
747 |
#ifdef sparc |
#ifdef sparc |
748 |
printf(\"1\"); |
printf(\"1\"); |
975 |
rm -f _testr.[co] _testr |
rm -f _testr.[co] _testr |
976 |
|
|
977 |
|
|
978 |
|
# strlcpy missing? |
979 |
|
printf "checking for strlcpy... " |
980 |
|
printf "#include <string.h> |
981 |
|
int main(int argc, char *argv[]) { char *p; char *q; size_t x; |
982 |
|
x = strlcpy(p, q, 50); return 0;}\n" > _tests.c |
983 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
984 |
|
if [ ! -x _tests ]; then |
985 |
|
printf "missing, using mystrlcpy\n" |
986 |
|
printf "#define strlcpy mystrlcpy\n" >> config.h |
987 |
|
printf "#define strlcat mystrlcat\n" >> config.h |
988 |
|
printf "#define USE_STRLCPY_REPLACEMENTS\n" >> config.h |
989 |
|
else |
990 |
|
printf "found\n" |
991 |
|
fi |
992 |
|
rm -f _tests.[co] _tests |
993 |
|
|
994 |
|
|
995 |
# strtoull missing? |
# strtoull missing? |
996 |
printf "checking for strtoull... " |
printf "checking for strtoull... " |
997 |
printf "#include <stdlib.h> |
printf "#include <stdlib.h> |
1128 |
|
|
1129 |
|
|
1130 |
# Check for u_int8_t etc: |
# Check for u_int8_t etc: |
1131 |
|
# These are needed because some header files in src/include/ use u_int* |
1132 |
|
# instead of uint*, and I don't have time to rewrite them all. |
1133 |
printf "checking for u_int8_t... " |
printf "checking for u_int8_t... " |
1134 |
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 |
1135 |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1151 |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
1152 |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
1153 |
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 |
|
1154 |
printf "uint8_t\n" |
printf "uint8_t\n" |
1155 |
else |
else |
1156 |
printf "yes\n" |
printf "yes\n" |
1157 |
fi |
fi |
1158 |
rm -f _testuint.c _testuint |
rm -f _testuint.c _testuint |
1159 |
|
|
1160 |
|
printf "checking for u_int64_t... " |
1161 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
1162 |
|
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1163 |
|
(int)sizeof(u_int64_t));return 0;}\n" > _testuint.c |
1164 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1165 |
|
if [ ! -x _testuint ]; then |
1166 |
|
rm -f _testuint* |
1167 |
|
printf "#include <stdio.h>\n#include <inttypes.h> |
1168 |
|
\n#include <sys/types.h>\nint main(int argc, char *argv[]) |
1169 |
|
{printf(\"%%i\\\n\", (int)sizeof(uint64_t));return 0;}\n" > _testuint.c |
1170 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1171 |
|
if [ ! -x _testuint ]; then |
1172 |
|
printf "no\n\nERROR: No u_int64_t or uint64_t. Aborting\n" |
1173 |
|
# TODO: Automagically detect using various combinations |
1174 |
|
# of char, int, short, long etc. |
1175 |
|
exit |
1176 |
|
fi |
1177 |
|
|
1178 |
|
printf "typedef uint64_t u_int64_t;\n" >> config.h |
1179 |
|
printf "uint64_t\n" |
1180 |
|
else |
1181 |
|
printf "yes\n" |
1182 |
|
fi |
1183 |
|
rm -f _testuint.c _testuint |
1184 |
|
|
1185 |
|
|
1186 |
############################################################################### |
############################################################################### |
1187 |
# |
# |
1250 |
|
|
1251 |
############################################################################### |
############################################################################### |
1252 |
|
|
1253 |
|
# Host byte order? |
1254 |
|
printf "checking host endianness... " |
1255 |
|
rm -f _test_end* |
1256 |
|
printf '#include <stdio.h> |
1257 |
|
int main(int argc, char *argv[]) |
1258 |
|
{ int x = 1; void *xp = (void *)&x; char *p = (char *)xp; |
1259 |
|
if (*p) printf("little\\\n"); else printf("big\\\n"); } |
1260 |
|
' > _test_end.c |
1261 |
|
$CC $CFLAGS _test_end.c -o _test_end 2> /dev/null |
1262 |
|
X=`./_test_end` |
1263 |
|
echo $X |
1264 |
|
if [ z$X = zlittle ]; then |
1265 |
|
printf "#define HOST_LITTLE_ENDIAN\n" >> config.h |
1266 |
|
else |
1267 |
|
if [ z$X = zbig ]; then |
1268 |
|
printf "#define HOST_BIG_ENDIAN\n" >> config.h |
1269 |
|
else |
1270 |
|
echo "Error! Could not determine host's endianness." |
1271 |
|
exit |
1272 |
|
fi |
1273 |
|
fi |
1274 |
|
rm -f _test_end* |
1275 |
|
|
1276 |
|
############################################################################### |
1277 |
|
|
1278 |
# Prefetch support? |
# Prefetch support? |
1279 |
printf "checking for asm prefetch support... " |
printf "checking for asm prefetch support... " |
1280 |
if [ z"`uname -m`" = zalpha ]; then |
if [ z"`uname -m`" = zalpha ]; then |
1304 |
INCLUDE=-Iinclude/ |
INCLUDE=-Iinclude/ |
1305 |
DINCLUDE=-I../include/ |
DINCLUDE=-I../include/ |
1306 |
|
|
1307 |
|
rm -f _testprog.c |
1308 |
|
|
1309 |
echo C compiler flags: $CFLAGS $CWARNINGS |
echo C compiler flags: $CFLAGS $CWARNINGS |
1310 |
echo Linker flags: $OTHERLIBS |
echo Linker flags: $OTHERLIBS |
1311 |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
1314 |
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
1315 |
echo "CC=$CC" >> _Makefile.header |
echo "CC=$CC" >> _Makefile.header |
1316 |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
1317 |
|
echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header |
1318 |
|
echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header |
1319 |
echo "" >> _Makefile.header |
echo "" >> _Makefile.header |
1320 |
|
|
1321 |
|
|
|
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 |
|
|
|
|
|
|
|
1322 |
# Create the Makefiles: |
# Create the Makefiles: |
1323 |
|
D=". src src/include src/cpus src/devices src/devices/fonts src/promemul" |
1324 |
for a in . src src/devices src/devices/fonts tests; do |
for a in $D; do |
1325 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1326 |
touch $a/Makefile |
touch $a/Makefile |
1327 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |