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