File:  [gforth] / gforth / configure.in
Revision 1.72: download - view: text, annotated - select for diffs
Thu Sep 14 16:46:52 2000 UTC (23 years, 6 months ago) by anton
Branches: MAIN
CVS tags: HEAD
added initial ia64 support (thanks to Andreas Schwab)

    1: dnl Process this file with autoconf to produce a configure script.
    2: 
    3: #Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
    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: 
   21: AC_INIT(engine/engine.c)
   22: 
   23: dnl We use some automake macros here,
   24: dnl but don't use automake for creating Makefile.in
   25: AM_INIT_AUTOMAKE(gforth,0.4.9-20000726)
   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!
   29: AM_CONFIG_HEADER(engine/config.h)
   30: #AM_CYGWIN32
   31: 
   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: 
   51: AC_ARG_WITH(debug,
   52: [  --with-debug     specifies option -g to compile with debug info (default)
   53:   --without-debug  omits the -g switch and creates smaller images on
   54:                    machines where "strip" has problems with gcc style
   55:                    debugging informations.],
   56: if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)
   57: 
   58: CFLAGS=$CFLAGS
   59: 
   60: AC_PROG_CC
   61: 
   62: if test "$GCC" = "yes"
   63: then
   64:    echo "Fine, gcc is available"
   65: else
   66:    cat <<'EOF'
   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).
   70: EOF
   71:    exit 1
   72: fi
   73: 
   74: AC_SUBST(CC)
   75: AC_SUBST(DEBUGFLAG)
   76: 
   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
   90: 
   91: AC_CHECK_SIZEOF(char)
   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
   99:   $ac_cv_sizeof_int)
  100:     ac_cv_int_type_cell=int
  101:     ;;
  102:   $ac_cv_sizeof_short)
  103:     ac_cv_int_type_cell=short
  104:     ;;
  105:   $ac_cv_sizeof_char)
  106:     ac_cv_int_type_cell=char
  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
  115: if test "$ac_cv_int_type_cell" != int; then
  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
  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
  137: if test "$ac_cv_int_type_double_cell" = none; then
  138: 	echo "Emulating double-cell arithmetic. This may be slow."
  139: 	echo "If you find this unacceptable, ask the GCC maintainers to provide proper"
  140: 	echo 'long longs for your machine (the GCC manual states that they \"are twice as'
  141: 	echo "long as \`long int\'\")."
  142: 	LIBOBJS="$LIBOBJS dblsub.o"
  143: 	AC_DEFINE(BUGGY_LONG_LONG)
  144: else
  145:   AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell)
  146: fi
  147: 
  148: AC_MSG_CHECKING([whether the linker accepts -export-dynamic])
  149: OLDLDFLAGS=$LDFLAGS
  150: LDFLAGS="$LDFLAGS -export-dynamic"
  151: dnl AC_TRY_LINK gives false positive on rs6000-ibm-aix4.2.1.0
  152: dnl AC_TRY_LINK(,,ac_export_dynamic=yes,ac_export_dynamic=no)
  153: AC_TRY_RUN(main(){exit(0);},ac_export_dynamic=yes,ac_export_dynamic=no,ac_export_dynamic=no)
  154: test $ac_export_dynamic = yes|| LDFLAGS=$OLDLDFLAGS
  155: AC_MSG_RESULT($ac_export_dynamic)
  156: 
  157: #terminology is a bit unusual here: The host is the system on which
  158: #gforth will run; the system on which configure will run is the `build'
  159: AC_CANONICAL_HOST
  160: case "$host_cpu" in
  161: 	hppa*)
  162: 		machine=hppa
  163: 		$srcdir/mkinstalldirs arch/hppa
  164: 		LIBOBJS="$LIBOBJS ../arch/hppa/cache.o"
  165: 		LDFLAGS="$LDFLAGS -Xlinker -N"
  166: 		LIBS="$LIBS -L/lib/pa1.1/"
  167: 		if test "${enable_direct_threaded+set}" = ""
  168: 		then
  169: 			AC_DEFINE(DIRECT_THREADED)
  170: 		fi
  171: 		;;
  172: 	sparc*)
  173: 		machine=sparc
  174: 		;;
  175: 	i386)
  176: 		machine=386
  177: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
  178: 		if test "${enable_direct_threaded+set}" = "" \
  179: 			-a "${enable_indirect_threaded+set}" = ""
  180: 		then
  181: 			echo "Using direct threaded code on 386"
  182: 			AC_DEFINE(DIRECT_THREADED)
  183: 		fi
  184: 		;;
  185: 	i486)
  186: 		machine=386
  187: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem -m486"
  188: 		if test "${enable_direct_threaded+set}" = "" \
  189: 			-a "${enable_indirect_threaded+set}" = ""
  190: 		then
  191: 			echo "Using direct threaded code on 486"
  192: 			AC_DEFINE(DIRECT_THREADED)
  193: 		fi
  194: 		;;
  195: 	i586)
  196: 		machine=386
  197: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
  198: 		CFLAGS_1="$CFLAGS"
  199: 		CFLAGS="$CFLAGS -mpentium"
  200: 		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
  201: 		if test "${enable_direct_threaded+set}" = "" \
  202: 			-a "${enable_indirect_threaded+set}" = ""
  203: 		then
  204: 			echo "Using indirect threaded code on Pentium/K5/K6"
  205: 			AC_DEFINE(INDIRECT_THREADED)
  206: 		fi
  207: 		;;
  208: 	i686)
  209: 		machine=386
  210: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
  211: 		CFLAGS_1="$CFLAGS"
  212: 		CFLAGS="$CFLAGS -mpentium"
  213: 		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
  214: 		if test "${enable_direct_threaded+set}" = "" \
  215: 			-a "${enable_indirect_threaded+set}" = ""
  216: 		then
  217: 			echo "Using direct threaded code on Athlon/PPro/Pentium II/Pentium III"
  218: 			AC_DEFINE(DIRECT_THREADED)
  219: 		fi
  220: 		;;
  221: 	ia64*)
  222: 		machine=ia64
  223: 		;;
  224:         m68k)
  225: 		machine=m68k
  226: 		CFLAGS="$CFLAGS -fomit-frame-pointer"
  227: 		if test "$host_os" = "nextstep3"
  228: 		then
  229: 			LIBOBJS="$LIBOBJS termios.o"
  230: 		fi
  231: 		;;
  232: 	mips*)
  233: 		machine=mips
  234: 		#link text and data segment into the same 256M region!
  235: 		AC_MSG_CHECKING([whether the linker accepts -T])
  236: 		OLDLDFLAGS=$LDFLAGS
  237: 		LDFLAGS="$LDFLAGS -Xlinker -T -Xlinker 10000000"
  238: 		AC_TRY_LINK(,,ac_link_mips_t=yes,ac_link_mips_t=no)
  239: 		test $ac_link_mips_t = yes||LDFLAGS=$OLDLDFLAGS
  240: 		AC_MSG_RESULT($ac_link_mips_t)
  241: 		test $ac_link_mips_t = yes||(echo cannot link text and data into same 256M region, using indirect threading; AC_DEFINE(INDIRECT_THREADED))
  242: 		AC_MSG_CHECKING([whether the linker accepts -D])
  243: 		OLDLDFLAGS=$LDFLAGS
  244: 		LDFLAGS="$LDFLAGS -Xlinker -D -Xlinker 10400000"
  245: 		AC_TRY_LINK(,,ac_link_mips_d=yes,ac_link_mips_d=no)
  246: 		test $ac_link_mips_d = yes||LDFLAGS=$OLDLDFLAGS
  247: 		AC_MSG_RESULT($ac_link_mips_d)
  248: 		;;
  249: 	alpha*)
  250: 		machine=alpha
  251: 		#full IEEE FP support for more uniformity across platforms:
  252: 		CFLAGS="$CFLAGS -mieee"
  253: 		;;
  254: 	power*|rs6000)
  255: 		machine=power
  256: 		$srcdir/mkinstalldirs arch/power
  257: 		AC_CHECK_FUNC(_sync_cache_range,true,LIBOBJS="$LIBOBJS ../arch/power/_sync_cache_range.o")
  258: 		#link text segment into first 32MB
  259: 		AC_MSG_CHECKING([whether the linker accepts --script=arch/power/elf32ppc.x])
  260: 		OLDLDFLAGS=$LDFLAGS
  261:                 #the -L../$srcdir helps when $srcdir is relative
  262: 		LDFLAGS="$LDFLAGS -L$srcdir -L../$srcdir -Xlinker --script=$srcdir/arch/power/elf32ppc.x"
  263: 		AC_TRY_LINK(,,ac_link_script=yes,ac_link_script=no)
  264: 		test $ac_link_script = yes||LDFLAGS=$OLDLDFLAGS
  265: 		AC_MSG_RESULT($ac_link_script)
  266: 		AC_MSG_CHECKING([whether the code is in the first 32MB])
  267: 		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)
  268:                 AC_MSG_RESULT($ac_code_under_32)
  269: 		test $ac_code_under_32 = yes||(AC_MSG_WARN([Using indirect threading]); AC_DEFINE(INDIRECT_THREADED))
  270: 		;;
  271: 	*)
  272: 		echo "No direct threading support for $host_cpu, using indirect threading."
  273: 		echo "Using a generic machine description."
  274: 		echo "I'll assume that C floats and doubles are represented by IEEE single and"
  275: 		echo "double numbers. If this is not so, SF@ etc. will not work correctly."
  276: 		echo "FLUSH-ICACHE will do nothing, so END-CODE may not work properly!"
  277: 		machine=generic
  278: esac
  279: AC_SUBST(host)
  280: AC_SUBST(ENGINE_FLAGS)
  281: 
  282: AC_CHECK_PROG(asm_fs,asm.fs,arch/$machine/asm.fs,,$srcdir/arch/$machine)
  283: AC_SUBST(asm_fs)
  284: 
  285: AC_CHECK_PROG(disasm_fs,disasm.fs,arch/$machine/disasm.fs,,$srcdir/arch/$machine)
  286: AC_SUBST(disasm_fs)
  287: 
  288: case "$host_os" in
  289: 	*win32)
  290: 		EXE=".exe"
  291: 		;;
  292: 	*)
  293: 		EXE=""
  294: 		;;
  295: esac
  296: AC_SUBST(EXE)
  297: 
  298: dnl Now a little support for DOS/DJGCC
  299: AC_SUBST(GFORTH_EXE)
  300: GFORTH_EXE=""
  301: AC_SUBST(GFORTHFAST_EXE)
  302: GFORTHFAST_EXE=""
  303: AC_SUBST(GFORTHDITC_EXE)
  304: GFORTHDITC_EXE=""
  305: 
  306: PATHSEP=":"
  307: AC_SUBST(PATHSEP)
  308: AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP')
  309: 
  310: AC_SUBST(FORTHSIZES)
  311: 
  312: dnl copy commands for systems that don't have links
  313: AC_SUBST(LINK_KERNL)
  314: LINK_KERNL=""
  315: 
  316: #if test $host_os=dos
  317: #then
  318: #  echo Configuring for DOS!!!
  319: #  MAKE_EXE="coff2exe gforth"
  320: #  LINK_KERNL='$(CP) kernl32l.fi kernel.fi'
  321: #fi
  322: 
  323: dnl the following macro produces a warning with autoconf-2.1
  324: AC_C_BIGENDIAN
  325: AC_SUBST(KERNEL)
  326: dnl ac_cv_c_bigendian is an undocumented variable of autoconf-2.1
  327: if test $ac_cv_c_bigendian = yes; then
  328:   bytesex=b
  329:   KERNEL="kernl16b.fi kernl16l.fi kernl32b.fi kernl32l.fi kernl64b.fi kernl64l.fi"
  330: else
  331:   bytesex=l
  332:   KERNEL="kernl16l.fi kernl16b.fi kernl32l.fi kernl32b.fi kernl64l.fi kernl64b.fi"
  333: fi
  334: 
  335: dnl Checks for programs.
  336: AC_PROG_LN_S
  337: dnl AM_PROG_INSTALL #performed by AM_INIT_AUTOMAKE
  338: 
  339: dnl Checks for library functions
  340: dnl This check is just for making later checks link with libm.
  341: dnl using sin here is no good idea since it is built-into gcc and typechecked
  342: AC_CHECK_LIB(m,asin)
  343: AC_CHECK_LIB(dl,dlopen)
  344: if test "$host_os" != "nextstep3"
  345: then
  346: 	AC_FUNC_MEMCMP
  347: fi
  348: AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
  349: AC_CHECK_FUNCS(dlopen sys_siglist getrusage)
  350: AC_DECL_SYS_SIGLIST
  351: AC_CHECK_FUNC(getopt_long,true,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
  352: AC_CHECK_FUNCS(rint expm1 log1p)
  353: AC_REPLACE_FUNCS(ecvt)
  354: dnl No check for select, because our replacement is no good under
  355: dnl anything but DOS
  356: AC_CHECK_HEADERS(sys/mman.h fnmatch.h)
  357: AC_FUNC_FNMATCH
  358: test $ac_cv_func_fnmatch_works = yes || LIBOBJS="$LIBOBJS fnmatch.o"
  359: AC_CHECK_FUNCS(mmap sysconf getpagesize)
  360: AM_PATH_LISPDIR
  361: 
  362: kernel_fi=kernl${wordsize}${bytesex}.fi
  363: AC_SUBST(kernel_fi)
  364: 
  365: dnl replace srource directory by absolute value
  366: if test $srcdir = "."; then srcdir=`pwd` 
  367: fi
  368: 
  369: AC_SUBST(machine)
  370: dnl AC_LINK_FILES(arch/$machine,arch/machine) #no longer needed
  371: AC_OUTPUT([
  372: Makefile
  373: Makedist
  374: gforthmi
  375: engine/Makefile
  376: doc/version.texi ],
  377: echo timestamp > stamp-h
  378: chmod +x gforthmi
  379: test -d kernel||mkdir kernel)
  380: 

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