1 |
#!/bin/sh |
#!/bin/sh |
2 |
############################################################################### |
############################################################################### |
3 |
# |
# |
4 |
# Copyright (C) 2003-2006 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.226 2006/07/20 21:52:59 debug Exp $ |
# $Id: configure,v 1.245 2007/03/16 14:13:59 debug Exp $ |
31 |
# |
# |
32 |
# This is a minimal configure script, hardcoded for GXemul. This script |
# This is a minimal configure script, hardcoded for GXemul. This script |
33 |
# figures out which compiler flags will work, and creates Makefiles in |
# figures out which compiler flags will work, and creates Makefiles in |
49 |
# o) which compiler flags to use (overridden by setting CFLAGS) |
# o) which compiler flags to use (overridden by setting CFLAGS) |
50 |
# o) X11 flags and libraries (TODO: should be possible to override |
# o) X11 flags and libraries (TODO: should be possible to override |
51 |
# via command line options?) |
# via command line options?) |
52 |
|
# o) native code generation backend (i.e. detect host architecture) |
53 |
# |
# |
54 |
# |
# |
55 |
# The general philosophy regarding command line switches is that anything |
# The general philosophy regarding command line switches is that anything |
66 |
ENABLEARM=YES |
ENABLEARM=YES |
67 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
68 |
ENABLEPPC=YES |
ENABLEPPC=YES |
69 |
|
ENABLESH=YES |
70 |
else |
else |
71 |
# Development: |
# Development: |
72 |
UNSTABLE=YES |
UNSTABLE=YES |
73 |
ENABLEALPHA=YES |
ENABLEALPHA=YES |
74 |
ENABLEARM=YES |
ENABLEARM=YES |
75 |
ENABLEAVR=YES |
ENABLEAVR=YES |
|
ENABLEHPPA=YES |
|
|
ENABLEI960=YES |
|
|
ENABLEIA64=YES |
|
76 |
ENABLEM68K=YES |
ENABLEM68K=YES |
77 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
78 |
ENABLEPPC=YES |
ENABLEPPC=YES |
79 |
|
ENABLERCA180X=YES |
80 |
ENABLESH=YES |
ENABLESH=YES |
81 |
ENABLESPARC=YES |
ENABLESPARC=YES |
82 |
ENABLETRANSPUTER=YES |
ENABLETRANSPUTER=YES |
|
ENABLEX86=YES |
|
83 |
fi |
fi |
84 |
|
|
85 |
if [ z"$UNSTABLE" = zYES ]; then |
if [ z"$UNSTABLE" = zYES ]; then |
167 |
printf "#define ENABLE_AVR\n" >> config.h |
printf "#define ENABLE_AVR\n" >> config.h |
168 |
CPU_ARCHS="$CPU_ARCHS cpu_avr.o" |
CPU_ARCHS="$CPU_ARCHS cpu_avr.o" |
169 |
fi |
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 |
|
170 |
if [ z$ENABLEM68K = zYES ]; then |
if [ z$ENABLEM68K = zYES ]; then |
171 |
printf "#define ENABLE_M68K\n" >> config.h |
printf "#define ENABLE_M68K\n" >> config.h |
172 |
CPU_ARCHS="$CPU_ARCHS cpu_m68k.o" |
CPU_ARCHS="$CPU_ARCHS cpu_m68k.o" |
176 |
CPU_ARCHS="$CPU_ARCHS cpu_mips.o cpu_mips_coproc.o " |
CPU_ARCHS="$CPU_ARCHS cpu_mips.o cpu_mips_coproc.o " |
177 |
CPU_ARCHS="$CPU_ARCHS cpu_mips_instr_unaligned.o" |
CPU_ARCHS="$CPU_ARCHS cpu_mips_instr_unaligned.o" |
178 |
CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore" |
CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore" |
179 |
|
CPU_TOOLS="$CPU_TOOLS generate_mips_loadstore_multi" |
180 |
fi |
fi |
181 |
if [ z$ENABLEPPC = zYES ]; then |
if [ z$ENABLEPPC = zYES ]; then |
182 |
printf "#define ENABLE_PPC\n" >> config.h |
printf "#define ENABLE_PPC\n" >> config.h |
183 |
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
CPU_ARCHS="$CPU_ARCHS cpu_ppc.o" |
184 |
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
CPU_TOOLS="$CPU_TOOLS generate_ppc_loadstore" |
185 |
fi |
fi |
186 |
|
if [ z$ENABLERCA180X = zYES ]; then |
187 |
|
printf "#define ENABLE_RCA180X\n" >> config.h |
188 |
|
CPU_ARCHS="$CPU_ARCHS cpu_rca180x.o" |
189 |
|
fi |
190 |
if [ z$ENABLESH = zYES ]; then |
if [ z$ENABLESH = zYES ]; then |
191 |
printf "#define ENABLE_SH\n" >> config.h |
printf "#define ENABLE_SH\n" >> config.h |
192 |
CPU_ARCHS="$CPU_ARCHS cpu_sh.o" |
CPU_ARCHS="$CPU_ARCHS cpu_sh.o memory_sh.o" |
193 |
fi |
fi |
194 |
if [ z$ENABLESPARC = zYES ]; then |
if [ z$ENABLESPARC = zYES ]; then |
195 |
printf "#define ENABLE_SPARC\n" >> config.h |
printf "#define ENABLE_SPARC\n" >> config.h |
196 |
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o" |
CPU_ARCHS="$CPU_ARCHS cpu_sparc.o memory_sparc.o" |
197 |
CPU_TOOLS="$CPU_TOOLS generate_sparc_loadstore" |
CPU_TOOLS="$CPU_TOOLS generate_sparc_loadstore" |
198 |
fi |
fi |
199 |
if [ z$ENABLETRANSPUTER = zYES ]; then |
if [ z$ENABLETRANSPUTER = zYES ]; then |
200 |
printf "#define ENABLE_TRANSPUTER\n" >> config.h |
printf "#define ENABLE_TRANSPUTER\n" >> config.h |
201 |
CPU_ARCHS="$CPU_ARCHS cpu_transputer.o" |
CPU_ARCHS="$CPU_ARCHS cpu_transputer.o" |
202 |
fi |
fi |
|
if [ z$ENABLEX86 = zYES ]; then |
|
|
printf "#define ENABLE_X86\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_x86.o" |
|
|
fi |
|
|
|
|
|
|
|
|
# Cache emulation: |
|
|
if [ z$CACHES = zYES ]; then |
|
|
echo 'Enabling Cache emulation. (EXPERIMENTAL and BUGGY)' |
|
|
printf "#define ENABLE_CACHE_EMULATION\n" >> config.h |
|
|
|
|
|
printf "\nNOTE: Cache emulation enabled, but right now it triggers " |
|
|
printf "weird bugs in the\n emulator. You have been warned.\n\n" |
|
|
fi |
|
203 |
|
|
204 |
|
|
205 |
############################################################################### |
############################################################################### |
346 |
|
|
347 |
rm -f _test_x11 _test_x11.o |
rm -f _test_x11 _test_x11.o |
348 |
|
|
349 |
|
# Special case for some 64-bit Linux/x86_64 systems: |
350 |
|
if [ z$XOK = z0 ]; then |
351 |
|
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
352 |
|
$XINCLUDE 2> /dev/null |
353 |
|
|
354 |
|
XLIB="-L/usr/X11R6/lib64 -lX11" |
355 |
|
$CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null |
356 |
|
|
357 |
|
if [ -x _test_x11 ]; then |
358 |
|
XOK=1 |
359 |
|
fi |
360 |
|
fi |
361 |
|
rm -f _test_x11 _test_x11.o |
362 |
|
|
363 |
if [ z$XOK = z0 ]; then |
if [ z$XOK = z0 ]; then |
364 |
XINCLUDE="" |
XINCLUDE="" |
365 |
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
676 |
rm -f _testprog _testprog.error _testprog.stdout |
rm -f _testprog _testprog.error _testprog.stdout |
677 |
|
|
678 |
|
|
679 |
# -g |
# -g, for development builds |
680 |
printf "checking whether -g can be used... " |
if [ z"$UNSTABLE" = zYES ]; then |
681 |
if [ z"$COMPAQCC" = zYES ]; then |
printf "checking whether -g can be used... " |
682 |
printf "skipping\n" |
if [ z"$COMPAQCC" = zYES ]; then |
683 |
else |
printf "skipping\n" |
|
$CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1 |
|
|
cat _testprog.stdout >> _testprog.error |
|
|
if [ -x _testprog ]; then |
|
|
CFLAGS="-g $CFLAGS" |
|
|
printf "yes\n" |
|
684 |
else |
else |
685 |
|
$CC $CFLAGS -g _testprog.c -o _testprog > _testprog.stdout 2>&1 |
686 |
|
cat _testprog.stdout >> _testprog.error |
687 |
|
if [ -x _testprog ]; then |
688 |
|
CFLAGS="-g $CFLAGS" |
689 |
|
printf "yes\n" |
690 |
|
else |
691 |
printf "no\n" |
printf "no\n" |
692 |
|
fi |
693 |
fi |
fi |
694 |
|
rm -f _testprog _testprog.error _testprog.stdout |
695 |
fi |
fi |
|
rm -f _testprog _testprog.error _testprog.stdout |
|
696 |
|
|
697 |
|
|
698 |
# -lrt for nanosleep? |
# -lrt for nanosleep? |
1055 |
fi |
fi |
1056 |
rm -f _test_end* |
rm -f _test_end* |
1057 |
|
|
1058 |
|
|
1059 |
|
############################################################################### |
1060 |
|
# |
1061 |
|
# Native code generation backend: (Detect host architecture.) |
1062 |
|
# |
1063 |
|
############################################################################### |
1064 |
|
|
1065 |
|
if [ z$UNSTABLE = zYES ]; then |
1066 |
|
printf "native code generation backend... " |
1067 |
|
|
1068 |
|
if [ z"`uname -m`" = zamd64 ]; then |
1069 |
|
NATIVE_CODE_GENERATION=YES |
1070 |
|
printf "amd64\n" |
1071 |
|
printf "#define NATIVE_CODE_GENERATION\n" >> config.h |
1072 |
|
printf "#define HOST_ARCH_AMD64\n" >> config.h |
1073 |
|
fi |
1074 |
|
|
1075 |
|
if [ z"`uname -m`" = zx86_64 ]; then |
1076 |
|
NATIVE_CODE_GENERATION=YES |
1077 |
|
printf "amd64\n" |
1078 |
|
printf "#define NATIVE_CODE_GENERATION\n" >> config.h |
1079 |
|
printf "#define HOST_ARCH_AMD64\n" >> config.h |
1080 |
|
fi |
1081 |
|
|
1082 |
|
if [ z$NATIVE_CODE_GENERATION = z ]; then |
1083 |
|
printf "not yet for this host platform\n" |
1084 |
|
fi |
1085 |
|
fi |
1086 |
|
|
1087 |
|
|
1088 |
############################################################################### |
############################################################################### |
1089 |
|
|
1090 |
INCLUDE=-Iinclude/ |
INCLUDE=-Iinclude/ |
1107 |
|
|
1108 |
# Create the Makefiles: |
# Create the Makefiles: |
1109 |
D=". src src/include src/cpus src/debugger src/devices src/devices/fonts" |
D=". src src/include src/cpus src/debugger src/devices src/devices/fonts" |
1110 |
D="$D src/machines src/promemul doc" |
D="$D src/disk src/machines src/native src/net src/promemul" |
1111 |
for a in $D; do |
for a in $D; do |
1112 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1113 |
touch $a/Makefile |
touch $a/Makefile |