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.155 2005/08/16 05:37:08 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=YES |
# Figure out if this is a stable version (0.x.x). |
62 |
ENABLEHPPA=YES |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
63 |
ENABLEMIPS=YES |
if [ z"$X" = z0. ]; then |
64 |
ENABLEPPC=YES |
# Stable: |
65 |
ENABLESPARC=YES |
ENABLEMIPS=YES |
66 |
ENABLEURISC=YES |
else |
67 |
|
# Development: |
68 |
|
ENABLEALPHA=YES |
69 |
|
ENABLEARM=YES |
70 |
|
ENABLEIA64=YES |
71 |
|
ENABLEM68K=YES |
72 |
|
ENABLEMIPS=YES |
73 |
|
ENABLEPPC=YES |
74 |
|
ENABLESPARC=YES |
75 |
|
ENABLEX86=YES |
76 |
|
fi |
77 |
|
|
78 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
79 |
# Parse command line options: |
# Parse command line options: |
82 |
NOX11=YES |
NOX11=YES |
83 |
else if [ z$a = z--always32 ]; then |
else if [ z$a = z--always32 ]; then |
84 |
ALWAYS32=YES |
ALWAYS32=YES |
85 |
|
else if [ z$a = z--tracenull ]; then |
86 |
|
TRACENULL=YES |
87 |
else if [ z$a = z--disable-bintrans ]; then |
else if [ z$a = z--disable-bintrans ]; then |
88 |
NOBINTRANS=YES |
NOBINTRANS=YES |
89 |
|
else if [ z$a = z--enable-bintrans ]; then |
90 |
|
NOBINTRANS=NO |
91 |
|
else if [ z$a = z--disable-mips16 ]; then |
92 |
|
MIPS16=NO |
93 |
else if [ z$a = z--enable-mips16 ]; then |
else if [ z$a = z--enable-mips16 ]; then |
94 |
MIPS16=YES |
MIPS16=YES |
95 |
else if [ z$a = z--disable-alpha ]; then |
else if [ z$a = z--disable-alpha ]; then |
96 |
ENABLEALPHA=NO |
ENABLEALPHA=NO |
97 |
else if [ z$a = z--disable-hppa ]; then |
else if [ z$a = z--enable-alpha ]; then |
98 |
ENABLEHPPA=NO |
ENABLEALPHA=YES |
99 |
|
else if [ z$a = z--disable-arm ]; then |
100 |
|
ENABLEARM=NO |
101 |
|
else if [ z$a = z--enable-arm ]; then |
102 |
|
ENABLEARM=YES |
103 |
|
else if [ z$a = z--disable-ia64 ]; then |
104 |
|
ENABLEIA64=NO |
105 |
|
else if [ z$a = z--enable-ia64 ]; then |
106 |
|
ENABLEIA64=YES |
107 |
|
else if [ z$a = z--disable-m68k ]; then |
108 |
|
ENABLEM68K=NO |
109 |
|
else if [ z$a = z--enable-m68k ]; then |
110 |
|
ENABLEM86K=YES |
111 |
else if [ z$a = z--disable-mips ]; then |
else if [ z$a = z--disable-mips ]; then |
112 |
ENABLEMIPS=NO |
ENABLEMIPS=NO |
113 |
|
else if [ z$a = z--enable-mips ]; then |
114 |
|
ENABLEMIPS=YES |
115 |
else if [ z$a = z--disable-ppc ]; then |
else if [ z$a = z--disable-ppc ]; then |
116 |
ENABLEPPC=NO |
ENABLEPPC=NO |
117 |
|
else if [ z$a = z--enable-ppc ]; then |
118 |
|
ENABLEPPC=YES |
119 |
else if [ z$a = z--disable-sparc ]; then |
else if [ z$a = z--disable-sparc ]; then |
120 |
ENABLESPARC=NO |
ENABLESPARC=NO |
121 |
else if [ z$a = z--disable-urisc ]; then |
else if [ z$a = z--enable-sparc ]; then |
122 |
ENABLEURISC=NO |
ENABLESPARC=YES |
123 |
|
else if [ z$a = z--disable-x86 ]; then |
124 |
|
ENABLEX86=NO |
125 |
|
else if [ z$a = z--enable-x86 ]; then |
126 |
|
ENABLEX86=YES |
127 |
|
else if [ z$a = z--disable-delays ]; then |
128 |
|
DELAYS=NO |
129 |
else if [ z$a = z--enable-delays ]; then |
else if [ z$a = z--enable-delays ]; then |
130 |
DELAYS=YES |
DELAYS=YES |
131 |
|
else if [ z$a = z--disable-caches ]; then |
132 |
|
CACHES=NO |
133 |
else if [ z$a = z--enable-caches ]; then |
else if [ z$a = z--enable-caches ]; then |
134 |
CACHES=YES |
CACHES=YES |
135 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
136 |
echo "usage: $0 [options]" |
echo "usage: $0 [options]" |
137 |
printf "\nDevelopment (debug) options:\n" |
|
138 |
echo " --always32 enable" \ |
printf "\nGeneral options:\n\n" |
139 |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
|
140 |
echo " 32/64-bit bugs)" |
echo " --disable-bintrans configure without the" \ |
141 |
printf "\nGeneral options:\n" |
"old binary translation subsystem," |
142 |
echo " --disable-bintrans configure without" \ |
echo " even if the host" \ |
143 |
"bintrans, even if the host supports it" |
"supports it" |
|
echo " --enable-caches enable cache emulation" \ |
|
|
"(experimental)" |
|
|
echo " --enable-delays enable instruction" \ |
|
|
"latency/delay emulation" |
|
144 |
echo " --disable-x don't include X11 support" |
echo " --disable-x don't include X11 support" |
145 |
printf "\nCPU selection options:\n" |
|
146 |
echo " --disable-alpha disable Alpha CPU emulation" |
printf "\nDevelopment (debug) options:\n\n" |
147 |
echo " --disable-hppa disable HPPA CPU emulation" |
|
148 |
echo " --disable-mips disable MIPS CPU emulation" |
echo " --always32 enable ALWAYS_SIGNEXTEND_32"\ |
149 |
echo " --disable-ppc disable PPC CPU emulation" |
"(for hunting down 32-bit bugs)" |
150 |
echo " --disable-sparc disable SPARC CPU emulation" |
echo " --tracenull enable" \ |
151 |
echo " --disable-urisc disable URISC CPU emulation" |
"TRACE_NULL_CRASHES (for bug hunting)" |
152 |
printf "\nMIPS-specific options:\n" |
printf " --enable-caches enable cache emulation" |
153 |
echo " --enable-mips16 enable MIPS16 instruction" \ |
printf " (BUGGY)\n" |
154 |
"support (experimental)" |
echo " --enable-delays enable instruction" \ |
155 |
printf "\n" |
"latency/delay emulation" |
156 |
|
|
157 |
|
if [ z$ENABLEALPHA = zYES ]; then |
158 |
|
printf " --disable-alpha disable " |
159 |
|
else |
160 |
|
printf " --enable-alpha enable " |
161 |
|
fi |
162 |
|
printf "Alpha CPU emulation\n" |
163 |
|
|
164 |
|
if [ z$ENABLEARM = zYES ]; then |
165 |
|
printf " --disable-arm disable " |
166 |
|
else |
167 |
|
printf " --enable-arm enable " |
168 |
|
fi |
169 |
|
printf "ARM CPU emulation\n" |
170 |
|
|
171 |
|
if [ z$ENABLEIA64 = zYES ]; then |
172 |
|
printf " --disable-ia64 disable " |
173 |
|
else |
174 |
|
printf " --enable-ia64 enable " |
175 |
|
fi |
176 |
|
printf "IA64 CPU emulation\n" |
177 |
|
|
178 |
|
if [ z$ENABLEM68K = zYES ]; then |
179 |
|
printf " --disable-m68k disable " |
180 |
|
else |
181 |
|
printf " --enable-m68k enable " |
182 |
|
fi |
183 |
|
printf "M68K CPU emulation\n" |
184 |
|
|
185 |
|
if [ z$ENABLEMIPS = zYES ]; then |
186 |
|
printf " --disable-mips disable " |
187 |
|
else |
188 |
|
printf " --enable-mips enable " |
189 |
|
fi |
190 |
|
printf "MIPS CPU emulation\n" |
191 |
|
|
192 |
|
if [ z$ENABLEPPC = zYES ]; then |
193 |
|
printf " --disable-ppc disable " |
194 |
|
else |
195 |
|
printf " --enable-ppc enable " |
196 |
|
fi |
197 |
|
printf "POWER/PPC CPU emulation\n" |
198 |
|
|
199 |
|
if [ z$ENABLESPARC = zYES ]; then |
200 |
|
printf " --disable-sparc disable " |
201 |
|
else |
202 |
|
printf " --enable-sparc enable " |
203 |
|
fi |
204 |
|
printf "SPARC CPU emulation\n" |
205 |
|
|
206 |
|
if [ z$ENABLEX86 = zYES ]; then |
207 |
|
printf " --disable-x86 disable " |
208 |
|
else |
209 |
|
printf " --enable-x86 enable " |
210 |
|
fi |
211 |
|
printf "x86 CPU emulation\n" |
212 |
|
|
213 |
|
echo " --enable-mips16 enable MIPS16 support" |
214 |
|
|
215 |
|
printf "\n(Pretty much all of these options are only" |
216 |
|
printf " meaningful during the development of\nthe" |
217 |
|
printf " emulator, and should not be used when " |
218 |
|
printf "compiling a stable version.)\n" |
219 |
exit |
exit |
220 |
else |
else |
221 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
222 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
223 |
"available options." |
"available options." |
224 |
exit |
exit |
225 |
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 |
226 |
|
fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi |
227 |
done |
done |
228 |
fi |
fi |
229 |
|
|
247 |
# Figure out if VERSION should be defined. |
# Figure out if VERSION should be defined. |
248 |
X=`basename \`pwd\`|cut -d \- -f 2-` |
X=`basename \`pwd\`|cut -d \- -f 2-` |
249 |
if [ z"$X" = zgxemul ]; then |
if [ z"$X" = zgxemul ]; then |
250 |
echo '# No VERSION defined.' >> _Makefile.header |
echo '/* No VERSION defined. */' >> config.h |
251 |
else |
else |
252 |
printf "#define VERSION \"$X\"\n" >> config.h |
printf "#define VERSION \"$X\"\n" >> config.h |
253 |
fi |
fi |
266 |
fi |
fi |
267 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
268 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ALPHA\n" >> config.h |
269 |
else |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" |
|
echo 'Disabling Alpha emulation support.' |
|
270 |
fi |
fi |
271 |
if [ z$ENABLEHPPA = zYES ]; then |
if [ z$ENABLEARM = zYES ]; then |
272 |
printf "#define ENABLE_HPPA\n" >> config.h |
printf "#define ENABLE_ARM\n" >> config.h |
273 |
else |
CPU_ARCHS="$CPU_ARCHS cpu_arm.o" |
274 |
echo 'Disabling HPPA emulation support.' |
fi |
275 |
|
if [ z$ENABLEIA64 = zYES ]; then |
276 |
|
printf "#define ENABLE_IA64\n" >> config.h |
277 |
|
CPU_ARCHS="$CPU_ARCHS cpu_ia64.o" |
278 |
|
fi |
279 |
|
if [ z$ENABLEM68K = zYES ]; then |
280 |
|
printf "#define ENABLE_M68K\n" >> config.h |
281 |
|
CPU_ARCHS="$CPU_ARCHS cpu_m68k.o" |
282 |
fi |
fi |
283 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
284 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
|
else |
|
|
echo 'Disabling MIPS emulation support.' |
|
285 |
fi |
fi |
286 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
287 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
288 |
else |
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
|
echo 'Disabling PPC emulation support.' |
|
289 |
fi |
fi |
290 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
291 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
292 |
else |
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" |
|
echo 'Disabling SPARC emulation support.' |
|
293 |
fi |
fi |
294 |
if [ z$ENABLEURISC = zYES ]; then |
if [ z$ENABLEX86 = zYES ]; then |
295 |
printf "#define ENABLE_URISC\n" >> config.h |
printf "#define ENABLE_X86\n" >> config.h |
296 |
else |
CPU_ARCHS="$CPU_ARCHS cpu_x86.o" |
|
echo 'Disabling URISC emulation support.' |
|
297 |
fi |
fi |
298 |
|
|
299 |
|
|
304 |
fi |
fi |
305 |
|
|
306 |
|
|
307 |
# Instruction delay/latency emulation: |
# Development option: ALWAYS_SIGNEXTEND_32 |
308 |
if [ z$ALWAYS32 = zYES ]; then |
if [ z$ALWAYS32 = zYES ]; then |
309 |
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
310 |
'This slows down everything.)' |
'This slows down everything.)' |
312 |
fi |
fi |
313 |
|
|
314 |
|
|
315 |
|
# Development option: TRACE_NULL_CRASHES |
316 |
|
if [ z$TRACENULL = zYES ]; then |
317 |
|
echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \ |
318 |
|
'This slows down the emulator.)' |
319 |
|
printf "#define TRACE_NULL_CRASHES\n" >> config.h |
320 |
|
fi |
321 |
|
|
322 |
|
|
323 |
# Cache emulation: |
# Cache emulation: |
324 |
if [ z$CACHES = zYES ]; then |
if [ z$CACHES = zYES ]; then |
325 |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
331 |
printf ' (--delays) will not produce correct ' |
printf ' (--delays) will not produce correct ' |
332 |
printf 'cache miss penalties and such.\n' |
printf 'cache miss penalties and such.\n' |
333 |
fi |
fi |
334 |
|
|
335 |
|
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
336 |
|
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
337 |
fi |
fi |
338 |
|
|
339 |
|
|
534 |
fi |
fi |
535 |
|
|
536 |
|
|
537 |
# Check for weird 'alpha' define. |
# Check for 'alpha' define. |
538 |
printf "checking for weird 'alpha' define... " |
printf "checking for 'alpha' define... " |
539 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
540 |
#ifdef alpha |
#ifdef alpha |
541 |
printf(\"1\"); |
printf(\"1\"); |
565 |
rm -f _testm* |
rm -f _testm* |
566 |
|
|
567 |
|
|
|
# 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* |
|
|
|
|
|
|
|
568 |
# 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) |
569 |
printf "checking for weird 'mips' define... " |
printf "checking for 'mips' define... " |
570 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
571 |
#ifdef mips |
#ifdef mips |
572 |
printf(\"1\"); |
printf(\"1\"); |
598 |
|
|
599 |
# 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 |
600 |
# any OS actually defined ppc like this. |
# any OS actually defined ppc like this. |
601 |
printf "checking for weird 'ppc' define... " |
printf "checking for 'ppc' define... " |
602 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
603 |
#ifdef ppc |
#ifdef ppc |
604 |
printf(\"1\"); |
printf(\"1\"); |
630 |
|
|
631 |
# 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 |
632 |
# any OS actually defined sparc like this. |
# any OS actually defined sparc like this. |
633 |
printf "checking for weird 'sparc' define... " |
printf "checking for 'sparc' define... " |
634 |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
printf "#include <stdio.h>\nint main(int argc, char *argv[]){ |
635 |
#ifdef sparc |
#ifdef sparc |
636 |
printf(\"1\"); |
printf(\"1\"); |
767 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
768 |
|
|
769 |
|
|
|
# -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 |
|
|
|
|
|
|
|
770 |
# -fomit-frame-pointer |
# -fomit-frame-pointer |
771 |
printf "checking whether -fomit-frame-pointer can be used... " |
printf "checking whether -fomit-frame-pointer can be used... " |
772 |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
863 |
rm -f _testr.[co] _testr |
rm -f _testr.[co] _testr |
864 |
|
|
865 |
|
|
866 |
|
# strlcpy missing? |
867 |
|
printf "checking for strlcpy... " |
868 |
|
printf "#include <string.h> |
869 |
|
int main(int argc, char *argv[]) { char *p; char *q; size_t x; |
870 |
|
x = strlcpy(p, q, 50); return 0;}\n" > _tests.c |
871 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
872 |
|
if [ ! -x _tests ]; then |
873 |
|
printf "missing, using mystrlcpy\n" |
874 |
|
printf "#define strlcpy mystrlcpy\n" >> config.h |
875 |
|
printf "#define strlcat mystrlcat\n" >> config.h |
876 |
|
printf "#define USE_STRLCPY_REPLACEMENTS\n" >> config.h |
877 |
|
else |
878 |
|
printf "found\n" |
879 |
|
fi |
880 |
|
rm -f _tests.[co] _tests |
881 |
|
|
882 |
|
|
883 |
# strtoull missing? |
# strtoull missing? |
884 |
printf "checking for strtoull... " |
printf "checking for strtoull... " |
885 |
printf "#include <stdlib.h> |
printf "#include <stdlib.h> |
892 |
printf "missing, using mystrtoull\n" |
printf "missing, using mystrtoull\n" |
893 |
printf "#define strtoull mystrtoull\n" >> config.h |
printf "#define strtoull mystrtoull\n" >> config.h |
894 |
else |
else |
895 |
printf "yes\n" |
printf "found\n" |
896 |
fi |
fi |
897 |
rm -f _testlong* _tests.[co] _tests |
rm -f _tests.[co] _tests |
898 |
|
|
899 |
|
|
900 |
|
# mkstemp missing? |
901 |
|
printf "checking for mkstemp... " |
902 |
|
printf "#include <unistd.h> |
903 |
|
int main(int argc, char *argv[]) { int x; char *y = \"abc\"; |
904 |
|
x = mkstemp(y); return 0;}\n" > _tests.c |
905 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
906 |
|
if [ ! -x _tests ]; then |
907 |
|
printf "missing, using workaround\n" |
908 |
|
printf "#define mkstemp mymkstemp\n" >> config.h |
909 |
|
else |
910 |
|
printf "found\n" |
911 |
|
fi |
912 |
|
rm -f _tests.[co] _tests |
913 |
|
|
914 |
|
|
915 |
# fseeko missing? |
# fseeko missing? |
921 |
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 |
922 |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
923 |
if [ ! -x _tests ]; then |
if [ ! -x _tests ]; then |
924 |
printf "no\n" |
printf "missing\n" |
925 |
printf "WARNING! fseeko missing from libc. Using a hack, " |
printf "WARNING! fseeko missing from libc. Using a hack, " |
926 |
printf "which probably doesn't work.\n" |
printf "which probably doesn't work.\n" |
927 |
printf "#define HACK_FSEEKO\n" >> config.h |
printf "#define HACK_FSEEKO\n" >> config.h |
928 |
else |
else |
929 |
printf "yes\n" |
printf "found\n" |
930 |
fi |
fi |
931 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
932 |
|
|
944 |
printf "no, using int\n" |
printf "no, using int\n" |
945 |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
946 |
else |
else |
947 |
printf "yes\n" |
printf "socklen_t\n" |
948 |
fi |
fi |
949 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
950 |
|
|
1112 |
|
|
1113 |
############################################################################### |
############################################################################### |
1114 |
|
|
1115 |
|
# Host byte order? |
1116 |
|
printf "checking host endianness... " |
1117 |
|
rm -f _test_end* |
1118 |
|
printf '#include <stdio.h> |
1119 |
|
int main(int argc, char *argv[]) |
1120 |
|
{ int x = 1; void *xp = (void *)&x; char *p = (char *)xp; |
1121 |
|
if (*p) printf("little\\\n"); else printf("big\\\n"); } |
1122 |
|
' > _test_end.c |
1123 |
|
$CC $CFLAGS _test_end.c -o _test_end 2> /dev/null |
1124 |
|
X=`./_test_end` |
1125 |
|
echo $X |
1126 |
|
if [ z$X = zlittle ]; then |
1127 |
|
printf "#define HOST_LITTLE_ENDIAN\n" >> config.h |
1128 |
|
else |
1129 |
|
if [ z$X = zbig ]; then |
1130 |
|
printf "#define HOST_BIG_ENDIAN\n" >> config.h |
1131 |
|
else |
1132 |
|
echo "Error! Could not determine host's endianness." |
1133 |
|
exit |
1134 |
|
fi |
1135 |
|
fi |
1136 |
|
rm -f _test_end* |
1137 |
|
|
1138 |
|
############################################################################### |
1139 |
|
|
1140 |
# Prefetch support? |
# Prefetch support? |
1141 |
printf "checking for asm prefetch support... " |
printf "checking for asm prefetch support... " |
1142 |
if [ z"`uname -m`" = zalpha ]; then |
if [ z"`uname -m`" = zalpha ]; then |
1163 |
|
|
1164 |
############################################################################### |
############################################################################### |
1165 |
|
|
1166 |
INCLUDE=-I../include/ |
INCLUDE=-Iinclude/ |
1167 |
|
DINCLUDE=-I../include/ |
1168 |
|
|
1169 |
|
rm -f _testprog.c |
1170 |
|
|
1171 |
echo C compiler flags: $CFLAGS $CWARNINGS $INCLUDE |
echo C compiler flags: $CFLAGS $CWARNINGS |
1172 |
echo Linker flags: $OTHERLIBS |
echo Linker flags: $OTHERLIBS |
1173 |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
1174 |
echo "COPTIM=$CFLAGS" >> _Makefile.header |
echo "COPTIM=$CFLAGS" >> _Makefile.header |
1175 |
echo "INCLUDE=$INCLUDE" >> _Makefile.header |
echo "INCLUDE=$INCLUDE" >> _Makefile.header |
1176 |
|
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
1177 |
echo "CC=$CC" >> _Makefile.header |
echo "CC=$CC" >> _Makefile.header |
1178 |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
1179 |
|
echo "CPU_ARCHS=$CPU_ARCHS" >> _Makefile.header |
1180 |
echo "" >> _Makefile.header |
echo "" >> _Makefile.header |
1181 |
|
|
1182 |
|
|
|
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 |
|
|
|
|
|
|
|
1183 |
# Create the Makefiles: |
# Create the Makefiles: |
1184 |
|
|
1185 |
for a in . src devices devices/fonts tests; do |
for a in . src src/devices src/devices/fonts; do |
1186 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1187 |
touch $a/Makefile |
touch $a/Makefile |
1188 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |