File:  [gforth] / gforth / configure.in
Revision 1.91: download - view: text, annotated - select for diffs
Mon Dec 23 22:14:05 2002 UTC (16 years, 9 months ago) by anton
Branches: MAIN
CVS tags: HEAD
the skipping code for engine2 is now checked with configure

    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-20020901)
   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: UPDATED="1 September 2002"
   30: AC_SUBST(UPDATED)
   31: AM_CONFIG_HEADER(engine/config.h)
   32: #AM_CYGWIN32
   33: 
   34: AC_ARG_ENABLE(force-reg,
   35: [  --enable-force-reg	  Use explicit register declarations if they appear in
   36: 			  the machine.h file. This can cause a good speedup,
   37: 			  but also incorrect code with some gcc versions on
   38: 			  some processors (default disabled).],
   39: AC_DEFINE(FORCE_REG,,[Define if you want to use explicit register declarations for better performance or for more convenient CODE words (does not work with all GCC versions on all machines)]))
   40: 
   41: AC_ARG_WITH(debug,
   42: [  --with-debug     specifies option -g to compile with debug info (default)
   43:   --without-debug  omits the -g switch and creates smaller images on
   44:                    machines where "strip" has problems with gcc style
   45:                    debugging informations.],
   46: if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)
   47: 
   48: PEEPHOLE="yes"
   49: AC_ARG_WITH(peephole,
   50: [  --with-peephole	Enable peephole optimization (default)
   51:   --without-peephole	disables peephole optimization. Creates smaller,
   52: 			but slower images.],
   53: PEEPHOLE="$withval")
   54: 
   55: #currently we force direct threading this way.  Eventually we should
   56: #setup in the arch and engine files right
   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,[an integer type that is as long as a pointer])
  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: 	AC_LIBOBJ(dblsub)
  143: 	AC_DEFINE(BUGGY_LONG_LONG,,[define this if there is no working DOUBLE_CELL_TYPE on your machine])
  144: else
  145:   AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell,[an integer type that is twice as long as a pointer])
  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: 		AC_LIBOBJ(../arch/hppa/cache)
  165: 		LDFLAGS="$LDFLAGS -Xlinker -N"
  166: 		LIBS="$LIBS -L/lib/pa1.1/"
  167: 		;;
  168: 	sparc*)
  169: 		machine=sparc
  170: 		;;
  171: 	i386)
  172: 		machine=386
  173: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
  174: 		;;
  175: 	i486)
  176: 		machine=386
  177: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem -m486"
  178: 		;;
  179: 	i*86)
  180: 		machine=386
  181: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
  182: 		CFLAGS_1="$CFLAGS"
  183: 		CFLAGS="$CFLAGS -march=pentium"
  184: 		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
  185: 		;;
  186: 	ia64*)
  187: 		machine=ia64
  188: 		;;
  189:         m68k)
  190: 		machine=m68k
  191: 		CFLAGS="$CFLAGS -fomit-frame-pointer"
  192: 		if test "$host_os" = "nextstep3"
  193: 		then
  194: 			AC_LIBOBJ(termios)
  195: 		fi
  196: 		;;
  197: 	mips*)
  198: 		machine=mips
  199: 		#link text and data segment into the same 256M region!
  200: 		AC_MSG_CHECKING([whether the linker accepts -T])
  201: 		OLDLDFLAGS=$LDFLAGS
  202: 		LDFLAGS="$LDFLAGS -Xlinker -T -Xlinker 10000000"
  203: 		AC_TRY_LINK(,,ac_link_mips_t=yes,ac_link_mips_t=no)
  204: 		test $ac_link_mips_t = yes||LDFLAGS=$OLDLDFLAGS
  205: 		AC_MSG_RESULT($ac_link_mips_t)
  206: 		fixme #dynamically generated code should be in the same 256MB
  207: 		# region as the text segment; no indirect threading necessary
  208: 		test $ac_link_mips_t = yes||(echo cannot link text and data into same 256M region, using indirect threading; AC_DEFINE(INDIRECT_THREADED,,[Define if you want to force an indirect threaded code implementation]))
  209: 		AC_MSG_CHECKING([whether the linker accepts -D])
  210: 		OLDLDFLAGS=$LDFLAGS
  211: 		LDFLAGS="$LDFLAGS -Xlinker -D -Xlinker 10400000"
  212: 		AC_TRY_LINK(,,ac_link_mips_d=yes,ac_link_mips_d=no)
  213: 		test $ac_link_mips_d = yes||LDFLAGS=$OLDLDFLAGS
  214: 		AC_MSG_RESULT($ac_link_mips_d)
  215: 		;;
  216: 	alpha*)
  217: 		machine=alpha
  218: 		#full IEEE FP support for more uniformity across platforms:
  219: 		CFLAGS="$CFLAGS -mieee"
  220: 		;;
  221: 	power*|rs6000)
  222: 		machine=power
  223: 		$srcdir/mkinstalldirs arch/power
  224: 		AC_CHECK_FUNC(_sync_cache_range,true,AC_LIBOBJ(../arch/power/_sync_cache_range))
  225: 		;;
  226: 	*)
  227: 		echo "Using a generic machine description."
  228: 		echo "I'll assume that C floats and doubles are represented by IEEE single and"
  229: 		echo "double numbers. If this is not so, SF@ etc. will not work correctly."
  230: 		echo "FLUSH-ICACHE will do nothing, so END-CODE may not work properly!"
  231: 		machine=generic
  232: esac
  233: AC_SUBST(host)
  234: AC_SUBST(ENGINE_FLAGS)
  235: 
  236: # Try if GCC understands -fno-cross-jump
  237: 
  238: CFLAGS_1="$CFLAGS"
  239: CFLAGS="$CFLAGS -fno-cross-jump"
  240: AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1")
  241: 
  242: AC_CHECK_PROG(asm_fs,asm.fs,arch/$machine/asm.fs,,$srcdir/arch/$machine)
  243: AC_SUBST(asm_fs)
  244: 
  245: AC_CHECK_PROG(disasm_fs,disasm.fs,arch/$machine/disasm.fs,,$srcdir/arch/$machine)
  246: AC_SUBST(disasm_fs)
  247: 
  248: case "$host_os" in
  249: 	*win32)
  250: 		EXE=".exe"
  251: 		DIRSEP="\\"
  252: 		;;
  253: 	*)
  254: 		EXE=""
  255: 		DIRSEP="/"
  256: 		;;
  257: esac
  258: AC_SUBST(EXE)
  259: AC_SUBST(DIRSEP)
  260: AC_DEFINE_UNQUOTED(DIRSEP,'$DIRSEP',[a directory separator character])
  261: 
  262: dnl Now a little support for DOS/DJGCC
  263: AC_SUBST(GFORTH_EXE)
  264: GFORTH_EXE=""
  265: AC_SUBST(GFORTHFAST_EXE)
  266: GFORTHFAST_EXE=""
  267: AC_SUBST(GFORTHITC_EXE)
  268: GFORTHITC_EXE=""
  269: AC_SUBST(GFORTHDITC_EXE)
  270: GFORTHDITC_EXE=""
  271: 
  272: PATHSEP=":"
  273: AC_SUBST(PATHSEP)
  274: AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP',[a path separator character])
  275: 
  276: AC_SUBST(FORTHSIZES)
  277: 
  278: if test "$PEEPHOLE" = "yes"
  279: then
  280:    PEEPHOLEFLAG="true"
  281:    AC_DEFINE(HAS_PEEPHOLE,,[Define if you want to use peephole optimization])
  282: else
  283:    PEEPHOLEFLAG="false"
  284: fi
  285: AC_SUBST(PEEPHOLEFLAG)
  286: 
  287: dnl copy commands for systems that don't have links
  288: AC_SUBST(LINK_KERNL)
  289: LINK_KERNL=""
  290: 
  291: #if test $host_os=dos
  292: #then
  293: #  echo Configuring for DOS!!!
  294: #  MAKE_EXE="coff2exe gforth"
  295: #  LINK_KERNL='$(CP) kernl32l.fi kernel.fi'
  296: #fi
  297: 
  298: dnl the following macro produces a warning with autoconf-2.1
  299: AC_C_BIGENDIAN
  300: AC_SUBST(KERNEL)
  301: dnl ac_cv_c_bigendian is an undocumented variable of autoconf-2.1
  302: if test $ac_cv_c_bigendian = yes; then
  303:   bytesex=b
  304:   KERNEL="kernl16b.fi kernl16l.fi kernl32b.fi kernl32l.fi kernl64b.fi kernl64l.fi"
  305: else
  306:   bytesex=l
  307:   KERNEL="kernl16l.fi kernl16b.fi kernl32l.fi kernl32b.fi kernl64l.fi kernl64b.fi"
  308: fi
  309: 
  310: #check how to do asm(".skip 16")
  311: for i in ".skip 16" ".block 16" ".org .+16" ".=.+16" ".space 16"
  312: do
  313: 	AC_MSG_CHECKING([whether asm("$i") skips 16 bytes])
  314: 	AC_TRY_RUN(
  315: int foo(int);
  316: main()
  317: {
  318:   exit(foo(0)!=16);
  319: }
  320: int foo(int x)
  321: {
  322:   if (x) {
  323:   label1:
  324:     asm("$i");
  325:   label2:
  326:   }
  327:   return (&&label2)-(&&label1);
  328: }
  329: 	,AC_MSG_RESULT(yes)
  330:          AC_DEFINE_UNQUOTED(SKIP16,asm("$i"),statement for skipping 16 bytes)
  331:          break
  332: 	,AC_MSG_RESULT(no),)
  333: 	
  334: done	
  335: 
  336: 
  337: dnl Checks for programs.
  338: AC_PROG_LN_S
  339: dnl AM_PROG_INSTALL #performed by AM_INIT_AUTOMAKE
  340: 
  341: dnl Checks for library functions
  342: dnl This check is just for making later checks link with libm.
  343: dnl using sin here is no good idea since it is built-into gcc and typechecked
  344: AC_CHECK_LIB(m,asin)
  345: AC_CHECK_LIB(dl,dlopen)
  346: if test "$host_os" != "nextstep3"
  347: then
  348: 	AC_FUNC_MEMCMP
  349: fi
  350: AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
  351: AC_CHECK_FUNCS(dlopen sys_siglist getrusage)
  352: AC_DECL_SYS_SIGLIST
  353: AC_CHECK_FUNC(getopt_long,true,AC_LIBOBJ(getopt.$ac_objext getopt1))
  354: AC_CHECK_FUNCS(expm1 log1p)
  355: AC_REPLACE_FUNCS(rint ecvt)
  356: dnl No check for select, because our replacement is no good under
  357: dnl anything but DOS
  358: AC_CHECK_HEADERS(sys/mman.h fnmatch.h)
  359: AC_FUNC_FNMATCH
  360: test $ac_cv_func_fnmatch_works = yes || AC_LIBOBJ(fnmatch)
  361: AC_CHECK_FUNCS(mmap sysconf getpagesize)
  362: AM_PATH_LISPDIR
  363: 
  364: kernel_fi=kernl${wordsize}${bytesex}.fi
  365: AC_SUBST(kernel_fi)
  366: 
  367: #this breaks bindists
  368: #dnl replace srource directory by absolute value
  369: #if test $srcdir = "."; then srcdir=`pwd` 
  370: #fi
  371: 
  372: AC_SUBST(machine)
  373: dnl AC_LINK_FILES(arch/$machine,arch/machine) #no longer needed
  374: AC_OUTPUT([
  375: Makefile
  376: Makedist
  377: gforthmi
  378: vmgen
  379: machpc.fs
  380: engine/Makefile
  381: doc/version.texi ],
  382: echo timestamp > stamp-h
  383: chmod +x gforthmi
  384: chmod +x vmgen
  385: test -d kernel||mkdir kernel)
  386: 

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