27 |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
28 |
# |
# |
29 |
# |
# |
30 |
# $Id: configure,v 1.119 2005/03/14 12:13:49 debug Exp $ |
# $Id: configure,v 1.134 2005/06/11 20:59:10 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 |
54 |
# |
# |
55 |
############################################################################### |
############################################################################### |
56 |
|
|
57 |
ENABLEALPHA=YES |
ENABLEALPHA=NO |
58 |
ENABLEHPPA=YES |
ENABLEARM=NO |
59 |
|
ENABLEHPPA=NO |
60 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
61 |
ENABLEPPC=YES |
ENABLEPPC=YES |
62 |
ENABLESPARC=YES |
ENABLESPARC=NO |
63 |
ENABLEURISC=YES |
ENABLEURISC=YES |
64 |
|
ENABLEX86=NO |
65 |
|
STABLE=YES |
66 |
|
|
67 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
68 |
# Parse command line options: |
# Parse command line options: |
71 |
NOX11=YES |
NOX11=YES |
72 |
else if [ z$a = z--always32 ]; then |
else if [ z$a = z--always32 ]; then |
73 |
ALWAYS32=YES |
ALWAYS32=YES |
74 |
|
else if [ z$a = z--tracenull ]; then |
75 |
|
TRACENULL=YES |
76 |
else if [ z$a = z--disable-bintrans ]; then |
else if [ z$a = z--disable-bintrans ]; then |
77 |
NOBINTRANS=YES |
NOBINTRANS=YES |
78 |
|
else if [ z$a = z--enable-bintrans ]; then |
79 |
|
NOBINTRANS=NO |
80 |
|
else if [ z$a = z--disable-mips16 ]; then |
81 |
|
MIPS16=NO |
82 |
else if [ z$a = z--enable-mips16 ]; then |
else if [ z$a = z--enable-mips16 ]; then |
83 |
MIPS16=YES |
MIPS16=YES |
84 |
else if [ z$a = z--disable-alpha ]; then |
else if [ z$a = z--disable-alpha ]; then |
85 |
ENABLEALPHA=NO |
ENABLEALPHA=NO |
86 |
|
else if [ z$a = z--enable-alpha ]; then |
87 |
|
ENABLEALPHA=YES |
88 |
|
else if [ z$a = z--disable-arm ]; then |
89 |
|
ENABLEARM=NO |
90 |
|
else if [ z$a = z--enable-arm ]; then |
91 |
|
ENABLEARM=YES |
92 |
else if [ z$a = z--disable-hppa ]; then |
else if [ z$a = z--disable-hppa ]; then |
93 |
ENABLEHPPA=NO |
ENABLEHPPA=NO |
94 |
|
else if [ z$a = z--enable-hppa ]; then |
95 |
|
ENABLEHPPA=YES |
96 |
else if [ z$a = z--disable-mips ]; then |
else if [ z$a = z--disable-mips ]; then |
97 |
ENABLEMIPS=NO |
ENABLEMIPS=NO |
98 |
|
else if [ z$a = z--enable-mips ]; then |
99 |
|
ENABLEMIPS=YES |
100 |
else if [ z$a = z--disable-ppc ]; then |
else if [ z$a = z--disable-ppc ]; then |
101 |
ENABLEPPC=NO |
ENABLEPPC=NO |
102 |
|
else if [ z$a = z--enable-ppc ]; then |
103 |
|
ENABLEPPC=YES |
104 |
else if [ z$a = z--disable-sparc ]; then |
else if [ z$a = z--disable-sparc ]; then |
105 |
ENABLESPARC=NO |
ENABLESPARC=NO |
106 |
|
else if [ z$a = z--enable-sparc ]; then |
107 |
|
ENABLESPARC=YES |
108 |
else if [ z$a = z--disable-urisc ]; then |
else if [ z$a = z--disable-urisc ]; then |
109 |
ENABLEURISC=NO |
ENABLEURISC=NO |
110 |
|
else if [ z$a = z--enable-urisc ]; then |
111 |
|
ENABLEURISC=YES |
112 |
|
else if [ z$a = z--disable-x86 ]; then |
113 |
|
ENABLEX86=NO |
114 |
|
else if [ z$a = z--enable-x86 ]; then |
115 |
|
ENABLEX86=YES |
116 |
|
else if [ z$a = z--disable-delays ]; then |
117 |
|
DELAYS=NO |
118 |
else if [ z$a = z--enable-delays ]; then |
else if [ z$a = z--enable-delays ]; then |
119 |
DELAYS=YES |
DELAYS=YES |
120 |
|
else if [ z$a = z--disable-caches ]; then |
121 |
|
CACHES=NO |
122 |
else if [ z$a = z--enable-caches ]; then |
else if [ z$a = z--enable-caches ]; then |
123 |
CACHES=YES |
CACHES=YES |
124 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
125 |
echo "usage: $0 [options]" |
echo "usage: $0 [options]" |
126 |
printf "\nDevelopment (debug) options:\n" |
printf "\nDevelopment (debug) options:\n" |
127 |
echo " --always32 enable" \ |
echo " --always32 enable" \ |
128 |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
129 |
echo " 32/64-bit bugs)" |
echo " 32/64-bit bugs)" |
130 |
|
echo " --tracenull enable" \ |
131 |
|
"TRACE_NULL_CRASHES (for bug hunting)" |
132 |
printf "\nGeneral options:\n" |
printf "\nGeneral options:\n" |
133 |
echo " --disable-bintrans configure without" \ |
echo " --disable-bintrans configure without" \ |
134 |
"bintrans, even if the host supports it" |
"bintrans, even if the host supports it" |
135 |
echo " --enable-caches enable cache emulation" \ |
printf " --enable-caches enable cache emulation" |
136 |
"(experimental)" |
printf " (BUGGY)\n" |
137 |
echo " --enable-delays enable instruction" \ |
echo " --enable-delays enable instruction" \ |
138 |
"latency/delay emulation" |
"latency/delay emulation" |
139 |
echo " --disable-x don't include X11 support" |
echo " --disable-x don't include X11 support" |
140 |
printf "\nCPU selection options:\n" |
printf "\nCPU selection options:\n" |
141 |
echo " --disable-alpha disable Alpha CPU emulation" |
if [ z$STABLE = zNO ]; then |
142 |
echo " --disable-hppa disable HPPA CPU emulation" |
printf " --enable-alpha " |
143 |
echo " --disable-mips disable MIPS CPU emulation" |
printf "enable Alpha CPU emulation" |
144 |
echo " --disable-ppc disable PPC CPU emulation" |
printf " (NOT YET)\n" |
145 |
echo " --disable-sparc disable SPARC CPU emulation" |
printf " --enable-arm " |
146 |
echo " --disable-urisc disable URISC CPU emulation" |
printf "enable ARM CPU emulation" |
147 |
|
printf " (NOT YET)\n" |
148 |
|
printf " --enable-hppa " |
149 |
|
printf "enable HPPA CPU emulation" |
150 |
|
printf " (NOT YET)\n" |
151 |
|
fi |
152 |
|
echo " --disable-mips disable MIPS CPU emulation" |
153 |
|
echo " --disable-ppc disable PPC CPU emulation" |
154 |
|
if [ z$STABLE = zNO ]; then |
155 |
|
printf " --enable-sparc " |
156 |
|
printf "enable SPARC CPU emulation" |
157 |
|
printf " (NOT YET)\n" |
158 |
|
fi |
159 |
|
echo " --disable-urisc disable URISC CPU emulation" |
160 |
|
if [ z$STABLE = zNO ]; then |
161 |
|
printf " --enable-x86 " |
162 |
|
printf "enable x86 CPU emulation" |
163 |
|
printf " (NOT YET)\n" |
164 |
|
fi |
165 |
printf "\nMIPS-specific options:\n" |
printf "\nMIPS-specific options:\n" |
166 |
echo " --enable-mips16 enable MIPS16 instruction" \ |
printf " --enable-mips16 enable MIPS16 instruction" |
167 |
"support (experimental)" |
printf " support (NOT YET)\n\n" |
|
printf "\n" |
|
168 |
exit |
exit |
169 |
else |
else |
170 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
171 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
172 |
"available options." |
"available options." |
173 |
exit |
exit |
174 |
|
fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi |
175 |
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 |
176 |
done |
done |
177 |
fi |
fi |
215 |
fi |
fi |
216 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
217 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ALPHA\n" >> config.h |
218 |
else |
if [ z$STABLE = zNO ]; then |
219 |
echo 'Disabling Alpha emulation support.' |
printf "\nWARNING: Alpha emulation enabled, but it isn't really" |
220 |
|
printf " implemented yet.\n\n" |
221 |
|
else |
222 |
|
printf "Not in the stable release.\n" |
223 |
|
exit |
224 |
|
fi |
225 |
|
fi |
226 |
|
if [ z$ENABLEARM = zYES ]; then |
227 |
|
printf "#define ENABLE_ARM\n" >> config.h |
228 |
|
if [ z$STABLE = zNO ]; then |
229 |
|
printf "\nWARNING: ARM emulation enabled, but it isn't really" |
230 |
|
printf " implemented yet.\n\n" |
231 |
|
else |
232 |
|
printf "Not in the stable release.\n" |
233 |
|
exit |
234 |
|
fi |
235 |
fi |
fi |
236 |
if [ z$ENABLEHPPA = zYES ]; then |
if [ z$ENABLEHPPA = zYES ]; then |
237 |
printf "#define ENABLE_HPPA\n" >> config.h |
printf "#define ENABLE_HPPA\n" >> config.h |
238 |
else |
if [ z$STABLE = zNO ]; then |
239 |
echo 'Disabling HPPA emulation support.' |
printf "\nWARNING: HPPA emulation enabled, but it isn't really" |
240 |
|
printf " implemented yet.\n\n" |
241 |
|
else |
242 |
|
printf "Not in the stable release.\n" |
243 |
|
exit |
244 |
|
fi |
245 |
fi |
fi |
246 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
247 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
|
else |
|
|
echo 'Disabling MIPS emulation support.' |
|
248 |
fi |
fi |
249 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
250 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
|
else |
|
|
echo 'Disabling PPC emulation support.' |
|
251 |
fi |
fi |
252 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
253 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
254 |
else |
if [ z$STABLE = zNO ]; then |
255 |
echo 'Disabling SPARC emulation support.' |
printf "\nWARNING: SPARC emulation enabled, but it isn't really" |
256 |
|
printf " implemented yet.\n\n" |
257 |
|
else |
258 |
|
printf "Not in the stable release.\n" |
259 |
|
exit |
260 |
|
fi |
261 |
fi |
fi |
262 |
if [ z$ENABLEURISC = zYES ]; then |
if [ z$ENABLEURISC = zYES ]; then |
263 |
printf "#define ENABLE_URISC\n" >> config.h |
printf "#define ENABLE_URISC\n" >> config.h |
264 |
else |
fi |
265 |
echo 'Disabling URISC emulation support.' |
if [ z$ENABLEX86 = zYES ]; then |
266 |
|
printf "#define ENABLE_X86\n" >> config.h |
267 |
|
if [ z$STABLE = zNO ]; then |
268 |
|
printf "\nWARNING: X86 emulation enabled, but it isn't really" |
269 |
|
printf " working yet.\n\n" |
270 |
|
else |
271 |
|
printf "Not in the stable release.\n" |
272 |
|
exit |
273 |
|
fi |
274 |
fi |
fi |
275 |
|
|
276 |
|
|
281 |
fi |
fi |
282 |
|
|
283 |
|
|
284 |
# Instruction delay/latency emulation: |
# Development option: ALWAYS_SIGNEXTEND_32 |
285 |
if [ z$ALWAYS32 = zYES ]; then |
if [ z$ALWAYS32 = zYES ]; then |
286 |
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
287 |
'This slows down everything.)' |
'This slows down everything.)' |
289 |
fi |
fi |
290 |
|
|
291 |
|
|
292 |
|
# Development option: TRACE_NULL_CRASHES |
293 |
|
if [ z$TRACENULL = zYES ]; then |
294 |
|
echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \ |
295 |
|
'This slows down the emulator.)' |
296 |
|
printf "#define TRACE_NULL_CRASHES\n" >> config.h |
297 |
|
fi |
298 |
|
|
299 |
|
|
300 |
# Cache emulation: |
# Cache emulation: |
301 |
if [ z$CACHES = zYES ]; then |
if [ z$CACHES = zYES ]; then |
302 |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
308 |
printf ' (--delays) will not produce correct ' |
printf ' (--delays) will not produce correct ' |
309 |
printf 'cache miss penalties and such.\n' |
printf 'cache miss penalties and such.\n' |
310 |
fi |
fi |
311 |
|
|
312 |
|
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
313 |
|
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
314 |
fi |
fi |
315 |
|
|
316 |
|
|
775 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
776 |
|
|
777 |
|
|
|
# -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 |
|
|
|
|
|
|
|
778 |
# -fomit-frame-pointer |
# -fomit-frame-pointer |
779 |
printf "checking whether -fomit-frame-pointer can be used... " |
printf "checking whether -fomit-frame-pointer can be used... " |
780 |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
883 |
printf "missing, using mystrtoull\n" |
printf "missing, using mystrtoull\n" |
884 |
printf "#define strtoull mystrtoull\n" >> config.h |
printf "#define strtoull mystrtoull\n" >> config.h |
885 |
else |
else |
886 |
printf "yes\n" |
printf "found\n" |
887 |
fi |
fi |
888 |
rm -f _testlong* _tests.[co] _tests |
rm -f _tests.[co] _tests |
889 |
|
|
890 |
|
|
891 |
|
# mkstemp missing? |
892 |
|
printf "checking for mkstemp... " |
893 |
|
printf "#include <unistd.h> |
894 |
|
int main(int argc, char *argv[]) { int x; char *y = \"abc\"; |
895 |
|
x = mkstemp(y); return 0;}\n" > _tests.c |
896 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
897 |
|
if [ ! -x _tests ]; then |
898 |
|
printf "missing, using workaround\n" |
899 |
|
printf "#define mkstemp mymkstemp\n" >> config.h |
900 |
|
else |
901 |
|
printf "found\n" |
902 |
|
fi |
903 |
|
rm -f _tests.[co] _tests |
904 |
|
|
905 |
|
|
906 |
# fseeko missing? |
# fseeko missing? |
912 |
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 |
913 |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
914 |
if [ ! -x _tests ]; then |
if [ ! -x _tests ]; then |
915 |
printf "no\n" |
printf "missing\n" |
916 |
printf "WARNING! fseeko missing from libc. Using a hack, " |
printf "WARNING! fseeko missing from libc. Using a hack, " |
917 |
printf "which probably doesn't work.\n" |
printf "which probably doesn't work.\n" |
918 |
printf "#define HACK_FSEEKO\n" >> config.h |
printf "#define HACK_FSEEKO\n" >> config.h |
919 |
else |
else |
920 |
printf "yes\n" |
printf "found\n" |
921 |
fi |
fi |
922 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
923 |
|
|
935 |
printf "no, using int\n" |
printf "no, using int\n" |
936 |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
937 |
else |
else |
938 |
printf "yes\n" |
printf "socklen_t\n" |
939 |
fi |
fi |
940 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
941 |
|
|
1129 |
|
|
1130 |
############################################################################### |
############################################################################### |
1131 |
|
|
1132 |
INCLUDE=-I../include/ |
INCLUDE=-Iinclude/ |
1133 |
|
DINCLUDE=-I../include/ |
1134 |
|
|
1135 |
echo C compiler flags: $CFLAGS $CWARNINGS $INCLUDE |
echo C compiler flags: $CFLAGS $CWARNINGS |
1136 |
echo Linker flags: $OTHERLIBS |
echo Linker flags: $OTHERLIBS |
1137 |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
1138 |
echo "COPTIM=$CFLAGS" >> _Makefile.header |
echo "COPTIM=$CFLAGS" >> _Makefile.header |
1139 |
echo "INCLUDE=$INCLUDE" >> _Makefile.header |
echo "INCLUDE=$INCLUDE" >> _Makefile.header |
1140 |
|
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
1141 |
echo "CC=$CC" >> _Makefile.header |
echo "CC=$CC" >> _Makefile.header |
1142 |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
1143 |
echo "" >> _Makefile.header |
echo "" >> _Makefile.header |
1298 |
|
|
1299 |
# Create the Makefiles: |
# Create the Makefiles: |
1300 |
|
|
1301 |
for a in . src devices devices/fonts tests; do |
for a in . src src/devices src/devices/fonts tests; do |
1302 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1303 |
touch $a/Makefile |
touch $a/Makefile |
1304 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |