/src/configure.in
https://bitbucket.org/ultra_iter/vim-qt · Autoconf · 3806 lines · 2900 code · 341 blank · 565 comment · 519 complexity · 3055817faa3ce25a05873cf8685f5136 MD5 · raw file
Large files are truncated click here to view the full file
- dnl configure.in: 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_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 If configure thinks we are cross compiling, there might be something
- dnl wrong with the CC or CFLAGS settings, give a useful warning message
- if test "$cross_compiling" = yes; then
- AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
- fi
- 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),
- 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
- CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
- 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; 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
- 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 -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
- have_local_include=`${CC-cc} -no-cpp-precomp -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 likley 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
- CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
- 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 -lselinux for SELinux stuff; if not found
- AC_MSG_CHECKING(--disable-selinux argument)
- AC_ARG_ENABLE(selinux,
- [ --disable-selinux Don't 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
- 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: normal)],
- features="$withval"; AC_MSG_RESULT($features),
- features="normal"; AC_MSG_RESULT(Defaulting to normal))
- 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
- 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
- LUA_INC=
- if test "X$vi_cv_path_lua_pfx" != "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)
- dnl -- try to find Lua executable
- AC_PATH_PROG(vi_cv_path_lua, lua)
- if test "X$vi_cv_path_lua" != "X"; then
- dnl -- find Lua version
- AC_CACHE_CHECK(Lua version, vi_cv_version_lua,
- [ vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
- 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_version_lua" != "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
- 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)
- if test "$enable_luainterp" = "dynamic"; then
- dnl Determine the SONAME for the current version, but fallback to
- dnl liblua${vi_cv_version_lua}.so if no SONAME-versioned file is found.
- for i in 0 1 2 3 4 5 6 7 8 9; do
- if test -f "${vi_cv_path_lua_pfx}/lib/liblua${vi_cv_version_lua}.so.$i"; then
- LUA_SONAME=".$i"
- break
- fi
- done
- AC_DEFINE(DYNAMIC_LUA)
- LUA_LIBS=""
- LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"liblua${vi_cv_version_lua}.so$LUA_SONAME\\\" $LUA_CFLAGS"
- fi
- fi
- if test "$fail_if_missing" = "yes" -a -z "$LUA_SRC"; 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"
- else
- AC_MSG_CHECKING(PLTHOME environment var)
- if test "X$PLTHOME" != "X"; then
- AC_MSG_RESULT("$PLTHOME")
- vi_cv_path_mzscheme_pfx="$PLTHOME"
- 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
- SCHEME_INC=
- if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
- 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
- if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
- if test "x$MACOSX" = "xyes"; then
- MZSCHEME_LIBS="-framework PLT_MzScheme"
- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
- MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
- MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
- MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"
- MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then
- MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then
- MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
- else
- dnl Using shared objects
- if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
- MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
- MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then
- MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m"
- MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then
- MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc"
- else
- MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -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,${vi_cv_path_mzscheme_pfx}/lib"
- elif test "`(uname) 2>/dev/null`" = SunOS &&
- uname -r | grep '^5' >/dev/null; then
- MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
- fi
- fi
- if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
- SCHEME_COLLECTS=lib/plt/
- else
- if test -d $vi_cv_path_mzscheme_pfx/lib/racket/collects; then
- SCHEME_COLLECTS=lib/racket/
- fi
- fi
- if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
- MZSCHEME_EXTRA="mzscheme_base.c"
- else
- if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
- MZSCHEME_EXTRA="mzscheme_base.c"
- fi
- fi
- if test "X$MZSCHEME_EXTRA" != "X" ; then
- dnl need to generate bytecode for MzScheme base
- MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
- MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
- fi
- MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
- -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
- MZSCHEME_SRC="if_mzsch.c"
- MZSCHEME_OBJ="objects/if_mzsch.o"
- MZSCHEME_PRO="if_mzsch.pro"
- AC_DEFINE(FEAT_MZSCHEME)
- 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
- 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)
- dnl Remove "-fno-something", it breaks using cproto.
- perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
- -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
- 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=$CFLAGS
- libs_save=$LIBS
- ldflags_save=$LDFLAGS
- CFLAGS="$CFLAGS $perlcppflags"
- LIBS="$LIBS $perllibs"
- LDFLAGS="$perlldflags $LDFLAGS"
- AC_TRY_LINK(,[ ],
- AC_MSG_RESULT(yes); perl_ok=yes,
- AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
- CFLAGS=$cflags_save
- LIBS=$libs_save
- LDFLAGS=$ldflags_save
- if test $perl_ok = yes; then
- if test "X$perlcppflags" != "X"; then
- dnl remove -pipe and -Wxxx, it confuses cproto
- PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
- fi
- if test "X$perlldflags" != "X"; then
- LDFLAGS="$perlldflags $LDFLAGS"
- fi
- PERL_LIBS=$perllibs
- PERL_SRC="auto/if_perl.c if_perlsfio.c"
- PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
- PERL_PRO="if_perl.pro if_perlsfio.pro"
- AC_DEFINE(FEAT_PERL)
- fi
- fi
- else
- AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
- fi
- fi
- if test "x$MACOSX" = "xyes"; then
- dnl Mac OS X 10.2 or later
- dir=/System/Library/Perl
- darwindir=$dir/darwin
- if test -d $darwindir; then
- PERL=/usr/bin/perl
- else
- dnl Mac OS X 10.3
- dir=/System/Library/Perl/5.8.1
- darwindir=$dir/darwin-thread-multi-2level
- if test -d $darwindir; then
- PERL=/usr/bin/perl
- fi
- fi
- if test -n "$PERL"; then
- PERL_DIR="$dir"
- PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
- PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
- PERL_LIBS="-L$darwindir/CORE -lperl"
- fi
- dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only
- dnl be included if requested by passing --with-mac-arch to
- dnl configure, so strip these flags first (if present)
- PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
- PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
- fi
- if test "$enable_perlinterp" = "dynamic"; then
- if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
- AC_DEFINE(DYNAMIC_PERL)
- PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
- fi
- fi
- if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then
- AC_MSG_ERROR([could not configure perl])
- fi
- fi
- AC_SUBST(shrpenv)
- AC_SUBST(PERL_SRC)
- AC_SUBST(PERL_OBJ)
- AC_SUBST(PERL_PRO)
- AC_SUBST(PERL_CFLAGS)
- AC_SUBST(PERL_LIBS)
- AC_MSG_CHECKING(--enable-pythoninterp argument)
- AC_ARG_ENABLE(pythoninterp,
- [ --enable-pythoninterp[=OPTS] Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
- [enable_pythoninterp="no"])
- AC_MSG_RESULT($enable_pythoninterp)
- if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
- dnl -- find the python executable
- AC_PATH_PROG(vi_cv_path_python, python)
- if test "X$vi_cv_path_python" != "X"; then
- dnl -- get its version number
- AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
- [[vi_cv_var_python_version=`
- ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
- ]])
- dnl -- it must be at least version 1.4
- AC_MSG_CHECKING(Python is 1.4 or better)
- if ${vi_cv_path_python} -c \
- "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
- then
- AC_MSG_RESULT(yep)
- dnl -- find where python thinks it was installed
- AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
- [ vi_cv_path_python_pfx=`
- ${vi_cv_path_python} -c \
- "import sys; print sys.prefix"` ])
- dnl -- and where it thinks it runs
- AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
- [ vi_cv_path_python_epfx=`
- ${vi_cv_path_python} -c \
- "import sys; print sys.exec_prefix"` ])
- dnl -- python's internal library path
- AC_CACHE_VAL(vi_cv_path_pythonpath,
- [ vi_cv_path_pythonpath=`
- unset PYTHONPATH;
- ${vi_cv_path_python} -c \
- "import sys, string; print string.join(sys.path,':')"` ])
- dnl -- where the Python implementation library archives are
- AC_ARG_WITH(python-config-dir,
- [ --with-python-config-dir=PATH Python's config directory],
- [ vi_cv_path_python_conf="${withval}" ] )
- AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
- [
- vi_cv_path_python_conf=
- for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
- for subdir in lib64 lib share; do
- d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
- if test -d "$d" && test -f "$d/config.c"; then
- vi_cv_path_python_conf="$d"
- fi
- done
- done
- ])
- PYTHON_CONFDIR="${vi_cv_path_python_conf}"
- if test "X$PYTHON_CONFDIR" = "X"; then
- AC_MSG_RESULT([can't find it!])
- else
- dnl -- we need to examine Python's config/Makefile too
- dnl see what the interpreter is built from
- AC_CACHE_VAL(vi_cv_path_python_plibs,
- [
- pwd=`pwd`
- tmp_mkf="$pwd/config-PyMake$$"
- cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
- __:
- @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
- @echo "python_LIBS='$(LIBS)'"
- @echo "python_SYSLIBS='$(SYSLIBS)'"
- @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
- @echo "python_INSTSONAME='$(INSTSONAME)'"
- eof
- dnl -- delete the lines from make about Entering/Leaving directory
- eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
- rm -f -- "${tmp_mkf}"
- if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
- "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
- vi_cv_path_python_plibs="-framework Python"
- else
- if test "${vi_cv_var_python_version}" = "1.4"; then
- vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
- else
- vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
- fi
- vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
- dnl remove -ltermcap, it can conflict with an earlier -lncurses
- vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
- fi
- ])
- PYTHON_LIBS="${vi_cv_path_python_plibs}"
- if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
- else
- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
- fi
- PYTHON_SRC="if_python.c"
- dnl For Mac OSX 10.2 config.o is included in the Python library.
- if test "x$MACOSX" = "xyes"; then
- PYTHON_OBJ="objects/if_python.o"
- else
- PYTHON_OBJ="objects/if_python.o objects/py_config.o"
- fi
- if test "${vi_cv_var_python_version}" = "1.4"; then
- PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
- fi
- PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
- dnl On FreeBSD linking with "-pthread" is required to use threads.
- dnl _THREAD_SAFE must be used for compiling then.
- dnl The "-pthread" is added to $LIBS, so that the following check for
- dnl sigaltstack() will look in libc_r (it's there in libc!).
- dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
- dnl will then define target-specific defines, e.g., -D_REENTRANT.
- dnl Don't do this for Mac OSX, -pthread will generate a warning.
- AC_MSG_CHECKING([if -pthread should be used])
- threadsafe_flag=
- thread_lib=
- dnl if test "x$MACOSX" != "xyes"; then
- if test "`(uname) 2>/dev/null`" != Darwin; then
- test "$GCC" = yes && threadsafe_flag="-pthread"
- if test "`(uname) 2>/dev/null`" = FreeBSD; then
- threadsafe_flag="-D_THREAD_SAFE"
- thread_lib="-pthread"
- fi
- fi
- libs_save_old=$LIBS
- if test -n "$threadsafe_flag"; then
- cflags_save=$CFLAGS
- CFLAGS="$CFLAGS $threadsafe_flag"
- LIBS="$LIBS $thread_lib"
- AC_TRY_LINK(,[ ],
- AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
- AC_MSG_RESULT(no); LIBS=$libs_save_old
- )
- CFLAGS=$cflags_save
- else
- AC_MSG_RESULT(no)
- fi
- dnl Check that compiling a simple program still works with the flags
- dnl added for Python.
- AC_MSG_CHECKING([if compile and link flags for Python are sane])
- cflags_save=$CFLAGS
- libs_save=$LIBS
- CFLAGS="$CFLAGS $PYTHON_CFLAGS"
- LIBS="$LIBS $PYTHON_LIBS"
- AC_TRY_LINK(,[ ],
- AC_MSG_RESULT(yes); python_ok=yes,
- AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
- CFLAGS=$cflags_save
- LIBS=$libs_save
- if test $python_ok = yes; then
- AC_DEFINE(FEAT_PYTHON)
- else
- LIBS=$libs_save_old
- PYTHON_SRC=
- PYTHON_OBJ=
- PYTHON_LIBS=
- PYTHON_CFLAGS=
- fi
- fi
- else
- AC_MSG_RESULT(too old)
- fi
- fi
- if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then
- AC_MSG_ERROR([could not configure python])
- fi
- fi
- AC_SUBST(PYTHON_CONFDIR)
- AC_SUBST(PYTHON_LIBS)
- AC_SUBST(PYTHON_GETPATH_CFLAGS)
- AC_SUBST(PYTHON_CFLAGS)
- AC_SUBST(PYTHON_SRC)
- AC_SUBST(PYTHON_OBJ)
- AC_MSG_CHECKING(--enable-python3interp argument)
- AC_ARG_ENABLE(python3interp,
- [ --enable-python3interp[=OPTS] Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
- [enable_python3interp="no"])
- AC_MSG_RESULT($enable_python3interp)
- if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
- dnl -- find the python3 executable
- AC_PATH_PROG(vi_cv_path_python3, python3)
- if test "X$vi_cv_path_python3" != "X"; then
- dnl -- get its version number
- AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
- [[vi_cv_var_python3_version=`
- ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
- ]])
- dnl -- get abiflags for python 3.2 or higher (PEP 3149)
- AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
- [
- vi_cv_var_python3_abiflags=
- if ${vi_cv_path_python3} -c \
- "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)"
- then
- vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \
- "import sys; print(sys.abiflags)"`
- fi ])
- dnl -- find where python3 thinks it was installed
- AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
- [ vi_cv_path_python3_pfx=`
- ${vi_cv_path_python3} -c \
- "import sys; print(sys.prefix)"` ])
- dnl -- and where it thinks it runs
- AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
- [ vi_cv_path_python3_epfx=`
- ${vi_cv_path_python3} -c \
- "import sys; print(sys.exec_prefix)"` ])
- dnl -- python3's internal library path
- AC_CACHE_VAL(vi_cv_path_python3path,
- [ vi_cv_path_python3path=`
- unset PYTHONPATH;
- ${vi_cv_path_python3} -c \
- "import sys, string; print(':'.join(sys.path))"` ])
- dnl -- where the Python implementation library archives are
- AC_ARG_WITH(python3-config-dir,
- [ --with-python3-config-dir=PATH Python's config directory],
- [ vi_cv_path_python3_conf="${withval}" ] )
- AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
- [
- vi_cv_path_python3_conf=
- config_dir="config"
- if test "${vi_cv_var_python3_abiflags}" != ""; then
- config_dir="${config_dir}-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
- fi
- for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
- for subdir in lib64 lib share; do
- d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
- if test -d "$d" && test -f "$d/config.c"; then
- vi_cv_path_python3_conf="$d"
- fi
- done
- done
- ])
- PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
- if test "X$PYTHON3_CONFDIR" = "X"; then
- AC_MSG_RESULT([can't find it!])
- else
- dnl -- we need to examine Python's config/Makefile too
- dnl see what the interpreter is built from
- AC_CACHE_VAL(vi_cv_path_python3_plibs,
- [
- pwd=`pwd`
- tmp_mkf="$pwd/config-PyMake$$"
- cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
- __:
- @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
- @echo "python3_LIBS='$(LIBS)'"
- @echo "python3_SYSLIBS='$(SYSLIBS)'"
- @echo "python3_INSTSONAME='$(INSTSONAME)'"
- eof
- dnl -- delete the lines from make about Entering/Leaving directory
- eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
- rm -f -- "${tmp_mkf}"
- vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
- vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}"
- dnl remove -ltermcap, it can conflict with an earlier -lncurses
- vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
- vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
- ])
- PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
- if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
- PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
- else
- PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
- fi
- PYTHON3_SRC="if_python3.c"
- dnl For Mac OSX 10.2 config.o is included in the Python library.
- if test "x$MACOSX" = "xyes"; then
- PYTHON3_OBJ="objects/if_python3.o"
- else
- PYTHON3_OBJ="objects/if_python3.o objects/py3_config.o"
- fi
- dnl On FreeBSD linking with "-pthread" is required to use threads.
- dnl _THREAD_SAFE must be used for compiling then.
- dnl The "-pthread" is added to $LIBS, so that the following check for
- dnl sigaltstack() will look in libc_r (it's there in libc!).
- dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
- dnl will then define target-specific defines, e.g., -D_REENTRANT.
- dnl Don't do this for Mac OSX, -pthread will generate a warning.
- AC_MSG_CHECKING([if -pthread should be used])
- threadsafe_flag=
- thread_lib=
- dnl if test "x$MACOSX" != "xyes"; then
- if test "`(uname) 2>/dev/null`" != Darwin; then
- test "$GCC" = yes && threadsafe_flag="-pthread"
- if test "`(uname) 2>/dev/null`" = FreeBSD; then
- threadsafe_flag="-D_THREAD_SAFE"
- thread_lib="-pthread"
- fi
- fi
- libs_save_old=$LIBS
- if test -n "$threadsafe_flag"; then
- cflags_save=$CFLAGS
- CFLAGS="$CFLAGS $threadsafe_flag"
- LIBS="$LIBS $thread_lib"
- AC_TRY_LINK(,[ ],
- AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
- AC_MSG_RESULT(no); LIBS=$libs_save_old
- )
- CFLAGS=$cflags_save
- else
- AC_MSG_RESULT(no)
- fi
- dnl check that compiling a simple program still works with the flags
- dnl added for Python.
- AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
- cflags_save=$CFLAGS
- libs_save=$LIBS
- CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
- LIBS="$LIBS $PYTHON3_LIBS"
- AC_TRY_LINK(,[ ],
- AC_MSG_RESULT(yes); python3_ok=yes,
- AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
- CFLAGS=$cflags_save
- LIBS=$libs_save
- if test "$python3_ok" = yes; then
- AC_DEFINE(FEAT_PYTHON3)
- else
- LIBS=$libs_save_old
- PYTHON3_SRC=
- PYTHON3_OBJ=
- PYTHON3_LIBS=
- PYTHON3_CFLAGS=
- fi
- fi
- fi
- fi
- AC_SUBST(PYTHON3_CONFDIR)
- AC_SUBST(PYTHON3_LIBS)
- AC_SUBST(PYTHON3_CFLAGS)
- AC_SUBST(PYTHON3_SRC)
- AC_SUBST(PYTHON3_OBJ)
- dnl if python2.x and python3.x are enabled one can only link in code
- dnl with dlopen(), dlsym(), dlclose()
- if test "$python_ok" = yes && test "$python3_ok" = yes; then
- AC_DEFINE(DYNAMIC_PYTHON)
- AC_DEFINE(DYNAMIC_PYTHON3)
- AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
- cflags_save=$CFLAGS
- CFLAGS="$CFLAGS $PYTHON_CFLAGS"
- ldflags_save=$LDFLAGS
- dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
- LDFLAGS="-ldl $LDFLAGS"
- AC_RUN_IFELSE([
- #include <dlfcn.h>
- /* If this program fails, then RTLD_GLOBAL is needed.
- * RTLD_GLOBAL will be used and then it is not possible to
- * have both python versions enabled in the same vim instance.
- * Only the first pyhton version used will be switched on.
- */
- int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
- {
- int needed = 0;
- void* pylib = dlopen(python_instsoname, RTLD_LAZY);
- if (pylib != 0)
- {
- void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
- void (*init)(void) = dlsym(pylib, "Py_Initialize");
- int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
- void (*final)(void) = dlsym(pylib, "Py_Finalize");
- (*pfx)(prefix);
- (*init)();
- needed = (*simple)("import termios") == -1;
- (*final)();
- dlclose(pylib);
- }
- return !needed;
- }
- int main(int argc, char** argv)
- {
- int not_needed = 0;
- if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}"))
- not_needed = 1;
- return !not_needed;
- }],
- [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
- CFLAGS=$cflags_save
- LDFLAGS=$ldflags_save
- AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
- cflags_save=$CFLAGS
- CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
- ldflags_save=$LDFLAGS
- dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
- LDFLAGS="-ldl $LDFLAGS"
- AC_RUN_IFELSE([
- #include <dlfcn.h>
- #include <wchar.h>
- /* If this program fails, then RTLD_GLOBAL is needed.
- * RTLD_GLOBAL will be used and then it is not possible to
- * have both python versions enabled in the same vim instance.
- * Only the first pyhton version used will be switched on.
- */
- int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
- {
- int needed = 0;
- void* pylib = dlopen(python_instsoname, RTLD_LAZY);
- if (pylib != 0)
- {
- void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
- void (*init)(void) = dlsym(pylib, "Py_Initialize");
- int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
- void (*final)(void) = dlsym(pylib, "Py_Finalize");
- (*pfx)(prefix);
- (*init)();
- needed = (*simple)("import termios") == -1;
- (*final)();
- dlclose(pylib);
- }
- return !needed;
- }
- int main(int argc, char** argv)
- {
- int not_needed = 0;
- if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}"))
- not_needed = 1;
- return !not_needed;
- }],
- [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
- CFLAGS=$cflags_save
- LDFLAGS=$ldflags_save
- PYTHON_SRC="if_python.c"
- PYTHON_OBJ="objects/if_python.o"
- PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
- PYTHON_LIBS=
- PYTHON3_SRC="if_python3.c"
- PYTHON3_OBJ="objects/if_python3.o"
- PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${python3_INSTSONAME}\\\""
- PYTHON3_LIBS=
- elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
- AC_DEFINE(DYNAMIC_PYTHON)
- PYTHON_SRC="if_python.c"
- PYTHON_OBJ="objects/if_python.o"
- PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
- PYTHON_LIBS=
- elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
- AC_DEFINE(DYNAMIC_PYTHON3)
- PYTHON3_SRC="if_python3.c"
- PYTHON3_OBJ="objects/if_python3.o"
- PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${python3_INSTSONAME}\\\""
- PYTHON3_LIBS=
- fi
- AC_MSG_CHECKING(--enable-tclinterp argument)
- AC_ARG_ENABLE(tclinterp,
- [ --enable-tclinterp Include Tcl interpreter.], ,
- [enable_tclinterp="no"])
- AC_MSG_RESULT($enable_tclinterp)
- if test "$enable_tclinterp" = "yes"; then
- dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
- AC_MSG_CHECKING(--with-tclsh argument)
- AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
- tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
- tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
- AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
- AC_SUBST(vi_cv_path_tcl)
- dnl when no specific version specified, also try 8.4, 8.2 and 8.0
- if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
- tclsh_name="tclsh8.4"
- AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
- fi
- if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
- tclsh_name="tclsh8.2"
- AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
- fi
- if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
- tclsh_name="tclsh8.0"
- AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
- fi
- dnl still didn't find it, try without version number
- if test "X$vi_cv_path_tcl" = "X"; then
- tclsh_name="tclsh"
- AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
- fi
- if test "X$vi_cv_path_tcl" != "X"; then
- AC_MSG_CHECKING(Tcl version)
- if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
- tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
- AC_MSG_RESULT($tclver - OK);
- tclloc=`echo 'set l [[info library]];set i [[string last lib $l]];incr i -2;puts [[string range $l 0 $i]]' | $vi_cv_path_tcl -`
- AC_MSG_CHECKING(for location of Tcl include)
- if test "x$MACOSX" != "xyes"; then
- tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver"
- else
- dnl For Mac OS X 10.3, use the OS-provided framework location
- tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
- fi
- TCL_INC=
- for try in $tclinc; do
- if test -f "$try/tcl.h"; then
- AC_MSG_RESULT($try/tcl.h)
- TCL_INC=$try
- break
- fi
- done
- if test -z "$TCL_INC"; then
- AC_MSG_RESULT(<not found>)
- SKIP_TCL=YES
- fi
- if test -z "$SKIP_TCL"; then
- AC_MSG_CHECKING(for location of tclConfig.sh script)
- if test "x$MACOSX" != "xyes"; then
- tclcnf=`echo $tclinc | sed s/include/lib/g`
- tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
- else
- dnl For Mac OS X 10.3, use the OS-provided framework location
- tclcnf="/System/Library/Frameworks/Tcl.framework"
- fi
- for try in $tclcnf; do
- if test -f $try/tclConfig.sh; then
- AC_MSG_RESULT($try/tclConfig.sh)
- . $try/tclConfig.sh
- dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
- TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
- dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
- dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
- TCL_DEFS=`echo $TCL_DEFS | sed -e 's/\\\\ /\\\\X/g' | tr ' ' '\012' | sed -e '/^[[^-]]/d' -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr '\012' ' ' | sed -e 's/\\\\X/\\\\ /g'`
- break
- fi
- done
- if test -z "$TCL_LIBS"; then
- AC_MSG_RESULT(<not found>)
- AC_MSG_CHECKING(for Tcl library by myself)
- tcllib=`echo $tclinc | sed s/include/lib/g`
- tclli…