Annotation of gforth/configure.in, revision 1.64

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>