blob: 6a847222cc634429b59ab841da874f125c93ee73 [file] [log] [blame]
Bram Moolenaar3f7d0902016-11-12 21:13:42 +01001dnl configure.ac: autoconf script for Vim
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
Paul Ollis65745772022-06-05 16:55:54 +01003dnl Process this file with autoconf 2.69 to produce "configure".
4dnl This should also work with other versions of autoconf, but 2.70 and later
5dnl generate lots of hard to fix "obsolete" warnings.
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
Illia Bobyrf39842f2023-08-27 18:21:23 +02007AC_INIT
8AC_CONFIG_SRCDIR([vim.h])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01009AC_CONFIG_HEADERS(auto/config.h:config.h.in)
Bram Moolenaar071d4272004-06-13 20:20:40 +000010
11dnl Being able to run configure means the system is Unix (compatible).
12AC_DEFINE(UNIX)
13AC_PROG_MAKE_SET
14
15dnl Checks for programs.
Bram Moolenaar22640082018-04-19 20:39:41 +020016AC_PROG_CC_C99 dnl required by almost everything
Bram Moolenaarc0394412017-04-20 20:20:23 +020017AC_PROG_CPP dnl required by header file checks
Illia Bobyrf39842f2023-08-27 18:21:23 +020018AC_PROG_EGREP dnl required by AC_EGREP_CPP
Bram Moolenaarc0394412017-04-20 20:20:23 +020019AC_PROG_FGREP dnl finds working grep -F
Bram Moolenaarc0394412017-04-20 20:20:23 +020020AC_PROG_AWK dnl required for "make html" in ../doc
Bram Moolenaar071d4272004-06-13 20:20:40 +000021
22dnl Don't strip if we don't have it
23AC_CHECK_PROG(STRIP, strip, strip, :)
24
Bram Moolenaar325b7a22004-07-05 15:58:32 +000025dnl Check for extension of executables
Bram Moolenaar071d4272004-06-13 20:20:40 +000026AC_EXEEXT
27
Bram Moolenaar446cb832008-06-24 21:56:24 +000028dnl Check for standard headers. We don't use this in Vim but other stuff
29dnl in autoconf needs it, where it uses STDC_HEADERS.
30AC_HEADER_STDC
31AC_HEADER_SYS_WAIT
32
Bram Moolenaar561f8a52018-04-17 22:02:45 +020033dnl Check that the C99 features that Vim uses are supported:
Bram Moolenaar22640082018-04-19 20:39:41 +020034if test x"$ac_cv_prog_cc_c99" != xno; then
35 dnl If the compiler doesn't explicitly support C99, then check
36 dnl for the specific features Vim uses
37
38 AC_TYPE_LONG_LONG_INT
39 if test "$ac_cv_type_long_long_int" = no; then
40 AC_MSG_FAILURE([Compiler does not support long long int])
41 fi
42
43 AC_MSG_CHECKING([if the compiler supports trailing commas])
44 trailing_commas=no
Bram Moolenaar1004b3d2022-06-05 19:51:55 +010045 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
Bram Moolenaar22640082018-04-19 20:39:41 +020046 enum {
47 one,
Bram Moolenaar1004b3d2022-06-05 19:51:55 +010048 };])],
Bram Moolenaar22640082018-04-19 20:39:41 +020049 [AC_MSG_RESULT(yes); trailing_commas=yes],
50 [AC_MSG_RESULT(no)])
51 if test "$trailing_commas" = no; then
52 AC_MSG_FAILURE([Compiler does not support trailing comma in enum])
53 fi
54
55 AC_MSG_CHECKING([if the compiler supports C++ comments])
56 slash_comments=no
Bram Moolenaar1004b3d2022-06-05 19:51:55 +010057 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
58 [// C++ comments?])],
Bram Moolenaar22640082018-04-19 20:39:41 +020059 [AC_MSG_RESULT(yes); slash_comments=yes],
60 [AC_MSG_RESULT(no)])
61 if test "$slash_comments" = no; then
62 AC_MSG_FAILURE([Compiler does not support C++ comments])
63 fi
64fi
Bram Moolenaar561f8a52018-04-17 22:02:45 +020065
Bram Moolenaar8f1dde52020-06-05 23:16:29 +020066dnl If $SOURCE_DATE_EPOCH is present in the environment, use that as the
67dnl "compiled" timestamp in :version's output. Attempt to get the formatted
68dnl date using GNU date syntax, BSD date syntax, and finally falling back to
69dnl just using the current time.
70if test -n "$SOURCE_DATE_EPOCH"; then
71 DATE_FMT="%b %d %Y %H:%M:%S"
72 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")
73 AC_DEFINE_UNQUOTED(BUILD_DATE, ["$BUILD_DATE"])
74 BUILD_DATE_MSG=-"echo -e '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\nNOTE: build date/time is fixed: $BUILD_DATE\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='"
75 AC_SUBST(BUILD_DATE_MSG)
76fi
77
Bram Moolenaarf788a062011-12-14 20:51:25 +010078dnl Check for the flag that fails if stuff are missing.
79
80AC_MSG_CHECKING(--enable-fail-if-missing argument)
81AC_ARG_ENABLE(fail_if_missing,
82 [ --enable-fail-if-missing Fail if dependencies on additional features
Bram Moolenaare5303952022-06-19 17:05:47 +010083 specified on the command line are missing.],
Bram Moolenaarf788a062011-12-14 20:51:25 +010084 [fail_if_missing="yes"],
85 [fail_if_missing="no"])
86AC_MSG_RESULT($fail_if_missing)
87
Bram Moolenaard2a05492018-07-27 22:35:15 +020088dnl Keep original value to check later.
89with_x_arg="$with_x"
90
Bram Moolenaar071d4272004-06-13 20:20:40 +000091dnl Set default value for CFLAGS if none is defined or it's empty
92if test -z "$CFLAGS"; then
93 CFLAGS="-O"
Bram Moolenaar4d8479b2021-01-31 14:36:06 +010094 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall -Wno-deprecated-declarations"
Bram Moolenaar071d4272004-06-13 20:20:40 +000095fi
Rose00d07e72023-05-06 18:07:14 +010096
Bram Moolenaar071d4272004-06-13 20:20:40 +000097if test "$GCC" = yes; then
Rose00d07e72023-05-06 18:07:14 +010098 dnl Method that should work for nearly all gcc versions.
Bram Moolenaarc8836f72014-04-12 13:12:24 +020099 gccversion=`$CC -dumpversion`
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000100 if test "x$gccversion" = "x"; then
101 dnl old method; fall-back for when -dumpversion doesn't work
Bram Moolenaarc8836f72014-04-12 13:12:24 +0200102 gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000103 fi
Rose00d07e72023-05-06 18:07:14 +0100104
105 dnl Gcc version 4.0.1 was reported to cause trouble on Macintosh by Marcin
106 dnl Dalecki. For Mac with Intel the symptom reported is: malloc() reports
107 dnl double free. This happens in expand_filename(), because the optimizer
108 dnl swaps two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaara5792f52005-11-23 21:25:05 +0000109 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000110 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
112 else
113 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
114 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
115 CFLAGS="$CFLAGS -fno-strength-reduce"
116 fi
117 fi
118fi
119
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200120dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
121dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on
122dnl the version number of the clang in use.
123dnl Note that this does not work to get the version of clang 3.1 or 3.2.
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100124AC_MSG_CHECKING(for clang version)
125CLANG_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 Moolenaar0c6ccfd2013-10-02 18:23:07 +0200126if test x"$CLANG_VERSION_STRING" != x"" ; then
127 CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'`
128 CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'`
129 CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'`
130 CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
131 AC_MSG_RESULT($CLANG_VERSION)
132 dnl If you find the same issue with versions earlier than 500.2.75,
133 dnl change the constant 500002075 below appropriately. To get the
134 dnl integer corresponding to a version number, refer to the
135 dnl definition of CLANG_VERSION above.
Bram Moolenaarebd211c2021-01-30 19:33:36 +0100136 dnl Clang 11 reports "11", assume Clang 10 and later work like this.
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100137 AC_MSG_CHECKING(if clang supports -fno-strength-reduce)
Bram Moolenaarebd211c2021-01-30 19:33:36 +0100138 if test "$CLANG_MAJOR" -ge 10 -o "$CLANG_VERSION" -ge 500002075 ; then
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100139 AC_MSG_RESULT(no)
140 CFLAGS=`echo "$CFLAGS" | sed -e 's/-fno-strength-reduce/ /'`
141 else
142 AC_MSG_RESULT(yes)
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200143 fi
144else
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100145 AC_MSG_RESULT(N/A)
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200146fi
147
Bram Moolenaar446cb832008-06-24 21:56:24 +0000148dnl If configure thinks we are cross compiling, there might be something
149dnl wrong with the CC or CFLAGS settings, give a useful warning message
Bram Moolenaar839e9542016-04-14 16:46:02 +0200150CROSS_COMPILING=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000151if test "$cross_compiling" = yes; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000152 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
Bram Moolenaar839e9542016-04-14 16:46:02 +0200153 CROSS_COMPILING=1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000154fi
Bram Moolenaar839e9542016-04-14 16:46:02 +0200155AC_SUBST(CROSS_COMPILING)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000156
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000157dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
158dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
160
161if test -f ./toolcheck; then
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100162 AC_MSG_CHECKING(for buggy tools)
163 sh ./toolcheck 1>&AS_MESSAGE_FD
Bram Moolenaar071d4272004-06-13 20:20:40 +0000164fi
165
166OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
167
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000168dnl When cross-compiling set $vim_cv_uname_output, $vim_cv_uname_r_output and
169dnl $vim_cv_uname_m_output to the desired value for the target system
170AC_MSG_CHECKING(uname)
171if test "x$vim_cv_uname_output" = "x" ; then
172 vim_cv_uname_output=`(uname) 2>/dev/null`
173 AC_MSG_RESULT($vim_cv_uname_output)
174else
175 AC_MSG_RESULT([$vim_cv_uname_output (cached)])
176fi
177
178AC_MSG_CHECKING(uname -r)
179if test "x$vim_cv_uname_r_output" = "x" ; then
180 vim_cv_uname_r_output=`(uname -r) 2>/dev/null`
181 AC_MSG_RESULT($vim_cv_uname_r_output)
182else
183 AC_MSG_RESULT([$vim_cv_uname_r_output (cached)])
184fi
185
186AC_MSG_CHECKING(uname -m)
187if test "x$vim_cv_uname_m_output" = "x" ; then
188 vim_cv_uname_m_output=`(uname -m) 2>/dev/null`
189 AC_MSG_RESULT($vim_cv_uname_m_output)
190else
191 AC_MSG_RESULT([$vim_cv_uname_m_output (cached)])
192fi
193
Bram Moolenaarb3f74062020-02-26 16:16:53 +0100194AC_MSG_CHECKING(for Haiku)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000195case $vim_cv_uname_output in
Bram Moolenaarb3f74062020-02-26 16:16:53 +0100196 Haiku) HAIKU=yes; AC_MSG_RESULT(yes);;
197 *) HAIKU=no; AC_MSG_RESULT(no);;
198esac
199
Bram Moolenaar071d4272004-06-13 20:20:40 +0000200dnl If QNX is found, assume we don't want to use Xphoton
201dnl unless it was specifically asked for (--with-x)
202AC_MSG_CHECKING(for QNX)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000203case $vim_cv_uname_output in
Bram Moolenaar071d4272004-06-13 20:20:40 +0000204 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
205 test -z "$with_x" && with_x=no
206 QNX=yes; AC_MSG_RESULT(yes);;
207 *) QNX=no; AC_MSG_RESULT(no);;
208esac
209
210dnl Check for Darwin and MacOS X
211dnl We do a check for MacOS X in the very beginning because there
212dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +0000213AC_MSG_CHECKING([for Darwin (Mac OS X)])
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000214if test "$vim_cv_uname_output" = Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215 AC_MSG_RESULT(yes)
Bram Moolenaard0573012017-10-28 21:11:06 +0200216 MACOS_X=yes
Bram Moolenaar52ecaaa2018-05-12 21:38:13 +0200217 CPPFLAGS="$CPPFLAGS -DMACOS_X"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000218
219 AC_MSG_CHECKING(--disable-darwin argument)
220 AC_ARG_ENABLE(darwin,
221 [ --disable-darwin Disable Darwin (Mac OS X) support.],
222 , [enable_darwin="yes"])
223 if test "$enable_darwin" = "yes"; then
224 AC_MSG_RESULT(no)
225 AC_MSG_CHECKING(if Darwin files are there)
Bram Moolenaar164fca32010-07-14 13:58:07 +0200226 if test -f os_macosx.m; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227 AC_MSG_RESULT(yes)
228 else
229 AC_MSG_RESULT([no, Darwin support disabled])
230 enable_darwin=no
231 fi
232 else
233 AC_MSG_RESULT([yes, Darwin support excluded])
234 fi
235
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000236 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000237 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000238 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000239 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000240
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100241 AC_MSG_CHECKING(--with-developer-dir argument)
242 AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
243 DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
Bram Moolenaar32d03b32015-11-19 13:46:48 +0100244 AC_MSG_RESULT(not present))
Bram Moolenaare5303952022-06-19 17:05:47 +0100245
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100246 if test "x$DEVELOPER_DIR" = "x"; then
247 AC_PATH_PROG(XCODE_SELECT, xcode-select)
248 if test "x$XCODE_SELECT" != "x"; then
249 AC_MSG_CHECKING(for developer dir using xcode-select)
250 DEVELOPER_DIR=`$XCODE_SELECT -print-path`
251 AC_MSG_RESULT([$DEVELOPER_DIR])
252 else
253 DEVELOPER_DIR=/Developer
254 fi
255 fi
256
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000257 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000258 AC_MSG_CHECKING(for 10.4 universal SDK)
259 dnl There is a terrible inconsistency (but we appear to get away with it):
260 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
261 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
262 dnl tests using the preprocessor are actually done with the wrong header
263 dnl files. $LDFLAGS is set at the end, because configure uses it together
264 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000265 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000266 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000267 save_ldflags="$LDFLAGS"
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100268 CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100269 AC_LINK_IFELSE([AC_LANG_PROGRAM([ ], [ ])],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000270 AC_MSG_RESULT(found, will make universal binary),
271
272 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000273 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000274 AC_MSG_CHECKING(if Intel architecture is supported)
275 CPPFLAGS="$CPPFLAGS -arch i386"
276 LDFLAGS="$save_ldflags -arch i386"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100277 AC_LINK_IFELSE([AC_LANG_PROGRAM([ ], [ ])],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000278 AC_MSG_RESULT(yes); MACARCH="intel",
279 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000280 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000281 CPPFLAGS="$save_cppflags -arch ppc"
282 LDFLAGS="$save_ldflags -arch ppc"))
283 elif test "x$MACARCH" = "xintel"; then
284 CPPFLAGS="$CPPFLAGS -arch intel"
285 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000286 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000287 CPPFLAGS="$CPPFLAGS -arch ppc"
288 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000289 fi
290
Bram Moolenaar071d4272004-06-13 20:20:40 +0000291 if test "$enable_darwin" = "yes"; then
Bram Moolenaard0573012017-10-28 21:11:06 +0200292 MACOS_X_DARWIN=yes
Bram Moolenaar164fca32010-07-14 13:58:07 +0200293 OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000294 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaare5303952022-06-19 17:05:47 +0100295 dnl os_macosx.m implements timer_create() and friends
296 AC_DEFINE(HAVE_TIMER_CREATE)
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000297 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaar0958e0f2013-11-04 04:57:50 +0100298 dnl Removed -no-cpp-precomp, only for very old compilers.
Bram Moolenaard0573012017-10-28 21:11:06 +0200299 CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
Bram Moolenaar040f9752020-08-11 23:08:48 +0200300
301 dnl Assume we don't want X11 unless it was specifically asked for
Bram Moolenaar0b40d082022-03-08 13:32:37 +0000302 dnl (--with-x) or Motif or GTK GUI is used.
303 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
Bram Moolenaar040f9752020-08-11 23:08:48 +0200304 with_x=no
305 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000306 fi
307else
308 AC_MSG_RESULT(no)
309fi
310
Bram Moolenaar39766a72013-11-03 00:41:00 +0100311dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon
312dnl so we need to include it to have access to version macros.
Bram Moolenaar18e54692013-11-03 20:26:31 +0100313AC_CHECK_HEADERS(AvailabilityMacros.h)
Evan Miller25448072022-12-30 10:42:23 +0000314# 10.5 and earlier lack dispatch
315AC_CHECK_HEADERS(dispatch/dispatch.h)
Bram Moolenaar39766a72013-11-03 00:41:00 +0100316
Bram Moolenaar071d4272004-06-13 20:20:40 +0000317AC_SUBST(OS_EXTRA_SRC)
318AC_SUBST(OS_EXTRA_OBJ)
319
320dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
321dnl Only when the directory exists and it wasn't there yet.
322dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000323dnl Skip all of this when cross-compiling.
324if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000325 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000326 have_local_include=''
327 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000328 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
329 --without-local-dir do not search /usr/local for local libraries.], [
330 local_dir="$withval"
331 case "$withval" in
332 */*) ;;
333 no)
334 # avoid adding local dir to LDFLAGS and CPPFLAGS
Bram Moolenaare06c1882010-07-21 22:05:20 +0200335 have_local_include=yes
Bram Moolenaarc236c162008-07-13 17:41:49 +0000336 have_local_lib=yes
337 ;;
338 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
339 esac
340 AC_MSG_RESULT($local_dir)
341 ], [
342 local_dir=/usr/local
343 AC_MSG_RESULT(Defaulting to $local_dir)
344 ])
345 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000346 echo 'void f(){}' > conftest.c
Bram Moolenaar0958e0f2013-11-04 04:57:50 +0100347 dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler)
348 have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
Bram Moolenaarc236c162008-07-13 17:41:49 +0000349 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000350 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000351 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000352 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
353 tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000354 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000355 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000356 fi
357 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000358 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
359 tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000360 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000361 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000362 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000363 fi
364fi
365
366AC_MSG_CHECKING(--with-vim-name argument)
367AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
368 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000369 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000370AC_SUBST(VIMNAME)
371AC_MSG_CHECKING(--with-ex-name argument)
372AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
373 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
374 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
375AC_SUBST(EXNAME)
376AC_MSG_CHECKING(--with-view-name argument)
377AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
378 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
379 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
380AC_SUBST(VIEWNAME)
381
382AC_MSG_CHECKING(--with-global-runtime argument)
Bram Moolenaar9d302ad2018-12-21 11:48:51 +0100383AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath', comma-separated for multiple directories],
384 RUNTIME_GLOBAL="$withval"; AC_MSG_RESULT($withval),
Bram Moolenaar071d4272004-06-13 20:20:40 +0000385 AC_MSG_RESULT(no))
386
Bram Moolenaar9d302ad2018-12-21 11:48:51 +0100387if test "X$RUNTIME_GLOBAL" != "X"; then
388 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" }')
389 AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$RUNTIME_GLOBAL")
390 AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL_AFTER, "$RUNTIME_GLOBAL_AFTER")
391fi
392
Bram Moolenaar071d4272004-06-13 20:20:40 +0000393AC_MSG_CHECKING(--with-modified-by argument)
394AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
395 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
396 AC_MSG_RESULT(no))
397
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200398dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000399AC_MSG_CHECKING(if character set is EBCDIC)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100400AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ],
Bram Moolenaar071d4272004-06-13 20:20:40 +0000401[ /* TryCompile function for CharSet.
402 Treat any failure as ASCII for compatibility with existing art.
403 Use compile-time rather than run-time tests for cross-compiler
404 tolerance. */
405#if '0'!=240
406make an error "Character set is not EBCDIC"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100407#endif ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +0000408[ # TryCompile action if true
409cf_cv_ebcdic=yes ],
410[ # TryCompile action if false
411cf_cv_ebcdic=no])
412# end of TryCompile ])
413# end of CacheVal CvEbcdic
414AC_MSG_RESULT($cf_cv_ebcdic)
415case "$cf_cv_ebcdic" in #(vi
416 yes) AC_DEFINE(EBCDIC)
417 line_break='"\\n"'
418 ;;
419 *) line_break='"\\012"';;
420esac
421AC_SUBST(line_break)
422
423if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar84a05ac2013-05-06 04:24:17 +0200424dnl If we have EBCDIC we most likely have z/OS Unix, let's test it!
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200425AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000426case $vim_cv_uname_output in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200427 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000428 dnl If using cc the environment variable _CC_CCMODE must be
429 dnl set to "1", so that some compiler extensions are enabled.
430 dnl If using c89 the environment variable is named _CC_C89MODE.
431 dnl Note: compile with c89 never tested.
432 if test "$CC" = "cc"; then
433 ccm="$_CC_CCMODE"
434 ccn="CC"
435 else
436 if test "$CC" = "c89"; then
437 ccm="$_CC_C89MODE"
438 ccn="C89"
439 else
440 ccm=1
441 fi
442 fi
443 if test "$ccm" != "1"; then
444 echo ""
445 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200446 echo " On z/OS Unix, the environment variable"
Bram Moolenaar77c19352012-06-13 19:19:41 +0200447 echo " _CC_${ccn}MODE must be set to \"1\"!"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000448 echo " Do:"
449 echo " export _CC_${ccn}MODE=1"
450 echo " and then call configure again."
451 echo "------------------------------------------"
452 exit 1
453 fi
Bram Moolenaar77c19352012-06-13 19:19:41 +0200454 # Set CFLAGS for configure process.
455 # This will be reset later for config.mk.
456 # Use haltonmsg to force error for missing H files.
457 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
458 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000459 AC_MSG_RESULT(yes)
460 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200461 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000462 AC_MSG_RESULT(no)
463 ;;
464esac
465fi
466
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200467dnl Set QUOTESED. Needs additional backslashes on zOS
468if test "$zOSUnix" = "yes"; then
Bram Moolenaarabcbb0e2020-12-23 12:33:42 +0100469 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/' -e 's/ */ /g'"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200470else
Bram Moolenaarabcbb0e2020-12-23 12:33:42 +0100471 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/' -e 's/ */ /g'"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200472fi
473AC_SUBST(QUOTESED)
474
475
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200476dnl Link with -lsmack for Smack stuff; if not found
477AC_MSG_CHECKING(--disable-smack argument)
478AC_ARG_ENABLE(smack,
479 [ --disable-smack Do not check for Smack support.],
480 , enable_smack="yes")
481if test "$enable_smack" = "yes"; then
Bram Moolenaar4ed89cd2014-04-05 12:02:25 +0200482 AC_MSG_RESULT(no)
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200483 AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no")
Bram Moolenaar4ed89cd2014-04-05 12:02:25 +0200484else
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200485 AC_MSG_RESULT(yes)
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200486fi
487if test "$enable_smack" = "yes"; then
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200488 AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no")
489fi
490if test "$enable_smack" = "yes"; then
491 AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h)
492 AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>],
493 AC_MSG_RESULT(yes),
Bram Moolenaare29b1fe2014-04-10 20:00:15 +0200494 AC_MSG_RESULT(no); enable_smack="no")
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200495fi
496if test "$enable_smack" = "yes"; then
497 AC_CHECK_LIB(attr, setxattr,
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200498 [LIBS="$LIBS -lattr"
499 found_smack="yes"
500 AC_DEFINE(HAVE_SMACK)])
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000501fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000502
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200503dnl When smack was found don't search for SELinux
504if test "x$found_smack" = "x"; then
505 dnl Link with -lselinux for SELinux stuff; if not found
506 AC_MSG_CHECKING(--disable-selinux argument)
507 AC_ARG_ENABLE(selinux,
508 [ --disable-selinux Do not check for SELinux support.],
509 , enable_selinux="yes")
510 if test "$enable_selinux" = "yes"; then
511 AC_MSG_RESULT(no)
512 AC_CHECK_LIB(selinux, is_selinux_enabled,
Bram Moolenaare4b78e22017-12-07 22:29:11 +0100513 [AC_CHECK_HEADER(selinux/selinux.h,
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200514 [LIBS="$LIBS -lselinux"
Bram Moolenaare4b78e22017-12-07 22:29:11 +0100515 AC_DEFINE(HAVE_SELINUX)])])
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200516 else
517 AC_MSG_RESULT(yes)
518 fi
519fi
520
Bram Moolenaar071d4272004-06-13 20:20:40 +0000521dnl Check user requested features.
522
523AC_MSG_CHECKING(--with-features argument)
Martin Tournoij25f3a142022-10-08 19:26:41 +0100524AC_ARG_WITH(features, [ --with-features=TYPE tiny, normal or huge (default: huge)],
Bram Moolenaar071d4272004-06-13 20:20:40 +0000525 features="$withval"; AC_MSG_RESULT($features),
Bram Moolenaar23c4f712016-01-20 22:11:59 +0100526 features="huge"; AC_MSG_RESULT(Defaulting to huge))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000527
Martin Tournoij7904fa42022-10-04 16:28:45 +0100528dnl "small" is supported for backwards compatibility, now an alias for "tiny"
Martin Tournoij25f3a142022-10-08 19:26:41 +0100529dnl "big" is supported for backwards compatibility, now an alias for "normal"
Martin Tournoij7904fa42022-10-04 16:28:45 +0100530case "$features" in
Martin Tournoij25f3a142022-10-08 19:26:41 +0100531 small) features="tiny" ;;
532 big) features="normal" ;;
Martin Tournoij7904fa42022-10-04 16:28:45 +0100533esac
534
Bram Moolenaar071d4272004-06-13 20:20:40 +0000535dovimdiff=""
536dogvimdiff=""
537case "$features" in
538 tiny) AC_DEFINE(FEAT_TINY) ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +0000539 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
540 dogvimdiff="installgvimdiff" ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +0000541 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
542 dogvimdiff="installgvimdiff" ;;
543 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
544esac
545
546AC_SUBST(dovimdiff)
547AC_SUBST(dogvimdiff)
548
Martin Tournoij7904fa42022-10-04 16:28:45 +0100549if test "x$features" = "xtiny"; then
Bram Moolenaar12471262022-01-18 11:11:25 +0000550 has_eval=no
551else
552 has_eval=yes
553fi
554
Bram Moolenaar071d4272004-06-13 20:20:40 +0000555AC_MSG_CHECKING(--with-compiledby argument)
556AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
557 compiledby="$withval"; AC_MSG_RESULT($withval),
558 compiledby=""; AC_MSG_RESULT(no))
559AC_SUBST(compiledby)
560
561AC_MSG_CHECKING(--disable-xsmp argument)
562AC_ARG_ENABLE(xsmp,
563 [ --disable-xsmp Disable XSMP session management],
564 , enable_xsmp="yes")
565
566if test "$enable_xsmp" = "yes"; then
567 AC_MSG_RESULT(no)
568 AC_MSG_CHECKING(--disable-xsmp-interact argument)
569 AC_ARG_ENABLE(xsmp-interact,
570 [ --disable-xsmp-interact Disable XSMP interaction],
571 , enable_xsmp_interact="yes")
572 if test "$enable_xsmp_interact" = "yes"; then
573 AC_MSG_RESULT(no)
574 AC_DEFINE(USE_XSMP_INTERACT)
575 else
576 AC_MSG_RESULT(yes)
577 fi
578else
579 AC_MSG_RESULT(yes)
580fi
581
Bram Moolenaar67ffb412022-01-08 13:36:57 +0000582AC_MSG_CHECKING([diff feature])
Martin Tournoij7904fa42022-10-04 16:28:45 +0100583if test "x$features" = "xtiny"; then
Bram Moolenaar67ffb412022-01-08 13:36:57 +0000584 AC_MSG_RESULT([disabled in $features version])
585else
586 AC_MSG_RESULT(enabled)
587 AC_DEFINE(FEAT_DIFF)
588 XDIFF_OBJS_USED="\$(XDIFF_OBJS)"
589 AC_SUBST(XDIFF_OBJS_USED)
590fi
591
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200592dnl Check for Lua feature.
593AC_MSG_CHECKING(--enable-luainterp argument)
594AC_ARG_ENABLE(luainterp,
Bram Moolenaar8008b632017-07-18 21:33:20 +0200595 [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200596 [enable_luainterp="no"])
597AC_MSG_RESULT($enable_luainterp)
598
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200599if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +0000600 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +0100601 AC_MSG_ERROR([cannot use Lua with tiny features])
Bram Moolenaar3c124e32016-01-31 14:36:58 +0100602 fi
603
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200604 dnl -- find the lua executable
605 AC_SUBST(vi_cv_path_lua)
606
607 AC_MSG_CHECKING(--with-lua-prefix argument)
608 AC_ARG_WITH(lua_prefix,
609 [ --with-lua-prefix=PFX Prefix where Lua is installed.],
610 with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200611 with_lua_prefix="";AC_MSG_RESULT(no))
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200612
613 if test "X$with_lua_prefix" != "X"; then
614 vi_cv_path_lua_pfx="$with_lua_prefix"
615 else
616 AC_MSG_CHECKING(LUA_PREFIX environment var)
617 if test "X$LUA_PREFIX" != "X"; then
618 AC_MSG_RESULT("$LUA_PREFIX")
619 vi_cv_path_lua_pfx="$LUA_PREFIX"
620 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200621 AC_MSG_RESULT([not set, default to /usr])
622 vi_cv_path_lua_pfx="/usr"
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200623 fi
624 fi
625
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200626 AC_MSG_CHECKING(--with-luajit)
627 AC_ARG_WITH(luajit,
628 [ --with-luajit Link with LuaJIT instead of Lua.],
629 [vi_cv_with_luajit="$withval"],
630 [vi_cv_with_luajit="no"])
631 AC_MSG_RESULT($vi_cv_with_luajit)
632
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200633 LUA_INC=
634 if test "X$vi_cv_path_lua_pfx" != "X"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200635 if test "x$vi_cv_with_luajit" != "xno"; then
636 dnl -- try to find LuaJIT executable
637 AC_PATH_PROG(vi_cv_path_luajit, luajit)
638 if test "X$vi_cv_path_luajit" != "X"; then
639 dnl -- find LuaJIT version
640 AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit,
Christian Brabandtd42f95b2023-08-24 08:15:38 +0200641 [ vi_cv_version_luajit=`${vi_cv_path_luajit} -v 2>&1 | sed 's/LuaJIT \([[0-9.]]*\)\.[[0-9]]\(-\?[[a-z0-9]]*\)* .*/\1/'` ])
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200642 AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit,
643 [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ])
644 vi_cv_path_lua="$vi_cv_path_luajit"
645 vi_cv_version_lua="$vi_cv_version_lua_luajit"
646 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200647 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200648 dnl -- try to find Lua executable
649 AC_PATH_PROG(vi_cv_path_plain_lua, lua)
650 if test "X$vi_cv_path_plain_lua" != "X"; then
651 dnl -- find Lua version
652 AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua,
653 [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
654 fi
655 vi_cv_path_lua="$vi_cv_path_plain_lua"
656 vi_cv_version_lua="$vi_cv_version_plain_lua"
657 fi
658 if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then
659 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit)
Bram Moolenaar49222be2015-12-11 18:11:30 +0100660 if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200661 AC_MSG_RESULT(yes)
662 LUA_INC=/luajit-$vi_cv_version_luajit
663 fi
664 fi
665 if test "X$LUA_INC" = "X"; then
666 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
Bram Moolenaar49222be2015-12-11 18:11:30 +0100667 if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200668 AC_MSG_RESULT(yes)
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200669 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200670 AC_MSG_RESULT(no)
671 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
Bram Moolenaar49222be2015-12-11 18:11:30 +0100672 if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200673 AC_MSG_RESULT(yes)
674 LUA_INC=/lua$vi_cv_version_lua
675 else
676 AC_MSG_RESULT(no)
Bram Moolenaarf49e5642020-04-19 17:46:53 +0200677
678 # Detect moonjit:
679 # https://groups.google.com/forum/#!topic/vim_use/O0vek60WuTk
680 lua_suf=/moonjit-2.3
681 inc_path="$vi_cv_path_lua_pfx/include"
Bram Moolenaarad4dc832020-04-20 16:21:53 +0200682 for dir in "$inc_path"/moonjit-[[0-9]]* ; do
Bram Moolenaarf49e5642020-04-19 17:46:53 +0200683 if test -d "$dir" ; then
Bram Moolenaara79a8942020-12-17 20:50:25 +0100684 lua_suf=`basename "$dir"`
Bram Moolenaarf49e5642020-04-19 17:46:53 +0200685 lua_suf="/$lua_suf"
686 break
687 fi
688 done
689 AC_MSG_CHECKING(if lua.h can be found in $inc_path$lua_suf)
690 if test -f "$inc_path$lua_suf/lua.h"; then
691 AC_MSG_RESULT(yes)
692 LUA_INC=$lua_suf
693 else
694 AC_MSG_RESULT(no)
695 vi_cv_path_lua_pfx=
696 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200697 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200698 fi
699 fi
700 fi
701
702 if test "X$vi_cv_path_lua_pfx" != "X"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200703 if test "x$vi_cv_with_luajit" != "xno"; then
704 multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
705 if test "X$multiarch" != "X"; then
706 lib_multiarch="lib/${multiarch}"
707 else
708 lib_multiarch="lib"
709 fi
710 if test "X$vi_cv_version_lua" = "X"; then
711 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit"
712 else
713 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua"
714 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200715 else
Bram Moolenaar869113f2023-03-31 21:29:00 +0100716 dnl Test alternate lib location including version
717 if test -d "${vi_cv_path_lua_pfx}/lib/lua$vi_cv_version_lua"; then
718 LUALIBDIR="lib/lua$vi_cv_version_lua"
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200719 else
Bram Moolenaar869113f2023-03-31 21:29:00 +0100720 LUALIBDIR=lib
721 fi
722 if test "X$LUA_INC" != "X"; then
723 dnl Test alternate name including version
724 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${LUALIBDIR} -llua$vi_cv_version_lua"
725 else
726 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${LUALIBDIR} -llua"
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200727 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200728 fi
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200729 if test "$enable_luainterp" = "dynamic"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200730 lua_ok="yes"
731 else
732 AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane])
733 libs_save=$LIBS
734 LIBS="$LIBS $LUA_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100735 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200736 AC_MSG_RESULT(yes); lua_ok="yes",
737 AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="")
738 LIBS=$libs_save
739 fi
740 if test "x$lua_ok" = "xyes"; then
741 LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
742 LUA_SRC="if_lua.c"
743 LUA_OBJ="objects/if_lua.o"
744 LUA_PRO="if_lua.pro"
745 AC_DEFINE(FEAT_LUA)
746 fi
747 if test "$enable_luainterp" = "dynamic"; then
748 if test "x$vi_cv_with_luajit" != "xno"; then
749 luajit="jit"
750 fi
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200751 if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
752 vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
753 else
Bram Moolenaard0573012017-10-28 21:11:06 +0200754 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200755 ext="dylib"
756 indexes=""
757 else
758 ext="so"
759 indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9"
760 multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
761 if test "X$multiarch" != "X"; then
762 lib_multiarch="lib/${multiarch}"
763 fi
Bram Moolenaar768baac2013-04-15 14:44:57 +0200764 fi
765 dnl Determine the sover for the current version, but fallback to
766 dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found.
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200767 AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx)
Bram Moolenaar768baac2013-04-15 14:44:57 +0200768 for subdir in "${lib_multiarch}" lib64 lib; do
769 if test -z "$subdir"; then
770 continue
771 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200772 for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \
773 ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do
774 for i in $indexes ""; do
775 if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then
Bram Moolenaar768baac2013-04-15 14:44:57 +0200776 sover2="$i"
777 break 3
778 fi
779 done
Bram Moolenaar07e1da62013-02-06 19:49:43 +0100780 done
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200781 sover=""
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200782 done
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200783 if test "X$sover" = "X"; then
784 AC_MSG_RESULT(no)
785 lua_ok="no"
786 vi_cv_dll_name_lua="liblua${luajit}.${ext}"
787 else
788 AC_MSG_RESULT(yes)
789 lua_ok="yes"
790 vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2"
791 fi
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200792 fi
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200793 AC_DEFINE(DYNAMIC_LUA)
794 LUA_LIBS=""
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200795 LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS"
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200796 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200797 if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \
Bram Moolenaard0573012017-10-28 21:11:06 +0200798 test "x$MACOS_X" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000799 test "$vim_cv_uname_m_output" = "x86_64"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200800 dnl OSX/x64 requires these flags. See http://luajit.org/install.html
801 LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS"
802 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200803 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200804 if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then
Bram Moolenaarf788a062011-12-14 20:51:25 +0100805 AC_MSG_ERROR([could not configure lua])
806 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200807 AC_SUBST(LUA_SRC)
808 AC_SUBST(LUA_OBJ)
809 AC_SUBST(LUA_PRO)
810 AC_SUBST(LUA_LIBS)
811 AC_SUBST(LUA_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +0000812 AC_SUBST(LUA_CFLAGS_EXTRA)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200813fi
814
815
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000816dnl Check for MzScheme feature.
817AC_MSG_CHECKING(--enable-mzschemeinterp argument)
818AC_ARG_ENABLE(mzschemeinterp,
Bram Moolenaar8008b632017-07-18 21:33:20 +0200819 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000820 [enable_mzschemeinterp="no"])
821AC_MSG_RESULT($enable_mzschemeinterp)
822
823if test "$enable_mzschemeinterp" = "yes"; then
824 dnl -- find the mzscheme executable
825 AC_SUBST(vi_cv_path_mzscheme)
826
827 AC_MSG_CHECKING(--with-plthome argument)
828 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000829 [ --with-plthome=PLTHOME Use PLTHOME.],
830 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000831 with_plthome="";AC_MSG_RESULT("no"))
832
833 if test "X$with_plthome" != "X"; then
834 vi_cv_path_mzscheme_pfx="$with_plthome"
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100835 vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000836 else
837 AC_MSG_CHECKING(PLTHOME environment var)
838 if test "X$PLTHOME" != "X"; then
839 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000840 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100841 vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000842 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000843 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000844 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000845 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000846
847 dnl resolve symbolic link, the executable is often elsewhere and there
848 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000849 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000850 lsout=`ls -l $vi_cv_path_mzscheme`
851 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
852 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
853 fi
854 fi
855
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000856 if test "X$vi_cv_path_mzscheme" != "X"; then
857 dnl -- find where MzScheme thinks it was installed
858 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000859 dnl different versions of MzScheme differ in command line processing
860 dnl use universal approach
861 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000862 (build-path (call-with-values \
863 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000864 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
865 dnl Remove a trailing slash
866 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
867 sed -e 's+/$++'` ])
868 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000869 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000870 fi
871 fi
872
873 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100874 AC_MSG_CHECKING(for racket include directory)
875 SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'`
876 if test "X$SCHEME_INC" != "X"; then
877 AC_MSG_RESULT(${SCHEME_INC})
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000878 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100879 AC_MSG_RESULT(not found)
880 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
881 if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then
882 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000883 AC_MSG_RESULT(yes)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000884 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000885 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100886 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
887 if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000888 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100889 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000890 else
891 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100892 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket)
893 if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100894 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100895 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100896 else
897 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100898 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
899 if test -f /usr/include/plt/scheme.h; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100900 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100901 SCHEME_INC=/usr/include/plt
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100902 else
903 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100904 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/)
905 if test -f /usr/include/racket/scheme.h; then
906 AC_MSG_RESULT(yes)
907 SCHEME_INC=/usr/include/racket
908 else
909 AC_MSG_RESULT(no)
910 vi_cv_path_mzscheme_pfx=
911 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100912 fi
913 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000914 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000915 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000916 fi
917 fi
918
919 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100920
921 AC_MSG_CHECKING(for racket lib directory)
922 SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'`
923 if test "X$SCHEME_LIB" != "X"; then
924 AC_MSG_RESULT(${SCHEME_LIB})
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000925 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100926 AC_MSG_RESULT(not found)
927 fi
928
929 for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
930 if test "X$path" != "X"; then
Bram Moolenaard0573012017-10-28 21:11:06 +0200931 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100932 MZSCHEME_LIBS="-framework Racket"
933 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
934 elif test -f "${path}/libmzscheme3m.a"; then
935 MZSCHEME_LIBS="${path}/libmzscheme3m.a"
936 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
937 elif test -f "${path}/libracket3m.a"; then
938 MZSCHEME_LIBS="${path}/libracket3m.a"
Bram Moolenaar588d2412020-10-03 14:24:19 +0200939 if test -f "${path}/librktio.a"; then
940 MZSCHEME_LIBS="${MZSCHEME_LIBS} ${path}/librktio.a"
941 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100942 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
943 elif test -f "${path}/libracket.a"; then
944 MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a"
945 elif test -f "${path}/libmzscheme.a"; then
946 MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a"
947 else
948 dnl Using shared objects
949 if test -f "${path}/libmzscheme3m.so"; then
950 MZSCHEME_LIBS="-L${path} -lmzscheme3m"
951 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
952 elif test -f "${path}/libracket3m.so"; then
953 MZSCHEME_LIBS="-L${path} -lracket3m"
954 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
955 elif test -f "${path}/libracket.so"; then
956 MZSCHEME_LIBS="-L${path} -lracket -lmzgc"
957 else
958 dnl try next until last
959 if test "$path" != "$SCHEME_LIB"; then
960 continue
961 fi
962 MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc"
963 fi
964 if test "$GCC" = yes; then
965 dnl Make Vim remember the path to the library. For when it's not in
966 dnl $LD_LIBRARY_PATH.
967 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000968 elif test "$vim_cv_uname_output" = SunOS &&
969 echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100970 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}"
971 fi
972 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000973 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100974 if test "X$MZSCHEME_LIBS" != "X"; then
975 break
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000976 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100977 done
978
979 AC_MSG_CHECKING([if racket requires -pthread])
980 if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then
981 AC_MSG_RESULT(yes)
982 MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread"
983 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread"
984 else
985 AC_MSG_RESULT(no)
986 fi
987
988 AC_MSG_CHECKING(for racket config directory)
989 SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'`
990 if test "X$SCHEME_CONFIGDIR" != "X"; then
991 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'"
992 AC_MSG_RESULT(${SCHEME_CONFIGDIR})
993 else
994 AC_MSG_RESULT(not found)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000995 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100996
997 AC_MSG_CHECKING(for racket collects directory)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100998 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))))'`
999 if test "X$SCHEME_COLLECTS" = "X"; then
1000 if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then
1001 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001002 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +01001003 if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then
1004 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/
Bram Moolenaar75676462013-01-30 14:55:42 +01001005 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +01001006 if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then
1007 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
1008 else
1009 if test -d "$vi_cv_path_mzscheme_pfx/collects"; then
1010 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
1011 fi
Bram Moolenaar75676462013-01-30 14:55:42 +01001012 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001013 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +01001014 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +00001015 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001016 if test "X$SCHEME_COLLECTS" != "X" ; then
1017 AC_MSG_RESULT(${SCHEME_COLLECTS})
1018 else
1019 AC_MSG_RESULT(not found)
1020 fi
1021
1022 AC_MSG_CHECKING(for mzscheme_base.c)
1023 if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001024 MZSCHEME_EXTRA="mzscheme_base.c"
Bram Moolenaar45e2bcc2014-02-15 17:19:00 +01001025 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
1026 MZSCHEME_MOD="++lib scheme/base"
Bram Moolenaar2d0860d2010-11-03 21:59:30 +01001027 else
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001028 if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +01001029 MZSCHEME_EXTRA="mzscheme_base.c"
Bram Moolenaar45e2bcc2014-02-15 17:19:00 +01001030 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
1031 MZSCHEME_MOD="++lib scheme/base"
1032 else
1033 if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then
1034 MZSCHEME_EXTRA="mzscheme_base.c"
1035 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool"
1036 MZSCHEME_MOD=""
1037 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +01001038 fi
1039 fi
1040 if test "X$MZSCHEME_EXTRA" != "X" ; then
1041 dnl need to generate bytecode for MzScheme base
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001042 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001043 AC_MSG_RESULT(needed)
1044 else
1045 AC_MSG_RESULT(not needed)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001046 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001047
Bram Moolenaar9e902192013-07-17 18:58:11 +02001048 dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'".
1049 AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"])
1050
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001051 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001052 -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar9e902192013-07-17 18:58:11 +02001053
1054 dnl Test that we can compile a simple program with these CFLAGS and LIBS.
1055 AC_MSG_CHECKING([if compile and link flags for MzScheme are sane])
1056 cflags_save=$CFLAGS
1057 libs_save=$LIBS
1058 CFLAGS="$CFLAGS $MZSCHEME_CFLAGS"
1059 LIBS="$LIBS $MZSCHEME_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001060 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar9e902192013-07-17 18:58:11 +02001061 AC_MSG_RESULT(yes); mzs_ok=yes,
1062 AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no)
1063 CFLAGS=$cflags_save
1064 LIBS=$libs_save
1065 if test $mzs_ok = yes; then
1066 MZSCHEME_SRC="if_mzsch.c"
1067 MZSCHEME_OBJ="objects/if_mzsch.o"
1068 MZSCHEME_PRO="if_mzsch.pro"
1069 AC_DEFINE(FEAT_MZSCHEME)
1070 else
1071 MZSCHEME_CFLAGS=
1072 MZSCHEME_LIBS=
1073 MZSCHEME_EXTRA=
1074 MZSCHEME_MZC=
1075 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001076 fi
1077 AC_SUBST(MZSCHEME_SRC)
1078 AC_SUBST(MZSCHEME_OBJ)
1079 AC_SUBST(MZSCHEME_PRO)
1080 AC_SUBST(MZSCHEME_LIBS)
1081 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001082 AC_SUBST(MZSCHEME_EXTRA)
1083 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001084fi
1085
1086
Bram Moolenaar071d4272004-06-13 20:20:40 +00001087AC_MSG_CHECKING(--enable-perlinterp argument)
1088AC_ARG_ENABLE(perlinterp,
Bram Moolenaare06c1882010-07-21 22:05:20 +02001089 [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001090 [enable_perlinterp="no"])
1091AC_MSG_RESULT($enable_perlinterp)
Bram Moolenaare06c1882010-07-21 22:05:20 +02001092if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00001093 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01001094 AC_MSG_ERROR([cannot use Perl with tiny features])
Bram Moolenaar3c124e32016-01-31 14:36:58 +01001095 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001096 AC_SUBST(vi_cv_path_perl)
1097 AC_PATH_PROG(vi_cv_path_perl, perl)
1098 if test "X$vi_cv_path_perl" != "X"; then
1099 AC_MSG_CHECKING(Perl version)
1100 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
1101 eval `$vi_cv_path_perl -V:usethreads`
Bram Moolenaare06c1882010-07-21 22:05:20 +02001102 eval `$vi_cv_path_perl -V:libperl`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001103 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
1104 badthreads=no
1105 else
1106 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
1107 eval `$vi_cv_path_perl -V:use5005threads`
1108 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
1109 badthreads=no
1110 else
1111 badthreads=yes
1112 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
1113 fi
1114 else
1115 badthreads=yes
1116 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
1117 fi
1118 fi
1119 if test $badthreads = no; then
1120 AC_MSG_RESULT(OK)
1121 eval `$vi_cv_path_perl -V:shrpenv`
1122 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
1123 shrpenv=""
1124 fi
1125 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
1126 AC_SUBST(vi_cv_perllib)
Bram Moolenaard5f62b12014-08-17 17:05:44 +02001127 vi_cv_perl_extutils=unknown_perl_extutils_path
1128 for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do
1129 xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp"
1130 if test -f "$xsubpp_path"; then
1131 vi_cv_perl_xsubpp="$xsubpp_path"
1132 fi
1133 done
1134 AC_SUBST(vi_cv_perl_xsubpp)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001135 dnl Remove "-fno-something", it breaks using cproto.
Bram Moolenaar280a8682015-06-21 13:41:08 +02001136 dnl Remove "-fdebug-prefix-map", it isn't supported by clang.
Bram Moolenaare8ff56b2017-09-14 23:06:23 +02001137 dnl Remove "FORTIFY_SOURCE", it will be defined twice.
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001138 dnl remove -pipe and -Wxxx, it confuses cproto
Bram Moolenaar071d4272004-06-13 20:20:40 +00001139 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
Bram Moolenaare8ff56b2017-09-14 23:06:23 +02001140 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \
1141 -e 's/-fdebug-prefix-map[[^ ]]*//g' \
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001142 -e 's/-pipe //' \
1143 -e 's/-W[[^ ]]*//g' \
1144 -e 's/-D_FORTIFY_SOURCE=.//g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001145 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
1146 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
1147 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
1148 -e 's/-bE:perl.exp//' -e 's/-lc //'`
1149 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
1150 dnl a test in configure may fail because of that.
1151 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
1152 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
1153
1154 dnl check that compiling a simple program still works with the flags
1155 dnl added for Perl.
1156 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
1157 cflags_save=$CFLAGS
1158 libs_save=$LIBS
1159 ldflags_save=$LDFLAGS
1160 CFLAGS="$CFLAGS $perlcppflags"
1161 LIBS="$LIBS $perllibs"
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001162 perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001163 LDFLAGS="$perlldflags $LDFLAGS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001164 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001165 AC_MSG_RESULT(yes); perl_ok=yes,
1166 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
1167 CFLAGS=$cflags_save
1168 LIBS=$libs_save
1169 LDFLAGS=$ldflags_save
1170 if test $perl_ok = yes; then
1171 if test "X$perlcppflags" != "X"; then
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001172 PERL_CFLAGS=$perlcppflags
Bram Moolenaar071d4272004-06-13 20:20:40 +00001173 fi
1174 if test "X$perlldflags" != "X"; then
Bram Moolenaar2bcaec32014-03-27 18:51:11 +01001175 if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001176 LDFLAGS="$perlldflags $LDFLAGS"
1177 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001178 fi
1179 PERL_LIBS=$perllibs
1180 PERL_SRC="auto/if_perl.c if_perlsfio.c"
1181 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
1182 PERL_PRO="if_perl.pro if_perlsfio.pro"
1183 AC_DEFINE(FEAT_PERL)
1184 fi
1185 fi
1186 else
1187 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
1188 fi
1189 fi
1190
Bram Moolenaard0573012017-10-28 21:11:06 +02001191 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +00001192 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +00001193 dir=/System/Library/Perl
1194 darwindir=$dir/darwin
1195 if test -d $darwindir; then
1196 PERL=/usr/bin/perl
1197 else
1198 dnl Mac OS X 10.3
1199 dir=/System/Library/Perl/5.8.1
1200 darwindir=$dir/darwin-thread-multi-2level
1201 if test -d $darwindir; then
1202 PERL=/usr/bin/perl
1203 fi
1204 fi
1205 if test -n "$PERL"; then
1206 PERL_DIR="$dir"
1207 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
1208 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
1209 PERL_LIBS="-L$darwindir/CORE -lperl"
1210 fi
Bram Moolenaar5dff57d2010-07-24 16:19:44 +02001211 dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only
1212 dnl be included if requested by passing --with-mac-arch to
1213 dnl configure, so strip these flags first (if present)
1214 PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
1215 PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001216 fi
Bram Moolenaare06c1882010-07-21 22:05:20 +02001217 if test "$enable_perlinterp" = "dynamic"; then
1218 if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
1219 AC_DEFINE(DYNAMIC_PERL)
1220 PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
1221 fi
1222 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001223
1224 if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then
1225 AC_MSG_ERROR([could not configure perl])
1226 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001227fi
1228AC_SUBST(shrpenv)
1229AC_SUBST(PERL_SRC)
1230AC_SUBST(PERL_OBJ)
1231AC_SUBST(PERL_PRO)
1232AC_SUBST(PERL_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00001233AC_SUBST(PERL_CFLAGS_EXTRA)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001234AC_SUBST(PERL_LIBS)
1235
1236AC_MSG_CHECKING(--enable-pythoninterp argument)
1237AC_ARG_ENABLE(pythoninterp,
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001238 [ --enable-pythoninterp[=OPTS] Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001239 [enable_pythoninterp="no"])
1240AC_MSG_RESULT($enable_pythoninterp)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001241if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00001242 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01001243 AC_MSG_ERROR([cannot use Python with tiny features])
Bram Moolenaar0b105412014-11-30 13:34:23 +01001244 fi
1245
Bram Moolenaar071d4272004-06-13 20:20:40 +00001246 dnl -- find the python executable
Bram Moolenaare1a32312018-04-15 16:03:25 +02001247 AC_MSG_CHECKING(--with-python-command argument)
1248 AC_SUBST(vi_cv_path_python)
1249 AC_ARG_WITH(python-command, [ --with-python-command=NAME name of the Python 2 command (default: python2 or python)],
1250 vi_cv_path_python="$withval"; AC_MSG_RESULT($vi_cv_path_python),
1251 AC_MSG_RESULT(no))
1252
1253 if test "X$vi_cv_path_python" = "X"; then
1254 AC_PATH_PROGS(vi_cv_path_python, python2 python)
1255 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001256 if test "X$vi_cv_path_python" != "X"; then
1257
1258 dnl -- get its version number
1259 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
1260 [[vi_cv_var_python_version=`
1261 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
1262 ]])
1263
Bram Moolenaarc09a6d62013-06-10 21:27:29 +02001264 dnl -- it must be at least version 2.3
1265 AC_MSG_CHECKING(Python is 2.3 or better)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001266 if ${vi_cv_path_python} -c \
Bram Moolenaarc09a6d62013-06-10 21:27:29 +02001267 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001268 then
1269 AC_MSG_RESULT(yep)
1270
1271 dnl -- find where python thinks it was installed
1272 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
1273 [ vi_cv_path_python_pfx=`
1274 ${vi_cv_path_python} -c \
1275 "import sys; print sys.prefix"` ])
1276
1277 dnl -- and where it thinks it runs
1278 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
1279 [ vi_cv_path_python_epfx=`
1280 ${vi_cv_path_python} -c \
1281 "import sys; print sys.exec_prefix"` ])
1282
1283 dnl -- python's internal library path
1284
1285 AC_CACHE_VAL(vi_cv_path_pythonpath,
1286 [ vi_cv_path_pythonpath=`
1287 unset PYTHONPATH;
1288 ${vi_cv_path_python} -c \
1289 "import sys, string; print string.join(sys.path,':')"` ])
1290
1291 dnl -- where the Python implementation library archives are
1292
1293 AC_ARG_WITH(python-config-dir,
Bram Moolenaare1a32312018-04-15 16:03:25 +02001294 [ --with-python-config-dir=PATH Python's config directory (deprecated)],
Bram Moolenaard0882402018-04-10 18:13:05 +02001295 [ vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 ] )
Bram Moolenaar071d4272004-06-13 20:20:40 +00001296
1297 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
1298 [
1299 vi_cv_path_python_conf=
Bram Moolenaarac499e32013-06-02 19:14:17 +02001300 d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
1301 if test -d "$d" && test -f "$d/config.c"; then
1302 vi_cv_path_python_conf="$d"
1303 else
1304 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
1305 for subdir in lib64 lib share; do
1306 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
1307 if test -d "$d" && test -f "$d/config.c"; then
1308 vi_cv_path_python_conf="$d"
1309 fi
1310 done
Bram Moolenaar071d4272004-06-13 20:20:40 +00001311 done
Bram Moolenaarac499e32013-06-02 19:14:17 +02001312 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001313 ])
1314
1315 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
1316
1317 if test "X$PYTHON_CONFDIR" = "X"; then
1318 AC_MSG_RESULT([can't find it!])
1319 else
1320
1321 dnl -- we need to examine Python's config/Makefile too
1322 dnl see what the interpreter is built from
1323 AC_CACHE_VAL(vi_cv_path_python_plibs,
1324 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +00001325 pwd=`pwd`
1326 tmp_mkf="$pwd/config-PyMake$$"
1327 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001328__:
Bram Moolenaar218116c2010-05-20 21:46:00 +02001329 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001330 @echo "python_LIBS='$(LIBS)'"
1331 @echo "python_SYSLIBS='$(SYSLIBS)'"
1332 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
Bram Moolenaarf94a13c2012-09-21 13:26:49 +02001333 @echo "python_DLLLIBRARY='$(DLLLIBRARY)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001334 @echo "python_INSTSONAME='$(INSTSONAME)'"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001335 @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'"
1336 @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
1337 @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001338eof
1339 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +00001340 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1341 rm -f -- "${tmp_mkf}"
Bram Moolenaard0573012017-10-28 21:11:06 +02001342 if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
Bram Moolenaar071d4272004-06-13 20:20:40 +00001343 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
1344 vi_cv_path_python_plibs="-framework Python"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001345 if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
1346 vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python"
1347 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001348 else
Bram Moolenaar9ce42132018-04-11 22:19:36 +02001349 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001350 dnl -- Check if the path contained in python_LINKFORSHARED is
1351 dnl usable for vim build. If not, make and try other
1352 dnl candidates.
Bram Moolenaara161e262015-03-24 15:14:27 +01001353 if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
Bram Moolenaar6c927552015-03-24 12:21:33 +01001354 python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'`
1355 python_link_path=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]][[ \t]]*\(.*\)/\2/'`
1356 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1357 dnl -- The path looks relative. Guess the absolute one using
1358 dnl the prefix and try that.
1359 python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}"
1360 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1361 dnl -- A last resort.
1362 python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}"
1363 dnl -- No check is done. The last word is left to the
1364 dnl "sanity" test on link flags that follows shortly.
1365 fi
1366 python_LINKFORSHARED="${python_link_symbol} ${python_link_path}"
1367 fi
1368 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +02001369 vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001370 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1371 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
1372 fi
1373 ])
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001374 AC_CACHE_CHECK(Python's dll name,vi_cv_dll_name_python,
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001375 [
1376 if test "X$python_DLLLIBRARY" != "X"; then
1377 vi_cv_dll_name_python="$python_DLLLIBRARY"
1378 else
1379 vi_cv_dll_name_python="$python_INSTSONAME"
1380 fi
1381 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001382
1383 PYTHON_LIBS="${vi_cv_path_python_plibs}"
1384 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
Bram Moolenaar04249582018-04-10 13:29:34 +02001385 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001386 else
Bram Moolenaar04249582018-04-10 13:29:34 +02001387 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 Moolenaar071d4272004-06-13 20:20:40 +00001388 fi
Bram Moolenaar3a21d9c2018-04-10 20:26:20 +02001389 if test "X$have_python_config_dir" = "X1" -a "$enable_pythoninterp" = "dynamic"; then
Bram Moolenaard0882402018-04-10 18:13:05 +02001390 dnl Define PYTHON_HOME if --with-python-config-dir was used
1391 PYTHON_CFLAGS="${PYTHON_CFLAGS} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
1392
1393 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001394 PYTHON_SRC="if_python.c"
Bram Moolenaar9bdb9a02012-07-25 16:32:08 +02001395 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001396
1397 dnl On FreeBSD linking with "-pthread" is required to use threads.
1398 dnl _THREAD_SAFE must be used for compiling then.
1399 dnl The "-pthread" is added to $LIBS, so that the following check for
1400 dnl sigaltstack() will look in libc_r (it's there in libc!).
1401 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1402 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1403 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1404 AC_MSG_CHECKING([if -pthread should be used])
1405 threadsafe_flag=
1406 thread_lib=
Bram Moolenaard0573012017-10-28 21:11:06 +02001407 dnl if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001408 if test "$vim_cv_uname_output" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001409 test "$GCC" = yes && threadsafe_flag="-pthread"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001410 if test "$vim_cv_uname_output" = FreeBSD; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001411 threadsafe_flag="-D_THREAD_SAFE"
1412 thread_lib="-pthread"
1413 fi
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001414 if test "$vim_cv_uname_output" = SunOS; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001415 threadsafe_flag="-pthreads"
1416 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001417 fi
1418 libs_save_old=$LIBS
1419 if test -n "$threadsafe_flag"; then
1420 cflags_save=$CFLAGS
1421 CFLAGS="$CFLAGS $threadsafe_flag"
1422 LIBS="$LIBS $thread_lib"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001423 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar69f787a2010-07-11 20:52:58 +02001424 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +00001425 AC_MSG_RESULT(no); LIBS=$libs_save_old
1426 )
1427 CFLAGS=$cflags_save
1428 else
1429 AC_MSG_RESULT(no)
1430 fi
1431
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001432 dnl Check that compiling a simple program still works with the flags
Bram Moolenaar071d4272004-06-13 20:20:40 +00001433 dnl added for Python.
1434 AC_MSG_CHECKING([if compile and link flags for Python are sane])
1435 cflags_save=$CFLAGS
1436 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +02001437 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001438 LIBS="$LIBS $PYTHON_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001439 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001440 AC_MSG_RESULT(yes); python_ok=yes,
1441 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
1442 CFLAGS=$cflags_save
1443 LIBS=$libs_save
1444 if test $python_ok = yes; then
1445 AC_DEFINE(FEAT_PYTHON)
1446 else
1447 LIBS=$libs_save_old
1448 PYTHON_SRC=
1449 PYTHON_OBJ=
1450 PYTHON_LIBS=
1451 PYTHON_CFLAGS=
1452 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001453 fi
1454 else
1455 AC_MSG_RESULT(too old)
1456 fi
1457 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001458
1459 if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then
1460 AC_MSG_ERROR([could not configure python])
1461 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001462fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001463
Bram Moolenaar071d4272004-06-13 20:20:40 +00001464AC_SUBST(PYTHON_LIBS)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001465AC_SUBST(PYTHON_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00001466AC_SUBST(PYTHON_CFLAGS_EXTRA)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001467AC_SUBST(PYTHON_SRC)
1468AC_SUBST(PYTHON_OBJ)
1469
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001470
1471AC_MSG_CHECKING(--enable-python3interp argument)
1472AC_ARG_ENABLE(python3interp,
Bram Moolenaar8008b632017-07-18 21:33:20 +02001473 [ --enable-python3interp[=OPTS] Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001474 [enable_python3interp="no"])
1475AC_MSG_RESULT($enable_python3interp)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001476if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00001477 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01001478 AC_MSG_ERROR([cannot use Python with tiny features])
Bram Moolenaar0b105412014-11-30 13:34:23 +01001479 fi
1480
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001481 dnl -- find the python3 executable
Bram Moolenaare1a32312018-04-15 16:03:25 +02001482 AC_MSG_CHECKING(--with-python3-command argument)
1483 AC_SUBST(vi_cv_path_python3)
1484 AC_ARG_WITH(python3-command, [ --with-python3-command=NAME name of the Python 3 command (default: python3 or python)],
1485 vi_cv_path_python3="$withval"; AC_MSG_RESULT($vi_cv_path_python3),
1486 AC_MSG_RESULT(no))
1487
1488 if test "X$vi_cv_path_python3" = "X"; then
1489 AC_PATH_PROGS(vi_cv_path_python3, python3 python)
1490 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001491 if test "X$vi_cv_path_python3" != "X"; then
1492
1493 dnl -- get its version number
1494 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
1495 [[vi_cv_var_python3_version=`
Bram Moolenaar23c01922021-05-21 11:43:58 +02001496 ${vi_cv_path_python3} -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001497 ]])
1498
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001499 dnl -- it must be at least version 3
1500 AC_MSG_CHECKING(Python is 3.0 or better)
1501 if ${vi_cv_path_python3} -c \
1502 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)"
1503 then
1504 AC_MSG_RESULT(yep)
Bram Moolenaar456f2bb2011-06-12 21:37:13 +02001505
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +02001506 dnl -- get the stable ABI version if passed in
1507 AC_MSG_CHECKING(--with-python3-stable-abi argument)
1508 AC_SUBST(vi_cv_var_python3_stable_abi)
1509 AC_ARG_WITH(python3-stable-abi, [ --with-python3-stable-abi=VERSION stable ABI version to target (e.g. 3.8)],
1510 vi_cv_var_python3_stable_abi="$withval"; AC_MSG_RESULT($vi_cv_var_python3_stable_abi),
1511 AC_MSG_RESULT(no))
1512 if test "X$vi_cv_var_python3_stable_abi" != "X"; then
1513 AC_CACHE_VAL(vi_cv_var_python3_stable_abi_hex,
1514 [
1515 vi_cv_var_python3_stable_abi_hex=`
1516 ${vi_cv_path_python3} -c \
1517 "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) ))"` ])
1518 if test "X$vi_cv_var_python3_stable_abi_hex" == "X"; then
1519 AC_MSG_ERROR([can't parse Python 3 stable ABI version. It should be "<major>.<minor>"])
1520 fi
1521 fi
1522
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001523 dnl -- get abiflags for python 3.2 or higher (PEP 3149)
1524 AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001525 [
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001526 vi_cv_var_python3_abiflags=
1527 if ${vi_cv_path_python3} -c \
1528 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)"
1529 then
Bram Moolenaare5303952022-06-19 17:05:47 +01001530 vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001531 "import sys; print(sys.abiflags)"`
1532 fi ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001533
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001534 dnl -- find where python3 thinks it was installed
1535 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
1536 [ vi_cv_path_python3_pfx=`
1537 ${vi_cv_path_python3} -c \
1538 "import sys; print(sys.prefix)"` ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001539
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001540 dnl -- and where it thinks it runs
1541 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
1542 [ vi_cv_path_python3_epfx=`
1543 ${vi_cv_path_python3} -c \
1544 "import sys; print(sys.exec_prefix)"` ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001545
Illia Bobyr74e1dad2023-08-27 18:26:54 +02001546 dnl -- python3's include path
1547 AC_CACHE_CHECK(Python's include path,vi_cv_path_python3_include,
1548 [ vi_cv_path_python3_include=`
1549 ${vi_cv_path_python3} -c \
1550 "import sysconfig; print(sysconfig.get_path(\"include\"))"` ])
1551
1552 dnl -- python3's platform include path
1553 AC_CACHE_CHECK(Python's include path,vi_cv_path_python3_platinclude,
1554 [ vi_cv_path_python3_platinclude=`
1555 ${vi_cv_path_python3} -c \
1556 "import sysconfig; print(sysconfig.get_path(\"platinclude\"))"` ])
1557
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001558 dnl -- python3's internal library path
Bram Moolenaare5303952022-06-19 17:05:47 +01001559
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001560 AC_CACHE_VAL(vi_cv_path_python3path,
1561 [ vi_cv_path_python3path=`
1562 unset PYTHONPATH;
1563 ${vi_cv_path_python3} -c \
1564 "import sys, string; print(':'.join(sys.path))"` ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001565
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001566 dnl -- where the Python implementation library archives are
Bram Moolenaare5303952022-06-19 17:05:47 +01001567
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001568 AC_ARG_WITH(python3-config-dir,
Bram Moolenaare1a32312018-04-15 16:03:25 +02001569 [ --with-python3-config-dir=PATH Python's config directory (deprecated)],
Bram Moolenaard0882402018-04-10 18:13:05 +02001570 [ vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 ] )
Bram Moolenaare5303952022-06-19 17:05:47 +01001571
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001572 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
1573 [
1574 vi_cv_path_python3_conf=
Bram Moolenaarfee496d2013-07-12 20:07:24 +02001575 config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
Zdenek Dohnal31e299c2021-06-10 18:50:55 +02001576 d=`${vi_cv_path_python3} -c "import sysconfig; print(sysconfig.get_config_var('LIBPL'))" 2> /dev/null`
1577 if test "x$d" = "x"; then
1578 d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
1579 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001580 if test -d "$d" && test -f "$d/config.c"; then
1581 vi_cv_path_python3_conf="$d"
1582 else
1583 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
1584 for subdir in lib64 lib share; do
1585 d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
1586 if test -d "$d" && test -f "$d/config.c"; then
1587 vi_cv_path_python3_conf="$d"
1588 fi
1589 done
1590 done
1591 fi
1592 ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001593
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001594 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
Bram Moolenaare5303952022-06-19 17:05:47 +01001595
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001596 if test "X$PYTHON3_CONFDIR" = "X"; then
1597 AC_MSG_RESULT([can't find it!])
1598 else
Bram Moolenaare5303952022-06-19 17:05:47 +01001599
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001600 dnl -- we need to examine Python's config/Makefile too
1601 dnl see what the interpreter is built from
1602 AC_CACHE_VAL(vi_cv_path_python3_plibs,
1603 [
1604 pwd=`pwd`
1605 tmp_mkf="$pwd/config-PyMake$$"
1606 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001607__:
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001608 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001609 @echo "python3_LIBS='$(LIBS)'"
1610 @echo "python3_SYSLIBS='$(SYSLIBS)'"
Bram Moolenaarf94a13c2012-09-21 13:26:49 +02001611 @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001612 @echo "python3_INSTSONAME='$(INSTSONAME)'"
Yee Cheng Chinb6ebe5a2023-04-05 18:24:50 +01001613 @echo "python3_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001614eof
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001615 dnl -- delete the lines from make about Entering/Leaving directory
1616 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1617 rm -f -- "${tmp_mkf}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001618 vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001619 vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}"
1620 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1621 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1622 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1623 ])
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001624 AC_CACHE_CHECK(Python3's dll name,vi_cv_dll_name_python3,
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001625 [
1626 if test "X$python3_DLLLIBRARY" != "X"; then
1627 vi_cv_dll_name_python3="$python3_DLLLIBRARY"
Yee Cheng Chinb6ebe5a2023-04-05 18:24:50 +01001628 elif test "X$python3_PYTHONFRAMEWORKPREFIX" != "X"; then
1629 vi_cv_dll_name_python3="${python3_PYTHONFRAMEWORKPREFIX}/${python3_INSTSONAME}"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001630 else
1631 vi_cv_dll_name_python3="$python3_INSTSONAME"
1632 fi
1633 ])
1634
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001635 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
Illia Bobyr74e1dad2023-08-27 18:26:54 +02001636 if test "${vi_cv_path_python3_include}" = "${vi_cv_path_python3_platinclude}"; then
1637 PYTHON3_CFLAGS="-I${vi_cv_path_python3_include}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001638 else
Illia Bobyr74e1dad2023-08-27 18:26:54 +02001639 PYTHON3_CFLAGS="-I${vi_cv_path_python3_include} -I${vi_cv_path_python3_platinclude}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001640 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +02001641 if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then
1642 dnl Define PYTHON3_HOME if --with-python-config-dir was used
1643 PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'"
1644 fi
1645 if test "X$vi_cv_var_python3_stable_abi_hex" != "X"; then
1646 PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPy_LIMITED_API=${vi_cv_var_python3_stable_abi_hex}"
1647 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001648 PYTHON3_SRC="if_python3.c"
1649 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaare5303952022-06-19 17:05:47 +01001650
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001651 dnl On FreeBSD linking with "-pthread" is required to use threads.
1652 dnl _THREAD_SAFE must be used for compiling then.
1653 dnl The "-pthread" is added to $LIBS, so that the following check for
1654 dnl sigaltstack() will look in libc_r (it's there in libc!).
1655 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1656 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1657 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1658 AC_MSG_CHECKING([if -pthread should be used])
1659 threadsafe_flag=
1660 thread_lib=
Bram Moolenaard0573012017-10-28 21:11:06 +02001661 dnl if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001662 if test "$vim_cv_uname_output" != Darwin; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001663 test "$GCC" = yes && threadsafe_flag="-pthread"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001664 if test "$vim_cv_uname_output" = FreeBSD; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001665 threadsafe_flag="-D_THREAD_SAFE"
1666 thread_lib="-pthread"
1667 fi
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001668 if test "$vim_cv_uname_output" = SunOS; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001669 threadsafe_flag="-pthreads"
1670 fi
1671 fi
1672 libs_save_old=$LIBS
1673 if test -n "$threadsafe_flag"; then
1674 cflags_save=$CFLAGS
1675 CFLAGS="$CFLAGS $threadsafe_flag"
1676 LIBS="$LIBS $thread_lib"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001677 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001678 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1679 AC_MSG_RESULT(no); LIBS=$libs_save_old
1680 )
1681 CFLAGS=$cflags_save
1682 else
1683 AC_MSG_RESULT(no)
1684 fi
Bram Moolenaare5303952022-06-19 17:05:47 +01001685
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001686 dnl check that compiling a simple program still works with the flags
1687 dnl added for Python.
1688 AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
1689 cflags_save=$CFLAGS
1690 libs_save=$LIBS
1691 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1692 LIBS="$LIBS $PYTHON3_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001693 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001694 AC_MSG_RESULT(yes); python3_ok=yes,
1695 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1696 CFLAGS=$cflags_save
1697 LIBS=$libs_save
1698 if test "$python3_ok" = yes; then
1699 AC_DEFINE(FEAT_PYTHON3)
1700 else
1701 LIBS=$libs_save_old
1702 PYTHON3_SRC=
1703 PYTHON3_OBJ=
1704 PYTHON3_LIBS=
1705 PYTHON3_CFLAGS=
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001706 fi
1707 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001708 else
1709 AC_MSG_RESULT(too old)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001710 fi
1711 fi
Bram Moolenaar1612b1a2013-06-14 21:22:39 +02001712 if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then
1713 AC_MSG_ERROR([could not configure python3])
1714 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001715fi
1716
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001717AC_SUBST(PYTHON3_LIBS)
1718AC_SUBST(PYTHON3_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00001719AC_SUBST(PYTHON3_CFLAGS_EXTRA)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001720AC_SUBST(PYTHON3_SRC)
1721AC_SUBST(PYTHON3_OBJ)
1722
1723dnl if python2.x and python3.x are enabled one can only link in code
Bram Moolenaare5303952022-06-19 17:05:47 +01001724dnl with dlopen(), dlsym(), dlclose()
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001725if test "$python_ok" = yes && test "$python3_ok" = yes; then
1726 AC_DEFINE(DYNAMIC_PYTHON)
1727 AC_DEFINE(DYNAMIC_PYTHON3)
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +02001728 if test "X$vi_cv_var_python3_stable_abi_hex" != "X"; then
1729 AC_DEFINE(DYNAMIC_PYTHON3_STABLE_ABI)
1730 fi
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001731 AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001732 cflags_save=$CFLAGS
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001733 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001734 libs_save=$LIBS
Bram Moolenaar6fabcbe2011-09-02 12:27:25 +02001735 dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001736 LIBS="-ldl $LIBS"
Bram Moolenaar7db77842014-03-27 17:40:59 +01001737 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001738 #include <dlfcn.h>
1739 /* If this program fails, then RTLD_GLOBAL is needed.
1740 * RTLD_GLOBAL will be used and then it is not possible to
1741 * have both python versions enabled in the same vim instance.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02001742 * Only the first python version used will be switched on.
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001743 */
1744
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01001745 static int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001746 {
1747 int needed = 0;
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001748 void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001749 if (pylib != 0)
1750 {
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001751 void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001752 void (*init)(void) = dlsym(pylib, "Py_Initialize");
1753 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1754 void (*final)(void) = dlsym(pylib, "Py_Finalize");
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001755 (*pfx)(prefix);
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001756 (*init)();
1757 needed = (*simple)("import termios") == -1;
1758 (*final)();
1759 dlclose(pylib);
1760 }
1761 return !needed;
1762 }
1763
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01001764 int main()
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001765 {
1766 int not_needed = 0;
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001767 if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}"))
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001768 not_needed = 1;
1769 return !not_needed;
Bram Moolenaar7db77842014-03-27 17:40:59 +01001770 }])],
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001771 [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001772
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001773 CFLAGS=$cflags_save
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001774 LIBS=$libs_save
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001775
1776 AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
1777 cflags_save=$CFLAGS
1778 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001779 libs_save=$LIBS
Bram Moolenaar6fabcbe2011-09-02 12:27:25 +02001780 dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001781 LIBS="-ldl $LIBS"
Bram Moolenaar7db77842014-03-27 17:40:59 +01001782 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001783 #include <dlfcn.h>
1784 #include <wchar.h>
1785 /* If this program fails, then RTLD_GLOBAL is needed.
1786 * RTLD_GLOBAL will be used and then it is not possible to
1787 * have both python versions enabled in the same vim instance.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02001788 * Only the first python version used will be switched on.
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001789 */
1790
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01001791 static int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001792 {
1793 int needed = 0;
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001794 void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001795 if (pylib != 0)
1796 {
1797 void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
1798 void (*init)(void) = dlsym(pylib, "Py_Initialize");
1799 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1800 void (*final)(void) = dlsym(pylib, "Py_Finalize");
1801 (*pfx)(prefix);
1802 (*init)();
1803 needed = (*simple)("import termios") == -1;
1804 (*final)();
1805 dlclose(pylib);
1806 }
1807 return !needed;
1808 }
1809
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01001810 int main()
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001811 {
1812 int not_needed = 0;
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001813 if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}"))
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001814 not_needed = 1;
1815 return !not_needed;
Bram Moolenaar7db77842014-03-27 17:40:59 +01001816 }])],
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001817 [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1818
1819 CFLAGS=$cflags_save
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001820 LIBS=$libs_save
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001821
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001822 PYTHON_SRC="if_python.c"
1823 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001824 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001825 PYTHON_LIBS=
1826 PYTHON3_SRC="if_python3.c"
1827 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001828 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001829 PYTHON3_LIBS=
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001830elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
1831 AC_DEFINE(DYNAMIC_PYTHON)
1832 PYTHON_SRC="if_python.c"
1833 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001834 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001835 PYTHON_LIBS=
Bram Moolenaare741f272013-07-09 21:57:52 +02001836elif test "$python_ok" = yes; then
1837 dnl Check that adding -fPIE works. It may be needed when using a static
1838 dnl Python library.
1839 AC_MSG_CHECKING([if -fPIE can be added for Python])
1840 cflags_save=$CFLAGS
1841 libs_save=$LIBS
1842 CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
1843 LIBS="$LIBS $PYTHON_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001844 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaare741f272013-07-09 21:57:52 +02001845 AC_MSG_RESULT(yes); fpie_ok=yes,
1846 AC_MSG_RESULT(no); fpie_ok=no)
1847 CFLAGS=$cflags_save
1848 LIBS=$libs_save
1849 if test $fpie_ok = yes; then
1850 PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
1851 fi
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001852elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
1853 AC_DEFINE(DYNAMIC_PYTHON3)
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +02001854 if test "X$vi_cv_var_python3_stable_abi_hex" != "X"; then
1855 AC_DEFINE(DYNAMIC_PYTHON3_STABLE_ABI)
1856 fi
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001857 PYTHON3_SRC="if_python3.c"
1858 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001859 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001860 PYTHON3_LIBS=
Bram Moolenaare741f272013-07-09 21:57:52 +02001861elif test "$python3_ok" = yes; then
1862 dnl Check that adding -fPIE works. It may be needed when using a static
1863 dnl Python library.
1864 AC_MSG_CHECKING([if -fPIE can be added for Python3])
1865 cflags_save=$CFLAGS
1866 libs_save=$LIBS
1867 CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
1868 LIBS="$LIBS $PYTHON3_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001869 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaare741f272013-07-09 21:57:52 +02001870 AC_MSG_RESULT(yes); fpie_ok=yes,
1871 AC_MSG_RESULT(no); fpie_ok=no)
1872 CFLAGS=$cflags_save
1873 LIBS=$libs_save
1874 if test $fpie_ok = yes; then
1875 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
1876 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001877fi
1878
Bram Moolenaar071d4272004-06-13 20:20:40 +00001879AC_MSG_CHECKING(--enable-tclinterp argument)
1880AC_ARG_ENABLE(tclinterp,
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001881 [ --enable-tclinterp[=OPTS] Include Tcl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001882 [enable_tclinterp="no"])
1883AC_MSG_RESULT($enable_tclinterp)
1884
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001885if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001886
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001887 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001888 AC_MSG_CHECKING(--with-tclsh argument)
1889 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
1890 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001891 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001892 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1893 AC_SUBST(vi_cv_path_tcl)
1894
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001895 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1896 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1897 tclsh_name="tclsh8.4"
1898 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1899 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001900 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001901 tclsh_name="tclsh8.2"
1902 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1903 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001904 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1905 tclsh_name="tclsh8.0"
1906 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1907 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001908 dnl still didn't find it, try without version number
1909 if test "X$vi_cv_path_tcl" = "X"; then
1910 tclsh_name="tclsh"
1911 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1912 fi
1913 if test "X$vi_cv_path_tcl" != "X"; then
1914 AC_MSG_CHECKING(Tcl version)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001915 if echo 'exit [[expr [info tclversion] < 8.0]]' | "$vi_cv_path_tcl" - ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001916 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1917 AC_MSG_RESULT($tclver - OK);
1918 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 Moolenaar8a5115c2016-01-09 19:41:11 +01001919 tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001920
1921 AC_MSG_CHECKING(for location of Tcl include)
Bram Moolenaard0573012017-10-28 21:11:06 +02001922 if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001923 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 Moolenaar071d4272004-06-13 20:20:40 +00001924 else
Bram Moolenaarf4ee5282020-07-30 20:18:08 +02001925 dnl For all macOS, use the value from TCL in case use of, say, homebrew
Bram Moolenaar071d4272004-06-13 20:20:40 +00001926 dnl For Mac OS X 10.3, use the OS-provided framework location
Bram Moolenaarf4ee5282020-07-30 20:18:08 +02001927 dnl For Mac OS X 10.14, the OS-provided framework location doesn't contain the headers, so also check the Xcode SDK
1928 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 Moolenaar071d4272004-06-13 20:20:40 +00001929 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001930 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001931 for try in $tclinc; do
1932 if test -f "$try/tcl.h"; then
1933 AC_MSG_RESULT($try/tcl.h)
1934 TCL_INC=$try
1935 break
1936 fi
1937 done
1938 if test -z "$TCL_INC"; then
1939 AC_MSG_RESULT(<not found>)
1940 SKIP_TCL=YES
1941 fi
1942 if test -z "$SKIP_TCL"; then
1943 AC_MSG_CHECKING(for location of tclConfig.sh script)
Bram Moolenaard0573012017-10-28 21:11:06 +02001944 if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001945 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001946 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001947 else
Bram Moolenaarf4ee5282020-07-30 20:18:08 +02001948 dnl For all macOS, use the value from TCL in case use of, say, homebrew
Bram Moolenaar071d4272004-06-13 20:20:40 +00001949 dnl For Mac OS X 10.3, use the OS-provided framework location
Bram Moolenaarf4ee5282020-07-30 20:18:08 +02001950 dnl For Mac OS X 10.14, the OS-provided framework location doesn't contain the headers, so also check the Xcode SDK
1951 tclcnf=`echo $tclinc | sed s/include/lib/g`
1952 tclcnf="$tclcnf /System/Library/Frameworks/Tcl.framework `xcrun --show-sdk-path`/System/Library/Frameworks/Tcl.framework"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001953 fi
1954 for try in $tclcnf; do
Bram Moolenaar49222be2015-12-11 18:11:30 +01001955 if test -f "$try/tclConfig.sh"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001956 AC_MSG_RESULT($try/tclConfig.sh)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001957 . "$try/tclConfig.sh"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001958 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001959 if test "$enable_tclinterp" = "dynamic"; then
1960 TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"`
1961 else
1962 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1963 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001964 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001965 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +00001966 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 Moolenaar071d4272004-06-13 20:20:40 +00001967 break
1968 fi
1969 done
1970 if test -z "$TCL_LIBS"; then
1971 AC_MSG_RESULT(<not found>)
1972 AC_MSG_CHECKING(for Tcl library by myself)
1973 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001974 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001975 for ext in .so .a ; do
1976 for ver in "" $tclver ; do
1977 for try in $tcllib ; do
1978 trylib=tcl$ver$ext
Bram Moolenaar49222be2015-12-11 18:11:30 +01001979 if test -f "$try/lib$trylib" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001980 AC_MSG_RESULT($try/lib$trylib)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001981 TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001982 if test "$vim_cv_uname_output" = SunOS &&
1983 echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001984 TCL_LIBS="$TCL_LIBS -R $try"
1985 fi
1986 break 3
1987 fi
1988 done
1989 done
1990 done
1991 if test -z "$TCL_LIBS"; then
1992 AC_MSG_RESULT(<not found>)
1993 SKIP_TCL=YES
1994 fi
1995 fi
1996 if test -z "$SKIP_TCL"; then
1997 AC_DEFINE(FEAT_TCL)
1998 TCL_SRC=if_tcl.c
1999 TCL_OBJ=objects/if_tcl.o
2000 TCL_PRO=if_tcl.pro
2001 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
2002 fi
2003 fi
2004 else
2005 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
2006 fi
2007 fi
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01002008 if test "$enable_tclinterp" = "dynamic"; then
2009 if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then
2010 AC_DEFINE(DYNAMIC_TCL)
2011 TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS"
2012 fi
2013 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01002014 if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then
2015 AC_MSG_ERROR([could not configure Tcl])
2016 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002017fi
2018AC_SUBST(TCL_SRC)
2019AC_SUBST(TCL_OBJ)
2020AC_SUBST(TCL_PRO)
2021AC_SUBST(TCL_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00002022AC_SUBST(TCL_CFLAGS_EXTRA)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002023AC_SUBST(TCL_LIBS)
2024
2025AC_MSG_CHECKING(--enable-rubyinterp argument)
2026AC_ARG_ENABLE(rubyinterp,
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002027 [ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00002028 [enable_rubyinterp="no"])
2029AC_MSG_RESULT($enable_rubyinterp)
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002030if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00002031 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01002032 AC_MSG_ERROR([cannot use Ruby with tiny features])
Bram Moolenaar0b105412014-11-30 13:34:23 +01002033 fi
2034
Bram Moolenaar165641d2010-02-17 16:23:09 +01002035 AC_MSG_CHECKING(--with-ruby-command argument)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002036 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar948733a2011-05-05 18:10:16 +02002037 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
2038 RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD),
2039 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar165641d2010-02-17 16:23:09 +01002040 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002041 if test "X$vi_cv_path_ruby" != "X"; then
2042 AC_MSG_CHECKING(Ruby version)
K.Takata236ccbf2022-09-22 16:12:06 +01002043 if $vi_cv_path_ruby -e 'RUBY_VERSION >= "1.9.1" or exit 1' >/dev/null 2>/dev/null; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002044 AC_MSG_RESULT(OK)
Bram Moolenaar81398892012-10-03 21:09:35 +02002045 AC_MSG_CHECKING(Ruby rbconfig)
2046 ruby_rbconfig="RbConfig"
2047 if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then
2048 ruby_rbconfig="Config"
2049 fi
2050 AC_MSG_RESULT($ruby_rbconfig)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002051 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar81398892012-10-03 21:09:35 +02002052 rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e "print $ruby_rbconfig::CONFIG[['rubyhdrdir']] || $ruby_rbconfig::CONFIG[['archdir']] || \\$hdrdir" 2>/dev/null`
Bram Moolenaar071d4272004-06-13 20:20:40 +00002053 if test "X$rubyhdrdir" != "X"; then
2054 AC_MSG_RESULT($rubyhdrdir)
2055 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaara6fd37b2014-03-27 17:19:09 +01002056 rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"`
2057 if test -d "$rubyarchdir"; then
2058 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01002059 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02002060 rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
Bram Moolenaar026a4452013-08-07 15:22:23 +02002061 if test "X$rubyversion" = "X"; then
K.Takata236ccbf2022-09-22 16:12:06 +01002062 rubyversion=`$vi_cv_path_ruby -e "print RUBY_VERSION.gsub(/\./, '')[[0,2]]"`
Bram Moolenaar026a4452013-08-07 15:22:23 +02002063 fi
Bram Moolenaar165641d2010-02-17 16:23:09 +01002064 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar81398892012-10-03 21:09:35 +02002065 rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
Bram Moolenaar071d4272004-06-13 20:20:40 +00002066 if test "X$rubylibs" != "X"; then
2067 RUBY_LIBS="$rubylibs"
2068 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02002069 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"`
2070 librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"`
Bram Moolenaarac499e32013-06-02 19:14:17 +02002071 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"`
Bram Moolenaard5a986f2020-12-06 21:11:31 +01002072 if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then
Bram Moolenaarac499e32013-06-02 19:14:17 +02002073 RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
2074 elif test "$librubyarg" = "libruby.a"; then
2075 dnl required on Mac OS 10.3 where libruby.a doesn't exist
2076 librubyarg="-lruby"
2077 RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002078 fi
2079
2080 if test "X$librubyarg" != "X"; then
2081 RUBY_LIBS="$librubyarg $RUBY_LIBS"
2082 fi
Zdenek Dohnal1d822af2022-11-23 12:06:08 +00002083
2084 dnl Here the Ruby LDFLAGS used to be added to LDFLAGS, but that turns
2085 dnl out to cause trouble and was removed.
2086
Bram Moolenaar071d4272004-06-13 20:20:40 +00002087 RUBY_SRC="if_ruby.c"
2088 RUBY_OBJ="objects/if_ruby.o"
2089 RUBY_PRO="if_ruby.pro"
2090 AC_DEFINE(FEAT_RUBY)
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002091 if test "$enable_rubyinterp" = "dynamic"; then
Bram Moolenaar92021622017-10-12 12:33:43 +02002092 libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_ALIASES']].split[[0]]"`
Bram Moolenaar87ea64c2018-08-04 15:13:34 +02002093 if test -z "$libruby_soname"; then
2094 libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
2095 fi
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002096 AC_DEFINE(DYNAMIC_RUBY)
Bram Moolenaar41a41412020-01-07 21:32:19 +01002097 RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" $RUBY_CFLAGS"
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002098 RUBY_LIBS=
2099 fi
Bram Moolenaar864a28b2020-12-28 21:36:56 +01002100 if test "X$CLANG_VERSION" != "X" -a "$rubyversion" -ge 30; then
2101 RUBY_CFLAGS="$RUBY_CFLAGS -fdeclspec"
2102 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002103 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01002104 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002105 fi
2106 else
K.Takata236ccbf2022-09-22 16:12:06 +01002107 AC_MSG_RESULT(too old; need Ruby version 1.9.1 or later)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002108 fi
2109 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01002110
2111 if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then
2112 AC_MSG_ERROR([could not configure Ruby])
2113 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002114fi
2115AC_SUBST(RUBY_SRC)
2116AC_SUBST(RUBY_OBJ)
2117AC_SUBST(RUBY_PRO)
2118AC_SUBST(RUBY_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00002119AC_SUBST(RUBY_CFLAGS_EXTRA)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002120AC_SUBST(RUBY_LIBS)
2121
2122AC_MSG_CHECKING(--enable-cscope argument)
2123AC_ARG_ENABLE(cscope,
2124 [ --enable-cscope Include cscope interface.], ,
2125 [enable_cscope="no"])
2126AC_MSG_RESULT($enable_cscope)
2127if test "$enable_cscope" = "yes"; then
2128 AC_DEFINE(FEAT_CSCOPE)
2129fi
2130
Bram Moolenaar071d4272004-06-13 20:20:40 +00002131AC_MSG_CHECKING(--disable-netbeans argument)
2132AC_ARG_ENABLE(netbeans,
2133 [ --disable-netbeans Disable NetBeans integration support.],
2134 , [enable_netbeans="yes"])
2135if test "$enable_netbeans" = "yes"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00002136 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01002137 AC_MSG_RESULT([cannot use NetBeans with tiny features])
Bram Moolenaar3c124e32016-01-31 14:36:58 +01002138 enable_netbeans="no"
2139 else
2140 AC_MSG_RESULT(no)
2141 fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002142else
2143 AC_MSG_RESULT(yes)
2144fi
2145
2146AC_MSG_CHECKING(--disable-channel argument)
2147AC_ARG_ENABLE(channel,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002148 [ --disable-channel Disable process communication support.],
Bram Moolenaare0874f82016-01-24 20:36:41 +01002149 , [enable_channel="yes"])
2150if test "$enable_channel" = "yes"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00002151 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01002152 AC_MSG_RESULT([cannot use channels with tiny features])
Bram Moolenaar3c124e32016-01-31 14:36:58 +01002153 enable_channel="no"
2154 else
2155 AC_MSG_RESULT(no)
2156 fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002157else
2158 if test "$enable_netbeans" = "yes"; then
Bram Moolenaar16435482016-01-24 21:31:54 +01002159 AC_MSG_RESULT([yes, netbeans also disabled])
Bram Moolenaare0874f82016-01-24 20:36:41 +01002160 enable_netbeans="no"
2161 else
2162 AC_MSG_RESULT(yes)
2163 fi
2164fi
2165
Bram Moolenaar16435482016-01-24 21:31:54 +01002166if test "$enable_channel" = "yes"; then
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002167 dnl On Solaris we need the socket library, or on Haiku the network library.
Bram Moolenaarb3f74062020-02-26 16:16:53 +01002168 if test "x$HAIKU" = "xyes"; then
2169 AC_CHECK_LIB(network, socket)
2170 else
2171 AC_CHECK_LIB(socket, socket)
2172 fi
2173
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002174 AC_CACHE_CHECK([whether compiling with IPv6 networking is possible], [vim_cv_ipv6_networking],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002175 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002176#include <stdio.h>
2177#include <stdlib.h>
2178#include <stdarg.h>
2179#include <fcntl.h>
2180#include <netdb.h>
2181#include <netinet/in.h>
2182#include <errno.h>
2183#include <sys/types.h>
2184#include <sys/socket.h>
2185 /* Check bitfields */
2186 struct nbbuf {
2187 unsigned int initDone:1;
2188 unsigned short signmaplen;
2189 };
2190 ], [
2191 /* Check creating a socket. */
2192 struct sockaddr_in server;
2193 struct addrinfo *res;
2194 (void)socket(AF_INET, SOCK_STREAM, 0);
2195 (void)htons(100);
2196 (void)getaddrinfo("microsoft.com", NULL, NULL, &res);
2197 if (errno == ECONNREFUSED)
2198 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
2199 (void)freeaddrinfo(res);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002200 ])],
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002201 [vim_cv_ipv6_networking="yes"],
2202 [vim_cv_ipv6_networking="no"])])
2203
2204 if test "x$vim_cv_ipv6_networking" = "xyes"; then
2205 AC_DEFINE(FEAT_IPV6)
Bram Moolenaarb6fb0512020-04-18 18:24:18 +02002206 AC_CHECK_FUNCS(inet_ntop)
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002207 else
2208 dnl On Solaris we need the nsl library.
2209 AC_CHECK_LIB(nsl, gethostbyname)
2210 AC_CACHE_CHECK([whether compiling with IPv4 networking is possible], [vim_cv_ipv4_networking],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002211 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00002212#include <stdio.h>
2213#include <stdlib.h>
2214#include <stdarg.h>
2215#include <fcntl.h>
2216#include <netdb.h>
2217#include <netinet/in.h>
2218#include <errno.h>
2219#include <sys/types.h>
2220#include <sys/socket.h>
2221 /* Check bitfields */
2222 struct nbbuf {
2223 unsigned int initDone:1;
Bram Moolenaar63de19e2016-12-09 20:11:26 +01002224 unsigned short signmaplen;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002225 };
2226 ], [
2227 /* Check creating a socket. */
2228 struct sockaddr_in server;
2229 (void)socket(AF_INET, SOCK_STREAM, 0);
2230 (void)htons(100);
2231 (void)gethostbyname("microsoft.com");
2232 if (errno == ECONNREFUSED)
2233 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002234 ])],
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002235 [vim_cv_ipv4_networking="yes"],
2236 [vim_cv_ipv4_networking="no"; enable_netbeans="no"; enable_channel="no"])])
2237 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002238fi
2239if test "$enable_netbeans" = "yes"; then
2240 AC_DEFINE(FEAT_NETBEANS_INTG)
2241 NETBEANS_SRC="netbeans.c"
2242 AC_SUBST(NETBEANS_SRC)
2243 NETBEANS_OBJ="objects/netbeans.o"
2244 AC_SUBST(NETBEANS_OBJ)
2245fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002246if test "$enable_channel" = "yes"; then
Bram Moolenaar509ce2a2016-03-11 22:52:15 +01002247 AC_DEFINE(FEAT_JOB_CHANNEL)
Bram Moolenaar8b5866d2020-09-05 15:48:51 +02002248 CHANNEL_SRC="job.c channel.c"
Bram Moolenaare0874f82016-01-24 20:36:41 +01002249 AC_SUBST(CHANNEL_SRC)
Bram Moolenaar8b5866d2020-09-05 15:48:51 +02002250 CHANNEL_OBJ="objects/job.o objects/channel.o"
Bram Moolenaare0874f82016-01-24 20:36:41 +01002251 AC_SUBST(CHANNEL_OBJ)
2252fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002253
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002254AC_MSG_CHECKING(--enable-terminal argument)
2255AC_ARG_ENABLE(terminal,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002256 [ --enable-terminal Enable terminal emulation support.],
Bram Moolenaaref839562017-10-28 20:28:23 +02002257 , [enable_terminal="auto"])
Bram Moolenaar595a4022017-09-03 19:15:57 +02002258if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then
Bram Moolenaar12471262022-01-18 11:11:25 +00002259 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01002260 AC_MSG_RESULT([cannot use terminal emulator with tiny features])
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002261 enable_terminal="no"
2262 else
Bram Moolenaar595a4022017-09-03 19:15:57 +02002263 if test "$enable_terminal" = "auto"; then
2264 enable_terminal="yes"
2265 AC_MSG_RESULT(defaulting to yes)
2266 else
2267 AC_MSG_RESULT(yes)
2268 fi
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002269 fi
2270else
Bram Moolenaar595a4022017-09-03 19:15:57 +02002271 if test "$enable_terminal" = "auto"; then
2272 enable_terminal="no"
2273 AC_MSG_RESULT(defaulting to no)
2274 else
2275 AC_MSG_RESULT(no)
2276 fi
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002277fi
Bram Moolenaar8b423282017-12-16 14:37:06 +01002278if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002279 AC_DEFINE(FEAT_TERMINAL)
Bram Moolenaar93268052019-10-10 13:22:54 +02002280 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 Moolenaare4f25e42017-07-07 11:54:15 +02002281 AC_SUBST(TERM_SRC)
Bram Moolenaar93268052019-10-10 13:22:54 +02002282 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 Moolenaare4f25e42017-07-07 11:54:15 +02002283 AC_SUBST(TERM_OBJ)
Bram Moolenaar823edd12019-10-23 22:35:36 +02002284 TERM_TEST="test_libvterm"
2285 AC_SUBST(TERM_TEST)
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002286fi
2287
Bram Moolenaare42a6d22017-11-12 19:21:51 +01002288AC_MSG_CHECKING(--enable-autoservername argument)
2289AC_ARG_ENABLE(autoservername,
2290 [ --enable-autoservername Automatically define servername at vim startup.], ,
2291 [enable_autoservername="no"])
2292AC_MSG_RESULT($enable_autoservername)
2293if test "$enable_autoservername" = "yes"; then
2294 AC_DEFINE(FEAT_AUTOSERVERNAME)
2295fi
2296
Bram Moolenaar071d4272004-06-13 20:20:40 +00002297AC_MSG_CHECKING(--enable-multibyte argument)
2298AC_ARG_ENABLE(multibyte,
2299 [ --enable-multibyte Include multibyte editing support.], ,
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01002300 [enable_multibyte="yes"])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002301AC_MSG_RESULT($enable_multibyte)
Bram Moolenaar30276f22019-01-24 17:59:39 +01002302if test "$enable_multibyte" != "yes"; then
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01002303 AC_MSG_ERROR([The multi-byte feature can no longer be disabled. If you have
2304 a problem with this, discuss on the Vim mailing list.])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002305fi
2306
Martin Tournoij25f3a142022-10-08 19:26:41 +01002307dnl Right-to-Left language support for Vim will be included with huge features,
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002308dnl unless ENABLE_RIGHTLEFT is undefined.
2309AC_MSG_CHECKING(--disable-rightleft argument)
2310AC_ARG_ENABLE(rightleft,
2311 [ --disable-rightleft Do not include Right-to-Left language support.],
2312 , [enable_rightleft="yes"])
2313if test "$enable_rightleft" = "yes"; then
2314 AC_MSG_RESULT(no)
2315else
2316 AC_MSG_RESULT(yes)
2317 AC_DEFINE(DISABLE_RIGHTLEFT)
2318fi
2319
Martin Tournoij25f3a142022-10-08 19:26:41 +01002320dnl Arabic language support for Vim will be included with huge features,
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002321dnl unless ENABLE_ARABIC is undefined.
2322AC_MSG_CHECKING(--disable-arabic argument)
2323AC_ARG_ENABLE(arabic,
2324 [ --disable-arabic Do not include Arabic language support.],
2325 , [enable_arabic="yes"])
2326if test "$enable_arabic" = "yes"; then
2327 AC_MSG_RESULT(no)
2328else
2329 AC_MSG_RESULT(yes)
2330 AC_DEFINE(DISABLE_ARABIC)
2331fi
2332
Bram Moolenaar14184a32019-02-16 15:10:30 +01002333dnl Farsi language support has been removed, ignore --disable-farsi
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002334AC_ARG_ENABLE(farsi,
Bram Moolenaar14184a32019-02-16 15:10:30 +01002335 [ --disable-farsi Deprecated.],,)
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002336
Bram Moolenaar071d4272004-06-13 20:20:40 +00002337AC_MSG_CHECKING(--enable-xim argument)
2338AC_ARG_ENABLE(xim,
2339 [ --enable-xim Include XIM input support.],
2340 AC_MSG_RESULT($enable_xim),
2341 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002342
2343AC_MSG_CHECKING(--enable-fontset argument)
2344AC_ARG_ENABLE(fontset,
2345 [ --enable-fontset Include X fontset output support.], ,
2346 [enable_fontset="no"])
2347AC_MSG_RESULT($enable_fontset)
2348dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
2349
2350test -z "$with_x" && with_x=yes
Bram Moolenaard0573012017-10-28 21:11:06 +02002351test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +00002352if test "$with_x" = no; then
2353 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
2354else
2355 dnl Do this check early, so that its failure can override user requests.
2356
2357 AC_PATH_PROG(xmkmfpath, xmkmf)
2358
2359 AC_PATH_XTRA
2360
Bram Moolenaar2c704a72010-06-03 21:17:25 +02002361 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00002362 dnl be compiled with a special option.
2363 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02002364 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002365 CFLAGS="$CFLAGS -W c,dll"
2366 LDFLAGS="$LDFLAGS -W l,dll"
2367 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
2368 fi
2369
2370 dnl On my HPUX system the X include dir is found, but the lib dir not.
Bram Moolenaar70778922020-02-05 20:44:24 +01002371 dnl This is a desperate try to fix this.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002372
2373 if test -d "$x_includes" && test ! -d "$x_libraries"; then
2374 x_libraries=`echo "$x_includes" | sed s/include/lib/`
2375 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
2376 X_LIBS="$X_LIBS -L$x_libraries"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00002377 if test "$vim_cv_uname_output" = SunOS &&
2378 echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002379 X_LIBS="$X_LIBS -R $x_libraries"
2380 fi
2381 fi
2382
2383 if test -d "$x_libraries" && test ! -d "$x_includes"; then
2384 x_includes=`echo "$x_libraries" | sed s/lib/include/`
2385 AC_MSG_RESULT(Corrected X includes to $x_includes)
2386 X_CFLAGS="$X_CFLAGS -I$x_includes"
2387 fi
2388
2389 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
2390 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
2391 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
2392 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
2393 dnl Same for "-R/usr/lib ".
2394 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
2395
2396
2397 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002398 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
2399 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002400 AC_MSG_CHECKING(if X11 header files can be found)
2401 cflags_save=$CFLAGS
2402 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002403 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <X11/Xlib.h>
2404#include <X11/Intrinsic.h>], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002405 AC_MSG_RESULT(yes),
2406 AC_MSG_RESULT(no); no_x=yes)
2407 CFLAGS=$cflags_save
2408
2409 if test "${no_x-no}" = yes; then
2410 with_x=no
2411 else
2412 AC_DEFINE(HAVE_X11)
2413 X_LIB="-lXt -lX11";
2414 AC_SUBST(X_LIB)
2415
2416 ac_save_LDFLAGS="$LDFLAGS"
2417 LDFLAGS="-L$x_libraries $LDFLAGS"
2418
2419 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
2420 dnl For HP-UX 10.20 it must be before -lSM -lICE
2421 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
2422 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
2423
2424 dnl Some systems need -lnsl -lsocket when testing for ICE.
2425 dnl The check above doesn't do this, try here (again). Also needed to get
2426 dnl them after Xdmcp. link.sh will remove them when not needed.
2427 dnl Check for other function than above to avoid the cached value
2428 AC_CHECK_LIB(ICE, IceOpenConnection,
2429 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
2430
2431 dnl Check for -lXpm (needed for some versions of Motif)
2432 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
2433 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
2434 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
2435
2436 dnl Check that the X11 header files don't use implicit declarations
2437 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
2438 cflags_save=$CFLAGS
Bram Moolenaard1864592013-05-04 04:40:15 +02002439 dnl -Werror is GCC only, others like Solaris Studio might not like it
2440 if test "$GCC" = yes; then
2441 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
2442 else
2443 CFLAGS="$CFLAGS $X_CFLAGS"
2444 fi
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002445 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <X11/Xlib.h>], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002446 AC_MSG_RESULT(no),
2447 CFLAGS="$CFLAGS -Wno-implicit-int"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002448 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <X11/Xlib.h>], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002449 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
2450 AC_MSG_RESULT(test failed)
2451 )
2452 )
2453 CFLAGS=$cflags_save
2454
2455 LDFLAGS="$ac_save_LDFLAGS"
2456
Mike Gilberta055b442023-08-20 19:01:41 +02002457 AC_CHECK_SIZEOF([wchar_t])
2458 if test "$ac_cv_sizeof_wchar_t" -le 2; then
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00002459 AC_DEFINE(SMALL_WCHAR_T)
2460 fi
2461
Bram Moolenaar071d4272004-06-13 20:20:40 +00002462 fi
2463fi
2464
Bram Moolenaard2a05492018-07-27 22:35:15 +02002465dnl Check if --with-x was given but it doesn't work.
2466if test "x$with_x" = xno -a "x$with_x_arg" = xyes; then
2467 AC_MSG_ERROR([could not configure X])
2468fi
2469
Bram Moolenaarb3f74062020-02-26 16:16:53 +01002470test "x$with_x" = xno -a "x$HAIKU" != "xyes" -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00002471
2472AC_MSG_CHECKING(--enable-gui argument)
2473AC_ARG_ENABLE(gui,
Bram Moolenaarf52fac22022-03-11 16:01:26 +00002474 [ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/haiku/photon/carbon]], , enable_gui="auto")
Bram Moolenaar071d4272004-06-13 20:20:40 +00002475
2476dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
2477dnl Do not use character classes for portability with old tools.
2478enable_gui_canon=`echo "_$enable_gui" | \
2479 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2480
2481dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002482SKIP_GTK2=YES
Bram Moolenaar1858a842016-02-23 22:30:31 +01002483SKIP_GTK3=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002484SKIP_GNOME=YES
2485SKIP_MOTIF=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002486SKIP_PHOTON=YES
Bram Moolenaarb3f74062020-02-26 16:16:53 +01002487SKIP_HAIKU=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002488GUITYPE=NONE
2489
Bram Moolenaarb3f74062020-02-26 16:16:53 +01002490if test "x$HAIKU" = "xyes"; then
2491 SKIP_HAIKU=
2492 case "$enable_gui_canon" in
2493 no) AC_MSG_RESULT(no GUI support)
2494 SKIP_HAIKU=YES ;;
2495 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
2496 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
2497 haiku) AC_MSG_RESULT(Haiku GUI support) ;;
2498 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2499 SKIP_HAIKU=YES ;;
2500 esac
2501elif test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002502 SKIP_PHOTON=
2503 case "$enable_gui_canon" in
2504 no) AC_MSG_RESULT(no GUI support)
2505 SKIP_PHOTON=YES ;;
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002506 yes|""|auto) AC_MSG_RESULT(automatic GUI support)
2507 gui_auto=yes ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002508 photon) AC_MSG_RESULT(Photon GUI support) ;;
2509 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2510 SKIP_PHOTON=YES ;;
2511 esac
2512
Bram Moolenaar040f9752020-08-11 23:08:48 +02002513elif test "x$MACOS_X" = "xyes" -a "x$with_x" = "xno" ; then
2514 case "$enable_gui_canon" in
2515 no) AC_MSG_RESULT(no GUI support) ;;
2516 yes|"") AC_MSG_RESULT(yes - automatic GUI support)
2517 gui_auto=yes ;;
2518 auto) AC_MSG_RESULT(auto - disable GUI support for Mac OS) ;;
Bram Moolenaarbe7529e2020-08-13 21:05:39 +02002519 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
Bram Moolenaar040f9752020-08-11 23:08:48 +02002520 esac
Bram Moolenaar071d4272004-06-13 20:20:40 +00002521else
2522
Bram Moolenaar071d4272004-06-13 20:20:40 +00002523 case "$enable_gui_canon" in
2524 no|none) AC_MSG_RESULT(no GUI support) ;;
2525 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002526 gui_auto=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +00002527 SKIP_GTK2=
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002528 SKIP_GTK3=
Bram Moolenaar071d4272004-06-13 20:20:40 +00002529 SKIP_GNOME=
Bram Moolenaarf52fac22022-03-11 16:01:26 +00002530 SKIP_MOTIF=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002531 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002532 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002533 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
2534 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00002535 SKIP_GTK2=;;
Bram Moolenaar98921892016-02-23 17:14:37 +01002536 gtk3) AC_MSG_RESULT(GTK+ 3.x GUI support)
2537 SKIP_GTK3=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002538 motif) AC_MSG_RESULT(Motif GUI support)
2539 SKIP_MOTIF=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002540 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
2541 esac
2542
2543fi
2544
Bram Moolenaar071d4272004-06-13 20:20:40 +00002545if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
2546 -a "$enable_gui_canon" != "gnome2"; then
2547 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
2548 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002549 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002550 , enable_gtk2_check="yes")
2551 AC_MSG_RESULT($enable_gtk2_check)
2552 if test "x$enable_gtk2_check" = "xno"; then
2553 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002554 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002555 fi
2556fi
2557
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002558if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002559 AC_MSG_CHECKING(whether or not to look for GNOME)
2560 AC_ARG_ENABLE(gnome-check,
2561 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
2562 , enable_gnome_check="no")
2563 AC_MSG_RESULT($enable_gnome_check)
2564 if test "x$enable_gnome_check" = "xno"; then
2565 SKIP_GNOME=YES
2566 fi
2567fi
2568
Bram Moolenaar98921892016-02-23 17:14:37 +01002569if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then
2570 AC_MSG_CHECKING(whether or not to look for GTK+ 3)
2571 AC_ARG_ENABLE(gtk3-check,
2572 [ --enable-gtk3-check If auto-select GUI, check for GTK+ 3 [default=yes]],
2573 , enable_gtk3_check="yes")
2574 AC_MSG_RESULT($enable_gtk3_check)
2575 if test "x$enable_gtk3_check" = "xno"; then
2576 SKIP_GTK3=YES
2577 fi
2578fi
2579
Bram Moolenaar071d4272004-06-13 20:20:40 +00002580if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
2581 AC_MSG_CHECKING(whether or not to look for Motif)
2582 AC_ARG_ENABLE(motif-check,
2583 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
2584 , enable_motif_check="yes")
2585 AC_MSG_RESULT($enable_motif_check)
2586 if test "x$enable_motif_check" = "xno"; then
2587 SKIP_MOTIF=YES
2588 fi
2589fi
2590
Bram Moolenaar071d4272004-06-13 20:20:40 +00002591dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002592dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002593dnl
2594dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00002595dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00002596dnl
2597AC_DEFUN(AM_PATH_GTK,
2598[
2599 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
2600 {
Bram Moolenaar071d4272004-06-13 20:20:40 +00002601 no_gtk=""
2602 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2603 && $PKG_CONFIG --exists gtk+-2.0; then
2604 {
Bram Moolenaar98921892016-02-23 17:14:37 +01002605 min_gtk_version=ifelse([$1], ,2.2.0,$1)
2606 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002607 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
2608 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
2609 dnl something like that.
2610 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00002611 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00002612 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
2613 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2614 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2615 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2616 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2617 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2618 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2619 }
Bram Moolenaar98921892016-02-23 17:14:37 +01002620 elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2621 && $PKG_CONFIG --exists gtk+-3.0; then
2622 {
2623 min_gtk_version=ifelse([$1], ,3.0.0,$1)
2624 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2625
2626 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0`
2627 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0`
2628 GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0`
2629 gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2630 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2631 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2632 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2633 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2634 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2635 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00002636 else
Bram Moolenaar67876de2021-01-12 20:51:24 +01002637 dnl Put some text before the "no" to hint at installing the gtk-dev
2638 dnl packages.
2639 AC_MSG_CHECKING(for GTK -dev package)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002640 no_gtk=yes
2641 fi
2642
2643 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
2644 {
2645 ac_save_CFLAGS="$CFLAGS"
2646 ac_save_LIBS="$LIBS"
2647 CFLAGS="$CFLAGS $GTK_CFLAGS"
2648 LIBS="$LIBS $GTK_LIBS"
2649
2650 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002651 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002652 dnl
2653 rm -f conf.gtktest
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002654 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaar071d4272004-06-13 20:20:40 +00002655#include <gtk/gtk.h>
2656#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002657#if STDC_HEADERS
2658# include <stdlib.h>
2659# include <stddef.h>
2660#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002661
2662int
2663main ()
2664{
2665int major, minor, micro;
2666char *tmp_version;
2667
2668system ("touch conf.gtktest");
2669
2670/* HP/UX 9 (%@#!) writes to sscanf strings */
2671tmp_version = g_strdup("$min_gtk_version");
2672if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2673 printf("%s, bad version string\n", "$min_gtk_version");
2674 exit(1);
2675 }
2676
2677if ((gtk_major_version > major) ||
2678 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2679 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
2680 (gtk_micro_version >= micro)))
2681{
2682 return 0;
2683}
2684return 1;
2685}
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002686])],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002687 CFLAGS="$ac_save_CFLAGS"
2688 LIBS="$ac_save_LIBS"
2689 }
2690 fi
2691 if test "x$no_gtk" = x ; then
2692 if test "x$enable_gtktest" = "xyes"; then
2693 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2694 else
2695 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2696 fi
2697 ifelse([$2], , :, [$2])
2698 else
2699 {
2700 AC_MSG_RESULT(no)
2701 GTK_CFLAGS=""
2702 GTK_LIBS=""
2703 ifelse([$3], , :, [$3])
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002704 if test "$fail_if_missing" = "yes" -a "X$gui_auto" != "Xyes"; then
2705 AC_MSG_ERROR([could not configure GTK])
2706 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002707 }
2708 fi
2709 }
2710 else
2711 GTK_CFLAGS=""
2712 GTK_LIBS=""
2713 ifelse([$3], , :, [$3])
2714 fi
2715 AC_SUBST(GTK_CFLAGS)
2716 AC_SUBST(GTK_LIBS)
2717 rm -f conf.gtktest
2718])
2719
2720dnl ---------------------------------------------------------------------------
2721dnl gnome
2722dnl ---------------------------------------------------------------------------
2723AC_DEFUN([GNOME_INIT_HOOK],
2724[
2725 AC_SUBST(GNOME_LIBS)
2726 AC_SUBST(GNOME_LIBDIR)
2727 AC_SUBST(GNOME_INCLUDEDIR)
2728
2729 AC_ARG_WITH(gnome-includes,
2730 [ --with-gnome-includes=DIR Specify location of GNOME headers],
2731 [CFLAGS="$CFLAGS -I$withval"]
2732 )
2733
2734 AC_ARG_WITH(gnome-libs,
2735 [ --with-gnome-libs=DIR Specify location of GNOME libs],
2736 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
2737 )
2738
2739 AC_ARG_WITH(gnome,
2740 [ --with-gnome Specify prefix for GNOME files],
2741 if test x$withval = xyes; then
2742 want_gnome=yes
2743 ifelse([$1], [], :, [$1])
2744 else
2745 if test "x$withval" = xno; then
2746 want_gnome=no
2747 else
2748 want_gnome=yes
2749 LDFLAGS="$LDFLAGS -L$withval/lib"
2750 CFLAGS="$CFLAGS -I$withval/include"
2751 gnome_prefix=$withval/lib
2752 fi
2753 fi,
2754 want_gnome=yes)
2755
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002756 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002757 {
2758 AC_MSG_CHECKING(for libgnomeui-2.0)
2759 if $PKG_CONFIG --exists libgnomeui-2.0; then
2760 AC_MSG_RESULT(yes)
2761 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
2762 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
2763 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00002764
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002765 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
2766 dnl This might not be the right way but it works for me...
2767 AC_MSG_CHECKING(for FreeBSD)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00002768 if test "$vim_cv_uname_output" = FreeBSD; then
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002769 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00002770 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002771 GNOME_LIBS="$GNOME_LIBS -pthread"
2772 else
2773 AC_MSG_RESULT(no)
2774 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002775 $1
2776 else
2777 AC_MSG_RESULT(not found)
2778 if test "x$2" = xfail; then
2779 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
2780 fi
2781 fi
2782 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00002783 fi
2784])
2785
2786AC_DEFUN([GNOME_INIT],[
2787 GNOME_INIT_HOOK([],fail)
2788])
2789
Bram Moolenaar427f5b62019-06-09 13:43:51 +02002790if test "X$PKG_CONFIG" = "X"; then
2791 AC_PATH_TOOL(PKG_CONFIG, pkg-config, no)
2792fi
2793
Bram Moolenaar071d4272004-06-13 20:20:40 +00002794
2795dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002796dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00002797dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002798if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002799
2800 AC_MSG_CHECKING(--disable-gtktest argument)
2801 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2802 , enable_gtktest=yes)
2803 if test "x$enable_gtktest" = "xyes" ; then
2804 AC_MSG_RESULT(gtk test enabled)
2805 else
2806 AC_MSG_RESULT(gtk test disabled)
2807 fi
2808
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002809 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002810 dnl First try finding version 2.2.0 or later. The 2.0.x series has
2811 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002812 dnl Disable checking for GTK3 here, otherwise it's found when GTK2 is not
2813 dnl found.
2814 save_skip_gtk3=$SKIP_GTK3
2815 SKIP_GTK3=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002816 AM_PATH_GTK(2.2.0,
2817 [GUI_LIB_LOC="$GTK_LIBDIR"
2818 GTK_LIBNAME="$GTK_LIBS"
2819 GUI_INC_LOC="$GTK_CFLAGS"], )
2820 if test "x$GTK_CFLAGS" != "x"; then
Bram Moolenaar98921892016-02-23 17:14:37 +01002821 SKIP_GTK3=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002822 SKIP_MOTIF=YES
2823 GUITYPE=GTK
2824 AC_SUBST(GTK_LIBNAME)
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002825 else
2826 SKIP_GTK3=$save_skip_gtk3
Bram Moolenaar071d4272004-06-13 20:20:40 +00002827 fi
2828 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002829 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002830 dnl
2831 dnl if GTK exists, then check for GNOME.
2832 dnl
2833 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002834 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002835 GNOME_INIT_HOOK([have_gnome=yes])
2836 if test "x$have_gnome" = xyes ; then
2837 AC_DEFINE(FEAT_GUI_GNOME)
2838 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
2839 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002840 fi
2841 }
2842 fi
2843 fi
2844fi
2845
Bram Moolenaar98921892016-02-23 17:14:37 +01002846
2847dnl ---------------------------------------------------------------------------
2848dnl Check for GTK3.
2849dnl ---------------------------------------------------------------------------
2850if test -z "$SKIP_GTK3"; then
2851
2852 AC_MSG_CHECKING(--disable-gtktest argument)
2853 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2854 , enable_gtktest=yes)
2855 if test "x$enable_gtktest" = "xyes" ; then
2856 AC_MSG_RESULT(gtk test enabled)
2857 else
2858 AC_MSG_RESULT(gtk test disabled)
2859 fi
2860
Bram Moolenaar98921892016-02-23 17:14:37 +01002861 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002862 save_skip_gtk2=$SKIP_GTK2
2863 SKIP_GTK2=YES
Bram Moolenaar98921892016-02-23 17:14:37 +01002864 AM_PATH_GTK(3.0.0,
2865 [GUI_LIB_LOC="$GTK_LIBDIR"
2866 GTK_LIBNAME="$GTK_LIBS"
2867 GUI_INC_LOC="$GTK_CFLAGS"], )
2868 if test "x$GTK_CFLAGS" != "x"; then
2869 SKIP_GTK2=YES
2870 SKIP_GNOME=YES
Bram Moolenaar98921892016-02-23 17:14:37 +01002871 SKIP_MOTIF=YES
2872 GUITYPE=GTK
2873 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar98921892016-02-23 17:14:37 +01002874 AC_DEFINE(USE_GTK3)
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002875 else
2876 SKIP_GTK2=$save_skip_gtk2
Bram Moolenaar98921892016-02-23 17:14:37 +01002877 fi
2878 fi
2879fi
2880
Bram Moolenaard2e03f02016-01-02 22:46:36 +01002881dnl Check the version of Gdk-Pixbuf. If the version is 2.31 or later and
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002882dnl glib-compile-resources is found in PATH, use GResource.
2883if test "x$GUITYPE" = "xGTK"; then
2884 AC_MSG_CHECKING([version of Gdk-Pixbuf])
2885 gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0`
2886 if test "x$gdk_pixbuf_version" != x ; then
2887 gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \
2888 sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'`
2889 if test "x$gdk_pixbuf_version_minor" != x -a \
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002890 $gdk_pixbuf_version_minor -ge 31 ; then
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002891 AC_MSG_RESULT([OK.])
2892 AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
2893 AC_MSG_CHECKING([glib-compile-resources])
2894 if test "x$GLIB_COMPILE_RESOURCES" = xno ; then
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002895 GLIB_COMPILE_RESOURCES=""
2896 AC_MSG_RESULT([cannot be found in PATH.])
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002897 else
2898 AC_MSG_RESULT([usable.])
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002899 AC_DEFINE(USE_GRESOURCE)
2900 GRESOURCE_SRC="auto/gui_gtk_gresources.c"
2901 GRESOURCE_OBJ="objects/gui_gtk_gresources.o"
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002902 fi
2903 else
2904 AC_MSG_RESULT([not usable.])
2905 fi
2906 else
2907 AC_MSG_RESULT([cannot obtain from pkg_config.])
2908 fi
Bram Moolenaar4adfaab2016-04-21 18:20:11 +02002909
2910 AC_MSG_CHECKING([--disable-icon-cache-update argument])
2911 AC_ARG_ENABLE(icon_cache_update,
2912 [ --disable-icon-cache-update update disabled],
2913 [],
2914 [enable_icon_cache_update="yes"])
2915 if test "$enable_icon_cache_update" = "yes"; then
2916 AC_MSG_RESULT([not set])
2917 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no)
2918 if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then
2919 AC_MSG_RESULT([not found in PATH.])
2920 fi
2921 else
2922 AC_MSG_RESULT([update disabled])
2923 fi
2924
2925 AC_MSG_CHECKING([--disable-desktop-database-update argument])
2926 AC_ARG_ENABLE(desktop_database_update,
2927 [ --disable-desktop-database-update update disabled],
2928 [],
2929 [enable_desktop_database_update="yes"])
2930 if test "$enable_desktop_database_update" = "yes"; then
2931 AC_MSG_RESULT([not set])
2932 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no)
2933 if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then
2934 AC_MSG_RESULT([not found in PATH.])
2935 fi
2936 else
2937 AC_MSG_RESULT([update disabled])
2938 fi
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002939fi
2940AC_SUBST(GLIB_COMPILE_RESOURCES)
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002941AC_SUBST(GRESOURCE_SRC)
2942AC_SUBST(GRESOURCE_OBJ)
Bram Moolenaar4adfaab2016-04-21 18:20:11 +02002943AC_SUBST(GTK_UPDATE_ICON_CACHE)
2944AC_SUBST(UPDATE_DESKTOP_DATABASE)
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002945
Bram Moolenaar071d4272004-06-13 20:20:40 +00002946dnl Check for Motif include files location.
2947dnl The LAST one found is used, this makes the highest version to be used,
2948dnl e.g. when Motif1.2 and Motif2.0 are both present.
2949
2950if test -z "$SKIP_MOTIF"; then
2951 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"
2952 dnl Remove "-I" from before $GUI_INC_LOC if it's there
2953 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
2954
2955 AC_MSG_CHECKING(for location of Motif GUI includes)
2956 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
2957 GUI_INC_LOC=
2958 for try in $gui_includes; do
2959 if test -f "$try/Xm/Xm.h"; then
2960 GUI_INC_LOC=$try
2961 fi
2962 done
2963 if test -n "$GUI_INC_LOC"; then
2964 if test "$GUI_INC_LOC" = /usr/include; then
2965 GUI_INC_LOC=
2966 AC_MSG_RESULT(in default path)
2967 else
2968 AC_MSG_RESULT($GUI_INC_LOC)
2969 fi
2970 else
2971 AC_MSG_RESULT(<not found>)
2972 SKIP_MOTIF=YES
2973 fi
2974fi
2975
2976dnl Check for Motif library files location. In the same order as the include
2977dnl files, to avoid a mixup if several versions are present
2978
2979if test -z "$SKIP_MOTIF"; then
2980 AC_MSG_CHECKING(--with-motif-lib argument)
2981 AC_ARG_WITH(motif-lib,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002982 [ --with-motif-lib=STRING Library for Motif ],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002983 [ MOTIF_LIBNAME="${withval}" ] )
2984
2985 if test -n "$MOTIF_LIBNAME"; then
2986 AC_MSG_RESULT($MOTIF_LIBNAME)
2987 GUI_LIB_LOC=
2988 else
2989 AC_MSG_RESULT(no)
2990
2991 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
2992 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
2993
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02002994 dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere. The
2995 dnl linker will figure out which one to use, we only check if one exists.
Kelvin Leeb4716902022-04-04 17:20:01 +01002996 dnl Cygwin uses the .dll.a extension.
Bram Moolenaar01967f52023-04-12 16:24:03 +01002997 dnl OpenSUSE appears to use /usr/lib64.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002998 AC_MSG_CHECKING(for location of Motif GUI libs)
Bram Moolenaar01967f52023-04-12 16:24:03 +01002999 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 Moolenaar071d4272004-06-13 20:20:40 +00003000 GUI_LIB_LOC=
3001 for try in $gui_libs; do
Kelvin Leeb4716902022-04-04 17:20:01 +01003002 for libtry in "$try"/libXm.a "$try"/libXm.dll.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00003003 if test -f "$libtry"; then
3004 GUI_LIB_LOC=$try
3005 fi
3006 done
3007 done
3008 if test -n "$GUI_LIB_LOC"; then
Bram Moolenaar01967f52023-04-12 16:24:03 +01003009 dnl Remove /usr/lib, it causes trouble on some systems.
3010 dnl For consistency also remove other standard lib directories.
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02003011 if test "$GUI_LIB_LOC" = /usr/lib \
Bram Moolenaar01967f52023-04-12 16:24:03 +01003012 -o "$GUI_LIB_LOC" = /usr/lib64 \
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02003013 -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \
3014 -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003015 GUI_LIB_LOC=
3016 AC_MSG_RESULT(in default path)
3017 else
3018 if test -n "$GUI_LIB_LOC"; then
3019 AC_MSG_RESULT($GUI_LIB_LOC)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00003020 if test "$vim_cv_uname_output" = SunOS &&
3021 echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003022 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
3023 fi
3024 fi
3025 fi
3026 MOTIF_LIBNAME=-lXm
3027 else
3028 AC_MSG_RESULT(<not found>)
3029 SKIP_MOTIF=YES
3030 fi
3031 fi
3032fi
3033
3034if test -z "$SKIP_MOTIF"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003035 GUITYPE=MOTIF
3036 AC_SUBST(MOTIF_LIBNAME)
3037fi
3038
Bram Moolenaare2adcf32022-03-12 11:57:25 +00003039if test -z "$SKIP_MOTIF"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003040 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
3041 dnl Avoid adding it when it twice
3042 if test -n "$GUI_INC_LOC"; then
3043 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
3044 fi
3045 if test -n "$GUI_LIB_LOC"; then
3046 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
3047 fi
3048
3049 dnl Check for -lXext and then for -lXmu
3050 ldflags_save=$LDFLAGS
3051 LDFLAGS="$X_LIBS $LDFLAGS"
3052 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
3053 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3054 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
3055 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
3056 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3057 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
3058 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3059 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
3060 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3061 if test -z "$SKIP_MOTIF"; then
3062 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
3063 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3064 fi
3065 LDFLAGS=$ldflags_save
3066
3067 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
3068 AC_MSG_CHECKING(for extra X11 defines)
3069 NARROW_PROTO=
3070 rm -fr conftestdir
3071 if mkdir conftestdir; then
3072 cd conftestdir
3073 cat > Imakefile <<'EOF'
3074acfindx:
3075 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
3076EOF
3077 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
3078 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
3079 fi
3080 cd ..
3081 rm -fr conftestdir
3082 fi
3083 if test -z "$NARROW_PROTO"; then
3084 AC_MSG_RESULT(no)
3085 else
3086 AC_MSG_RESULT($NARROW_PROTO)
3087 fi
3088 AC_SUBST(NARROW_PROTO)
3089fi
3090
3091dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
3092dnl use the X11 include path
3093if test "$enable_xsmp" = "yes"; then
3094 cppflags_save=$CPPFLAGS
3095 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3096 AC_CHECK_HEADERS(X11/SM/SMlib.h)
3097 CPPFLAGS=$cppflags_save
3098fi
3099
3100
Bram Moolenaarf52fac22022-03-11 16:01:26 +00003101if test -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003102 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
3103 cppflags_save=$CPPFLAGS
3104 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3105 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
3106
3107 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
3108 if test ! "$enable_xim" = "no"; then
3109 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
3110 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
3111 AC_MSG_RESULT(yes),
Bram Moolenaare29b1fe2014-04-10 20:00:15 +02003112 AC_MSG_RESULT(no; xim has been disabled); enable_xim="no")
Bram Moolenaar071d4272004-06-13 20:20:40 +00003113 fi
3114 CPPFLAGS=$cppflags_save
3115
Bram Moolenaar54612582019-11-21 17:13:31 +01003116 dnl automatically enable XIM in the GUI
3117 if test "$enable_xim" = "auto" -a "x$GUITYPE" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003118 AC_MSG_RESULT(X GUI selected; xim has been enabled)
3119 enable_xim="yes"
3120 fi
3121fi
3122
Bram Moolenaarf52fac22022-03-11 16:01:26 +00003123if test -z "$SKIP_MOTIF"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003124 cppflags_save=$CPPFLAGS
3125 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00003126dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
3127 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003128 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00003129#include <X11/Intrinsic.h>
3130#include <X11/Xmu/Editres.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003131 [int i; i = 0;])],
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00003132 AC_MSG_RESULT(yes)
3133 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
3134 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00003135 CPPFLAGS=$cppflags_save
3136fi
3137
Bram Moolenaar0b40d082022-03-08 13:32:37 +00003138dnl Only use the Xm directory when compiling Motif.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003139if test -z "$SKIP_MOTIF"; then
3140 cppflags_save=$CPPFLAGS
3141 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar77c19352012-06-13 19:19:41 +02003142 if test "$zOSUnix" = "yes"; then
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003143 AC_CHECK_HEADERS(Xm/Xm.h)
Bram Moolenaar77c19352012-06-13 19:19:41 +02003144 else
Bram Moolenaarde1d7342022-06-05 20:03:17 +01003145 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 Moolenaare5303952022-06-19 17:05:47 +01003146 fi
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003147
Bram Moolenaar77c19352012-06-13 19:19:41 +02003148 if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003149 dnl Solaris uses XpmAttributes_21, very annoying.
3150 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003151 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;])],
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003152 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
3153 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
3154 )
3155 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00003156 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003157 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003158 CPPFLAGS=$cppflags_save
3159fi
3160
3161if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
3162 AC_MSG_RESULT(no GUI selected; xim has been disabled)
3163 enable_xim="no"
3164fi
3165if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
3166 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
3167 enable_fontset="no"
3168fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02003169if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003170 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
3171 enable_fontset="no"
3172fi
3173
Bram Moolenaarb3f74062020-02-26 16:16:53 +01003174dnl There is no test for the Haiku GUI, if it's selected it's used
3175if test -z "$SKIP_HAIKU"; then
3176 GUITYPE=HAIKUGUI
3177fi
3178
Bram Moolenaar071d4272004-06-13 20:20:40 +00003179if test -z "$SKIP_PHOTON"; then
3180 GUITYPE=PHOTONGUI
3181fi
3182
3183AC_SUBST(GUI_INC_LOC)
3184AC_SUBST(GUI_LIB_LOC)
3185AC_SUBST(GUITYPE)
3186AC_SUBST(GUI_X_LIBS)
3187
3188if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
3189 AC_MSG_ERROR([cannot use workshop without Motif])
3190fi
3191
3192dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
3193if test "$enable_xim" = "yes"; then
3194 AC_DEFINE(FEAT_XIM)
3195fi
3196if test "$enable_fontset" = "yes"; then
3197 AC_DEFINE(FEAT_XFONTSET)
3198fi
3199
3200
3201dnl ---------------------------------------------------------------------------
3202dnl end of GUI-checking
3203dnl ---------------------------------------------------------------------------
3204
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003205AC_MSG_CHECKING([for /proc link to executable])
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003206if test -L "/proc/self/exe"; then
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003207 dnl Linux
3208 AC_MSG_RESULT([/proc/self/exe])
3209 AC_DEFINE(PROC_EXE_LINK, "/proc/self/exe")
3210elif test -L "/proc/self/path/a.out"; then
3211 dnl Solaris
3212 AC_MSG_RESULT([/proc/self/path/a.out])
3213 AC_DEFINE(PROC_EXE_LINK, "/proc/self/path/a.out")
3214elif test -L "/proc/curproc/file"; then
3215 dnl FreeBSD
3216 AC_MSG_RESULT([/proc/curproc/file])
3217 AC_DEFINE(PROC_EXE_LINK, "/proc/curproc/file")
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003218else
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003219 AC_MSG_RESULT(no)
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003220fi
3221
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003222dnl Check for Cygwin, which needs an extra source file if not using X11
Bram Moolenaar8def26a2015-12-17 15:34:53 +01003223AC_MSG_CHECKING(for CYGWIN or MSYS environment)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00003224case $vim_cv_uname_output in
Bram Moolenaar8def26a2015-12-17 15:34:53 +01003225 CYGWIN*|MSYS*) CYGWIN=yes; AC_MSG_RESULT(yes)
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003226 AC_MSG_CHECKING(for CYGWIN clipboard support)
3227 if test "x$with_x" = "xno" ; then
3228 OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o
3229 AC_MSG_RESULT(yes)
3230 AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD)
3231 else
3232 AC_MSG_RESULT(no - using X11)
3233 fi ;;
3234
3235 *) CYGWIN=no; AC_MSG_RESULT(no);;
3236esac
Bram Moolenaar071d4272004-06-13 20:20:40 +00003237
Bram Moolenaar071d4272004-06-13 20:20:40 +00003238dnl Checks for libraries and include files.
3239
Bram Moolenaar446cb832008-06-24 21:56:24 +00003240AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
3241 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003242 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003243#include "confdefs.h"
3244#include <ctype.h>
3245#if STDC_HEADERS
3246# include <stdlib.h>
3247# include <stddef.h>
3248#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003249int main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003250 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003251 vim_cv_toupper_broken=yes
3252 ],[
3253 vim_cv_toupper_broken=no
3254 ],[
3255 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
3256 ])])
3257
3258if test "x$vim_cv_toupper_broken" = "xyes" ; then
3259 AC_DEFINE(BROKEN_TOUPPER)
3260fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003261
3262AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003263AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003264 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
3265 AC_MSG_RESULT(no))
3266
Bram Moolenaar0c094b92009-05-14 20:20:33 +00003267AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003268AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [int x __attribute__((unused));])],
Bram Moolenaar0c094b92009-05-14 20:20:33 +00003269 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
3270 AC_MSG_RESULT(no))
3271
Bram Moolenaar071d4272004-06-13 20:20:40 +00003272dnl Checks for header files.
3273AC_CHECK_HEADER(elf.h, HAS_ELF=1)
3274dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
3275if test "$HAS_ELF" = 1; then
3276 AC_CHECK_LIB(elf, main)
3277fi
3278
3279AC_HEADER_DIRENT
3280
Bram Moolenaar071d4272004-06-13 20:20:40 +00003281dnl If sys/wait.h is not found it might still exist but not be POSIX
3282dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
3283if test $ac_cv_header_sys_wait_h = no; then
3284 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/wait.h>],
3286 [union wait xx, yy; xx = yy])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003287 AC_MSG_RESULT(yes)
3288 AC_DEFINE(HAVE_SYS_WAIT_H)
3289 AC_DEFINE(HAVE_UNION_WAIT),
3290 AC_MSG_RESULT(no))
3291fi
3292
Bram Moolenaar779a7752016-01-30 23:26:34 +01003293AC_CHECK_HEADERS(stdint.h stdlib.h string.h \
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003294 sys/select.h sys/utsname.h termcap.h fcntl.h \
3295 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
3296 termio.h iconv.h inttypes.h langinfo.h math.h \
3297 unistd.h stropts.h errno.h sys/resource.h \
3298 sys/systeminfo.h locale.h sys/stream.h termios.h \
3299 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
Bram Moolenaar1ecc5e42019-01-26 15:12:55 +01003300 utime.h sys/param.h sys/ptms.h libintl.h libgen.h \
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003301 util/debug.h util/msg18n.h frame.h sys/acl.h \
3302 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003303
Bram Moolenaar00ca2842008-06-26 20:14:00 +00003304dnl sys/ptem.h depends on sys/stream.h on Solaris
3305AC_CHECK_HEADERS(sys/ptem.h, [], [],
3306[#if defined HAVE_SYS_STREAM_H
3307# include <sys/stream.h>
3308#endif])
3309
Bram Moolenaar32f31b12009-05-21 13:20:59 +00003310dnl sys/sysctl.h depends on sys/param.h on OpenBSD
3311AC_CHECK_HEADERS(sys/sysctl.h, [], [],
3312[#if defined HAVE_SYS_PARAM_H
3313# include <sys/param.h>
3314#endif])
3315
Bram Moolenaar00ca2842008-06-26 20:14:00 +00003316
Bram Moolenaardf3267e2005-01-25 22:07:05 +00003317dnl pthread_np.h may exist but can only be used after including pthread.h
3318AC_MSG_CHECKING([for pthread_np.h])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003319AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaardf3267e2005-01-25 22:07:05 +00003320#include <pthread.h>
3321#include <pthread_np.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003322 [int i; i = 0;])],
Bram Moolenaardf3267e2005-01-25 22:07:05 +00003323 AC_MSG_RESULT(yes)
3324 AC_DEFINE(HAVE_PTHREAD_NP_H),
3325 AC_MSG_RESULT(no))
3326
Bram Moolenaare344bea2005-09-01 20:46:49 +00003327AC_CHECK_HEADERS(strings.h)
Bram Moolenaard0573012017-10-28 21:11:06 +02003328if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +00003329 dnl The strings.h file on OS/X contains a warning and nothing useful.
3330 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3331else
Bram Moolenaar071d4272004-06-13 20:20:40 +00003332
3333dnl Check if strings.h and string.h can both be included when defined.
3334AC_MSG_CHECKING([if strings.h can be included after string.h])
3335cppflags_save=$CPPFLAGS
3336CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003337AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003338#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
3339# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
3340 /* but don't do it on AIX 5.1 (Uribarri) */
3341#endif
3342#ifdef HAVE_XM_XM_H
3343# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
3344#endif
3345#ifdef HAVE_STRING_H
3346# include <string.h>
3347#endif
3348#if defined(HAVE_STRINGS_H)
3349# include <strings.h>
3350#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003351 ], [int i; i = 0;])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003352 AC_MSG_RESULT(yes),
3353 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3354 AC_MSG_RESULT(no))
3355CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00003356fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003357
3358dnl Checks for typedefs, structures, and compiler characteristics.
3359AC_PROG_GCC_TRADITIONAL
3360AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00003361AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00003362AC_TYPE_MODE_T
3363AC_TYPE_OFF_T
3364AC_TYPE_PID_T
3365AC_TYPE_SIZE_T
3366AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02003367AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003368
Illia Bobyrf39842f2023-08-27 18:21:23 +02003369AC_CHECK_HEADERS_ONCE([sys/time.h])
3370
Bram Moolenaar071d4272004-06-13 20:20:40 +00003371AC_CHECK_TYPE(ino_t, long)
3372AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02003373AC_C_BIGENDIAN(,,,)
Bram Moolenaar136f29a2016-02-27 20:14:15 +01003374AC_C_INLINE
Bram Moolenaar071d4272004-06-13 20:20:40 +00003375
3376AC_MSG_CHECKING(for rlim_t)
3377if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
3378 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
3379else
3380 AC_EGREP_CPP(dnl
3381changequote(<<,>>)dnl
3382<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
3383changequote([,]),
3384 [
3385#include <sys/types.h>
3386#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003387# include <stdlib.h>
3388# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003389#endif
3390#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00003391# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003392#endif
3393 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
3394 AC_MSG_RESULT($ac_cv_type_rlim_t)
3395fi
3396if test $ac_cv_type_rlim_t = no; then
3397 cat >> confdefs.h <<\EOF
3398#define rlim_t unsigned long
3399EOF
3400fi
3401
3402AC_MSG_CHECKING(for stack_t)
3403if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
3404 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
3405else
3406 AC_EGREP_CPP(stack_t,
3407 [
3408#include <sys/types.h>
3409#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003410# include <stdlib.h>
3411# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003412#endif
3413#include <signal.h>
3414 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
3415 AC_MSG_RESULT($ac_cv_type_stack_t)
3416fi
3417if test $ac_cv_type_stack_t = no; then
3418 cat >> confdefs.h <<\EOF
3419#define stack_t struct sigaltstack
3420EOF
3421fi
3422
3423dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
3424AC_MSG_CHECKING(whether stack_t has an ss_base field)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003425AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003426#include <sys/types.h>
3427#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003428# include <stdlib.h>
3429# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003430#endif
3431#include <signal.h>
3432#include "confdefs.h"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003433 ], [stack_t sigstk; sigstk.ss_base = 0; ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003434 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
3435 AC_MSG_RESULT(no))
3436
3437olibs="$LIBS"
3438AC_MSG_CHECKING(--with-tlib argument)
3439AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
3440if test -n "$with_tlib"; then
3441 AC_MSG_RESULT($with_tlib)
3442 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003443 AC_MSG_CHECKING(for linking with $with_tlib library)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003444 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003445 dnl Need to check for tgetent() below.
3446 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003447else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003448 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003449 dnl On HP-UX 10.10 termcap or termlib should be used instead of
3450 dnl curses, because curses is much slower.
Bram Moolenaar4e509b62011-02-09 17:42:57 +01003451 dnl Newer versions of ncurses are preferred over anything, except
Bram Moolenaar8f4ba692011-05-05 17:24:27 +02003452 dnl when tinfo has been split off, it contains all we need.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003453 dnl Older versions of ncurses have bugs, get a new one!
3454 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00003455 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00003456 case "$vim_cv_uname_output" in
Bram Moolenaar4e509b62011-02-09 17:42:57 +01003457 OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";;
3458 *) tlibs="tinfo ncurses termlib termcap curses";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00003459 esac
3460 for libname in $tlibs; do
3461 AC_CHECK_LIB(${libname}, tgetent,,)
3462 if test "x$olibs" != "x$LIBS"; then
3463 dnl It's possible that a library is found but it doesn't work
3464 dnl e.g., shared library that cannot be found
3465 dnl compile and run a test program to be sure
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003466 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003467#ifdef HAVE_TERMCAP_H
3468# include <termcap.h>
3469#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003470#if STDC_HEADERS
3471# include <stdlib.h>
3472# include <stddef.h>
3473#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003474int main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003475 res="OK", res="FAIL", res="FAIL")
3476 if test "$res" = "OK"; then
3477 break
3478 fi
3479 AC_MSG_RESULT($libname library is not usable)
3480 LIBS="$olibs"
3481 fi
3482 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003483 if test "x$olibs" = "x$LIBS"; then
3484 AC_MSG_RESULT(no terminal library found)
3485 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003486fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003487
3488if test "x$olibs" = "x$LIBS"; then
3489 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003490 AC_LINK_IFELSE([AC_LANG_PROGRAM([int tgetent(char *, const char *);],
3491 [[char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");]])],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003492 AC_MSG_RESULT(yes),
3493 AC_MSG_ERROR([NOT FOUND!
3494 You need to install a terminal library; for example ncurses.
Bram Moolenaar16678eb2021-04-21 11:57:59 +02003495 On Linux that would be the libncurses-dev package.
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003496 Or specify the name of the library with --with-tlib.]))
3497fi
3498
Bram Moolenaar446cb832008-06-24 21:56:24 +00003499AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
3500 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003501 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003502#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003503#ifdef HAVE_TERMCAP_H
3504# include <termcap.h>
3505#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003506#ifdef HAVE_STRING_H
3507# include <string.h>
3508#endif
3509#if STDC_HEADERS
3510# include <stdlib.h>
3511# include <stddef.h>
3512#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003513int main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00003514{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003515 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003516 vim_cv_terminfo=no
3517 ],[
3518 vim_cv_terminfo=yes
3519 ],[
3520 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
3521 ])
3522 ])
3523
3524if test "x$vim_cv_terminfo" = "xyes" ; then
3525 AC_DEFINE(TERMINFO)
3526fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003527
Bram Moolenaara88254f2017-11-02 23:04:14 +01003528AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgetent],
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003529 [
3530 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003531#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003532#ifdef HAVE_TERMCAP_H
3533# include <termcap.h>
3534#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003535#if STDC_HEADERS
3536# include <stdlib.h>
3537# include <stddef.h>
3538#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003539int main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00003540{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003541 ]])],[
Bram Moolenaara88254f2017-11-02 23:04:14 +01003542 vim_cv_tgetent=zero
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003543 ],[
Bram Moolenaara88254f2017-11-02 23:04:14 +01003544 vim_cv_tgetent=non-zero
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003545 ],[
3546 AC_MSG_ERROR(failed to compile test program.)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003547 ])
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003548 ])
3549
Bram Moolenaara88254f2017-11-02 23:04:14 +01003550if test "x$vim_cv_tgetent" = "xzero" ; then
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003551 AC_DEFINE(TGETENT_ZERO_ERR, 0)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003552fi
3553
3554AC_MSG_CHECKING(whether termcap.h contains ospeed)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003555AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003556#ifdef HAVE_TERMCAP_H
3557# include <termcap.h>
3558#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003559 ], [ospeed = 20000])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003560 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
3561 [AC_MSG_RESULT(no)
3562 AC_MSG_CHECKING(whether ospeed can be extern)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003563 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003564#ifdef HAVE_TERMCAP_H
3565# include <termcap.h>
3566#endif
3567extern short ospeed;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003568 ], [ospeed = 20000])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003569 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
3570 AC_MSG_RESULT(no))]
3571 )
3572
3573AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003574AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003575#ifdef HAVE_TERMCAP_H
3576# include <termcap.h>
3577#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003578 ], [if (UP == 0 && BC == 0) PC = 1])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003579 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
3580 [AC_MSG_RESULT(no)
3581 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003582 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003583#ifdef HAVE_TERMCAP_H
3584# include <termcap.h>
3585#endif
3586extern char *UP, *BC, PC;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003587 ], [if (UP == 0 && BC == 0) PC = 1])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003588 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
3589 AC_MSG_RESULT(no))]
3590 )
3591
3592AC_MSG_CHECKING(whether tputs() uses outfuntype)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003593AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003594#ifdef HAVE_TERMCAP_H
3595# include <termcap.h>
3596#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003597 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003598 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
3599 AC_MSG_RESULT(no))
3600
Bram Moolenaarb3a29552021-11-19 11:28:04 +00003601AC_MSG_CHECKING([whether del_curterm() can be used])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003602AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaarb3a29552021-11-19 11:28:04 +00003603#ifdef HAVE_TERMCAP_H
3604# include <termcap.h>
3605#endif
3606#include <term.h>
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003607 ], [if (cur_term) del_curterm(cur_term);])],
Bram Moolenaarb3a29552021-11-19 11:28:04 +00003608 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DEL_CURTERM),
3609 AC_MSG_RESULT(no))
3610
Bram Moolenaar071d4272004-06-13 20:20:40 +00003611dnl On some SCO machines sys/select redefines struct timeval
3612AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003613AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003614#include <sys/types.h>
3615#include <sys/time.h>
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003616#include <sys/select.h>], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003617 AC_MSG_RESULT(yes)
3618 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
3619 AC_MSG_RESULT(no))
3620
Bram Moolenaar071d4272004-06-13 20:20:40 +00003621dnl Checks for pty.c (copied from screen) ==========================
3622AC_MSG_CHECKING(for /dev/ptc)
3623if test -r /dev/ptc; then
3624 AC_DEFINE(HAVE_DEV_PTC)
3625 AC_MSG_RESULT(yes)
3626else
3627 AC_MSG_RESULT(no)
3628fi
3629
3630AC_MSG_CHECKING(for SVR4 ptys)
3631if test -c /dev/ptmx ; then
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003632 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaarce7be3a2020-11-26 20:11:11 +01003633// These should be in stdlib.h, but it depends on _XOPEN_SOURCE.
3634char *ptsname(int);
3635int unlockpt(int);
3636int grantpt(int);
3637 ], [
3638 ptsname(0);
3639 grantpt(0);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003640 unlockpt(0);])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003641 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
3642 AC_MSG_RESULT(no))
3643else
3644 AC_MSG_RESULT(no)
3645fi
3646
3647AC_MSG_CHECKING(for ptyranges)
3648if test -d /dev/ptym ; then
3649 pdir='/dev/ptym'
3650else
3651 pdir='/dev'
3652fi
3653dnl SCO uses ptyp%d
3654AC_EGREP_CPP(yes,
3655[#ifdef M_UNIX
3656 yes;
3657#endif
3658 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
3659dnl if test -c /dev/ptyp19; then
3660dnl ptys=`echo /dev/ptyp??`
3661dnl else
3662dnl ptys=`echo $pdir/pty??`
3663dnl fi
3664if test "$ptys" != "$pdir/pty??" ; then
3665 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
3666 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
3667 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
3668 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
3669 AC_MSG_RESULT([$p0 / $p1])
3670else
3671 AC_MSG_RESULT([don't know])
3672fi
3673
Bram Moolenaar071d4272004-06-13 20:20:40 +00003674dnl Checks for library functions. ===================================
3675
Bram Moolenaar071d4272004-06-13 20:20:40 +00003676dnl check if struct sigcontext is defined (used for SGI only)
3677AC_MSG_CHECKING(for struct sigcontext)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003678AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003679#include <signal.h>
Sam Jamesf8ea1062022-11-05 15:13:50 +00003680int test_sig()
Bram Moolenaar071d4272004-06-13 20:20:40 +00003681{
3682 struct sigcontext *scont;
3683 scont = (struct sigcontext *)0;
3684 return 1;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003685} ], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003686 AC_MSG_RESULT(yes)
3687 AC_DEFINE(HAVE_SIGCONTEXT),
3688 AC_MSG_RESULT(no))
3689
3690dnl tricky stuff: try to find out if getcwd() is implemented with
3691dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00003692AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
3693 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003694 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003695#include "confdefs.h"
3696#ifdef HAVE_UNISTD_H
3697#include <unistd.h>
3698#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003699char *dagger[] = { "IFS=pwd", 0 };
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003700int main()
Bram Moolenaar071d4272004-06-13 20:20:40 +00003701{
3702 char buffer[500];
3703 extern char **environ;
3704 environ = dagger;
3705 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00003706}
Bram Moolenaar7db77842014-03-27 17:40:59 +01003707 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003708 vim_cv_getcwd_broken=no
3709 ],[
3710 vim_cv_getcwd_broken=yes
3711 ],[
3712 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
3713 ])
3714 ])
3715
3716if test "x$vim_cv_getcwd_broken" = "xyes" ; then
3717 AC_DEFINE(BAD_GETCWD)
Bram Moolenaar63d25552019-05-10 21:28:38 +02003718 AC_CHECK_FUNCS(getwd)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003719fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003720
Bram Moolenaar25153e12010-02-24 14:47:08 +01003721dnl Check for functions in one big call, to reduce the size of configure.
3722dnl Can only be used for functions that do not require any include.
Bram Moolenaarcd142e32017-11-16 17:03:45 +01003723AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \
Bram Moolenaar63d25552019-05-10 21:28:38 +02003724 getpwent getpwnam getpwuid getrlimit gettimeofday localtime_r lstat \
Bram Moolenaareaf03392009-11-17 11:08:52 +00003725 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar2fcf6682017-03-11 20:03:42 +01003726 getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar84cf6bd2020-06-16 20:03:43 +02003727 sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \
Bram Moolenaar10455d42019-11-21 15:36:18 +01003728 strnicmp strpbrk strptime strtol tgetent towlower towupper iswupper \
Bram Moolenaar08210f82023-04-13 19:15:54 +01003729 tzset usleep utime utimes mblen ftruncate unsetenv posix_openpt \
3730 clock_gettime)
Bram Moolenaar643b6142018-09-12 20:29:09 +02003731AC_FUNC_SELECT_ARGTYPES
Bram Moolenaar25153e12010-02-24 14:47:08 +01003732AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00003733
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02003734dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
3735dnl appropriate, so that off_t is 64 bits when needed.
3736AC_SYS_LARGEFILE
3737
Bram Moolenaar21606672019-06-14 20:40:58 +02003738AC_MSG_CHECKING(--enable-canberra argument)
3739AC_ARG_ENABLE(canberra,
3740 [ --disable-canberra Do not use libcanberra.],
3741 , [enable_canberra="maybe"])
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003742
Bram Moolenaar21606672019-06-14 20:40:58 +02003743if test "$enable_canberra" = "maybe"; then
Martin Tournoij25f3a142022-10-08 19:26:41 +01003744 if test "$features" = "huge"; then
Bram Moolenaar21606672019-06-14 20:40:58 +02003745 AC_MSG_RESULT(Defaulting to yes)
3746 enable_canberra="yes"
3747 else
3748 AC_MSG_RESULT(Defaulting to no)
3749 enable_canberra="no"
3750 fi
3751else
Bram Moolenaar12471262022-01-18 11:11:25 +00003752 if test "$enable_canberra" = "yes" -a "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01003753 AC_MSG_RESULT([cannot use sound with tiny features])
Bram Moolenaar12471262022-01-18 11:11:25 +00003754 enable_canberra="no"
3755 else
3756 AC_MSG_RESULT($enable_canberra)
3757 fi
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003758fi
Bram Moolenaar21606672019-06-14 20:40:58 +02003759if test "$enable_canberra" = "yes"; then
3760 if test "x$PKG_CONFIG" != "xno"; then
3761 canberra_lib=`$PKG_CONFIG --libs libcanberra 2>/dev/null`
3762 canberra_cflags=`$PKG_CONFIG --cflags libcanberra 2>/dev/null`
3763 fi
3764 if test "x$canberra_lib" = "x"; then
3765 canberra_lib=-lcanberra
3766 canberra_cflags=-D_REENTRANT
3767 fi
3768 AC_MSG_CHECKING(for libcanberra)
3769 ac_save_CFLAGS="$CFLAGS"
3770 ac_save_LIBS="$LIBS"
Bram Moolenaar12471262022-01-18 11:11:25 +00003771 if `echo "$CFLAGS" | grep -v "$canberra_cflags" 2>/dev/null`; then
Christian Brabandt6b9efdd2021-09-09 17:14:50 +02003772 CFLAGS="$CFLAGS $canberra_cflags"
3773 fi
Bram Moolenaar21606672019-06-14 20:40:58 +02003774 LIBS="$LIBS $canberra_lib"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003775 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar21606672019-06-14 20:40:58 +02003776 # include <canberra.h>
3777 ], [
3778 ca_context *hello;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003779 ca_context_create(&hello);])],
Bram Moolenaar21606672019-06-14 20:40:58 +02003780 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CANBERRA),
Bram Moolenaar91b992c2019-11-17 19:07:42 +01003781 AC_MSG_RESULT(no; try installing libcanberra-dev); CFLAGS="$ac_save_CFLAGS"; LIBS="$ac_save_LIBS")
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003782fi
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003783
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003784AC_MSG_CHECKING(--enable-libsodium argument)
3785AC_ARG_ENABLE(libsodium,
3786 [ --disable-libsodium Do not use libsodium.],
3787 , [enable_libsodium="maybe"])
3788
3789if test "$enable_libsodium" = "maybe"; then
Martin Tournoij25f3a142022-10-08 19:26:41 +01003790 if test "$features" = "huge"; then
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003791 AC_MSG_RESULT(Defaulting to yes)
3792 enable_libsodium="yes"
3793 else
3794 AC_MSG_RESULT(Defaulting to no)
3795 enable_libsodium="no"
3796 fi
3797else
3798 AC_MSG_RESULT($enable_libsodium)
3799fi
3800if test "$enable_libsodium" = "yes"; then
3801 if test "x$PKG_CONFIG" != "xno"; then
3802 libsodium_lib=`$PKG_CONFIG --libs libsodium 2>/dev/null`
3803 libsodium_cflags=`$PKG_CONFIG --cflags libsodium 2>/dev/null`
3804 fi
3805 if test "x$libsodium_lib" = "x"; then
3806 libsodium_lib=-lsodium
3807 libsodium_cflags=
3808 fi
ichizok8ce3ca82021-06-23 15:41:52 +02003809 AC_MSG_CHECKING(for libsodium)
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003810 ac_save_CFLAGS="$CFLAGS"
3811 ac_save_LIBS="$LIBS"
3812 CFLAGS="$CFLAGS $libsodium_cflags"
3813 LIBS="$LIBS $libsodium_lib"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003814 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003815 # include <sodium.h>
3816 ], [
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003817 printf("%d", sodium_init()); ])],
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003818 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SODIUM),
3819 AC_MSG_RESULT(no; try installing libsodium-dev); CFLAGS="$ac_save_CFLAGS"; LIBS="$ac_save_LIBS")
3820fi
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003821
Bram Moolenaar071d4272004-06-13 20:20:40 +00003822dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
3823AC_MSG_CHECKING(for st_blksize)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003824AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00003825[#include <sys/types.h>
3826#include <sys/stat.h>],
3827[ struct stat st;
3828 int n;
3829
3830 stat("/", &st);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003831 n = (int)st.st_blksize;])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003832 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
3833 AC_MSG_RESULT(no))
3834
Paul Ollis65745772022-06-05 16:55:54 +01003835dnl Check for timer_create. It probably requires the 'rt' library.
Bram Moolenaarf2ce76a2022-07-02 11:40:40 +01003836dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually
3837dnl works, on Solaris timer_create() exists but fails at runtime.
Bram Moolenaarefffa532022-07-28 22:39:54 +01003838AC_CACHE_CHECK([for timer_create without -lrt], [vim_cv_timer_create], [
Bram Moolenaarf2ce76a2022-07-02 11:40:40 +01003839AC_RUN_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar5748b7f2022-07-28 12:09:04 +01003840#if STDC_HEADERS
3841# include <stdlib.h>
3842# include <stddef.h>
3843#endif
3844#include <signal.h>
3845#include <time.h>
Bram Moolenaare5303952022-06-19 17:05:47 +01003846static void set_flag(union sigval sv) {}
Paul Ollis65745772022-06-05 16:55:54 +01003847], [
3848 struct timespec ts;
3849 struct sigevent action = {0};
3850 timer_t timer_id;
3851
3852 action.sigev_notify = SIGEV_THREAD;
3853 action.sigev_notify_function = set_flag;
Bram Moolenaarf2ce76a2022-07-02 11:40:40 +01003854 if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3855 exit(1); // cannot create a monotonic timer
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003856 ])],
Bram Moolenaarefffa532022-07-28 22:39:54 +01003857 vim_cv_timer_create=yes,
3858 vim_cv_timer_create=no,
Bram Moolenaar5f6cae82022-07-30 11:00:50 +01003859 AC_MSG_WARN([failed to build test program; if cross-compiling please set 'vim_cv_timer_create'])
Bram Moolenaarefffa532022-07-28 22:39:54 +01003860 )])
Paul Ollis65745772022-06-05 16:55:54 +01003861
Bram Moolenaarefffa532022-07-28 22:39:54 +01003862dnl If the previous failed, check for timer_create() and linking with -lrt.
3863if test "x$vim_cv_timer_create" = "xno" ; then
3864 save_LIBS="$LIBS"
3865 LIBS="$LIBS -lrt"
3866 AC_CACHE_CHECK([for timer_create with -lrt], [vim_cv_timer_create_with_lrt], [
3867 AC_RUN_IFELSE([AC_LANG_PROGRAM([
3868 #if STDC_HEADERS
3869 # include <stdlib.h>
3870 # include <stddef.h>
3871 #endif
3872 #include <signal.h>
3873 #include <time.h>
3874 static void set_flag(union sigval sv) {}
3875 ], [
3876 struct timespec ts;
3877 struct sigevent action = {0};
3878 timer_t timer_id;
3879
3880 action.sigev_notify = SIGEV_THREAD;
3881 action.sigev_notify_function = set_flag;
3882 if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3883 exit(1); // cannot create a monotonic timer
3884 ])],
3885 vim_cv_timer_create_with_lrt=yes,
3886 vim_cv_timer_create_with_lrt=no,
Bram Moolenaar5f6cae82022-07-30 11:00:50 +01003887 AC_MSG_WARN([failed to build test program; if cross-compiling please set 'vim_cv_timer_create_with_lrt'])
Bram Moolenaarefffa532022-07-28 22:39:54 +01003888 )])
3889 LIBS="$save_LIBS"
3890else
3891 vim_cv_timer_create_with_lrt=no
3892fi
Richard Purdie509695c2022-07-24 20:48:00 +01003893
3894if test "x$vim_cv_timer_create" = "xyes" ; then
3895 AC_DEFINE(HAVE_TIMER_CREATE)
3896fi
Bram Moolenaarefffa532022-07-28 22:39:54 +01003897if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then
3898 AC_DEFINE(HAVE_TIMER_CREATE)
3899 LIBS="$LIBS -lrt"
3900fi
Paul Ollis65745772022-06-05 16:55:54 +01003901
Bram Moolenaar446cb832008-06-24 21:56:24 +00003902AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
3903 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003904 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003905#include "confdefs.h"
3906#if STDC_HEADERS
3907# include <stdlib.h>
3908# include <stddef.h>
3909#endif
3910#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003911#include <sys/stat.h>
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003912int main() {struct stat st; exit(stat("configure/", &st) != 0); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003913 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003914 vim_cv_stat_ignores_slash=yes
3915 ],[
3916 vim_cv_stat_ignores_slash=no
3917 ],[
3918 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
3919 ])
3920 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003921
Bram Moolenaar446cb832008-06-24 21:56:24 +00003922if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
3923 AC_DEFINE(STAT_IGNORES_SLASH)
3924fi
Leah Neukirchen0a7984a2021-10-14 21:27:55 +01003925
3926dnl nanoseconds field of struct stat
3927AC_CACHE_CHECK([for nanoseconds field of struct stat],
3928 ac_cv_struct_st_mtim_nsec,
3929 [ac_save_CPPFLAGS="$CPPFLAGS"
3930 ac_cv_struct_st_mtim_nsec=no
3931 # st_mtim.tv_nsec -- the usual case
3932 # st_mtim._tv_nsec -- Solaris 2.6, if
3933 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
3934 # && !defined __EXTENSIONS__)
3935 # st_mtim.st__tim.tv_nsec -- UnixWare 2.1.2
3936 # st_mtime_n -- AIX 5.2 and above
3937 # st_mtimespec.tv_nsec -- Darwin (Mac OSX)
3938 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
3939 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003940 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
3941#include <sys/stat.h>], [struct stat s; s.ST_MTIM_NSEC;])],
Leah Neukirchen0a7984a2021-10-14 21:27:55 +01003942 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
3943 done
3944 CPPFLAGS="$ac_save_CPPFLAGS"
3945])
3946if test $ac_cv_struct_st_mtim_nsec != no; then
3947 AC_DEFINE_UNQUOTED([ST_MTIM_NSEC], [$ac_cv_struct_st_mtim_nsec],
3948 [Define if struct stat contains a nanoseconds field])
3949fi
Bram Moolenaare5303952022-06-19 17:05:47 +01003950
Bram Moolenaar071d4272004-06-13 20:20:40 +00003951dnl Link with iconv for charset translation, if not found without library.
3952dnl check for iconv() requires including iconv.h
3953dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
3954dnl has been installed.
3955AC_MSG_CHECKING(for iconv_open())
3956save_LIBS="$LIBS"
3957LIBS="$LIBS -liconv"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003958AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003959#ifdef HAVE_ICONV_H
3960# include <iconv.h>
3961#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003962 ], [iconv_open("fr", "to");])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003963 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
3964 LIBS="$save_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003965 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003966#ifdef HAVE_ICONV_H
3967# include <iconv.h>
3968#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003969 ], [iconv_open("fr", "to");])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003970 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
3971 AC_MSG_RESULT(no)))
3972
3973
3974AC_MSG_CHECKING(for nl_langinfo(CODESET))
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003975AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003976#ifdef HAVE_LANGINFO_H
3977# include <langinfo.h>
3978#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003979], [char *cs = nl_langinfo(CODESET);])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003980 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
3981 AC_MSG_RESULT(no))
3982
Bram Moolenaar73e28dc2022-09-17 21:08:33 +01003983dnl Floating point support may require the "m" library
Bram Moolenaar446cb832008-06-24 21:56:24 +00003984AC_CHECK_LIB(m, strtod)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003985
Bram Moolenaara6b89762016-02-29 21:38:26 +01003986dnl isinf() and isnan() need to include header files and may need -lm.
3987AC_MSG_CHECKING([for isinf()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003988AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaara6b89762016-02-29 21:38:26 +01003989#ifdef HAVE_MATH_H
3990# include <math.h>
3991#endif
3992#if STDC_HEADERS
3993# include <stdlib.h>
3994# include <stddef.h>
3995#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003996], [int r = isinf(1.11); ])],
Bram Moolenaara6b89762016-02-29 21:38:26 +01003997 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISINF),
3998 AC_MSG_RESULT(no))
3999
4000AC_MSG_CHECKING([for isnan()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004001AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaara6b89762016-02-29 21:38:26 +01004002#ifdef HAVE_MATH_H
4003# include <math.h>
4004#endif
4005#if STDC_HEADERS
4006# include <stdlib.h>
4007# include <stddef.h>
4008#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004009], [int r = isnan(1.11); ])],
Bram Moolenaara6b89762016-02-29 21:38:26 +01004010 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISNAN),
4011 AC_MSG_RESULT(no))
4012
Bram Moolenaar071d4272004-06-13 20:20:40 +00004013dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
4014dnl when -lacl works, also try to use -lattr (required for Debian).
Bram Moolenaar8d462f92012-02-05 22:51:33 +01004015dnl On Solaris, use the acl_get/set functions in libsec, if present.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004016AC_MSG_CHECKING(--disable-acl argument)
4017AC_ARG_ENABLE(acl,
Bram Moolenaard6d30422018-01-28 22:48:55 +01004018 [ --disable-acl No check for ACL support.],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004019 , [enable_acl="yes"])
4020if test "$enable_acl" = "yes"; then
Bram Moolenaard6d30422018-01-28 22:48:55 +01004021 AC_MSG_RESULT(no)
4022 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004023 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
4024 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
4025
Bram Moolenaard6d30422018-01-28 22:48:55 +01004026 AC_MSG_CHECKING(for POSIX ACL support)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004027 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00004028#include <sys/types.h>
4029#ifdef HAVE_SYS_ACL_H
4030# include <sys/acl.h>
4031#endif
4032acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
4033 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004034 acl_free(acl);])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004035 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
4036 AC_MSG_RESULT(no))
4037
Bram Moolenaard6d30422018-01-28 22:48:55 +01004038 AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)],
4039 AC_MSG_CHECKING(for Solaris ACL support)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004040 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00004041#ifdef HAVE_SYS_ACL_H
4042# include <sys/acl.h>
4043#endif], [acl("foo", GETACLCNT, 0, NULL);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004044 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004045 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
Bram Moolenaar8d462f92012-02-05 22:51:33 +01004046 AC_MSG_RESULT(no)))
Bram Moolenaar071d4272004-06-13 20:20:40 +00004047
Bram Moolenaard6d30422018-01-28 22:48:55 +01004048 AC_MSG_CHECKING(for AIX ACL support)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004049 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar446cb832008-06-24 21:56:24 +00004050#if STDC_HEADERS
4051# include <stdlib.h>
4052# include <stddef.h>
4053#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00004054#ifdef HAVE_SYS_ACL_H
4055# include <sys/acl.h>
4056#endif
4057#ifdef HAVE_SYS_ACCESS_H
4058# include <sys/access.h>
4059#endif
4060#define _ALL_SOURCE
4061
4062#include <sys/stat.h>
4063
4064int aclsize;
4065struct acl *aclent;], [aclsize = sizeof(struct acl);
4066 aclent = (void *)malloc(aclsize);
4067 statacl("foo", STX_NORMAL, aclent, aclsize);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004068 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004069 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
4070 AC_MSG_RESULT(no))
4071else
4072 AC_MSG_RESULT(yes)
4073fi
4074
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02004075if test "x$GTK_CFLAGS" != "x"; then
4076 dnl pango_shape_full() is new, fall back to pango_shape().
4077 AC_MSG_CHECKING(for pango_shape_full)
4078 ac_save_CFLAGS="$CFLAGS"
4079 ac_save_LIBS="$LIBS"
4080 CFLAGS="$CFLAGS $GTK_CFLAGS"
4081 LIBS="$LIBS $GTK_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004082 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02004083 [#include <gtk/gtk.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004084 [ pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); ])],
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02004085 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PANGO_SHAPE_FULL),
4086 AC_MSG_RESULT(no))
4087 CFLAGS="$ac_save_CFLAGS"
4088 LIBS="$ac_save_LIBS"
4089fi
4090
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004091AC_MSG_CHECKING(--enable-gpm argument)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004092AC_ARG_ENABLE(gpm,
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004093 [ --enable-gpm=OPTS Use gpm (Linux mouse daemon). default=yes OPTS=yes/no/dynamic], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00004094 [enable_gpm="yes"])
4095
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004096if test "$enable_gpm" = "yes" -o "$enable_gpm" = "dynamic"; then
4097 AC_MSG_RESULT($enable_gpm)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004098 dnl Checking if gpm support can be compiled
4099 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
4100 [olibs="$LIBS" ; LIBS="-lgpm"]
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004101 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004102 [#include <gpm.h>
4103 #include <linux/keyboard.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004104 [Gpm_GetLibVersion(NULL);])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004105 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
4106 dnl FEAT_MOUSE_GPM if mouse support is included
4107 [vi_cv_have_gpm=yes],
4108 [vi_cv_have_gpm=no])
4109 [LIBS="$olibs"]
4110 )
4111 if test $vi_cv_have_gpm = yes; then
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004112 if test "$enable_gpm" = "yes"; then
4113 LIBS="$LIBS -lgpm"
4114 else
4115 AC_DEFINE(DYNAMIC_GPM)
4116 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004117 AC_DEFINE(HAVE_GPM)
4118 fi
4119else
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004120 AC_MSG_RESULT(no)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004121fi
4122
Bram Moolenaar446cb832008-06-24 21:56:24 +00004123AC_MSG_CHECKING(--disable-sysmouse argument)
4124AC_ARG_ENABLE(sysmouse,
Bram Moolenaar8008b632017-07-18 21:33:20 +02004125 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
Bram Moolenaar446cb832008-06-24 21:56:24 +00004126 [enable_sysmouse="yes"])
4127
4128if test "$enable_sysmouse" = "yes"; then
4129 AC_MSG_RESULT(no)
4130 dnl Checking if sysmouse support can be compiled
4131 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
4132 dnl defines FEAT_SYSMOUSE if mouse support is included
4133 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004134 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar446cb832008-06-24 21:56:24 +00004135 [#include <sys/consio.h>
4136 #include <signal.h>
4137 #include <sys/fbio.h>],
4138 [struct mouse_info mouse;
4139 mouse.operation = MOUSE_MODE;
4140 mouse.operation = MOUSE_SHOW;
4141 mouse.u.mode.mode = 0;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004142 mouse.u.mode.signal = SIGUSR2;])],
Bram Moolenaar446cb832008-06-24 21:56:24 +00004143 [vi_cv_have_sysmouse=yes],
4144 [vi_cv_have_sysmouse=no])
4145 )
4146 if test $vi_cv_have_sysmouse = yes; then
4147 AC_DEFINE(HAVE_SYSMOUSE)
4148 fi
4149else
4150 AC_MSG_RESULT(yes)
4151fi
4152
Bram Moolenaarf05da212009-11-17 16:13:15 +00004153dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
4154AC_MSG_CHECKING(for FD_CLOEXEC)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004155AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaarf05da212009-11-17 16:13:15 +00004156[#if HAVE_FCNTL_H
4157# include <fcntl.h>
4158#endif],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004159[ int flag = FD_CLOEXEC;])],
Bram Moolenaarf05da212009-11-17 16:13:15 +00004160 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
4161 AC_MSG_RESULT(not usable))
4162
Bram Moolenaar071d4272004-06-13 20:20:40 +00004163dnl rename needs to be checked separately to work on Nextstep with cc
4164AC_MSG_CHECKING(for rename)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004165AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [rename("this", "that")])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004166 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
4167 AC_MSG_RESULT(no))
4168
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004169dnl check for dirfd()
4170AC_MSG_CHECKING(for dirfd)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004171AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004172[#include <sys/types.h>
4173#include <dirent.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004174[DIR * dir=opendir("dirname"); dirfd(dir);])],
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004175AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DIRFD), AC_MSG_RESULT(not usable))
4176
4177dnl check for flock()
4178AC_MSG_CHECKING(for flock)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004179AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004180[#include <sys/file.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004181[flock(10, LOCK_SH);])],
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004182AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOCK), AC_MSG_RESULT(not usable))
4183
Bram Moolenaar071d4272004-06-13 20:20:40 +00004184dnl sysctl() may exist but not the arguments we use
4185AC_MSG_CHECKING(for sysctl)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004186AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004187[#include <sys/types.h>
4188#include <sys/sysctl.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004189[[ int mib[2], r;
Bram Moolenaar071d4272004-06-13 20:20:40 +00004190 size_t len;
4191
4192 mib[0] = CTL_HW;
4193 mib[1] = HW_USERMEM;
4194 len = sizeof(r);
4195 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004196 ]])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004197 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
4198 AC_MSG_RESULT(not usable))
4199
Bram Moolenaare2982d62021-10-06 11:27:21 +01004200dnl sysinfo() may exist but not be Linux compatible.
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004201dnl On some FreeBSD systems it may depend on libsysinfo, try to link
Bram Moolenaar071d4272004-06-13 20:20:40 +00004202AC_MSG_CHECKING(for sysinfo)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004203AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004204[#include <sys/types.h>
4205#include <sys/sysinfo.h>],
4206[ struct sysinfo sinfo;
4207 int t;
4208
4209 (void)sysinfo(&sinfo);
4210 t = sinfo.totalram;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004211 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004212 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
4213 AC_MSG_RESULT(not usable))
4214
Bram Moolenaar914572a2007-05-01 11:37:47 +00004215dnl struct sysinfo may have the mem_unit field or not
4216AC_MSG_CHECKING(for sysinfo.mem_unit)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004217AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar914572a2007-05-01 11:37:47 +00004218[#include <sys/types.h>
4219#include <sys/sysinfo.h>],
4220[ struct sysinfo sinfo;
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02004221 sinfo.mem_unit = 1;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004222 ])],
Bram Moolenaar914572a2007-05-01 11:37:47 +00004223 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
4224 AC_MSG_RESULT(no))
4225
Bram Moolenaarf52f0602021-03-10 21:26:37 +01004226dnl struct sysinfo may have the uptime field or not
4227AC_MSG_CHECKING(for sysinfo.uptime)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004228AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaarf52f0602021-03-10 21:26:37 +01004229[#include <sys/types.h>
4230#include <sys/sysinfo.h>],
4231[ struct sysinfo sinfo;
4232 long ut;
4233
4234 (void)sysinfo(&sinfo);
4235 ut = sinfo.uptime;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004236 ])],
Bram Moolenaarf52f0602021-03-10 21:26:37 +01004237 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_UPTIME),
4238 AC_MSG_RESULT(no))
4239
Bram Moolenaar071d4272004-06-13 20:20:40 +00004240dnl sysconf() may exist but not support what we want to use
4241AC_MSG_CHECKING(for sysconf)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004242AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004243[#include <unistd.h>],
4244[ (void)sysconf(_SC_PAGESIZE);
4245 (void)sysconf(_SC_PHYS_PAGES);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004246 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004247 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
4248 AC_MSG_RESULT(not usable))
4249
Bram Moolenaar0e62a672021-02-25 17:17:56 +01004250dnl check if we have _SC_SIGSTKSZ via sysconf()
4251AC_MSG_CHECKING(for _SC_SIGSTKSZ via sysconf())
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004252AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar0e62a672021-02-25 17:17:56 +01004253[#include <unistd.h>],
4254[ (void)sysconf(_SC_SIGSTKSZ);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004255 ])],
Bram Moolenaar0e62a672021-02-25 17:17:56 +01004256 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF_SIGSTKSZ),
4257 AC_MSG_RESULT(not usable))
4258
Bram Moolenaar914703b2010-05-31 21:59:46 +02004259AC_CHECK_SIZEOF([int])
4260AC_CHECK_SIZEOF([long])
4261AC_CHECK_SIZEOF([time_t])
4262AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02004263
Bram Moolenaara2aa31a2014-02-23 22:52:40 +01004264dnl Use different names to avoid clashing with other header files.
4265AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int])
4266AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long])
4267
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004268dnl Make sure that uint32_t is really 32 bits unsigned.
4269AC_MSG_CHECKING([uint32_t is 32 bits])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004270AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004271#ifdef HAVE_STDINT_H
4272# include <stdint.h>
4273#endif
4274#ifdef HAVE_INTTYPES_H
4275# include <inttypes.h>
4276#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01004277int main() {
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004278 uint32_t nr1 = (uint32_t)-1;
4279 uint32_t nr2 = (uint32_t)0xffffffffUL;
Bram Moolenaar52897832020-07-02 22:50:37 +02004280 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) return 1;
4281 return 0;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004282}])],
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004283AC_MSG_RESULT(ok),
4284AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
Bram Moolenaar323cb952011-12-14 19:22:34 +01004285AC_MSG_WARN([cannot check uint32_t when cross-compiling.]))
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004286
Bram Moolenaar446cb832008-06-24 21:56:24 +00004287dnl Check for memmove() before bcopy(), makes memmove() be used when both are
4288dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
4289
Bram Moolenaar071d4272004-06-13 20:20:40 +00004290[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00004291#include "confdefs.h"
4292#ifdef HAVE_STRING_H
4293# include <string.h>
4294#endif
4295#if STDC_HEADERS
4296# include <stdlib.h>
4297# include <stddef.h>
4298#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01004299int main() {
Bram Moolenaar071d4272004-06-13 20:20:40 +00004300 char buf[10];
4301 strcpy(buf, "abcdefghi");
4302 mch_memmove(buf, buf + 2, 3);
4303 if (strncmp(buf, "ababcf", 6))
4304 exit(1);
4305 strcpy(buf, "abcdefghi");
4306 mch_memmove(buf + 2, buf, 3);
4307 if (strncmp(buf, "cdedef", 6))
4308 exit(1);
4309 exit(0); /* libc version works properly. */
4310}']
4311
Bram Moolenaar446cb832008-06-24 21:56:24 +00004312AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
4313 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004314 AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]])],
Bram Moolenaar446cb832008-06-24 21:56:24 +00004315 [
4316 vim_cv_memmove_handles_overlap=yes
4317 ],[
4318 vim_cv_memmove_handles_overlap=no
4319 ],[
4320 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
4321 ])
4322 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00004323
Bram Moolenaar446cb832008-06-24 21:56:24 +00004324if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
4325 AC_DEFINE(USEMEMMOVE)
4326else
4327 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
4328 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004329 AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]])],
Bram Moolenaar446cb832008-06-24 21:56:24 +00004330 [
4331 vim_cv_bcopy_handles_overlap=yes
4332 ],[
4333 vim_cv_bcopy_handles_overlap=no
4334 ],[
4335 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
4336 ])
4337 ])
4338
4339 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
4340 AC_DEFINE(USEBCOPY)
4341 else
4342 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
4343 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004344 AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]])],
Bram Moolenaar446cb832008-06-24 21:56:24 +00004345 [
4346 vim_cv_memcpy_handles_overlap=yes
4347 ],[
4348 vim_cv_memcpy_handles_overlap=no
4349 ],[
4350 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
4351 ])
4352 ])
4353
4354 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
4355 AC_DEFINE(USEMEMCPY)
4356 fi
4357 fi
4358fi
4359
Bram Moolenaar071d4272004-06-13 20:20:40 +00004360
4361dnl Check for multibyte locale functions
4362dnl Find out if _Xsetlocale() is supported by libX11.
4363dnl Check if X_LOCALE should be defined.
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004364if test "x$with_x" = "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004365 cflags_save=$CFLAGS
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004366 libs_save=$LIBS
4367 LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS"
4368 CFLAGS="$CFLAGS $X_CFLAGS"
4369
4370 AC_MSG_CHECKING(whether X_LOCALE needed)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <X11/Xlocale.h>],)],
4372 AC_LINK_IFELSE([AC_LANG_CALL([],[_Xsetlocale])], [AC_MSG_RESULT(yes)
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004373 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
4374 AC_MSG_RESULT(no))
4375
4376 AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004377 AC_LINK_IFELSE([AC_LANG_CALL([],[Xutf8SetWMProperties])], [AC_MSG_RESULT(yes)
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004378 AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no))
4379
Bram Moolenaar071d4272004-06-13 20:20:40 +00004380 CFLAGS=$cflags_save
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004381 LIBS=$libs_save
Bram Moolenaar071d4272004-06-13 20:20:40 +00004382fi
4383
4384dnl Link with xpg4, it is said to make Korean locale working
4385AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
4386
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00004387dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar8f4ba692011-05-05 17:24:27 +02004388dnl Use --version to detect Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00004389dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004390dnl -t for typedefs (many ctags have this)
4391dnl -s for static functions (Elvis ctags only?)
4392dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
4393dnl -i+m to test for older Exuberant ctags
4394AC_MSG_CHECKING(how to create tags)
4395test -f tags && mv tags tags.save
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004396if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1; then
Bram Moolenaar509ff062020-01-02 22:38:49 +01004397 TAGPRG="ctags -I INIT+,INIT2+,INIT3+,INIT4+,INIT5+ --fields=+S"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004398elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1; then
Bram Moolenaar509ff062020-01-02 22:38:49 +01004399 TAGPRG="exctags -I INIT+,INIT2+,INIT3+,INIT4+,INIT5+ --fields=+S"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004400elif (eval exuberant-ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1; then
Bram Moolenaar509ff062020-01-02 22:38:49 +01004401 TAGPRG="exuberant-ctags -I INIT+,INIT2+,INIT3+,INIT4+,INIT5+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004402else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00004403 TAGPRG="ctags"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004404 (eval etags /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="etags"
4405 (eval etags -c /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="etags -c"
4406 (eval ctags /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags"
4407 (eval ctags -t /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags -t"
4408 (eval ctags -ts /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags -ts"
4409 (eval ctags -tvs /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags -tvs"
4410 (eval ctags -i+m /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags -i+m"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004411fi
4412test -f tags.save && mv tags.save tags
4413AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
4414
4415dnl Check how we can run man with a section number
4416AC_MSG_CHECKING(how to run man with a section nr)
4417MANDEF="man"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004418(eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AS_MESSAGE_LOG_FD && MANDEF="man -s"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004419AC_MSG_RESULT($MANDEF)
4420if test "$MANDEF" = "man -s"; then
4421 AC_DEFINE(USEMAN_S)
4422fi
4423
4424dnl Check if gettext() is working and if it needs -lintl
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004425dnl We take care to base this on an empty LIBS: on some systems libelf would be
4426dnl in LIBS and implicitly take along libintl. The final LIBS would then not
4427dnl contain libintl, and the link step would fail due to -Wl,--as-needed.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004428AC_MSG_CHECKING(--disable-nls argument)
4429AC_ARG_ENABLE(nls,
4430 [ --disable-nls Don't support NLS (gettext()).], ,
4431 [enable_nls="yes"])
4432
4433if test "$enable_nls" = "yes"; then
4434 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00004435
4436 INSTALL_LANGS=install-languages
4437 AC_SUBST(INSTALL_LANGS)
4438 INSTALL_TOOL_LANGS=install-tool-languages
4439 AC_SUBST(INSTALL_TOOL_LANGS)
4440
Bram Moolenaar071d4272004-06-13 20:20:40 +00004441 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
4442 AC_MSG_CHECKING([for NLS])
4443 if test -f po/Makefile; then
4444 have_gettext="no"
4445 if test -n "$MSGFMT"; then
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004446 olibs=$LIBS
4447 LIBS=""
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004448 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004449 [#include <libintl.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004450 [gettext("Test");])],
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004451 AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs,
4452 LIBS="-lintl"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004453 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004454 [#include <libintl.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004455 [gettext("Test");])],
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004456 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes";
4457 LIBS="$olibs -lintl",
Bram Moolenaar071d4272004-06-13 20:20:40 +00004458 AC_MSG_RESULT([gettext() doesn't work]);
4459 LIBS=$olibs))
4460 else
4461 AC_MSG_RESULT([msgfmt not found - disabled]);
4462 fi
Martin Tournoij7904fa42022-10-04 16:28:45 +01004463 if test $have_gettext = "yes" -a "x$features" != "xtiny"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004464 AC_DEFINE(HAVE_GETTEXT)
4465 MAKEMO=yes
4466 AC_SUBST(MAKEMO)
4467 dnl this was added in GNU gettext 0.10.36
4468 AC_CHECK_FUNCS(bind_textdomain_codeset)
4469 dnl _nl_msg_cat_cntr is required for GNU gettext
4470 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004471 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004472 [#include <libintl.h>
4473 extern int _nl_msg_cat_cntr;],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004474 [++_nl_msg_cat_cntr;])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004475 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
4476 AC_MSG_RESULT([no]))
Bram Moolenaar26096cc2019-04-11 15:25:40 +02004477 AC_MSG_CHECKING([if msgfmt supports --desktop])
4478 MSGFMT_DESKTOP=
4479 if "$MSGFMT" --help | grep -e '--desktop' >/dev/null; then
Bram Moolenaar62a88f42019-06-07 20:44:40 +02004480 if "$MSGFMT" --version | grep '0.19.[[3-7]]$' >/dev/null; then
4481 dnl GNU gettext 0.19.7's --desktop is broken. We assume back to
4482 dnl 0.19.3 is also broken.
4483 AC_MSG_RESULT([broken])
4484 else
4485 AC_MSG_RESULT([yes])
4486 MSGFMT_DESKTOP="gvim.desktop vim.desktop"
4487 fi
Bram Moolenaar26096cc2019-04-11 15:25:40 +02004488 else
4489 AC_MSG_RESULT([no])
4490 fi
4491 AC_SUBST(MSGFMT_DESKTOP)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004492 fi
4493 else
4494 AC_MSG_RESULT([no "po/Makefile" - disabled]);
4495 fi
4496else
4497 AC_MSG_RESULT(yes)
4498fi
4499
4500dnl Check for dynamic linking loader
4501AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
4502if test x${DLL} = xdlfcn.h; then
4503 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
4504 AC_MSG_CHECKING([for dlopen()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004505 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004506 extern void* dlopen();
4507 dlopen();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004508 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004509 AC_MSG_RESULT(yes);
4510 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4511 AC_MSG_RESULT(no);
4512 AC_MSG_CHECKING([for dlopen() in -ldl])
4513 olibs=$LIBS
4514 LIBS="$LIBS -ldl"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004515 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004516 extern void* dlopen();
4517 dlopen();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004518 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004519 AC_MSG_RESULT(yes);
4520 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4521 AC_MSG_RESULT(no);
4522 LIBS=$olibs))
4523 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
4524 dnl ick :-)
4525 AC_MSG_CHECKING([for dlsym()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004526 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004527 extern void* dlsym();
4528 dlsym();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004529 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004530 AC_MSG_RESULT(yes);
4531 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4532 AC_MSG_RESULT(no);
4533 AC_MSG_CHECKING([for dlsym() in -ldl])
4534 olibs=$LIBS
4535 LIBS="$LIBS -ldl"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004536 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004537 extern void* dlsym();
4538 dlsym();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004539 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004540 AC_MSG_RESULT(yes);
4541 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4542 AC_MSG_RESULT(no);
4543 LIBS=$olibs))
4544elif test x${DLL} = xdl.h; then
4545 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
4546 AC_MSG_CHECKING([for shl_load()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004547 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004548 extern void* shl_load();
4549 shl_load();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004550 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004551 AC_MSG_RESULT(yes);
4552 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4553 AC_MSG_RESULT(no);
4554 AC_MSG_CHECKING([for shl_load() in -ldld])
4555 olibs=$LIBS
4556 LIBS="$LIBS -ldld"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004557 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004558 extern void* shl_load();
4559 shl_load();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004560 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004561 AC_MSG_RESULT(yes);
4562 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4563 AC_MSG_RESULT(no);
4564 LIBS=$olibs))
4565fi
4566AC_CHECK_HEADERS(setjmp.h)
4567
Bram Moolenaard0573012017-10-28 21:11:06 +02004568if test "x$MACOS_X" = "xyes" -a -n "$PERL"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004569 dnl -ldl must come after DynaLoader.a
4570 if echo $LIBS | grep -e '-ldl' >/dev/null; then
4571 LIBS=`echo $LIBS | sed s/-ldl//`
4572 PERL_LIBS="$PERL_LIBS -ldl"
4573 fi
4574fi
4575
Bram Moolenaard0573012017-10-28 21:11:06 +02004576if test "$MACOS_X" = "yes"; then
4577 AC_MSG_CHECKING([whether we need macOS frameworks])
Bram Moolenaar097148e2020-08-11 21:58:20 +02004578 if test "$MACOS_X_DARWIN" = "yes"; then
Bram Moolenaard0573012017-10-28 21:11:06 +02004579 if test "$features" = "tiny"; then
Yee Cheng Chin4314e4f2022-10-08 13:50:05 +01004580 dnl Since no FEAT_CLIPBOARD or FEAT_SOUND, no need for os_macosx.m.
Bram Moolenaard0573012017-10-28 21:11:06 +02004581 OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'`
4582 OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'`
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01004583 AC_MSG_RESULT([yes, we need CoreServices])
4584 LIBS="$LIBS -framework CoreServices"
Bram Moolenaard0573012017-10-28 21:11:06 +02004585 else
4586 AC_MSG_RESULT([yes, we need AppKit])
4587 LIBS="$LIBS -framework AppKit"
Bram Moolenaard0573012017-10-28 21:11:06 +02004588 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004589 else
Bram Moolenaard0573012017-10-28 21:11:06 +02004590 AC_MSG_RESULT([no])
Bram Moolenaar3437b912013-07-03 19:52:53 +02004591 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004592fi
4593
Bram Moolenaar3ae5fc92021-09-06 18:57:30 +02004594dnl On some systems REENTRANT needs to be defined. It should not hurt to use
4595dnl it everywhere.
4596if `echo "$CFLAGS" | grep -v D_REENTRANT >/dev/null`; then
4597 CFLAGS="$CFLAGS -D_REENTRANT"
4598fi
4599
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004600dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
4601dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
4602dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00004603dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
4604dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004605DEPEND_CFLAGS_FILTER=
4606if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004607 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar348808f2020-02-07 20:50:07 +01004608 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]][[0-9]]*\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00004609 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004610 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004611 AC_MSG_RESULT(yes)
4612 else
4613 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004614 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004615 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
4616 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00004617 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaaraeabe052011-12-08 15:17:34 +01004618 dnl And undefine it first to avoid a warning.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004619 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
4620 if test "$gccmajor" -gt "3"; then
Zdenek Dohnal42196982023-01-18 16:09:51 +00004621 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/'`
4622 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 Moolenaar0cd49302008-11-20 09:37:01 +00004623 AC_MSG_RESULT(yes)
4624 else
4625 AC_MSG_RESULT(no)
4626 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00004627fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004628AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004629
Bram Moolenaarec0557f2018-01-31 14:41:37 +01004630dnl On some systems AC_SYS_LARGEFILE determines that -D_FILE_OFFSET_BITS=64
4631dnl isn't required, but the CFLAGS for some of the libraries we're using
4632dnl include the define. Since the define changes the size of some datatypes
4633dnl (e.g. ino_t and off_t), all of Vim's modules must be compiled with a
4634dnl consistent value. It's therefore safest to force the use of the define
4635dnl if it's present in any of the *_CFLAGS variables.
4636AC_MSG_CHECKING(whether we need to force -D_FILE_OFFSET_BITS=64)
Bram Moolenaar9ce42132018-04-11 22:19:36 +02004637if 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 Moolenaarec0557f2018-01-31 14:41:37 +01004638 AC_MSG_RESULT(yes)
4639 AC_DEFINE(_FILE_OFFSET_BITS, 64)
4640else
4641 AC_MSG_RESULT(no)
4642fi
4643
Bram Moolenaar6cd42db2020-12-04 18:09:54 +01004644dnl $LDFLAGS is passed to glibtool in libvterm, it doesn't like a space
4645dnl between "-L" and the path that follows.
4646LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-L /-L/g'`
4647
Bram Moolenaar22e193d2010-11-03 22:32:24 +01004648dnl link.sh tries to avoid overlinking in a hackish way.
4649dnl At least GNU ld supports --as-needed which provides the same functionality
4650dnl at linker level. Let's use it.
4651AC_MSG_CHECKING(linker --as-needed support)
4652LINK_AS_NEEDED=
4653# Check if linker supports --as-needed and --no-as-needed options
4654if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
Natanael Copa761ead42021-05-15 14:25:37 +02004655 if ! echo "$LDFLAGS" | grep -q -- '-Wl,[[^[:space:]]]*--as-needed'; then
4656 LDFLAGS="$LDFLAGS -Wl,--as-needed"
4657 fi
Bram Moolenaar22e193d2010-11-03 22:32:24 +01004658 LINK_AS_NEEDED=yes
4659fi
4660if test "$LINK_AS_NEEDED" = yes; then
4661 AC_MSG_RESULT(yes)
4662else
4663 AC_MSG_RESULT(no)
4664fi
4665AC_SUBST(LINK_AS_NEEDED)
4666
Bram Moolenaar77c19352012-06-13 19:19:41 +02004667# IBM z/OS reset CFLAGS for config.mk
4668if test "$zOSUnix" = "yes"; then
4669 CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
4670fi
4671
Bram Moolenaar071d4272004-06-13 20:20:40 +00004672dnl write output files
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004673AC_CONFIG_FILES(auto/config.mk:config.mk.in)
4674AC_OUTPUT
Bram Moolenaar071d4272004-06-13 20:20:40 +00004675
4676dnl vim: set sw=2 tw=78 fo+=l: