| 1 : |
anton
|
1.1
|
dnl Process this file with autoconf to produce a configure script. |
| 2 : |
|
|
AC_INIT(engine.c) |
| 3 : |
anton
|
1.18
|
AC_CONFIG_HEADER(config.h) |
| 4 : |
anton
|
1.14
|
|
| 5 : |
anton
|
1.1
|
AC_ARG_ENABLE(force-reg, |
| 6 : |
|
|
[ --enable-force-reg Use explicit register declarations if they appear in |
| 7 : |
|
|
the machine.h file. This can cause a good speedup, |
| 8 : |
|
|
but also incorrect code with some gcc versions on |
| 9 : |
|
|
some processors (default disabled).], |
| 10 : |
|
|
|
| 11 : |
|
|
AC_DEFINE(FORCE_REG)) |
| 12 : |
|
|
dnl this is not quite according to the autoconf manual, it causes a replacement |
| 13 : |
|
|
AC_ARG_ENABLE(direct-threaded, |
| 14 : |
|
|
[ --enable-direct-threaded Force direct threading. This may not work on |
| 15 : |
|
|
some machines and may cause slowdown on others. |
| 16 : |
|
|
(default processor-dependent)], |
| 17 : |
|
|
AC_DEFINE(DIRECT_THREADED)) |
| 18 : |
|
|
AC_ARG_ENABLE(indirect-threaded, |
| 19 : |
|
|
[ --enable-indirect-threaded Force indirect threading. This can cause a |
| 20 : |
|
|
slowdown on some machines. |
| 21 : |
|
|
(default processor-dependent)], |
| 22 : |
|
|
AC_DEFINE(INDIRECT_THREADED)) |
| 23 : |
|
|
|
| 24 : |
pazsan
|
1.9
|
AC_ARG_WITH(debug, |
| 25 : |
anton
|
1.10
|
[ --with-debug specifies option -g to compile with debug info (default) |
| 26 : |
pazsan
|
1.9
|
--without-debug omits the -g switch and creates smaller images on |
| 27 : |
|
|
machines where "strip" has problems with gcc style |
| 28 : |
|
|
debugging informations.], |
| 29 : |
|
|
if test "$withval" = "yes"; then DEBUGFLAG=-g; fi) |
| 30 : |
|
|
|
| 31 : |
anton
|
1.16
|
CFLAGS=$CFLAGS |
| 32 : |
|
|
|
| 33 : |
pazsan
|
1.15
|
AC_PROG_CC |
| 34 : |
|
|
|
| 35 : |
|
|
if test "$GCC" = "yes" |
| 36 : |
|
|
then |
| 37 : |
|
|
echo "Fine, gcc is available" |
| 38 : |
|
|
else |
| 39 : |
|
|
cat <<'EOF' |
| 40 : |
anton
|
1.16
|
Gforth requires GCC-2.0 or higher (it uses GNU C extensions). |
| 41 : |
|
|
It does not work with other C compilers. Please install the GNU C compiler, |
| 42 : |
|
|
and try again (or search for a binary distribution for your platform). |
| 43 : |
pazsan
|
1.15
|
EOF |
| 44 : |
|
|
exit 1 |
| 45 : |
|
|
fi |
| 46 : |
pazsan
|
1.9
|
|
| 47 : |
pazsan
|
1.15
|
AC_SUBST(CC) |
| 48 : |
anton
|
1.7
|
AC_SUBST(GCCLDFLAGS) |
| 49 : |
pazsan
|
1.9
|
AC_SUBST(DEBUGFLAG) |
| 50 : |
anton
|
1.7
|
|
| 51 : |
anton
|
1.10
|
dnl the following macro produces a warning with autoconf-2.1 |
| 52 : |
|
|
AC_CHECK_SIZEOF(char *) |
| 53 : |
|
|
case "$ac_cv_sizeof_char_p" in |
| 54 : |
|
|
2) |
| 55 : |
|
|
wordsize=16 |
| 56 : |
|
|
;; |
| 57 : |
|
|
4) |
| 58 : |
|
|
wordsize=32 |
| 59 : |
|
|
;; |
| 60 : |
|
|
8) |
| 61 : |
|
|
wordsize=64 |
| 62 : |
|
|
dnl AC_CHECK_SIZEOF(long long) |
| 63 : |
|
|
dnl if [ $ac_cv_sizeof_long_long != 16 ] |
| 64 : |
|
|
dnl then |
| 65 : |
pazsan
|
1.15
|
dnl try the whole thing with -mlonglong128 |
| 66 : |
anton
|
1.10
|
dnl complain about C compiler and OS vendor |
| 67 : |
|
|
dnl fi |
| 68 : |
|
|
;; |
| 69 : |
|
|
esac |
| 70 : |
pazsan
|
1.9
|
|
| 71 : |
anton
|
1.1
|
#terminology is a bit unusual here: The host is the system on which |
| 72 : |
|
|
#gforth will run; the system on which configure will run is the `build' |
| 73 : |
|
|
AC_CANONICAL_HOST |
| 74 : |
|
|
case "$host_cpu" in |
| 75 : |
|
|
hppa*) |
| 76 : |
|
|
mach_h=hppa |
| 77 : |
pazsan
|
1.3
|
LIBOBJS="cache.o" |
| 78 : |
pazsan
|
1.6
|
LDFLAGS="-Xlinker -N" |
| 79 : |
|
|
LIBS="-L/lib/pa1.1/" |
| 80 : |
anton
|
1.1
|
;; |
| 81 : |
|
|
sparc*) |
| 82 : |
|
|
mach_h=sparc |
| 83 : |
|
|
;; |
| 84 : |
|
|
i386|i486|i586) |
| 85 : |
|
|
mach_h=386 |
| 86 : |
anton
|
1.16
|
CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem" |
| 87 : |
anton
|
1.1
|
#!! direct/indirect threading switch |
| 88 : |
|
|
#!! -m486 flag |
| 89 : |
|
|
;; |
| 90 : |
|
|
mips*) |
| 91 : |
|
|
mach_h=mips |
| 92 : |
anton
|
1.7
|
#link text and data segment into the same 256M region! |
| 93 : |
|
|
GCCLDFLAGS="-Xlinker -T -Xlinker 10000000 -Xlinker -D -Xlinker 10400000" |
| 94 : |
anton
|
1.1
|
;; |
| 95 : |
pazsan
|
1.9
|
alpha*) |
| 96 : |
|
|
mach_h=alpha |
| 97 : |
|
|
echo Very Preliminary Support for Alpha!!! |
| 98 : |
|
|
;; |
| 99 : |
anton
|
1.1
|
*) |
| 100 : |
|
|
echo "No direct threading support for $host_cpu, using indirect threading." |
| 101 : |
anton
|
1.16
|
echo "Using a generic machine description. It will only work if char * AND" |
| 102 : |
|
|
echo "long values have the same size and long long is twice as long." |
| 103 : |
anton
|
1.1
|
echo "I'll assume that C floats and doubles are represented by IEEE single and" |
| 104 : |
|
|
echo "double numbers. If this is not so, SF@ etc. will not work correctly." |
| 105 : |
anton
|
1.16
|
echo "FLUSH-ICACHE will do nothing, so END-CODE may not work properly!" |
| 106 : |
anton
|
1.1
|
mach_h=32bit |
| 107 : |
|
|
esac |
| 108 : |
anton
|
1.10
|
AC_SUBST(host) |
| 109 : |
pazsan
|
1.15
|
AC_SUBST(ENGINE_FLAGS) |
| 110 : |
anton
|
1.1
|
|
| 111 : |
|
|
dnl Now a little support for DOS/DJGCC |
| 112 : |
|
|
AC_SUBST(MAKE_EXE) |
| 113 : |
|
|
MAKE_EXE="" |
| 114 : |
|
|
|
| 115 : |
|
|
dnl copy commands for systems that don't have links |
| 116 : |
pazsan
|
1.6
|
AC_SUBST(LINK_KERNL16L) |
| 117 : |
|
|
LINK_KERNL16L="" |
| 118 : |
|
|
AC_SUBST(LINK_KERNL16B) |
| 119 : |
|
|
LINK_KERNL16B="" |
| 120 : |
anton
|
1.1
|
AC_SUBST(LINK_KERNL32L) |
| 121 : |
|
|
LINK_KERNL32L="" |
| 122 : |
|
|
AC_SUBST(LINK_KERNL32B) |
| 123 : |
|
|
LINK_KERNL32B="" |
| 124 : |
pazsan
|
1.6
|
AC_SUBST(LINK_KERNL64L) |
| 125 : |
|
|
LINK_KERNL64L="" |
| 126 : |
|
|
AC_SUBST(LINK_KERNL64B) |
| 127 : |
|
|
LINK_KERNL64B="" |
| 128 : |
anton
|
1.1
|
|
| 129 : |
|
|
#if test $host_os=dos |
| 130 : |
|
|
#then |
| 131 : |
|
|
# echo Configuring for DOS!!! |
| 132 : |
|
|
# MAKE_EXE="coff2exe gforth" |
| 133 : |
anton
|
1.13
|
# LINK_KERNL32L='$(CP) kernl32l.fi kernal.fi' |
| 134 : |
anton
|
1.1
|
#fi |
| 135 : |
|
|
|
| 136 : |
|
|
dnl the following macro produces a warning with autoconf-2.1 |
| 137 : |
|
|
AC_C_BIGENDIAN |
| 138 : |
pazsan
|
1.4
|
AC_SUBST(KERNAL) |
| 139 : |
anton
|
1.1
|
dnl ac_cv_c_bigendian is an undocumented variable of autoconf-2.1 |
| 140 : |
|
|
if test $ac_cv_c_bigendian = yes; then |
| 141 : |
|
|
bytesex=b |
| 142 : |
pazsan
|
1.6
|
KERNAL="kernl16b.fi kernl16l.fi kernl32b.fi kernl32l.fi kernl64b.fi kernl64l.fi" |
| 143 : |
anton
|
1.1
|
else |
| 144 : |
|
|
bytesex=l |
| 145 : |
pazsan
|
1.6
|
KERNAL="kernl16l.fi kernl16b.fi kernl32l.fi kernl32b.fi kernl64l.fi kernl64b.fi" |
| 146 : |
anton
|
1.1
|
fi |
| 147 : |
|
|
|
| 148 : |
|
|
dnl Checks for programs. |
| 149 : |
|
|
AC_PROG_LN_S |
| 150 : |
|
|
AC_PROG_INSTALL |
| 151 : |
|
|
|
| 152 : |
|
|
dnl Checks for library functions |
| 153 : |
anton
|
1.2
|
dnl This check is just for making later checks link with libm. |
| 154 : |
|
|
dnl using sin here is no good idea since it is built-into gcc and typechecked |
| 155 : |
|
|
AC_CHECK_LIB(m,asin) |
| 156 : |
anton
|
1.1
|
AC_FUNC_MEMCMP |
| 157 : |
anton
|
1.13
|
AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal) |
| 158 : |
anton
|
1.17
|
AC_CHECK_FUNCS(sys_siglist) |
| 159 : |
anton
|
1.18
|
AC_MSG_CHECKING(whether sys_siglist may be declared) |
| 160 : |
|
|
AC_CACHE_VAL(gf_cv_declare_sys_siglist, |
| 161 : |
|
|
AC_TRY_COMPILE(#include <stdio.h> |
| 162 : |
|
|
#include <signal.h> |
| 163 : |
|
|
,extern void sys_siglist;,gf_cv_declare_sys_siglist='yes',gf_cv_declare_sys_siglist='no')) |
| 164 : |
|
|
if test $gf_cv_declare_sys_siglist = yes |
| 165 : |
|
|
then |
| 166 : |
|
|
AC_DEFINE(DECLARE_SYS_SIGLIST) |
| 167 : |
|
|
fi |
| 168 : |
|
|
AC_MSG_RESULT($gf_cv_declare_sys_siglist) |
| 169 : |
anton
|
1.8
|
AC_CHECK_FUNC(getopt_long,getopt_long="",getopt_long="getopt.o getopt1.o") |
| 170 : |
anton
|
1.1
|
AC_SUBST(getopt_long) |
| 171 : |
anton
|
1.11
|
AC_CHECK_FUNCS(rint expm1 log1p) |
| 172 : |
anton
|
1.1
|
AC_REPLACE_FUNCS(ecvt) |
| 173 : |
|
|
dnl No check for select, because our replacement is no good under |
| 174 : |
|
|
dnl anything but DOS |
| 175 : |
|
|
|
| 176 : |
anton
|
1.13
|
kernal_fi=kernl${wordsize}${bytesex}.fi |
| 177 : |
|
|
AC_SUBST(kernal_fi) |
| 178 : |
anton
|
1.8
|
|
| 179 : |
anton
|
1.13
|
AC_LINK_FILES(${mach_h}.h $kernal_fi,machine.h kernal.fi) |
| 180 : |
anton
|
1.18
|
AC_OUTPUT(Makefile,echo timestamp > stamp-h) |
| 181 : |
anton
|
1.1
|
|