File:  [gforth] / gforth / configure.in
Revision 1.219: download - view: text, annotated - select for diffs
Sun Apr 20 15:33:47 2008 UTC (11 years, 6 months ago) by anton
Branches: MAIN
CVS tags: HEAD
added support for building with included libltdl
  missing: building with installed libltdl
           including ltdl in the distributed files

    1: dnl Process this file with autoconf to produce a configure script.
    2: 
    3: #Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007 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 3
   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, see http://www.gnu.org/licenses/.
   19: 
   20: 
   21: dnl We use some automake macros here,
   22: dnl but don't use automake for creating Makefile.in
   23: AC_INIT([gforth],[0.6.9-20080405],[https://savannah.gnu.org/bugs/?func=addbug&group=gforth])
   24: AC_PREREQ(2.54)
   25: #snapshots have numbers major.minor.release-YYYYMMDD
   26: #note that lexicographic ordering must be heeded.
   27: #I.e., 0.4.1-YYYYMMDD must not exist before 0.4.1!
   28: UPDATED="February 23, 2008"
   29: AC_SUBST(UPDATED)
   30: AC_CONFIG_HEADERS(engine/config.h)
   31: 
   32: #ltdl stuff:
   33: AC_CONFIG_MACRO_DIR([libltdl/m4])
   34: LT_CONFIG_LTDL_DIR([libltdl])
   35: LT_INIT([dlopen])
   36: LTDL_INIT([subproject],[convenience])
   37: AC_CONFIG_AUX_DIR([libltdl/config])
   38: 
   39: echo check for ltdl features
   40: # check for ltdl features we need
   41: # The lt_dladvise_init symbol was added with libtool-2.2
   42: if test "x$with_included_ltdl" != "xyes"; then
   43:   save_CFLAGS="$CFLAGS"
   44:   save_LDFLAGS="$LDFLAGS"
   45:   CFLAGS="$CFLAGS $LTDLINCL"
   46:   LDFLAGS="$LDFLAGS $LIBLTDL"
   47:   AC_CHECK_LIB([ltdl], [lt_dladvise_init],
   48: 		[],
   49: 	[AC_MSG_ERROR([libltdl-2.2 or later needed; configure with --with-included-ltdl])])
   50:   LDFLAGS="$save_LDFLAGS"
   51:   CFLAGS="$save_CFLAGS"
   52: fi
   53: 
   54: #how to link with libltdl
   55: if test "x$with_included_ltdl" = "xyes"; then
   56:   #hard-code it (hopefully portable); the official way is to use automake :-(
   57:   LTDL_LDLIBS='-L $(top_builddir)/libltdl/.libs -lltdlc'
   58: else
   59:   LTDL_LDLIBS='$(LIBLTDL)'
   60: fi
   61: AC_SUBST(LTDL_LDLIBS)
   62: 
   63: #suppress the "-g -O2" default
   64: test "$CFLAGS" || CFLAGS=-O2
   65: 
   66: AC_ARG_ENABLE(force-cdiv,
   67: 	AC_HELP_STRING([--enable-force-cdiv],
   68: 		       [  Use the native C division - symmetric - instead of
   69: 		          floored division (default disabled).]),
   70: 	,enable_force_cdiv=no)
   71: test "$enable_force_cdiv" = "no"||
   72:   AC_DEFINE(FORCE_CDIV,,[Define if you want to use explicit symmetric division for better performance])
   73: 
   74: AC_SUBST(PROFEXES)
   75: AC_SUBST(PROFOBJS)
   76: AC_ARG_ENABLE(prof,
   77: 	AC_HELP_STRING([--enable-prof],
   78: 			[ Build gforth-prof, which outputs frequently occuring
   79:                           sequences of primitives.]),
   80: 	,enable_prof=no)
   81: if test "$enable_prof" != "no"; then
   82:   PROFEXES='gforth-prof$(OPT)$(EXE)'; PROFOBJS='engine-prof$(OPT).o main-prof$(OPT).o profile$(OPT).o'
   83: fi
   84: 
   85: AC_ARG_WITH(debug,
   86: [  --with-debug		  specifies option -g to compile with debug info
   87:   --without-debug	  omits the -g switch and creates smaller images on
   88: 			  machines where "strip" has problems with gcc style
   89: 			  debugging informations.],
   90: if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)
   91: 
   92: GCC_LD="\$(GCC)"
   93: EC_MODE="false"
   94: EC=""
   95: engine2='engine2$(OPT).o'
   96: engine_fast2='engine-fast2$(OPT).o'
   97: no_dynamic=""
   98: image_i=""
   99: signals_o="io.o signals.o"
  100: 
  101: AC_ARG_WITH(ec,
  102: 	AC_HELP_STRING([--with-ec=<arch>],
  103: 			[  Build gforth for systems without OS.]),
  104: [if test "$withval" = "no"; then
  105:   echo "defining hosted system"
  106: else
  107:   echo "defining standalone system (${withval})"
  108:   AC_DEFINE(STANDALONE,,[Define if you want a Gforth without OS])
  109:   EC_MODE="true"
  110:   EC="-ec"
  111:   engine2=""
  112:   engine_fast2=""
  113:   no_dynamic="-DNO_DYNAMIC"
  114:   image_i="image.i"
  115:   if test "$withval" != "yes"; then
  116:     signals_o="io-${withval}.o"
  117:   else
  118:     signals_o="io.o"
  119:   fi
  120:   GCC_PATH=$(which $CC)
  121:   LIB_PATH=${GCC_PATH%/*/*}
  122:   GCC_LD="\$(LD)"
  123:   platform=${withval}
  124: fi])
  125: 
  126: #variables mentioned in INSTALL
  127: AC_ARG_VAR(CC, [The C compiler (must support GNU C 2.x).])
  128: AC_ARG_VAR(FORTHSIZES, [Gforth command line options for the default stack and dictionary sizes (see INSTALL).])
  129: AC_ARG_VAR(STACK_CACHE_REGS, [number of registers in the maximum stack cache state for gforth-fast and gforth-native (default platform-dependent).])
  130: AC_ARG_VAR(STACK_CACHE_DEFAULT_FAST, [number of registers in the default stack cache state for gforth-fast and gforth-native (default 1).])
  131: AC_ARG_VAR(GCC_PR15242_WORKAROUND, [Force the enabling (1) or disabling (0) of a workaround for a gcc-3.x performance bug (default unset: use workaround for gcc-3.x)])
  132: 
  133: AC_ARG_VAR(ac_cv_sizeof_char_p, [sizeof(char *)])
  134: AC_ARG_VAR(ac_cv_sizeof_void_p, [sizeof(void *)])
  135: AC_ARG_VAR(ac_cv_sizeof_char, [sizeof(char)])
  136: AC_ARG_VAR(ac_cv_sizeof_short, [sizeof(short)])
  137: AC_ARG_VAR(ac_cv_sizeof_int, [sizeof(int)])
  138: AC_ARG_VAR(ac_cv_sizeof_long, [sizeof(long)])
  139: AC_ARG_VAR(ac_cv_sizeof_long_long, [sizeof(long long)])
  140: AC_ARG_VAR(ac_cv_sizeof_intptr_t, [sizeof(intptr_t)])
  141: AC_ARG_VAR(ac_cv_c_bigendian, [Is the target big-endian ("yes" or "no")?])
  142: AC_ARG_VAR(no_dynamic_default, [run gforth with --dynamic (0) or --no-dynamic (1) by default])
  143: AC_ARG_VAR(condbranch_opt, [enable (1) or disable (0) using two dispatches for conditional branches])
  144: AC_ARG_VAR(skipcode, [assembly code for skipping 16 bytes of code])
  145: AC_ARG_VAR(asmcomment, [assembler comment start string])
  146: AC_ARG_VAR(arm_cacheflush, [file containing ARM cacheflush function (without .c)])
  147: 
  148: #set up feature test macros, so the tests get them right:
  149: # turn on all POSIX, SUSv3, and GNU features if available
  150: AC_GNU_SOURCE
  151: dnl AC_DEFINE_UNQUOTED([_GNU_SOURCE],1,[feature test macro])
  152: 
  153: dnl Don't define _POSIX_SOURCE etc. because some OSs (in particular
  154: dnl MacOSX) disable some features then (MacOSX checks for _POSIX_SOURCE,
  155: dnl but not for _XOPEN_SOURCE)
  156: dnl AC_DEFINE_UNQUOTED([_POSIX_SOURCE],1,[feature test macro])
  157: dnl AC_DEFINE_UNQUOTED([_POSIX_C_SOURCE],199506L,[feature test macro])
  158: dnl AC_DEFINE_UNQUOTED([_XOPEN_SOURCE],600,[feature test macro])
  159: # turn on large file support with 64-bit off_t where available
  160: AC_SYS_LARGEFILE
  161: dnl AC_DEFINE_UNQUOTED([_LARGEFILE_SOURCE],1,[feature test macro])
  162: dnl AC_DEFINE_UNQUOTED([_FILE_OFFSET_BITS],64,[feature test macro])
  163: 
  164: #currently we force direct threading this way.  Eventually we should
  165: #setup in the arch and engine files right
  166: 
  167: AC_PROG_CC
  168: 
  169: test "$GCC" = "yes" || AC_MSG_ERROR(Gforth uses GNU C extensions and requires GCC 2.0 or higher)
  170: 
  171: AC_MSG_CHECKING([whether to use two dispatches per conditional branch])
  172: test x$condbranch_opt = x && 
  173: if ($CC -v 2>&1 |grep -q 'gcc version 3'); then
  174:    condbranch_opt=0
  175: else
  176:    condbranch_opt=1
  177: fi
  178: AC_MSG_RESULT($condbranch_opt)
  179: AC_SUBST(condbranch_opt)
  180: 
  181: AC_SUBST(CC)
  182: AC_SUBST(GCC_LD)
  183: AC_SUBST(DEBUGFLAG)
  184: AC_SUBST(EC)
  185: AC_SUBST(EC_MODE)
  186: AC_SUBST(engine2)
  187: AC_SUBST(engine_fast2)
  188: AC_SUBST(no_dynamic)
  189: AC_SUBST(image_i)
  190: AC_SUBST(signals_o)
  191: 
  192: #this is used to disable some (not generally essential) part of the
  193: #Makefile that some makes don't grok.  It would be better to test for
  194: #this specific Makefile feature than the make version.
  195: AC_MSG_CHECKING(make type)
  196: make_type=`make -n -v 2>&1|grep 'ake'|sed 's/ake .*/ake/'`
  197: GNUMAKE='#'
  198: test "$make_type" = "GNU Make" && GNUMAKE=''
  199: AC_MSG_RESULT($make_type)
  200: AC_SUBST(GNUMAKE)
  201: 
  202: AC_MSG_CHECKING([whether the linker accepts -export-dynamic])
  203: OLDLDFLAGS=$LDFLAGS
  204: LDFLAGS="$LDFLAGS -export-dynamic"
  205: dnl AC_TRY_LINK gives false positive on rs6000-ibm-aix4.2.1.0
  206: dnl AC_TRY_LINK(,,ac_export_dynamic=yes,ac_export_dynamic=no)
  207: AC_TRY_RUN(main(){exit(0);},ac_export_dynamic=yes,ac_export_dynamic=no,ac_export_dynamic=no)
  208: test $ac_export_dynamic = yes|| LDFLAGS=$OLDLDFLAGS
  209: AC_MSG_RESULT($ac_export_dynamic)
  210: 
  211: #terminology is a bit unusual here: The host is the system on which
  212: #gforth will run; the system on which configure will run is the `build'
  213: AC_CANONICAL_HOST
  214: case "$host_cpu" in
  215: 	arm*)
  216: 		machine=arm
  217: 		CFLAGS="$CFLAGS -fomit-frame-pointer"
  218: 		if test x$platform = xnxt; then
  219: 		   CFLAGS="$CFLAGS -mthumb -mthumb-interwork"
  220: 		fi
  221: 		if test -z $arm_cacheflush; then
  222: 		   case "$host_os" in
  223: 		     *linux*)
  224: 			arm_cacheflush=arch/arm/cacheflush-linux 
  225: 			;;
  226: 		     *)   
  227: 			no_dynamic_default=1
  228: 			arm_cacheflush=arch/arm/cacheflush0
  229: 			AC_MSG_WARN([No I-cache flush code known, disabling dynamic native code generation])
  230: 			;;
  231:                    esac
  232: 		fi
  233:                 AC_LIBSOURCES([../arch/arm/cacheflush0, dnl
  234: 			       ../arch/arm/cacheflush-linux])
  235:                 AC_LIBOBJ(../$arm_cacheflush)
  236:                 #longer skipcodes lead to problems on ARM, and it uses
  237:                 #only 4-byte alignment anyway
  238: 		test "$skipcode" || skipcode="nop"
  239: 		;;
  240: 	hppa*)
  241: 		machine=hppa
  242: 		$srcdir/mkinstalldirs arch/hppa
  243: 		AC_LIBOBJ(../arch/hppa/cache)
  244: 		#-N needed for --dynamic <M4U3b.3790$9d.317@news.cpqcorp.net>
  245: 		LDFLAGS="$LDFLAGS -Xlinker -N"
  246: 		LIBS="$LIBS -L/lib/pa1.1/"
  247: 		;;
  248: 	sparc*)
  249: 		machine=sparc
  250: 		;;
  251: 	i386)
  252: 		machine=386
  253: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr"
  254: 		;;
  255: 	i486)
  256: 		machine=386
  257: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -m486"
  258: 		;;
  259: 	i*86)
  260: 		machine=386
  261: 		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr"
  262: 		CFLAGS_1="$CFLAGS"
  263: 		CFLAGS="$CFLAGS -march=pentium"
  264: 		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
  265: 		;;
  266: 	x86_64)
  267: 		case $CC
  268: 		in
  269: 		    *-m32*)
  270: 		    	machine=386
  271: 			CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr"
  272: 			CFLAGS_1="$CFLAGS"
  273: 			CFLAGS="$CFLAGS -march=athlon64"
  274: 			;;
  275: 		    *)
  276: 		    	machine=amd64
  277: 			;;
  278: 		esac
  279: 		;;
  280: 	ia64*)
  281: 		machine=ia64
  282: 		AC_LIBOBJ(../arch/ia64/flush_icache_block)
  283: 		test "$skipcode" || skipcode="nop.i 0"
  284: 		#".skip 16" passes the test below,
  285: 		# but gives an assembler error in engine
  286: 		;;
  287:         m68k)
  288: 		machine=m68k
  289: 		CFLAGS="$CFLAGS -fomit-frame-pointer"
  290: 		if test "$host_os" = "nextstep3"
  291: 		then
  292: 			AC_LIBOBJ(termios)
  293: 		fi
  294: 		;;
  295: 	mips*)
  296: 		machine=mips
  297: 		#dynamic native code has the following problems on MIPS:
  298: 		#
  299: 		#1) J/JAL seems relocatable, but is are only
  300: 		#relocatable within a 256MB-segment.  While we try to
  301: 		#get the linker to arrange this, there is no guarantee
  302: 		#that this will succeed (and if the user uses a lot of
  303: 		#memory, it is likely to fail).
  304: 		#
  305: 		#2) The way we generate dynamic native code may
  306: 		#violate MIPS architectural restrictions (in
  307: 		#particular, the delay slots of LW, MFLO, etc.)
  308: 		#
  309: 		#Therefore we disable dynamic native code by default:
  310: 		if test -z $no_dynamic_default; then
  311: 		    no_dynamic_default=1
  312: 		    AC_MSG_WARN([Disabling default dynamic native code generation (relocation and delay slot issues)])
  313: 		fi
  314: 		;;
  315: 	alpha*)
  316: 		machine=alpha
  317: 		#full IEEE FP support for more uniformity across platforms:
  318: 		CFLAGS="$CFLAGS -mieee"
  319: 		;;
  320: 	power*|rs6000)
  321: 		machine=power
  322: 		$srcdir/mkinstalldirs arch/power
  323: 		AC_CHECK_FUNC(_sync_cache_range,[true],[AC_LIBOBJ(../arch/power/_sync_cache_range)])
  324: 		#long long is broken on (at least) gcc-2.95.* for PPC
  325: 		test x$ac_cv_sizeof_long_long = x && 
  326: 		($CC -v 2>&1 |grep -q 'gcc version 2.95') &&
  327: 		ac_cv_sizeof_long_long=0
  328:                 #The only architecture with enough callee-saved registers
  329:                 test x$STACK_CACHE_REGS = x && STACK_CACHE_REGS=3
  330:                 #or use 2, hardly slower at run-time and starts up faster
  331: 		;;
  332: 	*)
  333: 		AC_MSG_WARN([Using a generic machine description])
  334: 		AC_MSG_WARN([Assuming C floats and doubles are IEEE floats and doubles (for SF@ DF@ SF! DF!)])
  335: 		AC_MSG_WARN([FLUSH-ICACHE will do nothing, so END-CODE may not work properly!])
  336: 		machine=generic
  337: 		#I-cache flushing would be needed for dynamic code generation
  338: 		if test -z $no_dynamic_default; then
  339: 		    no_dynamic_default=1
  340: 		    AC_MSG_WARN([No I-cache flush code known, disabling dynamic native code generation])
  341: 		fi
  342: esac
  343: AC_SUBST(host)
  344: 
  345: MAKEINC=""
  346: 
  347: echo "Check for arch/$machine/$platform/gforth.ld ($EC_MODE)"
  348: if test x$EC_MODE = xtrue
  349: then
  350: 	echo "Check for arch/$machine/$platform/gforth.ld"
  351: 	if test -f arch/$machine/$platform/gforth.ld
  352: 	then
  353: 		LDFLAGS="-T ../arch/$machine/$platform/gforth.ld -Map \$@.map -cref --gc-sections $LDFLAGS"
  354: 		if test x$platform = xnxt; then
  355: 			LIBS="$LIB_PATH/lib/gcc/arm-elf/$($CC --version | grep GCC | cut -d' ' -f3)/interwork/libgcc.a $LIB_PATH/arm-elf/lib/interwork/libc.a $LIBS"
  356: 		fi
  357: 	fi
  358: 	if test -f arch/$machine/$platform/make.inc
  359: 	then
  360: 		MAKEINC="include ../arch/$machine/$platform/make.inc"
  361: 	fi
  362: fi
  363: AC_SUBST(MAKEINC)
  364: 
  365: AC_ARG_VAR(STACK_CACHE_REGS, [number of registers in the maximum stack cache state for gforth-fast and gforth-native (default platform-dependent).])
  366: 
  367: test x$STACK_CACHE_REGS = x && STACK_CACHE_REGS=1
  368: AC_DEFINE_UNQUOTED(STACK_CACHE_REGS, $STACK_CACHE_REGS,
  369: 		   [number of registers in the maximum stack cache state for gforth-fast and gforth-native])
  370: test x$STACK_CACHE_DEFAULT_FAST = x && STACK_CACHE_DEFAULT_FAST=1
  371: AC_DEFINE_UNQUOTED(STACK_CACHE_DEFAULT_FAST, $STACK_CACHE_DEFAULT_FAST,
  372: 		   [number of registers in the default stack cache state for gforth-fast and gforth-native])
  373: 
  374: test x$GCC_PR15242_WORKAROUND = x ||
  375: AC_DEFINE_UNQUOTED(GCC_PR15242_WORKAROUND, $GCC_PR15242_WORKAROUND,
  376:                    [force (1) or forbid (0) use of a workaround for a gcc performance bug])
  377: 
  378: dnl the following macro produces a warning with autoconf-2.1
  379: AC_CHECK_SIZEOF(char *)
  380: case "$ac_cv_sizeof_char_p" in
  381:   2)
  382:     wordsize=16
  383:     ;;
  384:   4)
  385:     wordsize=32
  386:     ;;
  387:   8)
  388:     wordsize=64
  389:     ;;
  390: esac
  391: 
  392: AC_CHECK_SIZEOF(void *)
  393: case "$ac_cv_sizeof_void_p" in
  394:   2)
  395:     vwordsize=16
  396:     ;;
  397:   4)
  398:     vwordsize=32
  399:     ;;
  400:   8)
  401:     vwordsize=64
  402:     ;;
  403: esac
  404: 
  405: AC_CHECK_SIZEOF(char)
  406: AC_CHECK_SIZEOF(short)
  407: AC_CHECK_SIZEOF(int)
  408: AC_CHECK_SIZEOF(long)
  409: AC_CHECK_SIZEOF(long long)
  410: AC_CHECK_SIZEOF(intptr_t)
  411: AC_CHECK_SIZEOF(int128_t)
  412: AC_CHECK_SIZEOF(uint128_t)
  413: 
  414: AC_MSG_CHECKING([for a C type for cells])
  415: ac_cv_int_type_cell=none
  416: case "$ac_cv_sizeof_char_p" in
  417:   $ac_cv_sizeof_int)
  418:     ac_cv_int_type_cell=int
  419:     ;;
  420:   $ac_cv_sizeof_short)
  421:     ac_cv_int_type_cell=short
  422:     ;;
  423:   $ac_cv_sizeof_char)
  424:     ac_cv_int_type_cell=char
  425:     ;;
  426:   $ac_cv_sizeof_long)
  427:     ac_cv_int_type_cell=long
  428:     ;;
  429:   $ac_cv_sizeof_long_long)
  430:     ac_cv_int_type_cell="long long"
  431:     ;;
  432:   $ac_cv_sizeof_intptr_t)
  433:     ac_cv_int_type_cell="intptr_t"
  434:     ;;
  435: esac
  436: AC_MSG_RESULT($ac_cv_int_type_cell)
  437: AC_DEFINE_UNQUOTED(CELL_TYPE,$ac_cv_int_type_cell,[an integer type that is as long as a pointer])
  438: 
  439: AC_MSG_CHECKING([for a C type for wydes])
  440: ac_cv_wyde_type_cell=none
  441: case 2 in
  442:   $ac_cv_sizeof_int)
  443:     ac_cv_wyde_type_cell=int
  444:     ;;
  445:   $ac_cv_sizeof_short)
  446:     ac_cv_wyde_type_cell=short
  447:     ;;
  448:   $ac_cv_sizeof_char)
  449:     ac_cv_wyde_type_cell=char
  450:     ;;
  451:   $ac_cv_sizeof_long)
  452:     ac_cv_wyde_type_cell=long
  453:     ;;
  454:   $ac_cv_sizeof_long_long)
  455:     ac_cv_wyde_type_cell="long long"
  456:     ;;
  457:   $ac_cv_sizeof_intptr_t)
  458:     ac_cv_wyde_type_cell="intptr_t"
  459:     ;;
  460: esac
  461: AC_MSG_RESULT($ac_cv_wyde_type_cell)
  462: AC_DEFINE_UNQUOTED(WYDE_TYPE,$ac_cv_wyde_type_cell,[an integer type that is 2 bytes long])
  463: 
  464: AC_MSG_CHECKING([for a C type for tetrabytes])
  465: ac_cv_tetrabyte_type_cell=none
  466: case 4 in
  467:   $ac_cv_sizeof_int)
  468:     ac_cv_tetrabyte_type_cell=int
  469:     ;;
  470:   $ac_cv_sizeof_short)
  471:     ac_cv_tetrabyte_type_cell=short
  472:     ;;
  473:   $ac_cv_sizeof_char)
  474:     ac_cv_tetrabyte_type_cell=char
  475:     ;;
  476:   $ac_cv_sizeof_long)
  477:     ac_cv_tetrabyte_type_cell=long
  478:     ;;
  479:   $ac_cv_sizeof_long_long)
  480:     ac_cv_tetrabyte_type_cell="long long"
  481:     ;;
  482:   $ac_cv_sizeof_intptr_t)
  483:     ac_cv_tetrabyte_type_cell="intptr_t"
  484:     ;;
  485: esac
  486: AC_MSG_RESULT($ac_cv_tetrabyte_type_cell)
  487: AC_DEFINE_UNQUOTED(TETRABYTE_TYPE,$ac_cv_tetrabyte_type_cell,[an integer type that is 4 bytes long])
  488: 
  489: AC_MSG_CHECKING([for a C type for double-cells])
  490: ac_cv_int_type_double_cell=none
  491: case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
  492:   $ac_cv_sizeof_short)
  493:     ac_cv_int_type_double_cell=short
  494:     ;;
  495:   $ac_cv_sizeof_int)
  496:     ac_cv_int_type_double_cell=int
  497:     ;;
  498:   $ac_cv_sizeof_long)
  499:     ac_cv_int_type_double_cell=long
  500:     ;;
  501:   $ac_cv_sizeof_long_long)
  502:     ac_cv_int_type_double_cell="long long"
  503:     ;;
  504:   $ac_cv_sizeof_intptr_t)
  505:     ac_cv_int_type_double_cell="intptr_t"
  506:     ;;
  507:   $ac_cv_sizeof_int128_t)
  508:     ac_cv_int_type_double_cell="int128_t"
  509:     ;;
  510: esac
  511: AC_MSG_RESULT($ac_cv_int_type_double_cell)
  512: 
  513: AC_MSG_CHECKING([for a C type for unsigned double-cells])
  514: ac_cv_int_type_double_ucell=none
  515: case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
  516:   $ac_cv_sizeof_short)
  517:     ac_cv_int_type_double_ucell="unsigned short"
  518:     ;;
  519:   $ac_cv_sizeof_int)
  520:     ac_cv_int_type_double_ucell="unsigned int"
  521:     ;;
  522:   $ac_cv_sizeof_long)
  523:     ac_cv_int_type_double_ucell="unsigned long"
  524:     ;;
  525:   $ac_cv_sizeof_long_long)
  526:     ac_cv_int_type_double_ucell="unsigned long long"
  527:     ;;
  528:   $ac_cv_sizeof_intptr_t)
  529:     ac_cv_int_type_double_ucell="unsigned intptr_t"
  530:     ;;
  531:   $ac_cv_sizeof_uint128_t)
  532:     ac_cv_int_type_double_ucell="uint128_t"
  533:     ;;
  534: esac
  535: AC_MSG_RESULT($ac_cv_int_type_double_ucell)
  536: 
  537: if test "$ac_cv_int_type_double_cell" != none && \
  538:    test "$ac_cv_int_type_double_ucell" != none
  539: then
  540: 	AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell,[an integer type that is twice as long as a pointer])
  541: 	AC_DEFINE_UNQUOTED(DOUBLE_UCELL_TYPE,$ac_cv_int_type_double_ucell,[an unsigned integer type that is twice as long as a pointer])
  542:         OPTS=-ll
  543: else
  544:         if test "$ac_cv_sizeof_char_p" = 8; then
  545:            OPTS="-ll -noll"
  546:         else
  547:            OPTS=-noll
  548:         fi
  549: fi
  550: 
  551: if grep -q FORCE_REG arch/$machine/machine.h; then
  552:    OPTS=`for i in $OPTS; do echo -n "$i-reg "; done`$OPTS
  553: fi
  554: AC_SUBST(OPTS)
  555: 
  556: AC_TYPE_OFF_T
  557: AC_CHECK_SIZEOF(off_t)
  558: test $ac_cv_sizeof_off_t -gt $ac_cv_sizeof_char_p
  559: ac_small_off_t=$?
  560: AC_DEFINE_UNQUOTED(SMALL_OFF_T,$ac_small_off_t,[1 if off_t fits in a Cell])
  561: 
  562: ENGINE_FLAGS=
  563: AC_SUBST(ENGINE_FLAGS)
  564: 
  565: # Try if GCC understands -fno-gcse
  566: 
  567: AC_MSG_CHECKING([if $CC understands -fno-gcse])
  568: CFLAGS_1="$CFLAGS"
  569: CFLAGS="$CFLAGS -fno-gcse"
  570: AC_TRY_COMPILE(,,ac_nogcse=yes;ENGINE_FLAGS="$ENGINE_FLAGS -fno-gcse",ac_nogcse=no)
  571: CFLAGS="$CFLAGS_1"
  572: AC_MSG_RESULT($ac_nogcse)
  573: 
  574: # Try if GCC understands -fno-strict-aliasing
  575: AC_MSG_CHECKING([if $CC understands -fno-strict-aliasing])
  576: CFLAGS_1="$CFLAGS"
  577: CFLAGS="$CFLAGS -fno-strict-aliasing"
  578: AC_TRY_COMPILE(,,ac_nostrictaliasing=yes;ENGINE_FLAGS="$ENGINE_FLAGS -fno-strict-aliasing",ac_nostrictaliasing=no)
  579: CFLAGS="$CFLAGS_1"
  580: AC_MSG_RESULT($ac_nostrictaliasing)
  581: 
  582: # Try if GCC understands -fno-crossjumping
  583: AC_MSG_CHECKING([if $CC understands -fno-crossjumping])
  584: CFLAGS_1="$CFLAGS"
  585: CFLAGS="$CFLAGS -fno-crossjumping"
  586: AC_TRY_COMPILE(,,ac_nocrossjumping=yes;ENGINE_FLAGS="$ENGINE_FLAGS -fno-crossjumping",ac_nocrossjumping=no)
  587: CFLAGS="$CFLAGS_1"
  588: AC_MSG_RESULT($ac_nocrossjumping)
  589: 
  590: # Try if GCC understands -fno-reorder-blocks
  591: AC_MSG_CHECKING([if $CC understands -fno-reorder-blocks])
  592: CFLAGS_1="$CFLAGS"
  593: CFLAGS="$CFLAGS -fno-reorder-blocks"
  594: AC_TRY_COMPILE(,,ac_noreorder_blocks=yes;ENGINE_FLAGS="$ENGINE_FLAGS -fno-reorder-blocks",ac_noreorder_blocks=no)
  595: CFLAGS="$CFLAGS_1"
  596: AC_MSG_RESULT($ac_noreorder_blocks)
  597: 
  598: # Try if GCC understands -falign-labels=1
  599: AC_MSG_CHECKING([if $CC understands -falign-labels=1])
  600: CFLAGS_1="$CFLAGS"
  601: CFLAGS="$CFLAGS -falign-labels=1"
  602: AC_TRY_COMPILE(,,ac_align_labels=yes;ENGINE_FLAGS="$ENGINE_FLAGS -falign-labels=1",ac_align_labels=no)
  603: CFLAGS="$CFLAGS_1"
  604: AC_MSG_RESULT($ac_align_labels)
  605: 
  606: # Try if GCC understands -falign-loops=1
  607: AC_MSG_CHECKING([if $CC understands -falign-loops=1])
  608: CFLAGS_1="$CFLAGS"
  609: CFLAGS="$CFLAGS -falign-loops=1"
  610: AC_TRY_COMPILE(,,ac_align_loops=yes;ENGINE_FLAGS="$ENGINE_FLAGS -falign-loops=1",ac_align_loops=no)
  611: CFLAGS="$CFLAGS_1"
  612: AC_MSG_RESULT($ac_align_loops)
  613: 
  614: # Try if GCC understands -falign-jumps=1
  615: AC_MSG_CHECKING([if $CC understands -falign-jumps=1])
  616: CFLAGS_1="$CFLAGS"
  617: CFLAGS="$CFLAGS -falign-jumps=1"
  618: AC_TRY_COMPILE(,,ac_align_jumps=yes;ENGINE_FLAGS="$ENGINE_FLAGS -falign-jumps=1",ac_align_jumps=no)
  619: CFLAGS="$CFLAGS_1"
  620: AC_MSG_RESULT($ac_align_jumps)
  621: 
  622: # Try if GCC understands __attribute__((unused))
  623: AC_MSG_CHECKING([how to suppress 'unused variable' warnings])
  624: AC_TRY_COMPILE(,[int __attribute__((unused)) foo;], MAYBE_UNUSED='__attribute__((unused))',)
  625: AC_DEFINE_UNQUOTED(MAYBE_UNUSED,$MAYBE_UNUSED,[attribute for possibly unused variables])
  626: AC_MSG_RESULT($MAYBE_UNUSED)
  627: 
  628: #try if m4 understands -s
  629: AC_MSG_CHECKING([how to invoke m4])
  630: if m4 -s /dev/null >/dev/null 2>&1; then
  631:  M4="m4 -s"
  632: else
  633:  M4=m4
  634: fi
  635: AC_SUBST(M4)
  636: AC_DEFINE_UNQUOTED(M4,"$M4",[How to invoke m4])
  637: AC_MSG_RESULT($M4)
  638: 
  639: # Find installed Gforth
  640: AC_MSG_CHECKING([for gforth])
  641: GFORTH="`cd / && which gforth 2>/dev/null`"
  642: if test -z "$GFORTH"; then
  643:   PREFORTH='echo "You need to configure with a gforth in \$PATH to build this part" && false'
  644: else
  645:   PREFORTH="$GFORTH -i `cd / && gforth --debug -e bye 2>&1 |grep "Opened image file: "|sed 's/Opened image file: //'`" ;
  646: fi
  647: AC_SUBST(PREFORTH)
  648: AC_DEFINE_UNQUOTED(PREFORTH,"$PREFORTH",[How to invoke the pre-installed gforth])
  649: AC_MSG_RESULT($PREFORTH)
  650: 
  651: #echo "machine='$machine'"
  652: 
  653: dnl AC_CHECK_PROG(asm_fs,asm.fs,arch/$machine/asm.fs,,$srcdir/arch/$machine)
  654: AC_CHECK_FILE($srcdir/arch/$machine/asm.fs,[asm_fs=arch/$machine/asm.fs],)
  655: AC_SUBST(asm_fs)
  656: 
  657: dnl AC_CHECK_PROG(disasm_fs,disasm.fs,arch/$machine/disasm.fs,,$srcdir/arch/$machine)
  658: AC_CHECK_FILE($srcdir/arch/$machine/disasm.fs,[disasm_fs=arch/$machine/disasm.fs],)
  659: AC_SUBST(disasm_fs)
  660: 
  661: AC_PATH_PROG(INSTALL_INFO,install-info,[echo '>>>>Please make info dir entry:'],$PATH:/sbin:/usr/sbin:/usr/local/sbin)
  662: 
  663: case "$host_os" in
  664: 	*win32*)
  665: 		# !!!FIXME!!! problems with cygwin and ';' as path separator
  666: 		DIRSEP="\\\\"
  667: 		PATHSEP=";"
  668: 		#we want the builtins of command.com/cmd.exe and its
  669: 		# handling of .com files.
  670: 		#$COMSPEC contains the name of the Windows shell;
  671: 		# the ./ is there, because the bash does not recognize
  672: 		# absolute DOS filenames
  673: 		DEFAULTSYSTEMPREFIX="./$COMSPEC /c "
  674: 		;;
  675: 	*darwin*)
  676: 		#Darwin uses some funny preprocessor by default; eliminate it:
  677: 		AC_MSG_NOTICE([using -no-cpp-precomp on Darwin])
  678: 		CFLAGS="$CFLAGS -no-cpp-precomp"
  679: 		DIRSEP="/"
  680: 		PATHSEP=":"
  681: 		DEFAULTSYSTEMPREFIX=""
  682: 		;;
  683: 	*)
  684: 		DIRSEP="/"
  685: 		PATHSEP=":"
  686: 		DEFAULTSYSTEMPREFIX=""
  687: 		;;
  688: esac
  689: AC_SUBST(DIRSEP)
  690: AC_DEFINE_UNQUOTED(DIRSEP,'$DIRSEP',[a directory separator character])
  691: AC_SUBST(PATHSEP)
  692: AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP',[a path separator character])
  693: AC_SUBST(DEFAULTSYSTEMPREFIX)
  694: AC_DEFINE_UNQUOTED(DEFAULTSYSTEMPREFIX,"$DEFAULTSYSTEMPREFIX",[default for environment variable GFORTHSYSTEMPREFIX])
  695: 
  696: #work around SELinux brain damage (from Andrew Haley <12t8f3jakb74g2c@news.supernews.com>)
  697: #This magic incantation  seems to be completely undocumented.
  698: AC_CHECK_PROG([MASSAGE_EXE],[chcon],[chcon -t unconfined_execmem_exec_t],[true])
  699: 
  700: dnl Now a little support for DOS/DJGCC
  701: AC_SUBST(GFORTH_EXE)
  702: GFORTH_EXE="true"
  703: AC_SUBST(GFORTHFAST_EXE)
  704: GFORTHFAST_EXE="true"
  705: AC_SUBST(GFORTHITC_EXE)
  706: GFORTHITC_EXE="true"
  707: AC_SUBST(GFORTHDITC_EXE)
  708: GFORTHDITC_EXE="true"
  709: 
  710: AC_SUBST(FORTHSIZES)
  711: 
  712: dnl if test "$PEEPHOLE" = "yes"
  713: dnl then
  714: dnl    PEEPHOLEFLAG="true"
  715: dnl    AC_DEFINE(HAS_PEEPHOLE,,[Define if you want to use peephole optimization])
  716: dnl else
  717: dnl    PEEPHOLEFLAG="false"
  718: dnl fi
  719: PEEPHOLEFLAG="true"
  720: AC_SUBST(PEEPHOLEFLAG)
  721: 
  722: dnl copy commands for systems that don't have links
  723: AC_SUBST(LINK_KERNL)
  724: LINK_KERNL=""
  725: 
  726: #if test $host_os=dos
  727: #then
  728: #  echo Configuring for DOS!!!
  729: #  MAKE_EXE="coff2exe gforth"
  730: #  LINK_KERNL='$(CP) kernl32l.fi kernel.fi'
  731: #fi
  732: 
  733: dnl the following macro produces a warning with autoconf-2.1
  734: AC_C_BIGENDIAN
  735: AC_SUBST(KERNEL)
  736: dnl ac_cv_c_bigendian is an undocumented variable of autoconf-2.1
  737: if test $ac_cv_c_bigendian = yes; then
  738:   bytesex=b
  739:   KERNEL="kernl16b.fi kernl16l.fi kernl32b.fi kernl32l.fi kernl64b.fi kernl64l.fi"
  740: else
  741:   bytesex=l
  742:   KERNEL="kernl16l.fi kernl16b.fi kernl32l.fi kernl32b.fi kernl64l.fi kernl64b.fi"
  743: fi
  744: 
  745: #check how to do asm(".skip 16")
  746: #echo "CFLAGS=$CFLAGS"
  747: #echo "ac_link=$ac_link"
  748: AC_MSG_CHECKING([if and how we can waste code space])
  749: if test -z "$skipcode"; then
  750:     skipcode=no
  751:     CFLAGS_1="$CFLAGS"
  752:     CFLAGS="$CFLAGS $ENGINE_FLAGS"
  753:     for i in ".skip 16" ".block 16" ".org .+16" ".=.+16" ".space 16"
  754:     do
  755: 	AC_TRY_RUN(
  756: [int foo(int,int,int);
  757: main()
  758: {
  759:   exit(foo(0,0,0)!=16);
  760: }
  761: int foo(int x, int y, int z)
  762: {
  763:   static void *labels[]={&&label1, &&label2};
  764:   if (x) {
  765:     y++; /* workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12108 */
  766:   label1:
  767:     asm("$i"); /* or ".space 16" or somesuch */
  768:   label2: ;
  769:   }
  770:   {
  771:   if (y) goto *labels[z]; /* workaround for gcc PR12108 */
  772:   return labels[1]-labels[0];
  773:   }
  774: }]
  775: 	,skipcode=$i; break
  776: 	,,)
  777:     done
  778:     CFLAGS=$CFLAGS_1
  779: fi
  780: AC_MSG_RESULT($skipcode)
  781: if test "$skipcode" = no
  782: then 
  783:     if test -z $no_dynamic_default; then
  784: 	no_dynamic_default=1
  785: 	AC_MSG_WARN(Disabling default dynamic native code generation)
  786:     fi
  787:     AC_DEFINE_UNQUOTED(SKIP16,((void)0),statement for skipping 16 bytes)
  788: else
  789:     AC_DEFINE_UNQUOTED(SKIP16,asm("$skipcode"),statement for skipping 16 bytes)
  790: fi
  791: 
  792: AC_MSG_CHECKING([if and how we can do comments in asm statements])
  793: #the point here is to get asm statements that look different to
  794: #gcc's "optimizer"
  795: if test -z "$asmcomment"; then
  796:     asmcomment=no
  797:     CFLAGS_1="$CFLAGS"
  798:     CFLAGS="$CFLAGS $ENGINE_FLAGS"
  799:     for i in '"# "' '"! "' '"; "'; do
  800: 	AC_TRY_COMPILE(,[asm($i"fluffystunk");],asmcomment=$i; break,)
  801:     done
  802:     CFLAGS=$CFLAGS_1
  803: fi
  804: AC_MSG_RESULT($asmcomment)
  805: if test "$asmcomment" != no
  806: then 
  807:     AC_DEFINE_UNQUOTED(ASMCOMMENT,$asmcomment,[assembler comment start string])
  808: fi
  809: 
  810: test "$no_dynamic_default" || no_dynamic_default=0
  811: AC_DEFINE_UNQUOTED(NO_DYNAMIC_DEFAULT,$no_dynamic_default,default value for no_dynamic)
  812: 
  813: dnl Checks for programs.
  814: AC_PROG_LN_S
  815: AC_PROG_INSTALL
  816: AC_CHECK_PROGS(TEXI2DVI,texi2dvi4a2ps texi2dvi)
  817: 
  818: dnl MacOS X has a libtool that does something else
  819: AC_CHECK_PROGS(GNU_LIBTOOL,glibtool libtool)
  820: 
  821: dnl Checks for library functions
  822: dnl This check is just for making later checks link with libm.
  823: dnl using sin here is no good idea since it is built-into gcc and typechecked
  824: AC_CHECK_LIB(m,asin)
  825: AC_CHECK_LIB(dl,dlopen)
  826: dnl check for libffi 2.x
  827: AC_CHECK_LIB(ffi,ffi_call)
  828: if test $ac_cv_lib_ffi_ffi_call = yes
  829: then
  830: LIBFFIFLAG="true"
  831: FFCALLFLAG="false"
  832: OLDCALLFLAG="false"
  833: AC_DEFINE(HAS_LIBFFI,,[define this if you want to use the ffcall interface with libffi 2.0])
  834: else
  835: dnl check for ffcall libraries
  836: dnl unfortunately, these four calls are separated out into a library each.
  837: AC_CHECK_LIB(avcall,__builtin_avcall)
  838: AC_CHECK_LIB(callback,__vacall_r)
  839: AC_CHECK_LIB(vacall,vacall)
  840: AC_CHECK_LIB(trampoline,alloc_trampoline)
  841: LIBFFIFLAG="false"
  842: FFCALLFLAG="false"
  843: OLDCALLFLAG="true"
  844: test $ac_cv_lib_avcall___builtin_avcall = yes && FFCALLFLAG="true" && OLDCALLFLAG="false" && AC_DEFINE(HAS_FFCALL,,[define this if you want to use the ffcall libraries])
  845: test $ac_cv_lib_avcall___builtin_avcall = no && AC_DEFINE(HAS_OLDCALL,,[define this if you want to use the old call libraries])
  846: fi
  847: AC_SUBST(LIBFFIFLAG)
  848: AC_SUBST(FFCALLFLAG)
  849: AC_SUBST(OLDCALLFLAG)
  850: if test "$host_os" != "nextstep3"
  851: then
  852: 	AC_FUNC_MEMCMP
  853: fi
  854: AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
  855: AC_FUNC_FSEEKO
  856: AC_CHECK_FUNCS(ftello dlopen sys_siglist getrusage nanosleep)
  857: AC_CHECK_TYPES(stack_t,,,[#include <signal.h>])
  858: AC_DECL_SYS_SIGLIST
  859: AC_CHECK_FUNC(getopt_long,[true],[AC_LIBOBJ(getopt) AC_LIBOBJ(getopt1)])
  860: AC_CHECK_FUNCS(expm1 log1p)
  861: AC_REPLACE_FUNCS(rint ecvt)
  862: dnl No check for select, because our replacement is no good under
  863: dnl anything but DOS
  864: AC_CHECK_HEADERS(sys/mman.h fnmatch.h)
  865: AC_FUNC_FNMATCH
  866: test $ac_cv_func_fnmatch_works = yes || AC_LIBOBJ(fnmatch)
  867: AC_CHECK_FUNCS(mmap sysconf getpagesize)
  868: AM_PATH_LISPDIR
  869: 
  870: kernel_fi=kernl${vwordsize}${bytesex}.fi
  871: include_fi=kernl${wordsize}${bytesex}${EC}.fi
  872: AC_SUBST(kernel_fi)
  873: AC_SUBST(include_fi)
  874: 
  875: #this breaks bindists
  876: #dnl replace srource directory by absolute value
  877: #if test $srcdir = "."; then srcdir=`pwd` 
  878: #fi
  879: 
  880: AC_SUBST(machine)
  881: AC_CONFIG_FILES([
  882: Makefile
  883: Makedist
  884: gforthmi
  885: vmgen
  886: machpc.fs
  887: envos.fs
  888: engine/Makefile
  889: engine/libcc.h
  890: doc/version.texi
  891: build-ec ])
  892: AC_CONFIG_COMMANDS([stamp-h],[[echo timestamp > stamp-h
  893: chmod +x gforthmi
  894: chmod +x vmgen
  895: chmod +x build-ec
  896: test -d kernel||mkdir kernel
  897: $srcdir/mkinstalldirs include/gforth/$PACKAGE_VERSION
  898: ln -sf ../../../engine/config.h ../../../engine/libcc.h include/gforth/$PACKAGE_VERSION]],[[PACKAGE_VERSION=$PACKAGE_VERSION]])
  899: AC_OUTPUT
  900: 

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