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