File:  [gforth] / gforth / configure.in
Revision 1.83: download - view: text, annotated - select for diffs
Fri Mar 22 20:36:25 2002 UTC (17 years, 7 months ago) by anton
Branches: MAIN
CVS tags: HEAD
cleaned up #defines of DIRECT_THREADED and INDIRECT_THREADED
introduced engine gforth-itc (indirect threading, no replication)
fixed bug in indirect threading

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

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