1 |
#!/bin/sh |
#!/bin/sh |
2 |
############################################################################### |
############################################################################### |
3 |
# |
# |
4 |
# Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
# Copyright (C) 2003-2007 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.277 2007/08/29 20:36:05 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...) |
# The general philosophy regarding command line switches is that anything |
54 |
# |
# which can be incorporated into the program as a runtime command line option |
55 |
# TODO: |
# should be, instead of requiring a recompile. |
|
# o) do not enable prefetch on Alpha ev4 or ev5, only on pca56 and newer |
|
|
# o) X11 libs and includes via command line options? |
|
56 |
# |
# |
57 |
############################################################################### |
############################################################################### |
58 |
|
|
59 |
# Figure out if this is a stable version (0.x.x). |
# Figure out if this is a stable version (0.x.x). |
60 |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
X=`basename \`pwd\`|cut -d \- -f 2-|cut -c1-2` |
61 |
if [ z"$X" = z0. ]; then |
if [ z"$X" = z0. ]; then |
62 |
# Stable: |
# Stable. |
63 |
ENABLEARM=YES |
: |
64 |
ENABLEMIPS=YES |
else |
65 |
else |
# Development. |
66 |
# Development: |
UNSTABLE=YES |
|
ENABLEALPHA=YES |
|
|
ENABLEARM=YES |
|
|
ENABLEAVR=NO |
|
|
ENABLEHPPA=NO |
|
|
ENABLEI960=NO |
|
|
ENABLEIA64=NO |
|
|
ENABLEM68K=NO |
|
|
ENABLEMIPS=YES |
|
|
ENABLEPPC=YES |
|
|
ENABLESH=NO |
|
|
ENABLESPARC=NO |
|
|
ENABLEX86=NO |
|
67 |
fi |
fi |
68 |
|
|
69 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
71 |
for a in $*; do |
for a in $*; do |
72 |
if [ z$a = z--disable-x ]; then |
if [ z$a = z--disable-x ]; then |
73 |
NOX11=YES |
NOX11=YES |
74 |
else if [ z$a = z--always32 ]; then |
else if [ z$a = z--debug ]; then |
75 |
ALWAYS32=YES |
DEBUG=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 |
|
76 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
77 |
echo "usage: $0 [options]" |
printf "usage: $0 [options]\n\n" |
78 |
|
echo " --disable-x don't include X11 support,"\ |
79 |
printf "\nGeneral options:\n\n" |
"even if the host supports it" |
80 |
|
if [ z"$UNSTABLE" = zYES ]; then |
81 |
echo " --disable-bintrans configure without the" \ |
echo " --debug configure" \ |
82 |
"old binary translation subsystem," |
"for a debug build" |
|
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 " |
|
83 |
fi |
fi |
84 |
printf "MIPS CPU emulation\n" |
echo |
|
|
|
|
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" |
|
85 |
exit |
exit |
86 |
else |
else |
87 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
88 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
89 |
"available options." |
"available options." |
90 |
exit |
exit |
91 |
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; fi |
|
92 |
done |
done |
93 |
fi |
fi |
94 |
|
|
112 |
# Figure out if VERSION should be defined. |
# Figure out if VERSION should be defined. |
113 |
X=`basename \`pwd\`|cut -d \- -f 2-` |
X=`basename \`pwd\`|cut -d \- -f 2-` |
114 |
if [ z"$X" = zgxemul ]; then |
if [ z"$X" = zgxemul ]; then |
115 |
echo '/* No VERSION defined. */' >> config.h |
printf "#define VERSION \"(unknown version)\"\n" >> config.h |
116 |
else |
else |
117 |
printf "#define VERSION \"$X\"\n" >> config.h |
printf "#define VERSION \"$X\"\n" >> config.h |
118 |
fi |
fi |
119 |
|
|
120 |
|
|
121 |
ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\`` |
if [ z"$UNSTABLE" = zYES ]; then |
122 |
printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h |
printf "#define UNSTABLE_DEVEL\n" >> config.h |
123 |
|
else |
124 |
|
CFLAGS="-DNDEBUG $CFLAGS" |
|
|
|
|
# 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 |
|
|
if [ z$ENABLEALPHA = zYES ]; then |
|
|
printf "#define ENABLE_ALPHA\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o" |
|
|
CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" |
|
|
fi |
|
|
if [ z$ENABLEARM = zYES ]; then |
|
|
printf "#define ENABLE_ARM\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o " |
|
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_loadstore.o" |
|
|
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_dpi" |
|
|
fi |
|
|
if [ z$ENABLEAVR = zYES ]; then |
|
|
printf "#define ENABLE_AVR\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_avr.o" |
|
|
fi |
|
|
if [ z$ENABLEHPPA = zYES ]; then |
|
|
printf "#define ENABLE_HPPA\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_hppa.o" |
|
|
fi |
|
|
if [ z$ENABLEI960 = zYES ]; then |
|
|
printf "#define ENABLE_I960\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_i960.o" |
|
|
fi |
|
|
if [ z$ENABLEIA64 = zYES ]; then |
|
|
printf "#define ENABLE_IA64\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_ia64.o" |
|
|
fi |
|
|
if [ z$ENABLEM68K = zYES ]; then |
|
|
printf "#define ENABLE_M68K\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_m68k.o" |
|
|
fi |
|
|
if [ z$ENABLEMIPS = zYES ]; then |
|
|
printf "#define ENABLE_MIPS\n" >> config.h |
|
|
fi |
|
|
if [ z$ENABLEPPC = zYES ]; then |
|
|
printf "#define ENABLE_PPC\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
|
|
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
|
|
fi |
|
|
if [ z$ENABLESH = zYES ]; then |
|
|
printf "#define ENABLE_SH\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_sh.o" |
|
|
fi |
|
|
if [ z$ENABLESPARC = zYES ]; then |
|
|
printf "#define ENABLE_SPARC\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" |
|
|
fi |
|
|
if [ z$ENABLEX86 = zYES ]; then |
|
|
printf "#define ENABLE_X86\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_x86.o" |
|
|
fi |
|
|
|
|
|
|
|
|
# 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 |
|
125 |
fi |
fi |
126 |
|
|
127 |
|
|
128 |
# Development option: TRACE_NULL_CRASHES |
ZZ=`echo compiled on \`uname\`/\`uname -m\`, \`date\`` |
129 |
if [ z$TRACENULL = zYES ]; then |
printf "#define COMPILE_DATE \"$ZZ\"\n" >> config.h |
|
echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \ |
|
|
'This slows down the emulator.)' |
|
|
printf "#define TRACE_NULL_CRASHES\n" >> config.h |
|
|
fi |
|
130 |
|
|
131 |
|
|
132 |
# Cache emulation: |
# Include support for all CPU types: |
133 |
if [ z$CACHES = zYES ]; then |
printf "#define ADD_ALL_CPU_FAMILIES " >> config.h |
|
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
|
|
printf "#define ENABLE_CACHE_EMULATION\n" >> config.h |
|
134 |
|
|
135 |
if [ z$DELAYS != zYES ]; then |
# Alpha |
136 |
printf 'WARNING: Cache emulation without instruction ' |
printf " add_cpu_family(alpha_cpu_family_init, ARCH_ALPHA);" >> config.h |
137 |
printf 'delay/latency emulation\n' |
CPU_ARCHS="$CPU_ARCHS cpu_alpha.o cpu_alpha_palcode.o memory_alpha.o" |
138 |
printf ' (--delays) will not produce correct ' |
CPU_TOOLS="$CPU_TOOLS generate_alpha_misc" |
139 |
printf 'cache miss penalties and such.\n' |
|
140 |
fi |
# ARM |
141 |
|
printf " add_cpu_family(arm_cpu_family_init, ARCH_ARM);" >> config.h |
142 |
|
CPU_ARCHS="$CPU_ARCHS cpu_arm.o cpu_arm_coproc.o memory_arm.o " |
143 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore.o" |
144 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore_p0_u0_w0.o" |
145 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore_p0_u0_w1.o" |
146 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore_p0_u1_w0.o" |
147 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore_p0_u1_w1.o" |
148 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore_p1_u0_w0.o" |
149 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore_p1_u0_w1.o" |
150 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore_p1_u1_w0.o" |
151 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_loadstore_p1_u1_w1.o" |
152 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_dpi.o tmp_arm_r.o" |
153 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r0.o tmp_arm_r1.o" |
154 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r2.o tmp_arm_r3.o" |
155 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r4.o tmp_arm_r5.o" |
156 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r6.o tmp_arm_r7.o" |
157 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_r8.o tmp_arm_r9.o" |
158 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_ra.o tmp_arm_rb.o" |
159 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_rc.o tmp_arm_rd.o" |
160 |
|
CPU_ARCHS="$CPU_ARCHS tmp_arm_re.o tmp_arm_rf.o tmp_arm_multi.o" |
161 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_dpi generate_arm_r" |
162 |
|
CPU_TOOLS="$CPU_TOOLS generate_arm_loadstore generate_arm_multi" |
163 |
|
|
164 |
|
# M32R |
165 |
|
printf " add_cpu_family(m32r_cpu_family_init, ARCH_M32R);" >> config.h |
166 |
|
CPU_ARCHS="$CPU_ARCHS cpu_m32r.o memory_m32r.o" |
167 |
|
|
168 |
|
# M88K |
169 |
|
printf " add_cpu_family(m88k_cpu_family_init, ARCH_M88K);" >> config.h |
170 |
|
CPU_ARCHS="$CPU_ARCHS cpu_m88k.o memory_m88k.o" |
171 |
|
CPU_TOOLS="$CPU_TOOLS generate_m88k_bcnd" |
172 |
|
CPU_TOOLS="$CPU_TOOLS generate_m88k_loadstore" |
173 |
|
|
174 |
|
# MIPS |
175 |
|
printf " add_cpu_family(mips_cpu_family_init, ARCH_MIPS);" >> config.h |
176 |
|
CPU_ARCHS="$CPU_ARCHS cpu_mips.o cpu_mips_coproc.o " |
177 |
|
CPU_ARCHS="$CPU_ARCHS cpu_mips_instr_unaligned.o" |
178 |
|
CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore" |
179 |
|
CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore_multi" |
180 |
|
|
181 |
|
# POWER/PowerPC |
182 |
|
printf " add_cpu_family(ppc_cpu_family_init, ARCH_PPC);" >> config.h |
183 |
|
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
184 |
|
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
185 |
|
|
186 |
|
# SuperH |
187 |
|
printf " add_cpu_family(sh_cpu_family_init, ARCH_SH);" >> config.h |
188 |
|
CPU_ARCHS="$CPU_ARCHS cpu_sh.o memory_sh.o" |
189 |
|
|
190 |
|
# SPARC |
191 |
|
printf " add_cpu_family(sparc_cpu_family_init, ARCH_SPARC);" >> config.h |
192 |
|
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o memory_sparc.o" |
193 |
|
CPU_TOOLS="$CPU_TOOLS generate_sparc_loadstore" |
194 |
|
|
195 |
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
printf "\n" >> config.h |
|
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
|
|
fi |
|
196 |
|
|
197 |
|
|
198 |
############################################################################### |
############################################################################### |
239 |
#\n\n" >> _Makefile.header |
#\n\n" >> _Makefile.header |
240 |
|
|
241 |
|
|
242 |
echo 'int main(int argc, char *argv[]) { return 0; }' > _testprog.c |
# Try with the simplest possible test program. Actually, test static variables |
243 |
|
# as well, because GXemul uses things like NULL-initialized global pointers, |
244 |
|
# and it is important that they work. (GCC on Solaris is known to be completely |
245 |
|
# broken, for instance.) |
246 |
|
|
247 |
|
echo '#include <stdio.h> |
248 |
|
|
249 |
|
int main(int argc, char *argv[]) |
250 |
|
{ |
251 |
|
static int x = 0; |
252 |
|
static int y = 1; |
253 |
|
printf("%i,%i", x, y); |
254 |
|
return 0; |
255 |
|
} |
256 |
|
' > _testprog.c |
257 |
|
|
258 |
|
|
259 |
# Try to detect which C compiler to use, if CC is not set: |
# Try to detect which C compiler to use, if CC is not set: |
260 |
printf "checking which C compiler to use... " |
printf "checking which C compiler to use... " |
261 |
|
rm -f _testprog |
262 |
if [ z"$CC" = z ]; then |
if [ z"$CC" = z ]; then |
|
CC=cc |
|
|
|
|
263 |
# Try gcc first: |
# Try gcc first: |
264 |
printf "#!/bin/sh\ngcc _testprog.c -o _testprog >" > _test.sh |
printf "#!/bin/sh\ngcc $CFLAGS _testprog.c -o _testprog >" > _test.sh |
265 |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
266 |
chmod 755 _test.sh |
chmod 755 _test.sh |
267 |
./_test.sh > /dev/null 2> /dev/null |
./_test.sh > /dev/null 2> /dev/null |
268 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
269 |
CC=gcc |
if [ z`./_testprog` = z0,1 ]; then |
270 |
|
CC=gcc |
271 |
|
else |
272 |
|
printf "broken gcc detected\n" |
273 |
|
printf "The test program:\n\n" |
274 |
|
cat _testprog.c |
275 |
|
printf "\nshould have resulted in 0,1, but the" |
276 |
|
printf " result was: " |
277 |
|
./_testprog |
278 |
|
printf "\n\nchecking for other C compilers... " |
279 |
|
fi |
280 |
fi |
fi |
281 |
rm -f _testprog |
rm -f _testprog |
282 |
|
|
283 |
# If both gcc and cc exist, then cc might be a vendor specific |
# If both gcc and cc exist, then cc might be a vendor specific |
284 |
# compiler which produces faster code than gcc (eg on Solaris): |
# compiler which produces faster code than gcc (eg on Solaris): |
285 |
printf "#!/bin/sh\ncc _testprog.c -o _testprog >" > _test.sh |
printf "#!/bin/sh\ncc $CFLAGS _testprog.c -o _testprog >" > _test.sh |
286 |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
printf " /dev/null 2> /dev/null\n" >> _test.sh |
287 |
chmod 755 _test.sh |
chmod 755 _test.sh |
288 |
./_test.sh > /dev/null 2> /dev/null |
./_test.sh > /dev/null 2> /dev/null |
289 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
290 |
CC=cc |
if [ z`./_testprog` = z0,1 ]; then |
291 |
|
CC=cc |
292 |
|
else |
293 |
|
printf "broken cc detected\n" |
294 |
|
printf "checking for other C compilers... " |
295 |
|
fi |
296 |
fi |
fi |
297 |
rm -f _testprog |
rm -f _testprog |
298 |
|
|
299 |
|
# Actually, don't try ccc on Alpha. ccc generates broken code :( |
300 |
|
|
301 |
# # Try ccc (FreeBSD/Alpha): |
# # Try ccc (FreeBSD/Alpha): |
302 |
# printf "#!/bin/sh\nccc _testprog.c -o _testprog >" > _test.sh |
# printf "#!/bin/sh\nccc $CFLAGS _testprog.c -o _testprog >" > _test.sh |
303 |
# printf " /dev/null 2> /dev/null\n" >> _test.sh |
# printf " /dev/null 2> /dev/null\n" >> _test.sh |
304 |
# chmod 755 _test.sh |
# chmod 755 _test.sh |
305 |
# ./_test.sh > /dev/null 2> /dev/null |
# ./_test.sh > /dev/null 2> /dev/null |
313 |
|
|
314 |
|
|
315 |
rm -f _testprog |
rm -f _testprog |
316 |
|
|
317 |
|
if [ z$CC = z ]; then |
318 |
|
printf "no working compiler detected\n" |
319 |
|
printf "\nPlease set the CC environment variable to a working C " |
320 |
|
printf "compiler before running\nthe configure script, and make" |
321 |
|
printf " sure that the CFLAGS environment variable is\nalso valid" |
322 |
|
printf " for that compiler.\n" |
323 |
|
exit |
324 |
|
fi |
325 |
|
|
326 |
printf "$CC $CFLAGS" |
printf "$CC $CFLAGS" |
327 |
|
|
328 |
|
|
379 |
rm -f _test_x11 _test_x11.o |
rm -f _test_x11 _test_x11.o |
380 |
|
|
381 |
if [ z$XOK = z0 ]; then |
if [ z$XOK = z0 ]; then |
382 |
|
XINCLUDE=-I/usr/local/include |
383 |
|
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
384 |
|
$XINCLUDE 2> /dev/null |
385 |
|
|
386 |
|
XLIB="-L/usr/local/lib -lX11" |
387 |
|
$CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null |
388 |
|
|
389 |
|
if [ -x _test_x11 ]; then |
390 |
|
XOK=1 |
391 |
|
fi |
392 |
|
fi |
393 |
|
rm -f _test_x11 _test_x11.o |
394 |
|
|
395 |
|
# Special case for some 64-bit Linux/x86_64 systems: |
396 |
|
if [ z$XOK = z0 ]; then |
397 |
|
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
398 |
|
$XINCLUDE 2> /dev/null |
399 |
|
|
400 |
|
XLIB="-L/usr/X11R6/lib64 -lX11" |
401 |
|
$CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null |
402 |
|
|
403 |
|
if [ -x _test_x11 ]; then |
404 |
|
XOK=1 |
405 |
|
fi |
406 |
|
fi |
407 |
|
rm -f _test_x11 _test_x11.o |
408 |
|
|
409 |
|
if [ z$XOK = z0 ]; then |
410 |
XINCLUDE="" |
XINCLUDE="" |
411 |
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
412 |
$XINCLUDE 2> /dev/null |
$XINCLUDE 2> /dev/null |
598 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ z"$COMPAQCC" = zYES ]; then |
599 |
CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop" |
CWARNINGS="$CWARNINGS -msg_disable longlongtype,unusedtop" |
600 |
fi |
fi |
601 |
|
|
602 |
|
if [ z"$UNSTABLE" = zYES ]; then |
603 |
|
printf "checking whether -Werror can be used... " |
604 |
|
rm -f _testprog |
605 |
|
$CC $CFLAGS $CWARNINGS _testprog.c -o _testprog -Werror 2> /dev/null |
606 |
|
if [ -x _testprog ]; then |
607 |
|
printf "yes\n" |
608 |
|
CWARNINGS="$CWARNINGS -Werror" |
609 |
|
else |
610 |
|
printf "no\n" |
611 |
|
fi |
612 |
|
fi |
613 |
else |
else |
614 |
printf "no\n" |
printf "no\n" |
615 |
fi |
fi |
616 |
rm -f _testprog |
rm -f _testprog |
617 |
|
|
618 |
|
|
619 |
|
# -Wstrict-aliasing |
620 |
|
if [ ! z"$DEBUG" = zYES ]; then |
621 |
|
printf "checking whether -Wstrict-aliasing can be used... " |
622 |
|
$CC $CFLAGS -Wstrict-aliasing _testprog.c -o \ |
623 |
|
_testprog 1> _testprog.stdout 2>&1 |
624 |
|
cat _testprog.stdout >> _testprog.error |
625 |
|
if grep frame _testprog.error > /dev/null 2>&1; then |
626 |
|
printf "no\n" |
627 |
|
else |
628 |
|
if [ -x _testprog ]; then |
629 |
|
CWARNINGS="-Wstrict-aliasing $CWARNINGS" |
630 |
|
printf "yes\n" |
631 |
|
else |
632 |
|
printf "no\n" |
633 |
|
fi |
634 |
|
fi |
635 |
|
rm -f _testprog _testprog.error _testprog.stdout |
636 |
|
fi |
637 |
|
|
638 |
|
|
639 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ z"$COMPAQCC" = zYES ]; then |
640 |
# -O4 is possible, but is -O3 better? |
# -O4 is possible, but sometimes -O3 is better? |
641 |
CFLAGS="-O4 $CFLAGS" |
if [ ! z"$DEBUG" = zYES ]; then |
642 |
|
CFLAGS="-O4 $CFLAGS" |
643 |
|
fi |
644 |
else |
else |
645 |
if [ z"`uname`" = zSunOS ]; then |
if [ z"`uname`" = zSunOS ]; then |
646 |
# "cc", the system's default compiler: |
# "cc", the system's default compiler: |
647 |
if [ z"$SUNCC" = zYES ]; then |
if [ ! z"$DEBUG" = zYES ]; then |
648 |
CFLAGS="-xO5 -xdepend $CFLAGS" |
if [ z"$SUNCC" = zYES ]; then |
649 |
|
CFLAGS="-xO5 -xdepend $CFLAGS" |
650 |
|
fi |
651 |
fi |
fi |
652 |
printf "#define SOLARIS\n" >> config.h |
printf "#define SOLARIS\n" >> config.h |
653 |
OTHERLIBS="-lsocket $OTHERLIBS" |
OTHERLIBS="-lsocket $OTHERLIBS" |
654 |
else |
else |
655 |
# gcc or something else: |
# gcc or something else: |
656 |
$CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null |
if [ ! z"$DEBUG" = zYES ]; then |
657 |
if [ -x _testprog ]; then |
$CC $CFLAGS _testprog.c -o _testprog -O 2> /dev/null |
|
rm -f _testprog |
|
|
$CC $CFLAGS _testprog.c -o _testprog -O2 2> /dev/null |
|
658 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
659 |
CFLAGS="-O2 $CFLAGS" |
rm -f _testprog |
660 |
else |
$CC $CFLAGS _testprog.c -o _testprog \ |
661 |
CFLAGS="-O $CFLAGS" |
-O3 2> /dev/null |
662 |
|
if [ -x _testprog ]; then |
663 |
|
CFLAGS="-O3 $CFLAGS" |
664 |
|
else |
665 |
|
CFLAGS="-O $CFLAGS" |
666 |
|
fi |
667 |
fi |
fi |
668 |
fi |
fi |
669 |
fi |
fi |
673 |
|
|
674 |
# -fschedule-insns causes bugs on i386 with gcc, |
# -fschedule-insns causes bugs on i386 with gcc, |
675 |
# but works OK on my alpha with ccc (compaq's cc). |
# but works OK on my alpha with ccc (compaq's cc). |
676 |
if [ z"$COMPAQCC" = zYES ]; then |
if [ ! z"$DEBUG" = zYES ]; then |
677 |
|
if [ z"$COMPAQCC" = zYES ]; then |
678 |
printf "checking whether -fschedule-insns2 can be used... " |
printf "checking whether -fschedule-insns2 can be used... " |
679 |
$CC $CFLAGS _testprog.c -o _testprog -fschedule-insns2 2> /dev/null |
$CC $CFLAGS _testprog.c -o _testprog -fschedule-insns2 2> /dev/null |
680 |
if [ -x _testprog ]; then |
if [ -x _testprog ]; then |
695 |
fi |
fi |
696 |
rm -f _testprog |
rm -f _testprog |
697 |
|
|
698 |
# # -intrinsics |
# -intrinsics |
699 |
# $CC $CFLAGS _testprog.c -o _testprog -intrinsics 2> /dev/null |
printf "checking whether -intrinsics can be used... " |
700 |
# if [ -x _testprog ]; then |
$CC $CFLAGS _testprog.c -o _testprog -intrinsics 2> /dev/null |
701 |
# CFLAGS="-intrinsics $CFLAGS" |
if [ -x _testprog ]; then |
702 |
# fi |
CFLAGS="-intrinsics $CFLAGS" |
703 |
# rm -f _testprog |
printf "yes\n" |
704 |
|
else |
705 |
|
printf "no\n" |
706 |
|
fi |
707 |
|
rm -f _testprog |
708 |
|
|
709 |
# -fast |
# -fast |
710 |
printf "checking whether -fast can be used... " |
printf "checking whether -fast can be used... " |
716 |
printf "no\n" |
printf "no\n" |
717 |
fi |
fi |
718 |
rm -f _testprog |
rm -f _testprog |
719 |
fi |
fi; fi |
720 |
|
|
721 |
|
|
722 |
# -fpeephole |
# -fpeephole |
723 |
printf "checking whether -fpeephole can be used... " |
if [ ! z"$DEBUG" = zYES ]; then |
724 |
$CC $CFLAGS -fpeephole _testprog.c -o _testprog > _testprog.stdout 2>&1 |
printf "checking whether -fpeephole can be used... " |
725 |
cat _testprog.stdout >> _testprog.error |
$CC $CFLAGS -fpeephole _testprog.c -o _testprog > _testprog.stdout 2>&1 |
726 |
if grep peephole _testprog.error > /dev/null 2>&1; then |
cat _testprog.stdout >> _testprog.error |
727 |
printf "no\n" |
if grep peephole _testprog.error > /dev/null 2>&1; then |
|
else |
|
|
if [ -x _testprog ]; then |
|
|
CFLAGS="-fpeephole $CFLAGS" |
|
|
printf "yes\n" |
|
|
else |
|
728 |
printf "no\n" |
printf "no\n" |
729 |
|
else |
730 |
|
if [ -x _testprog ]; then |
731 |
|
CFLAGS="-fpeephole $CFLAGS" |
732 |
|
printf "yes\n" |
733 |
|
else |
734 |
|
printf "no\n" |
735 |
|
fi |
736 |
fi |
fi |
737 |
|
rm -f _testprog _testprog.error _testprog.stdout |
738 |
fi |
fi |
|
rm -f _testprog _testprog.error _testprog.stdout |
|
739 |
|
|
740 |
|
|
741 |
# -fomit-frame-pointer |
# -fomit-frame-pointer |
742 |
printf "checking whether -fomit-frame-pointer can be used... " |
if [ ! z"$DEBUG" = zYES ]; then |
743 |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
printf "checking whether -fomit-frame-pointer can be used... " |
744 |
_testprog 1> _testprog.stdout 2>&1 |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
745 |
cat _testprog.stdout >> _testprog.error |
_testprog 1> _testprog.stdout 2>&1 |
746 |
if grep frame _testprog.error > /dev/null 2>&1; then |
cat _testprog.stdout >> _testprog.error |
747 |
printf "no\n" |
if grep frame _testprog.error > /dev/null 2>&1; then |
748 |
else |
printf "no\n" |
|
if [ -x _testprog ]; then |
|
|
CFLAGS="-fomit-frame-pointer $CFLAGS" |
|
|
printf "yes\n" |
|
749 |
else |
else |
750 |
|
if [ -x _testprog ]; then |
751 |
|
CFLAGS="-fomit-frame-pointer $CFLAGS" |
752 |
|
printf "yes\n" |
753 |
|
else |
754 |
|
printf "no\n" |
755 |
|
fi |
756 |
|
fi |
757 |
|
rm -f _testprog _testprog.error _testprog.stdout |
758 |
|
fi |
759 |
|
|
760 |
|
|
761 |
|
# -fstrict-aliasing |
762 |
|
if [ ! z"$DEBUG" = zYES ]; then |
763 |
|
printf "checking whether -fstrict-aliasing can be used... " |
764 |
|
$CC $CFLAGS -fstrict-aliasing _testprog.c -o \ |
765 |
|
_testprog 1> _testprog.stdout 2>&1 |
766 |
|
cat _testprog.stdout >> _testprog.error |
767 |
|
if grep frame _testprog.error > /dev/null 2>&1; then |
768 |
printf "no\n" |
printf "no\n" |
769 |
|
else |
770 |
|
if [ -x _testprog ]; then |
771 |
|
CFLAGS="-fstrict-aliasing $CFLAGS" |
772 |
|
printf "yes\n" |
773 |
|
else |
774 |
|
printf "no\n" |
775 |
|
fi |
776 |
|
fi |
777 |
|
rm -f _testprog _testprog.error _testprog.stdout |
778 |
|
fi |
779 |
|
|
780 |
|
|
781 |
|
# -g, for development builds |
782 |
|
if [ z"$UNSTABLE" = zYES ]; then |
783 |
|
printf "checking whether -g can be used... " |
784 |
|
if [ z"$COMPAQCC" = zYES ]; then |
785 |
|
$CC $CFLAGS -g3 _testprog.c -o _testprog > _testprog.stdout 2>&1 |
786 |
|
cat _testprog.stdout >> _testprog.error |
787 |
|
if [ -x _testprog ]; then |
788 |
|
CFLAGS="-g3 $CFLAGS" |
789 |
|
printf "yes (-g3)\n" |
790 |
|
else |
791 |
|
printf "no\n" |
792 |
|
fi |
793 |
|
else |
794 |
|
$CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1 |
795 |
|
cat _testprog.stdout >> _testprog.error |
796 |
|
if [ -x _testprog ]; then |
797 |
|
CFLAGS="-g $CFLAGS" |
798 |
|
printf "yes\n" |
799 |
|
else |
800 |
|
printf "no\n" |
801 |
|
fi |
802 |
fi |
fi |
803 |
|
rm -f _testprog _testprog.error _testprog.stdout |
804 |
fi |
fi |
|
rm -f _testprog _testprog.error _testprog.stdout |
|
805 |
|
|
806 |
|
|
807 |
# -lrt for nanosleep? |
# -lrt for nanosleep? |
857 |
# -lm? |
# -lm? |
858 |
printf "checking for math libs..." |
printf "checking for math libs..." |
859 |
printf "#include <math.h>\nint main(int argc, char *argv[]) { " > _testr.c |
printf "#include <math.h>\nint main(int argc, char *argv[]) { " > _testr.c |
860 |
printf "double x = sqrt((double)argc); return (int)x; }\n" >> _testr.c |
printf "double x = sqrt(sin((double)argc)); return (int)x; }\n" >> _testr.c |
861 |
$CC $CFLAGS _testr.c -o _testr 2> /dev/null |
$CC $CFLAGS _testr.c -o _testr 2> /dev/null |
862 |
if [ ! -x _testr ]; then |
if [ ! -x _testr ]; then |
863 |
$CC $CFLAGS _testr.c -lm -o _testr 2> /dev/null |
$CC $CFLAGS _testr.c -lm -o _testr 2> /dev/null |
938 |
#include <stdio.h> |
#include <stdio.h> |
939 |
#include <sys/types.h> |
#include <sys/types.h> |
940 |
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 |
941 |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
$CC $CFLAGS $CWARNINGS _tests.c -o _tests 2> /dev/null |
942 |
if [ ! -x _tests ]; then |
if [ ! -x _tests ]; then |
943 |
printf "missing\n" |
# Try with _LARGEFILE_SOURCE (hack to make fseeko |
944 |
printf "WARNING! fseeko missing from libc. Using a hack, " |
# work on 64-bit Linux): |
945 |
printf "which probably doesn't work.\n" |
$CC $CFLAGS -D_LARGEFILE_SOURCE $CWARNINGS _tests.c -o _tests 2> /dev/null |
946 |
printf "#define HACK_FSEEKO\n" >> config.h |
if [ ! -x _tests ]; then |
947 |
|
printf "missing\n" |
948 |
|
printf "WARNING! fseeko missing from libc. Using a hack, " |
949 |
|
printf "which probably doesn't work.\n" |
950 |
|
printf "#define HACK_FSEEKO\n" >> config.h |
951 |
|
else |
952 |
|
printf "using -D_LARGEFILE_SOURCE hack\n" |
953 |
|
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE" |
954 |
|
fi |
955 |
else |
else |
956 |
printf "found\n" |
printf "found\n" |
957 |
fi |
fi |
1008 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
1009 |
|
|
1010 |
|
|
1011 |
|
# Check for PRIx64 in inttypes.h: |
1012 |
|
printf "checking for PRIx64 in inttypes.h... " |
1013 |
|
printf "#include <inttypes.h>\nint main(int argc, char *argv[])\n |
1014 |
|
{\n#ifdef PRIx64\nreturn 0;\n#else\nreturn 1;\n#endif\n}\n" > _testpri.c |
1015 |
|
$CC $CFLAGS _testpri.c -o _testpri 2> /dev/null |
1016 |
|
if [ ! -x _testpri ]; then |
1017 |
|
printf "\nERROR! COULD NOT COMPILE PRIx64 TEST PROGRAM AT ALL!\n" |
1018 |
|
exit |
1019 |
|
else |
1020 |
|
if ./_testpri; then |
1021 |
|
printf "yes\n" |
1022 |
|
else |
1023 |
|
printf "no, using an ugly hack instead, " |
1024 |
|
printf "#define NO_C99_PRINTF_DEFINES\n" >> config.h |
1025 |
|
|
1026 |
|
# Try llx first: |
1027 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){ |
1028 |
|
printf(\"%%llx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c |
1029 |
|
rm -f _testpri |
1030 |
|
$CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> /dev/null |
1031 |
|
if [ z`./_testpri` = z80 ]; then |
1032 |
|
printf "PRIx64=llx\n" |
1033 |
|
printf "#define NO_C99_64BIT_LONGLONG\n" >> config.h |
1034 |
|
else |
1035 |
|
# Try lx too: |
1036 |
|
printf "#include <stdio.h>\n#include <inttypes.h>\nint main(int argc, char *argv[]){ |
1037 |
|
printf(\"%%lx\\\n\", (int64_t)128);return 0;}\n" > _testpri.c |
1038 |
|
rm -f _testpri |
1039 |
|
$CC $CFLAGS $CWARNINGS _testpri.c -o _testpri 2> _testpri.result |
1040 |
|
if [ z`./_testpri` = z80 ]; then |
1041 |
|
printf "PRIx64=lx\n" |
1042 |
|
else |
1043 |
|
printf "\nFailed, neither lx nor llx worked!\n" |
1044 |
|
exit |
1045 |
|
fi |
1046 |
|
fi |
1047 |
|
fi |
1048 |
|
fi |
1049 |
|
rm -f _testpri.c _testpri _testpri.result |
1050 |
|
|
1051 |
|
|
1052 |
# Check for 64-bit off_t: |
# Check for 64-bit off_t: |
1053 |
printf "checking for 64-bit off_t... " |
printf "checking for 64-bit off_t... " |
1054 |
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 |
1136 |
else |
else |
1137 |
printf "yes\n" |
printf "yes\n" |
1138 |
fi |
fi |
1139 |
rm -f _testuint.c _testuint |
rm -f _testuint* |
|
|
|
|
|
|
|
############################################################################### |
|
|
# |
|
|
# 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 |
|
1140 |
|
|
1141 |
# # UltraSPARC: |
printf "checking for __FUNCTION__... " |
1142 |
# if [ z"`uname -m`" = zsun4u ]; then |
printf "#include <stdio.h>\n\nint main(int argc, char *argv[]) { |
1143 |
# printf "#define SPARCV9\n" >> config.h |
if (__FUNCTION__) printf(__FUNCTION__);\n return 0;\n}\n" > _testfunction.c |
1144 |
# printf "#define BINTRANS\n" >> config.h |
$CC $CFLAGS _testfunction.c -o _testfunction 2> /dev/null |
1145 |
# printf "SPARC V9\n" |
if [ ! -x _testfunction ]; then |
1146 |
# BINTRANS=YES |
printf "no\n" |
1147 |
# else |
else |
1148 |
# if [ z"`uname -m`" = zsparc64 ]; then |
if [ z`./_testfunction` = zmain ]; then |
1149 |
# printf "#define SPARCV9\n" >> config.h |
printf "yes\n" |
1150 |
# printf "#define BINTRANS\n" >> config.h |
printf "#define HAVE___FUNCTION__\n" >> config.h |
1151 |
# printf "SPARC V9\n" |
else |
1152 |
# BINTRANS=YES |
printf "no\n" |
|
# fi |
|
|
# fi |
|
|
|
|
|
if [ z$BINTRANS = zNO ]; then |
|
|
printf "not supported yet on this arch\n" |
|
1153 |
fi |
fi |
1154 |
fi |
fi |
1155 |
|
rm -f _testfunction* |
1156 |
|
|
1157 |
|
|
1158 |
############################################################################### |
############################################################################### |
1180 |
fi |
fi |
1181 |
rm -f _test_end* |
rm -f _test_end* |
1182 |
|
|
|
############################################################################### |
|
|
|
|
|
# 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 |
|
|
|
|
1183 |
|
|
1184 |
############################################################################### |
############################################################################### |
1185 |
|
|
1202 |
|
|
1203 |
|
|
1204 |
# Create the Makefiles: |
# Create the Makefiles: |
1205 |
|
D=". src src/include src/console src/cpus src/debugger src/devices" |
1206 |
for a in . src src/cpus src/devices src/devices/fonts src/promemul; do |
D="$D src/devices/fonts src/disk src/file src/machines" |
1207 |
|
D="$D src/net src/promemul src/symbol src/useremul" |
1208 |
|
for a in $D; do |
1209 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1210 |
touch $a/Makefile |
touch $a/Makefile |
1211 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |
1219 |
rm -f _Makefile.header |
rm -f _Makefile.header |
1220 |
|
|
1221 |
echo Configured. You may now run make to build gxemul. |
echo Configured. You may now run make to build gxemul. |
1222 |
|
|