Annotation of gforth/configure.in, revision 1.81
1.1 anton 1: dnl Process this file with autoconf to produce a configure script.
1.20 anton 2:
1.73 anton 3: #Copyright (C) 1995,1996,1997,1998,2000 Free Software Foundation, Inc.
1.20 anton 4:
5: #This file is part of Gforth.
6:
7: #Gforth is free software; you can redistribute it and/or
8: #modify it under the terms of the GNU General Public License
9: #as published by the Free Software Foundation; either version 2
10: #of the License, or (at your option) any later version.
11:
12: #This program is distributed in the hope that it will be useful,
13: #but WITHOUT ANY WARRANTY; without even the implied warranty of
14: #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.#See the
15: #GNU General Public License for more details.
16:
17: #You should have received a copy of the GNU General Public License
18: #along with this program; if not, write to the Free Software
1.74 anton 19: #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
1.20 anton 20:
1.31 anton 21: AC_INIT(engine/engine.c)
1.34 anton 22:
23: dnl We use some automake macros here,
24: dnl but don't use automake for creating Makefile.in
1.81 ! anton 25: AM_INIT_AUTOMAKE(gforth,0.5.9-20010501)
1.47 anton 26: #snapshots have numbers major.minor.release-YYYYMMDD
27: #note that lexicographic ordering bust be heeded.
28: #I.e., 0.4.1-YYYYMMDD must not exist before 0.4.1!
1.34 anton 29: AM_CONFIG_HEADER(engine/config.h)
1.57 anton 30: #AM_CYGWIN32
1.14 anton 31:
1.1 anton 32: AC_ARG_ENABLE(force-reg,
33: [ --enable-force-reg Use explicit register declarations if they appear in
34: the machine.h file. This can cause a good speedup,
35: but also incorrect code with some gcc versions on
36: some processors (default disabled).],
37: AC_DEFINE(FORCE_REG))
38: dnl this is not quite according to the autoconf manual, it causes a replacement
39: AC_ARG_ENABLE(direct-threaded,
40: [ --enable-direct-threaded Force direct threading. This may not work on
41: some machines and may cause slowdown on others.
42: (default processor-dependent)],
43: AC_DEFINE(DIRECT_THREADED))
44: AC_ARG_ENABLE(indirect-threaded,
45: [ --enable-indirect-threaded Force indirect threading. This can cause a
46: slowdown on some machines.
47: (default processor-dependent)],
48: AC_DEFINE(INDIRECT_THREADED))
49:
1.9 pazsan 50: AC_ARG_WITH(debug,
1.10 anton 51: [ --with-debug specifies option -g to compile with debug info (default)
1.27 anton 52: --without-debug omits the -g switch and creates smaller images on
53: machines where "strip" has problems with gcc style
54: debugging informations.],
1.9 pazsan 55: if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)
56:
1.79 pazsan 57: PEEPHOLE="yes"
58: AC_ARG_WITH(peephole,
59: [ --with-peephole Enable peephole optimization (default)
60: --without-peephole disables peephole optimization. Creates smaller,
61: but slower images.],
62: PEEPHOLE="$withval")
63:
1.16 anton 64: CFLAGS=$CFLAGS
65:
1.15 pazsan 66: AC_PROG_CC
67:
68: if test "$GCC" = "yes"
69: then
70: echo "Fine, gcc is available"
71: else
72: cat <<'EOF'
1.16 anton 73: Gforth requires GCC-2.0 or higher (it uses GNU C extensions).
74: It does not work with other C compilers. Please install the GNU C compiler,
75: and try again (or search for a binary distribution for your platform).
1.15 pazsan 76: EOF
77: exit 1
78: fi
1.9 pazsan 79:
1.15 pazsan 80: AC_SUBST(CC)
1.9 pazsan 81: AC_SUBST(DEBUGFLAG)
1.7 anton 82:
1.10 anton 83: dnl the following macro produces a warning with autoconf-2.1
84: AC_CHECK_SIZEOF(char *)
85: case "$ac_cv_sizeof_char_p" in
86: 2)
87: wordsize=16
88: ;;
89: 4)
90: wordsize=32
91: ;;
92: 8)
93: wordsize=64
94: ;;
95: esac
1.9 pazsan 96:
1.40 pazsan 97: AC_CHECK_SIZEOF(char)
1.23 pazsan 98: AC_CHECK_SIZEOF(short)
99: AC_CHECK_SIZEOF(int)
100: AC_CHECK_SIZEOF(long)
101: AC_CHECK_SIZEOF(long long)
102:
103: ac_cv_int_type_cell=none
104: case "$ac_cv_sizeof_char_p" in
1.40 pazsan 105: $ac_cv_sizeof_int)
106: ac_cv_int_type_cell=int
107: ;;
1.23 pazsan 108: $ac_cv_sizeof_short)
109: ac_cv_int_type_cell=short
110: ;;
1.40 pazsan 111: $ac_cv_sizeof_char)
112: ac_cv_int_type_cell=char
1.23 pazsan 113: ;;
114: $ac_cv_sizeof_long)
115: ac_cv_int_type_cell=long
116: ;;
117: $ac_cv_sizeof_long_long)
118: ac_cv_int_type_cell="long long"
119: ;;
120: esac
1.22 pazsan 121: if test "$ac_cv_int_type_cell" != int; then
1.20 anton 122: echo "So, sizeof(pointer)!=sizeof(int); looks like a DOS C compiler to me."
123: echo "Since you don't have a proper C on this machine, that's one more reason"
124: echo "to use Forth;-)"
125: fi
1.23 pazsan 126: AC_DEFINE_UNQUOTED(CELL_TYPE,$ac_cv_int_type_cell)
127:
128: ac_cv_int_type_double_cell=none
129: case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
130: $ac_cv_sizeof_short)
131: ac_cv_int_type_double_cell=short
132: ;;
133: $ac_cv_sizeof_int)
134: ac_cv_int_type_double_cell=int
135: ;;
136: $ac_cv_sizeof_long)
137: ac_cv_int_type_double_cell=long
138: ;;
139: $ac_cv_sizeof_long_long)
140: ac_cv_int_type_double_cell="long long"
141: ;;
142: esac
1.21 anton 143: if test "$ac_cv_int_type_double_cell" = none; then
1.20 anton 144: echo "Emulating double-cell arithmetic. This may be slow."
145: echo "If you find this unacceptable, ask the GCC maintainers to provide proper"
1.23 pazsan 146: echo 'long longs for your machine (the GCC manual states that they \"are twice as'
147: echo "long as \`long int\'\")."
1.20 anton 148: LIBOBJS="$LIBOBJS dblsub.o"
149: AC_DEFINE(BUGGY_LONG_LONG)
1.23 pazsan 150: else
151: AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell)
1.20 anton 152: fi
153:
1.50 jwilke 154: AC_MSG_CHECKING([whether the linker accepts -export-dynamic])
155: OLDLDFLAGS=$LDFLAGS
156: LDFLAGS="$LDFLAGS -export-dynamic"
1.69 anton 157: dnl AC_TRY_LINK gives false positive on rs6000-ibm-aix4.2.1.0
158: dnl AC_TRY_LINK(,,ac_export_dynamic=yes,ac_export_dynamic=no)
159: AC_TRY_RUN(main(){exit(0);},ac_export_dynamic=yes,ac_export_dynamic=no,ac_export_dynamic=no)
1.50 jwilke 160: test $ac_export_dynamic = yes|| LDFLAGS=$OLDLDFLAGS
161: AC_MSG_RESULT($ac_export_dynamic)
162:
1.1 anton 163: #terminology is a bit unusual here: The host is the system on which
164: #gforth will run; the system on which configure will run is the `build'
165: AC_CANONICAL_HOST
166: case "$host_cpu" in
167: hppa*)
1.34 anton 168: machine=hppa
1.46 anton 169: $srcdir/mkinstalldirs arch/hppa
1.38 anton 170: LIBOBJS="$LIBOBJS ../arch/hppa/cache.o"
1.50 jwilke 171: LDFLAGS="$LDFLAGS -Xlinker -N"
1.47 anton 172: LIBS="$LIBS -L/lib/pa1.1/"
1.31 anton 173: if test "${enable_direct_threaded+set}" = ""
174: then
175: AC_DEFINE(DIRECT_THREADED)
176: fi
1.1 anton 177: ;;
178: sparc*)
1.34 anton 179: machine=sparc
1.1 anton 180: ;;
1.31 anton 181: i386)
1.34 anton 182: machine=386
1.16 anton 183: CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
1.31 anton 184: if test "${enable_direct_threaded+set}" = "" \
185: -a "${enable_indirect_threaded+set}" = ""
186: then
1.34 anton 187: echo "Using direct threaded code on 386"
1.31 anton 188: AC_DEFINE(DIRECT_THREADED)
189: fi
190: ;;
191: i486)
1.34 anton 192: machine=386
1.31 anton 193: CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem -m486"
194: if test "${enable_direct_threaded+set}" = "" \
195: -a "${enable_indirect_threaded+set}" = ""
196: then
1.34 anton 197: echo "Using direct threaded code on 486"
1.31 anton 198: AC_DEFINE(DIRECT_THREADED)
199: fi
200: ;;
1.77 anton 201: i*86)
1.34 anton 202: machine=386
1.55 anton 203: CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
1.56 pazsan 204: CFLAGS_1="$CFLAGS"
205: CFLAGS="$CFLAGS -mpentium"
206: AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
1.31 anton 207: if test "${enable_direct_threaded+set}" = "" \
208: -a "${enable_indirect_threaded+set}" = ""
209: then
1.77 anton 210: echo "Using indirect threaded code on IA32 CPUs with split L1 caches"
1.31 anton 211: AC_DEFINE(INDIRECT_THREADED)
212: fi
1.1 anton 213: ;;
1.72 anton 214: ia64*)
215: machine=ia64
216: ;;
1.26 pazsan 217: m68k)
1.34 anton 218: machine=m68k
1.32 pazsan 219: CFLAGS="$CFLAGS -fomit-frame-pointer"
220: if test "$host_os" = "nextstep3"
221: then
222: LIBOBJS="$LIBOBJS termios.o"
223: fi
1.26 pazsan 224: ;;
1.1 anton 225: mips*)
1.34 anton 226: machine=mips
1.7 anton 227: #link text and data segment into the same 256M region!
1.49 anton 228: AC_MSG_CHECKING([whether the linker accepts -T])
229: OLDLDFLAGS=$LDFLAGS
230: LDFLAGS="$LDFLAGS -Xlinker -T -Xlinker 10000000"
231: AC_TRY_LINK(,,ac_link_mips_t=yes,ac_link_mips_t=no)
232: test $ac_link_mips_t = yes||LDFLAGS=$OLDLDFLAGS
233: AC_MSG_RESULT($ac_link_mips_t)
234: test $ac_link_mips_t = yes||(echo cannot link text and data into same 256M region, using indirect threading; AC_DEFINE(INDIRECT_THREADED))
1.37 anton 235: AC_MSG_CHECKING([whether the linker accepts -D])
236: OLDLDFLAGS=$LDFLAGS
1.49 anton 237: LDFLAGS="$LDFLAGS -Xlinker -D -Xlinker 10400000"
1.37 anton 238: AC_TRY_LINK(,,ac_link_mips_d=yes,ac_link_mips_d=no)
1.49 anton 239: test $ac_link_mips_d = yes||LDFLAGS=$OLDLDFLAGS
1.37 anton 240: AC_MSG_RESULT($ac_link_mips_d)
1.1 anton 241: ;;
1.9 pazsan 242: alpha*)
1.34 anton 243: machine=alpha
1.58 anton 244: #full IEEE FP support for more uniformity across platforms:
245: CFLAGS="$CFLAGS -mieee"
1.9 pazsan 246: ;;
1.69 anton 247: power*|rs6000)
1.34 anton 248: machine=power
1.46 anton 249: $srcdir/mkinstalldirs arch/power
1.36 anton 250: AC_CHECK_FUNC(_sync_cache_range,true,LIBOBJS="$LIBOBJS ../arch/power/_sync_cache_range.o")
1.64 anton 251: #link text segment into first 32MB
252: AC_MSG_CHECKING([whether the linker accepts --script=arch/power/elf32ppc.x])
253: OLDLDFLAGS=$LDFLAGS
254: #the -L../$srcdir helps when $srcdir is relative
255: LDFLAGS="$LDFLAGS -L$srcdir -L../$srcdir -Xlinker --script=$srcdir/arch/power/elf32ppc.x"
256: AC_TRY_LINK(,,ac_link_script=yes,ac_link_script=no)
257: test $ac_link_script = yes||LDFLAGS=$OLDLDFLAGS
258: AC_MSG_RESULT($ac_link_script)
1.65 anton 259: AC_MSG_CHECKING([whether the code is in the first 32MB])
260: AC_TRY_RUN([main(){label: exit(((unsigned long)&&label)>32000000UL);}],ac_code_under_32=yes,ac_code_under_32=no,ac_code_under_32=no)
261: AC_MSG_RESULT($ac_code_under_32)
1.70 anton 262: test $ac_code_under_32 = yes||(AC_MSG_WARN([Using indirect threading]); AC_DEFINE(INDIRECT_THREADED))
1.31 anton 263: ;;
1.1 anton 264: *)
265: echo "No direct threading support for $host_cpu, using indirect threading."
1.20 anton 266: echo "Using a generic machine description."
1.1 anton 267: echo "I'll assume that C floats and doubles are represented by IEEE single and"
268: echo "double numbers. If this is not so, SF@ etc. will not work correctly."
1.16 anton 269: echo "FLUSH-ICACHE will do nothing, so END-CODE may not work properly!"
1.34 anton 270: machine=generic
1.1 anton 271: esac
1.10 anton 272: AC_SUBST(host)
1.15 pazsan 273: AC_SUBST(ENGINE_FLAGS)
1.1 anton 274:
1.66 anton 275: AC_CHECK_PROG(asm_fs,asm.fs,arch/$machine/asm.fs,,$srcdir/arch/$machine)
1.61 anton 276: AC_SUBST(asm_fs)
277:
1.66 anton 278: AC_CHECK_PROG(disasm_fs,disasm.fs,arch/$machine/disasm.fs,,$srcdir/arch/$machine)
1.61 anton 279: AC_SUBST(disasm_fs)
280:
1.39 pazsan 281: case "$host_os" in
282: *win32)
283: EXE=".exe"
284: ;;
285: *)
286: EXE=""
287: ;;
288: esac
289: AC_SUBST(EXE)
290:
1.1 anton 291: dnl Now a little support for DOS/DJGCC
1.30 pazsan 292: AC_SUBST(GFORTH_EXE)
293: GFORTH_EXE=""
1.48 anton 294: AC_SUBST(GFORTHFAST_EXE)
295: GFORTHFAST_EXE=""
1.30 pazsan 296: AC_SUBST(GFORTHDITC_EXE)
297: GFORTHDITC_EXE=""
1.1 anton 298:
1.24 anton 299: PATHSEP=":"
300: AC_SUBST(PATHSEP)
301: AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP')
1.27 anton 302:
303: AC_SUBST(FORTHSIZES)
1.24 anton 304:
1.79 pazsan 305: if test "$PEEPHOLE" = "yes"
306: then
307: PEEPHOLEFLAG="true"
308: AC_DEFINE(HAS_PEEPHOLE)
309: else
310: PEEPHOLEFLAG="false"
311: fi
312: AC_SUBST(PEEPHOLEFLAG)
313:
1.1 anton 314: dnl copy commands for systems that don't have links
1.29 pazsan 315: AC_SUBST(LINK_KERNL)
316: LINK_KERNL=""
1.1 anton 317:
318: #if test $host_os=dos
319: #then
320: # echo Configuring for DOS!!!
321: # MAKE_EXE="coff2exe gforth"
1.29 pazsan 322: # LINK_KERNL='$(CP) kernl32l.fi kernel.fi'
1.1 anton 323: #fi
324:
325: dnl the following macro produces a warning with autoconf-2.1
326: AC_C_BIGENDIAN
1.23 pazsan 327: AC_SUBST(KERNEL)
1.1 anton 328: dnl ac_cv_c_bigendian is an undocumented variable of autoconf-2.1
329: if test $ac_cv_c_bigendian = yes; then
330: bytesex=b
1.23 pazsan 331: KERNEL="kernl16b.fi kernl16l.fi kernl32b.fi kernl32l.fi kernl64b.fi kernl64l.fi"
1.1 anton 332: else
333: bytesex=l
1.23 pazsan 334: KERNEL="kernl16l.fi kernl16b.fi kernl32l.fi kernl32b.fi kernl64l.fi kernl64b.fi"
1.1 anton 335: fi
336:
337: dnl Checks for programs.
338: AC_PROG_LN_S
1.34 anton 339: dnl AM_PROG_INSTALL #performed by AM_INIT_AUTOMAKE
1.1 anton 340:
341: dnl Checks for library functions
1.2 anton 342: dnl This check is just for making later checks link with libm.
343: dnl using sin here is no good idea since it is built-into gcc and typechecked
344: AC_CHECK_LIB(m,asin)
1.31 anton 345: AC_CHECK_LIB(dl,dlopen)
1.32 pazsan 346: if test "$host_os" != "nextstep3"
347: then
348: AC_FUNC_MEMCMP
349: fi
1.25 pazsan 350: AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
1.71 anton 351: AC_CHECK_FUNCS(dlopen sys_siglist getrusage)
1.19 anton 352: AC_DECL_SYS_SIGLIST
1.34 anton 353: AC_CHECK_FUNC(getopt_long,true,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
1.11 anton 354: AC_CHECK_FUNCS(rint expm1 log1p)
1.1 anton 355: AC_REPLACE_FUNCS(ecvt)
356: dnl No check for select, because our replacement is no good under
357: dnl anything but DOS
1.62 anton 358: AC_CHECK_HEADERS(sys/mman.h fnmatch.h)
1.63 anton 359: AC_FUNC_FNMATCH
360: test $ac_cv_func_fnmatch_works = yes || LIBOBJS="$LIBOBJS fnmatch.o"
1.28 anton 361: AC_CHECK_FUNCS(mmap sysconf getpagesize)
1.34 anton 362: AM_PATH_LISPDIR
1.1 anton 363:
1.23 pazsan 364: kernel_fi=kernl${wordsize}${bytesex}.fi
365: AC_SUBST(kernel_fi)
1.50 jwilke 366:
1.76 anton 367: #this breaks bindists
368: #dnl replace srource directory by absolute value
369: #if test $srcdir = "."; then srcdir=`pwd`
370: #fi
1.8 anton 371:
1.34 anton 372: AC_SUBST(machine)
373: dnl AC_LINK_FILES(arch/$machine,arch/machine) #no longer needed
1.31 anton 374: AC_OUTPUT([
375: Makefile
1.45 pazsan 376: Makedist
1.43 anton 377: gforthmi
1.80 anton 378: vmgen
1.79 pazsan 379: machpc.fs
1.35 anton 380: engine/Makefile
1.44 anton 381: doc/version.texi ],
382: echo timestamp > stamp-h
1.43 anton 383: chmod +x gforthmi
1.80 anton 384: chmod +x vmgen
1.44 anton 385: test -d kernel||mkdir kernel)
386:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>