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.155 2005/08/16 05:37:08 debug Exp $ |
# $Id: configure,v 1.198 2006/02/18 13:15:20 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 |
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) |
# o) binary translation (on supported platforms) |
|
# o) prefetch capability (TODO: this is assumed on Alpha, but not all |
|
|
# Alphas have it...) |
|
52 |
# |
# |
53 |
# TODO: |
# TODO: |
|
# o) do not enable prefetch on Alpha ev4 or ev5, only on pca56 and newer |
|
54 |
# o) X11 libs and includes via command line options? |
# o) X11 libs and includes via command line options? |
55 |
# |
# |
56 |
############################################################################### |
############################################################################### |
59 |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
60 |
if [ z"$X" = z0. ]; then |
if [ z"$X" = z0. ]; then |
61 |
# Stable: |
# Stable: |
62 |
|
ENABLEARM=YES |
63 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
64 |
|
ENABLEPPC=YES |
65 |
else |
else |
66 |
# Development: |
# Development: |
67 |
|
UNSTABLE=YES |
68 |
|
DYNTRANSBACKEND=NO #YES |
69 |
ENABLEALPHA=YES |
ENABLEALPHA=YES |
70 |
ENABLEARM=YES |
ENABLEARM=YES |
71 |
|
ENABLEAVR=YES |
72 |
|
ENABLEHPPA=YES |
73 |
|
ENABLEI960=YES |
74 |
ENABLEIA64=YES |
ENABLEIA64=YES |
75 |
ENABLEM68K=YES |
ENABLEM68K=YES |
76 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
77 |
|
NEWMIPS=NO |
78 |
ENABLEPPC=YES |
ENABLEPPC=YES |
79 |
|
ENABLESH=YES |
80 |
ENABLESPARC=YES |
ENABLESPARC=YES |
81 |
ENABLEX86=YES |
ENABLEX86=YES |
82 |
fi |
fi |
83 |
|
|
84 |
|
if [ z"$UNSTABLE" = zYES ]; then |
85 |
|
printf "### DEVELOPMENT (UNSTABLE)\n\n" |
86 |
|
fi |
87 |
|
|
88 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
89 |
# Parse command line options: |
# Parse command line options: |
90 |
for a in $*; do |
for a in $*; do |
102 |
MIPS16=NO |
MIPS16=NO |
103 |
else if [ z$a = z--enable-mips16 ]; then |
else if [ z$a = z--enable-mips16 ]; then |
104 |
MIPS16=YES |
MIPS16=YES |
105 |
else if [ z$a = z--disable-alpha ]; then |
else if [ z$a = z--disable-dyntransbackend ]; then |
106 |
ENABLEALPHA=NO |
DYNTRANSBACKEND=NO |
107 |
else if [ z$a = z--enable-alpha ]; then |
else if [ z$a = z--enable-dyntransbackend ]; then |
108 |
ENABLEALPHA=YES |
DYNTRANSBACKEND=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-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-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 |
|
109 |
else if [ z$a = z--disable-delays ]; then |
else if [ z$a = z--disable-delays ]; then |
110 |
DELAYS=NO |
DELAYS=NO |
111 |
else if [ z$a = z--enable-delays ]; then |
else if [ z$a = z--enable-delays ]; then |
114 |
CACHES=NO |
CACHES=NO |
115 |
else if [ z$a = z--enable-caches ]; then |
else if [ z$a = z--enable-caches ]; then |
116 |
CACHES=YES |
CACHES=YES |
117 |
|
else if [ z$a = z--disable-newmips ]; then |
118 |
|
NEWMIPS=NO |
119 |
|
else if [ z$a = z--enable-newmips ]; then |
120 |
|
NEWMIPS=YES |
121 |
|
else if [ z$a = z--disable-1k-pages ]; then |
122 |
|
ONEKPAGE=NO |
123 |
|
else if [ z$a = z--enable-1k-pages ]; then |
124 |
|
ONEKPAGE=YES |
125 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
126 |
echo "usage: $0 [options]" |
echo "usage: $0 [options]" |
127 |
|
|
137 |
|
|
138 |
echo " --always32 enable ALWAYS_SIGNEXTEND_32"\ |
echo " --always32 enable ALWAYS_SIGNEXTEND_32"\ |
139 |
"(for hunting down 32-bit bugs)" |
"(for hunting down 32-bit bugs)" |
|
echo " --tracenull enable" \ |
|
|
"TRACE_NULL_CRASHES (for bug hunting)" |
|
140 |
printf " --enable-caches enable cache emulation" |
printf " --enable-caches enable cache emulation" |
141 |
printf " (BUGGY)\n" |
printf " (BUGGY)\n" |
142 |
echo " --enable-delays enable instruction" \ |
echo " --enable-delays enable instruction" \ |
143 |
"latency/delay emulation" |
"latency/delay emulation" |
144 |
|
|
145 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$DYNTRANSBACKEND = zYES ]; then |
146 |
printf " --disable-alpha disable " |
printf " --disable-dyntransbackend disable " |
|
else |
|
|
printf " --enable-alpha enable " |
|
|
fi |
|
|
printf "Alpha CPU emulation\n" |
|
|
|
|
|
if [ z$ENABLEARM = zYES ]; then |
|
|
printf " --disable-arm disable " |
|
147 |
else |
else |
148 |
printf " --enable-arm enable " |
printf " --enable-dyntransbackend enable" |
149 |
fi |
fi |
150 |
printf "ARM CPU emulation\n" |
printf "dyntrans backend\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$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" |
|
151 |
|
|
152 |
echo " --enable-mips16 enable MIPS16 support" |
echo " --enable-mips16 enable MIPS16 support" |
153 |
|
echo " --enable-newmips use new MIPS dyntrans code" |
154 |
|
#printf " --enable-1k-pages allow 1KB dyntrans pages" |
155 |
|
#printf " (default: 4KB)\n" |
156 |
|
|
157 |
printf "\n(Pretty much all of these options are only" |
printf "\n(Pretty much all of these options are only" |
158 |
printf " meaningful during the development of\nthe" |
printf " meaningful during the development of\nthe" |
164 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
165 |
"available options." |
"available options." |
166 |
exit |
exit |
167 |
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 |
168 |
fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi |
fi; fi |
169 |
done |
done |
170 |
fi |
fi |
171 |
|
|
209 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
210 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ALPHA\n" >> config.h |
211 |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" |
212 |
|
CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" |
213 |
fi |
fi |
214 |
if [ z$ENABLEARM = zYES ]; then |
if [ z$ENABLEARM = zYES ]; then |
215 |
printf "#define ENABLE_ARM\n" >> config.h |
printf "#define ENABLE_ARM\n" >> config.h |
216 |
CPU_ARCHS="$CPU_ARCHS cpu_arm.o" |
CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o " |
217 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o tmp_arm_r.o" |
218 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o" |
219 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o" |
220 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o" |
221 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o" |
222 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o" |
223 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o" |
224 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o" |
225 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o tmp_arm_multi.o" |
226 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r" |
227 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi" |
228 |
|
fi |
229 |
|
if [ z$ENABLEAVR = zYES ]; then |
230 |
|
printf "#define ENABLE_AVR\n" >> config.h |
231 |
|
CPU_ARCHS="$CPU_ARCHS cpu_avr.o" |
232 |
|
fi |
233 |
|
if [ z$ENABLEHPPA = zYES ]; then |
234 |
|
printf "#define ENABLE_HPPA\n" >> config.h |
235 |
|
CPU_ARCHS="$CPU_ARCHS cpu_hppa.o" |
236 |
|
fi |
237 |
|
if [ z$ENABLEI960 = zYES ]; then |
238 |
|
printf "#define ENABLE_I960\n" >> config.h |
239 |
|
CPU_ARCHS="$CPU_ARCHS cpu_i960.o" |
240 |
fi |
fi |
241 |
if [ z$ENABLEIA64 = zYES ]; then |
if [ z$ENABLEIA64 = zYES ]; then |
242 |
printf "#define ENABLE_IA64\n" >> config.h |
printf "#define ENABLE_IA64\n" >> config.h |
248 |
fi |
fi |
249 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
250 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
251 |
|
if [ z$NEWMIPS = zYES ]; then |
252 |
|
echo 'Enabling the _EXPERIMENTAL_ MIPS dyntrans code.' |
253 |
|
printf "#define EXPERIMENTAL_NEWMIPS\n" >> config.h |
254 |
|
fi |
255 |
fi |
fi |
256 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
257 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
258 |
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
259 |
|
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
260 |
|
fi |
261 |
|
if [ z$ENABLESH = zYES ]; then |
262 |
|
printf "#define ENABLE_SH\n" >> config.h |
263 |
|
CPU_ARCHS="$CPU_ARCHS cpu_sh.o" |
264 |
fi |
fi |
265 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
266 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
287 |
fi |
fi |
288 |
|
|
289 |
|
|
290 |
# Development option: TRACE_NULL_CRASHES |
# 1KB page emulation: |
291 |
if [ z$TRACENULL = zYES ]; then |
if [ z$ONEKPAGE = zYES ]; then |
292 |
echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \ |
echo '1 KB pages: not yet.' |
293 |
'This slows down the emulator.)' |
exit |
294 |
printf "#define TRACE_NULL_CRASHES\n" >> config.h |
echo 'Enabling 1 KB page dyntrans support. (NOTE:' \ |
295 |
|
'This slows down everything.)' |
296 |
|
printf "#define ONEKPAGE\n" >> config.h |
297 |
fi |
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 and BUGGY)' |
303 |
printf "#define ENABLE_CACHE_EMULATION\n" >> config.h |
printf "#define ENABLE_CACHE_EMULATION\n" >> config.h |
304 |
|
|
305 |
if [ z$DELAYS != zYES ]; then |
if [ z$DELAYS != zYES ]; then |
388 |
fi |
fi |
389 |
rm -f _testprog |
rm -f _testprog |
390 |
|
|
391 |
# Try ccc (FreeBSD/Alpha): |
# # Try ccc (FreeBSD/Alpha): |
392 |
printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
# printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
393 |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
# printf " /dev/null 2> /dev/null\n" >> _test.sh |
394 |
chmod 755 _test.sh |
# chmod 755 _test.sh |
395 |
./_test.sh > /dev/null 2> /dev/null |
# ./_test.sh > /dev/null 2> /dev/null |
396 |
if [ -x _testprog ]; then |
# if [ -x _testprog ]; then |
397 |
CC="ccc" |
# CC="ccc" |
398 |
fi |
# fi |
399 |
rm -f _testprog |
# rm -f _testprog |
400 |
|
|
401 |
rm -f _test.sh |
rm -f _test.sh |
402 |
fi |
fi |
650 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ z"$COMPAQCC" = zYES ]; then |
651 |
CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop" |
CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop" |
652 |
fi |
fi |
653 |
|
|
654 |
|
if [ z"$UNSTABLE" = zYES ]; then |
655 |
|
printf "checking whether -Werror can be used... " |
656 |
|
rm -f _testprog |
657 |
|
$CC $CFLAGS $CWARNINGS _testprog.c -o _testprog -Werror 2> /dev/null |
658 |
|
if [ -x _testprog ]; then |
659 |
|
printf "yes\n" |
660 |
|
CWARNINGS="$CWARNINGS -Werror" |
661 |
|
else |
662 |
|
printf "no\n" |
663 |
|
fi |
664 |
|
fi |
665 |
else |
else |
666 |
printf "no\n" |
printf "no\n" |
667 |
fi |
fi |
669 |
|
|
670 |
|
|
671 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ z"$COMPAQCC" = zYES ]; then |
672 |
# -O4 is possible, but is -O3 better? |
# -O4 is possible, but sometimes -O3 is better? |
673 |
CFLAGS="-O4 $CFLAGS" |
CFLAGS="-O4 $CFLAGS" |
674 |
else |
else |
675 |
if [ z"`uname`" = zSunOS ]; then |
if [ z"`uname`" = zSunOS ]; then |
684 |
$CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null |
$CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null |
685 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
686 |
rm -f _testprog |
rm -f _testprog |
687 |
$CC $CFLAGS _testprog.c -o _testprog -O2 2> /dev/null |
$CC $CFLAGS _testprog.c -o _testprog -O3 2> /dev/null |
688 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
689 |
CFLAGS="-O2 $CFLAGS" |
CFLAGS="-O3 $CFLAGS" |
690 |
else |
else |
691 |
CFLAGS="-O $CFLAGS" |
CFLAGS="-O $CFLAGS" |
692 |
fi |
fi |
774 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
775 |
|
|
776 |
|
|
777 |
|
# -g |
778 |
|
printf "checking whether -g can be used... " |
779 |
|
if [ z"$COMPAQCC" = zYES ]; then |
780 |
|
printf "skipping\n" |
781 |
|
else |
782 |
|
$CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1 |
783 |
|
cat _testprog.stdout >> _testprog.error |
784 |
|
if [ -x _testprog ]; then |
785 |
|
CFLAGS="-g $CFLAGS" |
786 |
|
printf "yes\n" |
787 |
|
else |
788 |
|
printf "no\n" |
789 |
|
fi |
790 |
|
fi |
791 |
|
rm -f _testprog _testprog.error _testprog.stdout |
792 |
|
|
793 |
|
|
794 |
# -lrt for nanosleep? |
# -lrt for nanosleep? |
795 |
printf "checking whether -lrt is required for nanosleep... " |
printf "checking whether -lrt is required for nanosleep... " |
796 |
printf "#include <time.h>\n#include <stdio.h> |
printf "#include <time.h>\n#include <stdio.h> |
1022 |
|
|
1023 |
|
|
1024 |
# Check for u_int8_t etc: |
# Check for u_int8_t etc: |
1025 |
|
# These are needed because some header files in src/include/ use u_int* |
1026 |
|
# instead of uint*, and I don't have time to rewrite them all. |
1027 |
printf "checking for u_int8_t... " |
printf "checking for u_int8_t... " |
1028 |
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 |
1029 |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1045 |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
printf "typedef uint8_t u_int8_t;\n" >> config.h |
1046 |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
printf "typedef uint16_t u_int16_t;\n" >> config.h |
1047 |
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 |
|
1048 |
printf "uint8_t\n" |
printf "uint8_t\n" |
1049 |
else |
else |
1050 |
printf "yes\n" |
printf "yes\n" |
1051 |
fi |
fi |
1052 |
rm -f _testuint.c _testuint |
rm -f _testuint.c _testuint |
1053 |
|
|
1054 |
|
printf "checking for u_int64_t... " |
1055 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\n#include <sys/types.h>\n |
1056 |
|
int main(int argc, char *argv[]){printf(\"%%i\\\n\", |
1057 |
|
(int)sizeof(u_int64_t));return 0;}\n" > _testuint.c |
1058 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1059 |
|
if [ ! -x _testuint ]; then |
1060 |
|
rm -f _testuint* |
1061 |
|
printf "#include <stdio.h>\n#include <inttypes.h> |
1062 |
|
\n#include <sys/types.h>\nint main(int argc, char *argv[]) |
1063 |
|
{printf(\"%%i\\\n\", (int)sizeof(uint64_t));return 0;}\n" > _testuint.c |
1064 |
|
$CC $CFLAGS _testuint.c -o _testuint 2> /dev/null |
1065 |
|
if [ ! -x _testuint ]; then |
1066 |
|
printf "no\n\nERROR: No u_int64_t or uint64_t. Aborting\n" |
1067 |
|
# TODO: Automagically detect using various combinations |
1068 |
|
# of char, int, short, long etc. |
1069 |
|
exit |
1070 |
|
fi |
1071 |
|
|
1072 |
|
printf "typedef uint64_t u_int64_t;\n" >> config.h |
1073 |
|
printf "uint64_t\n" |
1074 |
|
else |
1075 |
|
printf "yes\n" |
1076 |
|
fi |
1077 |
|
rm -f _testuint.c _testuint |
1078 |
|
|
1079 |
|
|
1080 |
############################################################################### |
############################################################################### |
1081 |
# |
# |
1082 |
# Dynamic binary translation (BINTRANS): |
# OLD binary translation (BINTRANS): |
1083 |
# |
# |
1084 |
############################################################################### |
############################################################################### |
1085 |
|
|
1104 |
BINTRANS=YES |
BINTRANS=YES |
1105 |
fi |
fi |
1106 |
|
|
1107 |
# x86: (all machines ending in "86" are treated as i386) |
# x86: |
1108 |
if [ z"`uname -m|rev|cut -c1-2`" = z68 ]; then |
if `uname -m|grep -v 64|grep -q 86`; then |
1109 |
printf "#define I386\n" >> config.h |
printf "#define I386\n" >> config.h |
1110 |
printf "#define BINTRANS\n" >> config.h |
printf "#define BINTRANS\n" >> config.h |
1111 |
printf "i386\n" |
printf "i386\n" |
1143 |
|
|
1144 |
|
|
1145 |
############################################################################### |
############################################################################### |
1146 |
|
# |
1147 |
|
# Dyntrans recompilation (native backend) support: |
1148 |
|
# |
1149 |
|
############################################################################### |
1150 |
|
|
1151 |
|
if [ z$DYNTRANSBACKEND = zYES ]; then |
1152 |
|
printf "Dyntrans: Not yet.\n" |
1153 |
|
exit |
1154 |
|
|
1155 |
|
printf "checking for dyntrans backend... " |
1156 |
|
DBFOUND=NO |
1157 |
|
|
1158 |
|
# Alpha: |
1159 |
|
if [ z"`uname -m`" = zalpha ]; then |
1160 |
|
printf "#define DYNTRANS_BACKEND_ALPHA\n" >> config.h |
1161 |
|
printf "Alpha\n" |
1162 |
|
CPU_BACKENDS="$CPU_BACKENDS backend_alpha.o" |
1163 |
|
DBFOUND=YES |
1164 |
|
fi |
1165 |
|
|
1166 |
|
# AMD64: |
1167 |
|
# TODO |
1168 |
|
|
1169 |
|
# # UltraSPARC: |
1170 |
|
# if [ z"`uname -m`" = zsun4u ]; then |
1171 |
|
# printf "#define DYNTRANS_BACKEND_SPARC64\n" >> config.h |
1172 |
|
# printf "UltraSPARC\n" |
1173 |
|
# CPU_BACKENDS="$CPU_BACKENDS backend_sparc.o" |
1174 |
|
# DBFOUND=YES |
1175 |
|
# fi |
1176 |
|
# if [ z"`uname -m`" = zsparc64 ]; then |
1177 |
|
# printf "#define DYNTRANS_BACKEND_SPARC64\n" >> config.h |
1178 |
|
# printf "UltraSPARC\n" |
1179 |
|
# CPU_BACKENDS="$CPU_BACKENDS backend_sparc.o" |
1180 |
|
# DBFOUND=YES |
1181 |
|
# fi |
1182 |
|
|
1183 |
|
# x86: |
1184 |
|
if `uname -m|grep -q -v 64|grep -q 86`; then |
1185 |
|
printf "#define DYNTRANS_BACKEND_I386\n" >> config.h |
1186 |
|
printf "i386\n" |
1187 |
|
CPU_BACKENDS="$CPU_BACKENDS backend_i386.o" |
1188 |
|
DBFOUND=YES |
1189 |
|
fi |
1190 |
|
|
1191 |
|
if [ z$DBFOUND = zYES ]; then |
1192 |
|
printf "#define DYNTRANS_BACKEND\n" >> config.h |
1193 |
|
else |
1194 |
|
printf "not supported yet on this arch (" |
1195 |
|
printf `uname -m` |
1196 |
|
printf ")\n" |
1197 |
|
fi |
1198 |
|
fi |
1199 |
|
|
1200 |
|
|
1201 |
|
############################################################################### |
1202 |
|
|
1203 |
# Host byte order? |
# Host byte order? |
1204 |
printf "checking host endianness... " |
printf "checking host endianness... " |
1225 |
|
|
1226 |
############################################################################### |
############################################################################### |
1227 |
|
|
|
# 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 |
|
|
|
|
|
|
|
|
############################################################################### |
|
|
|
|
1228 |
INCLUDE=-Iinclude/ |
INCLUDE=-Iinclude/ |
1229 |
DINCLUDE=-I../include/ |
DINCLUDE=-I../include/ |
1230 |
|
|
1239 |
echo "CC=$CC" >> _Makefile.header |
echo "CC=$CC" >> _Makefile.header |
1240 |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
1241 |
echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header |
echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header |
1242 |
|
echo "CPU_BACKENDS=$CPU_BACKENDS" >> _Makefile.header |
1243 |
|
echo "CPU_TOOLS=$CPU_TOOLS" >> _Makefile.header |
1244 |
echo "" >> _Makefile.header |
echo "" >> _Makefile.header |
1245 |
|
|
1246 |
|
|
1247 |
# Create the Makefiles: |
# Create the Makefiles: |
1248 |
|
D=". src src/include src/cpus src/devices src/devices/fonts" |
1249 |
for a in . src src/devices src/devices/fonts; do |
D="$D src/machines src/promemul" |
1250 |
|
for a in $D; do |
1251 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1252 |
touch $a/Makefile |
touch $a/Makefile |
1253 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |