File:  [gforth] / gforth / configure.in
Revision 1.46: download - view: text, annotated - select for diffs
Tue Dec 22 23:11:29 1998 UTC (20 years, 10 months ago) by anton
Branches: MAIN
CVS tags: v0-4-0, HEAD
fixed some bugs and problems

    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.0)
   26: AM_CONFIG_HEADER(engine/config.h)
   27: AM_CYGWIN32
   28: 
   29: AC_ARG_ENABLE(force-reg,
   30: [  --enable-force-reg	  Use explicit register declarations if they appear in
   31: 			  the machine.h file. This can cause a good speedup,
   32: 			  but also incorrect code with some gcc versions on
   33: 			  some processors (default disabled).],
   34: 
   35: AC_DEFINE(FORCE_REG))
   36: dnl this is not quite according to the autoconf manual, it causes a replacement
   37: AC_ARG_ENABLE(direct-threaded,
   38: [  --enable-direct-threaded	Force direct threading. This may not work on
   39: 				some machines and may cause slowdown on others.
   40: 				(default processor-dependent)],
   41: AC_DEFINE(DIRECT_THREADED))
   42: AC_ARG_ENABLE(indirect-threaded,
   43: [  --enable-indirect-threaded	Force indirect threading. This can cause a
   44: 				slowdown on some machines.
   45: 				(default processor-dependent)],
   46: AC_DEFINE(INDIRECT_THREADED))
   47: 
   48: AC_ARG_WITH(debug,
   49: [  --with-debug     specifies option -g to compile with debug info (default)
   50:   --without-debug  omits the -g switch and creates smaller images on
   51:                    machines where "strip" has problems with gcc style
   52:                    debugging informations.],
   53: if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)
   54: 
   55: CFLAGS=$CFLAGS
   56: 
   57: AC_PROG_CC
   58: 
   59: if test "$GCC" = "yes"
   60: then
   61:    echo "Fine, gcc is available"
   62: else
   63:    cat <<'EOF'
   64: Gforth requires GCC-2.0 or higher (it uses GNU C extensions).
   65: It does not work with other C compilers. Please install the GNU C compiler,
   66: and try again (or search for a binary distribution for your platform).
   67: EOF
   68:    exit 1
   69: fi
   70: 
   71: AC_SUBST(CC)
   72: AC_SUBST(DEBUGFLAG)
   73: 
   74: dnl the following macro produces a warning with autoconf-2.1
   75: AC_CHECK_SIZEOF(char *)
   76: case "$ac_cv_sizeof_char_p" in
   77:   2)
   78:     wordsize=16
   79:     ;;
   80:   4)
   81:     wordsize=32
   82:     ;;
   83:   8)
   84:     wordsize=64
   85:     ;;
   86: esac
   87: 
   88: AC_CHECK_SIZEOF(char)
   89: AC_CHECK_SIZEOF(short)
   90: AC_CHECK_SIZEOF(int)
   91: AC_CHECK_SIZEOF(long)
   92: AC_CHECK_SIZEOF(long long)
   93: 
   94: ac_cv_int_type_cell=none
   95: case "$ac_cv_sizeof_char_p" in
   96:   $ac_cv_sizeof_int)
   97:     ac_cv_int_type_cell=int
   98:     ;;
   99:   $ac_cv_sizeof_short)
  100:     ac_cv_int_type_cell=short
  101:     ;;
  102:   $ac_cv_sizeof_char)
  103:     ac_cv_int_type_cell=char
  104:     ;;
  105:   $ac_cv_sizeof_long)
  106:     ac_cv_int_type_cell=long
  107:     ;;
  108:   $ac_cv_sizeof_long_long)
  109:     ac_cv_int_type_cell="long long"
  110:     ;;
  111: esac
  112: if test "$ac_cv_int_type_cell" != int; then
  113: 	echo "So, sizeof(pointer)!=sizeof(int); looks like a DOS C compiler to me."
  114: 	echo "Since you don't have a proper C on this machine, that's one more reason"
  115: 	echo "to use Forth;-)"
  116: fi
  117: AC_DEFINE_UNQUOTED(CELL_TYPE,$ac_cv_int_type_cell)
  118: 
  119: ac_cv_int_type_double_cell=none
  120: case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
  121:   $ac_cv_sizeof_short)
  122:     ac_cv_int_type_double_cell=short
  123:     ;;
  124:   $ac_cv_sizeof_int)
  125:     ac_cv_int_type_double_cell=int
  126:     ;;
  127:   $ac_cv_sizeof_long)
  128:     ac_cv_int_type_double_cell=long
  129:     ;;
  130:   $ac_cv_sizeof_long_long)
  131:     ac_cv_int_type_double_cell="long long"
  132:     ;;
  133: esac
  134: if test "$ac_cv_int_type_double_cell" = none; then
  135: 	echo "Emulating double-cell arithmetic. This may be slow."
  136: 	echo "If you find this unacceptable, ask the GCC maintainers to provide proper"
  137: 	echo 'long longs for your machine (the GCC manual states that they \"are twice as'
  138: 	echo "long as \`long int\'\")."
  139: 	LIBOBJS="$LIBOBJS dblsub.o"
  140: 	AC_DEFINE(BUGGY_LONG_LONG)
  141: else
  142:   AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell)
  143: fi
  144: 
  145: #terminology is a bit unusual here: The host is the system on which
  146: #gforth will run; the system on which configure will run is the `build'
  147: AC_CANONICAL_HOST
  148: case "$host_cpu" in
  149: 	hppa*)
  150: 		machine=hppa
  151: 		$srcdir/mkinstalldirs arch/hppa
  152: 		LIBOBJS="$LIBOBJS ../arch/hppa/cache.o"
  153: 		LDFLAGS="-Xlinker -N"
  154: 		LIBS="-L/lib/pa1.1/"
  155: 		if test "${enable_direct_threaded+set}" = ""
  156: 		then
  157: 			AC_DEFINE(DIRECT_THREADED)
  158: 		fi
  159: 		;;
  160: 	sparc*)
  161: 		machine=sparc
  162: 		;;
  163: 	i386)
  164: 		machine=386
  165: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
  166: 		if test "${enable_direct_threaded+set}" = "" \
  167: 			-a "${enable_indirect_threaded+set}" = ""
  168: 		then
  169: 			echo "Using direct threaded code on 386"
  170: 			AC_DEFINE(DIRECT_THREADED)
  171: 		fi
  172: 		;;
  173: 	i486)
  174: 		machine=386
  175: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem -m486"
  176: 		if test "${enable_direct_threaded+set}" = "" \
  177: 			-a "${enable_indirect_threaded+set}" = ""
  178: 		then
  179: 			echo "Using direct threaded code on 486"
  180: 			AC_DEFINE(DIRECT_THREADED)
  181: 		fi
  182: 		;;
  183: 	i586|i686)
  184: 		machine=386
  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
  189: 			echo "Using indirect threaded code on Pentium and up"
  190: 			AC_DEFINE(INDIRECT_THREADED)
  191: 		fi
  192: 		;;
  193:         m68k)
  194: 		machine=m68k
  195: 		CFLAGS="$CFLAGS -fomit-frame-pointer"
  196: 		if test "$host_os" = "nextstep3"
  197: 		then
  198: 			LIBOBJS="$LIBOBJS termios.o"
  199: 		fi
  200: 		;;
  201: 	mips*)
  202: 		machine=mips
  203: 		#link text and data segment into the same 256M region!
  204: 		AC_MSG_CHECKING([whether the linker accepts -D])
  205: 		OLDLDFLAGS=$LDFLAGS
  206: 		LDFLAGS="$LDFLAGS -Xlinker -T -Xlinker 10000000 -Xlinker -D -Xlinker 10400000"
  207: 		AC_TRY_LINK(,,ac_link_mips_d=yes,ac_link_mips_d=no)
  208: 		test $ac_link_mips_d = yes||LDFLAGS="$OLDLDFLAGS -Xlinker -T -Xlinker 10000000"
  209: 		AC_MSG_RESULT($ac_link_mips_d)
  210: 		;;
  211: 	alpha*)
  212: 		machine=alpha
  213: 		;;
  214: 	power*)
  215: 		machine=power
  216: 		$srcdir/mkinstalldirs arch/power
  217: 		AC_CHECK_FUNC(_sync_cache_range,true,LIBOBJS="$LIBOBJS ../arch/power/_sync_cache_range.o")
  218: 		;;
  219: 	*)
  220: 		echo "No direct threading support for $host_cpu, using indirect threading."
  221: 		echo "Using a generic machine description."
  222: 		echo "I'll assume that C floats and doubles are represented by IEEE single and"
  223: 		echo "double numbers. If this is not so, SF@ etc. will not work correctly."
  224: 		echo "FLUSH-ICACHE will do nothing, so END-CODE may not work properly!"
  225: 		machine=generic
  226: esac
  227: AC_SUBST(host)
  228: AC_SUBST(ENGINE_FLAGS)
  229: 
  230: case "$host_os" in
  231: 	*win32)
  232: 		EXE=".exe"
  233: 		;;
  234: 	*)
  235: 		EXE=""
  236: 		;;
  237: esac
  238: AC_SUBST(EXE)
  239: 
  240: dnl Now a little support for DOS/DJGCC
  241: AC_SUBST(GFORTH_EXE)
  242: GFORTH_EXE=""
  243: AC_SUBST(GFORTHDITC_EXE)
  244: GFORTHDITC_EXE=""
  245: 
  246: PATHSEP=":"
  247: AC_SUBST(PATHSEP)
  248: AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP')
  249: 
  250: AC_SUBST(FORTHSIZES)
  251: 
  252: dnl copy commands for systems that don't have links
  253: AC_SUBST(LINK_KERNL)
  254: LINK_KERNL=""
  255: 
  256: #if test $host_os=dos
  257: #then
  258: #  echo Configuring for DOS!!!
  259: #  MAKE_EXE="coff2exe gforth"
  260: #  LINK_KERNL='$(CP) kernl32l.fi kernel.fi'
  261: #fi
  262: 
  263: dnl the following macro produces a warning with autoconf-2.1
  264: AC_C_BIGENDIAN
  265: AC_SUBST(KERNEL)
  266: dnl ac_cv_c_bigendian is an undocumented variable of autoconf-2.1
  267: if test $ac_cv_c_bigendian = yes; then
  268:   bytesex=b
  269:   KERNEL="kernl16b.fi kernl16l.fi kernl32b.fi kernl32l.fi kernl64b.fi kernl64l.fi"
  270: else
  271:   bytesex=l
  272:   KERNEL="kernl16l.fi kernl16b.fi kernl32l.fi kernl32b.fi kernl64l.fi kernl64b.fi"
  273: fi
  274: 
  275: dnl Checks for programs.
  276: AC_PROG_LN_S
  277: dnl AM_PROG_INSTALL #performed by AM_INIT_AUTOMAKE
  278: 
  279: dnl Checks for library functions
  280: dnl This check is just for making later checks link with libm.
  281: dnl using sin here is no good idea since it is built-into gcc and typechecked
  282: AC_CHECK_LIB(m,asin)
  283: AC_CHECK_LIB(dl,dlopen)
  284: if test "$host_os" != "nextstep3"
  285: then
  286: 	AC_FUNC_MEMCMP
  287: fi
  288: AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
  289: AC_CHECK_FUNCS(dlopen sys_siglist)
  290: AC_DECL_SYS_SIGLIST
  291: AC_CHECK_FUNC(getopt_long,true,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
  292: AC_CHECK_FUNCS(rint expm1 log1p)
  293: AC_REPLACE_FUNCS(ecvt)
  294: dnl No check for select, because our replacement is no good under
  295: dnl anything but DOS
  296: AC_CHECK_HEADERS(sys/mman.h)
  297: AC_CHECK_FUNCS(mmap sysconf getpagesize)
  298: AM_PATH_LISPDIR
  299: 
  300: kernel_fi=kernl${wordsize}${bytesex}.fi
  301: AC_SUBST(kernel_fi)
  302: 
  303: AC_SUBST(machine)
  304: dnl AC_LINK_FILES(arch/$machine,arch/machine) #no longer needed
  305: AC_OUTPUT([
  306: Makefile
  307: Makedist
  308: gforthmi
  309: engine/Makefile
  310: doc/version.texi ],
  311: echo timestamp > stamp-h
  312: chmod +x gforthmi
  313: test -d kernel||mkdir kernel)
  314: 

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