diff options
Diffstat (limited to 'src/configure.in')
-rw-r--r-- | src/configure.in | 2660 |
1 files changed, 2660 insertions, 0 deletions
diff --git a/src/configure.in b/src/configure.in new file mode 100644 index 0000000000..2c23e06118 --- /dev/null +++ b/src/configure.in @@ -0,0 +1,2660 @@ +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 extention of executables +AC_EXEEXT + +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 + gccversion=`"$CC" --version | sed -e '2,$d;s/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'` + if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2"; then + echo 'GCC 3.0.x 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 is probably something +dnl wrong with the CC or CFLAGS settings, give an understandable error message +if test "$cross_compiling" = yes; then + AC_MSG_ERROR([cannot compile a simple program, check CC and CFLAGS + (cross compiling doesn't work)]) +fi + +dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies +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 +DEFAULT_VIMNAME=vim +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.c; 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 + + if test "$enable_darwin" = "yes"; then + MACOSX=yes + OS_EXTRA_SCR="os_macosx.c"; + OS_EXTRA_OBJ="objects/os_macosx.o" + CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -I/Developer/Headers/FlatCarbon -no-cpp-precomp" + + dnl If Carbon is found, assume we don't want X11 + dnl unless it was specifically asked for (--with-x) + AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes) + if test "x$CARBON" = "xyes"; then + if test -z "$with_x"; then + with_x=no + DEFAULT_VIMNAME=Vim + fi + fi + 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. +have_local_include='' +have_local_lib='' +if test "$GCC" = yes; 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 '/usr/local/include'` + have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep '/usr/local/lib'` + rm -f conftest.c conftest.o +fi +if test -z "$have_local_lib" -a -d /usr/local/lib; then + tt=`echo "$LDFLAGS" | sed -e 's+-L/usr/local/lib ++g' -e 's+-L/usr/local/lib$++g'` + if test "$tt" = "$LDFLAGS"; then + LDFLAGS="$LDFLAGS -L/usr/local/lib" + fi +fi +if test -z "$have_local_include" -a -d /usr/local/include; then + tt=`echo "$CPPFLAGS" | sed -e 's+-I/usr/local/include ++g' -e 's+-I/usr/local/include$++g'` + if test "$tt" = "$CPPFLAGS"; then + CPPFLAGS="$CPPFLAGS -I/usr/local/include" + 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="$DEFAULT_VIMNAME"; 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 OS390 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 OS390 Unix, let's test it! +AC_MSG_CHECKING(for OS/390 Unix) +case `uname` in + OS/390) OS390Unix="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 OS/390 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"; LDFLAGS="$LDFLAGS -Wl,EDIT=NO" + AC_MSG_RESULT(yes) + ;; + *) OS390Unix="no"; + AC_MSG_RESULT(no) + ;; +esac +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 + +AC_MSG_CHECKING(--enable-perlinterp argument) +AC_ARG_ENABLE(perlinterp, + [ --enable-perlinterp Include Perl interpreter.], , + [enable_perlinterp="no"]) +AC_MSG_RESULT($enable_perlinterp) +if test "$enable_perlinterp" = "yes"; 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` + 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 + PERL_CFLAGS="$perlcppflags" + 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 10.3 + 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 + 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 Include Python interpreter.], , + [enable_pythoninterp="no"]) +AC_MSG_RESULT($enable_pythoninterp) +if test "$enable_pythoninterp" = "yes"; 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 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, + [ + tmp_mkf="/tmp/Makefile-conf$$" + cat ${PYTHON_CONFDIR}/Makefile - <<'eof' >${tmp_mkf} +__: + @echo "python_MODLIBS='$(MODLIBS)'" + @echo "python_LIBS='$(LIBS)'" + @echo "python_SYSLIBS='$(SYSLIBS)'" + @echo "python_LINKFORSHARED='$(LINKFORSHARED)'" +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_MODLIBS} ${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}" + 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}" + 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= + if test "x$MACOSX" != "xyes"; 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 +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-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.0 or tclsh8.2 + 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.0"; 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.2 + if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.0"; then + tclsh_name="tclsh8.2" + 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" + else + dnl For Mac OS X 10.3, use the OS-provided framework location + tclinc="/System/Library/Frameworks/Tcl.framework/Headers" + fi + 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` + 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. + TCL_DEFS=`echo $TCL_DEFS | tr ' ' '\012' | sed -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr -d '\012'` + 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` + for ext in .so .a ; do + for ver in "" $tclver ; do + for try in $tcllib ; do + trylib=tcl$ver$ext + if test -f $try/lib$trylib ; then + AC_MSG_RESULT($try/lib$trylib) + TCL_LIBS="-L$try -ltcl$ver -ldl -lm" + if test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + TCL_LIBS="$TCL_LIBS -R $try" + fi + break 3 + fi + done + done + done + if test -z "$TCL_LIBS"; then + AC_MSG_RESULT(<not found>) + SKIP_TCL=YES + fi + fi + if test -z "$SKIP_TCL"; then + AC_DEFINE(FEAT_TCL) + TCL_SRC=if_tcl.c + TCL_OBJ=objects/if_tcl.o + TCL_PRO=if_tcl.pro + TCL_CFLAGS="-I$TCL_INC $TCL_DEFS" + fi + fi + else + AC_MSG_RESULT(too old; need Tcl version 8.0 or later) + fi + fi +fi +AC_SUBST(TCL_SRC) +AC_SUBST(TCL_OBJ) +AC_SUBST(TCL_PRO) +AC_SUBST(TCL_CFLAGS) +AC_SUBST(TCL_LIBS) + +AC_MSG_CHECKING(--enable-rubyinterp argument) +AC_ARG_ENABLE(rubyinterp, + [ --enable-rubyinterp Include Ruby interpreter.], , + [enable_rubyinterp="no"]) +AC_MSG_RESULT($enable_rubyinterp) +if test "$enable_rubyinterp" = "yes"; then + AC_SUBST(vi_cv_path_ruby) + AC_PATH_PROG(vi_cv_path_ruby, ruby) + if test "X$vi_cv_path_ruby" != "X"; then + AC_MSG_CHECKING(Ruby version) + if $vi_cv_path_ruby -e 'VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then + AC_MSG_RESULT(OK) + AC_MSG_CHECKING(Ruby header files) + rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null` + if test "X$rubyhdrdir" != "X"; then + AC_MSG_RESULT($rubyhdrdir) + RUBY_CFLAGS="-I$rubyhdrdir" + rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'` + if test "X$rubylibs" != "X"; then + RUBY_LIBS="$rubylibs" + fi + librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'` + if test -f "$rubyhdrdir/$librubyarg"; then + librubyarg="$rubyhdrdir/$librubyarg" + else + rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'` + if test -f "$rubylibdir/$librubyarg"; then + librubyarg="$rubylibdir/$librubyarg" + elif test "$librubyarg" = "libruby.a"; then + dnl required on Mac OS 10.3 where libruby.a doesn't exist + librubyarg="-lruby" + else + librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"` + fi + fi + + if test "X$librubyarg" != "X"; then + RUBY_LIBS="$librubyarg $RUBY_LIBS" + fi + rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'` + if test "X$rubyldflags" != "X"; then + LDFLAGS="$rubyldflags $LDFLAGS" + fi + RUBY_SRC="if_ruby.c" + RUBY_OBJ="objects/if_ruby.o" + RUBY_PRO="if_ruby.pro" + AC_DEFINE(FEAT_RUBY) + else + AC_MSG_RESULT(not found, disabling Ruby) + fi + else + AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later) + fi + fi +fi +AC_SUBST(RUBY_SRC) +AC_SUBST(RUBY_OBJ) +AC_SUBST(RUBY_PRO) +AC_SUBST(RUBY_CFLAGS) +AC_SUBST(RUBY_LIBS) + +AC_MSG_CHECKING(--enable-cscope argument) +AC_ARG_ENABLE(cscope, + [ --enable-cscope Include cscope interface.], , + [enable_cscope="no"]) +AC_MSG_RESULT($enable_cscope) +if test "$enable_cscope" = "yes"; then + AC_DEFINE(FEAT_CSCOPE) +fi + +AC_MSG_CHECKING(--enable-workshop argument) +AC_ARG_ENABLE(workshop, + [ --enable-workshop Include Sun Visual Workshop support.], , + [enable_workshop="no"]) +AC_MSG_RESULT($enable_workshop) +if test "$enable_workshop" = "yes"; then + AC_DEFINE(FEAT_SUN_WORKSHOP) + WORKSHOP_SRC="workshop.c integration.c" + AC_SUBST(WORKSHOP_SRC) + WORKSHOP_OBJ="objects/workshop.o objects/integration.o" + AC_SUBST(WORKSHOP_OBJ) + if test "${enable_gui-xxx}" = xxx; then + enable_gui=motif + fi +fi + +AC_MSG_CHECKING(--disable-netbeans argument) +AC_ARG_ENABLE(netbeans, + [ --disable-netbeans Disable NetBeans integration support.], + , [enable_netbeans="yes"]) +if test "$enable_netbeans" = "yes"; then + AC_MSG_RESULT(no) + dnl On Solaris we need the socket and nsl library. + AC_CHECK_LIB(socket, socket) + AC_CHECK_LIB(nsl, gethostbyname) + AC_MSG_CHECKING(whether compiling netbeans integration is possible) + AC_TRY_LINK([ +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <fcntl.h> +#include <netdb.h> +#include <netinet/in.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/socket.h> + /* Check bitfields */ + struct nbbuf { + unsigned int initDone:1; + ushort signmaplen; + }; + ], [ + /* Check creating a socket. */ + struct sockaddr_in server; + (void)socket(AF_INET, SOCK_STREAM, 0); + (void)htons(100); + (void)gethostbyname("microsoft.com"); + if (errno == ECONNREFUSED) + (void)connect(1, (struct sockaddr *)&server, sizeof(server)); + ], + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); enable_netbeans="no") +else + AC_MSG_RESULT(yes) +fi +if test "$enable_netbeans" = "yes"; then + AC_DEFINE(FEAT_NETBEANS_INTG) + NETBEANS_SRC="netbeans.c" + AC_SUBST(NETBEANS_SRC) + NETBEANS_OBJ="objects/netbeans.o" + AC_SUBST(NETBEANS_OBJ) +fi + +AC_MSG_CHECKING(--enable-sniff argument) +AC_ARG_ENABLE(sniff, + [ --enable-sniff Include Sniff interface.], , + [enable_sniff="no"]) +AC_MSG_RESULT($enable_sniff) +if test "$enable_sniff" = "yes"; then + AC_DEFINE(FEAT_SNIFF) + SNIFF_SRC="if_sniff.c" + AC_SUBST(SNIFF_SRC) + SNIFF_OBJ="objects/if_sniff.o" + AC_SUBST(SNIFF_OBJ) +fi + +AC_MSG_CHECKING(--enable-multibyte argument) +AC_ARG_ENABLE(multibyte, + [ --enable-multibyte Include multibyte editing support.], , + [enable_multibyte="no"]) +AC_MSG_RESULT($enable_multibyte) +if test "$enable_multibyte" = "yes"; then + AC_DEFINE(FEAT_MBYTE) +fi + +AC_MSG_CHECKING(--enable-hangulinput argument) +AC_ARG_ENABLE(hangulinput, + [ --enable-hangulinput Include Hangul input support.], , + [enable_hangulinput="no"]) +AC_MSG_RESULT($enable_hangulinput) + +AC_MSG_CHECKING(--enable-xim argument) +AC_ARG_ENABLE(xim, + [ --enable-xim Include XIM input support.], + AC_MSG_RESULT($enable_xim), + [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)]) +dnl defining FEAT_XIM is delayed, so that it can be disabled for older GTK + +AC_MSG_CHECKING(--enable-fontset argument) +AC_ARG_ENABLE(fontset, + [ --enable-fontset Include X fontset output support.], , + [enable_fontset="no"]) +AC_MSG_RESULT($enable_fontset) +dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI + +test -z "$with_x" && with_x=yes +test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes +if test "$with_x" = no; then + AC_MSG_RESULT(defaulting to: don't HAVE_X11) +else + dnl Do this check early, so that its failure can override user requests. + + AC_PATH_PROG(xmkmfpath, xmkmf) + + AC_PATH_XTRA + + dnl On OS390Unix the X libraries are DLLs. To use them the code must + dnl be compiled with a special option. + dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS. + if test "$OS390Unix" = "yes"; then + CFLAGS="$CFLAGS -W c,dll" + LDFLAGS="$LDFLAGS -W l,dll" + X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu" + fi + + dnl On my HPUX system the X include dir is found, but the lib dir not. + dnl This is a desparate try to fix this. + + if test -d "$x_includes" && test ! -d "$x_libraries"; then + x_libraries=`echo "$x_includes" | sed s/include/lib/` + AC_MSG_RESULT(Corrected X libraries to $x_libraries) + X_LIBS="$X_LIBS -L$x_libraries" + if test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + X_LIBS="$X_LIBS -R $x_libraries" + fi + fi + + if test -d "$x_libraries" && test ! -d "$x_includes"; then + x_includes=`echo "$x_libraries" | sed s/lib/include/` + AC_MSG_RESULT(Corrected X includes to $x_includes) + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed. + X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`" + dnl Remove "-L/usr/lib " from X_LIBS, should not be needed. + X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`" + dnl Same for "-R/usr/lib ". + X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`" + + + dnl Check if the X11 header files are correctly installed. On some systems + dnl Xlib.h includes files that don't exist + AC_MSG_CHECKING(if X11 header files can be found) + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $X_CFLAGS" + AC_TRY_COMPILE([#include <X11/Xlib.h>], , + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); no_x=yes) + CFLAGS=$cflags_save + + if test "${no_x-no}" = yes; then + with_x=no + else + AC_DEFINE(HAVE_X11) + X_LIB="-lXt -lX11"; + AC_SUBST(X_LIB) + + ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="-L$x_libraries $LDFLAGS" + + dnl Check for -lXdmcp (needed on SunOS 4.1.4) + dnl For HP-UX 10.20 it must be before -lSM -lICE + AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],, + [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp]) + + dnl Some systems need -lnsl -lsocket when testing for ICE. + dnl The check above doesn't do this, try here (again). Also needed to get + dnl them after Xdmcp. link.sh will remove them when not needed. + dnl Check for other function than above to avoid the cached value + AC_CHECK_LIB(ICE, IceOpenConnection, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS]) + + dnl Check for -lXpm (needed for some versions of Motif) + LDFLAGS="$X_LIBS $ac_save_LDFLAGS" + AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],, + [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS]) + + dnl Check that the X11 header files don't use implicit declarations + AC_MSG_CHECKING(if X11 header files implicitly declare return values) + cflags_save=$CFLAGS + CFLAGS="$CFLAGS $X_CFLAGS -Werror" + AC_TRY_COMPILE([#include <X11/Xlib.h>], , + AC_MSG_RESULT(no), + CFLAGS="$CFLAGS -Wno-implicit-int" + AC_TRY_COMPILE([#include <X11/Xlib.h>], , + AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int", + AC_MSG_RESULT(test failed) + ) + ) + CFLAGS=$cflags_save + + LDFLAGS="$ac_save_LDFLAGS" + + fi +fi + +test "x$with_x" = xno -a "x$BEOS" != "xyes" -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no + +AC_MSG_CHECKING(--enable-gui argument) +AC_ARG_ENABLE(gui, + [ --enable-gui[=OPTS] X11 GUI [default=auto] [OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/beos/photon/carbon]], , enable_gui="auto") + +dnl Canonicalize the --enable-gui= argument so that it can be easily compared. +dnl Do not use character classes for portability with old tools. +enable_gui_canon=`echo "_$enable_gui" | \ + sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + +dnl Skip everything by default. +SKIP_GTK=YES +SKIP_GTK2=YES +SKIP_GNOME=YES +SKIP_MOTIF=YES +SKIP_ATHENA=YES +SKIP_NEXTAW=YES +SKIP_PHOTON=YES +SKIP_BEOS=YES +SKIP_CARBON=YES +GUITYPE=NONE + +if test "x$BEOS" = "xyes"; then + SKIP_BEOS= + case "$enable_gui_canon" in + no) AC_MSG_RESULT(no GUI support) + SKIP_BEOS=YES ;; + yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;; + auto) AC_MSG_RESULT(auto - automatic GUI support) ;; + beos) AC_MSG_RESULT(BeOS GUI support) ;; + *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) + SKIP_BEOS=YES ;; + esac + +elif test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then + SKIP_PHOTON= + case "$enable_gui_canon" in + no) AC_MSG_RESULT(no GUI support) + SKIP_PHOTON=YES ;; + yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;; + auto) AC_MSG_RESULT(auto - automatic GUI support) ;; + photon) AC_MSG_RESULT(Photon GUI support) ;; + *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) + SKIP_PHOTON=YES ;; + esac + +elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then + SKIP_CARBON= + case "$enable_gui_canon" in + no) AC_MSG_RESULT(no GUI support) + SKIP_CARBON=YES ;; + yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;; + auto) AC_MSG_RESULT(auto - automatic GUI support) ;; + carbon) AC_MSG_RESULT(Carbon GUI support) ;; + *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) + SKIP_CARBON=YES ;; + esac + +else + + + case "$enable_gui_canon" in + no|none) AC_MSG_RESULT(no GUI support) ;; + yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support) + SKIP_GTK= + SKIP_GTK2= + SKIP_GNOME= + SKIP_MOTIF= + SKIP_ATHENA= + SKIP_NEXTAW= + SKIP_CARBON=;; + gtk) AC_MSG_RESULT(GTK+ 1.x GUI support) + SKIP_GTK=;; + gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support) + SKIP_GTK= + SKIP_GTK2=;; + gnome) AC_MSG_RESULT(GNOME 1.x GUI support) + SKIP_GNOME= + SKIP_GTK=;; + gnome2) AC_MSG_RESULT(GNOME 2.x GUI support) + SKIP_GNOME= + SKIP_GTK= + SKIP_GTK2=;; + motif) AC_MSG_RESULT(Motif GUI support) + SKIP_MOTIF=;; + athena) AC_MSG_RESULT(Athena GUI support) |