File:  [gforth] / gforth / configure.in
Revision 1.82: download - view: text, annotated - select for diffs
Wed Mar 13 16:59:12 2002 UTC (17 years, 8 months ago) by anton
Branches: MAIN
CVS tags: HEAD
Better discussion of cross-installation in INSTALL.
Force direct threading everywhere (indirect threading currentldoes not work).
make target "gforths" builds and copies all engines.

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

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