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