27 |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
28 |
# |
# |
29 |
# |
# |
30 |
# $Id: configure,v 1.123 2005/04/17 01:42:21 debug Exp $ |
# $Id: configure,v 1.132 2005/06/04 12:05:50 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 |
55 |
############################################################################### |
############################################################################### |
56 |
|
|
57 |
ENABLEALPHA=NO |
ENABLEALPHA=NO |
58 |
|
ENABLEARM=NO |
59 |
ENABLEHPPA=NO |
ENABLEHPPA=NO |
60 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
61 |
ENABLEPPC=YES |
ENABLEPPC=YES |
62 |
ENABLESPARC=NO |
ENABLESPARC=NO |
63 |
ENABLEURISC=YES |
ENABLEURISC=YES |
64 |
ENABLEX86=NO |
ENABLEX86=NO |
65 |
|
STABLE=YES |
66 |
|
|
67 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
68 |
# Parse command line options: |
# Parse command line options: |
73 |
ALWAYS32=YES |
ALWAYS32=YES |
74 |
else if [ z$a = z--disable-bintrans ]; then |
else if [ z$a = z--disable-bintrans ]; then |
75 |
NOBINTRANS=YES |
NOBINTRANS=YES |
76 |
|
else if [ z$a = z--enable-bintrans ]; then |
77 |
|
NOBINTRANS=NO |
78 |
|
else if [ z$a = z--disable-mips16 ]; then |
79 |
|
MIPS16=NO |
80 |
else if [ z$a = z--enable-mips16 ]; then |
else if [ z$a = z--enable-mips16 ]; then |
81 |
MIPS16=YES |
MIPS16=YES |
82 |
|
else if [ z$a = z--disable-alpha ]; then |
83 |
|
ENABLEALPHA=NO |
84 |
else if [ z$a = z--enable-alpha ]; then |
else if [ z$a = z--enable-alpha ]; then |
85 |
ENABLEALPHA=YES |
ENABLEALPHA=YES |
86 |
|
else if [ z$a = z--disable-arm ]; then |
87 |
|
ENABLEARM=NO |
88 |
|
else if [ z$a = z--enable-arm ]; then |
89 |
|
ENABLEARM=YES |
90 |
|
else if [ z$a = z--disable-hppa ]; then |
91 |
|
ENABLEHPPA=NO |
92 |
else if [ z$a = z--enable-hppa ]; then |
else if [ z$a = z--enable-hppa ]; then |
93 |
ENABLEHPPA=YES |
ENABLEHPPA=YES |
94 |
else if [ z$a = z--disable-mips ]; then |
else if [ z$a = z--disable-mips ]; then |
95 |
ENABLEMIPS=NO |
ENABLEMIPS=NO |
96 |
|
else if [ z$a = z--enable-mips ]; then |
97 |
|
ENABLEMIPS=YES |
98 |
else if [ z$a = z--disable-ppc ]; then |
else if [ z$a = z--disable-ppc ]; then |
99 |
ENABLEPPC=NO |
ENABLEPPC=NO |
100 |
|
else if [ z$a = z--enable-ppc ]; then |
101 |
|
ENABLEPPC=YES |
102 |
|
else if [ z$a = z--disable-sparc ]; then |
103 |
|
ENABLESPARC=NO |
104 |
else if [ z$a = z--enable-sparc ]; then |
else if [ z$a = z--enable-sparc ]; then |
105 |
ENABLESPARC=YES |
ENABLESPARC=YES |
106 |
else if [ z$a = z--disable-urisc ]; then |
else if [ z$a = z--disable-urisc ]; then |
107 |
ENABLEURISC=NO |
ENABLEURISC=NO |
108 |
|
else if [ z$a = z--enable-urisc ]; then |
109 |
|
ENABLEURISC=YES |
110 |
|
else if [ z$a = z--disable-x86 ]; then |
111 |
|
ENABLEX86=NO |
112 |
else if [ z$a = z--enable-x86 ]; then |
else if [ z$a = z--enable-x86 ]; then |
113 |
ENABLEX86=YES |
ENABLEX86=YES |
114 |
|
else if [ z$a = z--disable-delays ]; then |
115 |
|
DELAYS=NO |
116 |
else if [ z$a = z--enable-delays ]; then |
else if [ z$a = z--enable-delays ]; then |
117 |
DELAYS=YES |
DELAYS=YES |
118 |
|
else if [ z$a = z--disable-caches ]; then |
119 |
|
CACHES=NO |
120 |
else if [ z$a = z--enable-caches ]; then |
else if [ z$a = z--enable-caches ]; then |
121 |
CACHES=YES |
CACHES=YES |
122 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
123 |
echo "usage: $0 [options]" |
echo "usage: $0 [options]" |
124 |
printf "\nDevelopment (debug) options:\n" |
printf "\nDevelopment (debug) options:\n" |
125 |
echo " --always32 enable" \ |
echo " --always32 enable" \ |
126 |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
127 |
echo " 32/64-bit bugs)" |
echo " 32/64-bit bugs)" |
128 |
printf "\nGeneral options:\n" |
printf "\nGeneral options:\n" |
129 |
echo " --disable-bintrans configure without" \ |
echo " --disable-bintrans configure without" \ |
130 |
"bintrans, even if the host supports it" |
"bintrans, even if the host supports it" |
131 |
echo " --enable-caches enable cache emulation" \ |
printf " --enable-caches enable cache emulation" |
132 |
"(experimental)" |
printf " (BUGGY)\n" |
133 |
echo " --enable-delays enable instruction" \ |
echo " --enable-delays enable instruction" \ |
134 |
"latency/delay emulation" |
"latency/delay emulation" |
135 |
echo " --disable-x don't include X11 support" |
echo " --disable-x don't include X11 support" |
136 |
printf "\nCPU selection options: (most of these" |
printf "\nCPU selection options:\n" |
137 |
printf " are experimental)\n" |
if [ z$STABLE = zNO ]; then |
138 |
echo " --enable-alpha enable Alpha CPU emulation" |
printf " --enable-alpha " |
139 |
echo " --enable-hppa enable HPPA CPU emulation" |
printf "enable Alpha CPU emulation" |
140 |
echo " --disable-mips disable MIPS CPU emulation" |
printf " (NOT YET)\n" |
141 |
echo " --disable-ppc disable PPC CPU emulation" |
printf " --enable-arm " |
142 |
echo " --enable-sparc enable SPARC CPU emulation" |
printf "enable ARM CPU emulation" |
143 |
echo " --disable-urisc disable URISC CPU emulation" |
printf " (NOT YET)\n" |
144 |
echo " --enable-x86 enable x86 CPU emulation" |
printf " --enable-hppa " |
145 |
|
printf "enable HPPA CPU emulation" |
146 |
|
printf " (NOT YET)\n" |
147 |
|
fi |
148 |
|
echo " --disable-mips disable MIPS CPU emulation" |
149 |
|
echo " --disable-ppc disable PPC CPU emulation" |
150 |
|
if [ z$STABLE = zNO ]; then |
151 |
|
printf " --enable-sparc " |
152 |
|
printf "enable SPARC CPU emulation" |
153 |
|
printf " (NOT YET)\n" |
154 |
|
fi |
155 |
|
echo " --disable-urisc disable URISC CPU emulation" |
156 |
|
if [ z$STABLE = zNO ]; then |
157 |
|
printf " --enable-x86 " |
158 |
|
printf "enable x86 CPU emulation" |
159 |
|
printf " (NOT YET)\n" |
160 |
|
fi |
161 |
printf "\nMIPS-specific options:\n" |
printf "\nMIPS-specific options:\n" |
162 |
echo " --enable-mips16 enable MIPS16 instruction" \ |
printf " --enable-mips16 enable MIPS16 instruction" |
163 |
"support (experimental)" |
printf " support (NOT YET)\n\n" |
|
printf "\n" |
|
164 |
exit |
exit |
165 |
else |
else |
166 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
167 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
168 |
"available options." |
"available options." |
169 |
exit |
exit |
170 |
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 |
171 |
|
fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi |
172 |
done |
done |
173 |
fi |
fi |
174 |
|
|
211 |
fi |
fi |
212 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEALPHA = zYES ]; then |
213 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ALPHA\n" >> config.h |
214 |
|
if [ z$STABLE = zNO ]; then |
215 |
|
printf "\nWARNING: Alpha emulation enabled, but it isn't really" |
216 |
|
printf " implemented yet.\n\n" |
217 |
|
else |
218 |
|
printf "Not in the stable release.\n" |
219 |
|
exit |
220 |
|
fi |
221 |
|
fi |
222 |
|
if [ z$ENABLEARM = zYES ]; then |
223 |
|
printf "#define ENABLE_ARM\n" >> config.h |
224 |
|
if [ z$STABLE = zNO ]; then |
225 |
|
printf "\nWARNING: ARM emulation enabled, but it isn't really" |
226 |
|
printf " implemented yet.\n\n" |
227 |
|
else |
228 |
|
printf "Not in the stable release.\n" |
229 |
|
exit |
230 |
|
fi |
231 |
fi |
fi |
232 |
if [ z$ENABLEHPPA = zYES ]; then |
if [ z$ENABLEHPPA = zYES ]; then |
233 |
printf "#define ENABLE_HPPA\n" >> config.h |
printf "#define ENABLE_HPPA\n" >> config.h |
234 |
|
if [ z$STABLE = zNO ]; then |
235 |
|
printf "\nWARNING: HPPA emulation enabled, but it isn't really" |
236 |
|
printf " implemented yet.\n\n" |
237 |
|
else |
238 |
|
printf "Not in the stable release.\n" |
239 |
|
exit |
240 |
|
fi |
241 |
fi |
fi |
242 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
243 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
247 |
fi |
fi |
248 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
249 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
250 |
|
if [ z$STABLE = zNO ]; then |
251 |
|
printf "\nWARNING: SPARC emulation enabled, but it isn't really" |
252 |
|
printf " implemented yet.\n\n" |
253 |
|
else |
254 |
|
printf "Not in the stable release.\n" |
255 |
|
exit |
256 |
|
fi |
257 |
fi |
fi |
258 |
if [ z$ENABLEURISC = zYES ]; then |
if [ z$ENABLEURISC = zYES ]; then |
259 |
printf "#define ENABLE_URISC\n" >> config.h |
printf "#define ENABLE_URISC\n" >> config.h |
260 |
fi |
fi |
261 |
if [ z$ENABLEX86 = zYES ]; then |
if [ z$ENABLEX86 = zYES ]; then |
262 |
printf "#define ENABLE_X86\n" >> config.h |
printf "#define ENABLE_X86\n" >> config.h |
263 |
|
if [ z$STABLE = zNO ]; then |
264 |
|
printf "\nWARNING: X86 emulation enabled, but it isn't really" |
265 |
|
printf " working yet.\n\n" |
266 |
|
else |
267 |
|
printf "Not in the stable release.\n" |
268 |
|
exit |
269 |
|
fi |
270 |
fi |
fi |
271 |
|
|
272 |
|
|
296 |
printf ' (--delays) will not produce correct ' |
printf ' (--delays) will not produce correct ' |
297 |
printf 'cache miss penalties and such.\n' |
printf 'cache miss penalties and such.\n' |
298 |
fi |
fi |
299 |
|
|
300 |
|
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
301 |
|
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
302 |
fi |
fi |
303 |
|
|
304 |
|
|
763 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
764 |
|
|
765 |
|
|
|
# -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 |
|
|
|
|
|
|
|
766 |
# -fomit-frame-pointer |
# -fomit-frame-pointer |
767 |
printf "checking whether -fomit-frame-pointer can be used... " |
printf "checking whether -fomit-frame-pointer can be used... " |
768 |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
871 |
printf "missing, using mystrtoull\n" |
printf "missing, using mystrtoull\n" |
872 |
printf "#define strtoull mystrtoull\n" >> config.h |
printf "#define strtoull mystrtoull\n" >> config.h |
873 |
else |
else |
874 |
printf "yes\n" |
printf "found\n" |
875 |
|
fi |
876 |
|
rm -f _tests.[co] _tests |
877 |
|
|
878 |
|
|
879 |
|
# mkstemp missing? |
880 |
|
printf "checking for mkstemp... " |
881 |
|
printf "#include <unistd.h> |
882 |
|
int main(int argc, char *argv[]) { int x; char *y = \"abc\"; |
883 |
|
x = mkstemp(y); return 0;}\n" > _tests.c |
884 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
885 |
|
if [ ! -x _tests ]; then |
886 |
|
printf "missing, using workaround\n" |
887 |
|
printf "#define mkstemp mymkstemp\n" >> config.h |
888 |
|
else |
889 |
|
printf "found\n" |
890 |
fi |
fi |
891 |
rm -f _testlong* _tests.[co] _tests |
rm -f _tests.[co] _tests |
892 |
|
|
893 |
|
|
894 |
# fseeko missing? |
# fseeko missing? |
900 |
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 |
901 |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
902 |
if [ ! -x _tests ]; then |
if [ ! -x _tests ]; then |
903 |
printf "no\n" |
printf "missing\n" |
904 |
printf "WARNING! fseeko missing from libc. Using a hack, " |
printf "WARNING! fseeko missing from libc. Using a hack, " |
905 |
printf "which probably doesn't work.\n" |
printf "which probably doesn't work.\n" |
906 |
printf "#define HACK_FSEEKO\n" >> config.h |
printf "#define HACK_FSEEKO\n" >> config.h |
907 |
else |
else |
908 |
printf "yes\n" |
printf "found\n" |
909 |
fi |
fi |
910 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
911 |
|
|
923 |
printf "no, using int\n" |
printf "no, using int\n" |
924 |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
925 |
else |
else |
926 |
printf "yes\n" |
printf "socklen_t\n" |
927 |
fi |
fi |
928 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
929 |
|
|