Bram Moolenaar | 3f7d090 | 2016-11-12 21:13:42 +0100 | [diff] [blame] | 1 | dnl configure.ac: autoconf script for Vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | dnl Process this file with autoconf 2.12 or 2.13 to produce "configure". |
| 4 | dnl Should also work with autoconf 2.54 and later. |
| 5 | |
| 6 | AC_INIT(vim.h) |
| 7 | AC_CONFIG_HEADER(auto/config.h:config.h.in) |
| 8 | |
| 9 | dnl Being able to run configure means the system is Unix (compatible). |
| 10 | AC_DEFINE(UNIX) |
| 11 | AC_PROG_MAKE_SET |
| 12 | |
| 13 | dnl Checks for programs. |
Bram Moolenaar | c039441 | 2017-04-20 20:20:23 +0200 | [diff] [blame] | 14 | AC_PROG_CC dnl required by almost everything |
| 15 | AC_PROG_CPP dnl required by header file checks |
| 16 | AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP |
| 17 | AC_PROG_FGREP dnl finds working grep -F |
| 18 | AC_ISC_POSIX dnl required by AC_C_CROSS |
| 19 | AC_PROG_AWK dnl required for "make html" in ../doc |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 20 | |
| 21 | dnl Don't strip if we don't have it |
| 22 | AC_CHECK_PROG(STRIP, strip, strip, :) |
| 23 | |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 24 | dnl Check for extension of executables |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 25 | AC_EXEEXT |
| 26 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 27 | dnl Check for standard headers. We don't use this in Vim but other stuff |
| 28 | dnl in autoconf needs it, where it uses STDC_HEADERS. |
| 29 | AC_HEADER_STDC |
| 30 | AC_HEADER_SYS_WAIT |
| 31 | |
Bram Moolenaar | f788a06 | 2011-12-14 20:51:25 +0100 | [diff] [blame] | 32 | dnl Check for the flag that fails if stuff are missing. |
| 33 | |
| 34 | AC_MSG_CHECKING(--enable-fail-if-missing argument) |
| 35 | AC_ARG_ENABLE(fail_if_missing, |
| 36 | [ --enable-fail-if-missing Fail if dependencies on additional features |
| 37 | specified on the command line are missing.], |
| 38 | [fail_if_missing="yes"], |
| 39 | [fail_if_missing="no"]) |
| 40 | AC_MSG_RESULT($fail_if_missing) |
| 41 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 42 | dnl Set default value for CFLAGS if none is defined or it's empty |
| 43 | if test -z "$CFLAGS"; then |
| 44 | CFLAGS="-O" |
| 45 | test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall" |
| 46 | fi |
| 47 | if test "$GCC" = yes; then |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 48 | dnl method that should work for nearly all versions |
Bram Moolenaar | c8836f7 | 2014-04-12 13:12:24 +0200 | [diff] [blame] | 49 | gccversion=`$CC -dumpversion` |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 50 | if test "x$gccversion" = "x"; then |
| 51 | dnl old method; fall-back for when -dumpversion doesn't work |
Bram Moolenaar | c8836f7 | 2014-04-12 13:12:24 +0200 | [diff] [blame] | 52 | gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'` |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 53 | fi |
Bram Moolenaar | a5792f5 | 2005-11-23 21:25:05 +0000 | [diff] [blame] | 54 | dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki |
| 55 | if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 56 | echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 57 | CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'` |
| 58 | else |
| 59 | if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then |
| 60 | echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"' |
| 61 | CFLAGS="$CFLAGS -fno-strength-reduce" |
| 62 | fi |
| 63 | fi |
| 64 | fi |
| 65 | |
Bram Moolenaar | 0c6ccfd | 2013-10-02 18:23:07 +0200 | [diff] [blame] | 66 | dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a |
| 67 | dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on |
| 68 | dnl the version number of the clang in use. |
| 69 | dnl Note that this does not work to get the version of clang 3.1 or 3.2. |
Bram Moolenaar | 5f69fee | 2017-03-09 11:58:40 +0100 | [diff] [blame] | 70 | AC_MSG_CHECKING(for clang version) |
| 71 | 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]][[0-9]]*\).*$/\1/p'` |
Bram Moolenaar | 0c6ccfd | 2013-10-02 18:23:07 +0200 | [diff] [blame] | 72 | if test x"$CLANG_VERSION_STRING" != x"" ; then |
| 73 | CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'` |
| 74 | CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'` |
| 75 | CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'` |
| 76 | CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION` |
| 77 | AC_MSG_RESULT($CLANG_VERSION) |
| 78 | dnl If you find the same issue with versions earlier than 500.2.75, |
| 79 | dnl change the constant 500002075 below appropriately. To get the |
| 80 | dnl integer corresponding to a version number, refer to the |
| 81 | dnl definition of CLANG_VERSION above. |
Bram Moolenaar | 5f69fee | 2017-03-09 11:58:40 +0100 | [diff] [blame] | 82 | AC_MSG_CHECKING(if clang supports -fno-strength-reduce) |
Bram Moolenaar | 0c6ccfd | 2013-10-02 18:23:07 +0200 | [diff] [blame] | 83 | if test "$CLANG_VERSION" -ge 500002075 ; then |
Bram Moolenaar | 5f69fee | 2017-03-09 11:58:40 +0100 | [diff] [blame] | 84 | AC_MSG_RESULT(no) |
| 85 | CFLAGS=`echo "$CFLAGS" | sed -e 's/-fno-strength-reduce/ /'` |
| 86 | else |
| 87 | AC_MSG_RESULT(yes) |
Bram Moolenaar | 0c6ccfd | 2013-10-02 18:23:07 +0200 | [diff] [blame] | 88 | fi |
| 89 | else |
Bram Moolenaar | 5f69fee | 2017-03-09 11:58:40 +0100 | [diff] [blame] | 90 | AC_MSG_RESULT(N/A) |
Bram Moolenaar | 0c6ccfd | 2013-10-02 18:23:07 +0200 | [diff] [blame] | 91 | fi |
| 92 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 93 | dnl If configure thinks we are cross compiling, there might be something |
| 94 | dnl wrong with the CC or CFLAGS settings, give a useful warning message |
Bram Moolenaar | 839e954 | 2016-04-14 16:46:02 +0200 | [diff] [blame] | 95 | CROSS_COMPILING= |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 96 | if test "$cross_compiling" = yes; then |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 97 | AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS]) |
Bram Moolenaar | 839e954 | 2016-04-14 16:46:02 +0200 | [diff] [blame] | 98 | CROSS_COMPILING=1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 99 | fi |
Bram Moolenaar | 839e954 | 2016-04-14 16:46:02 +0200 | [diff] [blame] | 100 | AC_SUBST(CROSS_COMPILING) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 101 | |
Bram Moolenaar | d5cdbeb | 2005-10-10 20:59:28 +0000 | [diff] [blame] | 102 | dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies. |
| 103 | dnl But gcc 3.1 changed the meaning! See near the end. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 104 | test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM) |
| 105 | |
| 106 | if test -f ./toolcheck; then |
| 107 | AC_CHECKING(for buggy tools) |
| 108 | sh ./toolcheck 1>&AC_FD_MSG |
| 109 | fi |
| 110 | |
| 111 | OS_EXTRA_SRC=""; OS_EXTRA_OBJ="" |
| 112 | |
| 113 | dnl Check for BeOS, which needs an extra source file |
| 114 | AC_MSG_CHECKING(for BeOS) |
| 115 | case `uname` in |
| 116 | BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o |
| 117 | BEOS=yes; AC_MSG_RESULT(yes);; |
| 118 | *) BEOS=no; AC_MSG_RESULT(no);; |
| 119 | esac |
| 120 | |
| 121 | dnl If QNX is found, assume we don't want to use Xphoton |
| 122 | dnl unless it was specifically asked for (--with-x) |
| 123 | AC_MSG_CHECKING(for QNX) |
| 124 | case `uname` in |
| 125 | QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o |
| 126 | test -z "$with_x" && with_x=no |
| 127 | QNX=yes; AC_MSG_RESULT(yes);; |
| 128 | *) QNX=no; AC_MSG_RESULT(no);; |
| 129 | esac |
| 130 | |
| 131 | dnl Check for Darwin and MacOS X |
| 132 | dnl We do a check for MacOS X in the very beginning because there |
| 133 | dnl are a lot of other things we need to change besides GUI stuff |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 134 | AC_MSG_CHECKING([for Darwin (Mac OS X)]) |
| 135 | if test "`(uname) 2>/dev/null`" = Darwin; then |
| 136 | AC_MSG_RESULT(yes) |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 137 | MACOS_X=yes |
| 138 | CPPFLAGS="$CPPFLAGS -DMACOS_X" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 139 | |
| 140 | AC_MSG_CHECKING(--disable-darwin argument) |
| 141 | AC_ARG_ENABLE(darwin, |
| 142 | [ --disable-darwin Disable Darwin (Mac OS X) support.], |
| 143 | , [enable_darwin="yes"]) |
| 144 | if test "$enable_darwin" = "yes"; then |
| 145 | AC_MSG_RESULT(no) |
| 146 | AC_MSG_CHECKING(if Darwin files are there) |
Bram Moolenaar | 164fca3 | 2010-07-14 13:58:07 +0200 | [diff] [blame] | 147 | if test -f os_macosx.m; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 148 | AC_MSG_RESULT(yes) |
| 149 | else |
| 150 | AC_MSG_RESULT([no, Darwin support disabled]) |
| 151 | enable_darwin=no |
| 152 | fi |
| 153 | else |
| 154 | AC_MSG_RESULT([yes, Darwin support excluded]) |
| 155 | fi |
| 156 | |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 157 | AC_MSG_CHECKING(--with-mac-arch argument) |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 158 | AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both], |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 159 | MACARCH="$withval"; AC_MSG_RESULT($MACARCH), |
Bram Moolenaar | 899dddf | 2006-03-26 21:06:50 +0000 | [diff] [blame] | 160 | MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH)) |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 161 | |
Bram Moolenaar | 595a7be | 2010-03-10 16:28:12 +0100 | [diff] [blame] | 162 | AC_MSG_CHECKING(--with-developer-dir argument) |
| 163 | AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools], |
| 164 | DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR), |
Bram Moolenaar | 32d03b3 | 2015-11-19 13:46:48 +0100 | [diff] [blame] | 165 | AC_MSG_RESULT(not present)) |
Bram Moolenaar | 595a7be | 2010-03-10 16:28:12 +0100 | [diff] [blame] | 166 | |
| 167 | if test "x$DEVELOPER_DIR" = "x"; then |
| 168 | AC_PATH_PROG(XCODE_SELECT, xcode-select) |
| 169 | if test "x$XCODE_SELECT" != "x"; then |
| 170 | AC_MSG_CHECKING(for developer dir using xcode-select) |
| 171 | DEVELOPER_DIR=`$XCODE_SELECT -print-path` |
| 172 | AC_MSG_RESULT([$DEVELOPER_DIR]) |
| 173 | else |
| 174 | DEVELOPER_DIR=/Developer |
| 175 | fi |
| 176 | fi |
| 177 | |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 178 | if test "x$MACARCH" = "xboth"; then |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 179 | AC_MSG_CHECKING(for 10.4 universal SDK) |
| 180 | dnl There is a terrible inconsistency (but we appear to get away with it): |
| 181 | dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS |
| 182 | dnl doesn't, because "gcc -E" doesn't grok it. That means the configure |
| 183 | dnl tests using the preprocessor are actually done with the wrong header |
| 184 | dnl files. $LDFLAGS is set at the end, because configure uses it together |
| 185 | dnl with $CFLAGS and we can only have one -sysroot argument. |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 186 | save_cppflags="$CPPFLAGS" |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 187 | save_cflags="$CFLAGS" |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 188 | save_ldflags="$LDFLAGS" |
Bram Moolenaar | 595a7be | 2010-03-10 16:28:12 +0100 | [diff] [blame] | 189 | CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 190 | AC_TRY_LINK([ ], [ ], |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 191 | AC_MSG_RESULT(found, will make universal binary), |
| 192 | |
| 193 | AC_MSG_RESULT(not found) |
Bram Moolenaar | 1f35bf9 | 2006-03-07 22:38:47 +0000 | [diff] [blame] | 194 | CFLAGS="$save_cflags" |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 195 | AC_MSG_CHECKING(if Intel architecture is supported) |
| 196 | CPPFLAGS="$CPPFLAGS -arch i386" |
| 197 | LDFLAGS="$save_ldflags -arch i386" |
| 198 | AC_TRY_LINK([ ], [ ], |
| 199 | AC_MSG_RESULT(yes); MACARCH="intel", |
| 200 | AC_MSG_RESULT(no, using PowerPC) |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 201 | MACARCH="ppc" |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 202 | CPPFLAGS="$save_cppflags -arch ppc" |
| 203 | LDFLAGS="$save_ldflags -arch ppc")) |
| 204 | elif test "x$MACARCH" = "xintel"; then |
| 205 | CPPFLAGS="$CPPFLAGS -arch intel" |
| 206 | LDFLAGS="$LDFLAGS -arch intel" |
Bram Moolenaar | e2f98b9 | 2006-03-29 21:18:24 +0000 | [diff] [blame] | 207 | elif test "x$MACARCH" = "xppc"; then |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 208 | CPPFLAGS="$CPPFLAGS -arch ppc" |
| 209 | LDFLAGS="$LDFLAGS -arch ppc" |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 210 | fi |
| 211 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 212 | if test "$enable_darwin" = "yes"; then |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 213 | MACOS_X_DARWIN=yes |
Bram Moolenaar | 164fca3 | 2010-07-14 13:58:07 +0200 | [diff] [blame] | 214 | OS_EXTRA_SRC="os_macosx.m os_mac_conv.c"; |
Bram Moolenaar | ab79bcb | 2004-07-18 21:34:53 +0000 | [diff] [blame] | 215 | OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o" |
Bram Moolenaar | 32466aa | 2006-02-24 23:53:04 +0000 | [diff] [blame] | 216 | dnl TODO: use -arch i386 on Intel machines |
Bram Moolenaar | 0958e0f | 2013-11-04 04:57:50 +0100 | [diff] [blame] | 217 | dnl Removed -no-cpp-precomp, only for very old compilers. |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 218 | CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 219 | |
| 220 | dnl If Carbon is found, assume we don't want X11 |
| 221 | dnl unless it was specifically asked for (--with-x) |
Bram Moolenaar | ab79bcb | 2004-07-18 21:34:53 +0000 | [diff] [blame] | 222 | dnl or Motif, Athena or GTK GUI is used. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 223 | AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes) |
| 224 | if test "x$CARBON" = "xyes"; then |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 225 | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 226 | with_x=no |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 227 | fi |
| 228 | fi |
| 229 | fi |
Bram Moolenaar | a23ccb8 | 2006-02-27 00:08:02 +0000 | [diff] [blame] | 230 | |
Bram Moolenaar | db552d60 | 2006-03-23 22:59:57 +0000 | [diff] [blame] | 231 | dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double |
Bram Moolenaar | fd2ac76 | 2006-03-01 22:09:21 +0000 | [diff] [blame] | 232 | dnl free. This happens in expand_filename(), because the optimizer swaps |
Bram Moolenaar | db552d60 | 2006-03-23 22:59:57 +0000 | [diff] [blame] | 233 | dnl two blocks of code, both using "repl", that can't be swapped. |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 234 | if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then |
| 235 | CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'` |
| 236 | fi |
| 237 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 238 | else |
| 239 | AC_MSG_RESULT(no) |
| 240 | fi |
| 241 | |
Bram Moolenaar | 39766a7 | 2013-11-03 00:41:00 +0100 | [diff] [blame] | 242 | dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon |
| 243 | dnl so we need to include it to have access to version macros. |
Bram Moolenaar | 18e5469 | 2013-11-03 20:26:31 +0100 | [diff] [blame] | 244 | AC_CHECK_HEADERS(AvailabilityMacros.h) |
Bram Moolenaar | 39766a7 | 2013-11-03 00:41:00 +0100 | [diff] [blame] | 245 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 246 | AC_SUBST(OS_EXTRA_SRC) |
| 247 | AC_SUBST(OS_EXTRA_OBJ) |
| 248 | |
| 249 | dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS. |
| 250 | dnl Only when the directory exists and it wasn't there yet. |
| 251 | dnl For gcc don't do this when it is already in the default search path. |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 252 | dnl Skip all of this when cross-compiling. |
| 253 | if test "$cross_compiling" = no; then |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 254 | AC_MSG_CHECKING(--with-local-dir argument) |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 255 | have_local_include='' |
| 256 | have_local_lib='' |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 257 | AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries. |
| 258 | --without-local-dir do not search /usr/local for local libraries.], [ |
| 259 | local_dir="$withval" |
| 260 | case "$withval" in |
| 261 | */*) ;; |
| 262 | no) |
| 263 | # avoid adding local dir to LDFLAGS and CPPFLAGS |
Bram Moolenaar | e06c188 | 2010-07-21 22:05:20 +0200 | [diff] [blame] | 264 | have_local_include=yes |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 265 | have_local_lib=yes |
| 266 | ;; |
| 267 | *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;; |
| 268 | esac |
| 269 | AC_MSG_RESULT($local_dir) |
| 270 | ], [ |
| 271 | local_dir=/usr/local |
| 272 | AC_MSG_RESULT(Defaulting to $local_dir) |
| 273 | ]) |
| 274 | if test "$GCC" = yes -a "$local_dir" != no; then |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 275 | echo 'void f(){}' > conftest.c |
Bram Moolenaar | 0958e0f | 2013-11-04 04:57:50 +0100 | [diff] [blame] | 276 | dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler) |
| 277 | have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"` |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 278 | have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"` |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 279 | rm -f conftest.c conftest.o |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 280 | fi |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 281 | if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then |
| 282 | tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"` |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 283 | if test "$tt" = "$LDFLAGS"; then |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 284 | LDFLAGS="$LDFLAGS -L${local_dir}/lib" |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 285 | fi |
| 286 | fi |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 287 | if test -z "$have_local_include" -a -d "${local_dir}/include"; then |
| 288 | tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"` |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 289 | if test "$tt" = "$CPPFLAGS"; then |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 290 | CPPFLAGS="$CPPFLAGS -I${local_dir}/include" |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 291 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 292 | fi |
| 293 | fi |
| 294 | |
| 295 | AC_MSG_CHECKING(--with-vim-name argument) |
| 296 | AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable], |
| 297 | VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME), |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 298 | VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME)) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 299 | AC_SUBST(VIMNAME) |
| 300 | AC_MSG_CHECKING(--with-ex-name argument) |
| 301 | AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable], |
| 302 | EXNAME="$withval"; AC_MSG_RESULT($EXNAME), |
| 303 | EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex)) |
| 304 | AC_SUBST(EXNAME) |
| 305 | AC_MSG_CHECKING(--with-view-name argument) |
| 306 | AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable], |
| 307 | VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME), |
| 308 | VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view)) |
| 309 | AC_SUBST(VIEWNAME) |
| 310 | |
| 311 | AC_MSG_CHECKING(--with-global-runtime argument) |
| 312 | AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'], |
| 313 | AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"), |
| 314 | AC_MSG_RESULT(no)) |
| 315 | |
| 316 | AC_MSG_CHECKING(--with-modified-by argument) |
| 317 | AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version], |
| 318 | AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"), |
| 319 | AC_MSG_RESULT(no)) |
| 320 | |
Bram Moolenaar | 2c704a7 | 2010-06-03 21:17:25 +0200 | [diff] [blame] | 321 | dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 322 | AC_MSG_CHECKING(if character set is EBCDIC) |
| 323 | AC_TRY_COMPILE([ ], |
| 324 | [ /* TryCompile function for CharSet. |
| 325 | Treat any failure as ASCII for compatibility with existing art. |
| 326 | Use compile-time rather than run-time tests for cross-compiler |
| 327 | tolerance. */ |
| 328 | #if '0'!=240 |
| 329 | make an error "Character set is not EBCDIC" |
| 330 | #endif ], |
| 331 | [ # TryCompile action if true |
| 332 | cf_cv_ebcdic=yes ], |
| 333 | [ # TryCompile action if false |
| 334 | cf_cv_ebcdic=no]) |
| 335 | # end of TryCompile ]) |
| 336 | # end of CacheVal CvEbcdic |
| 337 | AC_MSG_RESULT($cf_cv_ebcdic) |
| 338 | case "$cf_cv_ebcdic" in #(vi |
| 339 | yes) AC_DEFINE(EBCDIC) |
| 340 | line_break='"\\n"' |
| 341 | ;; |
| 342 | *) line_break='"\\012"';; |
| 343 | esac |
| 344 | AC_SUBST(line_break) |
| 345 | |
| 346 | if test "$cf_cv_ebcdic" = "yes"; then |
Bram Moolenaar | 84a05ac | 2013-05-06 04:24:17 +0200 | [diff] [blame] | 347 | dnl If we have EBCDIC we most likely have z/OS Unix, let's test it! |
Bram Moolenaar | 2c704a7 | 2010-06-03 21:17:25 +0200 | [diff] [blame] | 348 | AC_MSG_CHECKING(for z/OS Unix) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 349 | case `uname` in |
Bram Moolenaar | 2c704a7 | 2010-06-03 21:17:25 +0200 | [diff] [blame] | 350 | OS/390) zOSUnix="yes"; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 351 | dnl If using cc the environment variable _CC_CCMODE must be |
| 352 | dnl set to "1", so that some compiler extensions are enabled. |
| 353 | dnl If using c89 the environment variable is named _CC_C89MODE. |
| 354 | dnl Note: compile with c89 never tested. |
| 355 | if test "$CC" = "cc"; then |
| 356 | ccm="$_CC_CCMODE" |
| 357 | ccn="CC" |
| 358 | else |
| 359 | if test "$CC" = "c89"; then |
| 360 | ccm="$_CC_C89MODE" |
| 361 | ccn="C89" |
| 362 | else |
| 363 | ccm=1 |
| 364 | fi |
| 365 | fi |
| 366 | if test "$ccm" != "1"; then |
| 367 | echo "" |
| 368 | echo "------------------------------------------" |
Bram Moolenaar | 2c704a7 | 2010-06-03 21:17:25 +0200 | [diff] [blame] | 369 | echo " On z/OS Unix, the environment variable" |
Bram Moolenaar | 77c1935 | 2012-06-13 19:19:41 +0200 | [diff] [blame] | 370 | echo " _CC_${ccn}MODE must be set to \"1\"!" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 371 | echo " Do:" |
| 372 | echo " export _CC_${ccn}MODE=1" |
| 373 | echo " and then call configure again." |
| 374 | echo "------------------------------------------" |
| 375 | exit 1 |
| 376 | fi |
Bram Moolenaar | 77c1935 | 2012-06-13 19:19:41 +0200 | [diff] [blame] | 377 | # Set CFLAGS for configure process. |
| 378 | # This will be reset later for config.mk. |
| 379 | # Use haltonmsg to force error for missing H files. |
| 380 | CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)"; |
| 381 | LDFLAGS="$LDFLAGS -Wl,EDIT=NO" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 382 | AC_MSG_RESULT(yes) |
| 383 | ;; |
Bram Moolenaar | 2c704a7 | 2010-06-03 21:17:25 +0200 | [diff] [blame] | 384 | *) zOSUnix="no"; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 385 | AC_MSG_RESULT(no) |
| 386 | ;; |
| 387 | esac |
| 388 | fi |
| 389 | |
Bram Moolenaar | 2c704a7 | 2010-06-03 21:17:25 +0200 | [diff] [blame] | 390 | dnl Set QUOTESED. Needs additional backslashes on zOS |
| 391 | if test "$zOSUnix" = "yes"; then |
| 392 | QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'" |
| 393 | else |
| 394 | QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'" |
| 395 | fi |
| 396 | AC_SUBST(QUOTESED) |
| 397 | |
| 398 | |
Bram Moolenaar | 5bd32f4 | 2014-04-02 14:05:38 +0200 | [diff] [blame] | 399 | dnl Link with -lsmack for Smack stuff; if not found |
| 400 | AC_MSG_CHECKING(--disable-smack argument) |
| 401 | AC_ARG_ENABLE(smack, |
| 402 | [ --disable-smack Do not check for Smack support.], |
| 403 | , enable_smack="yes") |
| 404 | if test "$enable_smack" = "yes"; then |
Bram Moolenaar | 4ed89cd | 2014-04-05 12:02:25 +0200 | [diff] [blame] | 405 | AC_MSG_RESULT(no) |
Bram Moolenaar | 5bd32f4 | 2014-04-02 14:05:38 +0200 | [diff] [blame] | 406 | AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no") |
Bram Moolenaar | 4ed89cd | 2014-04-05 12:02:25 +0200 | [diff] [blame] | 407 | else |
Bram Moolenaar | c09551a | 2014-04-10 11:09:17 +0200 | [diff] [blame] | 408 | AC_MSG_RESULT(yes) |
Bram Moolenaar | 5bd32f4 | 2014-04-02 14:05:38 +0200 | [diff] [blame] | 409 | fi |
| 410 | if test "$enable_smack" = "yes"; then |
Bram Moolenaar | c09551a | 2014-04-10 11:09:17 +0200 | [diff] [blame] | 411 | AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no") |
| 412 | fi |
| 413 | if test "$enable_smack" = "yes"; then |
| 414 | AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h) |
| 415 | AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>], |
| 416 | AC_MSG_RESULT(yes), |
Bram Moolenaar | e29b1fe | 2014-04-10 20:00:15 +0200 | [diff] [blame] | 417 | AC_MSG_RESULT(no); enable_smack="no") |
Bram Moolenaar | c09551a | 2014-04-10 11:09:17 +0200 | [diff] [blame] | 418 | fi |
| 419 | if test "$enable_smack" = "yes"; then |
| 420 | AC_CHECK_LIB(attr, setxattr, |
Bram Moolenaar | 5bd32f4 | 2014-04-02 14:05:38 +0200 | [diff] [blame] | 421 | [LIBS="$LIBS -lattr" |
| 422 | found_smack="yes" |
| 423 | AC_DEFINE(HAVE_SMACK)]) |
Bram Moolenaar | 588ebeb | 2008-05-07 17:09:24 +0000 | [diff] [blame] | 424 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 425 | |
Bram Moolenaar | 5bd32f4 | 2014-04-02 14:05:38 +0200 | [diff] [blame] | 426 | dnl When smack was found don't search for SELinux |
| 427 | if test "x$found_smack" = "x"; then |
| 428 | dnl Link with -lselinux for SELinux stuff; if not found |
| 429 | AC_MSG_CHECKING(--disable-selinux argument) |
| 430 | AC_ARG_ENABLE(selinux, |
| 431 | [ --disable-selinux Do not check for SELinux support.], |
| 432 | , enable_selinux="yes") |
| 433 | if test "$enable_selinux" = "yes"; then |
| 434 | AC_MSG_RESULT(no) |
| 435 | AC_CHECK_LIB(selinux, is_selinux_enabled, |
| 436 | [LIBS="$LIBS -lselinux" |
| 437 | AC_DEFINE(HAVE_SELINUX)]) |
| 438 | else |
| 439 | AC_MSG_RESULT(yes) |
| 440 | fi |
| 441 | fi |
| 442 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 443 | dnl Check user requested features. |
| 444 | |
| 445 | AC_MSG_CHECKING(--with-features argument) |
Bram Moolenaar | eec2981 | 2016-07-26 21:27:36 +0200 | [diff] [blame] | 446 | AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: huge)], |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 447 | features="$withval"; AC_MSG_RESULT($features), |
Bram Moolenaar | 23c4f71 | 2016-01-20 22:11:59 +0100 | [diff] [blame] | 448 | features="huge"; AC_MSG_RESULT(Defaulting to huge)) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 449 | |
| 450 | dovimdiff="" |
| 451 | dogvimdiff="" |
| 452 | case "$features" in |
| 453 | tiny) AC_DEFINE(FEAT_TINY) ;; |
| 454 | small) AC_DEFINE(FEAT_SMALL) ;; |
| 455 | normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff"; |
| 456 | dogvimdiff="installgvimdiff" ;; |
| 457 | big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff"; |
| 458 | dogvimdiff="installgvimdiff" ;; |
| 459 | huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff"; |
| 460 | dogvimdiff="installgvimdiff" ;; |
| 461 | *) AC_MSG_RESULT([Sorry, $features is not supported]) ;; |
| 462 | esac |
| 463 | |
| 464 | AC_SUBST(dovimdiff) |
| 465 | AC_SUBST(dogvimdiff) |
| 466 | |
| 467 | AC_MSG_CHECKING(--with-compiledby argument) |
| 468 | AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message], |
| 469 | compiledby="$withval"; AC_MSG_RESULT($withval), |
| 470 | compiledby=""; AC_MSG_RESULT(no)) |
| 471 | AC_SUBST(compiledby) |
| 472 | |
| 473 | AC_MSG_CHECKING(--disable-xsmp argument) |
| 474 | AC_ARG_ENABLE(xsmp, |
| 475 | [ --disable-xsmp Disable XSMP session management], |
| 476 | , enable_xsmp="yes") |
| 477 | |
| 478 | if test "$enable_xsmp" = "yes"; then |
| 479 | AC_MSG_RESULT(no) |
| 480 | AC_MSG_CHECKING(--disable-xsmp-interact argument) |
| 481 | AC_ARG_ENABLE(xsmp-interact, |
| 482 | [ --disable-xsmp-interact Disable XSMP interaction], |
| 483 | , enable_xsmp_interact="yes") |
| 484 | if test "$enable_xsmp_interact" = "yes"; then |
| 485 | AC_MSG_RESULT(no) |
| 486 | AC_DEFINE(USE_XSMP_INTERACT) |
| 487 | else |
| 488 | AC_MSG_RESULT(yes) |
| 489 | fi |
| 490 | else |
| 491 | AC_MSG_RESULT(yes) |
| 492 | fi |
| 493 | |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 494 | dnl Check for Lua feature. |
| 495 | AC_MSG_CHECKING(--enable-luainterp argument) |
| 496 | AC_ARG_ENABLE(luainterp, |
Bram Moolenaar | 8008b63 | 2017-07-18 21:33:20 +0200 | [diff] [blame] | 497 | [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], , |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 498 | [enable_luainterp="no"]) |
| 499 | AC_MSG_RESULT($enable_luainterp) |
| 500 | |
Bram Moolenaar | 2334b6d | 2010-07-22 21:32:16 +0200 | [diff] [blame] | 501 | if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then |
Bram Moolenaar | 3c124e3 | 2016-01-31 14:36:58 +0100 | [diff] [blame] | 502 | if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then |
| 503 | AC_MSG_ERROR([cannot use Lua with tiny or small features]) |
| 504 | fi |
| 505 | |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 506 | dnl -- find the lua executable |
| 507 | AC_SUBST(vi_cv_path_lua) |
| 508 | |
| 509 | AC_MSG_CHECKING(--with-lua-prefix argument) |
| 510 | AC_ARG_WITH(lua_prefix, |
| 511 | [ --with-lua-prefix=PFX Prefix where Lua is installed.], |
| 512 | with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix), |
Bram Moolenaar | 0d2e4fc | 2010-07-18 12:35:47 +0200 | [diff] [blame] | 513 | with_lua_prefix="";AC_MSG_RESULT(no)) |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 514 | |
| 515 | if test "X$with_lua_prefix" != "X"; then |
| 516 | vi_cv_path_lua_pfx="$with_lua_prefix" |
| 517 | else |
| 518 | AC_MSG_CHECKING(LUA_PREFIX environment var) |
| 519 | if test "X$LUA_PREFIX" != "X"; then |
| 520 | AC_MSG_RESULT("$LUA_PREFIX") |
| 521 | vi_cv_path_lua_pfx="$LUA_PREFIX" |
| 522 | else |
Bram Moolenaar | 0d2e4fc | 2010-07-18 12:35:47 +0200 | [diff] [blame] | 523 | AC_MSG_RESULT([not set, default to /usr]) |
| 524 | vi_cv_path_lua_pfx="/usr" |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 525 | fi |
| 526 | fi |
| 527 | |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 528 | AC_MSG_CHECKING(--with-luajit) |
| 529 | AC_ARG_WITH(luajit, |
| 530 | [ --with-luajit Link with LuaJIT instead of Lua.], |
| 531 | [vi_cv_with_luajit="$withval"], |
| 532 | [vi_cv_with_luajit="no"]) |
| 533 | AC_MSG_RESULT($vi_cv_with_luajit) |
| 534 | |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 535 | LUA_INC= |
| 536 | if test "X$vi_cv_path_lua_pfx" != "X"; then |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 537 | if test "x$vi_cv_with_luajit" != "xno"; then |
| 538 | dnl -- try to find LuaJIT executable |
| 539 | AC_PATH_PROG(vi_cv_path_luajit, luajit) |
| 540 | if test "X$vi_cv_path_luajit" != "X"; then |
| 541 | dnl -- find LuaJIT version |
| 542 | AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit, |
Bram Moolenaar | 49b1027 | 2013-11-21 12:17:51 +0100 | [diff] [blame] | 543 | [ vi_cv_version_luajit=`${vi_cv_path_luajit} -v 2>&1 | sed 's/LuaJIT \([[0-9.]]*\)\.[[0-9]]\(-[[a-z0-9]]*\)* .*/\1/'` ]) |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 544 | AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit, |
| 545 | [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ]) |
| 546 | vi_cv_path_lua="$vi_cv_path_luajit" |
| 547 | vi_cv_version_lua="$vi_cv_version_lua_luajit" |
| 548 | fi |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 549 | else |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 550 | dnl -- try to find Lua executable |
| 551 | AC_PATH_PROG(vi_cv_path_plain_lua, lua) |
| 552 | if test "X$vi_cv_path_plain_lua" != "X"; then |
| 553 | dnl -- find Lua version |
| 554 | AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua, |
| 555 | [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ]) |
| 556 | fi |
| 557 | vi_cv_path_lua="$vi_cv_path_plain_lua" |
| 558 | vi_cv_version_lua="$vi_cv_version_plain_lua" |
| 559 | fi |
| 560 | if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then |
| 561 | AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit) |
Bram Moolenaar | 49222be | 2015-12-11 18:11:30 +0100 | [diff] [blame] | 562 | if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 563 | AC_MSG_RESULT(yes) |
| 564 | LUA_INC=/luajit-$vi_cv_version_luajit |
| 565 | fi |
| 566 | fi |
| 567 | if test "X$LUA_INC" = "X"; then |
| 568 | AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include) |
Bram Moolenaar | 49222be | 2015-12-11 18:11:30 +0100 | [diff] [blame] | 569 | if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 570 | AC_MSG_RESULT(yes) |
Bram Moolenaar | 1e91f26 | 2012-10-03 14:48:08 +0200 | [diff] [blame] | 571 | else |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 572 | AC_MSG_RESULT(no) |
| 573 | AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua) |
Bram Moolenaar | 49222be | 2015-12-11 18:11:30 +0100 | [diff] [blame] | 574 | if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 575 | AC_MSG_RESULT(yes) |
| 576 | LUA_INC=/lua$vi_cv_version_lua |
| 577 | else |
| 578 | AC_MSG_RESULT(no) |
| 579 | vi_cv_path_lua_pfx= |
| 580 | fi |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 581 | fi |
| 582 | fi |
| 583 | fi |
| 584 | |
| 585 | if test "X$vi_cv_path_lua_pfx" != "X"; then |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 586 | if test "x$vi_cv_with_luajit" != "xno"; then |
| 587 | multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` |
| 588 | if test "X$multiarch" != "X"; then |
| 589 | lib_multiarch="lib/${multiarch}" |
| 590 | else |
| 591 | lib_multiarch="lib" |
| 592 | fi |
| 593 | if test "X$vi_cv_version_lua" = "X"; then |
| 594 | LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit" |
| 595 | else |
| 596 | LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua" |
| 597 | fi |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 598 | else |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 599 | if test "X$LUA_INC" != "X"; then |
| 600 | dnl Test alternate location using version |
| 601 | LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua" |
| 602 | else |
| 603 | LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua" |
| 604 | fi |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 605 | fi |
Bram Moolenaar | 2334b6d | 2010-07-22 21:32:16 +0200 | [diff] [blame] | 606 | if test "$enable_luainterp" = "dynamic"; then |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 607 | lua_ok="yes" |
| 608 | else |
| 609 | AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane]) |
| 610 | libs_save=$LIBS |
| 611 | LIBS="$LIBS $LUA_LIBS" |
| 612 | AC_TRY_LINK(,[ ], |
| 613 | AC_MSG_RESULT(yes); lua_ok="yes", |
| 614 | AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="") |
| 615 | LIBS=$libs_save |
| 616 | fi |
| 617 | if test "x$lua_ok" = "xyes"; then |
| 618 | LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}" |
| 619 | LUA_SRC="if_lua.c" |
| 620 | LUA_OBJ="objects/if_lua.o" |
| 621 | LUA_PRO="if_lua.pro" |
| 622 | AC_DEFINE(FEAT_LUA) |
| 623 | fi |
| 624 | if test "$enable_luainterp" = "dynamic"; then |
| 625 | if test "x$vi_cv_with_luajit" != "xno"; then |
| 626 | luajit="jit" |
| 627 | fi |
Bram Moolenaar | 1e91f26 | 2012-10-03 14:48:08 +0200 | [diff] [blame] | 628 | if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then |
| 629 | vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll" |
| 630 | else |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 631 | if test "x$MACOS_X" = "xyes"; then |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 632 | ext="dylib" |
| 633 | indexes="" |
| 634 | else |
| 635 | ext="so" |
| 636 | indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9" |
| 637 | multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null` |
| 638 | if test "X$multiarch" != "X"; then |
| 639 | lib_multiarch="lib/${multiarch}" |
| 640 | fi |
Bram Moolenaar | 768baac | 2013-04-15 14:44:57 +0200 | [diff] [blame] | 641 | fi |
| 642 | dnl Determine the sover for the current version, but fallback to |
| 643 | dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found. |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 644 | AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx) |
Bram Moolenaar | 768baac | 2013-04-15 14:44:57 +0200 | [diff] [blame] | 645 | for subdir in "${lib_multiarch}" lib64 lib; do |
| 646 | if test -z "$subdir"; then |
| 647 | continue |
| 648 | fi |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 649 | for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \ |
| 650 | ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do |
| 651 | for i in $indexes ""; do |
| 652 | if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then |
Bram Moolenaar | 768baac | 2013-04-15 14:44:57 +0200 | [diff] [blame] | 653 | sover2="$i" |
| 654 | break 3 |
| 655 | fi |
| 656 | done |
Bram Moolenaar | 07e1da6 | 2013-02-06 19:49:43 +0100 | [diff] [blame] | 657 | done |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 658 | sover="" |
Bram Moolenaar | 1e91f26 | 2012-10-03 14:48:08 +0200 | [diff] [blame] | 659 | done |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 660 | if test "X$sover" = "X"; then |
| 661 | AC_MSG_RESULT(no) |
| 662 | lua_ok="no" |
| 663 | vi_cv_dll_name_lua="liblua${luajit}.${ext}" |
| 664 | else |
| 665 | AC_MSG_RESULT(yes) |
| 666 | lua_ok="yes" |
| 667 | vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2" |
| 668 | fi |
Bram Moolenaar | 1e91f26 | 2012-10-03 14:48:08 +0200 | [diff] [blame] | 669 | fi |
Bram Moolenaar | 2334b6d | 2010-07-22 21:32:16 +0200 | [diff] [blame] | 670 | AC_DEFINE(DYNAMIC_LUA) |
| 671 | LUA_LIBS="" |
Bram Moolenaar | 1e91f26 | 2012-10-03 14:48:08 +0200 | [diff] [blame] | 672 | LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS" |
Bram Moolenaar | 2334b6d | 2010-07-22 21:32:16 +0200 | [diff] [blame] | 673 | fi |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 674 | if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \ |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 675 | test "x$MACOS_X" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \ |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 676 | test "`(uname -m) 2>/dev/null`" = "x86_64"; then |
| 677 | dnl OSX/x64 requires these flags. See http://luajit.org/install.html |
| 678 | LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS" |
| 679 | fi |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 680 | fi |
Bram Moolenaar | e855ccf | 2013-07-28 13:32:15 +0200 | [diff] [blame] | 681 | if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then |
Bram Moolenaar | f788a06 | 2011-12-14 20:51:25 +0100 | [diff] [blame] | 682 | AC_MSG_ERROR([could not configure lua]) |
| 683 | fi |
Bram Moolenaar | 0ba0429 | 2010-07-14 23:23:17 +0200 | [diff] [blame] | 684 | AC_SUBST(LUA_SRC) |
| 685 | AC_SUBST(LUA_OBJ) |
| 686 | AC_SUBST(LUA_PRO) |
| 687 | AC_SUBST(LUA_LIBS) |
| 688 | AC_SUBST(LUA_CFLAGS) |
| 689 | fi |
| 690 | |
| 691 | |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 692 | dnl Check for MzScheme feature. |
| 693 | AC_MSG_CHECKING(--enable-mzschemeinterp argument) |
| 694 | AC_ARG_ENABLE(mzschemeinterp, |
Bram Moolenaar | 8008b63 | 2017-07-18 21:33:20 +0200 | [diff] [blame] | 695 | [ --enable-mzschemeinterp Include MzScheme interpreter.], , |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 696 | [enable_mzschemeinterp="no"]) |
| 697 | AC_MSG_RESULT($enable_mzschemeinterp) |
| 698 | |
| 699 | if test "$enable_mzschemeinterp" = "yes"; then |
| 700 | dnl -- find the mzscheme executable |
| 701 | AC_SUBST(vi_cv_path_mzscheme) |
| 702 | |
| 703 | AC_MSG_CHECKING(--with-plthome argument) |
| 704 | AC_ARG_WITH(plthome, |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 705 | [ --with-plthome=PLTHOME Use PLTHOME.], |
| 706 | with_plthome="$withval"; AC_MSG_RESULT($with_plthome), |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 707 | with_plthome="";AC_MSG_RESULT("no")) |
| 708 | |
| 709 | if test "X$with_plthome" != "X"; then |
| 710 | vi_cv_path_mzscheme_pfx="$with_plthome" |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 711 | vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme" |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 712 | else |
| 713 | AC_MSG_CHECKING(PLTHOME environment var) |
| 714 | if test "X$PLTHOME" != "X"; then |
| 715 | AC_MSG_RESULT("$PLTHOME") |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 716 | vi_cv_path_mzscheme_pfx="$PLTHOME" |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 717 | vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme" |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 718 | else |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 719 | AC_MSG_RESULT(not set) |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 720 | dnl -- try to find MzScheme executable |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 721 | AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme) |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 722 | |
| 723 | dnl resolve symbolic link, the executable is often elsewhere and there |
| 724 | dnl are no links for the include files. |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 725 | if test "X$vi_cv_path_mzscheme" != "X"; then |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 726 | lsout=`ls -l $vi_cv_path_mzscheme` |
| 727 | if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then |
| 728 | vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'` |
| 729 | fi |
| 730 | fi |
| 731 | |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 732 | if test "X$vi_cv_path_mzscheme" != "X"; then |
| 733 | dnl -- find where MzScheme thinks it was installed |
| 734 | AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx, |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 735 | dnl different versions of MzScheme differ in command line processing |
| 736 | dnl use universal approach |
| 737 | echo "(display (simplify-path \ |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 738 | (build-path (call-with-values \ |
| 739 | (lambda () (split-path (find-system-path (quote exec-file)))) \ |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 740 | (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm |
| 741 | dnl Remove a trailing slash |
| 742 | [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \ |
| 743 | sed -e 's+/$++'` ]) |
| 744 | rm -f mzdirs.scm |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 745 | fi |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 746 | fi |
| 747 | fi |
| 748 | |
| 749 | if test "X$vi_cv_path_mzscheme_pfx" != "X"; then |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 750 | AC_MSG_CHECKING(for racket include directory) |
| 751 | SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'` |
| 752 | if test "X$SCHEME_INC" != "X"; then |
| 753 | AC_MSG_RESULT(${SCHEME_INC}) |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 754 | else |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 755 | AC_MSG_RESULT(not found) |
| 756 | AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include) |
| 757 | if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then |
| 758 | SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 759 | AC_MSG_RESULT(yes) |
Bram Moolenaar | d7afed3 | 2007-05-06 13:26:41 +0000 | [diff] [blame] | 760 | else |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 761 | AC_MSG_RESULT(no) |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 762 | AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt) |
| 763 | if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 764 | AC_MSG_RESULT(yes) |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 765 | SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 766 | else |
| 767 | AC_MSG_RESULT(no) |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 768 | AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket) |
| 769 | if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 770 | AC_MSG_RESULT(yes) |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 771 | SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 772 | else |
| 773 | AC_MSG_RESULT(no) |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 774 | AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/) |
| 775 | if test -f /usr/include/plt/scheme.h; then |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 776 | AC_MSG_RESULT(yes) |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 777 | SCHEME_INC=/usr/include/plt |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 778 | else |
| 779 | AC_MSG_RESULT(no) |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 780 | AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/) |
| 781 | if test -f /usr/include/racket/scheme.h; then |
| 782 | AC_MSG_RESULT(yes) |
| 783 | SCHEME_INC=/usr/include/racket |
| 784 | else |
| 785 | AC_MSG_RESULT(no) |
| 786 | vi_cv_path_mzscheme_pfx= |
| 787 | fi |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 788 | fi |
| 789 | fi |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 790 | fi |
Bram Moolenaar | d7afed3 | 2007-05-06 13:26:41 +0000 | [diff] [blame] | 791 | fi |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 792 | fi |
| 793 | fi |
| 794 | |
| 795 | if test "X$vi_cv_path_mzscheme_pfx" != "X"; then |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 796 | |
| 797 | AC_MSG_CHECKING(for racket lib directory) |
| 798 | SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'` |
| 799 | if test "X$SCHEME_LIB" != "X"; then |
| 800 | AC_MSG_RESULT(${SCHEME_LIB}) |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 801 | else |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 802 | AC_MSG_RESULT(not found) |
| 803 | fi |
| 804 | |
| 805 | for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do |
| 806 | if test "X$path" != "X"; then |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 807 | if test "x$MACOS_X" = "xyes"; then |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 808 | MZSCHEME_LIBS="-framework Racket" |
| 809 | MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" |
| 810 | elif test -f "${path}/libmzscheme3m.a"; then |
| 811 | MZSCHEME_LIBS="${path}/libmzscheme3m.a" |
| 812 | MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" |
| 813 | elif test -f "${path}/libracket3m.a"; then |
| 814 | MZSCHEME_LIBS="${path}/libracket3m.a" |
| 815 | MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" |
| 816 | elif test -f "${path}/libracket.a"; then |
| 817 | MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a" |
| 818 | elif test -f "${path}/libmzscheme.a"; then |
| 819 | MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a" |
| 820 | else |
| 821 | dnl Using shared objects |
| 822 | if test -f "${path}/libmzscheme3m.so"; then |
| 823 | MZSCHEME_LIBS="-L${path} -lmzscheme3m" |
| 824 | MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" |
| 825 | elif test -f "${path}/libracket3m.so"; then |
| 826 | MZSCHEME_LIBS="-L${path} -lracket3m" |
| 827 | MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" |
| 828 | elif test -f "${path}/libracket.so"; then |
| 829 | MZSCHEME_LIBS="-L${path} -lracket -lmzgc" |
| 830 | else |
| 831 | dnl try next until last |
| 832 | if test "$path" != "$SCHEME_LIB"; then |
| 833 | continue |
| 834 | fi |
| 835 | MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc" |
| 836 | fi |
| 837 | if test "$GCC" = yes; then |
| 838 | dnl Make Vim remember the path to the library. For when it's not in |
| 839 | dnl $LD_LIBRARY_PATH. |
| 840 | MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}" |
| 841 | elif test "`(uname) 2>/dev/null`" = SunOS && |
| 842 | uname -r | grep '^5' >/dev/null; then |
| 843 | MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}" |
| 844 | fi |
| 845 | fi |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 846 | fi |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 847 | if test "X$MZSCHEME_LIBS" != "X"; then |
| 848 | break |
Bram Moolenaar | 2df6dcc | 2004-07-12 15:53:54 +0000 | [diff] [blame] | 849 | fi |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 850 | done |
| 851 | |
| 852 | AC_MSG_CHECKING([if racket requires -pthread]) |
| 853 | if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then |
| 854 | AC_MSG_RESULT(yes) |
| 855 | MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread" |
| 856 | MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread" |
| 857 | else |
| 858 | AC_MSG_RESULT(no) |
| 859 | fi |
| 860 | |
| 861 | AC_MSG_CHECKING(for racket config directory) |
| 862 | SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'` |
| 863 | if test "X$SCHEME_CONFIGDIR" != "X"; then |
| 864 | MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'" |
| 865 | AC_MSG_RESULT(${SCHEME_CONFIGDIR}) |
| 866 | else |
| 867 | AC_MSG_RESULT(not found) |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 868 | fi |
Bram Moolenaar | fe9fb92 | 2012-11-23 21:54:48 +0100 | [diff] [blame] | 869 | |
| 870 | AC_MSG_CHECKING(for racket collects directory) |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 871 | 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))))'` |
| 872 | if test "X$SCHEME_COLLECTS" = "X"; then |
| 873 | if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then |
| 874 | SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/ |
Bram Moolenaar | fe9fb92 | 2012-11-23 21:54:48 +0100 | [diff] [blame] | 875 | else |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 876 | if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then |
| 877 | SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ |
Bram Moolenaar | 7567646 | 2013-01-30 14:55:42 +0100 | [diff] [blame] | 878 | else |
Bram Moolenaar | 4e640bd | 2016-01-16 16:20:38 +0100 | [diff] [blame] | 879 | if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then |
| 880 | SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/ |
| 881 | else |
| 882 | if test -d "$vi_cv_path_mzscheme_pfx/collects"; then |
| 883 | SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/ |
| 884 | fi |
Bram Moolenaar | 7567646 | 2013-01-30 14:55:42 +0100 | [diff] [blame] | 885 | fi |
Bram Moolenaar | fe9fb92 | 2012-11-23 21:54:48 +0100 | [diff] [blame] | 886 | fi |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 887 | fi |
Bram Moolenaar | d7afed3 | 2007-05-06 13:26:41 +0000 | [diff] [blame] | 888 | fi |
Bram Moolenaar | fe9fb92 | 2012-11-23 21:54:48 +0100 | [diff] [blame] | 889 | if test "X$SCHEME_COLLECTS" != "X" ; then |
| 890 | AC_MSG_RESULT(${SCHEME_COLLECTS}) |
| 891 | else |
| 892 | AC_MSG_RESULT(not found) |
| 893 | fi |
| 894 | |
| 895 | AC_MSG_CHECKING(for mzscheme_base.c) |
| 896 | if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 897 | MZSCHEME_EXTRA="mzscheme_base.c" |
Bram Moolenaar | 45e2bcc | 2014-02-15 17:19:00 +0100 | [diff] [blame] | 898 | MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" |
| 899 | MZSCHEME_MOD="++lib scheme/base" |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 900 | else |
Bram Moolenaar | fe9fb92 | 2012-11-23 21:54:48 +0100 | [diff] [blame] | 901 | if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 902 | MZSCHEME_EXTRA="mzscheme_base.c" |
Bram Moolenaar | 45e2bcc | 2014-02-15 17:19:00 +0100 | [diff] [blame] | 903 | MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc" |
| 904 | MZSCHEME_MOD="++lib scheme/base" |
| 905 | else |
| 906 | if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then |
| 907 | MZSCHEME_EXTRA="mzscheme_base.c" |
| 908 | MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool" |
| 909 | MZSCHEME_MOD="" |
| 910 | fi |
Bram Moolenaar | 2d0860d | 2010-11-03 21:59:30 +0100 | [diff] [blame] | 911 | fi |
| 912 | fi |
| 913 | if test "X$MZSCHEME_EXTRA" != "X" ; then |
| 914 | dnl need to generate bytecode for MzScheme base |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 915 | MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE" |
Bram Moolenaar | fe9fb92 | 2012-11-23 21:54:48 +0100 | [diff] [blame] | 916 | AC_MSG_RESULT(needed) |
| 917 | else |
| 918 | AC_MSG_RESULT(not needed) |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 919 | fi |
Bram Moolenaar | fe9fb92 | 2012-11-23 21:54:48 +0100 | [diff] [blame] | 920 | |
Bram Moolenaar | 9e90219 | 2013-07-17 18:58:11 +0200 | [diff] [blame] | 921 | dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'". |
| 922 | AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"]) |
| 923 | |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 924 | MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \ |
Bram Moolenaar | fe9fb92 | 2012-11-23 21:54:48 +0100 | [diff] [blame] | 925 | -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'" |
Bram Moolenaar | 9e90219 | 2013-07-17 18:58:11 +0200 | [diff] [blame] | 926 | |
| 927 | dnl Test that we can compile a simple program with these CFLAGS and LIBS. |
| 928 | AC_MSG_CHECKING([if compile and link flags for MzScheme are sane]) |
| 929 | cflags_save=$CFLAGS |
| 930 | libs_save=$LIBS |
| 931 | CFLAGS="$CFLAGS $MZSCHEME_CFLAGS" |
| 932 | LIBS="$LIBS $MZSCHEME_LIBS" |
| 933 | AC_TRY_LINK(,[ ], |
| 934 | AC_MSG_RESULT(yes); mzs_ok=yes, |
| 935 | AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no) |
| 936 | CFLAGS=$cflags_save |
| 937 | LIBS=$libs_save |
| 938 | if test $mzs_ok = yes; then |
| 939 | MZSCHEME_SRC="if_mzsch.c" |
| 940 | MZSCHEME_OBJ="objects/if_mzsch.o" |
| 941 | MZSCHEME_PRO="if_mzsch.pro" |
| 942 | AC_DEFINE(FEAT_MZSCHEME) |
| 943 | else |
| 944 | MZSCHEME_CFLAGS= |
| 945 | MZSCHEME_LIBS= |
| 946 | MZSCHEME_EXTRA= |
| 947 | MZSCHEME_MZC= |
| 948 | fi |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 949 | fi |
| 950 | AC_SUBST(MZSCHEME_SRC) |
| 951 | AC_SUBST(MZSCHEME_OBJ) |
| 952 | AC_SUBST(MZSCHEME_PRO) |
| 953 | AC_SUBST(MZSCHEME_LIBS) |
| 954 | AC_SUBST(MZSCHEME_CFLAGS) |
Bram Moolenaar | 9e70cf1 | 2009-05-26 20:59:55 +0000 | [diff] [blame] | 955 | AC_SUBST(MZSCHEME_EXTRA) |
| 956 | AC_SUBST(MZSCHEME_MZC) |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 957 | fi |
| 958 | |
| 959 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 960 | AC_MSG_CHECKING(--enable-perlinterp argument) |
| 961 | AC_ARG_ENABLE(perlinterp, |
Bram Moolenaar | e06c188 | 2010-07-21 22:05:20 +0200 | [diff] [blame] | 962 | [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], , |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 963 | [enable_perlinterp="no"]) |
| 964 | AC_MSG_RESULT($enable_perlinterp) |
Bram Moolenaar | e06c188 | 2010-07-21 22:05:20 +0200 | [diff] [blame] | 965 | if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then |
Bram Moolenaar | 3c124e3 | 2016-01-31 14:36:58 +0100 | [diff] [blame] | 966 | if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then |
| 967 | AC_MSG_ERROR([cannot use Perl with tiny or small features]) |
| 968 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 969 | AC_SUBST(vi_cv_path_perl) |
| 970 | AC_PATH_PROG(vi_cv_path_perl, perl) |
| 971 | if test "X$vi_cv_path_perl" != "X"; then |
| 972 | AC_MSG_CHECKING(Perl version) |
| 973 | if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then |
| 974 | eval `$vi_cv_path_perl -V:usethreads` |
Bram Moolenaar | e06c188 | 2010-07-21 22:05:20 +0200 | [diff] [blame] | 975 | eval `$vi_cv_path_perl -V:libperl` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 976 | if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then |
| 977 | badthreads=no |
| 978 | else |
| 979 | if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then |
| 980 | eval `$vi_cv_path_perl -V:use5005threads` |
| 981 | if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then |
| 982 | badthreads=no |
| 983 | else |
| 984 | badthreads=yes |
| 985 | AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<) |
| 986 | fi |
| 987 | else |
| 988 | badthreads=yes |
| 989 | AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<) |
| 990 | fi |
| 991 | fi |
| 992 | if test $badthreads = no; then |
| 993 | AC_MSG_RESULT(OK) |
| 994 | eval `$vi_cv_path_perl -V:shrpenv` |
| 995 | if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04 |
| 996 | shrpenv="" |
| 997 | fi |
| 998 | vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'` |
| 999 | AC_SUBST(vi_cv_perllib) |
Bram Moolenaar | d5f62b1 | 2014-08-17 17:05:44 +0200 | [diff] [blame] | 1000 | vi_cv_perl_extutils=unknown_perl_extutils_path |
| 1001 | for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do |
| 1002 | xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" |
| 1003 | if test -f "$xsubpp_path"; then |
| 1004 | vi_cv_perl_xsubpp="$xsubpp_path" |
| 1005 | fi |
| 1006 | done |
| 1007 | AC_SUBST(vi_cv_perl_xsubpp) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1008 | dnl Remove "-fno-something", it breaks using cproto. |
Bram Moolenaar | 280a868 | 2015-06-21 13:41:08 +0200 | [diff] [blame] | 1009 | dnl Remove "-fdebug-prefix-map", it isn't supported by clang. |
Bram Moolenaar | e8ff56b | 2017-09-14 23:06:23 +0200 | [diff] [blame] | 1010 | dnl Remove "FORTIFY_SOURCE", it will be defined twice. |
Bram Moolenaar | 1ec96c9 | 2017-09-27 21:42:08 +0200 | [diff] [blame] | 1011 | dnl remove -pipe and -Wxxx, it confuses cproto |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1012 | perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ |
Bram Moolenaar | e8ff56b | 2017-09-14 23:06:23 +0200 | [diff] [blame] | 1013 | -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \ |
| 1014 | -e 's/-fdebug-prefix-map[[^ ]]*//g' \ |
Bram Moolenaar | 1ec96c9 | 2017-09-27 21:42:08 +0200 | [diff] [blame] | 1015 | -e 's/-pipe //' \ |
| 1016 | -e 's/-W[[^ ]]*//g' \ |
| 1017 | -e 's/-D_FORTIFY_SOURCE=.//g'` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1018 | dnl Remove "-lc", it breaks on FreeBSD when using "-pthread". |
| 1019 | perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \ |
| 1020 | sed -e '/Warning/d' -e '/Note (probably harmless)/d' \ |
| 1021 | -e 's/-bE:perl.exp//' -e 's/-lc //'` |
| 1022 | dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH |
| 1023 | dnl a test in configure may fail because of that. |
| 1024 | perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \ |
| 1025 | -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'` |
| 1026 | |
| 1027 | dnl check that compiling a simple program still works with the flags |
| 1028 | dnl added for Perl. |
| 1029 | AC_MSG_CHECKING([if compile and link flags for Perl are sane]) |
| 1030 | cflags_save=$CFLAGS |
| 1031 | libs_save=$LIBS |
| 1032 | ldflags_save=$LDFLAGS |
| 1033 | CFLAGS="$CFLAGS $perlcppflags" |
| 1034 | LIBS="$LIBS $perllibs" |
Bram Moolenaar | a6cc031 | 2013-06-18 23:31:55 +0200 | [diff] [blame] | 1035 | perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1036 | LDFLAGS="$perlldflags $LDFLAGS" |
| 1037 | AC_TRY_LINK(,[ ], |
| 1038 | AC_MSG_RESULT(yes); perl_ok=yes, |
| 1039 | AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no) |
| 1040 | CFLAGS=$cflags_save |
| 1041 | LIBS=$libs_save |
| 1042 | LDFLAGS=$ldflags_save |
| 1043 | if test $perl_ok = yes; then |
| 1044 | if test "X$perlcppflags" != "X"; then |
Bram Moolenaar | 1ec96c9 | 2017-09-27 21:42:08 +0200 | [diff] [blame] | 1045 | PERL_CFLAGS=$perlcppflags |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1046 | fi |
| 1047 | if test "X$perlldflags" != "X"; then |
Bram Moolenaar | 2bcaec3 | 2014-03-27 18:51:11 +0100 | [diff] [blame] | 1048 | if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then |
Bram Moolenaar | a6cc031 | 2013-06-18 23:31:55 +0200 | [diff] [blame] | 1049 | LDFLAGS="$perlldflags $LDFLAGS" |
| 1050 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1051 | fi |
| 1052 | PERL_LIBS=$perllibs |
| 1053 | PERL_SRC="auto/if_perl.c if_perlsfio.c" |
| 1054 | PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o" |
| 1055 | PERL_PRO="if_perl.pro if_perlsfio.pro" |
| 1056 | AC_DEFINE(FEAT_PERL) |
| 1057 | fi |
| 1058 | fi |
| 1059 | else |
| 1060 | AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<) |
| 1061 | fi |
| 1062 | fi |
| 1063 | |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 1064 | if test "x$MACOS_X" = "xyes"; then |
Bram Moolenaar | 9372a11 | 2005-12-06 19:59:18 +0000 | [diff] [blame] | 1065 | dnl Mac OS X 10.2 or later |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1066 | dir=/System/Library/Perl |
| 1067 | darwindir=$dir/darwin |
| 1068 | if test -d $darwindir; then |
| 1069 | PERL=/usr/bin/perl |
| 1070 | else |
| 1071 | dnl Mac OS X 10.3 |
| 1072 | dir=/System/Library/Perl/5.8.1 |
| 1073 | darwindir=$dir/darwin-thread-multi-2level |
| 1074 | if test -d $darwindir; then |
| 1075 | PERL=/usr/bin/perl |
| 1076 | fi |
| 1077 | fi |
| 1078 | if test -n "$PERL"; then |
| 1079 | PERL_DIR="$dir" |
| 1080 | PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE" |
| 1081 | PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a" |
| 1082 | PERL_LIBS="-L$darwindir/CORE -lperl" |
| 1083 | fi |
Bram Moolenaar | 5dff57d | 2010-07-24 16:19:44 +0200 | [diff] [blame] | 1084 | dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only |
| 1085 | dnl be included if requested by passing --with-mac-arch to |
| 1086 | dnl configure, so strip these flags first (if present) |
| 1087 | PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` |
| 1088 | PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1089 | fi |
Bram Moolenaar | e06c188 | 2010-07-21 22:05:20 +0200 | [diff] [blame] | 1090 | if test "$enable_perlinterp" = "dynamic"; then |
| 1091 | if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then |
| 1092 | AC_DEFINE(DYNAMIC_PERL) |
| 1093 | PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS" |
| 1094 | fi |
| 1095 | fi |
Bram Moolenaar | f788a06 | 2011-12-14 20:51:25 +0100 | [diff] [blame] | 1096 | |
| 1097 | if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then |
| 1098 | AC_MSG_ERROR([could not configure perl]) |
| 1099 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1100 | fi |
| 1101 | AC_SUBST(shrpenv) |
| 1102 | AC_SUBST(PERL_SRC) |
| 1103 | AC_SUBST(PERL_OBJ) |
| 1104 | AC_SUBST(PERL_PRO) |
| 1105 | AC_SUBST(PERL_CFLAGS) |
| 1106 | AC_SUBST(PERL_LIBS) |
| 1107 | |
| 1108 | AC_MSG_CHECKING(--enable-pythoninterp argument) |
| 1109 | AC_ARG_ENABLE(pythoninterp, |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1110 | [ --enable-pythoninterp[=OPTS] Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], , |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1111 | [enable_pythoninterp="no"]) |
| 1112 | AC_MSG_RESULT($enable_pythoninterp) |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1113 | if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then |
Bram Moolenaar | 0b10541 | 2014-11-30 13:34:23 +0100 | [diff] [blame] | 1114 | if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then |
| 1115 | AC_MSG_ERROR([cannot use Python with tiny or small features]) |
| 1116 | fi |
| 1117 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1118 | dnl -- find the python executable |
Bram Moolenaar | 09ba6d7 | 2012-12-12 14:25:05 +0100 | [diff] [blame] | 1119 | AC_PATH_PROGS(vi_cv_path_python, python2 python) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1120 | if test "X$vi_cv_path_python" != "X"; then |
| 1121 | |
| 1122 | dnl -- get its version number |
| 1123 | AC_CACHE_CHECK(Python version,vi_cv_var_python_version, |
| 1124 | [[vi_cv_var_python_version=` |
| 1125 | ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'` |
| 1126 | ]]) |
| 1127 | |
Bram Moolenaar | c09a6d6 | 2013-06-10 21:27:29 +0200 | [diff] [blame] | 1128 | dnl -- it must be at least version 2.3 |
| 1129 | AC_MSG_CHECKING(Python is 2.3 or better) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1130 | if ${vi_cv_path_python} -c \ |
Bram Moolenaar | c09a6d6 | 2013-06-10 21:27:29 +0200 | [diff] [blame] | 1131 | "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1132 | then |
| 1133 | AC_MSG_RESULT(yep) |
| 1134 | |
| 1135 | dnl -- find where python thinks it was installed |
| 1136 | AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx, |
| 1137 | [ vi_cv_path_python_pfx=` |
| 1138 | ${vi_cv_path_python} -c \ |
| 1139 | "import sys; print sys.prefix"` ]) |
| 1140 | |
| 1141 | dnl -- and where it thinks it runs |
| 1142 | AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx, |
| 1143 | [ vi_cv_path_python_epfx=` |
| 1144 | ${vi_cv_path_python} -c \ |
| 1145 | "import sys; print sys.exec_prefix"` ]) |
| 1146 | |
| 1147 | dnl -- python's internal library path |
| 1148 | |
| 1149 | AC_CACHE_VAL(vi_cv_path_pythonpath, |
| 1150 | [ vi_cv_path_pythonpath=` |
| 1151 | unset PYTHONPATH; |
| 1152 | ${vi_cv_path_python} -c \ |
| 1153 | "import sys, string; print string.join(sys.path,':')"` ]) |
| 1154 | |
| 1155 | dnl -- where the Python implementation library archives are |
| 1156 | |
| 1157 | AC_ARG_WITH(python-config-dir, |
| 1158 | [ --with-python-config-dir=PATH Python's config directory], |
| 1159 | [ vi_cv_path_python_conf="${withval}" ] ) |
| 1160 | |
| 1161 | AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf, |
| 1162 | [ |
| 1163 | vi_cv_path_python_conf= |
Bram Moolenaar | ac499e3 | 2013-06-02 19:14:17 +0200 | [diff] [blame] | 1164 | d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"` |
| 1165 | if test -d "$d" && test -f "$d/config.c"; then |
| 1166 | vi_cv_path_python_conf="$d" |
| 1167 | else |
| 1168 | for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do |
| 1169 | for subdir in lib64 lib share; do |
| 1170 | d="${path}/${subdir}/python${vi_cv_var_python_version}/config" |
| 1171 | if test -d "$d" && test -f "$d/config.c"; then |
| 1172 | vi_cv_path_python_conf="$d" |
| 1173 | fi |
| 1174 | done |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1175 | done |
Bram Moolenaar | ac499e3 | 2013-06-02 19:14:17 +0200 | [diff] [blame] | 1176 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1177 | ]) |
| 1178 | |
| 1179 | PYTHON_CONFDIR="${vi_cv_path_python_conf}" |
| 1180 | |
| 1181 | if test "X$PYTHON_CONFDIR" = "X"; then |
| 1182 | AC_MSG_RESULT([can't find it!]) |
| 1183 | else |
| 1184 | |
| 1185 | dnl -- we need to examine Python's config/Makefile too |
| 1186 | dnl see what the interpreter is built from |
| 1187 | AC_CACHE_VAL(vi_cv_path_python_plibs, |
| 1188 | [ |
Bram Moolenaar | 01dd60c | 2008-07-24 14:24:48 +0000 | [diff] [blame] | 1189 | pwd=`pwd` |
| 1190 | tmp_mkf="$pwd/config-PyMake$$" |
| 1191 | cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1192 | __: |
Bram Moolenaar | 218116c | 2010-05-20 21:46:00 +0200 | [diff] [blame] | 1193 | @echo "python_BASEMODLIBS='$(BASEMODLIBS)'" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1194 | @echo "python_LIBS='$(LIBS)'" |
| 1195 | @echo "python_SYSLIBS='$(SYSLIBS)'" |
| 1196 | @echo "python_LINKFORSHARED='$(LINKFORSHARED)'" |
Bram Moolenaar | f94a13c | 2012-09-21 13:26:49 +0200 | [diff] [blame] | 1197 | @echo "python_DLLLIBRARY='$(DLLLIBRARY)'" |
Bram Moolenaar | 2a7e2a6 | 2010-07-24 15:19:11 +0200 | [diff] [blame] | 1198 | @echo "python_INSTSONAME='$(INSTSONAME)'" |
Bram Moolenaar | 6c92755 | 2015-03-24 12:21:33 +0100 | [diff] [blame] | 1199 | @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'" |
| 1200 | @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'" |
| 1201 | @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1202 | eof |
| 1203 | dnl -- delete the lines from make about Entering/Leaving directory |
Bram Moolenaar | 01dd60c | 2008-07-24 14:24:48 +0000 | [diff] [blame] | 1204 | eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" |
| 1205 | rm -f -- "${tmp_mkf}" |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 1206 | if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1207 | "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then |
| 1208 | vi_cv_path_python_plibs="-framework Python" |
Bram Moolenaar | 6c92755 | 2015-03-24 12:21:33 +0100 | [diff] [blame] | 1209 | if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then |
| 1210 | vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python" |
| 1211 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1212 | else |
| 1213 | if test "${vi_cv_var_python_version}" = "1.4"; then |
| 1214 | vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a" |
| 1215 | else |
| 1216 | vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" |
| 1217 | fi |
Bram Moolenaar | 6c92755 | 2015-03-24 12:21:33 +0100 | [diff] [blame] | 1218 | dnl -- Check if the path contained in python_LINKFORSHARED is |
| 1219 | dnl usable for vim build. If not, make and try other |
| 1220 | dnl candidates. |
Bram Moolenaar | a161e26 | 2015-03-24 15:14:27 +0100 | [diff] [blame] | 1221 | if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then |
Bram Moolenaar | 6c92755 | 2015-03-24 12:21:33 +0100 | [diff] [blame] | 1222 | python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'` |
| 1223 | python_link_path=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]][[ \t]]*\(.*\)/\2/'` |
| 1224 | if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then |
| 1225 | dnl -- The path looks relative. Guess the absolute one using |
| 1226 | dnl the prefix and try that. |
| 1227 | python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}" |
| 1228 | if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then |
| 1229 | dnl -- A last resort. |
| 1230 | python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}" |
| 1231 | dnl -- No check is done. The last word is left to the |
| 1232 | dnl "sanity" test on link flags that follows shortly. |
| 1233 | fi |
| 1234 | python_LINKFORSHARED="${python_link_symbol} ${python_link_path}" |
| 1235 | fi |
| 1236 | fi |
Bram Moolenaar | 218116c | 2010-05-20 21:46:00 +0200 | [diff] [blame] | 1237 | vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1238 | dnl remove -ltermcap, it can conflict with an earlier -lncurses |
| 1239 | vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//` |
| 1240 | fi |
| 1241 | ]) |
Bram Moolenaar | ba59ddb | 2016-01-28 15:34:25 +0100 | [diff] [blame] | 1242 | AC_CACHE_CHECK(Python's dll name,vi_cv_dll_name_python, |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1243 | [ |
| 1244 | if test "X$python_DLLLIBRARY" != "X"; then |
| 1245 | vi_cv_dll_name_python="$python_DLLLIBRARY" |
| 1246 | else |
| 1247 | vi_cv_dll_name_python="$python_INSTSONAME" |
| 1248 | fi |
| 1249 | ]) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1250 | |
| 1251 | PYTHON_LIBS="${vi_cv_path_python_plibs}" |
| 1252 | if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then |
Bram Moolenaar | 780c3e9 | 2013-06-11 20:53:28 +0200 | [diff] [blame] | 1253 | PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1254 | else |
Bram Moolenaar | 780c3e9 | 2013-06-11 20:53:28 +0200 | [diff] [blame] | 1255 | 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}\"'" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1256 | fi |
| 1257 | PYTHON_SRC="if_python.c" |
Bram Moolenaar | 9bdb9a0 | 2012-07-25 16:32:08 +0200 | [diff] [blame] | 1258 | PYTHON_OBJ="objects/if_python.o" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1259 | if test "${vi_cv_var_python_version}" = "1.4"; then |
| 1260 | PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" |
| 1261 | fi |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1262 | PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1263 | |
| 1264 | dnl On FreeBSD linking with "-pthread" is required to use threads. |
| 1265 | dnl _THREAD_SAFE must be used for compiling then. |
| 1266 | dnl The "-pthread" is added to $LIBS, so that the following check for |
| 1267 | dnl sigaltstack() will look in libc_r (it's there in libc!). |
| 1268 | dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC |
| 1269 | dnl will then define target-specific defines, e.g., -D_REENTRANT. |
| 1270 | dnl Don't do this for Mac OSX, -pthread will generate a warning. |
| 1271 | AC_MSG_CHECKING([if -pthread should be used]) |
| 1272 | threadsafe_flag= |
| 1273 | thread_lib= |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 1274 | dnl if test "x$MACOS_X" != "xyes"; then |
Bram Moolenaar | a1b5aa5 | 2006-10-10 09:41:28 +0000 | [diff] [blame] | 1275 | if test "`(uname) 2>/dev/null`" != Darwin; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1276 | test "$GCC" = yes && threadsafe_flag="-pthread" |
| 1277 | if test "`(uname) 2>/dev/null`" = FreeBSD; then |
| 1278 | threadsafe_flag="-D_THREAD_SAFE" |
| 1279 | thread_lib="-pthread" |
| 1280 | fi |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1281 | if test "`(uname) 2>/dev/null`" = SunOS; then |
| 1282 | threadsafe_flag="-pthreads" |
| 1283 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1284 | fi |
| 1285 | libs_save_old=$LIBS |
| 1286 | if test -n "$threadsafe_flag"; then |
| 1287 | cflags_save=$CFLAGS |
| 1288 | CFLAGS="$CFLAGS $threadsafe_flag" |
| 1289 | LIBS="$LIBS $thread_lib" |
| 1290 | AC_TRY_LINK(,[ ], |
Bram Moolenaar | 69f787a | 2010-07-11 20:52:58 +0200 | [diff] [blame] | 1291 | AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag", |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1292 | AC_MSG_RESULT(no); LIBS=$libs_save_old |
| 1293 | ) |
| 1294 | CFLAGS=$cflags_save |
| 1295 | else |
| 1296 | AC_MSG_RESULT(no) |
| 1297 | fi |
| 1298 | |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1299 | dnl Check that compiling a simple program still works with the flags |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1300 | dnl added for Python. |
| 1301 | AC_MSG_CHECKING([if compile and link flags for Python are sane]) |
| 1302 | cflags_save=$CFLAGS |
| 1303 | libs_save=$LIBS |
Bram Moolenaar | 69f787a | 2010-07-11 20:52:58 +0200 | [diff] [blame] | 1304 | CFLAGS="$CFLAGS $PYTHON_CFLAGS" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1305 | LIBS="$LIBS $PYTHON_LIBS" |
| 1306 | AC_TRY_LINK(,[ ], |
| 1307 | AC_MSG_RESULT(yes); python_ok=yes, |
| 1308 | AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no) |
| 1309 | CFLAGS=$cflags_save |
| 1310 | LIBS=$libs_save |
| 1311 | if test $python_ok = yes; then |
| 1312 | AC_DEFINE(FEAT_PYTHON) |
| 1313 | else |
| 1314 | LIBS=$libs_save_old |
| 1315 | PYTHON_SRC= |
| 1316 | PYTHON_OBJ= |
| 1317 | PYTHON_LIBS= |
| 1318 | PYTHON_CFLAGS= |
| 1319 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1320 | fi |
| 1321 | else |
| 1322 | AC_MSG_RESULT(too old) |
| 1323 | fi |
| 1324 | fi |
Bram Moolenaar | f788a06 | 2011-12-14 20:51:25 +0100 | [diff] [blame] | 1325 | |
| 1326 | if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then |
| 1327 | AC_MSG_ERROR([could not configure python]) |
| 1328 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1329 | fi |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1330 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1331 | AC_SUBST(PYTHON_CONFDIR) |
| 1332 | AC_SUBST(PYTHON_LIBS) |
| 1333 | AC_SUBST(PYTHON_GETPATH_CFLAGS) |
| 1334 | AC_SUBST(PYTHON_CFLAGS) |
| 1335 | AC_SUBST(PYTHON_SRC) |
| 1336 | AC_SUBST(PYTHON_OBJ) |
| 1337 | |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1338 | |
| 1339 | AC_MSG_CHECKING(--enable-python3interp argument) |
| 1340 | AC_ARG_ENABLE(python3interp, |
Bram Moolenaar | 8008b63 | 2017-07-18 21:33:20 +0200 | [diff] [blame] | 1341 | [ --enable-python3interp[=OPTS] Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], , |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1342 | [enable_python3interp="no"]) |
| 1343 | AC_MSG_RESULT($enable_python3interp) |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1344 | if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then |
Bram Moolenaar | 0b10541 | 2014-11-30 13:34:23 +0100 | [diff] [blame] | 1345 | if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then |
| 1346 | AC_MSG_ERROR([cannot use Python with tiny or small features]) |
| 1347 | fi |
| 1348 | |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1349 | dnl -- find the python3 executable |
Bram Moolenaar | 09ba6d7 | 2012-12-12 14:25:05 +0100 | [diff] [blame] | 1350 | AC_PATH_PROGS(vi_cv_path_python3, python3 python) |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1351 | if test "X$vi_cv_path_python3" != "X"; then |
| 1352 | |
| 1353 | dnl -- get its version number |
| 1354 | AC_CACHE_CHECK(Python version,vi_cv_var_python3_version, |
| 1355 | [[vi_cv_var_python3_version=` |
Bram Moolenaar | 3804aeb | 2010-07-19 21:18:54 +0200 | [diff] [blame] | 1356 | ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'` |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1357 | ]]) |
| 1358 | |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1359 | dnl -- it must be at least version 3 |
| 1360 | AC_MSG_CHECKING(Python is 3.0 or better) |
| 1361 | if ${vi_cv_path_python3} -c \ |
| 1362 | "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)" |
| 1363 | then |
| 1364 | AC_MSG_RESULT(yep) |
Bram Moolenaar | 456f2bb | 2011-06-12 21:37:13 +0200 | [diff] [blame] | 1365 | |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1366 | dnl -- get abiflags for python 3.2 or higher (PEP 3149) |
| 1367 | AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags, |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1368 | [ |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1369 | vi_cv_var_python3_abiflags= |
| 1370 | if ${vi_cv_path_python3} -c \ |
| 1371 | "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)" |
| 1372 | then |
| 1373 | vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \ |
| 1374 | "import sys; print(sys.abiflags)"` |
| 1375 | fi ]) |
| 1376 | |
| 1377 | dnl -- find where python3 thinks it was installed |
| 1378 | AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx, |
| 1379 | [ vi_cv_path_python3_pfx=` |
| 1380 | ${vi_cv_path_python3} -c \ |
| 1381 | "import sys; print(sys.prefix)"` ]) |
| 1382 | |
| 1383 | dnl -- and where it thinks it runs |
| 1384 | AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx, |
| 1385 | [ vi_cv_path_python3_epfx=` |
| 1386 | ${vi_cv_path_python3} -c \ |
| 1387 | "import sys; print(sys.exec_prefix)"` ]) |
| 1388 | |
| 1389 | dnl -- python3's internal library path |
| 1390 | |
| 1391 | AC_CACHE_VAL(vi_cv_path_python3path, |
| 1392 | [ vi_cv_path_python3path=` |
| 1393 | unset PYTHONPATH; |
| 1394 | ${vi_cv_path_python3} -c \ |
| 1395 | "import sys, string; print(':'.join(sys.path))"` ]) |
| 1396 | |
| 1397 | dnl -- where the Python implementation library archives are |
| 1398 | |
| 1399 | AC_ARG_WITH(python3-config-dir, |
| 1400 | [ --with-python3-config-dir=PATH Python's config directory], |
| 1401 | [ vi_cv_path_python3_conf="${withval}" ] ) |
| 1402 | |
| 1403 | AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf, |
| 1404 | [ |
| 1405 | vi_cv_path_python3_conf= |
Bram Moolenaar | fee496d | 2013-07-12 20:07:24 +0200 | [diff] [blame] | 1406 | config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1407 | d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"` |
| 1408 | if test -d "$d" && test -f "$d/config.c"; then |
| 1409 | vi_cv_path_python3_conf="$d" |
| 1410 | else |
| 1411 | for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do |
| 1412 | for subdir in lib64 lib share; do |
| 1413 | d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}" |
| 1414 | if test -d "$d" && test -f "$d/config.c"; then |
| 1415 | vi_cv_path_python3_conf="$d" |
| 1416 | fi |
| 1417 | done |
| 1418 | done |
| 1419 | fi |
| 1420 | ]) |
| 1421 | |
| 1422 | PYTHON3_CONFDIR="${vi_cv_path_python3_conf}" |
| 1423 | |
| 1424 | if test "X$PYTHON3_CONFDIR" = "X"; then |
| 1425 | AC_MSG_RESULT([can't find it!]) |
| 1426 | else |
| 1427 | |
| 1428 | dnl -- we need to examine Python's config/Makefile too |
| 1429 | dnl see what the interpreter is built from |
| 1430 | AC_CACHE_VAL(vi_cv_path_python3_plibs, |
| 1431 | [ |
| 1432 | pwd=`pwd` |
| 1433 | tmp_mkf="$pwd/config-PyMake$$" |
| 1434 | cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}" |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1435 | __: |
Bram Moolenaar | 3804aeb | 2010-07-19 21:18:54 +0200 | [diff] [blame] | 1436 | @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'" |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1437 | @echo "python3_LIBS='$(LIBS)'" |
| 1438 | @echo "python3_SYSLIBS='$(SYSLIBS)'" |
Bram Moolenaar | f94a13c | 2012-09-21 13:26:49 +0200 | [diff] [blame] | 1439 | @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'" |
Bram Moolenaar | 2a7e2a6 | 2010-07-24 15:19:11 +0200 | [diff] [blame] | 1440 | @echo "python3_INSTSONAME='$(INSTSONAME)'" |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1441 | eof |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1442 | dnl -- delete the lines from make about Entering/Leaving directory |
| 1443 | eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" |
| 1444 | rm -f -- "${tmp_mkf}" |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1445 | vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1446 | vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}" |
| 1447 | dnl remove -ltermcap, it can conflict with an earlier -lncurses |
| 1448 | vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//` |
| 1449 | vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//` |
| 1450 | ]) |
Bram Moolenaar | ba59ddb | 2016-01-28 15:34:25 +0100 | [diff] [blame] | 1451 | AC_CACHE_CHECK(Python3's dll name,vi_cv_dll_name_python3, |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1452 | [ |
| 1453 | if test "X$python3_DLLLIBRARY" != "X"; then |
| 1454 | vi_cv_dll_name_python3="$python3_DLLLIBRARY" |
| 1455 | else |
| 1456 | vi_cv_dll_name_python3="$python3_INSTSONAME" |
| 1457 | fi |
| 1458 | ]) |
| 1459 | |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1460 | PYTHON3_LIBS="${vi_cv_path_python3_plibs}" |
| 1461 | if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then |
Bram Moolenaar | 780c3e9 | 2013-06-11 20:53:28 +0200 | [diff] [blame] | 1462 | 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}\"'" |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1463 | else |
Bram Moolenaar | 780c3e9 | 2013-06-11 20:53:28 +0200 | [diff] [blame] | 1464 | 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}\"'" |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1465 | fi |
| 1466 | PYTHON3_SRC="if_python3.c" |
| 1467 | PYTHON3_OBJ="objects/if_python3.o" |
| 1468 | |
| 1469 | dnl On FreeBSD linking with "-pthread" is required to use threads. |
| 1470 | dnl _THREAD_SAFE must be used for compiling then. |
| 1471 | dnl The "-pthread" is added to $LIBS, so that the following check for |
| 1472 | dnl sigaltstack() will look in libc_r (it's there in libc!). |
| 1473 | dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC |
| 1474 | dnl will then define target-specific defines, e.g., -D_REENTRANT. |
| 1475 | dnl Don't do this for Mac OSX, -pthread will generate a warning. |
| 1476 | AC_MSG_CHECKING([if -pthread should be used]) |
| 1477 | threadsafe_flag= |
| 1478 | thread_lib= |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 1479 | dnl if test "x$MACOS_X" != "xyes"; then |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1480 | if test "`(uname) 2>/dev/null`" != Darwin; then |
| 1481 | test "$GCC" = yes && threadsafe_flag="-pthread" |
| 1482 | if test "`(uname) 2>/dev/null`" = FreeBSD; then |
| 1483 | threadsafe_flag="-D_THREAD_SAFE" |
| 1484 | thread_lib="-pthread" |
| 1485 | fi |
| 1486 | if test "`(uname) 2>/dev/null`" = SunOS; then |
| 1487 | threadsafe_flag="-pthreads" |
| 1488 | fi |
| 1489 | fi |
| 1490 | libs_save_old=$LIBS |
| 1491 | if test -n "$threadsafe_flag"; then |
| 1492 | cflags_save=$CFLAGS |
| 1493 | CFLAGS="$CFLAGS $threadsafe_flag" |
| 1494 | LIBS="$LIBS $thread_lib" |
| 1495 | AC_TRY_LINK(,[ ], |
| 1496 | AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag", |
| 1497 | AC_MSG_RESULT(no); LIBS=$libs_save_old |
| 1498 | ) |
| 1499 | CFLAGS=$cflags_save |
| 1500 | else |
| 1501 | AC_MSG_RESULT(no) |
| 1502 | fi |
| 1503 | |
| 1504 | dnl check that compiling a simple program still works with the flags |
| 1505 | dnl added for Python. |
| 1506 | AC_MSG_CHECKING([if compile and link flags for Python 3 are sane]) |
| 1507 | cflags_save=$CFLAGS |
| 1508 | libs_save=$LIBS |
| 1509 | CFLAGS="$CFLAGS $PYTHON3_CFLAGS" |
| 1510 | LIBS="$LIBS $PYTHON3_LIBS" |
| 1511 | AC_TRY_LINK(,[ ], |
| 1512 | AC_MSG_RESULT(yes); python3_ok=yes, |
| 1513 | AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no) |
| 1514 | CFLAGS=$cflags_save |
| 1515 | LIBS=$libs_save |
| 1516 | if test "$python3_ok" = yes; then |
| 1517 | AC_DEFINE(FEAT_PYTHON3) |
| 1518 | else |
| 1519 | LIBS=$libs_save_old |
| 1520 | PYTHON3_SRC= |
| 1521 | PYTHON3_OBJ= |
| 1522 | PYTHON3_LIBS= |
| 1523 | PYTHON3_CFLAGS= |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1524 | fi |
| 1525 | fi |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 1526 | else |
| 1527 | AC_MSG_RESULT(too old) |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1528 | fi |
| 1529 | fi |
Bram Moolenaar | 1612b1a | 2013-06-14 21:22:39 +0200 | [diff] [blame] | 1530 | if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then |
| 1531 | AC_MSG_ERROR([could not configure python3]) |
| 1532 | fi |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1533 | fi |
| 1534 | |
| 1535 | AC_SUBST(PYTHON3_CONFDIR) |
| 1536 | AC_SUBST(PYTHON3_LIBS) |
| 1537 | AC_SUBST(PYTHON3_CFLAGS) |
| 1538 | AC_SUBST(PYTHON3_SRC) |
| 1539 | AC_SUBST(PYTHON3_OBJ) |
| 1540 | |
| 1541 | dnl if python2.x and python3.x are enabled one can only link in code |
| 1542 | dnl with dlopen(), dlsym(), dlclose() |
| 1543 | if test "$python_ok" = yes && test "$python3_ok" = yes; then |
| 1544 | AC_DEFINE(DYNAMIC_PYTHON) |
| 1545 | AC_DEFINE(DYNAMIC_PYTHON3) |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1546 | AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python) |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1547 | cflags_save=$CFLAGS |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1548 | CFLAGS="$CFLAGS $PYTHON_CFLAGS" |
Bram Moolenaar | 5d3fbf3 | 2015-03-05 16:47:20 +0100 | [diff] [blame] | 1549 | libs_save=$LIBS |
Bram Moolenaar | 6fabcbe | 2011-09-02 12:27:25 +0200 | [diff] [blame] | 1550 | dnl -ldl must go first to make this work on Archlinux (Roland Puntaier) |
Bram Moolenaar | 5d3fbf3 | 2015-03-05 16:47:20 +0100 | [diff] [blame] | 1551 | LIBS="-ldl $LIBS" |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 1552 | AC_RUN_IFELSE([AC_LANG_SOURCE([ |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1553 | #include <dlfcn.h> |
| 1554 | /* If this program fails, then RTLD_GLOBAL is needed. |
| 1555 | * RTLD_GLOBAL will be used and then it is not possible to |
| 1556 | * have both python versions enabled in the same vim instance. |
Bram Moolenaar | 84a05ac | 2013-05-06 04:24:17 +0200 | [diff] [blame] | 1557 | * Only the first python version used will be switched on. |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1558 | */ |
| 1559 | |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1560 | int no_rtl_global_needed_for(char *python_instsoname, char *prefix) |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1561 | { |
| 1562 | int needed = 0; |
Bram Moolenaar | ba59ddb | 2016-01-28 15:34:25 +0100 | [diff] [blame] | 1563 | void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL); |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1564 | if (pylib != 0) |
| 1565 | { |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1566 | void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome"); |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1567 | void (*init)(void) = dlsym(pylib, "Py_Initialize"); |
| 1568 | int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); |
| 1569 | void (*final)(void) = dlsym(pylib, "Py_Finalize"); |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1570 | (*pfx)(prefix); |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1571 | (*init)(); |
| 1572 | needed = (*simple)("import termios") == -1; |
| 1573 | (*final)(); |
| 1574 | dlclose(pylib); |
| 1575 | } |
| 1576 | return !needed; |
| 1577 | } |
| 1578 | |
| 1579 | int main(int argc, char** argv) |
| 1580 | { |
| 1581 | int not_needed = 0; |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1582 | if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}")) |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1583 | not_needed = 1; |
| 1584 | return !not_needed; |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 1585 | }])], |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1586 | [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1587 | |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1588 | CFLAGS=$cflags_save |
Bram Moolenaar | 5d3fbf3 | 2015-03-05 16:47:20 +0100 | [diff] [blame] | 1589 | LIBS=$libs_save |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1590 | |
| 1591 | AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3) |
| 1592 | cflags_save=$CFLAGS |
| 1593 | CFLAGS="$CFLAGS $PYTHON3_CFLAGS" |
Bram Moolenaar | 5d3fbf3 | 2015-03-05 16:47:20 +0100 | [diff] [blame] | 1594 | libs_save=$LIBS |
Bram Moolenaar | 6fabcbe | 2011-09-02 12:27:25 +0200 | [diff] [blame] | 1595 | dnl -ldl must go first to make this work on Archlinux (Roland Puntaier) |
Bram Moolenaar | 5d3fbf3 | 2015-03-05 16:47:20 +0100 | [diff] [blame] | 1596 | LIBS="-ldl $LIBS" |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 1597 | AC_RUN_IFELSE([AC_LANG_SOURCE([ |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1598 | #include <dlfcn.h> |
| 1599 | #include <wchar.h> |
| 1600 | /* If this program fails, then RTLD_GLOBAL is needed. |
| 1601 | * RTLD_GLOBAL will be used and then it is not possible to |
| 1602 | * have both python versions enabled in the same vim instance. |
Bram Moolenaar | 84a05ac | 2013-05-06 04:24:17 +0200 | [diff] [blame] | 1603 | * Only the first python version used will be switched on. |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1604 | */ |
| 1605 | |
| 1606 | int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix) |
| 1607 | { |
| 1608 | int needed = 0; |
Bram Moolenaar | ba59ddb | 2016-01-28 15:34:25 +0100 | [diff] [blame] | 1609 | void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL); |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1610 | if (pylib != 0) |
| 1611 | { |
| 1612 | void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome"); |
| 1613 | void (*init)(void) = dlsym(pylib, "Py_Initialize"); |
| 1614 | int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); |
| 1615 | void (*final)(void) = dlsym(pylib, "Py_Finalize"); |
| 1616 | (*pfx)(prefix); |
| 1617 | (*init)(); |
| 1618 | needed = (*simple)("import termios") == -1; |
| 1619 | (*final)(); |
| 1620 | dlclose(pylib); |
| 1621 | } |
| 1622 | return !needed; |
| 1623 | } |
| 1624 | |
| 1625 | int main(int argc, char** argv) |
| 1626 | { |
| 1627 | int not_needed = 0; |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1628 | if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}")) |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1629 | not_needed = 1; |
| 1630 | return !not_needed; |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 1631 | }])], |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1632 | [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) |
| 1633 | |
| 1634 | CFLAGS=$cflags_save |
Bram Moolenaar | 5d3fbf3 | 2015-03-05 16:47:20 +0100 | [diff] [blame] | 1635 | LIBS=$libs_save |
Bram Moolenaar | 644d37b | 2010-11-16 19:26:02 +0100 | [diff] [blame] | 1636 | |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1637 | PYTHON_SRC="if_python.c" |
| 1638 | PYTHON_OBJ="objects/if_python.o" |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1639 | PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\"" |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1640 | PYTHON_LIBS= |
| 1641 | PYTHON3_SRC="if_python3.c" |
| 1642 | PYTHON3_OBJ="objects/if_python3.o" |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1643 | PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\"" |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1644 | PYTHON3_LIBS= |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1645 | elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then |
| 1646 | AC_DEFINE(DYNAMIC_PYTHON) |
| 1647 | PYTHON_SRC="if_python.c" |
| 1648 | PYTHON_OBJ="objects/if_python.o" |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1649 | PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\"" |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1650 | PYTHON_LIBS= |
Bram Moolenaar | e741f27 | 2013-07-09 21:57:52 +0200 | [diff] [blame] | 1651 | elif test "$python_ok" = yes; then |
| 1652 | dnl Check that adding -fPIE works. It may be needed when using a static |
| 1653 | dnl Python library. |
| 1654 | AC_MSG_CHECKING([if -fPIE can be added for Python]) |
| 1655 | cflags_save=$CFLAGS |
| 1656 | libs_save=$LIBS |
| 1657 | CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE" |
| 1658 | LIBS="$LIBS $PYTHON_LIBS" |
| 1659 | AC_TRY_LINK(,[ ], |
| 1660 | AC_MSG_RESULT(yes); fpie_ok=yes, |
| 1661 | AC_MSG_RESULT(no); fpie_ok=no) |
| 1662 | CFLAGS=$cflags_save |
| 1663 | LIBS=$libs_save |
| 1664 | if test $fpie_ok = yes; then |
| 1665 | PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE" |
| 1666 | fi |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1667 | elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then |
| 1668 | AC_DEFINE(DYNAMIC_PYTHON3) |
| 1669 | PYTHON3_SRC="if_python3.c" |
| 1670 | PYTHON3_OBJ="objects/if_python3.o" |
Bram Moolenaar | cf1b057 | 2014-05-22 14:44:22 +0200 | [diff] [blame] | 1671 | PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\"" |
Bram Moolenaar | b744b2f | 2010-08-13 16:22:57 +0200 | [diff] [blame] | 1672 | PYTHON3_LIBS= |
Bram Moolenaar | e741f27 | 2013-07-09 21:57:52 +0200 | [diff] [blame] | 1673 | elif test "$python3_ok" = yes; then |
| 1674 | dnl Check that adding -fPIE works. It may be needed when using a static |
| 1675 | dnl Python library. |
| 1676 | AC_MSG_CHECKING([if -fPIE can be added for Python3]) |
| 1677 | cflags_save=$CFLAGS |
| 1678 | libs_save=$LIBS |
| 1679 | CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE" |
| 1680 | LIBS="$LIBS $PYTHON3_LIBS" |
| 1681 | AC_TRY_LINK(,[ ], |
| 1682 | AC_MSG_RESULT(yes); fpie_ok=yes, |
| 1683 | AC_MSG_RESULT(no); fpie_ok=no) |
| 1684 | CFLAGS=$cflags_save |
| 1685 | LIBS=$libs_save |
| 1686 | if test $fpie_ok = yes; then |
| 1687 | PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE" |
| 1688 | fi |
Bram Moolenaar | bd5e15f | 2010-07-17 21:19:38 +0200 | [diff] [blame] | 1689 | fi |
| 1690 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1691 | AC_MSG_CHECKING(--enable-tclinterp argument) |
| 1692 | AC_ARG_ENABLE(tclinterp, |
Bram Moolenaar | 8a5115c | 2016-01-09 19:41:11 +0100 | [diff] [blame] | 1693 | [ --enable-tclinterp[=OPTS] Include Tcl interpreter. [default=no] [OPTS=no/yes/dynamic]], , |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1694 | [enable_tclinterp="no"]) |
| 1695 | AC_MSG_RESULT($enable_tclinterp) |
| 1696 | |
Bram Moolenaar | 8a5115c | 2016-01-09 19:41:11 +0100 | [diff] [blame] | 1697 | if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1698 | |
Bram Moolenaar | 9b5d4dd | 2008-01-01 15:26:45 +0000 | [diff] [blame] | 1699 | dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420] |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1700 | AC_MSG_CHECKING(--with-tclsh argument) |
| 1701 | AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)], |
| 1702 | tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name), |
Bram Moolenaar | 9b5d4dd | 2008-01-01 15:26:45 +0000 | [diff] [blame] | 1703 | tclsh_name="tclsh8.5"; AC_MSG_RESULT(no)) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1704 | AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) |
| 1705 | AC_SUBST(vi_cv_path_tcl) |
| 1706 | |
Bram Moolenaar | 9b5d4dd | 2008-01-01 15:26:45 +0000 | [diff] [blame] | 1707 | dnl when no specific version specified, also try 8.4, 8.2 and 8.0 |
| 1708 | if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then |
| 1709 | tclsh_name="tclsh8.4" |
| 1710 | AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) |
| 1711 | fi |
Bram Moolenaar | df3267e | 2005-01-25 22:07:05 +0000 | [diff] [blame] | 1712 | if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1713 | tclsh_name="tclsh8.2" |
| 1714 | AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) |
| 1715 | fi |
Bram Moolenaar | df3267e | 2005-01-25 22:07:05 +0000 | [diff] [blame] | 1716 | if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then |
| 1717 | tclsh_name="tclsh8.0" |
| 1718 | AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) |
| 1719 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1720 | dnl still didn't find it, try without version number |
| 1721 | if test "X$vi_cv_path_tcl" = "X"; then |
| 1722 | tclsh_name="tclsh" |
| 1723 | AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name) |
| 1724 | fi |
| 1725 | if test "X$vi_cv_path_tcl" != "X"; then |
| 1726 | AC_MSG_CHECKING(Tcl version) |
Bram Moolenaar | 49222be | 2015-12-11 18:11:30 +0100 | [diff] [blame] | 1727 | if echo 'exit [[expr [info tclversion] < 8.0]]' | "$vi_cv_path_tcl" - ; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1728 | tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -` |
| 1729 | AC_MSG_RESULT($tclver - OK); |
| 1730 | 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 -` |
Bram Moolenaar | 8a5115c | 2016-01-09 19:41:11 +0100 | [diff] [blame] | 1731 | tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1732 | |
| 1733 | AC_MSG_CHECKING(for location of Tcl include) |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 1734 | if test "x$MACOS_X" != "xyes"; then |
Bram Moolenaar | 0ff8f60 | 2008-02-20 11:44:03 +0000 | [diff] [blame] | 1735 | tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1736 | else |
| 1737 | dnl For Mac OS X 10.3, use the OS-provided framework location |
| 1738 | tclinc="/System/Library/Frameworks/Tcl.framework/Headers" |
| 1739 | fi |
Bram Moolenaar | 0ff8f60 | 2008-02-20 11:44:03 +0000 | [diff] [blame] | 1740 | TCL_INC= |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1741 | for try in $tclinc; do |
| 1742 | if test -f "$try/tcl.h"; then |
| 1743 | AC_MSG_RESULT($try/tcl.h) |
| 1744 | TCL_INC=$try |
| 1745 | break |
| 1746 | fi |
| 1747 | done |
| 1748 | if test -z "$TCL_INC"; then |
| 1749 | AC_MSG_RESULT(<not found>) |
| 1750 | SKIP_TCL=YES |
| 1751 | fi |
| 1752 | if test -z "$SKIP_TCL"; then |
| 1753 | AC_MSG_CHECKING(for location of tclConfig.sh script) |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 1754 | if test "x$MACOS_X" != "xyes"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1755 | tclcnf=`echo $tclinc | sed s/include/lib/g` |
Bram Moolenaar | 9b5d4dd | 2008-01-01 15:26:45 +0000 | [diff] [blame] | 1756 | tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1757 | else |
| 1758 | dnl For Mac OS X 10.3, use the OS-provided framework location |
| 1759 | tclcnf="/System/Library/Frameworks/Tcl.framework" |
| 1760 | fi |
| 1761 | for try in $tclcnf; do |
Bram Moolenaar | 49222be | 2015-12-11 18:11:30 +0100 | [diff] [blame] | 1762 | if test -f "$try/tclConfig.sh"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1763 | AC_MSG_RESULT($try/tclConfig.sh) |
Bram Moolenaar | 49222be | 2015-12-11 18:11:30 +0100 | [diff] [blame] | 1764 | . "$try/tclConfig.sh" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1765 | dnl use eval, because tcl 8.2 includes ${TCL_DBGX} |
Bram Moolenaar | 8a5115c | 2016-01-09 19:41:11 +0100 | [diff] [blame] | 1766 | if test "$enable_tclinterp" = "dynamic"; then |
| 1767 | TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"` |
| 1768 | else |
| 1769 | TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"` |
| 1770 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1771 | dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the |
Bram Moolenaar | df3267e | 2005-01-25 22:07:05 +0000 | [diff] [blame] | 1772 | dnl "-D_ABC" items. Watch out for -DFOO=long\ long. |
Bram Moolenaar | 4394bff | 2008-07-24 11:21:31 +0000 | [diff] [blame] | 1773 | 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'` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1774 | break |
| 1775 | fi |
| 1776 | done |
| 1777 | if test -z "$TCL_LIBS"; then |
| 1778 | AC_MSG_RESULT(<not found>) |
| 1779 | AC_MSG_CHECKING(for Tcl library by myself) |
| 1780 | tcllib=`echo $tclinc | sed s/include/lib/g` |
Bram Moolenaar | 9b5d4dd | 2008-01-01 15:26:45 +0000 | [diff] [blame] | 1781 | tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1782 | for ext in .so .a ; do |
| 1783 | for ver in "" $tclver ; do |
| 1784 | for try in $tcllib ; do |
| 1785 | trylib=tcl$ver$ext |
Bram Moolenaar | 49222be | 2015-12-11 18:11:30 +0100 | [diff] [blame] | 1786 | if test -f "$try/lib$trylib" ; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1787 | AC_MSG_RESULT($try/lib$trylib) |
Bram Moolenaar | 49222be | 2015-12-11 18:11:30 +0100 | [diff] [blame] | 1788 | TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1789 | if test "`(uname) 2>/dev/null`" = SunOS && |
| 1790 | uname -r | grep '^5' >/dev/null; then |
| 1791 | TCL_LIBS="$TCL_LIBS -R $try" |
| 1792 | fi |
| 1793 | break 3 |
| 1794 | fi |
| 1795 | done |
| 1796 | done |
| 1797 | done |
| 1798 | if test -z "$TCL_LIBS"; then |
| 1799 | AC_MSG_RESULT(<not found>) |
| 1800 | SKIP_TCL=YES |
| 1801 | fi |
| 1802 | fi |
| 1803 | if test -z "$SKIP_TCL"; then |
| 1804 | AC_DEFINE(FEAT_TCL) |
| 1805 | TCL_SRC=if_tcl.c |
| 1806 | TCL_OBJ=objects/if_tcl.o |
| 1807 | TCL_PRO=if_tcl.pro |
| 1808 | TCL_CFLAGS="-I$TCL_INC $TCL_DEFS" |
| 1809 | fi |
| 1810 | fi |
| 1811 | else |
| 1812 | AC_MSG_RESULT(too old; need Tcl version 8.0 or later) |
| 1813 | fi |
| 1814 | fi |
Bram Moolenaar | 8a5115c | 2016-01-09 19:41:11 +0100 | [diff] [blame] | 1815 | if test "$enable_tclinterp" = "dynamic"; then |
| 1816 | if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then |
| 1817 | AC_DEFINE(DYNAMIC_TCL) |
| 1818 | TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS" |
| 1819 | fi |
| 1820 | fi |
Bram Moolenaar | f788a06 | 2011-12-14 20:51:25 +0100 | [diff] [blame] | 1821 | if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then |
| 1822 | AC_MSG_ERROR([could not configure Tcl]) |
| 1823 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1824 | fi |
| 1825 | AC_SUBST(TCL_SRC) |
| 1826 | AC_SUBST(TCL_OBJ) |
| 1827 | AC_SUBST(TCL_PRO) |
| 1828 | AC_SUBST(TCL_CFLAGS) |
| 1829 | AC_SUBST(TCL_LIBS) |
| 1830 | |
| 1831 | AC_MSG_CHECKING(--enable-rubyinterp argument) |
| 1832 | AC_ARG_ENABLE(rubyinterp, |
Bram Moolenaar | 3ca71f1 | 2010-10-27 16:49:47 +0200 | [diff] [blame] | 1833 | [ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], , |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1834 | [enable_rubyinterp="no"]) |
| 1835 | AC_MSG_RESULT($enable_rubyinterp) |
Bram Moolenaar | 3ca71f1 | 2010-10-27 16:49:47 +0200 | [diff] [blame] | 1836 | if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then |
Bram Moolenaar | 0b10541 | 2014-11-30 13:34:23 +0100 | [diff] [blame] | 1837 | if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then |
| 1838 | AC_MSG_ERROR([cannot use Ruby with tiny or small features]) |
| 1839 | fi |
| 1840 | |
Bram Moolenaar | 165641d | 2010-02-17 16:23:09 +0100 | [diff] [blame] | 1841 | AC_MSG_CHECKING(--with-ruby-command argument) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1842 | AC_SUBST(vi_cv_path_ruby) |
Bram Moolenaar | 948733a | 2011-05-05 18:10:16 +0200 | [diff] [blame] | 1843 | AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)], |
| 1844 | RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD), |
| 1845 | RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD)) |
Bram Moolenaar | 165641d | 2010-02-17 16:23:09 +0100 | [diff] [blame] | 1846 | AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1847 | if test "X$vi_cv_path_ruby" != "X"; then |
| 1848 | AC_MSG_CHECKING(Ruby version) |
Bram Moolenaar | e4efc3b | 2005-03-07 23:16:51 +0000 | [diff] [blame] | 1849 | if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1850 | AC_MSG_RESULT(OK) |
Bram Moolenaar | 8139889 | 2012-10-03 21:09:35 +0200 | [diff] [blame] | 1851 | AC_MSG_CHECKING(Ruby rbconfig) |
| 1852 | ruby_rbconfig="RbConfig" |
| 1853 | if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then |
| 1854 | ruby_rbconfig="Config" |
| 1855 | fi |
| 1856 | AC_MSG_RESULT($ruby_rbconfig) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1857 | AC_MSG_CHECKING(Ruby header files) |
Bram Moolenaar | 8139889 | 2012-10-03 21:09:35 +0200 | [diff] [blame] | 1858 | rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e "print $ruby_rbconfig::CONFIG[['rubyhdrdir']] || $ruby_rbconfig::CONFIG[['archdir']] || \\$hdrdir" 2>/dev/null` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1859 | if test "X$rubyhdrdir" != "X"; then |
| 1860 | AC_MSG_RESULT($rubyhdrdir) |
| 1861 | RUBY_CFLAGS="-I$rubyhdrdir" |
Bram Moolenaar | a6fd37b | 2014-03-27 17:19:09 +0100 | [diff] [blame] | 1862 | rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"` |
| 1863 | if test -d "$rubyarchdir"; then |
| 1864 | RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir" |
Bram Moolenaar | 165641d | 2010-02-17 16:23:09 +0100 | [diff] [blame] | 1865 | fi |
Bram Moolenaar | 8139889 | 2012-10-03 21:09:35 +0200 | [diff] [blame] | 1866 | rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"` |
Bram Moolenaar | 026a445 | 2013-08-07 15:22:23 +0200 | [diff] [blame] | 1867 | if test "X$rubyversion" = "X"; then |
| 1868 | rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"` |
| 1869 | fi |
Bram Moolenaar | 165641d | 2010-02-17 16:23:09 +0100 | [diff] [blame] | 1870 | RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion" |
Bram Moolenaar | 8139889 | 2012-10-03 21:09:35 +0200 | [diff] [blame] | 1871 | rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1872 | if test "X$rubylibs" != "X"; then |
| 1873 | RUBY_LIBS="$rubylibs" |
| 1874 | fi |
Bram Moolenaar | 8139889 | 2012-10-03 21:09:35 +0200 | [diff] [blame] | 1875 | librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"` |
| 1876 | librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"` |
Bram Moolenaar | ac499e3 | 2013-06-02 19:14:17 +0200 | [diff] [blame] | 1877 | rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"` |
Bram Moolenaar | 948733a | 2011-05-05 18:10:16 +0200 | [diff] [blame] | 1878 | if test -f "$rubylibdir/$librubya"; then |
| 1879 | librubyarg="$librubyarg" |
Bram Moolenaar | ac499e3 | 2013-06-02 19:14:17 +0200 | [diff] [blame] | 1880 | RUBY_LIBS="$RUBY_LIBS -L$rubylibdir" |
| 1881 | elif test "$librubyarg" = "libruby.a"; then |
| 1882 | dnl required on Mac OS 10.3 where libruby.a doesn't exist |
| 1883 | librubyarg="-lruby" |
| 1884 | RUBY_LIBS="$RUBY_LIBS -L$rubylibdir" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1885 | fi |
| 1886 | |
| 1887 | if test "X$librubyarg" != "X"; then |
| 1888 | RUBY_LIBS="$librubyarg $RUBY_LIBS" |
| 1889 | fi |
Bram Moolenaar | 8139889 | 2012-10-03 21:09:35 +0200 | [diff] [blame] | 1890 | rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LDFLAGS']]"` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1891 | if test "X$rubyldflags" != "X"; then |
Bram Moolenaar | 996b6d8 | 2009-07-22 09:17:23 +0000 | [diff] [blame] | 1892 | dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only |
| 1893 | dnl be included if requested by passing --with-mac-arch to |
| 1894 | dnl configure, so strip these flags first (if present) |
Bram Moolenaar | 5dff57d | 2010-07-24 16:19:44 +0200 | [diff] [blame] | 1895 | rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` |
Bram Moolenaar | 996b6d8 | 2009-07-22 09:17:23 +0000 | [diff] [blame] | 1896 | if test "X$rubyldflags" != "X"; then |
Bram Moolenaar | 2bcaec3 | 2014-03-27 18:51:11 +0100 | [diff] [blame] | 1897 | if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$rubyldflags\"`" = "X"; then |
Bram Moolenaar | a6cc031 | 2013-06-18 23:31:55 +0200 | [diff] [blame] | 1898 | LDFLAGS="$rubyldflags $LDFLAGS" |
| 1899 | fi |
Bram Moolenaar | 996b6d8 | 2009-07-22 09:17:23 +0000 | [diff] [blame] | 1900 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1901 | fi |
| 1902 | RUBY_SRC="if_ruby.c" |
| 1903 | RUBY_OBJ="objects/if_ruby.o" |
| 1904 | RUBY_PRO="if_ruby.pro" |
| 1905 | AC_DEFINE(FEAT_RUBY) |
Bram Moolenaar | 3ca71f1 | 2010-10-27 16:49:47 +0200 | [diff] [blame] | 1906 | if test "$enable_rubyinterp" = "dynamic"; then |
Bram Moolenaar | 9202162 | 2017-10-12 12:33:43 +0200 | [diff] [blame] | 1907 | libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_ALIASES']].split[[0]]"` |
Bram Moolenaar | 3ca71f1 | 2010-10-27 16:49:47 +0200 | [diff] [blame] | 1908 | AC_DEFINE(DYNAMIC_RUBY) |
Bram Moolenaar | 9202162 | 2017-10-12 12:33:43 +0200 | [diff] [blame] | 1909 | RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS" |
Bram Moolenaar | 3ca71f1 | 2010-10-27 16:49:47 +0200 | [diff] [blame] | 1910 | RUBY_LIBS= |
| 1911 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1912 | else |
Bram Moolenaar | 165641d | 2010-02-17 16:23:09 +0100 | [diff] [blame] | 1913 | AC_MSG_RESULT(not found; disabling Ruby) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1914 | fi |
| 1915 | else |
| 1916 | AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later) |
| 1917 | fi |
| 1918 | fi |
Bram Moolenaar | f788a06 | 2011-12-14 20:51:25 +0100 | [diff] [blame] | 1919 | |
| 1920 | if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then |
| 1921 | AC_MSG_ERROR([could not configure Ruby]) |
| 1922 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1923 | fi |
| 1924 | AC_SUBST(RUBY_SRC) |
| 1925 | AC_SUBST(RUBY_OBJ) |
| 1926 | AC_SUBST(RUBY_PRO) |
| 1927 | AC_SUBST(RUBY_CFLAGS) |
| 1928 | AC_SUBST(RUBY_LIBS) |
| 1929 | |
| 1930 | AC_MSG_CHECKING(--enable-cscope argument) |
| 1931 | AC_ARG_ENABLE(cscope, |
| 1932 | [ --enable-cscope Include cscope interface.], , |
| 1933 | [enable_cscope="no"]) |
| 1934 | AC_MSG_RESULT($enable_cscope) |
| 1935 | if test "$enable_cscope" = "yes"; then |
| 1936 | AC_DEFINE(FEAT_CSCOPE) |
| 1937 | fi |
| 1938 | |
| 1939 | AC_MSG_CHECKING(--enable-workshop argument) |
| 1940 | AC_ARG_ENABLE(workshop, |
| 1941 | [ --enable-workshop Include Sun Visual Workshop support.], , |
| 1942 | [enable_workshop="no"]) |
| 1943 | AC_MSG_RESULT($enable_workshop) |
| 1944 | if test "$enable_workshop" = "yes"; then |
| 1945 | AC_DEFINE(FEAT_SUN_WORKSHOP) |
| 1946 | WORKSHOP_SRC="workshop.c integration.c" |
| 1947 | AC_SUBST(WORKSHOP_SRC) |
| 1948 | WORKSHOP_OBJ="objects/workshop.o objects/integration.o" |
| 1949 | AC_SUBST(WORKSHOP_OBJ) |
| 1950 | if test "${enable_gui-xxx}" = xxx; then |
| 1951 | enable_gui=motif |
| 1952 | fi |
| 1953 | fi |
| 1954 | |
| 1955 | AC_MSG_CHECKING(--disable-netbeans argument) |
| 1956 | AC_ARG_ENABLE(netbeans, |
| 1957 | [ --disable-netbeans Disable NetBeans integration support.], |
| 1958 | , [enable_netbeans="yes"]) |
| 1959 | if test "$enable_netbeans" = "yes"; then |
Bram Moolenaar | 3c124e3 | 2016-01-31 14:36:58 +0100 | [diff] [blame] | 1960 | if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then |
| 1961 | AC_MSG_RESULT([cannot use NetBeans with tiny or small features]) |
| 1962 | enable_netbeans="no" |
| 1963 | else |
| 1964 | AC_MSG_RESULT(no) |
| 1965 | fi |
Bram Moolenaar | e0874f8 | 2016-01-24 20:36:41 +0100 | [diff] [blame] | 1966 | else |
| 1967 | AC_MSG_RESULT(yes) |
| 1968 | fi |
| 1969 | |
| 1970 | AC_MSG_CHECKING(--disable-channel argument) |
| 1971 | AC_ARG_ENABLE(channel, |
Bram Moolenaar | 8008b63 | 2017-07-18 21:33:20 +0200 | [diff] [blame] | 1972 | [ --disable-channel Disable process communication support.], |
Bram Moolenaar | e0874f8 | 2016-01-24 20:36:41 +0100 | [diff] [blame] | 1973 | , [enable_channel="yes"]) |
| 1974 | if test "$enable_channel" = "yes"; then |
Bram Moolenaar | 3c124e3 | 2016-01-31 14:36:58 +0100 | [diff] [blame] | 1975 | if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then |
| 1976 | AC_MSG_RESULT([cannot use channels with tiny or small features]) |
| 1977 | enable_channel="no" |
| 1978 | else |
| 1979 | AC_MSG_RESULT(no) |
| 1980 | fi |
Bram Moolenaar | e0874f8 | 2016-01-24 20:36:41 +0100 | [diff] [blame] | 1981 | else |
| 1982 | if test "$enable_netbeans" = "yes"; then |
Bram Moolenaar | 1643548 | 2016-01-24 21:31:54 +0100 | [diff] [blame] | 1983 | AC_MSG_RESULT([yes, netbeans also disabled]) |
Bram Moolenaar | e0874f8 | 2016-01-24 20:36:41 +0100 | [diff] [blame] | 1984 | enable_netbeans="no" |
| 1985 | else |
| 1986 | AC_MSG_RESULT(yes) |
| 1987 | fi |
| 1988 | fi |
| 1989 | |
Bram Moolenaar | 1643548 | 2016-01-24 21:31:54 +0100 | [diff] [blame] | 1990 | if test "$enable_channel" = "yes"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1991 | dnl On Solaris we need the socket and nsl library. |
| 1992 | AC_CHECK_LIB(socket, socket) |
| 1993 | AC_CHECK_LIB(nsl, gethostbyname) |
Bram Moolenaar | e0874f8 | 2016-01-24 20:36:41 +0100 | [diff] [blame] | 1994 | AC_MSG_CHECKING(whether compiling with process communication is possible) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1995 | AC_TRY_LINK([ |
| 1996 | #include <stdio.h> |
| 1997 | #include <stdlib.h> |
| 1998 | #include <stdarg.h> |
| 1999 | #include <fcntl.h> |
| 2000 | #include <netdb.h> |
| 2001 | #include <netinet/in.h> |
| 2002 | #include <errno.h> |
| 2003 | #include <sys/types.h> |
| 2004 | #include <sys/socket.h> |
| 2005 | /* Check bitfields */ |
| 2006 | struct nbbuf { |
| 2007 | unsigned int initDone:1; |
Bram Moolenaar | 63de19e | 2016-12-09 20:11:26 +0100 | [diff] [blame] | 2008 | unsigned short signmaplen; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2009 | }; |
| 2010 | ], [ |
| 2011 | /* Check creating a socket. */ |
| 2012 | struct sockaddr_in server; |
| 2013 | (void)socket(AF_INET, SOCK_STREAM, 0); |
| 2014 | (void)htons(100); |
| 2015 | (void)gethostbyname("microsoft.com"); |
| 2016 | if (errno == ECONNREFUSED) |
| 2017 | (void)connect(1, (struct sockaddr *)&server, sizeof(server)); |
| 2018 | ], |
| 2019 | AC_MSG_RESULT(yes), |
Bram Moolenaar | e0874f8 | 2016-01-24 20:36:41 +0100 | [diff] [blame] | 2020 | AC_MSG_RESULT(no); enable_netbeans="no"; enable_channel="no") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2021 | fi |
| 2022 | if test "$enable_netbeans" = "yes"; then |
| 2023 | AC_DEFINE(FEAT_NETBEANS_INTG) |
| 2024 | NETBEANS_SRC="netbeans.c" |
| 2025 | AC_SUBST(NETBEANS_SRC) |
| 2026 | NETBEANS_OBJ="objects/netbeans.o" |
| 2027 | AC_SUBST(NETBEANS_OBJ) |
| 2028 | fi |
Bram Moolenaar | e0874f8 | 2016-01-24 20:36:41 +0100 | [diff] [blame] | 2029 | if test "$enable_channel" = "yes"; then |
Bram Moolenaar | 509ce2a | 2016-03-11 22:52:15 +0100 | [diff] [blame] | 2030 | AC_DEFINE(FEAT_JOB_CHANNEL) |
Bram Moolenaar | e0874f8 | 2016-01-24 20:36:41 +0100 | [diff] [blame] | 2031 | CHANNEL_SRC="channel.c" |
| 2032 | AC_SUBST(CHANNEL_SRC) |
| 2033 | CHANNEL_OBJ="objects/channel.o" |
| 2034 | AC_SUBST(CHANNEL_OBJ) |
| 2035 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2036 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 2037 | AC_MSG_CHECKING(--enable-terminal argument) |
| 2038 | AC_ARG_ENABLE(terminal, |
Bram Moolenaar | 8008b63 | 2017-07-18 21:33:20 +0200 | [diff] [blame] | 2039 | [ --enable-terminal Enable terminal emulation support.], |
Bram Moolenaar | ef83956 | 2017-10-28 20:28:23 +0200 | [diff] [blame] | 2040 | , [enable_terminal="auto"]) |
Bram Moolenaar | 595a402 | 2017-09-03 19:15:57 +0200 | [diff] [blame] | 2041 | if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 2042 | if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then |
| 2043 | AC_MSG_RESULT([cannot use terminal emulator with tiny or small features]) |
| 2044 | enable_terminal="no" |
| 2045 | else |
Bram Moolenaar | 595a402 | 2017-09-03 19:15:57 +0200 | [diff] [blame] | 2046 | if test "$enable_terminal" = "auto"; then |
| 2047 | enable_terminal="yes" |
| 2048 | AC_MSG_RESULT(defaulting to yes) |
| 2049 | else |
| 2050 | AC_MSG_RESULT(yes) |
| 2051 | fi |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 2052 | fi |
| 2053 | else |
Bram Moolenaar | 595a402 | 2017-09-03 19:15:57 +0200 | [diff] [blame] | 2054 | if test "$enable_terminal" = "auto"; then |
| 2055 | enable_terminal="no" |
| 2056 | AC_MSG_RESULT(defaulting to no) |
| 2057 | else |
| 2058 | AC_MSG_RESULT(no) |
| 2059 | fi |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 2060 | fi |
| 2061 | if test "$enable_terminal" = "yes"; then |
| 2062 | AC_DEFINE(FEAT_TERMINAL) |
| 2063 | TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/screen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" |
| 2064 | AC_SUBST(TERM_SRC) |
| 2065 | TERM_OBJ="objects/term_encoding.o objects/term_keyboard.o objects/term_mouse.o objects/term_parser.o objects/term_pen.o objects/term_screen.o objects/term_state.o objects/term_unicode.o objects/term_vterm.o" |
| 2066 | AC_SUBST(TERM_OBJ) |
| 2067 | fi |
| 2068 | |
Bram Moolenaar | e42a6d2 | 2017-11-12 19:21:51 +0100 | [diff] [blame] | 2069 | AC_MSG_CHECKING(--enable-autoservername argument) |
| 2070 | AC_ARG_ENABLE(autoservername, |
| 2071 | [ --enable-autoservername Automatically define servername at vim startup.], , |
| 2072 | [enable_autoservername="no"]) |
| 2073 | AC_MSG_RESULT($enable_autoservername) |
| 2074 | if test "$enable_autoservername" = "yes"; then |
| 2075 | AC_DEFINE(FEAT_AUTOSERVERNAME) |
| 2076 | fi |
| 2077 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2078 | AC_MSG_CHECKING(--enable-multibyte argument) |
| 2079 | AC_ARG_ENABLE(multibyte, |
| 2080 | [ --enable-multibyte Include multibyte editing support.], , |
| 2081 | [enable_multibyte="no"]) |
| 2082 | AC_MSG_RESULT($enable_multibyte) |
| 2083 | if test "$enable_multibyte" = "yes"; then |
| 2084 | AC_DEFINE(FEAT_MBYTE) |
| 2085 | fi |
| 2086 | |
| 2087 | AC_MSG_CHECKING(--enable-hangulinput argument) |
| 2088 | AC_ARG_ENABLE(hangulinput, |
| 2089 | [ --enable-hangulinput Include Hangul input support.], , |
| 2090 | [enable_hangulinput="no"]) |
| 2091 | AC_MSG_RESULT($enable_hangulinput) |
| 2092 | |
| 2093 | AC_MSG_CHECKING(--enable-xim argument) |
| 2094 | AC_ARG_ENABLE(xim, |
| 2095 | [ --enable-xim Include XIM input support.], |
| 2096 | AC_MSG_RESULT($enable_xim), |
| 2097 | [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)]) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2098 | |
| 2099 | AC_MSG_CHECKING(--enable-fontset argument) |
| 2100 | AC_ARG_ENABLE(fontset, |
| 2101 | [ --enable-fontset Include X fontset output support.], , |
| 2102 | [enable_fontset="no"]) |
| 2103 | AC_MSG_RESULT($enable_fontset) |
| 2104 | dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI |
| 2105 | |
| 2106 | test -z "$with_x" && with_x=yes |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 2107 | test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2108 | if test "$with_x" = no; then |
| 2109 | AC_MSG_RESULT(defaulting to: don't HAVE_X11) |
| 2110 | else |
| 2111 | dnl Do this check early, so that its failure can override user requests. |
| 2112 | |
| 2113 | AC_PATH_PROG(xmkmfpath, xmkmf) |
| 2114 | |
| 2115 | AC_PATH_XTRA |
| 2116 | |
Bram Moolenaar | 2c704a7 | 2010-06-03 21:17:25 +0200 | [diff] [blame] | 2117 | dnl On z/OS Unix the X libraries are DLLs. To use them the code must |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2118 | dnl be compiled with a special option. |
| 2119 | dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS. |
Bram Moolenaar | 2c704a7 | 2010-06-03 21:17:25 +0200 | [diff] [blame] | 2120 | if test "$zOSUnix" = "yes"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2121 | CFLAGS="$CFLAGS -W c,dll" |
| 2122 | LDFLAGS="$LDFLAGS -W l,dll" |
| 2123 | X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu" |
| 2124 | fi |
| 2125 | |
| 2126 | dnl On my HPUX system the X include dir is found, but the lib dir not. |
| 2127 | dnl This is a desparate try to fix this. |
| 2128 | |
| 2129 | if test -d "$x_includes" && test ! -d "$x_libraries"; then |
| 2130 | x_libraries=`echo "$x_includes" | sed s/include/lib/` |
| 2131 | AC_MSG_RESULT(Corrected X libraries to $x_libraries) |
| 2132 | X_LIBS="$X_LIBS -L$x_libraries" |
| 2133 | if test "`(uname) 2>/dev/null`" = SunOS && |
| 2134 | uname -r | grep '^5' >/dev/null; then |
| 2135 | X_LIBS="$X_LIBS -R $x_libraries" |
| 2136 | fi |
| 2137 | fi |
| 2138 | |
| 2139 | if test -d "$x_libraries" && test ! -d "$x_includes"; then |
| 2140 | x_includes=`echo "$x_libraries" | sed s/lib/include/` |
| 2141 | AC_MSG_RESULT(Corrected X includes to $x_includes) |
| 2142 | X_CFLAGS="$X_CFLAGS -I$x_includes" |
| 2143 | fi |
| 2144 | |
| 2145 | dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed. |
| 2146 | X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`" |
| 2147 | dnl Remove "-L/usr/lib " from X_LIBS, should not be needed. |
| 2148 | X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`" |
| 2149 | dnl Same for "-R/usr/lib ". |
| 2150 | X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`" |
| 2151 | |
| 2152 | |
| 2153 | dnl Check if the X11 header files are correctly installed. On some systems |
Bram Moolenaar | 00ca284 | 2008-06-26 20:14:00 +0000 | [diff] [blame] | 2154 | dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h |
| 2155 | dnl is missing. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2156 | AC_MSG_CHECKING(if X11 header files can be found) |
| 2157 | cflags_save=$CFLAGS |
| 2158 | CFLAGS="$CFLAGS $X_CFLAGS" |
Bram Moolenaar | 00ca284 | 2008-06-26 20:14:00 +0000 | [diff] [blame] | 2159 | AC_TRY_COMPILE([#include <X11/Xlib.h> |
| 2160 | #include <X11/Intrinsic.h>], , |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2161 | AC_MSG_RESULT(yes), |
| 2162 | AC_MSG_RESULT(no); no_x=yes) |
| 2163 | CFLAGS=$cflags_save |
| 2164 | |
| 2165 | if test "${no_x-no}" = yes; then |
| 2166 | with_x=no |
| 2167 | else |
| 2168 | AC_DEFINE(HAVE_X11) |
| 2169 | X_LIB="-lXt -lX11"; |
| 2170 | AC_SUBST(X_LIB) |
| 2171 | |
| 2172 | ac_save_LDFLAGS="$LDFLAGS" |
| 2173 | LDFLAGS="-L$x_libraries $LDFLAGS" |
| 2174 | |
| 2175 | dnl Check for -lXdmcp (needed on SunOS 4.1.4) |
| 2176 | dnl For HP-UX 10.20 it must be before -lSM -lICE |
| 2177 | AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],, |
| 2178 | [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp]) |
| 2179 | |
| 2180 | dnl Some systems need -lnsl -lsocket when testing for ICE. |
| 2181 | dnl The check above doesn't do this, try here (again). Also needed to get |
| 2182 | dnl them after Xdmcp. link.sh will remove them when not needed. |
| 2183 | dnl Check for other function than above to avoid the cached value |
| 2184 | AC_CHECK_LIB(ICE, IceOpenConnection, |
| 2185 | [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS]) |
| 2186 | |
| 2187 | dnl Check for -lXpm (needed for some versions of Motif) |
| 2188 | LDFLAGS="$X_LIBS $ac_save_LDFLAGS" |
| 2189 | AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],, |
| 2190 | [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS]) |
| 2191 | |
| 2192 | dnl Check that the X11 header files don't use implicit declarations |
| 2193 | AC_MSG_CHECKING(if X11 header files implicitly declare return values) |
| 2194 | cflags_save=$CFLAGS |
Bram Moolenaar | d186459 | 2013-05-04 04:40:15 +0200 | [diff] [blame] | 2195 | dnl -Werror is GCC only, others like Solaris Studio might not like it |
| 2196 | if test "$GCC" = yes; then |
| 2197 | CFLAGS="$CFLAGS $X_CFLAGS -Werror" |
| 2198 | else |
| 2199 | CFLAGS="$CFLAGS $X_CFLAGS" |
| 2200 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2201 | AC_TRY_COMPILE([#include <X11/Xlib.h>], , |
| 2202 | AC_MSG_RESULT(no), |
| 2203 | CFLAGS="$CFLAGS -Wno-implicit-int" |
| 2204 | AC_TRY_COMPILE([#include <X11/Xlib.h>], , |
| 2205 | AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int", |
| 2206 | AC_MSG_RESULT(test failed) |
| 2207 | ) |
| 2208 | ) |
| 2209 | CFLAGS=$cflags_save |
| 2210 | |
| 2211 | LDFLAGS="$ac_save_LDFLAGS" |
| 2212 | |
Bram Moolenaar | 4bdbbf7 | 2009-05-21 21:27:43 +0000 | [diff] [blame] | 2213 | AC_MSG_CHECKING(size of wchar_t is 2 bytes) |
| 2214 | AC_CACHE_VAL(ac_cv_small_wchar_t, |
| 2215 | [AC_TRY_RUN([ |
| 2216 | #include <X11/Xlib.h> |
| 2217 | #if STDC_HEADERS |
| 2218 | # include <stdlib.h> |
| 2219 | # include <stddef.h> |
| 2220 | #endif |
| 2221 | main() |
| 2222 | { |
| 2223 | if (sizeof(wchar_t) <= 2) |
| 2224 | exit(1); |
| 2225 | exit(0); |
| 2226 | }], |
| 2227 | ac_cv_small_wchar_t="no", |
| 2228 | ac_cv_small_wchar_t="yes", |
| 2229 | AC_MSG_ERROR(failed to compile test program))]) |
| 2230 | AC_MSG_RESULT($ac_cv_small_wchar_t) |
| 2231 | if test "x$ac_cv_small_wchar_t" = "xyes" ; then |
| 2232 | AC_DEFINE(SMALL_WCHAR_T) |
| 2233 | fi |
| 2234 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2235 | fi |
| 2236 | fi |
| 2237 | |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 2238 | test "x$with_x" = xno -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2239 | |
| 2240 | AC_MSG_CHECKING(--enable-gui argument) |
| 2241 | AC_ARG_ENABLE(gui, |
Bram Moolenaar | 8008b63 | 2017-07-18 21:33:20 +0200 | [diff] [blame] | 2242 | [ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2243 | |
| 2244 | dnl Canonicalize the --enable-gui= argument so that it can be easily compared. |
| 2245 | dnl Do not use character classes for portability with old tools. |
| 2246 | enable_gui_canon=`echo "_$enable_gui" | \ |
| 2247 | sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
| 2248 | |
| 2249 | dnl Skip everything by default. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2250 | SKIP_GTK2=YES |
Bram Moolenaar | 1858a84 | 2016-02-23 22:30:31 +0100 | [diff] [blame] | 2251 | SKIP_GTK3=YES |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2252 | SKIP_GNOME=YES |
| 2253 | SKIP_MOTIF=YES |
| 2254 | SKIP_ATHENA=YES |
| 2255 | SKIP_NEXTAW=YES |
| 2256 | SKIP_PHOTON=YES |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2257 | SKIP_CARBON=YES |
| 2258 | GUITYPE=NONE |
| 2259 | |
Bram Moolenaar | b11160e | 2005-01-04 21:31:43 +0000 | [diff] [blame] | 2260 | if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2261 | SKIP_PHOTON= |
| 2262 | case "$enable_gui_canon" in |
| 2263 | no) AC_MSG_RESULT(no GUI support) |
| 2264 | SKIP_PHOTON=YES ;; |
| 2265 | yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;; |
| 2266 | auto) AC_MSG_RESULT(auto - automatic GUI support) ;; |
| 2267 | photon) AC_MSG_RESULT(Photon GUI support) ;; |
| 2268 | *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) |
| 2269 | SKIP_PHOTON=YES ;; |
| 2270 | esac |
| 2271 | |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 2272 | elif test "x$MACOS_X" = "xyes" -a "x$with_x" = "xno" ; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2273 | SKIP_CARBON= |
| 2274 | case "$enable_gui_canon" in |
| 2275 | no) AC_MSG_RESULT(no GUI support) |
| 2276 | SKIP_CARBON=YES ;; |
| 2277 | yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;; |
Bram Moolenaar | 164fca3 | 2010-07-14 13:58:07 +0200 | [diff] [blame] | 2278 | auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support) |
| 2279 | SKIP_CARBON=YES ;; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2280 | carbon) AC_MSG_RESULT(Carbon GUI support) ;; |
| 2281 | *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) |
| 2282 | SKIP_CARBON=YES ;; |
| 2283 | esac |
| 2284 | |
| 2285 | else |
| 2286 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2287 | case "$enable_gui_canon" in |
| 2288 | no|none) AC_MSG_RESULT(no GUI support) ;; |
| 2289 | yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2290 | SKIP_GTK2= |
| 2291 | SKIP_GNOME= |
| 2292 | SKIP_MOTIF= |
| 2293 | SKIP_ATHENA= |
| 2294 | SKIP_NEXTAW= |
| 2295 | SKIP_CARBON=;; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2296 | gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2297 | SKIP_GTK2=;; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2298 | gnome2) AC_MSG_RESULT(GNOME 2.x GUI support) |
| 2299 | SKIP_GNOME= |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2300 | SKIP_GTK2=;; |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 2301 | gtk3) AC_MSG_RESULT(GTK+ 3.x GUI support) |
| 2302 | SKIP_GTK3=;; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2303 | motif) AC_MSG_RESULT(Motif GUI support) |
| 2304 | SKIP_MOTIF=;; |
| 2305 | athena) AC_MSG_RESULT(Athena GUI support) |
| 2306 | SKIP_ATHENA=;; |
| 2307 | nextaw) AC_MSG_RESULT(neXtaw GUI support) |
| 2308 | SKIP_NEXTAW=;; |
| 2309 | *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;; |
| 2310 | esac |
| 2311 | |
| 2312 | fi |
| 2313 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2314 | if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \ |
| 2315 | -a "$enable_gui_canon" != "gnome2"; then |
| 2316 | AC_MSG_CHECKING(whether or not to look for GTK+ 2) |
| 2317 | AC_ARG_ENABLE(gtk2-check, |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2318 | [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]], |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2319 | , enable_gtk2_check="yes") |
| 2320 | AC_MSG_RESULT($enable_gtk2_check) |
| 2321 | if test "x$enable_gtk2_check" = "xno"; then |
| 2322 | SKIP_GTK2=YES |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2323 | SKIP_GNOME=YES |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2324 | fi |
| 2325 | fi |
| 2326 | |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2327 | if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2328 | AC_MSG_CHECKING(whether or not to look for GNOME) |
| 2329 | AC_ARG_ENABLE(gnome-check, |
| 2330 | [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]], |
| 2331 | , enable_gnome_check="no") |
| 2332 | AC_MSG_RESULT($enable_gnome_check) |
| 2333 | if test "x$enable_gnome_check" = "xno"; then |
| 2334 | SKIP_GNOME=YES |
| 2335 | fi |
| 2336 | fi |
| 2337 | |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 2338 | if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then |
| 2339 | AC_MSG_CHECKING(whether or not to look for GTK+ 3) |
| 2340 | AC_ARG_ENABLE(gtk3-check, |
| 2341 | [ --enable-gtk3-check If auto-select GUI, check for GTK+ 3 [default=yes]], |
| 2342 | , enable_gtk3_check="yes") |
| 2343 | AC_MSG_RESULT($enable_gtk3_check) |
| 2344 | if test "x$enable_gtk3_check" = "xno"; then |
| 2345 | SKIP_GTK3=YES |
| 2346 | fi |
| 2347 | fi |
| 2348 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2349 | if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then |
| 2350 | AC_MSG_CHECKING(whether or not to look for Motif) |
| 2351 | AC_ARG_ENABLE(motif-check, |
| 2352 | [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]], |
| 2353 | , enable_motif_check="yes") |
| 2354 | AC_MSG_RESULT($enable_motif_check) |
| 2355 | if test "x$enable_motif_check" = "xno"; then |
| 2356 | SKIP_MOTIF=YES |
| 2357 | fi |
| 2358 | fi |
| 2359 | |
| 2360 | if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then |
| 2361 | AC_MSG_CHECKING(whether or not to look for Athena) |
| 2362 | AC_ARG_ENABLE(athena-check, |
| 2363 | [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]], |
| 2364 | , enable_athena_check="yes") |
| 2365 | AC_MSG_RESULT($enable_athena_check) |
| 2366 | if test "x$enable_athena_check" = "xno"; then |
| 2367 | SKIP_ATHENA=YES |
| 2368 | fi |
| 2369 | fi |
| 2370 | |
| 2371 | if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then |
| 2372 | AC_MSG_CHECKING(whether or not to look for neXtaw) |
| 2373 | AC_ARG_ENABLE(nextaw-check, |
| 2374 | [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]], |
| 2375 | , enable_nextaw_check="yes") |
| 2376 | AC_MSG_RESULT($enable_nextaw_check); |
| 2377 | if test "x$enable_nextaw_check" = "xno"; then |
| 2378 | SKIP_NEXTAW=YES |
| 2379 | fi |
| 2380 | fi |
| 2381 | |
| 2382 | if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then |
| 2383 | AC_MSG_CHECKING(whether or not to look for Carbon) |
| 2384 | AC_ARG_ENABLE(carbon-check, |
| 2385 | [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]], |
| 2386 | , enable_carbon_check="yes") |
| 2387 | AC_MSG_RESULT($enable_carbon_check); |
| 2388 | if test "x$enable_carbon_check" = "xno"; then |
| 2389 | SKIP_CARBON=YES |
| 2390 | fi |
| 2391 | fi |
| 2392 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 2393 | |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 2394 | if test "x$MACOS_X" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2395 | AC_MSG_CHECKING(for Carbon GUI) |
Bram Moolenaar | 1471681 | 2006-05-04 21:54:08 +0000 | [diff] [blame] | 2396 | dnl already did the check, just give the message |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2397 | AC_MSG_RESULT(yes); |
| 2398 | GUITYPE=CARBONGUI |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 2399 | if test "$VIMNAME" = "vim"; then |
| 2400 | VIMNAME=Vim |
| 2401 | fi |
Bram Moolenaar | 1471681 | 2006-05-04 21:54:08 +0000 | [diff] [blame] | 2402 | |
Bram Moolenaar | 164fca3 | 2010-07-14 13:58:07 +0200 | [diff] [blame] | 2403 | if test "x$MACARCH" = "xboth"; then |
| 2404 | CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon" |
| 2405 | else |
| 2406 | CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon" |
| 2407 | fi |
| 2408 | |
Bram Moolenaar | 1471681 | 2006-05-04 21:54:08 +0000 | [diff] [blame] | 2409 | dnl Default install directory is not /usr/local |
| 2410 | if test x$prefix = xNONE; then |
| 2411 | prefix=/Applications |
| 2412 | fi |
| 2413 | |
| 2414 | dnl Sorry for the hard coded default |
| 2415 | datadir='${prefix}/Vim.app/Contents/Resources' |
| 2416 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2417 | dnl skip everything else |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2418 | SKIP_GTK2=YES; |
| 2419 | SKIP_GNOME=YES; |
| 2420 | SKIP_MOTIF=YES; |
| 2421 | SKIP_ATHENA=YES; |
| 2422 | SKIP_NEXTAW=YES; |
| 2423 | SKIP_PHOTON=YES; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2424 | SKIP_CARBON=YES |
| 2425 | fi |
| 2426 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2427 | dnl define an autoconf function to check for a specified version of GTK, and |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2428 | dnl try to compile/link a GTK program. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2429 | dnl |
| 2430 | dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
Bram Moolenaar | 7b0294c | 2004-10-11 10:16:09 +0000 | [diff] [blame] | 2431 | dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2432 | dnl |
| 2433 | AC_DEFUN(AM_PATH_GTK, |
| 2434 | [ |
| 2435 | if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then |
| 2436 | { |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2437 | no_gtk="" |
| 2438 | if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ |
| 2439 | && $PKG_CONFIG --exists gtk+-2.0; then |
| 2440 | { |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 2441 | min_gtk_version=ifelse([$1], ,2.2.0,$1) |
| 2442 | AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2443 | dnl We should be using PKG_CHECK_MODULES() instead of this hack. |
| 2444 | dnl But I guess the dependency on pkgconfig.m4 is not wanted or |
| 2445 | dnl something like that. |
| 2446 | GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0` |
Bram Moolenaar | 7b0294c | 2004-10-11 10:16:09 +0000 | [diff] [blame] | 2447 | GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0` |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2448 | GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0` |
| 2449 | gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ |
| 2450 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 2451 | gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ |
| 2452 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
| 2453 | gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ |
| 2454 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` |
| 2455 | } |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 2456 | elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \ |
| 2457 | && $PKG_CONFIG --exists gtk+-3.0; then |
| 2458 | { |
| 2459 | min_gtk_version=ifelse([$1], ,3.0.0,$1) |
| 2460 | AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) |
| 2461 | |
| 2462 | GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0` |
| 2463 | GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0` |
| 2464 | GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0` |
| 2465 | gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ |
| 2466 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 2467 | gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ |
| 2468 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
| 2469 | gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \ |
| 2470 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` |
| 2471 | } |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2472 | else |
| 2473 | no_gtk=yes |
| 2474 | fi |
| 2475 | |
| 2476 | if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then |
| 2477 | { |
| 2478 | ac_save_CFLAGS="$CFLAGS" |
| 2479 | ac_save_LIBS="$LIBS" |
| 2480 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
| 2481 | LIBS="$LIBS $GTK_LIBS" |
| 2482 | |
| 2483 | dnl |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2484 | dnl Now check if the installed GTK is sufficiently new. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2485 | dnl |
| 2486 | rm -f conf.gtktest |
| 2487 | AC_TRY_RUN([ |
| 2488 | #include <gtk/gtk.h> |
| 2489 | #include <stdio.h> |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 2490 | #if STDC_HEADERS |
| 2491 | # include <stdlib.h> |
| 2492 | # include <stddef.h> |
| 2493 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2494 | |
| 2495 | int |
| 2496 | main () |
| 2497 | { |
| 2498 | int major, minor, micro; |
| 2499 | char *tmp_version; |
| 2500 | |
| 2501 | system ("touch conf.gtktest"); |
| 2502 | |
| 2503 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
| 2504 | tmp_version = g_strdup("$min_gtk_version"); |
| 2505 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
| 2506 | printf("%s, bad version string\n", "$min_gtk_version"); |
| 2507 | exit(1); |
| 2508 | } |
| 2509 | |
| 2510 | if ((gtk_major_version > major) || |
| 2511 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || |
| 2512 | ((gtk_major_version == major) && (gtk_minor_version == minor) && |
| 2513 | (gtk_micro_version >= micro))) |
| 2514 | { |
| 2515 | return 0; |
| 2516 | } |
| 2517 | return 1; |
| 2518 | } |
| 2519 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
| 2520 | CFLAGS="$ac_save_CFLAGS" |
| 2521 | LIBS="$ac_save_LIBS" |
| 2522 | } |
| 2523 | fi |
| 2524 | if test "x$no_gtk" = x ; then |
| 2525 | if test "x$enable_gtktest" = "xyes"; then |
| 2526 | AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version) |
| 2527 | else |
| 2528 | AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version) |
| 2529 | fi |
| 2530 | ifelse([$2], , :, [$2]) |
| 2531 | else |
| 2532 | { |
| 2533 | AC_MSG_RESULT(no) |
| 2534 | GTK_CFLAGS="" |
| 2535 | GTK_LIBS="" |
| 2536 | ifelse([$3], , :, [$3]) |
| 2537 | } |
| 2538 | fi |
| 2539 | } |
| 2540 | else |
| 2541 | GTK_CFLAGS="" |
| 2542 | GTK_LIBS="" |
| 2543 | ifelse([$3], , :, [$3]) |
| 2544 | fi |
| 2545 | AC_SUBST(GTK_CFLAGS) |
| 2546 | AC_SUBST(GTK_LIBS) |
| 2547 | rm -f conf.gtktest |
| 2548 | ]) |
| 2549 | |
| 2550 | dnl --------------------------------------------------------------------------- |
| 2551 | dnl gnome |
| 2552 | dnl --------------------------------------------------------------------------- |
| 2553 | AC_DEFUN([GNOME_INIT_HOOK], |
| 2554 | [ |
| 2555 | AC_SUBST(GNOME_LIBS) |
| 2556 | AC_SUBST(GNOME_LIBDIR) |
| 2557 | AC_SUBST(GNOME_INCLUDEDIR) |
| 2558 | |
| 2559 | AC_ARG_WITH(gnome-includes, |
| 2560 | [ --with-gnome-includes=DIR Specify location of GNOME headers], |
| 2561 | [CFLAGS="$CFLAGS -I$withval"] |
| 2562 | ) |
| 2563 | |
| 2564 | AC_ARG_WITH(gnome-libs, |
| 2565 | [ --with-gnome-libs=DIR Specify location of GNOME libs], |
| 2566 | [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval] |
| 2567 | ) |
| 2568 | |
| 2569 | AC_ARG_WITH(gnome, |
| 2570 | [ --with-gnome Specify prefix for GNOME files], |
| 2571 | if test x$withval = xyes; then |
| 2572 | want_gnome=yes |
| 2573 | ifelse([$1], [], :, [$1]) |
| 2574 | else |
| 2575 | if test "x$withval" = xno; then |
| 2576 | want_gnome=no |
| 2577 | else |
| 2578 | want_gnome=yes |
| 2579 | LDFLAGS="$LDFLAGS -L$withval/lib" |
| 2580 | CFLAGS="$CFLAGS -I$withval/include" |
| 2581 | gnome_prefix=$withval/lib |
| 2582 | fi |
| 2583 | fi, |
| 2584 | want_gnome=yes) |
| 2585 | |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2586 | if test "x$want_gnome" = xyes; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2587 | { |
| 2588 | AC_MSG_CHECKING(for libgnomeui-2.0) |
| 2589 | if $PKG_CONFIG --exists libgnomeui-2.0; then |
| 2590 | AC_MSG_RESULT(yes) |
| 2591 | GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0` |
| 2592 | GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0` |
| 2593 | GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0` |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 2594 | |
Bram Moolenaar | 97b2ad3 | 2006-03-18 21:40:56 +0000 | [diff] [blame] | 2595 | dnl On FreeBSD we need -pthread but pkg-config doesn't include it. |
| 2596 | dnl This might not be the right way but it works for me... |
| 2597 | AC_MSG_CHECKING(for FreeBSD) |
| 2598 | if test "`(uname) 2>/dev/null`" = FreeBSD; then |
| 2599 | AC_MSG_RESULT(yes, adding -pthread) |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 2600 | GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE" |
Bram Moolenaar | 97b2ad3 | 2006-03-18 21:40:56 +0000 | [diff] [blame] | 2601 | GNOME_LIBS="$GNOME_LIBS -pthread" |
| 2602 | else |
| 2603 | AC_MSG_RESULT(no) |
| 2604 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2605 | $1 |
| 2606 | else |
| 2607 | AC_MSG_RESULT(not found) |
| 2608 | if test "x$2" = xfail; then |
| 2609 | AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config) |
| 2610 | fi |
| 2611 | fi |
| 2612 | } |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2613 | fi |
| 2614 | ]) |
| 2615 | |
| 2616 | AC_DEFUN([GNOME_INIT],[ |
| 2617 | GNOME_INIT_HOOK([],fail) |
| 2618 | ]) |
| 2619 | |
| 2620 | |
| 2621 | dnl --------------------------------------------------------------------------- |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2622 | dnl Check for GTK2. If it fails, then continue on for Motif as before... |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2623 | dnl --------------------------------------------------------------------------- |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2624 | if test -z "$SKIP_GTK2"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2625 | |
| 2626 | AC_MSG_CHECKING(--disable-gtktest argument) |
| 2627 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], |
| 2628 | , enable_gtktest=yes) |
| 2629 | if test "x$enable_gtktest" = "xyes" ; then |
| 2630 | AC_MSG_RESULT(gtk test enabled) |
| 2631 | else |
| 2632 | AC_MSG_RESULT(gtk test disabled) |
| 2633 | fi |
| 2634 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2635 | if test "X$PKG_CONFIG" = "X"; then |
| 2636 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
| 2637 | fi |
| 2638 | |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2639 | if test "x$PKG_CONFIG" != "xno"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2640 | dnl First try finding version 2.2.0 or later. The 2.0.x series has |
| 2641 | dnl problems (bold fonts, --remote doesn't work). |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2642 | AM_PATH_GTK(2.2.0, |
| 2643 | [GUI_LIB_LOC="$GTK_LIBDIR" |
| 2644 | GTK_LIBNAME="$GTK_LIBS" |
| 2645 | GUI_INC_LOC="$GTK_CFLAGS"], ) |
| 2646 | if test "x$GTK_CFLAGS" != "x"; then |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 2647 | SKIP_GTK3=YES |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2648 | SKIP_ATHENA=YES |
| 2649 | SKIP_NEXTAW=YES |
| 2650 | SKIP_MOTIF=YES |
| 2651 | GUITYPE=GTK |
| 2652 | AC_SUBST(GTK_LIBNAME) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2653 | fi |
| 2654 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2655 | if test "x$GUITYPE" = "xGTK"; then |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2656 | dnl |
| 2657 | dnl if GTK exists, then check for GNOME. |
| 2658 | dnl |
| 2659 | if test -z "$SKIP_GNOME"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2660 | { |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 2661 | GNOME_INIT_HOOK([have_gnome=yes]) |
| 2662 | if test "x$have_gnome" = xyes ; then |
| 2663 | AC_DEFINE(FEAT_GUI_GNOME) |
| 2664 | GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR" |
| 2665 | GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2666 | fi |
| 2667 | } |
| 2668 | fi |
| 2669 | fi |
| 2670 | fi |
| 2671 | |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 2672 | |
| 2673 | dnl --------------------------------------------------------------------------- |
| 2674 | dnl Check for GTK3. |
| 2675 | dnl --------------------------------------------------------------------------- |
| 2676 | if test -z "$SKIP_GTK3"; then |
| 2677 | |
| 2678 | AC_MSG_CHECKING(--disable-gtktest argument) |
| 2679 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], |
| 2680 | , enable_gtktest=yes) |
| 2681 | if test "x$enable_gtktest" = "xyes" ; then |
| 2682 | AC_MSG_RESULT(gtk test enabled) |
| 2683 | else |
| 2684 | AC_MSG_RESULT(gtk test disabled) |
| 2685 | fi |
| 2686 | |
| 2687 | if test "X$PKG_CONFIG" = "X"; then |
| 2688 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
| 2689 | fi |
| 2690 | |
| 2691 | if test "x$PKG_CONFIG" != "xno"; then |
| 2692 | AM_PATH_GTK(3.0.0, |
| 2693 | [GUI_LIB_LOC="$GTK_LIBDIR" |
| 2694 | GTK_LIBNAME="$GTK_LIBS" |
| 2695 | GUI_INC_LOC="$GTK_CFLAGS"], ) |
| 2696 | if test "x$GTK_CFLAGS" != "x"; then |
| 2697 | SKIP_GTK2=YES |
| 2698 | SKIP_GNOME=YES |
| 2699 | SKIP_ATHENA=YES |
| 2700 | SKIP_NEXTAW=YES |
| 2701 | SKIP_MOTIF=YES |
| 2702 | GUITYPE=GTK |
| 2703 | AC_SUBST(GTK_LIBNAME) |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 2704 | AC_DEFINE(USE_GTK3) |
| 2705 | fi |
| 2706 | fi |
| 2707 | fi |
| 2708 | |
Bram Moolenaar | d2e03f0 | 2016-01-02 22:46:36 +0100 | [diff] [blame] | 2709 | dnl Check the version of Gdk-Pixbuf. If the version is 2.31 or later and |
Bram Moolenaar | 36e294c | 2015-12-29 18:55:46 +0100 | [diff] [blame] | 2710 | dnl glib-compile-resources is found in PATH, use GResource. |
| 2711 | if test "x$GUITYPE" = "xGTK"; then |
| 2712 | AC_MSG_CHECKING([version of Gdk-Pixbuf]) |
| 2713 | gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0` |
| 2714 | if test "x$gdk_pixbuf_version" != x ; then |
| 2715 | gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \ |
| 2716 | sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'` |
| 2717 | if test "x$gdk_pixbuf_version_minor" != x -a \ |
Bram Moolenaar | 33c31d5 | 2016-02-22 21:07:06 +0100 | [diff] [blame] | 2718 | $gdk_pixbuf_version_minor -ge 31 ; then |
Bram Moolenaar | 36e294c | 2015-12-29 18:55:46 +0100 | [diff] [blame] | 2719 | AC_MSG_RESULT([OK.]) |
| 2720 | AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no) |
| 2721 | AC_MSG_CHECKING([glib-compile-resources]) |
| 2722 | if test "x$GLIB_COMPILE_RESOURCES" = xno ; then |
Bram Moolenaar | 33c31d5 | 2016-02-22 21:07:06 +0100 | [diff] [blame] | 2723 | GLIB_COMPILE_RESOURCES="" |
| 2724 | AC_MSG_RESULT([cannot be found in PATH.]) |
Bram Moolenaar | 36e294c | 2015-12-29 18:55:46 +0100 | [diff] [blame] | 2725 | else |
| 2726 | AC_MSG_RESULT([usable.]) |
Bram Moolenaar | 33c31d5 | 2016-02-22 21:07:06 +0100 | [diff] [blame] | 2727 | AC_DEFINE(USE_GRESOURCE) |
| 2728 | GRESOURCE_SRC="auto/gui_gtk_gresources.c" |
| 2729 | GRESOURCE_OBJ="objects/gui_gtk_gresources.o" |
Bram Moolenaar | 36e294c | 2015-12-29 18:55:46 +0100 | [diff] [blame] | 2730 | fi |
| 2731 | else |
| 2732 | AC_MSG_RESULT([not usable.]) |
| 2733 | fi |
| 2734 | else |
| 2735 | AC_MSG_RESULT([cannot obtain from pkg_config.]) |
| 2736 | fi |
Bram Moolenaar | 4adfaab | 2016-04-21 18:20:11 +0200 | [diff] [blame] | 2737 | |
| 2738 | AC_MSG_CHECKING([--disable-icon-cache-update argument]) |
| 2739 | AC_ARG_ENABLE(icon_cache_update, |
| 2740 | [ --disable-icon-cache-update update disabled], |
| 2741 | [], |
| 2742 | [enable_icon_cache_update="yes"]) |
| 2743 | if test "$enable_icon_cache_update" = "yes"; then |
| 2744 | AC_MSG_RESULT([not set]) |
| 2745 | AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no) |
| 2746 | if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then |
| 2747 | AC_MSG_RESULT([not found in PATH.]) |
| 2748 | fi |
| 2749 | else |
| 2750 | AC_MSG_RESULT([update disabled]) |
| 2751 | fi |
| 2752 | |
| 2753 | AC_MSG_CHECKING([--disable-desktop-database-update argument]) |
| 2754 | AC_ARG_ENABLE(desktop_database_update, |
| 2755 | [ --disable-desktop-database-update update disabled], |
| 2756 | [], |
| 2757 | [enable_desktop_database_update="yes"]) |
| 2758 | if test "$enable_desktop_database_update" = "yes"; then |
| 2759 | AC_MSG_RESULT([not set]) |
| 2760 | AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no) |
| 2761 | if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then |
| 2762 | AC_MSG_RESULT([not found in PATH.]) |
| 2763 | fi |
| 2764 | else |
| 2765 | AC_MSG_RESULT([update disabled]) |
| 2766 | fi |
Bram Moolenaar | 36e294c | 2015-12-29 18:55:46 +0100 | [diff] [blame] | 2767 | fi |
| 2768 | AC_SUBST(GLIB_COMPILE_RESOURCES) |
Bram Moolenaar | 36e294c | 2015-12-29 18:55:46 +0100 | [diff] [blame] | 2769 | AC_SUBST(GRESOURCE_SRC) |
| 2770 | AC_SUBST(GRESOURCE_OBJ) |
Bram Moolenaar | 4adfaab | 2016-04-21 18:20:11 +0200 | [diff] [blame] | 2771 | AC_SUBST(GTK_UPDATE_ICON_CACHE) |
| 2772 | AC_SUBST(UPDATE_DESKTOP_DATABASE) |
Bram Moolenaar | 36e294c | 2015-12-29 18:55:46 +0100 | [diff] [blame] | 2773 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2774 | dnl Check for Motif include files location. |
| 2775 | dnl The LAST one found is used, this makes the highest version to be used, |
| 2776 | dnl e.g. when Motif1.2 and Motif2.0 are both present. |
| 2777 | |
| 2778 | if test -z "$SKIP_MOTIF"; then |
| 2779 | gui_XXX="/usr/XXX/Motif* /usr/Motif*/XXX /usr/XXX /usr/shlib /usr/X11*/XXX /usr/XXX/X11* /usr/dt/XXX /local/Motif*/XXX /local/XXX/Motif* /usr/local/Motif*/XXX /usr/local/XXX/Motif* /usr/local/XXX /usr/local/X11*/XXX /usr/local/LessTif/Motif*/XXX $MOTIFHOME/XXX" |
| 2780 | dnl Remove "-I" from before $GUI_INC_LOC if it's there |
| 2781 | GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`" |
| 2782 | |
| 2783 | AC_MSG_CHECKING(for location of Motif GUI includes) |
| 2784 | gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC" |
| 2785 | GUI_INC_LOC= |
| 2786 | for try in $gui_includes; do |
| 2787 | if test -f "$try/Xm/Xm.h"; then |
| 2788 | GUI_INC_LOC=$try |
| 2789 | fi |
| 2790 | done |
| 2791 | if test -n "$GUI_INC_LOC"; then |
| 2792 | if test "$GUI_INC_LOC" = /usr/include; then |
| 2793 | GUI_INC_LOC= |
| 2794 | AC_MSG_RESULT(in default path) |
| 2795 | else |
| 2796 | AC_MSG_RESULT($GUI_INC_LOC) |
| 2797 | fi |
| 2798 | else |
| 2799 | AC_MSG_RESULT(<not found>) |
| 2800 | SKIP_MOTIF=YES |
| 2801 | fi |
| 2802 | fi |
| 2803 | |
| 2804 | dnl Check for Motif library files location. In the same order as the include |
| 2805 | dnl files, to avoid a mixup if several versions are present |
| 2806 | |
| 2807 | if test -z "$SKIP_MOTIF"; then |
| 2808 | AC_MSG_CHECKING(--with-motif-lib argument) |
| 2809 | AC_ARG_WITH(motif-lib, |
Bram Moolenaar | 8008b63 | 2017-07-18 21:33:20 +0200 | [diff] [blame] | 2810 | [ --with-motif-lib=STRING Library for Motif ], |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2811 | [ MOTIF_LIBNAME="${withval}" ] ) |
| 2812 | |
| 2813 | if test -n "$MOTIF_LIBNAME"; then |
| 2814 | AC_MSG_RESULT($MOTIF_LIBNAME) |
| 2815 | GUI_LIB_LOC= |
| 2816 | else |
| 2817 | AC_MSG_RESULT(no) |
| 2818 | |
| 2819 | dnl Remove "-L" from before $GUI_LIB_LOC if it's there |
| 2820 | GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`" |
| 2821 | |
Bram Moolenaar | 6324c3b | 2013-06-17 20:27:18 +0200 | [diff] [blame] | 2822 | dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere. The |
| 2823 | dnl linker will figure out which one to use, we only check if one exists. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2824 | AC_MSG_CHECKING(for location of Motif GUI libs) |
Bram Moolenaar | 6324c3b | 2013-06-17 20:27:18 +0200 | [diff] [blame] | 2825 | gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2826 | GUI_LIB_LOC= |
| 2827 | for try in $gui_libs; do |
Bram Moolenaar | 325b7a2 | 2004-07-05 15:58:32 +0000 | [diff] [blame] | 2828 | for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2829 | if test -f "$libtry"; then |
| 2830 | GUI_LIB_LOC=$try |
| 2831 | fi |
| 2832 | done |
| 2833 | done |
| 2834 | if test -n "$GUI_LIB_LOC"; then |
| 2835 | dnl Remove /usr/lib, it causes trouble on some systems |
Bram Moolenaar | 6324c3b | 2013-06-17 20:27:18 +0200 | [diff] [blame] | 2836 | if test "$GUI_LIB_LOC" = /usr/lib \ |
| 2837 | -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \ |
| 2838 | -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2839 | GUI_LIB_LOC= |
| 2840 | AC_MSG_RESULT(in default path) |
| 2841 | else |
| 2842 | if test -n "$GUI_LIB_LOC"; then |
| 2843 | AC_MSG_RESULT($GUI_LIB_LOC) |
| 2844 | if test "`(uname) 2>/dev/null`" = SunOS && |
| 2845 | uname -r | grep '^5' >/dev/null; then |
| 2846 | GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC" |
| 2847 | fi |
| 2848 | fi |
| 2849 | fi |
| 2850 | MOTIF_LIBNAME=-lXm |
| 2851 | else |
| 2852 | AC_MSG_RESULT(<not found>) |
| 2853 | SKIP_MOTIF=YES |
| 2854 | fi |
| 2855 | fi |
| 2856 | fi |
| 2857 | |
| 2858 | if test -z "$SKIP_MOTIF"; then |
| 2859 | SKIP_ATHENA=YES |
| 2860 | SKIP_NEXTAW=YES |
| 2861 | GUITYPE=MOTIF |
| 2862 | AC_SUBST(MOTIF_LIBNAME) |
| 2863 | fi |
| 2864 | |
| 2865 | dnl Check if the Athena files can be found |
| 2866 | |
| 2867 | GUI_X_LIBS= |
| 2868 | |
| 2869 | if test -z "$SKIP_ATHENA"; then |
| 2870 | AC_MSG_CHECKING(if Athena header files can be found) |
| 2871 | cflags_save=$CFLAGS |
| 2872 | CFLAGS="$CFLAGS $X_CFLAGS" |
| 2873 | AC_TRY_COMPILE([ |
| 2874 | #include <X11/Intrinsic.h> |
| 2875 | #include <X11/Xaw/Paned.h>], , |
| 2876 | AC_MSG_RESULT(yes), |
| 2877 | AC_MSG_RESULT(no); SKIP_ATHENA=YES ) |
| 2878 | CFLAGS=$cflags_save |
| 2879 | fi |
| 2880 | |
| 2881 | if test -z "$SKIP_ATHENA"; then |
| 2882 | GUITYPE=ATHENA |
| 2883 | fi |
| 2884 | |
| 2885 | if test -z "$SKIP_NEXTAW"; then |
| 2886 | AC_MSG_CHECKING(if neXtaw header files can be found) |
| 2887 | cflags_save=$CFLAGS |
| 2888 | CFLAGS="$CFLAGS $X_CFLAGS" |
| 2889 | AC_TRY_COMPILE([ |
| 2890 | #include <X11/Intrinsic.h> |
| 2891 | #include <X11/neXtaw/Paned.h>], , |
| 2892 | AC_MSG_RESULT(yes), |
| 2893 | AC_MSG_RESULT(no); SKIP_NEXTAW=YES ) |
| 2894 | CFLAGS=$cflags_save |
| 2895 | fi |
| 2896 | |
| 2897 | if test -z "$SKIP_NEXTAW"; then |
| 2898 | GUITYPE=NEXTAW |
| 2899 | fi |
| 2900 | |
| 2901 | if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then |
| 2902 | dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty |
| 2903 | dnl Avoid adding it when it twice |
| 2904 | if test -n "$GUI_INC_LOC"; then |
| 2905 | GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`" |
| 2906 | fi |
| 2907 | if test -n "$GUI_LIB_LOC"; then |
| 2908 | GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`" |
| 2909 | fi |
| 2910 | |
| 2911 | dnl Check for -lXext and then for -lXmu |
| 2912 | ldflags_save=$LDFLAGS |
| 2913 | LDFLAGS="$X_LIBS $LDFLAGS" |
| 2914 | AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],, |
| 2915 | [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) |
| 2916 | dnl For Solaris we need -lw and -ldl before linking with -lXmu works. |
| 2917 | AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],, |
| 2918 | [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) |
| 2919 | AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],, |
| 2920 | [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) |
| 2921 | AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],, |
| 2922 | [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) |
| 2923 | if test -z "$SKIP_MOTIF"; then |
| 2924 | AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],, |
| 2925 | [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) |
| 2926 | fi |
| 2927 | LDFLAGS=$ldflags_save |
| 2928 | |
| 2929 | dnl Execute xmkmf to figure out if -DNARROWPROTO is needed. |
| 2930 | AC_MSG_CHECKING(for extra X11 defines) |
| 2931 | NARROW_PROTO= |
| 2932 | rm -fr conftestdir |
| 2933 | if mkdir conftestdir; then |
| 2934 | cd conftestdir |
| 2935 | cat > Imakefile <<'EOF' |
| 2936 | acfindx: |
| 2937 | @echo 'NARROW_PROTO="${PROTO_DEFINES}"' |
| 2938 | EOF |
| 2939 | if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then |
| 2940 | eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` |
| 2941 | fi |
| 2942 | cd .. |
| 2943 | rm -fr conftestdir |
| 2944 | fi |
| 2945 | if test -z "$NARROW_PROTO"; then |
| 2946 | AC_MSG_RESULT(no) |
| 2947 | else |
| 2948 | AC_MSG_RESULT($NARROW_PROTO) |
| 2949 | fi |
| 2950 | AC_SUBST(NARROW_PROTO) |
| 2951 | fi |
| 2952 | |
| 2953 | dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs |
| 2954 | dnl use the X11 include path |
| 2955 | if test "$enable_xsmp" = "yes"; then |
| 2956 | cppflags_save=$CPPFLAGS |
| 2957 | CPPFLAGS="$CPPFLAGS $X_CFLAGS" |
| 2958 | AC_CHECK_HEADERS(X11/SM/SMlib.h) |
| 2959 | CPPFLAGS=$cppflags_save |
| 2960 | fi |
| 2961 | |
| 2962 | |
Bram Moolenaar | 9892189 | 2016-02-23 17:14:37 +0100 | [diff] [blame] | 2963 | if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2964 | dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path |
| 2965 | cppflags_save=$CPPFLAGS |
| 2966 | CPPFLAGS="$CPPFLAGS $X_CFLAGS" |
| 2967 | AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h) |
| 2968 | |
| 2969 | dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h |
| 2970 | if test ! "$enable_xim" = "no"; then |
| 2971 | AC_MSG_CHECKING(for XIMText in X11/Xlib.h) |
| 2972 | AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>], |
| 2973 | AC_MSG_RESULT(yes), |
Bram Moolenaar | e29b1fe | 2014-04-10 20:00:15 +0200 | [diff] [blame] | 2974 | AC_MSG_RESULT(no; xim has been disabled); enable_xim="no") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2975 | fi |
| 2976 | CPPFLAGS=$cppflags_save |
| 2977 | |
| 2978 | dnl automatically enable XIM when hangul input isn't enabled |
| 2979 | if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \ |
| 2980 | -a "x$GUITYPE" != "xNONE" ; then |
| 2981 | AC_MSG_RESULT(X GUI selected; xim has been enabled) |
| 2982 | enable_xim="yes" |
| 2983 | fi |
| 2984 | fi |
| 2985 | |
| 2986 | if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then |
| 2987 | cppflags_save=$CPPFLAGS |
| 2988 | CPPFLAGS="$CPPFLAGS $X_CFLAGS" |
Bram Moolenaar | 2ce06f6 | 2005-01-31 19:19:04 +0000 | [diff] [blame] | 2989 | dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h |
| 2990 | AC_MSG_CHECKING([for X11/Xmu/Editres.h]) |
| 2991 | AC_TRY_COMPILE([ |
| 2992 | #include <X11/Intrinsic.h> |
| 2993 | #include <X11/Xmu/Editres.h>], |
| 2994 | [int i; i = 0;], |
| 2995 | AC_MSG_RESULT(yes) |
| 2996 | AC_DEFINE(HAVE_X11_XMU_EDITRES_H), |
| 2997 | AC_MSG_RESULT(no)) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2998 | CPPFLAGS=$cppflags_save |
| 2999 | fi |
| 3000 | |
| 3001 | dnl Only use the Xm directory when compiling Motif, don't use it for Athena |
| 3002 | if test -z "$SKIP_MOTIF"; then |
| 3003 | cppflags_save=$CPPFLAGS |
| 3004 | CPPFLAGS="$CPPFLAGS $X_CFLAGS" |
Bram Moolenaar | 77c1935 | 2012-06-13 19:19:41 +0200 | [diff] [blame] | 3005 | if test "$zOSUnix" = "yes"; then |
| 3006 | xmheader="Xm/Xm.h" |
| 3007 | else |
| 3008 | xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 3009 | Xm/UnhighlightT.h Xm/Notebook.h" |
Bram Moolenaar | 77c1935 | 2012-06-13 19:19:41 +0200 | [diff] [blame] | 3010 | fi |
| 3011 | AC_CHECK_HEADERS($xmheader) |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 3012 | |
Bram Moolenaar | 77c1935 | 2012-06-13 19:19:41 +0200 | [diff] [blame] | 3013 | if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 3014 | dnl Solaris uses XpmAttributes_21, very annoying. |
| 3015 | AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h]) |
| 3016 | AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;], |
| 3017 | AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21), |
| 3018 | AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes) |
| 3019 | ) |
| 3020 | else |
Bram Moolenaar | 57657d8 | 2006-04-21 22:12:41 +0000 | [diff] [blame] | 3021 | AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes) |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 3022 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3023 | CPPFLAGS=$cppflags_save |
| 3024 | fi |
| 3025 | |
| 3026 | if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then |
| 3027 | AC_MSG_RESULT(no GUI selected; xim has been disabled) |
| 3028 | enable_xim="no" |
| 3029 | fi |
| 3030 | if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then |
| 3031 | AC_MSG_RESULT(no GUI selected; fontset has been disabled) |
| 3032 | enable_fontset="no" |
| 3033 | fi |
Bram Moolenaar | 182c5be | 2010-06-25 05:37:59 +0200 | [diff] [blame] | 3034 | if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3035 | AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled) |
| 3036 | enable_fontset="no" |
| 3037 | fi |
| 3038 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3039 | if test -z "$SKIP_PHOTON"; then |
| 3040 | GUITYPE=PHOTONGUI |
| 3041 | fi |
| 3042 | |
| 3043 | AC_SUBST(GUI_INC_LOC) |
| 3044 | AC_SUBST(GUI_LIB_LOC) |
| 3045 | AC_SUBST(GUITYPE) |
| 3046 | AC_SUBST(GUI_X_LIBS) |
| 3047 | |
| 3048 | if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then |
| 3049 | AC_MSG_ERROR([cannot use workshop without Motif]) |
| 3050 | fi |
| 3051 | |
| 3052 | dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled |
| 3053 | if test "$enable_xim" = "yes"; then |
| 3054 | AC_DEFINE(FEAT_XIM) |
| 3055 | fi |
| 3056 | if test "$enable_fontset" = "yes"; then |
| 3057 | AC_DEFINE(FEAT_XFONTSET) |
| 3058 | fi |
| 3059 | |
| 3060 | |
| 3061 | dnl --------------------------------------------------------------------------- |
| 3062 | dnl end of GUI-checking |
| 3063 | dnl --------------------------------------------------------------------------- |
| 3064 | |
Bram Moolenaar | f3757f0 | 2017-03-16 15:13:45 +0100 | [diff] [blame] | 3065 | AC_MSG_CHECKING([for /proc link to executable]) |
Bram Moolenaar | 5f69fee | 2017-03-09 11:58:40 +0100 | [diff] [blame] | 3066 | if test -L "/proc/self/exe"; then |
Bram Moolenaar | f3757f0 | 2017-03-16 15:13:45 +0100 | [diff] [blame] | 3067 | dnl Linux |
| 3068 | AC_MSG_RESULT([/proc/self/exe]) |
| 3069 | AC_DEFINE(PROC_EXE_LINK, "/proc/self/exe") |
| 3070 | elif test -L "/proc/self/path/a.out"; then |
| 3071 | dnl Solaris |
| 3072 | AC_MSG_RESULT([/proc/self/path/a.out]) |
| 3073 | AC_DEFINE(PROC_EXE_LINK, "/proc/self/path/a.out") |
| 3074 | elif test -L "/proc/curproc/file"; then |
| 3075 | dnl FreeBSD |
| 3076 | AC_MSG_RESULT([/proc/curproc/file]) |
| 3077 | AC_DEFINE(PROC_EXE_LINK, "/proc/curproc/file") |
Bram Moolenaar | 5f69fee | 2017-03-09 11:58:40 +0100 | [diff] [blame] | 3078 | else |
Bram Moolenaar | f3757f0 | 2017-03-16 15:13:45 +0100 | [diff] [blame] | 3079 | AC_MSG_RESULT(no) |
Bram Moolenaar | 5f69fee | 2017-03-09 11:58:40 +0100 | [diff] [blame] | 3080 | fi |
| 3081 | |
Bram Moolenaar | 693e40c | 2013-02-26 14:56:42 +0100 | [diff] [blame] | 3082 | dnl Check for Cygwin, which needs an extra source file if not using X11 |
Bram Moolenaar | 8def26a | 2015-12-17 15:34:53 +0100 | [diff] [blame] | 3083 | AC_MSG_CHECKING(for CYGWIN or MSYS environment) |
Bram Moolenaar | 693e40c | 2013-02-26 14:56:42 +0100 | [diff] [blame] | 3084 | case `uname` in |
Bram Moolenaar | 8def26a | 2015-12-17 15:34:53 +0100 | [diff] [blame] | 3085 | CYGWIN*|MSYS*) CYGWIN=yes; AC_MSG_RESULT(yes) |
Bram Moolenaar | 693e40c | 2013-02-26 14:56:42 +0100 | [diff] [blame] | 3086 | AC_MSG_CHECKING(for CYGWIN clipboard support) |
| 3087 | if test "x$with_x" = "xno" ; then |
| 3088 | OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o |
| 3089 | AC_MSG_RESULT(yes) |
| 3090 | AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD) |
| 3091 | else |
| 3092 | AC_MSG_RESULT(no - using X11) |
| 3093 | fi ;; |
| 3094 | |
| 3095 | *) CYGWIN=no; AC_MSG_RESULT(no);; |
| 3096 | esac |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3097 | |
| 3098 | dnl Only really enable hangul input when GUI and XFONTSET are available |
| 3099 | if test "$enable_hangulinput" = "yes"; then |
| 3100 | if test "x$GUITYPE" = "xNONE"; then |
| 3101 | AC_MSG_RESULT(no GUI selected; hangul input has been disabled) |
| 3102 | enable_hangulinput=no |
| 3103 | else |
| 3104 | AC_DEFINE(FEAT_HANGULIN) |
| 3105 | HANGULIN_SRC=hangulin.c |
| 3106 | AC_SUBST(HANGULIN_SRC) |
| 3107 | HANGULIN_OBJ=objects/hangulin.o |
| 3108 | AC_SUBST(HANGULIN_OBJ) |
| 3109 | fi |
| 3110 | fi |
| 3111 | |
| 3112 | dnl Checks for libraries and include files. |
| 3113 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3114 | AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken], |
| 3115 | [ |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3116 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3117 | #include "confdefs.h" |
| 3118 | #include <ctype.h> |
| 3119 | #if STDC_HEADERS |
| 3120 | # include <stdlib.h> |
| 3121 | # include <stddef.h> |
| 3122 | #endif |
| 3123 | main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); } |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3124 | ]])],[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3125 | vim_cv_toupper_broken=yes |
| 3126 | ],[ |
| 3127 | vim_cv_toupper_broken=no |
| 3128 | ],[ |
| 3129 | AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken') |
| 3130 | ])]) |
| 3131 | |
| 3132 | if test "x$vim_cv_toupper_broken" = "xyes" ; then |
| 3133 | AC_DEFINE(BROKEN_TOUPPER) |
| 3134 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3135 | |
| 3136 | AC_MSG_CHECKING(whether __DATE__ and __TIME__ work) |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3137 | AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");], |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3138 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME), |
| 3139 | AC_MSG_RESULT(no)) |
| 3140 | |
Bram Moolenaar | 0c094b9 | 2009-05-14 20:20:33 +0000 | [diff] [blame] | 3141 | AC_MSG_CHECKING(whether __attribute__((unused)) is allowed) |
| 3142 | AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));], |
| 3143 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED), |
| 3144 | AC_MSG_RESULT(no)) |
| 3145 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3146 | dnl Checks for header files. |
| 3147 | AC_CHECK_HEADER(elf.h, HAS_ELF=1) |
| 3148 | dnl AC_CHECK_HEADER(dwarf.h, SVR4=1) |
| 3149 | if test "$HAS_ELF" = 1; then |
| 3150 | AC_CHECK_LIB(elf, main) |
| 3151 | fi |
| 3152 | |
| 3153 | AC_HEADER_DIRENT |
| 3154 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3155 | dnl If sys/wait.h is not found it might still exist but not be POSIX |
| 3156 | dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT) |
| 3157 | if test $ac_cv_header_sys_wait_h = no; then |
| 3158 | AC_MSG_CHECKING([for sys/wait.h that defines union wait]) |
| 3159 | AC_TRY_COMPILE([#include <sys/wait.h>], |
| 3160 | [union wait xx, yy; xx = yy], |
| 3161 | AC_MSG_RESULT(yes) |
| 3162 | AC_DEFINE(HAVE_SYS_WAIT_H) |
| 3163 | AC_DEFINE(HAVE_UNION_WAIT), |
| 3164 | AC_MSG_RESULT(no)) |
| 3165 | fi |
| 3166 | |
Bram Moolenaar | 779a775 | 2016-01-30 23:26:34 +0100 | [diff] [blame] | 3167 | AC_CHECK_HEADERS(stdint.h stdlib.h string.h \ |
Bram Moolenaar | fa7584c | 2010-05-19 21:57:45 +0200 | [diff] [blame] | 3168 | sys/select.h sys/utsname.h termcap.h fcntl.h \ |
| 3169 | sgtty.h sys/ioctl.h sys/time.h sys/types.h \ |
| 3170 | termio.h iconv.h inttypes.h langinfo.h math.h \ |
| 3171 | unistd.h stropts.h errno.h sys/resource.h \ |
| 3172 | sys/systeminfo.h locale.h sys/stream.h termios.h \ |
| 3173 | libc.h sys/statfs.h poll.h sys/poll.h pwd.h \ |
| 3174 | utime.h sys/param.h libintl.h libgen.h \ |
| 3175 | util/debug.h util/msg18n.h frame.h sys/acl.h \ |
| 3176 | sys/access.h sys/sysinfo.h wchar.h wctype.h) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3177 | |
Bram Moolenaar | 00ca284 | 2008-06-26 20:14:00 +0000 | [diff] [blame] | 3178 | dnl sys/ptem.h depends on sys/stream.h on Solaris |
| 3179 | AC_CHECK_HEADERS(sys/ptem.h, [], [], |
| 3180 | [#if defined HAVE_SYS_STREAM_H |
| 3181 | # include <sys/stream.h> |
| 3182 | #endif]) |
| 3183 | |
Bram Moolenaar | 32f31b1 | 2009-05-21 13:20:59 +0000 | [diff] [blame] | 3184 | dnl sys/sysctl.h depends on sys/param.h on OpenBSD |
| 3185 | AC_CHECK_HEADERS(sys/sysctl.h, [], [], |
| 3186 | [#if defined HAVE_SYS_PARAM_H |
| 3187 | # include <sys/param.h> |
| 3188 | #endif]) |
| 3189 | |
Bram Moolenaar | 00ca284 | 2008-06-26 20:14:00 +0000 | [diff] [blame] | 3190 | |
Bram Moolenaar | df3267e | 2005-01-25 22:07:05 +0000 | [diff] [blame] | 3191 | dnl pthread_np.h may exist but can only be used after including pthread.h |
| 3192 | AC_MSG_CHECKING([for pthread_np.h]) |
| 3193 | AC_TRY_COMPILE([ |
| 3194 | #include <pthread.h> |
| 3195 | #include <pthread_np.h>], |
| 3196 | [int i; i = 0;], |
| 3197 | AC_MSG_RESULT(yes) |
| 3198 | AC_DEFINE(HAVE_PTHREAD_NP_H), |
| 3199 | AC_MSG_RESULT(no)) |
| 3200 | |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 3201 | AC_CHECK_HEADERS(strings.h) |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 3202 | if test "x$MACOS_X" = "xyes"; then |
Bram Moolenaar | 9372a11 | 2005-12-06 19:59:18 +0000 | [diff] [blame] | 3203 | dnl The strings.h file on OS/X contains a warning and nothing useful. |
| 3204 | AC_DEFINE(NO_STRINGS_WITH_STRING_H) |
| 3205 | else |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3206 | |
| 3207 | dnl Check if strings.h and string.h can both be included when defined. |
| 3208 | AC_MSG_CHECKING([if strings.h can be included after string.h]) |
| 3209 | cppflags_save=$CPPFLAGS |
| 3210 | CPPFLAGS="$CPPFLAGS $X_CFLAGS" |
| 3211 | AC_TRY_COMPILE([ |
| 3212 | #if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO) |
| 3213 | # define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */ |
| 3214 | /* but don't do it on AIX 5.1 (Uribarri) */ |
| 3215 | #endif |
| 3216 | #ifdef HAVE_XM_XM_H |
| 3217 | # include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */ |
| 3218 | #endif |
| 3219 | #ifdef HAVE_STRING_H |
| 3220 | # include <string.h> |
| 3221 | #endif |
| 3222 | #if defined(HAVE_STRINGS_H) |
| 3223 | # include <strings.h> |
| 3224 | #endif |
| 3225 | ], [int i; i = 0;], |
| 3226 | AC_MSG_RESULT(yes), |
| 3227 | AC_DEFINE(NO_STRINGS_WITH_STRING_H) |
| 3228 | AC_MSG_RESULT(no)) |
| 3229 | CPPFLAGS=$cppflags_save |
Bram Moolenaar | 9372a11 | 2005-12-06 19:59:18 +0000 | [diff] [blame] | 3230 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3231 | |
| 3232 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 3233 | AC_PROG_GCC_TRADITIONAL |
| 3234 | AC_C_CONST |
Bram Moolenaar | 76243bd | 2009-03-02 01:47:02 +0000 | [diff] [blame] | 3235 | AC_C_VOLATILE |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3236 | AC_TYPE_MODE_T |
| 3237 | AC_TYPE_OFF_T |
| 3238 | AC_TYPE_PID_T |
| 3239 | AC_TYPE_SIZE_T |
| 3240 | AC_TYPE_UID_T |
Bram Moolenaar | 0bbabe8 | 2010-05-17 20:32:55 +0200 | [diff] [blame] | 3241 | AC_TYPE_UINT32_T |
Bram Moolenaar | fa7584c | 2010-05-19 21:57:45 +0200 | [diff] [blame] | 3242 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3243 | AC_HEADER_TIME |
| 3244 | AC_CHECK_TYPE(ino_t, long) |
| 3245 | AC_CHECK_TYPE(dev_t, unsigned) |
Bram Moolenaar | 0bbabe8 | 2010-05-17 20:32:55 +0200 | [diff] [blame] | 3246 | AC_C_BIGENDIAN(,,,) |
Bram Moolenaar | 136f29a | 2016-02-27 20:14:15 +0100 | [diff] [blame] | 3247 | AC_C_INLINE |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3248 | |
| 3249 | AC_MSG_CHECKING(for rlim_t) |
| 3250 | if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then |
| 3251 | AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t]) |
| 3252 | else |
| 3253 | AC_EGREP_CPP(dnl |
| 3254 | changequote(<<,>>)dnl |
| 3255 | <<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl |
| 3256 | changequote([,]), |
| 3257 | [ |
| 3258 | #include <sys/types.h> |
| 3259 | #if STDC_HEADERS |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3260 | # include <stdlib.h> |
| 3261 | # include <stddef.h> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3262 | #endif |
| 3263 | #ifdef HAVE_SYS_RESOURCE_H |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3264 | # include <sys/resource.h> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3265 | #endif |
| 3266 | ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no) |
| 3267 | AC_MSG_RESULT($ac_cv_type_rlim_t) |
| 3268 | fi |
| 3269 | if test $ac_cv_type_rlim_t = no; then |
| 3270 | cat >> confdefs.h <<\EOF |
| 3271 | #define rlim_t unsigned long |
| 3272 | EOF |
| 3273 | fi |
| 3274 | |
| 3275 | AC_MSG_CHECKING(for stack_t) |
| 3276 | if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then |
| 3277 | AC_MSG_RESULT([(cached) $ac_cv_type_stack_t]) |
| 3278 | else |
| 3279 | AC_EGREP_CPP(stack_t, |
| 3280 | [ |
| 3281 | #include <sys/types.h> |
| 3282 | #if STDC_HEADERS |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3283 | # include <stdlib.h> |
| 3284 | # include <stddef.h> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3285 | #endif |
| 3286 | #include <signal.h> |
| 3287 | ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no) |
| 3288 | AC_MSG_RESULT($ac_cv_type_stack_t) |
| 3289 | fi |
| 3290 | if test $ac_cv_type_stack_t = no; then |
| 3291 | cat >> confdefs.h <<\EOF |
| 3292 | #define stack_t struct sigaltstack |
| 3293 | EOF |
| 3294 | fi |
| 3295 | |
| 3296 | dnl BSDI uses ss_base while others use ss_sp for the stack pointer. |
| 3297 | AC_MSG_CHECKING(whether stack_t has an ss_base field) |
| 3298 | AC_TRY_COMPILE([ |
| 3299 | #include <sys/types.h> |
| 3300 | #if STDC_HEADERS |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3301 | # include <stdlib.h> |
| 3302 | # include <stddef.h> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3303 | #endif |
| 3304 | #include <signal.h> |
| 3305 | #include "confdefs.h" |
| 3306 | ], [stack_t sigstk; sigstk.ss_base = 0; ], |
| 3307 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE), |
| 3308 | AC_MSG_RESULT(no)) |
| 3309 | |
| 3310 | olibs="$LIBS" |
| 3311 | AC_MSG_CHECKING(--with-tlib argument) |
| 3312 | AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],) |
| 3313 | if test -n "$with_tlib"; then |
| 3314 | AC_MSG_RESULT($with_tlib) |
| 3315 | LIBS="$LIBS -l$with_tlib" |
Bram Moolenaar | 1cd871b | 2004-12-19 22:46:22 +0000 | [diff] [blame] | 3316 | AC_MSG_CHECKING(for linking with $with_tlib library) |
| 3317 | AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED)) |
| 3318 | dnl Need to check for tgetent() below. |
| 3319 | olibs="$LIBS" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3320 | else |
Bram Moolenaar | 1cd871b | 2004-12-19 22:46:22 +0000 | [diff] [blame] | 3321 | AC_MSG_RESULT([empty: automatic terminal library selection]) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3322 | dnl On HP-UX 10.10 termcap or termlib should be used instead of |
| 3323 | dnl curses, because curses is much slower. |
Bram Moolenaar | 4e509b6 | 2011-02-09 17:42:57 +0100 | [diff] [blame] | 3324 | dnl Newer versions of ncurses are preferred over anything, except |
Bram Moolenaar | 8f4ba69 | 2011-05-05 17:24:27 +0200 | [diff] [blame] | 3325 | dnl when tinfo has been split off, it contains all we need. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3326 | dnl Older versions of ncurses have bugs, get a new one! |
| 3327 | dnl Digital Unix (OSF1) should use curses (Ronald Schild). |
Bram Moolenaar | a1b5aa5 | 2006-10-10 09:41:28 +0000 | [diff] [blame] | 3328 | dnl On SCO Openserver should prefer termlib (Roger Cornelius). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3329 | case "`uname -s 2>/dev/null`" in |
Bram Moolenaar | 4e509b6 | 2011-02-09 17:42:57 +0100 | [diff] [blame] | 3330 | OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";; |
| 3331 | *) tlibs="tinfo ncurses termlib termcap curses";; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3332 | esac |
| 3333 | for libname in $tlibs; do |
| 3334 | AC_CHECK_LIB(${libname}, tgetent,,) |
| 3335 | if test "x$olibs" != "x$LIBS"; then |
| 3336 | dnl It's possible that a library is found but it doesn't work |
| 3337 | dnl e.g., shared library that cannot be found |
| 3338 | dnl compile and run a test program to be sure |
| 3339 | AC_TRY_RUN([ |
| 3340 | #ifdef HAVE_TERMCAP_H |
| 3341 | # include <termcap.h> |
| 3342 | #endif |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3343 | #if STDC_HEADERS |
| 3344 | # include <stdlib.h> |
| 3345 | # include <stddef.h> |
| 3346 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3347 | main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }], |
| 3348 | res="OK", res="FAIL", res="FAIL") |
| 3349 | if test "$res" = "OK"; then |
| 3350 | break |
| 3351 | fi |
| 3352 | AC_MSG_RESULT($libname library is not usable) |
| 3353 | LIBS="$olibs" |
| 3354 | fi |
| 3355 | done |
Bram Moolenaar | 1cd871b | 2004-12-19 22:46:22 +0000 | [diff] [blame] | 3356 | if test "x$olibs" = "x$LIBS"; then |
| 3357 | AC_MSG_RESULT(no terminal library found) |
| 3358 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3359 | fi |
Bram Moolenaar | 1cd871b | 2004-12-19 22:46:22 +0000 | [diff] [blame] | 3360 | |
| 3361 | if test "x$olibs" = "x$LIBS"; then |
| 3362 | AC_MSG_CHECKING([for tgetent()]) |
Bram Moolenaar | 2389c3c | 2005-05-22 22:07:59 +0000 | [diff] [blame] | 3363 | AC_TRY_LINK([], |
Bram Moolenaar | 1cd871b | 2004-12-19 22:46:22 +0000 | [diff] [blame] | 3364 | [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");], |
| 3365 | AC_MSG_RESULT(yes), |
| 3366 | AC_MSG_ERROR([NOT FOUND! |
| 3367 | You need to install a terminal library; for example ncurses. |
| 3368 | Or specify the name of the library with --with-tlib.])) |
| 3369 | fi |
| 3370 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3371 | AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo], |
| 3372 | [ |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3373 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3374 | #include "confdefs.h" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3375 | #ifdef HAVE_TERMCAP_H |
| 3376 | # include <termcap.h> |
| 3377 | #endif |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3378 | #ifdef HAVE_STRING_H |
| 3379 | # include <string.h> |
| 3380 | #endif |
| 3381 | #if STDC_HEADERS |
| 3382 | # include <stdlib.h> |
| 3383 | # include <stddef.h> |
| 3384 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3385 | main() |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3386 | {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); } |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3387 | ]])],[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3388 | vim_cv_terminfo=no |
| 3389 | ],[ |
| 3390 | vim_cv_terminfo=yes |
| 3391 | ],[ |
| 3392 | AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo') |
| 3393 | ]) |
| 3394 | ]) |
| 3395 | |
| 3396 | if test "x$vim_cv_terminfo" = "xyes" ; then |
| 3397 | AC_DEFINE(TERMINFO) |
| 3398 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3399 | |
Bram Moolenaar | a88254f | 2017-11-02 23:04:14 +0100 | [diff] [blame] | 3400 | AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgetent], |
Bram Moolenaar | 696cbd2 | 2017-04-28 15:45:46 +0200 | [diff] [blame] | 3401 | [ |
| 3402 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3403 | #include "confdefs.h" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3404 | #ifdef HAVE_TERMCAP_H |
| 3405 | # include <termcap.h> |
| 3406 | #endif |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3407 | #if STDC_HEADERS |
| 3408 | # include <stdlib.h> |
| 3409 | # include <stddef.h> |
| 3410 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3411 | main() |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3412 | {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); } |
Bram Moolenaar | 696cbd2 | 2017-04-28 15:45:46 +0200 | [diff] [blame] | 3413 | ]])],[ |
Bram Moolenaar | a88254f | 2017-11-02 23:04:14 +0100 | [diff] [blame] | 3414 | vim_cv_tgetent=zero |
Bram Moolenaar | 696cbd2 | 2017-04-28 15:45:46 +0200 | [diff] [blame] | 3415 | ],[ |
Bram Moolenaar | a88254f | 2017-11-02 23:04:14 +0100 | [diff] [blame] | 3416 | vim_cv_tgetent=non-zero |
Bram Moolenaar | 696cbd2 | 2017-04-28 15:45:46 +0200 | [diff] [blame] | 3417 | ],[ |
| 3418 | AC_MSG_ERROR(failed to compile test program.) |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3419 | ]) |
Bram Moolenaar | 696cbd2 | 2017-04-28 15:45:46 +0200 | [diff] [blame] | 3420 | ]) |
| 3421 | |
Bram Moolenaar | a88254f | 2017-11-02 23:04:14 +0100 | [diff] [blame] | 3422 | if test "x$vim_cv_tgetent" = "xzero" ; then |
Bram Moolenaar | 696cbd2 | 2017-04-28 15:45:46 +0200 | [diff] [blame] | 3423 | AC_DEFINE(TGETENT_ZERO_ERR, 0) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3424 | fi |
| 3425 | |
| 3426 | AC_MSG_CHECKING(whether termcap.h contains ospeed) |
| 3427 | AC_TRY_LINK([ |
| 3428 | #ifdef HAVE_TERMCAP_H |
| 3429 | # include <termcap.h> |
| 3430 | #endif |
| 3431 | ], [ospeed = 20000], |
| 3432 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED), |
| 3433 | [AC_MSG_RESULT(no) |
| 3434 | AC_MSG_CHECKING(whether ospeed can be extern) |
| 3435 | AC_TRY_LINK([ |
| 3436 | #ifdef HAVE_TERMCAP_H |
| 3437 | # include <termcap.h> |
| 3438 | #endif |
| 3439 | extern short ospeed; |
| 3440 | ], [ospeed = 20000], |
| 3441 | AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN), |
| 3442 | AC_MSG_RESULT(no))] |
| 3443 | ) |
| 3444 | |
| 3445 | AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC]) |
| 3446 | AC_TRY_LINK([ |
| 3447 | #ifdef HAVE_TERMCAP_H |
| 3448 | # include <termcap.h> |
| 3449 | #endif |
| 3450 | ], [if (UP == 0 && BC == 0) PC = 1], |
| 3451 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC), |
| 3452 | [AC_MSG_RESULT(no) |
| 3453 | AC_MSG_CHECKING([whether UP, BC and PC can be extern]) |
| 3454 | AC_TRY_LINK([ |
| 3455 | #ifdef HAVE_TERMCAP_H |
| 3456 | # include <termcap.h> |
| 3457 | #endif |
| 3458 | extern char *UP, *BC, PC; |
| 3459 | ], [if (UP == 0 && BC == 0) PC = 1], |
| 3460 | AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN), |
| 3461 | AC_MSG_RESULT(no))] |
| 3462 | ) |
| 3463 | |
| 3464 | AC_MSG_CHECKING(whether tputs() uses outfuntype) |
| 3465 | AC_TRY_COMPILE([ |
| 3466 | #ifdef HAVE_TERMCAP_H |
| 3467 | # include <termcap.h> |
| 3468 | #endif |
| 3469 | ], [extern int xx(); tputs("test", 1, (outfuntype)xx)], |
| 3470 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE), |
| 3471 | AC_MSG_RESULT(no)) |
| 3472 | |
| 3473 | dnl On some SCO machines sys/select redefines struct timeval |
| 3474 | AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included]) |
| 3475 | AC_TRY_COMPILE([ |
| 3476 | #include <sys/types.h> |
| 3477 | #include <sys/time.h> |
| 3478 | #include <sys/select.h>], , |
| 3479 | AC_MSG_RESULT(yes) |
| 3480 | AC_DEFINE(SYS_SELECT_WITH_SYS_TIME), |
| 3481 | AC_MSG_RESULT(no)) |
| 3482 | |
| 3483 | dnl AC_DECL_SYS_SIGLIST |
| 3484 | |
| 3485 | dnl Checks for pty.c (copied from screen) ========================== |
| 3486 | AC_MSG_CHECKING(for /dev/ptc) |
| 3487 | if test -r /dev/ptc; then |
| 3488 | AC_DEFINE(HAVE_DEV_PTC) |
| 3489 | AC_MSG_RESULT(yes) |
| 3490 | else |
| 3491 | AC_MSG_RESULT(no) |
| 3492 | fi |
| 3493 | |
| 3494 | AC_MSG_CHECKING(for SVR4 ptys) |
| 3495 | if test -c /dev/ptmx ; then |
| 3496 | AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);], |
| 3497 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS), |
| 3498 | AC_MSG_RESULT(no)) |
| 3499 | else |
| 3500 | AC_MSG_RESULT(no) |
| 3501 | fi |
| 3502 | |
| 3503 | AC_MSG_CHECKING(for ptyranges) |
| 3504 | if test -d /dev/ptym ; then |
| 3505 | pdir='/dev/ptym' |
| 3506 | else |
| 3507 | pdir='/dev' |
| 3508 | fi |
| 3509 | dnl SCO uses ptyp%d |
| 3510 | AC_EGREP_CPP(yes, |
| 3511 | [#ifdef M_UNIX |
| 3512 | yes; |
| 3513 | #endif |
| 3514 | ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`) |
| 3515 | dnl if test -c /dev/ptyp19; then |
| 3516 | dnl ptys=`echo /dev/ptyp??` |
| 3517 | dnl else |
| 3518 | dnl ptys=`echo $pdir/pty??` |
| 3519 | dnl fi |
| 3520 | if test "$ptys" != "$pdir/pty??" ; then |
| 3521 | p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` |
| 3522 | p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` |
| 3523 | AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0") |
| 3524 | AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1") |
| 3525 | AC_MSG_RESULT([$p0 / $p1]) |
| 3526 | else |
| 3527 | AC_MSG_RESULT([don't know]) |
| 3528 | fi |
| 3529 | |
| 3530 | dnl **** pty mode/group handling **** |
| 3531 | dnl |
| 3532 | dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3533 | rm -f conftest_grp |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3534 | AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group], |
| 3535 | [ |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3536 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3537 | #include "confdefs.h" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3538 | #include <sys/types.h> |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3539 | #if STDC_HEADERS |
| 3540 | # include <stdlib.h> |
| 3541 | # include <stddef.h> |
| 3542 | #endif |
| 3543 | #ifdef HAVE_UNISTD_H |
| 3544 | #include <unistd.h> |
| 3545 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3546 | #include <sys/stat.h> |
| 3547 | #include <stdio.h> |
| 3548 | main() |
| 3549 | { |
| 3550 | struct stat sb; |
| 3551 | char *x,*ttyname(); |
| 3552 | int om, m; |
| 3553 | FILE *fp; |
| 3554 | |
| 3555 | if (!(x = ttyname(0))) exit(1); |
| 3556 | if (stat(x, &sb)) exit(1); |
| 3557 | om = sb.st_mode; |
| 3558 | if (om & 002) exit(0); |
| 3559 | m = system("mesg y"); |
| 3560 | if (m == -1 || m == 127) exit(1); |
| 3561 | if (stat(x, &sb)) exit(1); |
| 3562 | m = sb.st_mode; |
| 3563 | if (chmod(x, om)) exit(1); |
| 3564 | if (m & 002) exit(0); |
| 3565 | if (sb.st_gid == getgid()) exit(1); |
| 3566 | if (!(fp=fopen("conftest_grp", "w"))) |
| 3567 | exit(1); |
| 3568 | fprintf(fp, "%d\n", sb.st_gid); |
| 3569 | fclose(fp); |
| 3570 | exit(0); |
| 3571 | } |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3572 | ]])],[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3573 | if test -f conftest_grp; then |
| 3574 | vim_cv_tty_group=`cat conftest_grp` |
| 3575 | if test "x$vim_cv_tty_mode" = "x" ; then |
| 3576 | vim_cv_tty_mode=0620 |
| 3577 | fi |
| 3578 | AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group]) |
| 3579 | else |
| 3580 | vim_cv_tty_group=world |
Bram Moolenaar | 7295107 | 2009-12-02 16:58:33 +0000 | [diff] [blame] | 3581 | AC_MSG_RESULT([ptys are world accessible]) |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3582 | fi |
| 3583 | ],[ |
| 3584 | vim_cv_tty_group=world |
Bram Moolenaar | 7295107 | 2009-12-02 16:58:33 +0000 | [diff] [blame] | 3585 | AC_MSG_RESULT([can't determine - assume ptys are world accessible]) |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3586 | ],[ |
| 3587 | AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode') |
| 3588 | ]) |
| 3589 | ]) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3590 | rm -f conftest_grp |
| 3591 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3592 | if test "x$vim_cv_tty_group" != "xworld" ; then |
| 3593 | AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group) |
| 3594 | if test "x$vim_cv_tty_mode" = "x" ; then |
Bram Moolenaar | 84a05ac | 2013-05-06 04:24:17 +0200 | [diff] [blame] | 3595 | AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (probably 0620)]) |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3596 | else |
| 3597 | AC_DEFINE(PTYMODE, 0620) |
| 3598 | fi |
| 3599 | fi |
| 3600 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3601 | dnl Checks for library functions. =================================== |
| 3602 | |
| 3603 | AC_TYPE_SIGNAL |
| 3604 | |
| 3605 | dnl find out what to use at the end of a signal function |
| 3606 | if test $ac_cv_type_signal = void; then |
| 3607 | AC_DEFINE(SIGRETURN, [return]) |
| 3608 | else |
| 3609 | AC_DEFINE(SIGRETURN, [return 0]) |
| 3610 | fi |
| 3611 | |
| 3612 | dnl check if struct sigcontext is defined (used for SGI only) |
| 3613 | AC_MSG_CHECKING(for struct sigcontext) |
| 3614 | AC_TRY_COMPILE([ |
| 3615 | #include <signal.h> |
| 3616 | test_sig() |
| 3617 | { |
| 3618 | struct sigcontext *scont; |
| 3619 | scont = (struct sigcontext *)0; |
| 3620 | return 1; |
| 3621 | } ], , |
| 3622 | AC_MSG_RESULT(yes) |
| 3623 | AC_DEFINE(HAVE_SIGCONTEXT), |
| 3624 | AC_MSG_RESULT(no)) |
| 3625 | |
| 3626 | dnl tricky stuff: try to find out if getcwd() is implemented with |
| 3627 | dnl system("sh -c pwd") |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3628 | AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken], |
| 3629 | [ |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3630 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3631 | #include "confdefs.h" |
| 3632 | #ifdef HAVE_UNISTD_H |
| 3633 | #include <unistd.h> |
| 3634 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3635 | char *dagger[] = { "IFS=pwd", 0 }; |
| 3636 | main() |
| 3637 | { |
| 3638 | char buffer[500]; |
| 3639 | extern char **environ; |
| 3640 | environ = dagger; |
| 3641 | return getcwd(buffer, 500) ? 0 : 1; |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3642 | } |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3643 | ]])],[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3644 | vim_cv_getcwd_broken=no |
| 3645 | ],[ |
| 3646 | vim_cv_getcwd_broken=yes |
| 3647 | ],[ |
| 3648 | AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken') |
| 3649 | ]) |
| 3650 | ]) |
| 3651 | |
| 3652 | if test "x$vim_cv_getcwd_broken" = "xyes" ; then |
| 3653 | AC_DEFINE(BAD_GETCWD) |
| 3654 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3655 | |
Bram Moolenaar | 25153e1 | 2010-02-24 14:47:08 +0100 | [diff] [blame] | 3656 | dnl Check for functions in one big call, to reduce the size of configure. |
| 3657 | dnl Can only be used for functions that do not require any include. |
Bram Moolenaar | b129a44 | 2016-12-01 17:25:20 +0100 | [diff] [blame] | 3658 | AC_CHECK_FUNCS(fchdir fchown fsync getcwd getpseudotty \ |
| 3659 | getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat \ |
Bram Moolenaar | eaf0339 | 2009-11-17 11:08:52 +0000 | [diff] [blame] | 3660 | memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \ |
Bram Moolenaar | 2fcf668 | 2017-03-11 20:03:42 +0100 | [diff] [blame] | 3661 | getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ |
Bram Moolenaar | bb09ceb | 2016-10-18 16:27:23 +0200 | [diff] [blame] | 3662 | sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \ |
Bram Moolenaar | 0cb032e | 2005-04-23 20:52:00 +0000 | [diff] [blame] | 3663 | strnicmp strpbrk strtol tgetent towlower towupper iswupper \ |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 3664 | usleep utime utimes mblen) |
Bram Moolenaar | 25153e1 | 2010-02-24 14:47:08 +0100 | [diff] [blame] | 3665 | AC_FUNC_FSEEKO |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3666 | |
Bram Moolenaar | 317fd3a | 2010-05-07 16:05:55 +0200 | [diff] [blame] | 3667 | dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when |
| 3668 | dnl appropriate, so that off_t is 64 bits when needed. |
| 3669 | AC_SYS_LARGEFILE |
| 3670 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3671 | dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible |
| 3672 | AC_MSG_CHECKING(for st_blksize) |
| 3673 | AC_TRY_COMPILE( |
| 3674 | [#include <sys/types.h> |
| 3675 | #include <sys/stat.h>], |
| 3676 | [ struct stat st; |
| 3677 | int n; |
| 3678 | |
| 3679 | stat("/", &st); |
| 3680 | n = (int)st.st_blksize;], |
| 3681 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE), |
| 3682 | AC_MSG_RESULT(no)) |
| 3683 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3684 | AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash], |
| 3685 | [ |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3686 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3687 | #include "confdefs.h" |
| 3688 | #if STDC_HEADERS |
| 3689 | # include <stdlib.h> |
| 3690 | # include <stddef.h> |
| 3691 | #endif |
| 3692 | #include <sys/types.h> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3693 | #include <sys/stat.h> |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3694 | main() {struct stat st; exit(stat("configure/", &st) != 0); } |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 3695 | ]])],[ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3696 | vim_cv_stat_ignores_slash=yes |
| 3697 | ],[ |
| 3698 | vim_cv_stat_ignores_slash=no |
| 3699 | ],[ |
| 3700 | AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash') |
| 3701 | ]) |
| 3702 | ]) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3703 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3704 | if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then |
| 3705 | AC_DEFINE(STAT_IGNORES_SLASH) |
| 3706 | fi |
| 3707 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3708 | dnl Link with iconv for charset translation, if not found without library. |
| 3709 | dnl check for iconv() requires including iconv.h |
| 3710 | dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it |
| 3711 | dnl has been installed. |
| 3712 | AC_MSG_CHECKING(for iconv_open()) |
| 3713 | save_LIBS="$LIBS" |
| 3714 | LIBS="$LIBS -liconv" |
| 3715 | AC_TRY_LINK([ |
| 3716 | #ifdef HAVE_ICONV_H |
| 3717 | # include <iconv.h> |
| 3718 | #endif |
| 3719 | ], [iconv_open("fr", "to");], |
| 3720 | AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV), |
| 3721 | LIBS="$save_LIBS" |
| 3722 | AC_TRY_LINK([ |
| 3723 | #ifdef HAVE_ICONV_H |
| 3724 | # include <iconv.h> |
| 3725 | #endif |
| 3726 | ], [iconv_open("fr", "to");], |
| 3727 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV), |
| 3728 | AC_MSG_RESULT(no))) |
| 3729 | |
| 3730 | |
| 3731 | AC_MSG_CHECKING(for nl_langinfo(CODESET)) |
| 3732 | AC_TRY_LINK([ |
| 3733 | #ifdef HAVE_LANGINFO_H |
| 3734 | # include <langinfo.h> |
| 3735 | #endif |
| 3736 | ], [char *cs = nl_langinfo(CODESET);], |
| 3737 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET), |
| 3738 | AC_MSG_RESULT(no)) |
| 3739 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3740 | dnl Need various functions for floating point support. Only enable |
| 3741 | dnl floating point when they are all present. |
| 3742 | AC_CHECK_LIB(m, strtod) |
| 3743 | AC_MSG_CHECKING([for strtod() and other floating point functions]) |
| 3744 | AC_TRY_LINK([ |
| 3745 | #ifdef HAVE_MATH_H |
| 3746 | # include <math.h> |
| 3747 | #endif |
| 3748 | #if STDC_HEADERS |
| 3749 | # include <stdlib.h> |
| 3750 | # include <stddef.h> |
| 3751 | #endif |
| 3752 | ], [char *s; double d; |
| 3753 | d = strtod("1.1", &s); |
| 3754 | d = fabs(1.11); |
| 3755 | d = ceil(1.11); |
| 3756 | d = floor(1.11); |
| 3757 | d = log10(1.11); |
| 3758 | d = pow(1.11, 2.22); |
| 3759 | d = sqrt(1.11); |
| 3760 | d = sin(1.11); |
| 3761 | d = cos(1.11); |
| 3762 | d = atan(1.11); |
| 3763 | ], |
| 3764 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS), |
| 3765 | AC_MSG_RESULT(no)) |
| 3766 | |
Bram Moolenaar | a6b8976 | 2016-02-29 21:38:26 +0100 | [diff] [blame] | 3767 | dnl isinf() and isnan() need to include header files and may need -lm. |
| 3768 | AC_MSG_CHECKING([for isinf()]) |
| 3769 | AC_TRY_LINK([ |
| 3770 | #ifdef HAVE_MATH_H |
| 3771 | # include <math.h> |
| 3772 | #endif |
| 3773 | #if STDC_HEADERS |
| 3774 | # include <stdlib.h> |
| 3775 | # include <stddef.h> |
| 3776 | #endif |
| 3777 | ], [int r = isinf(1.11); ], |
| 3778 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISINF), |
| 3779 | AC_MSG_RESULT(no)) |
| 3780 | |
| 3781 | AC_MSG_CHECKING([for isnan()]) |
| 3782 | AC_TRY_LINK([ |
| 3783 | #ifdef HAVE_MATH_H |
| 3784 | # include <math.h> |
| 3785 | #endif |
| 3786 | #if STDC_HEADERS |
| 3787 | # include <stdlib.h> |
| 3788 | # include <stddef.h> |
| 3789 | #endif |
| 3790 | ], [int r = isnan(1.11); ], |
| 3791 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISNAN), |
| 3792 | AC_MSG_RESULT(no)) |
| 3793 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3794 | dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI |
| 3795 | dnl when -lacl works, also try to use -lattr (required for Debian). |
Bram Moolenaar | 8d462f9 | 2012-02-05 22:51:33 +0100 | [diff] [blame] | 3796 | dnl On Solaris, use the acl_get/set functions in libsec, if present. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3797 | AC_MSG_CHECKING(--disable-acl argument) |
| 3798 | AC_ARG_ENABLE(acl, |
| 3799 | [ --disable-acl Don't check for ACL support.], |
| 3800 | , [enable_acl="yes"]) |
| 3801 | if test "$enable_acl" = "yes"; then |
| 3802 | AC_MSG_RESULT(no) |
| 3803 | AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"], |
| 3804 | AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl" |
| 3805 | AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),) |
| 3806 | |
| 3807 | AC_MSG_CHECKING(for POSIX ACL support) |
| 3808 | AC_TRY_LINK([ |
| 3809 | #include <sys/types.h> |
| 3810 | #ifdef HAVE_SYS_ACL_H |
| 3811 | # include <sys/acl.h> |
| 3812 | #endif |
| 3813 | acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS); |
| 3814 | acl_set_file("foo", ACL_TYPE_ACCESS, acl); |
| 3815 | acl_free(acl);], |
| 3816 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL), |
| 3817 | AC_MSG_RESULT(no)) |
| 3818 | |
Bram Moolenaar | 8d462f9 | 2012-02-05 22:51:33 +0100 | [diff] [blame] | 3819 | AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)], |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3820 | AC_MSG_CHECKING(for Solaris ACL support) |
| 3821 | AC_TRY_LINK([ |
| 3822 | #ifdef HAVE_SYS_ACL_H |
| 3823 | # include <sys/acl.h> |
| 3824 | #endif], [acl("foo", GETACLCNT, 0, NULL); |
| 3825 | ], |
| 3826 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL), |
Bram Moolenaar | 8d462f9 | 2012-02-05 22:51:33 +0100 | [diff] [blame] | 3827 | AC_MSG_RESULT(no))) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3828 | |
| 3829 | AC_MSG_CHECKING(for AIX ACL support) |
| 3830 | AC_TRY_LINK([ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3831 | #if STDC_HEADERS |
| 3832 | # include <stdlib.h> |
| 3833 | # include <stddef.h> |
| 3834 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3835 | #ifdef HAVE_SYS_ACL_H |
| 3836 | # include <sys/acl.h> |
| 3837 | #endif |
| 3838 | #ifdef HAVE_SYS_ACCESS_H |
| 3839 | # include <sys/access.h> |
| 3840 | #endif |
| 3841 | #define _ALL_SOURCE |
| 3842 | |
| 3843 | #include <sys/stat.h> |
| 3844 | |
| 3845 | int aclsize; |
| 3846 | struct acl *aclent;], [aclsize = sizeof(struct acl); |
| 3847 | aclent = (void *)malloc(aclsize); |
| 3848 | statacl("foo", STX_NORMAL, aclent, aclsize); |
| 3849 | ], |
| 3850 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL), |
| 3851 | AC_MSG_RESULT(no)) |
| 3852 | else |
| 3853 | AC_MSG_RESULT(yes) |
| 3854 | fi |
| 3855 | |
Bram Moolenaar | 3cbe0c0 | 2015-09-08 20:00:22 +0200 | [diff] [blame] | 3856 | if test "x$GTK_CFLAGS" != "x"; then |
| 3857 | dnl pango_shape_full() is new, fall back to pango_shape(). |
| 3858 | AC_MSG_CHECKING(for pango_shape_full) |
| 3859 | ac_save_CFLAGS="$CFLAGS" |
| 3860 | ac_save_LIBS="$LIBS" |
| 3861 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
| 3862 | LIBS="$LIBS $GTK_LIBS" |
Bram Moolenaar | 5325b9b | 2015-09-09 20:27:02 +0200 | [diff] [blame] | 3863 | AC_TRY_LINK( |
Bram Moolenaar | 3cbe0c0 | 2015-09-08 20:00:22 +0200 | [diff] [blame] | 3864 | [#include <gtk/gtk.h>], |
| 3865 | [ pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); ], |
| 3866 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PANGO_SHAPE_FULL), |
| 3867 | AC_MSG_RESULT(no)) |
| 3868 | CFLAGS="$ac_save_CFLAGS" |
| 3869 | LIBS="$ac_save_LIBS" |
| 3870 | fi |
| 3871 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3872 | AC_MSG_CHECKING(--disable-gpm argument) |
| 3873 | AC_ARG_ENABLE(gpm, |
| 3874 | [ --disable-gpm Don't use gpm (Linux mouse daemon).], , |
| 3875 | [enable_gpm="yes"]) |
| 3876 | |
| 3877 | if test "$enable_gpm" = "yes"; then |
| 3878 | AC_MSG_RESULT(no) |
| 3879 | dnl Checking if gpm support can be compiled |
| 3880 | AC_CACHE_CHECK([for gpm], vi_cv_have_gpm, |
| 3881 | [olibs="$LIBS" ; LIBS="-lgpm"] |
| 3882 | AC_TRY_LINK( |
| 3883 | [#include <gpm.h> |
| 3884 | #include <linux/keyboard.h>], |
| 3885 | [Gpm_GetLibVersion(NULL);], |
| 3886 | dnl Configure defines HAVE_GPM, if it is defined feature.h defines |
| 3887 | dnl FEAT_MOUSE_GPM if mouse support is included |
| 3888 | [vi_cv_have_gpm=yes], |
| 3889 | [vi_cv_have_gpm=no]) |
| 3890 | [LIBS="$olibs"] |
| 3891 | ) |
| 3892 | if test $vi_cv_have_gpm = yes; then |
| 3893 | LIBS="$LIBS -lgpm" |
| 3894 | AC_DEFINE(HAVE_GPM) |
| 3895 | fi |
| 3896 | else |
| 3897 | AC_MSG_RESULT(yes) |
| 3898 | fi |
| 3899 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3900 | AC_MSG_CHECKING(--disable-sysmouse argument) |
| 3901 | AC_ARG_ENABLE(sysmouse, |
Bram Moolenaar | 8008b63 | 2017-07-18 21:33:20 +0200 | [diff] [blame] | 3902 | [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], , |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 3903 | [enable_sysmouse="yes"]) |
| 3904 | |
| 3905 | if test "$enable_sysmouse" = "yes"; then |
| 3906 | AC_MSG_RESULT(no) |
| 3907 | dnl Checking if sysmouse support can be compiled |
| 3908 | dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h |
| 3909 | dnl defines FEAT_SYSMOUSE if mouse support is included |
| 3910 | AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse, |
| 3911 | AC_TRY_LINK( |
| 3912 | [#include <sys/consio.h> |
| 3913 | #include <signal.h> |
| 3914 | #include <sys/fbio.h>], |
| 3915 | [struct mouse_info mouse; |
| 3916 | mouse.operation = MOUSE_MODE; |
| 3917 | mouse.operation = MOUSE_SHOW; |
| 3918 | mouse.u.mode.mode = 0; |
| 3919 | mouse.u.mode.signal = SIGUSR2;], |
| 3920 | [vi_cv_have_sysmouse=yes], |
| 3921 | [vi_cv_have_sysmouse=no]) |
| 3922 | ) |
| 3923 | if test $vi_cv_have_sysmouse = yes; then |
| 3924 | AC_DEFINE(HAVE_SYSMOUSE) |
| 3925 | fi |
| 3926 | else |
| 3927 | AC_MSG_RESULT(yes) |
| 3928 | fi |
| 3929 | |
Bram Moolenaar | f05da21 | 2009-11-17 16:13:15 +0000 | [diff] [blame] | 3930 | dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known |
| 3931 | AC_MSG_CHECKING(for FD_CLOEXEC) |
| 3932 | AC_TRY_COMPILE( |
| 3933 | [#if HAVE_FCNTL_H |
| 3934 | # include <fcntl.h> |
| 3935 | #endif], |
| 3936 | [ int flag = FD_CLOEXEC;], |
| 3937 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC), |
| 3938 | AC_MSG_RESULT(not usable)) |
| 3939 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3940 | dnl rename needs to be checked separately to work on Nextstep with cc |
| 3941 | AC_MSG_CHECKING(for rename) |
| 3942 | AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")], |
| 3943 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME), |
| 3944 | AC_MSG_RESULT(no)) |
| 3945 | |
| 3946 | dnl sysctl() may exist but not the arguments we use |
| 3947 | AC_MSG_CHECKING(for sysctl) |
| 3948 | AC_TRY_COMPILE( |
| 3949 | [#include <sys/types.h> |
| 3950 | #include <sys/sysctl.h>], |
| 3951 | [ int mib[2], r; |
| 3952 | size_t len; |
| 3953 | |
| 3954 | mib[0] = CTL_HW; |
| 3955 | mib[1] = HW_USERMEM; |
| 3956 | len = sizeof(r); |
| 3957 | (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0); |
| 3958 | ], |
| 3959 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL), |
| 3960 | AC_MSG_RESULT(not usable)) |
| 3961 | |
| 3962 | dnl sysinfo() may exist but not be Linux compatible |
| 3963 | AC_MSG_CHECKING(for sysinfo) |
| 3964 | AC_TRY_COMPILE( |
| 3965 | [#include <sys/types.h> |
| 3966 | #include <sys/sysinfo.h>], |
| 3967 | [ struct sysinfo sinfo; |
| 3968 | int t; |
| 3969 | |
| 3970 | (void)sysinfo(&sinfo); |
| 3971 | t = sinfo.totalram; |
| 3972 | ], |
| 3973 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO), |
| 3974 | AC_MSG_RESULT(not usable)) |
| 3975 | |
Bram Moolenaar | 914572a | 2007-05-01 11:37:47 +0000 | [diff] [blame] | 3976 | dnl struct sysinfo may have the mem_unit field or not |
| 3977 | AC_MSG_CHECKING(for sysinfo.mem_unit) |
| 3978 | AC_TRY_COMPILE( |
| 3979 | [#include <sys/types.h> |
| 3980 | #include <sys/sysinfo.h>], |
| 3981 | [ struct sysinfo sinfo; |
Bram Moolenaar | 3c7ad01 | 2013-06-11 19:53:45 +0200 | [diff] [blame] | 3982 | sinfo.mem_unit = 1; |
Bram Moolenaar | 914572a | 2007-05-01 11:37:47 +0000 | [diff] [blame] | 3983 | ], |
| 3984 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT), |
| 3985 | AC_MSG_RESULT(no)) |
| 3986 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3987 | dnl sysconf() may exist but not support what we want to use |
| 3988 | AC_MSG_CHECKING(for sysconf) |
| 3989 | AC_TRY_COMPILE( |
| 3990 | [#include <unistd.h>], |
| 3991 | [ (void)sysconf(_SC_PAGESIZE); |
| 3992 | (void)sysconf(_SC_PHYS_PAGES); |
| 3993 | ], |
| 3994 | AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF), |
| 3995 | AC_MSG_RESULT(not usable)) |
| 3996 | |
Bram Moolenaar | 914703b | 2010-05-31 21:59:46 +0200 | [diff] [blame] | 3997 | AC_CHECK_SIZEOF([int]) |
| 3998 | AC_CHECK_SIZEOF([long]) |
| 3999 | AC_CHECK_SIZEOF([time_t]) |
| 4000 | AC_CHECK_SIZEOF([off_t]) |
Bram Moolenaar | 644fdff | 2010-05-30 13:26:21 +0200 | [diff] [blame] | 4001 | |
Bram Moolenaar | a2aa31a | 2014-02-23 22:52:40 +0100 | [diff] [blame] | 4002 | dnl Use different names to avoid clashing with other header files. |
| 4003 | AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int]) |
| 4004 | AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long]) |
| 4005 | |
Bram Moolenaar | fa7584c | 2010-05-19 21:57:45 +0200 | [diff] [blame] | 4006 | dnl Make sure that uint32_t is really 32 bits unsigned. |
| 4007 | AC_MSG_CHECKING([uint32_t is 32 bits]) |
| 4008 | AC_TRY_RUN([ |
| 4009 | #ifdef HAVE_STDINT_H |
| 4010 | # include <stdint.h> |
| 4011 | #endif |
| 4012 | #ifdef HAVE_INTTYPES_H |
| 4013 | # include <inttypes.h> |
| 4014 | #endif |
| 4015 | main() { |
| 4016 | uint32_t nr1 = (uint32_t)-1; |
| 4017 | uint32_t nr2 = (uint32_t)0xffffffffUL; |
| 4018 | if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1); |
| 4019 | exit(0); |
| 4020 | }], |
| 4021 | AC_MSG_RESULT(ok), |
| 4022 | AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]), |
Bram Moolenaar | 323cb95 | 2011-12-14 19:22:34 +0100 | [diff] [blame] | 4023 | AC_MSG_WARN([cannot check uint32_t when cross-compiling.])) |
Bram Moolenaar | fa7584c | 2010-05-19 21:57:45 +0200 | [diff] [blame] | 4024 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 4025 | dnl Check for memmove() before bcopy(), makes memmove() be used when both are |
| 4026 | dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5. |
| 4027 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4028 | [bcopy_test_prog=' |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 4029 | #include "confdefs.h" |
| 4030 | #ifdef HAVE_STRING_H |
| 4031 | # include <string.h> |
| 4032 | #endif |
| 4033 | #if STDC_HEADERS |
| 4034 | # include <stdlib.h> |
| 4035 | # include <stddef.h> |
| 4036 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4037 | main() { |
| 4038 | char buf[10]; |
| 4039 | strcpy(buf, "abcdefghi"); |
| 4040 | mch_memmove(buf, buf + 2, 3); |
| 4041 | if (strncmp(buf, "ababcf", 6)) |
| 4042 | exit(1); |
| 4043 | strcpy(buf, "abcdefghi"); |
| 4044 | mch_memmove(buf + 2, buf, 3); |
| 4045 | if (strncmp(buf, "cdedef", 6)) |
| 4046 | exit(1); |
| 4047 | exit(0); /* libc version works properly. */ |
| 4048 | }'] |
| 4049 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 4050 | AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap], |
| 4051 | [ |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 4052 | AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]])], |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 4053 | [ |
| 4054 | vim_cv_memmove_handles_overlap=yes |
| 4055 | ],[ |
| 4056 | vim_cv_memmove_handles_overlap=no |
| 4057 | ],[ |
| 4058 | AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap') |
| 4059 | ]) |
| 4060 | ]) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4061 | |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 4062 | if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then |
| 4063 | AC_DEFINE(USEMEMMOVE) |
| 4064 | else |
| 4065 | AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap], |
| 4066 | [ |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 4067 | AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]])], |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 4068 | [ |
| 4069 | vim_cv_bcopy_handles_overlap=yes |
| 4070 | ],[ |
| 4071 | vim_cv_bcopy_handles_overlap=no |
| 4072 | ],[ |
| 4073 | AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap') |
| 4074 | ]) |
| 4075 | ]) |
| 4076 | |
| 4077 | if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then |
| 4078 | AC_DEFINE(USEBCOPY) |
| 4079 | else |
| 4080 | AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap], |
| 4081 | [ |
Bram Moolenaar | 7db7784 | 2014-03-27 17:40:59 +0100 | [diff] [blame] | 4082 | AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]])], |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 4083 | [ |
| 4084 | vim_cv_memcpy_handles_overlap=yes |
| 4085 | ],[ |
| 4086 | vim_cv_memcpy_handles_overlap=no |
| 4087 | ],[ |
| 4088 | AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap') |
| 4089 | ]) |
| 4090 | ]) |
| 4091 | |
| 4092 | if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then |
| 4093 | AC_DEFINE(USEMEMCPY) |
| 4094 | fi |
| 4095 | fi |
| 4096 | fi |
| 4097 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4098 | |
| 4099 | dnl Check for multibyte locale functions |
| 4100 | dnl Find out if _Xsetlocale() is supported by libX11. |
| 4101 | dnl Check if X_LOCALE should be defined. |
Bram Moolenaar | cbc246a | 2014-10-11 14:47:26 +0200 | [diff] [blame] | 4102 | if test "x$with_x" = "xyes"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4103 | cflags_save=$CFLAGS |
Bram Moolenaar | cbc246a | 2014-10-11 14:47:26 +0200 | [diff] [blame] | 4104 | libs_save=$LIBS |
| 4105 | LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS" |
| 4106 | CFLAGS="$CFLAGS $X_CFLAGS" |
| 4107 | |
| 4108 | AC_MSG_CHECKING(whether X_LOCALE needed) |
| 4109 | AC_TRY_COMPILE([#include <X11/Xlocale.h>],, |
| 4110 | AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes) |
| 4111 | AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)), |
| 4112 | AC_MSG_RESULT(no)) |
| 4113 | |
| 4114 | AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used) |
| 4115 | AC_TRY_LINK_FUNC([Xutf8SetWMProperties], [AC_MSG_RESULT(yes) |
| 4116 | AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no)) |
| 4117 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4118 | CFLAGS=$cflags_save |
Bram Moolenaar | cbc246a | 2014-10-11 14:47:26 +0200 | [diff] [blame] | 4119 | LIBS=$libs_save |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4120 | fi |
| 4121 | |
| 4122 | dnl Link with xpg4, it is said to make Korean locale working |
| 4123 | AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,) |
| 4124 | |
Bram Moolenaar | 0c7ce77 | 2009-05-13 12:49:39 +0000 | [diff] [blame] | 4125 | dnl Check how we can run ctags. Default to "ctags" when nothing works. |
Bram Moolenaar | 8f4ba69 | 2011-05-05 17:24:27 +0200 | [diff] [blame] | 4126 | dnl Use --version to detect Exuberant ctags (preferred) |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 4127 | dnl Add --fields=+S to get function signatures for omni completion. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4128 | dnl -t for typedefs (many ctags have this) |
| 4129 | dnl -s for static functions (Elvis ctags only?) |
| 4130 | dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'. |
| 4131 | dnl -i+m to test for older Exuberant ctags |
| 4132 | AC_MSG_CHECKING(how to create tags) |
| 4133 | test -f tags && mv tags tags.save |
Bram Moolenaar | 5897e0c | 2011-05-10 15:42:03 +0200 | [diff] [blame] | 4134 | if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 4135 | TAGPRG="ctags -I INIT+ --fields=+S" |
Bram Moolenaar | 5897e0c | 2011-05-10 15:42:03 +0200 | [diff] [blame] | 4136 | elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then |
| 4137 | TAGPRG="exctags -I INIT+ --fields=+S" |
| 4138 | elif (eval exuberant-ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then |
| 4139 | TAGPRG="exuberant-ctags -I INIT+ --fields=+S" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4140 | else |
Bram Moolenaar | 0c7ce77 | 2009-05-13 12:49:39 +0000 | [diff] [blame] | 4141 | TAGPRG="ctags" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4142 | (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags" |
| 4143 | (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c" |
| 4144 | (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags" |
| 4145 | (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t" |
| 4146 | (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts" |
| 4147 | (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs" |
| 4148 | (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m" |
| 4149 | fi |
| 4150 | test -f tags.save && mv tags.save tags |
| 4151 | AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG) |
| 4152 | |
| 4153 | dnl Check how we can run man with a section number |
| 4154 | AC_MSG_CHECKING(how to run man with a section nr) |
| 4155 | MANDEF="man" |
Bram Moolenaar | 8b13150 | 2008-02-13 09:28:19 +0000 | [diff] [blame] | 4156 | (eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4157 | AC_MSG_RESULT($MANDEF) |
| 4158 | if test "$MANDEF" = "man -s"; then |
| 4159 | AC_DEFINE(USEMAN_S) |
| 4160 | fi |
| 4161 | |
| 4162 | dnl Check if gettext() is working and if it needs -lintl |
Bram Moolenaar | 49b6a57 | 2013-11-17 20:32:54 +0100 | [diff] [blame] | 4163 | dnl We take care to base this on an empty LIBS: on some systems libelf would be |
| 4164 | dnl in LIBS and implicitly take along libintl. The final LIBS would then not |
| 4165 | dnl contain libintl, and the link step would fail due to -Wl,--as-needed. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4166 | AC_MSG_CHECKING(--disable-nls argument) |
| 4167 | AC_ARG_ENABLE(nls, |
| 4168 | [ --disable-nls Don't support NLS (gettext()).], , |
| 4169 | [enable_nls="yes"]) |
| 4170 | |
| 4171 | if test "$enable_nls" = "yes"; then |
| 4172 | AC_MSG_RESULT(no) |
Bram Moolenaar | 2389c3c | 2005-05-22 22:07:59 +0000 | [diff] [blame] | 4173 | |
| 4174 | INSTALL_LANGS=install-languages |
| 4175 | AC_SUBST(INSTALL_LANGS) |
| 4176 | INSTALL_TOOL_LANGS=install-tool-languages |
| 4177 | AC_SUBST(INSTALL_TOOL_LANGS) |
| 4178 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4179 | AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, ) |
| 4180 | AC_MSG_CHECKING([for NLS]) |
| 4181 | if test -f po/Makefile; then |
| 4182 | have_gettext="no" |
| 4183 | if test -n "$MSGFMT"; then |
Bram Moolenaar | 49b6a57 | 2013-11-17 20:32:54 +0100 | [diff] [blame] | 4184 | olibs=$LIBS |
| 4185 | LIBS="" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4186 | AC_TRY_LINK( |
| 4187 | [#include <libintl.h>], |
| 4188 | [gettext("Test");], |
Bram Moolenaar | 49b6a57 | 2013-11-17 20:32:54 +0100 | [diff] [blame] | 4189 | AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs, |
| 4190 | LIBS="-lintl" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4191 | AC_TRY_LINK( |
| 4192 | [#include <libintl.h>], |
| 4193 | [gettext("Test");], |
Bram Moolenaar | 49b6a57 | 2013-11-17 20:32:54 +0100 | [diff] [blame] | 4194 | AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes"; |
| 4195 | LIBS="$olibs -lintl", |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4196 | AC_MSG_RESULT([gettext() doesn't work]); |
| 4197 | LIBS=$olibs)) |
| 4198 | else |
| 4199 | AC_MSG_RESULT([msgfmt not found - disabled]); |
| 4200 | fi |
Bram Moolenaar | 278eb58 | 2014-07-30 13:22:52 +0200 | [diff] [blame] | 4201 | if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4202 | AC_DEFINE(HAVE_GETTEXT) |
| 4203 | MAKEMO=yes |
| 4204 | AC_SUBST(MAKEMO) |
| 4205 | dnl this was added in GNU gettext 0.10.36 |
| 4206 | AC_CHECK_FUNCS(bind_textdomain_codeset) |
| 4207 | dnl _nl_msg_cat_cntr is required for GNU gettext |
| 4208 | AC_MSG_CHECKING([for _nl_msg_cat_cntr]) |
| 4209 | AC_TRY_LINK( |
| 4210 | [#include <libintl.h> |
| 4211 | extern int _nl_msg_cat_cntr;], |
| 4212 | [++_nl_msg_cat_cntr;], |
| 4213 | AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR), |
| 4214 | AC_MSG_RESULT([no])) |
| 4215 | fi |
| 4216 | else |
| 4217 | AC_MSG_RESULT([no "po/Makefile" - disabled]); |
| 4218 | fi |
| 4219 | else |
| 4220 | AC_MSG_RESULT(yes) |
| 4221 | fi |
| 4222 | |
| 4223 | dnl Check for dynamic linking loader |
| 4224 | AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)]) |
| 4225 | if test x${DLL} = xdlfcn.h; then |
| 4226 | AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ]) |
| 4227 | AC_MSG_CHECKING([for dlopen()]) |
| 4228 | AC_TRY_LINK(,[ |
| 4229 | extern void* dlopen(); |
| 4230 | dlopen(); |
| 4231 | ], |
| 4232 | AC_MSG_RESULT(yes); |
| 4233 | AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]), |
| 4234 | AC_MSG_RESULT(no); |
| 4235 | AC_MSG_CHECKING([for dlopen() in -ldl]) |
| 4236 | olibs=$LIBS |
| 4237 | LIBS="$LIBS -ldl" |
| 4238 | AC_TRY_LINK(,[ |
| 4239 | extern void* dlopen(); |
| 4240 | dlopen(); |
| 4241 | ], |
| 4242 | AC_MSG_RESULT(yes); |
| 4243 | AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]), |
| 4244 | AC_MSG_RESULT(no); |
| 4245 | LIBS=$olibs)) |
| 4246 | dnl ReliantUNIX has dlopen() in libc but everything else in libdl |
| 4247 | dnl ick :-) |
| 4248 | AC_MSG_CHECKING([for dlsym()]) |
| 4249 | AC_TRY_LINK(,[ |
| 4250 | extern void* dlsym(); |
| 4251 | dlsym(); |
| 4252 | ], |
| 4253 | AC_MSG_RESULT(yes); |
| 4254 | AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]), |
| 4255 | AC_MSG_RESULT(no); |
| 4256 | AC_MSG_CHECKING([for dlsym() in -ldl]) |
| 4257 | olibs=$LIBS |
| 4258 | LIBS="$LIBS -ldl" |
| 4259 | AC_TRY_LINK(,[ |
| 4260 | extern void* dlsym(); |
| 4261 | dlsym(); |
| 4262 | ], |
| 4263 | AC_MSG_RESULT(yes); |
| 4264 | AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]), |
| 4265 | AC_MSG_RESULT(no); |
| 4266 | LIBS=$olibs)) |
| 4267 | elif test x${DLL} = xdl.h; then |
| 4268 | AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ]) |
| 4269 | AC_MSG_CHECKING([for shl_load()]) |
| 4270 | AC_TRY_LINK(,[ |
| 4271 | extern void* shl_load(); |
| 4272 | shl_load(); |
| 4273 | ], |
| 4274 | AC_MSG_RESULT(yes); |
| 4275 | AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]), |
| 4276 | AC_MSG_RESULT(no); |
| 4277 | AC_MSG_CHECKING([for shl_load() in -ldld]) |
| 4278 | olibs=$LIBS |
| 4279 | LIBS="$LIBS -ldld" |
| 4280 | AC_TRY_LINK(,[ |
| 4281 | extern void* shl_load(); |
| 4282 | shl_load(); |
| 4283 | ], |
| 4284 | AC_MSG_RESULT(yes); |
| 4285 | AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]), |
| 4286 | AC_MSG_RESULT(no); |
| 4287 | LIBS=$olibs)) |
| 4288 | fi |
| 4289 | AC_CHECK_HEADERS(setjmp.h) |
| 4290 | |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 4291 | if test "x$MACOS_X" = "xyes" -a -n "$PERL"; then |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4292 | dnl -ldl must come after DynaLoader.a |
| 4293 | if echo $LIBS | grep -e '-ldl' >/dev/null; then |
| 4294 | LIBS=`echo $LIBS | sed s/-ldl//` |
| 4295 | PERL_LIBS="$PERL_LIBS -ldl" |
| 4296 | fi |
| 4297 | fi |
| 4298 | |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 4299 | if test "$MACOS_X" = "yes"; then |
| 4300 | AC_MSG_CHECKING([whether we need macOS frameworks]) |
| 4301 | if test "$GUITYPE" = "CARBONGUI"; then |
| 4302 | AC_MSG_RESULT([yes, we need Carbon]) |
| 4303 | LIBS="$LIBS -framework Carbon" |
| 4304 | elif test "$MACOS_X_DARWIN" = "yes"; then |
| 4305 | if test "$features" = "tiny"; then |
| 4306 | dnl Since no FEAT_CLIPBOARD, no longer need for os_macosx.m. |
| 4307 | OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'` |
| 4308 | OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'` |
| 4309 | if test "$enable_multibyte" = "yes"; then |
| 4310 | AC_MSG_RESULT([yes, we need CoreServices]) |
| 4311 | LIBS="$LIBS -framework CoreServices" |
| 4312 | else |
| 4313 | dnl Since no FEAT_MBYTE, no longer need for os_mac_conv.c. |
| 4314 | AC_MSG_RESULT([no]) |
| 4315 | OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_mac_conv.c++'` |
| 4316 | OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_mac_conv.o++'` |
| 4317 | CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's+-DMACOS_X_DARWIN++'` |
| 4318 | fi |
| 4319 | else |
| 4320 | AC_MSG_RESULT([yes, we need AppKit]) |
| 4321 | LIBS="$LIBS -framework AppKit" |
| 4322 | if test "$features" = "small" -a "$enable_multibyte" = "no"; then |
| 4323 | dnl Since FEAT_CLIPBOARD is to be defined in vim.h for FEAT_SMALL, define |
| 4324 | dnl FEAT_MBYTE in order not to compromise the interoperability of the |
| 4325 | dnl clipboard. |
| 4326 | AC_MSG_NOTICE([+multi_byte will be set in favor of +clipboard]) |
| 4327 | enable_multibyte=yes |
| 4328 | AC_DEFINE(FEAT_MBYTE) |
| 4329 | fi |
| 4330 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4331 | else |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 4332 | AC_MSG_RESULT([no]) |
Bram Moolenaar | 3437b91 | 2013-07-03 19:52:53 +0200 | [diff] [blame] | 4333 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4334 | fi |
Bram Moolenaar | 164fca3 | 2010-07-14 13:58:07 +0200 | [diff] [blame] | 4335 | if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then |
Bram Moolenaar | 595a7be | 2010-03-10 16:28:12 +0100 | [diff] [blame] | 4336 | LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" |
Bram Moolenaar | e224ffa | 2006-03-01 00:01:28 +0000 | [diff] [blame] | 4337 | fi |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4338 | |
Bram Moolenaar | d5cdbeb | 2005-10-10 20:59:28 +0000 | [diff] [blame] | 4339 | dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to |
| 4340 | dnl use "-isystem" instead of "-I" for all non-Vim include dirs. |
| 4341 | dnl But only when making dependencies, cproto and lint don't take "-isystem". |
Bram Moolenaar | 32466aa | 2006-02-24 23:53:04 +0000 | [diff] [blame] | 4342 | dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow |
| 4343 | dnl the number before the version number. |
Bram Moolenaar | d5cdbeb | 2005-10-10 20:59:28 +0000 | [diff] [blame] | 4344 | DEPEND_CFLAGS_FILTER= |
| 4345 | if test "$GCC" = yes; then |
Bram Moolenaar | 0cd4930 | 2008-11-20 09:37:01 +0000 | [diff] [blame] | 4346 | AC_MSG_CHECKING(for GCC 3 or later) |
Bram Moolenaar | 2217cae | 2006-03-25 21:55:52 +0000 | [diff] [blame] | 4347 | gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'` |
Bram Moolenaar | f740b29 | 2006-02-16 22:11:02 +0000 | [diff] [blame] | 4348 | if test "$gccmajor" -gt "2"; then |
Bram Moolenaar | d5cdbeb | 2005-10-10 20:59:28 +0000 | [diff] [blame] | 4349 | DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'" |
Bram Moolenaar | 0cd4930 | 2008-11-20 09:37:01 +0000 | [diff] [blame] | 4350 | AC_MSG_RESULT(yes) |
| 4351 | else |
| 4352 | AC_MSG_RESULT(no) |
Bram Moolenaar | d5cdbeb | 2005-10-10 20:59:28 +0000 | [diff] [blame] | 4353 | fi |
Bram Moolenaar | 0cd4930 | 2008-11-20 09:37:01 +0000 | [diff] [blame] | 4354 | dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is |
| 4355 | dnl declared as char x[1] but actually longer. Introduced in gcc 4.0. |
Bram Moolenaar | 56d1db3 | 2009-12-16 16:14:51 +0000 | [diff] [blame] | 4356 | dnl Also remove duplicate _FORTIFY_SOURCE arguments. |
Bram Moolenaar | aeabe05 | 2011-12-08 15:17:34 +0100 | [diff] [blame] | 4357 | dnl And undefine it first to avoid a warning. |
Bram Moolenaar | 0cd4930 | 2008-11-20 09:37:01 +0000 | [diff] [blame] | 4358 | AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1) |
| 4359 | if test "$gccmajor" -gt "3"; then |
Bram Moolenaar | a6cc031 | 2013-06-18 23:31:55 +0200 | [diff] [blame] | 4360 | CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'` |
Bram Moolenaar | 0cd4930 | 2008-11-20 09:37:01 +0000 | [diff] [blame] | 4361 | AC_MSG_RESULT(yes) |
| 4362 | else |
| 4363 | AC_MSG_RESULT(no) |
| 4364 | fi |
Bram Moolenaar | a5792f5 | 2005-11-23 21:25:05 +0000 | [diff] [blame] | 4365 | fi |
Bram Moolenaar | d5cdbeb | 2005-10-10 20:59:28 +0000 | [diff] [blame] | 4366 | AC_SUBST(DEPEND_CFLAGS_FILTER) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4367 | |
Bram Moolenaar | 22e193d | 2010-11-03 22:32:24 +0100 | [diff] [blame] | 4368 | dnl link.sh tries to avoid overlinking in a hackish way. |
| 4369 | dnl At least GNU ld supports --as-needed which provides the same functionality |
| 4370 | dnl at linker level. Let's use it. |
| 4371 | AC_MSG_CHECKING(linker --as-needed support) |
| 4372 | LINK_AS_NEEDED= |
| 4373 | # Check if linker supports --as-needed and --no-as-needed options |
| 4374 | if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then |
Bram Moolenaar | a6cc031 | 2013-06-18 23:31:55 +0200 | [diff] [blame] | 4375 | LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'` |
Bram Moolenaar | 22e193d | 2010-11-03 22:32:24 +0100 | [diff] [blame] | 4376 | LINK_AS_NEEDED=yes |
| 4377 | fi |
| 4378 | if test "$LINK_AS_NEEDED" = yes; then |
| 4379 | AC_MSG_RESULT(yes) |
| 4380 | else |
| 4381 | AC_MSG_RESULT(no) |
| 4382 | fi |
| 4383 | AC_SUBST(LINK_AS_NEEDED) |
| 4384 | |
Bram Moolenaar | 77c1935 | 2012-06-13 19:19:41 +0200 | [diff] [blame] | 4385 | # IBM z/OS reset CFLAGS for config.mk |
| 4386 | if test "$zOSUnix" = "yes"; then |
| 4387 | CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" |
| 4388 | fi |
| 4389 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4390 | dnl write output files |
| 4391 | AC_OUTPUT(auto/config.mk:config.mk.in) |
| 4392 | |
| 4393 | dnl vim: set sw=2 tw=78 fo+=l: |