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