27 |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
28 |
# |
# |
29 |
# |
# |
30 |
# $Id: configure,v 1.155 2005/08/16 05:37:08 debug Exp $ |
# $Id: configure,v 1.170 2005/10/07 15:09: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 |
62 |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
63 |
if [ z"$X" = z0. ]; then |
if [ z"$X" = z0. ]; then |
64 |
# Stable: |
# Stable: |
65 |
|
ENABLEARM=YES |
66 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
67 |
else |
else |
68 |
# Development: |
# Development: |
69 |
ENABLEALPHA=YES |
ENABLEALPHA=YES |
70 |
ENABLEARM=YES |
ENABLEARM=YES |
71 |
ENABLEIA64=YES |
ENABLEAVR=NO |
72 |
ENABLEM68K=YES |
ENABLEHPPA=NO |
73 |
|
ENABLEI960=NO |
74 |
|
ENABLEIA64=NO |
75 |
|
ENABLEM68K=NO |
76 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
77 |
ENABLEPPC=YES |
ENABLEPPC=YES |
78 |
ENABLESPARC=YES |
ENABLESH=NO |
79 |
ENABLEX86=YES |
ENABLESPARC=NO |
80 |
|
ENABLEX86=NO |
81 |
fi |
fi |
82 |
|
|
83 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
97 |
MIPS16=NO |
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 |
else if [ z$a = z--disable-alpha ]; then |
114 |
ENABLEALPHA=NO |
ENABLEALPHA=NO |
115 |
else if [ z$a = z--enable-alpha ]; then |
else if [ z$a = z--enable-alpha ]; then |
118 |
ENABLEARM=NO |
ENABLEARM=NO |
119 |
else if [ z$a = z--enable-arm ]; then |
else if [ z$a = z--enable-arm ]; then |
120 |
ENABLEARM=YES |
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 |
128 |
|
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 |
else if [ z$a = z--disable-ia64 ]; then |
134 |
ENABLEIA64=NO |
ENABLEIA64=NO |
135 |
else if [ z$a = z--enable-ia64 ]; then |
else if [ z$a = z--enable-ia64 ]; then |
146 |
ENABLEPPC=NO |
ENABLEPPC=NO |
147 |
else if [ z$a = z--enable-ppc ]; then |
else if [ z$a = z--enable-ppc ]; then |
148 |
ENABLEPPC=YES |
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 |
else if [ z$a = z--disable-sparc ]; then |
154 |
ENABLESPARC=NO |
ENABLESPARC=NO |
155 |
else if [ z$a = z--enable-sparc ]; then |
else if [ z$a = z--enable-sparc ]; then |
188 |
echo " --enable-delays enable instruction" \ |
echo " --enable-delays enable instruction" \ |
189 |
"latency/delay emulation" |
"latency/delay emulation" |
190 |
|
|
191 |
|
printf " --enable-all enable everything\n" |
192 |
|
|
193 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
194 |
printf " --disable-alpha disable " |
printf " --disable-alpha disable " |
195 |
else |
else |
204 |
fi |
fi |
205 |
printf "ARM CPU emulation\n" |
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 |
if [ z$ENABLEIA64 = zYES ]; then |
229 |
printf " --disable-ia64 disable " |
printf " --disable-ia64 disable " |
230 |
else |
else |
253 |
fi |
fi |
254 |
printf "POWER/PPC CPU emulation\n" |
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 |
if [ z$ENABLESPARC = zYES ]; then |
264 |
printf " --disable-sparc disable " |
printf " --disable-sparc disable " |
265 |
else |
else |
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; 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 |
|
|
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" |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" |
335 |
|
CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" |
336 |
fi |
fi |
337 |
if [ z$ENABLEARM = zYES ]; then |
if [ z$ENABLEARM = zYES ]; then |
338 |
printf "#define ENABLE_ARM\n" >> config.h |
printf "#define ENABLE_ARM\n" >> config.h |
339 |
CPU_ARCHS="$CPU_ARCHS cpu_arm.o" |
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" |
341 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_dpi" |
342 |
|
fi |
343 |
|
if [ z$ENABLEAVR = zYES ]; then |
344 |
|
printf "#define ENABLE_AVR\n" >> config.h |
345 |
|
CPU_ARCHS="$CPU_ARCHS cpu_avr.o" |
346 |
|
fi |
347 |
|
if [ z$ENABLEHPPA = zYES ]; then |
348 |
|
printf "#define ENABLE_HPPA\n" >> config.h |
349 |
|
CPU_ARCHS="$CPU_ARCHS cpu_hppa.o" |
350 |
|
fi |
351 |
|
if [ z$ENABLEI960 = zYES ]; then |
352 |
|
printf "#define ENABLE_I960\n" >> config.h |
353 |
|
CPU_ARCHS="$CPU_ARCHS cpu_i960.o" |
354 |
fi |
fi |
355 |
if [ z$ENABLEIA64 = zYES ]; then |
if [ z$ENABLEIA64 = zYES ]; then |
356 |
printf "#define ENABLE_IA64\n" >> config.h |
printf "#define ENABLE_IA64\n" >> config.h |
366 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
367 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
368 |
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
369 |
|
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
370 |
|
fi |
371 |
|
if [ z$ENABLESH = zYES ]; then |
372 |
|
printf "#define ENABLE_SH\n" >> config.h |
373 |
|
CPU_ARCHS="$CPU_ARCHS cpu_sh.o" |
374 |
fi |
fi |
375 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
376 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
496 |
fi |
fi |
497 |
rm -f _testprog |
rm -f _testprog |
498 |
|
|
499 |
# Try ccc (FreeBSD/Alpha): |
# # Try ccc (FreeBSD/Alpha): |
500 |
printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
# printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
501 |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
# printf " /dev/null 2> /dev/null\n" >> _test.sh |
502 |
chmod 755 _test.sh |
# chmod 755 _test.sh |
503 |
./_test.sh > /dev/null 2> /dev/null |
# ./_test.sh > /dev/null 2> /dev/null |
504 |
if [ -x _testprog ]; then |
# if [ -x _testprog ]; then |
505 |
CC="ccc" |
# CC="ccc" |
506 |
fi |
# fi |
507 |
rm -f _testprog |
# rm -f _testprog |
508 |
|
|
509 |
rm -f _test.sh |
rm -f _test.sh |
510 |
fi |
fi |
1101 |
|
|
1102 |
|
|
1103 |
# Check for u_int8_t etc: |
# Check for u_int8_t etc: |
1104 |
|
# These are needed because some header files in src/include/ use u_int* |
1105 |
|
# instead of uint*, and I don't have time to rewrite them all. |
1106 |
printf "checking for u_int8_t... " |
printf "checking for u_int8_t... " |
1107 |
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 |
1108 |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1124 |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
1125 |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
1126 |
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 |
|
1127 |
printf "uint8_t\n" |
printf "uint8_t\n" |
1128 |
else |
else |
1129 |
printf "yes\n" |
printf "yes\n" |
1130 |
fi |
fi |
1131 |
rm -f _testuint.c _testuint |
rm -f _testuint.c _testuint |
1132 |
|
|
1133 |
|
printf "checking for u_int64_t... " |
1134 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
1135 |
|
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1136 |
|
(int)sizeof(u_int64_t));return 0;}\n" > _testuint.c |
1137 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1138 |
|
if [ ! -x _testuint ]; then |
1139 |
|
rm -f _testuint* |
1140 |
|
printf "#include <stdio.h>\n#include <inttypes.h> |
1141 |
|
\n#include <sys/types.h>\nint main(int argc, char *argv[]) |
1142 |
|
{printf(\"%%i\\\n\", (int)sizeof(uint64_t));return 0;}\n" > _testuint.c |
1143 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1144 |
|
if [ ! -x _testuint ]; then |
1145 |
|
printf "no\n\nERROR: No u_int64_t or uint64_t. Aborting\n" |
1146 |
|
# TODO: Automagically detect using various combinations |
1147 |
|
# of char, int, short, long etc. |
1148 |
|
exit |
1149 |
|
fi |
1150 |
|
|
1151 |
|
printf "typedef uint64_t u_int64_t;\n" >> config.h |
1152 |
|
printf "uint64_t\n" |
1153 |
|
else |
1154 |
|
printf "yes\n" |
1155 |
|
fi |
1156 |
|
rm -f _testuint.c _testuint |
1157 |
|
|
1158 |
|
|
1159 |
############################################################################### |
############################################################################### |
1160 |
# |
# |
1288 |
echo "CC=$CC" >> _Makefile.header |
echo "CC=$CC" >> _Makefile.header |
1289 |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
1290 |
echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header |
echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header |
1291 |
|
echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header |
1292 |
echo "" >> _Makefile.header |
echo "" >> _Makefile.header |
1293 |
|
|
1294 |
|
|
1295 |
# Create the Makefiles: |
# Create the Makefiles: |
1296 |
|
|
1297 |
for a in . src src/devices src/devices/fonts; do |
for a in . src src/cpus src/devices src/devices/fonts src/promemul; do |
1298 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1299 |
touch $a/Makefile |
touch $a/Makefile |
1300 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |