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