1 |
#!/bin/sh |
#!/bin/sh |
2 |
############################################################################### |
############################################################################### |
3 |
# |
# |
4 |
# Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
# Copyright (C) 2003-2006 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.170 2005/10/07 15:09:59 debug Exp $ |
# $Id: configure,v 1.226 2006/07/20 21:52:59 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 |
# |
53 |
# Alphas have it...) |
# |
54 |
# |
# The general philosophy regarding command line switches is that anything |
55 |
# TODO: |
# which can be incorporated into the program as a runtime command line option |
56 |
# o) do not enable prefetch on Alpha ev4 or ev5, only on pca56 and newer |
# should be, instead of requiring a recompile. |
|
# o) X11 libs and includes via command line options? |
|
57 |
# |
# |
58 |
############################################################################### |
############################################################################### |
59 |
|
|
61 |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
62 |
if [ z"$X" = z0. ]; then |
if [ z"$X" = z0. ]; then |
63 |
# Stable: |
# Stable: |
64 |
|
ENABLEALPHA=YES |
65 |
ENABLEARM=YES |
ENABLEARM=YES |
66 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
67 |
|
ENABLEPPC=YES |
68 |
else |
else |
69 |
# Development: |
# Development: |
70 |
|
UNSTABLE=YES |
71 |
ENABLEALPHA=YES |
ENABLEALPHA=YES |
72 |
ENABLEARM=YES |
ENABLEARM=YES |
73 |
ENABLEAVR=NO |
ENABLEAVR=YES |
74 |
ENABLEHPPA=NO |
ENABLEHPPA=YES |
75 |
ENABLEI960=NO |
ENABLEI960=YES |
76 |
ENABLEIA64=NO |
ENABLEIA64=YES |
77 |
ENABLEM68K=NO |
ENABLEM68K=YES |
78 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
79 |
ENABLEPPC=YES |
ENABLEPPC=YES |
80 |
ENABLESH=NO |
ENABLESH=YES |
81 |
ENABLESPARC=NO |
ENABLESPARC=YES |
82 |
ENABLEX86=NO |
ENABLETRANSPUTER=YES |
83 |
|
ENABLEX86=YES |
84 |
|
fi |
85 |
|
|
86 |
|
if [ z"$UNSTABLE" = zYES ]; then |
87 |
|
printf "###\n### DEVELOPMENT (UNSTABLE)\n###\n\n" |
88 |
fi |
fi |
89 |
|
|
90 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
92 |
for a in $*; do |
for a in $*; do |
93 |
if [ z$a = z--disable-x ]; then |
if [ z$a = z--disable-x ]; then |
94 |
NOX11=YES |
NOX11=YES |
|
else if [ z$a = z--always32 ]; then |
|
|
ALWAYS32=YES |
|
|
else if [ z$a = z--tracenull ]; then |
|
|
TRACENULL=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--enable-all ]; then |
|
|
ENABLEALPHA=YES |
|
|
ENABLEARM=YES |
|
|
ENABLEAVR=YES |
|
|
ENABLEHPPA=YES |
|
|
ENABLEI960=YES |
|
|
ENABLEIA64=YES |
|
|
ENABLEM68K=YES |
|
|
ENABLEMIPS=YES |
|
|
ENABLEPPC=YES |
|
|
ENABLESH=YES |
|
|
ENABLESPARC=YES |
|
|
ENABLEX86=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-avr ]; then |
|
|
ENABLEAVR=NO |
|
|
else if [ z$a = z--enable-avr ]; then |
|
|
ENABLEAVR=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-i960 ]; then |
|
|
ENABLEI960=NO |
|
|
else if [ z$a = z--enable-i960 ]; then |
|
|
ENABLEI960=YES |
|
|
else if [ z$a = z--disable-ia64 ]; then |
|
|
ENABLEIA64=NO |
|
|
else if [ z$a = z--enable-ia64 ]; then |
|
|
ENABLEIA64=YES |
|
|
else if [ z$a = z--disable-m68k ]; then |
|
|
ENABLEM68K=NO |
|
|
else if [ z$a = z--enable-m68k ]; then |
|
|
ENABLEM86K=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-sh ]; then |
|
|
ENABLESH=NO |
|
|
else if [ z$a = z--enable-sh ]; then |
|
|
ENABLESH=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-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 |
|
95 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
96 |
echo "usage: $0 [options]" |
printf "usage: $0 [options]\n\n" |
97 |
|
echo " --disable-x don't include X11 support,"\ |
98 |
printf "\nGeneral options:\n\n" |
"even if the host supports it" |
99 |
|
echo |
|
echo " --disable-bintrans configure without the" \ |
|
|
"old binary translation subsystem," |
|
|
echo " even if the host" \ |
|
|
"supports it" |
|
|
echo " --disable-x don't include X11 support" |
|
|
|
|
|
printf "\nDevelopment (debug) options:\n\n" |
|
|
|
|
|
echo " --always32 enable ALWAYS_SIGNEXTEND_32"\ |
|
|
"(for hunting down 32-bit bugs)" |
|
|
echo " --tracenull enable" \ |
|
|
"TRACE_NULL_CRASHES (for bug hunting)" |
|
|
printf " --enable-caches enable cache emulation" |
|
|
printf " (BUGGY)\n" |
|
|
echo " --enable-delays enable instruction" \ |
|
|
"latency/delay emulation" |
|
|
|
|
|
printf " --enable-all enable everything\n" |
|
|
|
|
|
if [ z$ENABLEALPHA = zYES ]; then |
|
|
printf " --disable-alpha disable " |
|
|
else |
|
|
printf " --enable-alpha enable " |
|
|
fi |
|
|
printf "Alpha CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEARM = zYES ]; then |
|
|
printf " --disable-arm disable " |
|
|
else |
|
|
printf " --enable-arm enable " |
|
|
fi |
|
|
printf "ARM CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEAVR = zYES ]; then |
|
|
printf " --disable-avr disable " |
|
|
else |
|
|
printf " --enable-avr enable " |
|
|
fi |
|
|
printf "Atmel AVR CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEHPPA = zYES ]; then |
|
|
printf " --disable-hppa disable " |
|
|
else |
|
|
printf " --enable-hppa enable " |
|
|
fi |
|
|
printf "HPPA CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEI960 = zYES ]; then |
|
|
printf " --disable-i960 disable " |
|
|
else |
|
|
printf " --enable-i960 enable " |
|
|
fi |
|
|
printf "i960 CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEIA64 = zYES ]; then |
|
|
printf " --disable-ia64 disable " |
|
|
else |
|
|
printf " --enable-ia64 enable " |
|
|
fi |
|
|
printf "IA64 CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEM68K = zYES ]; then |
|
|
printf " --disable-m68k disable " |
|
|
else |
|
|
printf " --enable-m68k enable " |
|
|
fi |
|
|
printf "M68K CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEMIPS = zYES ]; then |
|
|
printf " --disable-mips disable " |
|
|
else |
|
|
printf " --enable-mips enable " |
|
|
fi |
|
|
printf "MIPS CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEPPC = zYES ]; then |
|
|
printf " --disable-ppc disable " |
|
|
else |
|
|
printf " --enable-ppc enable " |
|
|
fi |
|
|
printf "POWER/PPC CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLESH = zYES ]; then |
|
|
printf " --disable-sh disable " |
|
|
else |
|
|
printf " --enable-sh enable " |
|
|
fi |
|
|
printf "SH CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLESPARC = zYES ]; then |
|
|
printf " --disable-sparc disable " |
|
|
else |
|
|
printf " --enable-sparc enable " |
|
|
fi |
|
|
printf "SPARC CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEX86 = zYES ]; then |
|
|
printf " --disable-x86 disable " |
|
|
else |
|
|
printf " --enable-x86 enable " |
|
|
fi |
|
|
printf "x86 CPU emulation\n" |
|
|
|
|
|
echo " --enable-mips16 enable MIPS16 support" |
|
|
|
|
|
printf "\n(Pretty much all of these options are only" |
|
|
printf " meaningful during the development of\nthe" |
|
|
printf " emulator, and should not be used when " |
|
|
printf "compiling a stable version.)\n" |
|
100 |
exit |
exit |
101 |
else |
else |
102 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
103 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
104 |
"available options." |
"available options." |
105 |
exit |
exit |
106 |
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; fi; fi; fi |
|
|
fi; fi; fi; fi; fi |
|
107 |
done |
done |
108 |
fi |
fi |
109 |
|
|
133 |
fi |
fi |
134 |
|
|
135 |
|
|
136 |
|
if [ z"$UNSTABLE" = zYES ]; then |
137 |
|
printf "#define UNSTABLE_DEVEL\n" >> config.h |
138 |
|
fi |
139 |
|
|
140 |
|
|
141 |
ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\`` |
ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\`` |
142 |
printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h |
printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h |
143 |
|
|
144 |
|
|
145 |
|
|
146 |
# 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 |
|
147 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
148 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ALPHA\n" >> config.h |
149 |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o memory_alpha.o" |
150 |
CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" |
CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" |
151 |
fi |
fi |
152 |
if [ z$ENABLEARM = zYES ]; then |
if [ z$ENABLEARM = zYES ]; then |
153 |
printf "#define ENABLE_ARM\n" >> config.h |
printf "#define ENABLE_ARM\n" >> config.h |
154 |
CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o " |
CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o " |
155 |
CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o" |
CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o tmp_arm_r.o" |
156 |
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_dpi" |
CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o" |
157 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o" |
158 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o" |
159 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o" |
160 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o" |
161 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o" |
162 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o" |
163 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o tmp_arm_multi.o" |
164 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r" |
165 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi" |
166 |
fi |
fi |
167 |
if [ z$ENABLEAVR = zYES ]; then |
if [ z$ENABLEAVR = zYES ]; then |
168 |
printf "#define ENABLE_AVR\n" >> config.h |
printf "#define ENABLE_AVR\n" >> config.h |
186 |
fi |
fi |
187 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
188 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
189 |
|
CPU_ARCHS="$CPU_ARCHS cpu_mips.o cpu_mips_coproc.o " |
190 |
|
CPU_ARCHS="$CPU_ARCHS cpu_mips_instr_unaligned.o" |
191 |
|
CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore" |
192 |
fi |
fi |
193 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
194 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
202 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
203 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
204 |
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" |
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" |
205 |
|
CPU_TOOLS="$CPU_TOOLS generate_sparc_loadstore" |
206 |
|
fi |
207 |
|
if [ z$ENABLETRANSPUTER = zYES ]; then |
208 |
|
printf "#define ENABLE_TRANSPUTER\n" >> config.h |
209 |
|
CPU_ARCHS="$CPU_ARCHS cpu_transputer.o" |
210 |
fi |
fi |
211 |
if [ z$ENABLEX86 = zYES ]; then |
if [ z$ENABLEX86 = zYES ]; then |
212 |
printf "#define ENABLE_X86\n" >> config.h |
printf "#define ENABLE_X86\n" >> config.h |
214 |
fi |
fi |
215 |
|
|
216 |
|
|
|
# Instruction delay/latency emulation: |
|
|
if [ z$DELAYS = zYES ]; then |
|
|
echo 'Enabling Instruction delay/latency emulation.' |
|
|
printf "#define ENABLE_INSTRUCTION_DELAYS\n" >> config.h |
|
|
fi |
|
|
|
|
|
|
|
|
# Development option: ALWAYS_SIGNEXTEND_32 |
|
|
if [ z$ALWAYS32 = zYES ]; then |
|
|
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
|
|
'This slows down everything.)' |
|
|
printf "#define ALWAYS_SIGNEXTEND_32\n" >> config.h |
|
|
fi |
|
|
|
|
|
|
|
|
# Development option: TRACE_NULL_CRASHES |
|
|
if [ z$TRACENULL = zYES ]; then |
|
|
echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \ |
|
|
'This slows down the emulator.)' |
|
|
printf "#define TRACE_NULL_CRASHES\n" >> config.h |
|
|
fi |
|
|
|
|
|
|
|
217 |
# Cache emulation: |
# Cache emulation: |
218 |
if [ z$CACHES = zYES ]; then |
if [ z$CACHES = zYES ]; then |
219 |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
echo 'Enabling Cache emulation. (EXPERIMENTAL and BUGGY)' |
220 |
printf "#define ENABLE_CACHE_EMULATION\n" >> config.h |
printf "#define ENABLE_CACHE_EMULATION\n" >> config.h |
221 |
|
|
|
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 |
|
|
|
|
222 |
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
223 |
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
224 |
fi |
fi |
560 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ z"$COMPAQCC" = zYES ]; then |
561 |
CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop" |
CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop" |
562 |
fi |
fi |
563 |
|
|
564 |
|
if [ z"$UNSTABLE" = zYES ]; then |
565 |
|
printf "checking whether -Werror can be used... " |
566 |
|
rm -f _testprog |
567 |
|
$CC $CFLAGS $CWARNINGS _testprog.c -o _testprog -Werror 2> /dev/null |
568 |
|
if [ -x _testprog ]; then |
569 |
|
printf "yes\n" |
570 |
|
CWARNINGS="$CWARNINGS -Werror" |
571 |
|
else |
572 |
|
printf "no\n" |
573 |
|
fi |
574 |
|
fi |
575 |
else |
else |
576 |
printf "no\n" |
printf "no\n" |
577 |
fi |
fi |
579 |
|
|
580 |
|
|
581 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ z"$COMPAQCC" = zYES ]; then |
582 |
# -O4 is possible, but is -O3 better? |
# -O4 is possible, but sometimes -O3 is better? |
583 |
CFLAGS="-O4 $CFLAGS" |
CFLAGS="-O4 $CFLAGS" |
584 |
else |
else |
585 |
if [ z"`uname`" = zSunOS ]; then |
if [ z"`uname`" = zSunOS ]; then |
594 |
$CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null |
$CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null |
595 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
596 |
rm -f _testprog |
rm -f _testprog |
597 |
$CC $CFLAGS _testprog.c -o _testprog -O2 2> /dev/null |
$CC $CFLAGS _testprog.c -o _testprog -O3 2> /dev/null |
598 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
599 |
CFLAGS="-O2 $CFLAGS" |
CFLAGS="-O3 $CFLAGS" |
600 |
else |
else |
601 |
CFLAGS="-O $CFLAGS" |
CFLAGS="-O $CFLAGS" |
602 |
fi |
fi |
684 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
685 |
|
|
686 |
|
|
687 |
|
# -g |
688 |
|
printf "checking whether -g can be used... " |
689 |
|
if [ z"$COMPAQCC" = zYES ]; then |
690 |
|
printf "skipping\n" |
691 |
|
else |
692 |
|
$CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1 |
693 |
|
cat _testprog.stdout >> _testprog.error |
694 |
|
if [ -x _testprog ]; then |
695 |
|
CFLAGS="-g $CFLAGS" |
696 |
|
printf "yes\n" |
697 |
|
else |
698 |
|
printf "no\n" |
699 |
|
fi |
700 |
|
fi |
701 |
|
rm -f _testprog _testprog.error _testprog.stdout |
702 |
|
|
703 |
|
|
704 |
# -lrt for nanosleep? |
# -lrt for nanosleep? |
705 |
printf "checking whether -lrt is required for nanosleep... " |
printf "checking whether -lrt is required for nanosleep... " |
706 |
printf "#include <time.h>\n#include <stdio.h> |
printf "#include <time.h>\n#include <stdio.h> |
835 |
#include <stdio.h> |
#include <stdio.h> |
836 |
#include <sys/types.h> |
#include <sys/types.h> |
837 |
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 |
838 |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
$CC $CFLAGS $CWARNINGS _tests.c -o _tests 2> /dev/null |
839 |
if [ ! -x _tests ]; then |
if [ ! -x _tests ]; then |
840 |
printf "missing\n" |
# Try with _LARGEFILE_SOURCE (hack to make fseeko |
841 |
printf "WARNING! fseeko missing from libc. Using a hack, " |
# work on 64-bit Linux): |
842 |
printf "which probably doesn't work.\n" |
$CC $CFLAGS -D_LARGEFILE_SOURCE $CWARNINGS _tests.c -o _tests 2> /dev/null |
843 |
printf "#define HACK_FSEEKO\n" >> config.h |
if [ ! -x _tests ]; then |
844 |
|
printf "missing\n" |
845 |
|
printf "WARNING! fseeko missing from libc. Using a hack, " |
846 |
|
printf "which probably doesn't work.\n" |
847 |
|
printf "#define HACK_FSEEKO\n" >> config.h |
848 |
|
else |
849 |
|
printf "using -D_LARGEFILE_SOURCE hack\n" |
850 |
|
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE" |
851 |
|
fi |
852 |
else |
else |
853 |
printf "found\n" |
printf "found\n" |
854 |
fi |
fi |
905 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
906 |
|
|
907 |
|
|
908 |
|
# Check for PRIx64 in inttypes.h: |
909 |
|
printf "checking for PRIx64 in inttypes.h... " |
910 |
|
printf "#include <inttypes.h>\nint main(int argc, char *argv[])\n |
911 |
|
{\n#ifdef PRIx64\nreturn 0;\n#else\nreturn 1;\n#endif\n}\n" > _testpri.c |
912 |
|
$CC $CFLAGS _testpri.c -o _testpri 2> /dev/null |
913 |
|
if [ ! -x _testpri ]; then |
914 |
|
printf "\nERROR! COULD NOT COMPILE PRIx64 TEST PROGRAM AT ALL!\n" |
915 |
|
exit |
916 |
|
else |
917 |
|
if ./_testpri; then |
918 |
|
printf "yes\n" |
919 |
|
else |
920 |
|
printf "no, using an ugly hack instead, " |
921 |
|
printf "#define NO_C99_PRINTF_DEFINES\n" >> config.h |
922 |
|
|
923 |
|
# Try llx first: |
924 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){ |
925 |
|
printf(\"%%llx\\\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=llx\n" |
930 |
|
printf "#define NO_C99_64BIT_LONGLONG\n" >> config.h |
931 |
|
else |
932 |
|
# Try lx too: |
933 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){ |
934 |
|
printf(\"%%lx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c |
935 |
|
rm -f _testpri |
936 |
|
$CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null |
937 |
|
if [ z`./_testpri` = z80 ]; then |
938 |
|
printf "PRIx64=lx\n" |
939 |
|
else |
940 |
|
printf "\nFailed, neither lx nor llx worked!\n" |
941 |
|
exit |
942 |
|
fi |
943 |
|
fi |
944 |
|
fi |
945 |
|
fi |
946 |
|
rm -f _testpri.c _testpri |
947 |
|
|
948 |
|
|
949 |
# Check for 64-bit off_t: |
# Check for 64-bit off_t: |
950 |
printf "checking for 64-bit off_t... " |
printf "checking for 64-bit off_t... " |
951 |
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 |
1037 |
|
|
1038 |
|
|
1039 |
############################################################################### |
############################################################################### |
|
# |
|
|
# Dynamic binary translation (BINTRANS): |
|
|
# |
|
|
############################################################################### |
|
|
|
|
|
printf "checking for bintrans backend... " |
|
|
|
|
|
BINTRANS=NO |
|
|
|
|
|
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 |
|
|
|
|
|
# # 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 |
|
|
|
|
|
if [ z$BINTRANS = zNO ]; then |
|
|
printf "not supported yet on this arch\n" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
############################################################################### |
|
1040 |
|
|
1041 |
# Host byte order? |
# Host byte order? |
1042 |
printf "checking host endianness... " |
printf "checking host endianness... " |
1063 |
|
|
1064 |
############################################################################### |
############################################################################### |
1065 |
|
|
|
# Prefetch support? |
|
|
printf "checking for asm prefetch support... " |
|
|
if [ z"`uname -m`" = zalpha ]; then |
|
|
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" |
|
|
fi |
|
|
|
|
|
|
|
|
############################################################################### |
|
|
|
|
1066 |
INCLUDE=-Iinclude/ |
INCLUDE=-Iinclude/ |
1067 |
DINCLUDE=-I../include/ |
DINCLUDE=-I../include/ |
1068 |
|
|
1082 |
|
|
1083 |
|
|
1084 |
# Create the Makefiles: |
# Create the Makefiles: |
1085 |
|
D=". src src/include src/cpus src/debugger src/devices src/devices/fonts" |
1086 |
for a in . src src/cpus src/devices src/devices/fonts src/promemul; do |
D="$D src/machines src/promemul doc" |
1087 |
|
for a in $D; do |
1088 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1089 |
touch $a/Makefile |
touch $a/Makefile |
1090 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |