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.235 2006/10/28 13:04:37 debug Exp $ |
# $Id: configure,v 1.243 2007/02/10 14:29:54 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 |
73 |
ENABLEALPHA=YES |
ENABLEALPHA=YES |
74 |
ENABLEARM=YES |
ENABLEARM=YES |
75 |
ENABLEAVR=YES |
ENABLEAVR=YES |
|
ENABLEAVR32=YES |
|
|
ENABLEHPPA=YES |
|
|
ENABLEI960=YES |
|
|
ENABLEIA64=YES |
|
76 |
ENABLEM68K=YES |
ENABLEM68K=YES |
77 |
ENABLEMIPS=YES |
ENABLEMIPS=YES |
78 |
ENABLEPPC=YES |
ENABLEPPC=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$ENABLEAVR32 = zYES ]; then |
|
|
printf "#define ENABLE_AVR32\n" >> config.h |
|
|
CPU_ARCHS="$CPU_ARCHS cpu_avr32.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 |
|
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 |
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 |
|
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 |
|
XLIB="-L/usr/X11R6/lib64 -lX11" |
352 |
|
$CC $CFLAGS _test_x11.o -o _test_x11 $XLIB 2> /dev/null |
353 |
|
|
354 |
|
if [ -x _test_x11 ]; then |
355 |
|
XOK=1 |
356 |
|
fi |
357 |
|
fi |
358 |
|
rm -f _test_x11 _test_x11.o |
359 |
|
|
360 |
if [ z$XOK = z0 ]; then |
if [ z$XOK = z0 ]; then |
361 |
XINCLUDE="" |
XINCLUDE="" |
362 |
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
$CC $CFLAGS _test_x11.c -c -o _test_x11.o \ |
1052 |
fi |
fi |
1053 |
rm -f _test_end* |
rm -f _test_end* |
1054 |
|
|
1055 |
|
|
1056 |
|
############################################################################### |
1057 |
|
# |
1058 |
|
# Native code generation backend: (Detect host architecture.) |
1059 |
|
# |
1060 |
|
############################################################################### |
1061 |
|
|
1062 |
|
if [ z$UNSTABLE = zYES ]; then |
1063 |
|
printf "native code generation backend... " |
1064 |
|
|
1065 |
|
if [ z"`uname -m`" = zamd64 ]; then |
1066 |
|
NATIVE_CODE_GENERATION=YES |
1067 |
|
printf "amd64\n" |
1068 |
|
printf "#define NATIVE_CODE_GENERATION\n" >> config.h |
1069 |
|
printf "#define HOST_ARCH_AMD64\n" >> config.h |
1070 |
|
fi |
1071 |
|
|
1072 |
|
if [ z"`uname -m`" = zx86_64 ]; then |
1073 |
|
NATIVE_CODE_GENERATION=YES |
1074 |
|
printf "amd64\n" |
1075 |
|
printf "#define NATIVE_CODE_GENERATION\n" >> config.h |
1076 |
|
printf "#define HOST_ARCH_AMD64\n" >> config.h |
1077 |
|
fi |
1078 |
|
|
1079 |
|
if [ z$NATIVE_CODE_GENERATION = z ]; then |
1080 |
|
printf "not yet for this host platform\n" |
1081 |
|
fi |
1082 |
|
fi |
1083 |
|
|
1084 |
|
|
1085 |
############################################################################### |
############################################################################### |
1086 |
|
|
1087 |
INCLUDE=-Iinclude/ |
INCLUDE=-Iinclude/ |
1104 |
|
|
1105 |
# Create the Makefiles: |
# Create the Makefiles: |
1106 |
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" |
1107 |
D="$D src/machines src/net src/promemul" |
D="$D src/machines src/native src/net src/promemul" |
1108 |
for a in $D; do |
for a in $D; do |
1109 |
echo "creating $a/Makefile" |
echo "creating $a/Makefile" |
1110 |
touch $a/Makefile |
touch $a/Makefile |