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