diff options
Diffstat (limited to 'src/configure.ac')
-rw-r--r-- | src/configure.ac | 4314 |
1 files changed, 4314 insertions, 0 deletions
diff --git a/src/configure.ac b/src/configure.ac new file mode 100644 index 0000000000..f6a44691f0 --- /dev/null +++ b/src/configure.ac @@ -0,0 +1,4314 @@ +dnl configure.ac: autoconf script for Vim + +dnl Process this file with autoconf 2.12 or 2.13 to produce "configure". +dnl Should also work with autoconf 2.54 and later. + +AC_INIT(vim.h) +AC_CONFIG_HEADER(auto/config.h:config.h.in) + +dnl Being able to run configure means the system is Unix (compatible). +AC_DEFINE(UNIX) +AC_PROG_MAKE_SET + +dnl Checks for programs. +AC_PROG_CC dnl required by almost everything +AC_PROG_CPP dnl required by header file checks +AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP +AC_PROG_FGREP dnl finds working grep -F +AC_ISC_POSIX dnl required by AC_C_CROSS +AC_PROG_AWK dnl required for "make html" in ../doc + +dnl Don't strip if we don't have it +AC_CHECK_PROG(STRIP, strip, strip, :) + +dnl Check for extension of executables +AC_EXEEXT + +dnl Check for standard headers. We don't use this in Vim but other stuff +dnl in autoconf needs it, where it uses STDC_HEADERS. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT + +dnl Check for the flag that fails if stuff are missing. + +AC_MSG_CHECKING(--enable-fail-if-missing argument) +AC_ARG_ENABLE(fail_if_missing, + [ --enable-fail-if-missing Fail if dependencies on additional features + specified on the command line are missing.], + [fail_if_missing="yes"], + [fail_if_missing="no"]) +AC_MSG_RESULT($fail_if_missing) + +dnl Set default value for CFLAGS if none is defined or it's empty +if test -z "$CFLAGS"; then + CFLAGS="-O" + test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall" +fi +if test "$GCC" = yes; then + dnl method that should work for nearly all versions + gccversion=`$CC -dumpversion` + if test "x$gccversion" = "x"; then + dnl old method; fall-back for when -dumpversion doesn't work + gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'` + fi + dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki + if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then + echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"' + CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'` + else + if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then + echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"' + CFLAGS="$CFLAGS -fno-strength-reduce" + fi + fi +fi + +dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a +dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on +dnl the version number of the clang in use. +dnl Note that this does not work to get the version of clang 3.1 or 3.2. +AC_MSG_CHECKING(for recent clang version) +CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang.*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'` +if test x"$CLANG_VERSION_STRING" != x"" ; then + CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'` + CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'` + CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'` + CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION` + AC_MSG_RESULT($CLANG_VERSION) + dnl If you find the same issue with versions earlier than 500.2.75, + dnl change the constant 500002075 below appropriately. To get the + dnl integer corresponding to a version number, refer to the + dnl definition of CLANG_VERSION above. + if test "$CLANG_VERSION" -ge 500002075 ; then + CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'` + fi +else + AC_MSG_RESULT(no) +fi + +dnl If configure thinks we are cross compiling, there might be something +dnl wrong with the CC or CFLAGS settings, give a useful warning message +CROSS_COMPILING= +if test "$cross_compiling" = yes; then + AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS]) + CROSS_COMPILING=1 +fi +AC_SUBST(CROSS_COMPILING) + +dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies. +dnl But gcc 3.1 changed the meaning! See near the end. +test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM) + +if test -f ./toolcheck; then + AC_CHECKING(for buggy tools) + sh ./toolcheck 1>&AC_FD_MSG +fi + +OS_EXTRA_SRC=""; OS_EXTRA_OBJ="" + +dnl Check for BeOS, which needs an extra source file +AC_MSG_CHECKING(for BeOS) +case `uname` in + BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o + BEOS=yes; AC_MSG_RESULT(yes);; + *) BEOS=no; AC_MSG_RESULT(no);; +esac + +dnl If QNX is found, assume we don't want to use Xphoton +dnl unless it was specifically asked for (--with-x) +AC_MSG_CHECKING(for QNX) +case `uname` in + QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o + test -z "$with_x" && with_x=no + QNX=yes; AC_MSG_RESULT(yes);; + *) QNX=no; AC_MSG_RESULT(no);; +esac + +dnl Check for Darwin and MacOS X +dnl We do a check for MacOS X in the very beginning because there +dnl are a lot of other things we need to change besides GUI stuff +AC_MSG_CHECKING([for Darwin (Mac OS X)]) +if test "`(uname) 2>/dev/null`" = Darwin; then + AC_MSG_RESULT(yes) + + AC_MSG_CHECKING(--disable-darwin argument) + AC_ARG_ENABLE(darwin, + [ --disable-darwin Disable Darwin (Mac OS X) support.], + , [enable_darwin="yes"]) + if test "$enable_darwin" = "yes"; then + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if Darwin files are there) + if test -f os_macosx.m; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT([no, Darwin support disabled]) + enable_darwin=no + fi + else + AC_MSG_RESULT([yes, Darwin support excluded]) + fi + + AC_MSG_CHECKING(--with-mac-arch argument) + AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both], + MACARCH="$withval"; AC_MSG_RESULT($MACARCH), + MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH)) + + AC_MSG_CHECKING(--with-developer-dir argument) + AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools], + DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR), + AC_MSG_RESULT(not present)) + + if test "x$DEVELOPER_DIR" = "x"; then + AC_PATH_PROG(XCODE_SELECT, xcode-select) + if test "x$XCODE_SELECT" != "x"; then + AC_MSG_CHECKING(for developer dir using xcode-select) + DEVELOPER_DIR=`$XCODE_SELECT -print-path` + AC_MSG_RESULT([$DEVELOPER_DIR]) + else + DEVELOPER_DIR=/Developer + fi + fi + + if test "x$MACARCH" = "xboth"; then + AC_MSG_CHECKING(for 10.4 universal SDK) + dnl There is a terrible inconsistency (but we appear to get away with it): + dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS + dnl doesn't, because "gcc -E" doesn't grok it. That means the configure + dnl tests using the preprocessor are actually done with the wrong header + dnl files. $LDFLAGS is set at the end, because configure uses it together + dnl with $CFLAGS and we can only have one -sysroot argument. + save_cppflags="$CPPFLAGS" + save_cflags="$CFLAGS" + save_ldflags="$LDFLAGS" + CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" + AC_TRY_LINK([ ], [ ], + AC_MSG_RESULT(found, will make universal binary), + + AC_MSG_RESULT(not found) + CFLAGS="$save_cflags" + AC_MSG_CHECKING(if Intel architecture is supported) + CPPFLAGS="$CPPFLAGS -arch i386" + LDFLAGS="$save_ldflags -arch i386" + AC_TRY_LINK([ ], [ ], + AC_MSG_RESULT(yes); MACARCH="intel", + AC_MSG_RESULT(no, using PowerPC) + MACARCH="ppc" + CPPFLAGS="$save_cppflags -arch ppc" + LDFLAGS="$save_ldflags -arch ppc")) + elif test "x$MACARCH" = "xintel"; then + CPPFLAGS="$CPPFLAGS -arch intel" + LDFLAGS="$LDFLAGS -arch intel" + elif test "x$MACARCH" = "xppc"; then + CPPFLAGS="$CPPFLAGS -arch ppc" + LDFLAGS="$LDFLAGS -arch ppc" + fi + + if test "$enable_darwin" = "yes"; then + MACOSX=yes + OS_EXTRA_SRC="os_macosx.m os_mac_conv.c"; + OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o" + dnl TODO: use -arch i386 on Intel machines + dnl Removed -no-cpp-precomp, only for very old compilers. + CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX" + + dnl If Carbon is found, assume we don't want X11 + dnl unless it was specifically asked for (--with-x) + dnl or Motif, Athena or GTK GUI is used. + AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes) + if test "x$CARBON" = "xyes"; then + if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then + with_x=no + fi + fi + fi + + dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double + dnl free. This happens in expand_filename(), because the optimizer swaps + dnl two blocks of code, both using "repl", that can't be swapped. + if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then + CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'` + fi + +else + AC_MSG_RESULT(no) +fi + +dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon +dnl so we need to include it to have access to version macros. +AC_CHECK_HEADERS(AvailabilityMacros.h) + +AC_SUBST(OS_EXTRA_SRC) +AC_SUBST(OS_EXTRA_OBJ) + +dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS. +dnl Only when the directory exists and it wasn't there yet. +dnl For gcc don't do this when it is already in the default search path. +dnl Skip all of this when cross-compiling. +if test "$cross_compiling" = no; then + AC_MSG_CHECKING(--with-local-dir argument) + have_local_include='' + have_local_lib='' + AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries. + --without-local-dir do not search /usr/local for local libraries.], [ + local_dir="$withval" + case "$withval" in + */*) ;; + no) + # avoid adding local dir to LDFLAGS and CPPFLAGS + have_local_include=yes + have_local_lib=yes + ;; + *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;; + esac + AC_MSG_RESULT($local_dir) + ], [ + local_dir=/usr/local + AC_MSG_RESULT(Defaulting to $local_dir) + ]) + if test "$GCC" = yes -a "$local_dir" != no; then + echo 'void f(){}' > conftest.c + dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler) + have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"` + have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"` + rm -f conftest.c conftest.o + fi + if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then + tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"` + if test "$tt" = "$LDFLAGS"; then + LDFLAGS="$LDFLAGS -L${local_dir}/lib" + fi + fi + if test -z "$have_local_include" -a -d "${local_dir}/include"; then + tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"` + if test "$tt" = "$CPPFLAGS"; then + CPPFLAGS="$CPPFLAGS -I${local_dir}/include" + fi + fi +fi + +AC_MSG_CHECKING(--with-vim-name argument) +AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable], + VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME), + VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME)) +AC_SUBST(VIMNAME) +AC_MSG_CHECKING(--with-ex-name argument) +AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable], + EXNAME="$withval"; AC_MSG_RESULT($EXNAME), + EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex)) +AC_SUBST(EXNAME) +AC_MSG_CHECKING(--with-view-name argument) +AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable], + VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME), + VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view)) +AC_SUBST(VIEWNAME) + +AC_MSG_CHECKING(--with-global-runtime argument) +AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'], + AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"), + AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(--with-modified-by argument) +AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version], + AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"), + AC_MSG_RESULT(no)) + +dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix +AC_MSG_CHECKING(if character set is EBCDIC) +AC_TRY_COMPILE([ ], +[ /* TryCompile function for CharSet. + Treat any failure as ASCII for compatibility with existing art. + Use compile-time rather than run-time tests for cross-compiler + tolerance. */ +#if '0'!=240 +make an error "Character set is not EBCDIC" +#endif ], +[ # TryCompile action if true +cf_cv_ebcdic=yes ], +[ # TryCompile action if false +cf_cv_ebcdic=no]) +# end of TryCompile ]) +# end of CacheVal CvEbcdic +AC_MSG_RESULT($cf_cv_ebcdic) +case "$cf_cv_ebcdic" in #(vi + yes) AC_DEFINE(EBCDIC) + line_break='"\\n"' + ;; + *) line_break='"\\012"';; +esac +AC_SUBST(line_break) + +if test "$cf_cv_ebcdic" = "yes"; then +dnl If we have EBCDIC we most likely have z/OS Unix, let's test it! +AC_MSG_CHECKING(for z/OS Unix) +case `uname` in + OS/390) zOSUnix="yes"; + dnl If using cc the environment variable _CC_CCMODE must be + dnl set to "1", so that some compiler extensions are enabled. + dnl If using c89 the environment variable is named _CC_C89MODE. + dnl Note: compile with c89 never tested. + if test "$CC" = "cc"; then + ccm="$_CC_CCMODE" + ccn="CC" + else + if test "$CC" = "c89"; then + ccm="$_CC_C89MODE" + ccn="C89" + else + ccm=1 + fi + fi + if test "$ccm" != "1"; then + echo "" + echo "------------------------------------------" + echo " On z/OS Unix, the environment variable" + echo " _CC_${ccn}MODE must be set to \"1\"!" + echo " Do:" + echo " export _CC_${ccn}MODE=1" + echo " and then call configure again." + echo "------------------------------------------" + exit 1 + fi + # Set CFLAGS for configure process. + # This will be reset later for config.mk. + # Use haltonmsg to force error for missing H files. + CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)"; + LDFLAGS="$LDFLAGS -Wl,EDIT=NO" + AC_MSG_RESULT(yes) + ;; + *) zOSUnix="no"; + AC_MSG_RESULT(no) + ;; +esac +fi + +dnl Set QUOTESED. Needs additional backslashes on zOS +if test "$zOSUnix" = "yes"; then + QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'" +else + QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'" +fi +AC_SUBST(QUOTESED) + + +dnl Link with -lsmack for Smack stuff; if not found +AC_MSG_CHECKING(--disable-smack argument) +AC_ARG_ENABLE(smack, + [ --disable-smack Do not check for Smack support.], + , enable_smack="yes") +if test "$enable_smack" = "yes"; then + AC_MSG_RESULT(no) + AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no") +else + AC_MSG_RESULT(yes) +fi +if test "$enable_smack" = "yes"; then + AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no") +fi +if test "$enable_smack" = "yes"; then + AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h) + AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>], + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); enable_smack="no") +fi +if test "$enable_smack" = "yes"; then + AC_CHECK_LIB(attr, setxattr, + [LIBS="$LIBS -lattr" + found_smack="yes" + AC_DEFINE(HAVE_SMACK)]) +fi + +dnl When smack was found don't search for SELinux +if test "x$found_smack" = "x"; then + dnl Link with -lselinux for SELinux stuff; if not found + AC_MSG_CHECKING(--disable-selinux argument) + AC_ARG_ENABLE(selinux, + [ --disable-selinux Do not check for SELinux support.], + , enable_selinux="yes") + if test "$enable_selinux" = "yes"; then + AC_MSG_RESULT(no) + AC_CHECK_LIB(selinux, is_selinux_enabled, + [LIBS="$LIBS -lselinux" + AC_DEFINE(HAVE_SELINUX)]) + else + AC_MSG_RESULT(yes) + fi +fi + +dnl Check user requested features. + +AC_MSG_CHECKING(--with-features argument) +AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: huge)], + features="$withval"; AC_MSG_RESULT($features), + features="huge"; AC_MSG_RESULT(Defaulting to huge)) + +dovimdiff="" +dogvimdiff="" +case "$features" in + tiny) AC_DEFINE(FEAT_TINY) ;; + small) AC_DEFINE(FEAT_SMALL) ;; + normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff"; + dogvimdiff="installgvimdiff" ;; + big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff"; + dogvimdiff="installgvimdiff" ;; + huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff"; + dogvimdiff="installgvimdiff" ;; + *) AC_MSG_RESULT([Sorry, $features is not supported]) ;; +esac + +AC_SUBST(dovimdiff) +AC_SUBST(dogvimdiff) + +AC_MSG_CHECKING(--with-compiledby argument) +AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message], + compiledby="$withval"; AC_MSG_RESULT($withval), + compiledby=""; AC_MSG_RESULT(no)) +AC_SUBST(compiledby) + +AC_MSG_CHECKING(--disable-xsmp argument) +AC_ARG_ENABLE(xsmp, + [ --disable-xsmp Disable XSMP session management], + , enable_xsmp="yes") + +if test "$enable_xsmp" = "yes"; then + AC_MSG_RESULT(no) + AC_MSG_CHECKING(--disable-xsmp-interact argument) + AC_ARG_ENABLE(xsmp-interact, + [ --disable-xsmp-interact Disable XSMP interaction], + , enable_xsmp_interact="yes") + if test "$enable_xsmp_interact" = "yes"; then + AC_MSG_RESULT(no) + AC_DEFINE(USE_XSMP_INTERACT) + else + AC_MSG_RESULT(yes) + fi +else + AC_MSG_RESULT(yes) +fi + +dnl Check for Lua feature. +AC_MSG_CHECKING(--enable-luainterp argument) +AC_ARG_ENABLE(luainterp, + [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_luainterp="no"]) +AC_MSG_RESULT($enable_luainterp) + +if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Lua with tiny or small features]) + fi + + dnl -- find the lua executable + AC_SUBST(vi_cv_path_lua) + + AC_MSG_CHECKING(--with-lua-prefix argument) + AC_ARG_WITH(lua_prefix, + [ --with-lua-prefix=PFX Prefix where Lua is installed.], + with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix), + with_lua_prefix="";AC_MSG_RESULT(no)) + + if test "X$with_lua_prefix" != "X"; then + vi_cv_path_lua_pfx="$with_lua_prefix" + else + AC_MSG_CHECKING(LUA_PREFIX environment var) + if test "X$LUA_PREFIX" != "X"; then + AC_MSG_RESULT("$LUA_PREFIX") + vi_cv_path_lua_pfx="$LUA_PREFIX" + else + AC_MSG_RESULT([not set, default to /usr]) + vi_cv_path_lua_pfx="/usr" + fi + fi + + AC_MSG_CHECKING(--with-luajit) + AC_ARG_WITH(luajit, + [ --with-luajit Link with LuaJIT instead of Lua.], + [vi_cv_with_luajit="$withval"], + [vi_cv_with_luajit="no"]) + AC_MSG_RESULT($vi_cv_with_luajit) + + LUA_INC= + if test "X$vi_cv_path_lua_pfx" != "X"; then + if test "x$vi_cv_with_luajit" != "xno"; then + dnl -- try to find LuaJIT executable + AC_PATH_PROG(vi_cv_path_luajit, luajit) + if test "X$vi_cv_path_luajit" != "X"; then + dnl -- find LuaJIT version + AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit, + [ vi_cv_version_luajit=`${vi_cv_path_luajit} -v 2>&1 | sed 's/LuaJIT \([[0-9.]]*\)\.[[0-9]]\(-[[a-z0-9]]*\)* .*/\1/'` ]) + AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit, + [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ]) + vi_cv_path_lua="$vi_cv_path_luajit" + vi_cv_version_lua="$vi_cv_version_lua_luajit" + fi + else + dnl -- try to find Lua executable + AC_PATH_PROG(vi_cv_path_plain_lua, lua) + if test "X$vi_cv_path_plain_lua" != "X"; then + dnl -- find Lua version + AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua, + [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ]) + fi + vi_cv_path_lua="$vi_cv_path_plain_lua" + vi_cv_version_lua="$vi_cv_version_plain_lua" + fi + if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then + AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit) + if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then + AC_MSG_RESULT(yes) + LUA_INC=/luajit-$vi_cv_version_luajit + fi + fi + if test "X$LUA_INC" = "X"; then + AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include) + if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua) + if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then + AC_MSG_RESULT(yes) + LUA_INC=/lua$vi_cv_version_lua + else + AC_MSG_RESULT(no) + vi_cv_path_lua_pfx= + fi + fi + fi + fi + + if test "X$vi_cv_path_lua_pfx" != "X"; then + if test "x$vi_cv_with_luajit" != "xno"; then + multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` + if test "X$multiarch" != "X"; then + lib_multiarch="lib/${multiarch}" + else + lib_multiarch="lib" + fi + if test "X$vi_cv_version_lua" = "X"; then + LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit" + else + LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua" + fi + else + if test "X$LUA_INC" != "X"; then + dnl Test alternate location using version + LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua" + else + LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua" + fi + fi + if test "$enable_luainterp" = "dynamic"; then + lua_ok="yes" + else + AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane]) + libs_save=$LIBS + LIBS="$LIBS $LUA_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); lua_ok="yes", + AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="") + LIBS=$libs_save + fi + if test "x$lua_ok" = "xyes"; then + LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}" + LUA_SRC="if_lua.c" + LUA_OBJ="objects/if_lua.o" + LUA_PRO="if_lua.pro" + AC_DEFINE(FEAT_LUA) + fi + if test "$enable_luainterp" = "dynamic"; then + if test "x$vi_cv_with_luajit" != "xno"; then + luajit="jit" + fi + if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then + vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll" + else + if test "x$MACOSX" = "xyes"; then + ext="dylib" + indexes="" + else + ext="so" + indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9" + multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` + if test "X$multiarch" != "X"; then + lib_multiarch="lib/${multiarch}" + fi + fi + dnl Determine the sover for the current version, but fallback to + dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found. + AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx) + for subdir in "${lib_multiarch}" lib64 lib; do + if test -z "$subdir"; then + continue + fi + for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \ + ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do + for i in $indexes ""; do + if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then + sover2="$i" + break 3 + fi + done + done + sover="" + done + if test "X$sover" = "X"; then + AC_MSG_RESULT(no) + lua_ok="no" + vi_cv_dll_name_lua="liblua${luajit}.${ext}" + else + AC_MSG_RESULT(yes) + lua_ok="yes" + vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2" + fi + fi + AC_DEFINE(DYNAMIC_LUA) + LUA_LIBS="" + LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS" + fi + if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \ + test "x$MACOSX" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \ + test "`(uname -m) 2>/dev/null`" = "x86_64"; then + dnl OSX/x64 requires these flags. See http://luajit.org/install.html + LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS" + fi + fi + if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then + AC_MSG_ERROR([could not configure lua]) + fi + AC_SUBST(LUA_SRC) + AC_SUBST(LUA_OBJ) + AC_SUBST(LUA_PRO) + AC_SUBST(LUA_LIBS) + AC_SUBST(LUA_CFLAGS) +fi + + +dnl Check for MzScheme feature. +AC_MSG_CHECKING(--enable-mzschemeinterp argument) +AC_ARG_ENABLE(mzschemeinterp, + [ --enable-mzschemeinterp Include MzScheme interpreter.], , + [enable_mzschemeinterp="no"]) +AC_MSG_RESULT($enable_mzschemeinterp) + +if test "$enable_mzschemeinterp" = "yes"; then + dnl -- find the mzscheme executable + AC_SUBST(vi_cv_path_mzscheme) + + AC_MSG_CHECKING(--with-plthome argument) + AC_ARG_WITH(plthome, + [ --with-plthome=PLTHOME Use PLTHOME.], + with_plthome="$withval"; AC_MSG_RESULT($with_plthome), + with_plthome="";AC_MSG_RESULT("no")) + + if test "X$with_plthome" != "X"; then + vi_cv_path_mzscheme_pfx="$with_plthome" + vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme" + else + AC_MSG_CHECKING(PLTHOME environment var) + if test "X$PLTHOME" != "X"; then + AC_MSG_RESULT("$PLTHOME") + vi_cv_path_mzscheme_pfx="$PLTHOME" + vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme" + else + AC_MSG_RESULT(not set) + dnl -- try to find MzScheme executable + AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme) + + dnl resolve symbolic link, the executable is often elsewhere and there + dnl are no links for the include files. + if test "X$vi_cv_path_mzscheme" != "X"; then + lsout=`ls -l $vi_cv_path_mzscheme` + if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then + vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'` + fi + fi + + if test "X$vi_cv_path_mzscheme" != "X"; then + dnl -- find where MzScheme thinks it was installed + AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx, + dnl different versions of MzScheme differ in command line processing + dnl use universal approach + echo "(display (simplify-path \ + (build-path (call-with-values \ + (lambda () (split-path (find-system-path (quote exec-file)))) \ + (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm + dnl Remove a trailing slash + [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \ + sed -e 's+/$++'` ]) + rm -f mzdirs.scm + fi + fi + fi + + if test "X$vi_cv_path_mzscheme_pfx" != "X"; then + AC_MSG_CHECKING(for racket include directory) + SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_INC" != "X"; then + AC_MSG_RESULT(${SCHEME_INC}) + else + AC_MSG_RESULT(not found) + AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include) + if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt) + if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then + AC_MSG_RESULT(yes) + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket) + if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then + AC_MSG_RESULT(yes) + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/) + if test -f /usr/include/plt/scheme.h; then + AC_MSG_RESULT(yes) + SCHEME_INC=/usr/include/plt + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/) + if test -f /usr/include/racket/scheme.h; then + AC_MSG_RESULT(yes) + SCHEME_INC=/usr/include/racket + else + AC_MSG_RESULT(no) + vi_cv_path_mzscheme_pfx= + fi + fi + fi + fi + fi + fi + fi + + if test "X$vi_cv_path_mzscheme_pfx" != "X"; then + + AC_MSG_CHECKING(for racket lib directory) + SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_LIB" != "X"; then + AC_MSG_RESULT(${SCHEME_LIB}) + else + AC_MSG_RESULT(not found) + fi + + for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do + if test "X$path" != "X"; then + if test "x$MACOSX" = "xyes"; then + MZSCHEME_LIBS="-framework Racket" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libmzscheme3m.a"; then + MZSCHEME_LIBS="${path}/libmzscheme3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.a"; then + MZSCHEME_LIBS="${path}/libracket3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket.a"; then + MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a" + elif test -f "${path}/libmzscheme.a"; then + MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a" + else + dnl Using shared objects + if test -f "${path}/libmzscheme3m.so"; then + MZSCHEME_LIBS="-L${path} -lmzscheme3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.so"; then + MZSCHEME_LIBS="-L${path} -lracket3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket.so"; then + MZSCHEME_LIBS="-L${path} -lracket -lmzgc" + else + dnl try next until last + if test "$path" != "$SCHEME_LIB"; then + continue + fi + MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc" + fi + if test "$GCC" = yes; then + dnl Make Vim remember the path to the library. For when it's not in + dnl $LD_LIBRARY_PATH. + MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}" + elif test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}" + fi + fi + fi + if test "X$MZSCHEME_LIBS" != "X"; then + break + fi + done + + AC_MSG_CHECKING([if racket requires -pthread]) + if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then + AC_MSG_RESULT(yes) + MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread" + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread" + else + AC_MSG_RESULT(no) + fi + + AC_MSG_CHECKING(for racket config directory) + SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'` + if test "X$SCHEME_CONFIGDIR" != "X"; then + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'" + AC_MSG_RESULT(${SCHEME_CONFIGDIR}) + else + AC_MSG_RESULT(not found) + fi + + AC_MSG_CHECKING(for racket collects directory) + SCHEME_COLLECTS=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-collects-dir))) (when (path? p) (let-values (((base _1 _2) (split-path p))) (display base))))'` + if test "X$SCHEME_COLLECTS" = "X"; then + if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/ + else + if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ + else + if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/ + else + if test -d "$vi_cv_path_mzscheme_pfx/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/ + fi + fi + fi + fi + fi + if test "X$SCHEME_COLLECTS" != "X" ; then + AC_MSG_RESULT(${SCHEME_COLLECTS}) + else + AC_MSG_RESULT(not found) + fi + + AC_MSG_CHECKING(for mzscheme_base.c) + if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then + MZSCHEME_EXTRA="mzscheme_base.c" + MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" + MZSCHEME_MOD="++lib scheme/base" + else + if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then + MZSCHEME_EXTRA="mzscheme_base.c" + MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" + MZSCHEME_MOD="++lib scheme/base" + else + if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then + MZSCHEME_EXTRA="mzscheme_base.c" + MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool" + MZSCHEME_MOD="" + fi + fi + fi + if test "X$MZSCHEME_EXTRA" != "X" ; then + dnl need to generate bytecode for MzScheme base + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE" + AC_MSG_RESULT(needed) + else + AC_MSG_RESULT(not needed) + fi + + dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'". + AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"]) + + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \ + -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'" + + dnl Test that we can compile a simple program with these CFLAGS and LIBS. + AC_MSG_CHECKING([if compile and link flags for MzScheme are sane]) + cflags_save=$CFLAGS + libs_save=$LIBS + CFLAGS="$CFLAGS $MZSCHEME_CFLAGS" + LIBS="$LIBS $MZSCHEME_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); mzs_ok=yes, + AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no) + CFLAGS=$cflags_save + LIBS=$libs_save + if test $mzs_ok = yes; then + MZSCHEME_SRC="if_mzsch.c" + MZSCHEME_OBJ="objects/if_mzsch.o" + MZSCHEME_PRO="if_mzsch.pro" + AC_DEFINE(FEAT_MZSCHEME) + else + MZSCHEME_CFLAGS= + MZSCHEME_LIBS= + MZSCHEME_EXTRA= + MZSCHEME_MZC= + fi + fi + AC_SUBST(MZSCHEME_SRC) + AC_SUBST(MZSCHEME_OBJ) + AC_SUBST(MZSCHEME_PRO) + AC_SUBST(MZSCHEME_LIBS) + AC_SUBST(MZSCHEME_CFLAGS) + AC_SUBST(MZSCHEME_EXTRA) + AC_SUBST(MZSCHEME_MZC) +fi + + +AC_MSG_CHECKING(--enable-perlinterp argument) +AC_ARG_ENABLE(perlinterp, + [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], , + [enable_perlinterp="no"]) +AC_MSG_RESULT($enable_perlinterp) +if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Perl with tiny or small features]) + fi + AC_SUBST(vi_cv_path_perl) + AC_PATH_PROG(vi_cv_path_perl, perl) + if test "X$vi_cv_path_perl" != "X"; then + AC_MSG_CHECKING(Perl version) + if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then + eval `$vi_cv_path_perl -V:usethreads` + eval `$vi_cv_path_perl -V:libperl` + if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then + badthreads=no + else + if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then + eval `$vi_cv_path_perl -V:use5005threads` + if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then + badthreads=no + else + badthreads=yes + AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<) + fi + else + badthreads=yes + AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<) + fi + fi + if test $badthreads = no; then + AC_MSG_RESULT(OK) + eval `$vi_cv_path_perl -V:shrpenv` + if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04 + shrpenv="" + fi + vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'` + AC_SUBST(vi_cv_perllib) + vi_cv_perl_extutils=unknown_perl_extutils_path + for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do + xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" + if test -f "$xsubpp_path"; then + vi_cv_perl_xsubpp="$xsubpp_path" + fi + done + AC_SUBST(vi_cv_perl_xsubpp) + dnl Remove "-fno-something", it breaks using cproto. + dnl Remove "-fdebug-prefix-map", it isn't supported by clang. + perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ + -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \ + -e 's/-fdebug-prefix-map[[^ ]]*//g'` + dnl Remove "-lc", it breaks on FreeBSD when using "-pthread". + perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \ + sed -e '/Warning/d' -e '/Note (probably harmless)/d' \ + -e 's/-bE:perl.exp//' -e 's/-lc //'` + dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH + dnl a test in configure may fail because of that. + perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \ + -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'` + + dnl check that compiling a simple program still works with the flags + dnl added for Perl. + AC_MSG_CHECKING([if compile and link flags for Perl are sane]) + cflags_save=$CFLAG |