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.140 2005/06/27 17:31: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 |
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 |
ENABLEARM=YES |
|
ENABLEHPPA=YES |
|
62 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
63 |
ENABLEPPC=YES |
ENABLEPPC=YES |
|
ENABLESPARC=YES |
|
64 |
ENABLEURISC=YES |
ENABLEURISC=YES |
65 |
|
ENABLEX86=NO |
66 |
|
STABLE=NO |
67 |
|
|
68 |
if [ z"$*" != z ]; then |
if [ z"$*" != z ]; then |
69 |
# Parse command line options: |
# Parse command line options: |
72 |
NOX11=YES |
NOX11=YES |
73 |
else if [ z$a = z--always32 ]; then |
else if [ z$a = z--always32 ]; then |
74 |
ALWAYS32=YES |
ALWAYS32=YES |
75 |
|
else if [ z$a = z--tracenull ]; then |
76 |
|
TRACENULL=YES |
77 |
else if [ z$a = z--disable-bintrans ]; then |
else if [ z$a = z--disable-bintrans ]; then |
78 |
NOBINTRANS=YES |
NOBINTRANS=YES |
79 |
|
else if [ z$a = z--enable-bintrans ]; then |
80 |
|
NOBINTRANS=NO |
81 |
|
else if [ z$a = z--disable-mips16 ]; then |
82 |
|
MIPS16=NO |
83 |
else if [ z$a = z--enable-mips16 ]; then |
else if [ z$a = z--enable-mips16 ]; then |
84 |
MIPS16=YES |
MIPS16=YES |
85 |
else if [ z$a = z--disable-alpha ]; then |
else if [ z$a = z--disable-arm ]; then |
86 |
ENABLEALPHA=NO |
ENABLEARM=NO |
87 |
else if [ z$a = z--disable-hppa ]; then |
else if [ z$a = z--enable-arm ]; then |
88 |
ENABLEHPPA=NO |
ENABLEARM=YES |
89 |
else if [ z$a = z--disable-mips ]; then |
else if [ z$a = z--disable-mips ]; then |
90 |
ENABLEMIPS=NO |
ENABLEMIPS=NO |
91 |
|
else if [ z$a = z--enable-mips ]; then |
92 |
|
ENABLEMIPS=YES |
93 |
else if [ z$a = z--disable-ppc ]; then |
else if [ z$a = z--disable-ppc ]; then |
94 |
ENABLEPPC=NO |
ENABLEPPC=NO |
95 |
else if [ z$a = z--disable-sparc ]; then |
else if [ z$a = z--enable-ppc ]; then |
96 |
ENABLESPARC=NO |
ENABLEPPC=YES |
97 |
else if [ z$a = z--disable-urisc ]; then |
else if [ z$a = z--disable-urisc ]; then |
98 |
ENABLEURISC=NO |
ENABLEURISC=NO |
99 |
|
else if [ z$a = z--enable-urisc ]; then |
100 |
|
ENABLEURISC=YES |
101 |
|
else if [ z$a = z--disable-x86 ]; then |
102 |
|
ENABLEX86=NO |
103 |
|
else if [ z$a = z--enable-x86 ]; then |
104 |
|
ENABLEX86=YES |
105 |
|
else if [ z$a = z--disable-delays ]; then |
106 |
|
DELAYS=NO |
107 |
else if [ z$a = z--enable-delays ]; then |
else if [ z$a = z--enable-delays ]; then |
108 |
DELAYS=YES |
DELAYS=YES |
109 |
|
else if [ z$a = z--disable-caches ]; then |
110 |
|
CACHES=NO |
111 |
else if [ z$a = z--enable-caches ]; then |
else if [ z$a = z--enable-caches ]; then |
112 |
CACHES=YES |
CACHES=YES |
113 |
else if [ z$a = z--help ]; then |
else if [ z$a = z--help ]; then |
114 |
echo "usage: $0 [options]" |
echo "usage: $0 [options]" |
115 |
printf "\nDevelopment (debug) options:\n" |
printf "\nDevelopment (debug) options:\n" |
116 |
echo " --always32 enable" \ |
echo " --always32 enable" \ |
117 |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
"ALWAYS_SIGNEXTEND_32 (for hunting down" |
118 |
echo " 32/64-bit bugs)" |
echo " 32/64-bit bugs)" |
119 |
|
echo " --tracenull enable" \ |
120 |
|
"TRACE_NULL_CRASHES (for bug hunting)" |
121 |
printf "\nGeneral options:\n" |
printf "\nGeneral options:\n" |
122 |
echo " --disable-bintrans configure without" \ |
echo " --disable-bintrans configure without" \ |
123 |
"bintrans, even if the host supports it" |
"bintrans, even if the host supports it" |
124 |
echo " --enable-caches enable cache emulation" \ |
printf " --enable-caches enable cache emulation" |
125 |
"(experimental)" |
printf " (BUGGY)\n" |
126 |
echo " --enable-delays enable instruction" \ |
echo " --enable-delays enable instruction" \ |
127 |
"latency/delay emulation" |
"latency/delay emulation" |
128 |
echo " --disable-x don't include X11 support" |
echo " --disable-x don't include X11 support" |
129 |
printf "\nCPU selection options:\n" |
printf "\nCPU selection options:\n" |
130 |
echo " --disable-alpha disable Alpha CPU emulation" |
echo " --disable-arm disable ARM CPU emulation" |
131 |
echo " --disable-hppa disable HPPA CPU emulation" |
echo " --disable-mips disable MIPS CPU emulation" |
132 |
echo " --disable-mips disable MIPS CPU emulation" |
echo " --disable-ppc disable PPC CPU emulation" |
133 |
echo " --disable-ppc disable PPC CPU emulation" |
echo " --disable-urisc disable URISC CPU emulation" |
134 |
echo " --disable-sparc disable SPARC CPU emulation" |
if [ z$STABLE = zNO ]; then |
135 |
echo " --disable-urisc disable URISC CPU emulation" |
printf " --enable-x86 " |
136 |
|
printf "enable x86 CPU emulation" |
137 |
|
printf " (NOT YET)\n" |
138 |
|
fi |
139 |
printf "\nMIPS-specific options:\n" |
printf "\nMIPS-specific options:\n" |
140 |
echo " --enable-mips16 enable MIPS16 instruction" \ |
printf " --enable-mips16 enable MIPS16 instruction" |
141 |
"support (experimental)" |
printf " support (NOT YET)\n\n" |
|
printf "\n" |
|
142 |
exit |
exit |
143 |
else |
else |
144 |
echo "Invalid option: $a" |
echo "Invalid option: $a" |
145 |
echo "Run $0 --help to get a list of" \ |
echo "Run $0 --help to get a list of" \ |
146 |
"available options." |
"available options." |
147 |
exit |
exit |
148 |
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 |
149 |
|
fi; fi; fi; fi; fi; fi; fi |
150 |
done |
done |
151 |
fi |
fi |
152 |
|
|
170 |
# Figure out if VERSION should be defined. |
# Figure out if VERSION should be defined. |
171 |
X=`basename \`pwd\`|cut -d \- -f 2-` |
X=`basename \`pwd\`|cut -d \- -f 2-` |
172 |
if [ z"$X" = zgxemul ]; then |
if [ z"$X" = zgxemul ]; then |
173 |
echo '# No VERSION defined.' >> _Makefile.header |
echo '/* No VERSION defined. */' >> config.h |
174 |
else |
else |
175 |
printf "#define VERSION \"$X\"\n" >> config.h |
printf "#define VERSION \"$X\"\n" >> config.h |
176 |
fi |
fi |
187 |
printf 'NOTE: MIPS16 support is not really working yet.\n' |
printf 'NOTE: MIPS16 support is not really working yet.\n' |
188 |
printf "#define ENABLE_MIPS16\n" >> config.h |
printf "#define ENABLE_MIPS16\n" >> config.h |
189 |
fi |
fi |
190 |
if [ z$ENABLEALPHA = zYES ]; then |
if [ z$ENABLEARM = zYES ]; then |
191 |
printf "#define ENABLE_ALPHA\n" >> config.h |
printf "#define ENABLE_ARM\n" >> config.h |
|
else |
|
|
echo 'Disabling Alpha emulation support.' |
|
|
fi |
|
|
if [ z$ENABLEHPPA = zYES ]; then |
|
|
printf "#define ENABLE_HPPA\n" >> config.h |
|
|
else |
|
|
echo 'Disabling HPPA emulation support.' |
|
192 |
fi |
fi |
193 |
if [ z$ENABLEMIPS = zYES ]; then |
if [ z$ENABLEMIPS = zYES ]; then |
194 |
printf "#define ENABLE_MIPS\n" >> config.h |
printf "#define ENABLE_MIPS\n" >> config.h |
|
else |
|
|
echo 'Disabling MIPS emulation support.' |
|
195 |
fi |
fi |
196 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
197 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
|
else |
|
|
echo 'Disabling PPC emulation support.' |
|
|
fi |
|
|
if [ z$ENABLESPARC = zYES ]; then |
|
|
printf "#define ENABLE_SPARC\n" >> config.h |
|
|
else |
|
|
echo 'Disabling SPARC emulation support.' |
|
198 |
fi |
fi |
199 |
if [ z$ENABLEURISC = zYES ]; then |
if [ z$ENABLEURISC = zYES ]; then |
200 |
printf "#define ENABLE_URISC\n" >> config.h |
printf "#define ENABLE_URISC\n" >> config.h |
201 |
else |
fi |
202 |
echo 'Disabling URISC emulation support.' |
if [ z$ENABLEX86 = zYES ]; then |
203 |
|
printf "#define ENABLE_X86\n" >> config.h |
204 |
|
if [ z$STABLE = zNO ]; then |
205 |
|
printf "\nWARNING: X86 emulation enabled, but it isn't really" |
206 |
|
printf " working yet.\n\n" |
207 |
|
else |
208 |
|
printf "Not in the stable release.\n" |
209 |
|
exit |
210 |
|
fi |
211 |
fi |
fi |
212 |
|
|
213 |
|
|
218 |
fi |
fi |
219 |
|
|
220 |
|
|
221 |
# Instruction delay/latency emulation: |
# Development option: ALWAYS_SIGNEXTEND_32 |
222 |
if [ z$ALWAYS32 = zYES ]; then |
if [ z$ALWAYS32 = zYES ]; then |
223 |
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
echo 'Enabling ALWAYS_SIGNEXTEND_32. (NOTE:' \ |
224 |
'This slows down everything.)' |
'This slows down everything.)' |
226 |
fi |
fi |
227 |
|
|
228 |
|
|
229 |
|
# Development option: TRACE_NULL_CRASHES |
230 |
|
if [ z$TRACENULL = zYES ]; then |
231 |
|
echo 'Enabling TRACE_NULL_CRASHES. (NOTE:' \ |
232 |
|
'This slows down the emulator.)' |
233 |
|
printf "#define TRACE_NULL_CRASHES\n" >> config.h |
234 |
|
fi |
235 |
|
|
236 |
|
|
237 |
# Cache emulation: |
# Cache emulation: |
238 |
if [ z$CACHES = zYES ]; then |
if [ z$CACHES = zYES ]; then |
239 |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
echo 'Enabling Cache emulation. (EXPERIMENTAL)' |
245 |
printf ' (--delays) will not produce correct ' |
printf ' (--delays) will not produce correct ' |
246 |
printf 'cache miss penalties and such.\n' |
printf 'cache miss penalties and such.\n' |
247 |
fi |
fi |
248 |
|
|
249 |
|
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
250 |
|
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
251 |
fi |
fi |
252 |
|
|
253 |
|
|
712 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
713 |
|
|
714 |
|
|
|
# -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 |
|
|
|
|
|
|
|
715 |
# -fomit-frame-pointer |
# -fomit-frame-pointer |
716 |
printf "checking whether -fomit-frame-pointer can be used... " |
printf "checking whether -fomit-frame-pointer can be used... " |
717 |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
$CC $CFLAGS -fomit-frame-pointer _testprog.c -o \ |
808 |
rm -f _testr.[co] _testr |
rm -f _testr.[co] _testr |
809 |
|
|
810 |
|
|
811 |
|
# strlcpy missing? |
812 |
|
printf "checking for strlcpy... " |
813 |
|
printf "#include <string.h> |
814 |
|
int main(int argc, char *argv[]) { char *p; char *q; size_t x; |
815 |
|
x = strlcpy(p, q, 50); return 0;}\n" > _tests.c |
816 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
817 |
|
if [ ! -x _tests ]; then |
818 |
|
printf "missing, using mystrlcpy\n" |
819 |
|
printf "#define strlcpy mystrlcpy\n" >> config.h |
820 |
|
printf "#define strlcat mystrlcat\n" >> config.h |
821 |
|
printf "#define USE_STRLCPY_REPLACEMENTS\n" >> config.h |
822 |
|
else |
823 |
|
printf "found\n" |
824 |
|
fi |
825 |
|
rm -f _tests.[co] _tests |
826 |
|
|
827 |
|
|
828 |
# strtoull missing? |
# strtoull missing? |
829 |
printf "checking for strtoull... " |
printf "checking for strtoull... " |
830 |
printf "#include <stdlib.h> |
printf "#include <stdlib.h> |
837 |
printf "missing, using mystrtoull\n" |
printf "missing, using mystrtoull\n" |
838 |
printf "#define strtoull mystrtoull\n" >> config.h |
printf "#define strtoull mystrtoull\n" >> config.h |
839 |
else |
else |
840 |
printf "yes\n" |
printf "found\n" |
841 |
|
fi |
842 |
|
rm -f _tests.[co] _tests |
843 |
|
|
844 |
|
|
845 |
|
# mkstemp missing? |
846 |
|
printf "checking for mkstemp... " |
847 |
|
printf "#include <unistd.h> |
848 |
|
int main(int argc, char *argv[]) { int x; char *y = \"abc\"; |
849 |
|
x = mkstemp(y); return 0;}\n" > _tests.c |
850 |
|
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
851 |
|
if [ ! -x _tests ]; then |
852 |
|
printf "missing, using workaround\n" |
853 |
|
printf "#define mkstemp mymkstemp\n" >> config.h |
854 |
|
else |
855 |
|
printf "found\n" |
856 |
fi |
fi |
857 |
rm -f _testlong* _tests.[co] _tests |
rm -f _tests.[co] _tests |
858 |
|
|
859 |
|
|
860 |
# fseeko missing? |
# fseeko missing? |
866 |
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 |
867 |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
$CC $CFLAGS _tests.c -o _tests 2> /dev/null |
868 |
if [ ! -x _tests ]; then |
if [ ! -x _tests ]; then |
869 |
printf "no\n" |
printf "missing\n" |
870 |
printf "WARNING! fseeko missing from libc. Using a hack, " |
printf "WARNING! fseeko missing from libc. Using a hack, " |
871 |
printf "which probably doesn't work.\n" |
printf "which probably doesn't work.\n" |
872 |
printf "#define HACK_FSEEKO\n" >> config.h |
printf "#define HACK_FSEEKO\n" >> config.h |
873 |
else |
else |
874 |
printf "yes\n" |
printf "found\n" |
875 |
fi |
fi |
876 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
877 |
|
|
889 |
printf "no, using int\n" |
printf "no, using int\n" |
890 |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
CFLAGS="$CFLAGS -Dsocklen_t=int" |
891 |
else |
else |
892 |
printf "yes\n" |
printf "socklen_t\n" |
893 |
fi |
fi |
894 |
rm -f _tests.[co] _tests |
rm -f _tests.[co] _tests |
895 |
|
|
1083 |
|
|
1084 |
############################################################################### |
############################################################################### |
1085 |
|
|
1086 |
INCLUDE=-I../include/ |
INCLUDE=-Iinclude/ |
1087 |
|
DINCLUDE=-I../include/ |
1088 |
|
|
1089 |
echo C compiler flags: $CFLAGS $CWARNINGS $INCLUDE |
echo C compiler flags: $CFLAGS $CWARNINGS |
1090 |
echo Linker flags: $OTHERLIBS |
echo Linker flags: $OTHERLIBS |
1091 |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
echo "CWARNINGS=$CWARNINGS" >> _Makefile.header |
1092 |
echo "COPTIM=$CFLAGS" >> _Makefile.header |
echo "COPTIM=$CFLAGS" >> _Makefile.header |
1093 |
echo "INCLUDE=$INCLUDE" >> _Makefile.header |
echo "INCLUDE=$INCLUDE" >> _Makefile.header |
1094 |
|
echo "DINCLUDE=$DINCLUDE" >> _Makefile.header |
1095 |
echo "CC=$CC" >> _Makefile.header |
echo "CC=$CC" >> _Makefile.header |
1096 |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
echo "OTHERLIBS=$OTHERLIBS" >> _Makefile.header |
1097 |
echo "" >> _Makefile.header |
echo "" >> _Makefile.header |
1100 |
printf "Regression test setup: (not really needed to build gxemul)\n" |
printf "Regression test setup: (not really needed to build gxemul)\n" |
1101 |
|
|
1102 |
|
|
|
## 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 |
|
|
|
|
|
|
|
1103 |
# 64-bit MIPS cross-compiler: |
# 64-bit MIPS cross-compiler: |
1104 |
|
|
1105 |
MIPS='' |
MIPS='' |
1215 |
|
|
1216 |
# Create the Makefiles: |
# Create the Makefiles: |
1217 |
|
|
1218 |
for a in . src devices devices/fonts tests; do |
for a in . src src/devices src/devices/fonts tests; do |
1219 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1220 |
touch $a/Makefile |
touch $a/Makefile |
1221 |
cat _Makefile.header > $a/Makefile |
cat _Makefile.header > $a/Makefile |