blob: 294e331364a427807703c50f6498e2e36692a24d [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 +000028AC_HEADER_SYS_WAIT
29
Bram Moolenaar561f8a52018-04-17 22:02:45 +020030dnl Check that the C99 features that Vim uses are supported:
Bram Moolenaar22640082018-04-19 20:39:41 +020031if test x"$ac_cv_prog_cc_c99" != xno; then
32 dnl If the compiler doesn't explicitly support C99, then check
33 dnl for the specific features Vim uses
34
35 AC_TYPE_LONG_LONG_INT
36 if test "$ac_cv_type_long_long_int" = no; then
37 AC_MSG_FAILURE([Compiler does not support long long int])
38 fi
39
40 AC_MSG_CHECKING([if the compiler supports trailing commas])
41 trailing_commas=no
Bram Moolenaar1004b3d2022-06-05 19:51:55 +010042 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
Bram Moolenaar22640082018-04-19 20:39:41 +020043 enum {
44 one,
Bram Moolenaar1004b3d2022-06-05 19:51:55 +010045 };])],
Bram Moolenaar22640082018-04-19 20:39:41 +020046 [AC_MSG_RESULT(yes); trailing_commas=yes],
47 [AC_MSG_RESULT(no)])
48 if test "$trailing_commas" = no; then
49 AC_MSG_FAILURE([Compiler does not support trailing comma in enum])
50 fi
51
52 AC_MSG_CHECKING([if the compiler supports C++ comments])
53 slash_comments=no
Bram Moolenaar1004b3d2022-06-05 19:51:55 +010054 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
55 [// C++ comments?])],
Bram Moolenaar22640082018-04-19 20:39:41 +020056 [AC_MSG_RESULT(yes); slash_comments=yes],
57 [AC_MSG_RESULT(no)])
58 if test "$slash_comments" = no; then
59 AC_MSG_FAILURE([Compiler does not support C++ comments])
60 fi
61fi
Bram Moolenaar561f8a52018-04-17 22:02:45 +020062
Bram Moolenaar8f1dde52020-06-05 23:16:29 +020063dnl If $SOURCE_DATE_EPOCH is present in the environment, use that as the
64dnl "compiled" timestamp in :version's output. Attempt to get the formatted
65dnl date using GNU date syntax, BSD date syntax, and finally falling back to
66dnl just using the current time.
67if test -n "$SOURCE_DATE_EPOCH"; then
68 DATE_FMT="%b %d %Y %H:%M:%S"
69 BUILD_DATE=$(LC_ALL=C date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || LC_ALL=C date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || LC_ALL=C date -u "+$DATE_FMT")
70 AC_DEFINE_UNQUOTED(BUILD_DATE, ["$BUILD_DATE"])
71 BUILD_DATE_MSG=-"echo -e '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\nNOTE: build date/time is fixed: $BUILD_DATE\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='"
72 AC_SUBST(BUILD_DATE_MSG)
73fi
74
Bram Moolenaarf788a062011-12-14 20:51:25 +010075dnl Check for the flag that fails if stuff are missing.
76
77AC_MSG_CHECKING(--enable-fail-if-missing argument)
78AC_ARG_ENABLE(fail_if_missing,
79 [ --enable-fail-if-missing Fail if dependencies on additional features
Bram Moolenaare5303952022-06-19 17:05:47 +010080 specified on the command line are missing.],
Bram Moolenaarf788a062011-12-14 20:51:25 +010081 [fail_if_missing="yes"],
82 [fail_if_missing="no"])
83AC_MSG_RESULT($fail_if_missing)
84
Bram Moolenaard2a05492018-07-27 22:35:15 +020085dnl Keep original value to check later.
86with_x_arg="$with_x"
87
Bram Moolenaar071d4272004-06-13 20:20:40 +000088dnl Set default value for CFLAGS if none is defined or it's empty
89if test -z "$CFLAGS"; then
90 CFLAGS="-O"
Bram Moolenaar4d8479b2021-01-31 14:36:06 +010091 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall -Wno-deprecated-declarations"
Bram Moolenaar071d4272004-06-13 20:20:40 +000092fi
Rose00d07e72023-05-06 18:07:14 +010093
Bram Moolenaar071d4272004-06-13 20:20:40 +000094if test "$GCC" = yes; then
Rose00d07e72023-05-06 18:07:14 +010095 dnl Method that should work for nearly all gcc versions.
Bram Moolenaarc8836f72014-04-12 13:12:24 +020096 gccversion=`$CC -dumpversion`
Bram Moolenaar910f66f2006-04-05 20:41:53 +000097 if test "x$gccversion" = "x"; then
98 dnl old method; fall-back for when -dumpversion doesn't work
Bram Moolenaarc8836f72014-04-12 13:12:24 +020099 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 +0000100 fi
Rose00d07e72023-05-06 18:07:14 +0100101
102 dnl Gcc version 4.0.1 was reported to cause trouble on Macintosh by Marcin
103 dnl Dalecki. For Mac with Intel the symptom reported is: malloc() reports
104 dnl double free. This happens in expand_filename(), because the optimizer
105 dnl swaps two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaara5792f52005-11-23 21:25:05 +0000106 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000107 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
109 else
110 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
111 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
112 CFLAGS="$CFLAGS -fno-strength-reduce"
113 fi
114 fi
115fi
116
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200117dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
118dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on
119dnl the version number of the clang in use.
120dnl Note that this does not work to get the version of clang 3.1 or 3.2.
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100121AC_MSG_CHECKING(for clang version)
122CLANG_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 +0200123if test x"$CLANG_VERSION_STRING" != x"" ; then
124 CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'`
125 CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'`
126 CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'`
127 CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
128 AC_MSG_RESULT($CLANG_VERSION)
129 dnl If you find the same issue with versions earlier than 500.2.75,
130 dnl change the constant 500002075 below appropriately. To get the
131 dnl integer corresponding to a version number, refer to the
132 dnl definition of CLANG_VERSION above.
Bram Moolenaarebd211c2021-01-30 19:33:36 +0100133 dnl Clang 11 reports "11", assume Clang 10 and later work like this.
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100134 AC_MSG_CHECKING(if clang supports -fno-strength-reduce)
Bram Moolenaarebd211c2021-01-30 19:33:36 +0100135 if test "$CLANG_MAJOR" -ge 10 -o "$CLANG_VERSION" -ge 500002075 ; then
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100136 AC_MSG_RESULT(no)
137 CFLAGS=`echo "$CFLAGS" | sed -e 's/-fno-strength-reduce/ /'`
138 else
139 AC_MSG_RESULT(yes)
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200140 fi
141else
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100142 AC_MSG_RESULT(N/A)
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200143fi
144
Bram Moolenaar446cb832008-06-24 21:56:24 +0000145dnl If configure thinks we are cross compiling, there might be something
146dnl wrong with the CC or CFLAGS settings, give a useful warning message
Bram Moolenaar839e9542016-04-14 16:46:02 +0200147CROSS_COMPILING=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000148if test "$cross_compiling" = yes; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000149 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
Bram Moolenaar839e9542016-04-14 16:46:02 +0200150 CROSS_COMPILING=1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000151fi
Bram Moolenaar839e9542016-04-14 16:46:02 +0200152AC_SUBST(CROSS_COMPILING)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000153
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000154dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
155dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000156test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
157
158if test -f ./toolcheck; then
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100159 AC_MSG_CHECKING(for buggy tools)
160 sh ./toolcheck 1>&AS_MESSAGE_FD
Bram Moolenaar071d4272004-06-13 20:20:40 +0000161fi
162
163OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
164
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000165dnl When cross-compiling set $vim_cv_uname_output, $vim_cv_uname_r_output and
166dnl $vim_cv_uname_m_output to the desired value for the target system
167AC_MSG_CHECKING(uname)
168if test "x$vim_cv_uname_output" = "x" ; then
169 vim_cv_uname_output=`(uname) 2>/dev/null`
170 AC_MSG_RESULT($vim_cv_uname_output)
171else
172 AC_MSG_RESULT([$vim_cv_uname_output (cached)])
173fi
174
175AC_MSG_CHECKING(uname -r)
176if test "x$vim_cv_uname_r_output" = "x" ; then
177 vim_cv_uname_r_output=`(uname -r) 2>/dev/null`
178 AC_MSG_RESULT($vim_cv_uname_r_output)
179else
180 AC_MSG_RESULT([$vim_cv_uname_r_output (cached)])
181fi
182
183AC_MSG_CHECKING(uname -m)
184if test "x$vim_cv_uname_m_output" = "x" ; then
185 vim_cv_uname_m_output=`(uname -m) 2>/dev/null`
186 AC_MSG_RESULT($vim_cv_uname_m_output)
187else
188 AC_MSG_RESULT([$vim_cv_uname_m_output (cached)])
189fi
190
Bram Moolenaarb3f74062020-02-26 16:16:53 +0100191AC_MSG_CHECKING(for Haiku)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000192case $vim_cv_uname_output in
Bram Moolenaarb3f74062020-02-26 16:16:53 +0100193 Haiku) HAIKU=yes; AC_MSG_RESULT(yes);;
194 *) HAIKU=no; AC_MSG_RESULT(no);;
195esac
196
Bram Moolenaar071d4272004-06-13 20:20:40 +0000197dnl If QNX is found, assume we don't want to use Xphoton
198dnl unless it was specifically asked for (--with-x)
199AC_MSG_CHECKING(for QNX)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000200case $vim_cv_uname_output in
Bram Moolenaar071d4272004-06-13 20:20:40 +0000201 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
202 test -z "$with_x" && with_x=no
203 QNX=yes; AC_MSG_RESULT(yes);;
204 *) QNX=no; AC_MSG_RESULT(no);;
205esac
206
207dnl Check for Darwin and MacOS X
208dnl We do a check for MacOS X in the very beginning because there
209dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +0000210AC_MSG_CHECKING([for Darwin (Mac OS X)])
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000211if test "$vim_cv_uname_output" = Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000212 AC_MSG_RESULT(yes)
Bram Moolenaard0573012017-10-28 21:11:06 +0200213 MACOS_X=yes
Bram Moolenaar52ecaaa2018-05-12 21:38:13 +0200214 CPPFLAGS="$CPPFLAGS -DMACOS_X"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215
216 AC_MSG_CHECKING(--disable-darwin argument)
217 AC_ARG_ENABLE(darwin,
218 [ --disable-darwin Disable Darwin (Mac OS X) support.],
219 , [enable_darwin="yes"])
220 if test "$enable_darwin" = "yes"; then
221 AC_MSG_RESULT(no)
222 AC_MSG_CHECKING(if Darwin files are there)
Bram Moolenaar164fca32010-07-14 13:58:07 +0200223 if test -f os_macosx.m; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000224 AC_MSG_RESULT(yes)
225 else
226 AC_MSG_RESULT([no, Darwin support disabled])
227 enable_darwin=no
228 fi
229 else
230 AC_MSG_RESULT([yes, Darwin support excluded])
231 fi
232
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000233 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000234 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000235 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000236 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000237
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100238 AC_MSG_CHECKING(--with-developer-dir argument)
239 AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
240 DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
Bram Moolenaar32d03b32015-11-19 13:46:48 +0100241 AC_MSG_RESULT(not present))
Bram Moolenaare5303952022-06-19 17:05:47 +0100242
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100243 if test "x$DEVELOPER_DIR" = "x"; then
244 AC_PATH_PROG(XCODE_SELECT, xcode-select)
245 if test "x$XCODE_SELECT" != "x"; then
246 AC_MSG_CHECKING(for developer dir using xcode-select)
247 DEVELOPER_DIR=`$XCODE_SELECT -print-path`
248 AC_MSG_RESULT([$DEVELOPER_DIR])
249 else
250 DEVELOPER_DIR=/Developer
251 fi
252 fi
253
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000254 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000255 AC_MSG_CHECKING(for 10.4 universal SDK)
256 dnl There is a terrible inconsistency (but we appear to get away with it):
257 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
258 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
259 dnl tests using the preprocessor are actually done with the wrong header
260 dnl files. $LDFLAGS is set at the end, because configure uses it together
261 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000262 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000263 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000264 save_ldflags="$LDFLAGS"
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100265 CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100266 AC_LINK_IFELSE([AC_LANG_PROGRAM([ ], [ ])],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000267 AC_MSG_RESULT(found, will make universal binary),
268
269 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000270 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000271 AC_MSG_CHECKING(if Intel architecture is supported)
272 CPPFLAGS="$CPPFLAGS -arch i386"
273 LDFLAGS="$save_ldflags -arch i386"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100274 AC_LINK_IFELSE([AC_LANG_PROGRAM([ ], [ ])],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000275 AC_MSG_RESULT(yes); MACARCH="intel",
276 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000277 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000278 CPPFLAGS="$save_cppflags -arch ppc"
279 LDFLAGS="$save_ldflags -arch ppc"))
280 elif test "x$MACARCH" = "xintel"; then
281 CPPFLAGS="$CPPFLAGS -arch intel"
282 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000283 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000284 CPPFLAGS="$CPPFLAGS -arch ppc"
285 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000286 fi
287
Bram Moolenaar071d4272004-06-13 20:20:40 +0000288 if test "$enable_darwin" = "yes"; then
Bram Moolenaard0573012017-10-28 21:11:06 +0200289 MACOS_X_DARWIN=yes
Bram Moolenaar164fca32010-07-14 13:58:07 +0200290 OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000291 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaare5303952022-06-19 17:05:47 +0100292 dnl os_macosx.m implements timer_create() and friends
293 AC_DEFINE(HAVE_TIMER_CREATE)
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000294 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaar0958e0f2013-11-04 04:57:50 +0100295 dnl Removed -no-cpp-precomp, only for very old compilers.
Bram Moolenaard0573012017-10-28 21:11:06 +0200296 CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
Bram Moolenaar040f9752020-08-11 23:08:48 +0200297
298 dnl Assume we don't want X11 unless it was specifically asked for
Bram Moolenaar0b40d082022-03-08 13:32:37 +0000299 dnl (--with-x) or Motif or GTK GUI is used.
300 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
Bram Moolenaar040f9752020-08-11 23:08:48 +0200301 with_x=no
302 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303 fi
304else
305 AC_MSG_RESULT(no)
306fi
307
Bram Moolenaar39766a72013-11-03 00:41:00 +0100308dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon
309dnl so we need to include it to have access to version macros.
Bram Moolenaar18e54692013-11-03 20:26:31 +0100310AC_CHECK_HEADERS(AvailabilityMacros.h)
Evan Miller25448072022-12-30 10:42:23 +0000311# 10.5 and earlier lack dispatch
312AC_CHECK_HEADERS(dispatch/dispatch.h)
Bram Moolenaar39766a72013-11-03 00:41:00 +0100313
Bram Moolenaar071d4272004-06-13 20:20:40 +0000314AC_SUBST(OS_EXTRA_SRC)
315AC_SUBST(OS_EXTRA_OBJ)
316
317dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
318dnl Only when the directory exists and it wasn't there yet.
319dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000320dnl Skip all of this when cross-compiling.
321if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000322 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000323 have_local_include=''
324 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000325 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
326 --without-local-dir do not search /usr/local for local libraries.], [
327 local_dir="$withval"
328 case "$withval" in
329 */*) ;;
330 no)
331 # avoid adding local dir to LDFLAGS and CPPFLAGS
Bram Moolenaare06c1882010-07-21 22:05:20 +0200332 have_local_include=yes
Bram Moolenaarc236c162008-07-13 17:41:49 +0000333 have_local_lib=yes
334 ;;
335 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
336 esac
337 AC_MSG_RESULT($local_dir)
338 ], [
339 local_dir=/usr/local
340 AC_MSG_RESULT(Defaulting to $local_dir)
341 ])
342 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000343 echo 'void f(){}' > conftest.c
Bram Moolenaar0958e0f2013-11-04 04:57:50 +0100344 dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler)
345 have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
Bram Moolenaarc236c162008-07-13 17:41:49 +0000346 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000347 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000348 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000349 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
350 tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000351 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000352 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000353 fi
354 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000355 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
356 tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000357 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000358 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000359 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000360 fi
361fi
362
363AC_MSG_CHECKING(--with-vim-name argument)
364AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
365 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000366 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000367AC_SUBST(VIMNAME)
368AC_MSG_CHECKING(--with-ex-name argument)
369AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
370 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
371 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
372AC_SUBST(EXNAME)
373AC_MSG_CHECKING(--with-view-name argument)
374AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
375 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
376 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
377AC_SUBST(VIEWNAME)
378
379AC_MSG_CHECKING(--with-global-runtime argument)
Bram Moolenaar9d302ad2018-12-21 11:48:51 +0100380AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath', comma-separated for multiple directories],
381 RUNTIME_GLOBAL="$withval"; AC_MSG_RESULT($withval),
Bram Moolenaar071d4272004-06-13 20:20:40 +0000382 AC_MSG_RESULT(no))
383
Bram Moolenaar9d302ad2018-12-21 11:48:51 +0100384if test "X$RUNTIME_GLOBAL" != "X"; then
385 RUNTIME_GLOBAL_AFTER=$(printf -- "$RUNTIME_GLOBAL\\n" | $AWK -F, 'BEGIN { comma=0 } { for (i = NF; i > 0; i--) { if (comma) { printf ",%s/after", $i } else { printf "%s/after", $i; comma=1 } } } END { printf "\n" }')
386 AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$RUNTIME_GLOBAL")
387 AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL_AFTER, "$RUNTIME_GLOBAL_AFTER")
388fi
389
Bram Moolenaar071d4272004-06-13 20:20:40 +0000390AC_MSG_CHECKING(--with-modified-by argument)
391AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
392 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
393 AC_MSG_RESULT(no))
394
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200395dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000396AC_MSG_CHECKING(if character set is EBCDIC)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100397AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ],
Bram Moolenaar071d4272004-06-13 20:20:40 +0000398[ /* TryCompile function for CharSet.
399 Treat any failure as ASCII for compatibility with existing art.
400 Use compile-time rather than run-time tests for cross-compiler
401 tolerance. */
402#if '0'!=240
403make an error "Character set is not EBCDIC"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100404#endif ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +0000405[ # TryCompile action if true
406cf_cv_ebcdic=yes ],
407[ # TryCompile action if false
408cf_cv_ebcdic=no])
409# end of TryCompile ])
410# end of CacheVal CvEbcdic
411AC_MSG_RESULT($cf_cv_ebcdic)
412case "$cf_cv_ebcdic" in #(vi
413 yes) AC_DEFINE(EBCDIC)
414 line_break='"\\n"'
415 ;;
416 *) line_break='"\\012"';;
417esac
418AC_SUBST(line_break)
419
420if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar84a05ac2013-05-06 04:24:17 +0200421dnl If we have EBCDIC we most likely have z/OS Unix, let's test it!
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200422AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000423case $vim_cv_uname_output in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200424 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000425 dnl If using cc the environment variable _CC_CCMODE must be
426 dnl set to "1", so that some compiler extensions are enabled.
427 dnl If using c89 the environment variable is named _CC_C89MODE.
428 dnl Note: compile with c89 never tested.
429 if test "$CC" = "cc"; then
430 ccm="$_CC_CCMODE"
431 ccn="CC"
432 else
433 if test "$CC" = "c89"; then
434 ccm="$_CC_C89MODE"
435 ccn="C89"
436 else
437 ccm=1
438 fi
439 fi
440 if test "$ccm" != "1"; then
441 echo ""
442 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200443 echo " On z/OS Unix, the environment variable"
Bram Moolenaar77c19352012-06-13 19:19:41 +0200444 echo " _CC_${ccn}MODE must be set to \"1\"!"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000445 echo " Do:"
446 echo " export _CC_${ccn}MODE=1"
447 echo " and then call configure again."
448 echo "------------------------------------------"
449 exit 1
450 fi
Bram Moolenaar77c19352012-06-13 19:19:41 +0200451 # Set CFLAGS for configure process.
452 # This will be reset later for config.mk.
453 # Use haltonmsg to force error for missing H files.
454 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
455 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000456 AC_MSG_RESULT(yes)
457 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200458 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000459 AC_MSG_RESULT(no)
460 ;;
461esac
462fi
463
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200464dnl Set QUOTESED. Needs additional backslashes on zOS
465if test "$zOSUnix" = "yes"; then
Bram Moolenaarabcbb0e2020-12-23 12:33:42 +0100466 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/' -e 's/ */ /g'"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200467else
Bram Moolenaarabcbb0e2020-12-23 12:33:42 +0100468 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/' -e 's/ */ /g'"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200469fi
470AC_SUBST(QUOTESED)
471
472
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200473dnl Link with -lsmack for Smack stuff; if not found
474AC_MSG_CHECKING(--disable-smack argument)
475AC_ARG_ENABLE(smack,
476 [ --disable-smack Do not check for Smack support.],
477 , enable_smack="yes")
478if test "$enable_smack" = "yes"; then
Bram Moolenaar4ed89cd2014-04-05 12:02:25 +0200479 AC_MSG_RESULT(no)
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200480 AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no")
Bram Moolenaar4ed89cd2014-04-05 12:02:25 +0200481else
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200482 AC_MSG_RESULT(yes)
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200483fi
484if test "$enable_smack" = "yes"; then
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200485 AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no")
486fi
487if test "$enable_smack" = "yes"; then
488 AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h)
489 AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>],
490 AC_MSG_RESULT(yes),
Bram Moolenaare29b1fe2014-04-10 20:00:15 +0200491 AC_MSG_RESULT(no); enable_smack="no")
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200492fi
493if test "$enable_smack" = "yes"; then
494 AC_CHECK_LIB(attr, setxattr,
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200495 [LIBS="$LIBS -lattr"
496 found_smack="yes"
497 AC_DEFINE(HAVE_SMACK)])
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000498fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000499
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200500dnl When smack was found don't search for SELinux
501if test "x$found_smack" = "x"; then
502 dnl Link with -lselinux for SELinux stuff; if not found
503 AC_MSG_CHECKING(--disable-selinux argument)
504 AC_ARG_ENABLE(selinux,
505 [ --disable-selinux Do not check for SELinux support.],
506 , enable_selinux="yes")
507 if test "$enable_selinux" = "yes"; then
508 AC_MSG_RESULT(no)
509 AC_CHECK_LIB(selinux, is_selinux_enabled,
Bram Moolenaare4b78e22017-12-07 22:29:11 +0100510 [AC_CHECK_HEADER(selinux/selinux.h,
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200511 [LIBS="$LIBS -lselinux"
Bram Moolenaare4b78e22017-12-07 22:29:11 +0100512 AC_DEFINE(HAVE_SELINUX)])])
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200513 else
514 AC_MSG_RESULT(yes)
515 fi
516fi
517
Bram Moolenaar071d4272004-06-13 20:20:40 +0000518dnl Check user requested features.
519
520AC_MSG_CHECKING(--with-features argument)
Martin Tournoij25f3a142022-10-08 19:26:41 +0100521AC_ARG_WITH(features, [ --with-features=TYPE tiny, normal or huge (default: huge)],
Bram Moolenaar071d4272004-06-13 20:20:40 +0000522 features="$withval"; AC_MSG_RESULT($features),
Bram Moolenaar23c4f712016-01-20 22:11:59 +0100523 features="huge"; AC_MSG_RESULT(Defaulting to huge))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000524
Martin Tournoij7904fa42022-10-04 16:28:45 +0100525dnl "small" is supported for backwards compatibility, now an alias for "tiny"
Martin Tournoij25f3a142022-10-08 19:26:41 +0100526dnl "big" is supported for backwards compatibility, now an alias for "normal"
Martin Tournoij7904fa42022-10-04 16:28:45 +0100527case "$features" in
Martin Tournoij25f3a142022-10-08 19:26:41 +0100528 small) features="tiny" ;;
529 big) features="normal" ;;
Martin Tournoij7904fa42022-10-04 16:28:45 +0100530esac
531
Bram Moolenaar071d4272004-06-13 20:20:40 +0000532dovimdiff=""
533dogvimdiff=""
534case "$features" in
535 tiny) AC_DEFINE(FEAT_TINY) ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +0000536 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
537 dogvimdiff="installgvimdiff" ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +0000538 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
539 dogvimdiff="installgvimdiff" ;;
540 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
541esac
542
543AC_SUBST(dovimdiff)
544AC_SUBST(dogvimdiff)
545
Martin Tournoij7904fa42022-10-04 16:28:45 +0100546if test "x$features" = "xtiny"; then
Bram Moolenaar12471262022-01-18 11:11:25 +0000547 has_eval=no
548else
549 has_eval=yes
550fi
551
Bram Moolenaar071d4272004-06-13 20:20:40 +0000552AC_MSG_CHECKING(--with-compiledby argument)
553AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
554 compiledby="$withval"; AC_MSG_RESULT($withval),
555 compiledby=""; AC_MSG_RESULT(no))
556AC_SUBST(compiledby)
557
558AC_MSG_CHECKING(--disable-xsmp argument)
559AC_ARG_ENABLE(xsmp,
560 [ --disable-xsmp Disable XSMP session management],
561 , enable_xsmp="yes")
562
563if test "$enable_xsmp" = "yes"; then
564 AC_MSG_RESULT(no)
565 AC_MSG_CHECKING(--disable-xsmp-interact argument)
566 AC_ARG_ENABLE(xsmp-interact,
567 [ --disable-xsmp-interact Disable XSMP interaction],
568 , enable_xsmp_interact="yes")
569 if test "$enable_xsmp_interact" = "yes"; then
570 AC_MSG_RESULT(no)
571 AC_DEFINE(USE_XSMP_INTERACT)
572 else
573 AC_MSG_RESULT(yes)
574 fi
575else
576 AC_MSG_RESULT(yes)
577fi
578
Bram Moolenaar67ffb412022-01-08 13:36:57 +0000579AC_MSG_CHECKING([diff feature])
Martin Tournoij7904fa42022-10-04 16:28:45 +0100580if test "x$features" = "xtiny"; then
Bram Moolenaar67ffb412022-01-08 13:36:57 +0000581 AC_MSG_RESULT([disabled in $features version])
582else
583 AC_MSG_RESULT(enabled)
584 AC_DEFINE(FEAT_DIFF)
585 XDIFF_OBJS_USED="\$(XDIFF_OBJS)"
586 AC_SUBST(XDIFF_OBJS_USED)
587fi
588
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200589dnl Check for Lua feature.
590AC_MSG_CHECKING(--enable-luainterp argument)
591AC_ARG_ENABLE(luainterp,
Bram Moolenaar8008b632017-07-18 21:33:20 +0200592 [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200593 [enable_luainterp="no"])
594AC_MSG_RESULT($enable_luainterp)
595
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200596if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +0000597 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +0100598 AC_MSG_ERROR([cannot use Lua with tiny features])
Bram Moolenaar3c124e32016-01-31 14:36:58 +0100599 fi
600
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200601 dnl -- find the lua executable
602 AC_SUBST(vi_cv_path_lua)
603
604 AC_MSG_CHECKING(--with-lua-prefix argument)
605 AC_ARG_WITH(lua_prefix,
606 [ --with-lua-prefix=PFX Prefix where Lua is installed.],
607 with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200608 with_lua_prefix="";AC_MSG_RESULT(no))
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200609
610 if test "X$with_lua_prefix" != "X"; then
611 vi_cv_path_lua_pfx="$with_lua_prefix"
612 else
613 AC_MSG_CHECKING(LUA_PREFIX environment var)
614 if test "X$LUA_PREFIX" != "X"; then
615 AC_MSG_RESULT("$LUA_PREFIX")
616 vi_cv_path_lua_pfx="$LUA_PREFIX"
617 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200618 AC_MSG_RESULT([not set, default to /usr])
619 vi_cv_path_lua_pfx="/usr"
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200620 fi
621 fi
622
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200623 AC_MSG_CHECKING(--with-luajit)
624 AC_ARG_WITH(luajit,
625 [ --with-luajit Link with LuaJIT instead of Lua.],
626 [vi_cv_with_luajit="$withval"],
627 [vi_cv_with_luajit="no"])
628 AC_MSG_RESULT($vi_cv_with_luajit)
629
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200630 LUA_INC=
631 if test "X$vi_cv_path_lua_pfx" != "X"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200632 if test "x$vi_cv_with_luajit" != "xno"; then
633 dnl -- try to find LuaJIT executable
634 AC_PATH_PROG(vi_cv_path_luajit, luajit)
635 if test "X$vi_cv_path_luajit" != "X"; then
636 dnl -- find LuaJIT version
637 AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit,
ichizokbddc6ad2023-08-29 20:54:32 +0200638 [ 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 +0200639 AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit,
640 [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ])
641 vi_cv_path_lua="$vi_cv_path_luajit"
642 vi_cv_version_lua="$vi_cv_version_lua_luajit"
643 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200644 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200645 dnl -- try to find Lua executable
646 AC_PATH_PROG(vi_cv_path_plain_lua, lua)
647 if test "X$vi_cv_path_plain_lua" != "X"; then
648 dnl -- find Lua version
649 AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua,
650 [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
651 fi
652 vi_cv_path_lua="$vi_cv_path_plain_lua"
653 vi_cv_version_lua="$vi_cv_version_plain_lua"
654 fi
655 if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then
656 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit)
Bram Moolenaar49222be2015-12-11 18:11:30 +0100657 if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200658 AC_MSG_RESULT(yes)
659 LUA_INC=/luajit-$vi_cv_version_luajit
660 fi
661 fi
662 if test "X$LUA_INC" = "X"; then
663 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
Bram Moolenaar49222be2015-12-11 18:11:30 +0100664 if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200665 AC_MSG_RESULT(yes)
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200666 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200667 AC_MSG_RESULT(no)
668 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
Bram Moolenaar49222be2015-12-11 18:11:30 +0100669 if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200670 AC_MSG_RESULT(yes)
671 LUA_INC=/lua$vi_cv_version_lua
672 else
673 AC_MSG_RESULT(no)
Bram Moolenaarf49e5642020-04-19 17:46:53 +0200674
675 # Detect moonjit:
676 # https://groups.google.com/forum/#!topic/vim_use/O0vek60WuTk
677 lua_suf=/moonjit-2.3
678 inc_path="$vi_cv_path_lua_pfx/include"
Bram Moolenaarad4dc832020-04-20 16:21:53 +0200679 for dir in "$inc_path"/moonjit-[[0-9]]* ; do
Bram Moolenaarf49e5642020-04-19 17:46:53 +0200680 if test -d "$dir" ; then
Bram Moolenaara79a8942020-12-17 20:50:25 +0100681 lua_suf=`basename "$dir"`
Bram Moolenaarf49e5642020-04-19 17:46:53 +0200682 lua_suf="/$lua_suf"
683 break
684 fi
685 done
686 AC_MSG_CHECKING(if lua.h can be found in $inc_path$lua_suf)
687 if test -f "$inc_path$lua_suf/lua.h"; then
688 AC_MSG_RESULT(yes)
689 LUA_INC=$lua_suf
690 else
691 AC_MSG_RESULT(no)
692 vi_cv_path_lua_pfx=
693 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200694 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200695 fi
696 fi
697 fi
698
699 if test "X$vi_cv_path_lua_pfx" != "X"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200700 if test "x$vi_cv_with_luajit" != "xno"; then
701 multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
702 if test "X$multiarch" != "X"; then
703 lib_multiarch="lib/${multiarch}"
704 else
705 lib_multiarch="lib"
706 fi
707 if test "X$vi_cv_version_lua" = "X"; then
708 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit"
709 else
710 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua"
711 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200712 else
Bram Moolenaar869113f2023-03-31 21:29:00 +0100713 dnl Test alternate lib location including version
714 if test -d "${vi_cv_path_lua_pfx}/lib/lua$vi_cv_version_lua"; then
715 LUALIBDIR="lib/lua$vi_cv_version_lua"
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200716 else
Bram Moolenaar869113f2023-03-31 21:29:00 +0100717 LUALIBDIR=lib
718 fi
719 if test "X$LUA_INC" != "X"; then
720 dnl Test alternate name including version
721 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${LUALIBDIR} -llua$vi_cv_version_lua"
722 else
723 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${LUALIBDIR} -llua"
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200724 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200725 fi
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200726 if test "$enable_luainterp" = "dynamic"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200727 lua_ok="yes"
728 else
729 AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane])
730 libs_save=$LIBS
731 LIBS="$LIBS $LUA_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +0100732 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200733 AC_MSG_RESULT(yes); lua_ok="yes",
734 AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="")
735 LIBS=$libs_save
736 fi
737 if test "x$lua_ok" = "xyes"; then
738 LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
739 LUA_SRC="if_lua.c"
740 LUA_OBJ="objects/if_lua.o"
741 LUA_PRO="if_lua.pro"
742 AC_DEFINE(FEAT_LUA)
743 fi
744 if test "$enable_luainterp" = "dynamic"; then
745 if test "x$vi_cv_with_luajit" != "xno"; then
746 luajit="jit"
747 fi
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200748 if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
749 vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
750 else
Bram Moolenaard0573012017-10-28 21:11:06 +0200751 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200752 ext="dylib"
753 indexes=""
754 else
755 ext="so"
756 indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9"
757 multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
758 if test "X$multiarch" != "X"; then
759 lib_multiarch="lib/${multiarch}"
760 fi
Bram Moolenaar768baac2013-04-15 14:44:57 +0200761 fi
762 dnl Determine the sover for the current version, but fallback to
763 dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found.
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200764 AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx)
Bram Moolenaar768baac2013-04-15 14:44:57 +0200765 for subdir in "${lib_multiarch}" lib64 lib; do
766 if test -z "$subdir"; then
767 continue
768 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200769 for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \
770 ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do
771 for i in $indexes ""; do
772 if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then
Bram Moolenaar768baac2013-04-15 14:44:57 +0200773 sover2="$i"
774 break 3
775 fi
776 done
Bram Moolenaar07e1da62013-02-06 19:49:43 +0100777 done
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200778 sover=""
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200779 done
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200780 if test "X$sover" = "X"; then
781 AC_MSG_RESULT(no)
782 lua_ok="no"
783 vi_cv_dll_name_lua="liblua${luajit}.${ext}"
784 else
785 AC_MSG_RESULT(yes)
786 lua_ok="yes"
787 vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2"
788 fi
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200789 fi
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200790 AC_DEFINE(DYNAMIC_LUA)
791 LUA_LIBS=""
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200792 LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS"
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200793 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200794 if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \
Bram Moolenaard0573012017-10-28 21:11:06 +0200795 test "x$MACOS_X" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000796 test "$vim_cv_uname_m_output" = "x86_64"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200797 dnl OSX/x64 requires these flags. See http://luajit.org/install.html
798 LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS"
799 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200800 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200801 if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then
Bram Moolenaarf788a062011-12-14 20:51:25 +0100802 AC_MSG_ERROR([could not configure lua])
803 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200804 AC_SUBST(LUA_SRC)
805 AC_SUBST(LUA_OBJ)
806 AC_SUBST(LUA_PRO)
807 AC_SUBST(LUA_LIBS)
808 AC_SUBST(LUA_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +0000809 AC_SUBST(LUA_CFLAGS_EXTRA)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200810fi
811
812
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000813dnl Check for MzScheme feature.
814AC_MSG_CHECKING(--enable-mzschemeinterp argument)
815AC_ARG_ENABLE(mzschemeinterp,
Bram Moolenaar8008b632017-07-18 21:33:20 +0200816 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000817 [enable_mzschemeinterp="no"])
818AC_MSG_RESULT($enable_mzschemeinterp)
819
820if test "$enable_mzschemeinterp" = "yes"; then
821 dnl -- find the mzscheme executable
822 AC_SUBST(vi_cv_path_mzscheme)
823
824 AC_MSG_CHECKING(--with-plthome argument)
825 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000826 [ --with-plthome=PLTHOME Use PLTHOME.],
827 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000828 with_plthome="";AC_MSG_RESULT("no"))
829
830 if test "X$with_plthome" != "X"; then
831 vi_cv_path_mzscheme_pfx="$with_plthome"
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100832 vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000833 else
834 AC_MSG_CHECKING(PLTHOME environment var)
835 if test "X$PLTHOME" != "X"; then
836 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000837 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100838 vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000839 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000840 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000841 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000842 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000843
844 dnl resolve symbolic link, the executable is often elsewhere and there
845 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000846 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000847 lsout=`ls -l $vi_cv_path_mzscheme`
848 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
849 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
850 fi
851 fi
852
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000853 if test "X$vi_cv_path_mzscheme" != "X"; then
854 dnl -- find where MzScheme thinks it was installed
855 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000856 dnl different versions of MzScheme differ in command line processing
857 dnl use universal approach
858 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000859 (build-path (call-with-values \
860 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000861 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
862 dnl Remove a trailing slash
863 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
864 sed -e 's+/$++'` ])
865 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000866 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000867 fi
868 fi
869
870 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100871 AC_MSG_CHECKING(for racket include directory)
872 SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'`
873 if test "X$SCHEME_INC" != "X"; then
874 AC_MSG_RESULT(${SCHEME_INC})
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000875 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100876 AC_MSG_RESULT(not found)
877 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
878 if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then
879 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000880 AC_MSG_RESULT(yes)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000881 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000882 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100883 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
884 if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000885 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100886 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000887 else
888 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100889 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket)
890 if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100891 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100892 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100893 else
894 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100895 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
896 if test -f /usr/include/plt/scheme.h; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100897 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100898 SCHEME_INC=/usr/include/plt
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100899 else
900 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100901 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/)
902 if test -f /usr/include/racket/scheme.h; then
903 AC_MSG_RESULT(yes)
904 SCHEME_INC=/usr/include/racket
905 else
906 AC_MSG_RESULT(no)
907 vi_cv_path_mzscheme_pfx=
908 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100909 fi
910 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000911 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000912 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000913 fi
914 fi
915
916 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100917
918 AC_MSG_CHECKING(for racket lib directory)
919 SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'`
920 if test "X$SCHEME_LIB" != "X"; then
921 AC_MSG_RESULT(${SCHEME_LIB})
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000922 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100923 AC_MSG_RESULT(not found)
924 fi
925
926 for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
927 if test "X$path" != "X"; then
Bram Moolenaard0573012017-10-28 21:11:06 +0200928 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100929 MZSCHEME_LIBS="-framework Racket"
930 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
931 elif test -f "${path}/libmzscheme3m.a"; then
932 MZSCHEME_LIBS="${path}/libmzscheme3m.a"
933 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
934 elif test -f "${path}/libracket3m.a"; then
935 MZSCHEME_LIBS="${path}/libracket3m.a"
Bram Moolenaar588d2412020-10-03 14:24:19 +0200936 if test -f "${path}/librktio.a"; then
937 MZSCHEME_LIBS="${MZSCHEME_LIBS} ${path}/librktio.a"
938 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100939 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
940 elif test -f "${path}/libracket.a"; then
941 MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a"
942 elif test -f "${path}/libmzscheme.a"; then
943 MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a"
944 else
945 dnl Using shared objects
946 if test -f "${path}/libmzscheme3m.so"; then
947 MZSCHEME_LIBS="-L${path} -lmzscheme3m"
948 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
949 elif test -f "${path}/libracket3m.so"; then
950 MZSCHEME_LIBS="-L${path} -lracket3m"
951 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
952 elif test -f "${path}/libracket.so"; then
953 MZSCHEME_LIBS="-L${path} -lracket -lmzgc"
954 else
955 dnl try next until last
956 if test "$path" != "$SCHEME_LIB"; then
957 continue
958 fi
959 MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc"
960 fi
961 if test "$GCC" = yes; then
962 dnl Make Vim remember the path to the library. For when it's not in
963 dnl $LD_LIBRARY_PATH.
964 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +0000965 elif test "$vim_cv_uname_output" = SunOS &&
966 echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100967 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}"
968 fi
969 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000970 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100971 if test "X$MZSCHEME_LIBS" != "X"; then
972 break
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000973 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100974 done
975
976 AC_MSG_CHECKING([if racket requires -pthread])
977 if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then
978 AC_MSG_RESULT(yes)
979 MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread"
980 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread"
981 else
982 AC_MSG_RESULT(no)
983 fi
984
985 AC_MSG_CHECKING(for racket config directory)
986 SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'`
987 if test "X$SCHEME_CONFIGDIR" != "X"; then
988 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'"
989 AC_MSG_RESULT(${SCHEME_CONFIGDIR})
990 else
991 AC_MSG_RESULT(not found)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000992 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100993
994 AC_MSG_CHECKING(for racket collects directory)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100995 SCHEME_COLLECTS=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-collects-dir))) (when (path? p) (let-values (((base _1 _2) (split-path p))) (display base))))'`
996 if test "X$SCHEME_COLLECTS" = "X"; then
997 if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then
998 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100999 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +01001000 if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then
1001 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/
Bram Moolenaar75676462013-01-30 14:55:42 +01001002 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +01001003 if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then
1004 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
1005 else
1006 if test -d "$vi_cv_path_mzscheme_pfx/collects"; then
1007 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
1008 fi
Bram Moolenaar75676462013-01-30 14:55:42 +01001009 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001010 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +01001011 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +00001012 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001013 if test "X$SCHEME_COLLECTS" != "X" ; then
1014 AC_MSG_RESULT(${SCHEME_COLLECTS})
1015 else
1016 AC_MSG_RESULT(not found)
1017 fi
1018
1019 AC_MSG_CHECKING(for mzscheme_base.c)
1020 if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001021 MZSCHEME_EXTRA="mzscheme_base.c"
Bram Moolenaar45e2bcc2014-02-15 17:19:00 +01001022 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
1023 MZSCHEME_MOD="++lib scheme/base"
Bram Moolenaar2d0860d2010-11-03 21:59:30 +01001024 else
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001025 if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +01001026 MZSCHEME_EXTRA="mzscheme_base.c"
Bram Moolenaar45e2bcc2014-02-15 17:19:00 +01001027 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
1028 MZSCHEME_MOD="++lib scheme/base"
1029 else
1030 if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then
1031 MZSCHEME_EXTRA="mzscheme_base.c"
1032 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool"
1033 MZSCHEME_MOD=""
1034 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +01001035 fi
1036 fi
1037 if test "X$MZSCHEME_EXTRA" != "X" ; then
1038 dnl need to generate bytecode for MzScheme base
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001039 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001040 AC_MSG_RESULT(needed)
1041 else
1042 AC_MSG_RESULT(not needed)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001043 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001044
Bram Moolenaar9e902192013-07-17 18:58:11 +02001045 dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'".
1046 AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"])
1047
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001048 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaarfe9fb922012-11-23 21:54:48 +01001049 -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar9e902192013-07-17 18:58:11 +02001050
1051 dnl Test that we can compile a simple program with these CFLAGS and LIBS.
1052 AC_MSG_CHECKING([if compile and link flags for MzScheme are sane])
1053 cflags_save=$CFLAGS
1054 libs_save=$LIBS
1055 CFLAGS="$CFLAGS $MZSCHEME_CFLAGS"
1056 LIBS="$LIBS $MZSCHEME_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001057 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar9e902192013-07-17 18:58:11 +02001058 AC_MSG_RESULT(yes); mzs_ok=yes,
1059 AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no)
1060 CFLAGS=$cflags_save
1061 LIBS=$libs_save
1062 if test $mzs_ok = yes; then
1063 MZSCHEME_SRC="if_mzsch.c"
1064 MZSCHEME_OBJ="objects/if_mzsch.o"
1065 MZSCHEME_PRO="if_mzsch.pro"
1066 AC_DEFINE(FEAT_MZSCHEME)
1067 else
1068 MZSCHEME_CFLAGS=
1069 MZSCHEME_LIBS=
1070 MZSCHEME_EXTRA=
1071 MZSCHEME_MZC=
1072 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001073 fi
1074 AC_SUBST(MZSCHEME_SRC)
1075 AC_SUBST(MZSCHEME_OBJ)
1076 AC_SUBST(MZSCHEME_PRO)
1077 AC_SUBST(MZSCHEME_LIBS)
1078 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +00001079 AC_SUBST(MZSCHEME_EXTRA)
1080 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001081fi
1082
1083
Bram Moolenaar071d4272004-06-13 20:20:40 +00001084AC_MSG_CHECKING(--enable-perlinterp argument)
1085AC_ARG_ENABLE(perlinterp,
Bram Moolenaare06c1882010-07-21 22:05:20 +02001086 [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001087 [enable_perlinterp="no"])
1088AC_MSG_RESULT($enable_perlinterp)
Bram Moolenaare06c1882010-07-21 22:05:20 +02001089if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00001090 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01001091 AC_MSG_ERROR([cannot use Perl with tiny features])
Bram Moolenaar3c124e32016-01-31 14:36:58 +01001092 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001093 AC_SUBST(vi_cv_path_perl)
1094 AC_PATH_PROG(vi_cv_path_perl, perl)
1095 if test "X$vi_cv_path_perl" != "X"; then
1096 AC_MSG_CHECKING(Perl version)
1097 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
1098 eval `$vi_cv_path_perl -V:usethreads`
Bram Moolenaare06c1882010-07-21 22:05:20 +02001099 eval `$vi_cv_path_perl -V:libperl`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001100 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
1101 badthreads=no
1102 else
1103 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
1104 eval `$vi_cv_path_perl -V:use5005threads`
1105 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
1106 badthreads=no
1107 else
1108 badthreads=yes
1109 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
1110 fi
1111 else
1112 badthreads=yes
1113 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
1114 fi
1115 fi
1116 if test $badthreads = no; then
1117 AC_MSG_RESULT(OK)
1118 eval `$vi_cv_path_perl -V:shrpenv`
1119 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
1120 shrpenv=""
1121 fi
1122 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
1123 AC_SUBST(vi_cv_perllib)
Bram Moolenaard5f62b12014-08-17 17:05:44 +02001124 vi_cv_perl_extutils=unknown_perl_extutils_path
1125 for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do
1126 xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp"
1127 if test -f "$xsubpp_path"; then
1128 vi_cv_perl_xsubpp="$xsubpp_path"
1129 fi
1130 done
1131 AC_SUBST(vi_cv_perl_xsubpp)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001132 dnl Remove "-fno-something", it breaks using cproto.
Bram Moolenaar280a8682015-06-21 13:41:08 +02001133 dnl Remove "-fdebug-prefix-map", it isn't supported by clang.
Bram Moolenaare8ff56b2017-09-14 23:06:23 +02001134 dnl Remove "FORTIFY_SOURCE", it will be defined twice.
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001135 dnl remove -pipe and -Wxxx, it confuses cproto
Bram Moolenaar071d4272004-06-13 20:20:40 +00001136 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
Bram Moolenaare8ff56b2017-09-14 23:06:23 +02001137 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \
1138 -e 's/-fdebug-prefix-map[[^ ]]*//g' \
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001139 -e 's/-pipe //' \
1140 -e 's/-W[[^ ]]*//g' \
1141 -e 's/-D_FORTIFY_SOURCE=.//g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001142 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
1143 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
1144 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
1145 -e 's/-bE:perl.exp//' -e 's/-lc //'`
1146 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
1147 dnl a test in configure may fail because of that.
1148 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
1149 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
1150
1151 dnl check that compiling a simple program still works with the flags
1152 dnl added for Perl.
1153 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
1154 cflags_save=$CFLAGS
1155 libs_save=$LIBS
1156 ldflags_save=$LDFLAGS
1157 CFLAGS="$CFLAGS $perlcppflags"
1158 LIBS="$LIBS $perllibs"
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001159 perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001160 LDFLAGS="$perlldflags $LDFLAGS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001161 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001162 AC_MSG_RESULT(yes); perl_ok=yes,
1163 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
1164 CFLAGS=$cflags_save
1165 LIBS=$libs_save
1166 LDFLAGS=$ldflags_save
1167 if test $perl_ok = yes; then
1168 if test "X$perlcppflags" != "X"; then
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001169 PERL_CFLAGS=$perlcppflags
Bram Moolenaar071d4272004-06-13 20:20:40 +00001170 fi
1171 if test "X$perlldflags" != "X"; then
Bram Moolenaar2bcaec32014-03-27 18:51:11 +01001172 if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001173 LDFLAGS="$perlldflags $LDFLAGS"
1174 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001175 fi
1176 PERL_LIBS=$perllibs
1177 PERL_SRC="auto/if_perl.c if_perlsfio.c"
1178 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
1179 PERL_PRO="if_perl.pro if_perlsfio.pro"
1180 AC_DEFINE(FEAT_PERL)
1181 fi
1182 fi
1183 else
1184 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
1185 fi
1186 fi
1187
Bram Moolenaard0573012017-10-28 21:11:06 +02001188 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +00001189 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +00001190 dir=/System/Library/Perl
1191 darwindir=$dir/darwin
1192 if test -d $darwindir; then
1193 PERL=/usr/bin/perl
1194 else
1195 dnl Mac OS X 10.3
1196 dir=/System/Library/Perl/5.8.1
1197 darwindir=$dir/darwin-thread-multi-2level
1198 if test -d $darwindir; then
1199 PERL=/usr/bin/perl
1200 fi
1201 fi
1202 if test -n "$PERL"; then
1203 PERL_DIR="$dir"
1204 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
1205 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
1206 PERL_LIBS="-L$darwindir/CORE -lperl"
1207 fi
Bram Moolenaar5dff57d2010-07-24 16:19:44 +02001208 dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only
1209 dnl be included if requested by passing --with-mac-arch to
1210 dnl configure, so strip these flags first (if present)
1211 PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
1212 PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001213 fi
Bram Moolenaare06c1882010-07-21 22:05:20 +02001214 if test "$enable_perlinterp" = "dynamic"; then
1215 if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
1216 AC_DEFINE(DYNAMIC_PERL)
1217 PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
1218 fi
1219 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001220
1221 if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then
1222 AC_MSG_ERROR([could not configure perl])
1223 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001224fi
1225AC_SUBST(shrpenv)
1226AC_SUBST(PERL_SRC)
1227AC_SUBST(PERL_OBJ)
1228AC_SUBST(PERL_PRO)
1229AC_SUBST(PERL_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00001230AC_SUBST(PERL_CFLAGS_EXTRA)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001231AC_SUBST(PERL_LIBS)
1232
1233AC_MSG_CHECKING(--enable-pythoninterp argument)
1234AC_ARG_ENABLE(pythoninterp,
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001235 [ --enable-pythoninterp[=OPTS] Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001236 [enable_pythoninterp="no"])
1237AC_MSG_RESULT($enable_pythoninterp)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001238if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00001239 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01001240 AC_MSG_ERROR([cannot use Python with tiny features])
Bram Moolenaar0b105412014-11-30 13:34:23 +01001241 fi
1242
Bram Moolenaar071d4272004-06-13 20:20:40 +00001243 dnl -- find the python executable
Bram Moolenaare1a32312018-04-15 16:03:25 +02001244 AC_MSG_CHECKING(--with-python-command argument)
1245 AC_SUBST(vi_cv_path_python)
1246 AC_ARG_WITH(python-command, [ --with-python-command=NAME name of the Python 2 command (default: python2 or python)],
1247 vi_cv_path_python="$withval"; AC_MSG_RESULT($vi_cv_path_python),
1248 AC_MSG_RESULT(no))
1249
1250 if test "X$vi_cv_path_python" = "X"; then
1251 AC_PATH_PROGS(vi_cv_path_python, python2 python)
1252 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001253 if test "X$vi_cv_path_python" != "X"; then
1254
1255 dnl -- get its version number
1256 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
1257 [[vi_cv_var_python_version=`
1258 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
1259 ]])
1260
Bram Moolenaarc09a6d62013-06-10 21:27:29 +02001261 dnl -- it must be at least version 2.3
1262 AC_MSG_CHECKING(Python is 2.3 or better)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001263 if ${vi_cv_path_python} -c \
Bram Moolenaarc09a6d62013-06-10 21:27:29 +02001264 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001265 then
1266 AC_MSG_RESULT(yep)
1267
1268 dnl -- find where python thinks it was installed
1269 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
1270 [ vi_cv_path_python_pfx=`
1271 ${vi_cv_path_python} -c \
1272 "import sys; print sys.prefix"` ])
1273
1274 dnl -- and where it thinks it runs
1275 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
1276 [ vi_cv_path_python_epfx=`
1277 ${vi_cv_path_python} -c \
1278 "import sys; print sys.exec_prefix"` ])
1279
1280 dnl -- python's internal library path
1281
1282 AC_CACHE_VAL(vi_cv_path_pythonpath,
1283 [ vi_cv_path_pythonpath=`
1284 unset PYTHONPATH;
1285 ${vi_cv_path_python} -c \
1286 "import sys, string; print string.join(sys.path,':')"` ])
1287
1288 dnl -- where the Python implementation library archives are
1289
1290 AC_ARG_WITH(python-config-dir,
Bram Moolenaare1a32312018-04-15 16:03:25 +02001291 [ --with-python-config-dir=PATH Python's config directory (deprecated)],
Bram Moolenaard0882402018-04-10 18:13:05 +02001292 [ vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 ] )
Bram Moolenaar071d4272004-06-13 20:20:40 +00001293
1294 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
1295 [
1296 vi_cv_path_python_conf=
Bram Moolenaarac499e32013-06-02 19:14:17 +02001297 d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
1298 if test -d "$d" && test -f "$d/config.c"; then
1299 vi_cv_path_python_conf="$d"
1300 else
1301 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
1302 for subdir in lib64 lib share; do
1303 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
1304 if test -d "$d" && test -f "$d/config.c"; then
1305 vi_cv_path_python_conf="$d"
1306 fi
1307 done
Bram Moolenaar071d4272004-06-13 20:20:40 +00001308 done
Bram Moolenaarac499e32013-06-02 19:14:17 +02001309 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001310 ])
1311
1312 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
1313
1314 if test "X$PYTHON_CONFDIR" = "X"; then
1315 AC_MSG_RESULT([can't find it!])
1316 else
1317
1318 dnl -- we need to examine Python's config/Makefile too
1319 dnl see what the interpreter is built from
1320 AC_CACHE_VAL(vi_cv_path_python_plibs,
1321 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +00001322 pwd=`pwd`
1323 tmp_mkf="$pwd/config-PyMake$$"
1324 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001325__:
Bram Moolenaar218116c2010-05-20 21:46:00 +02001326 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001327 @echo "python_LIBS='$(LIBS)'"
1328 @echo "python_SYSLIBS='$(SYSLIBS)'"
1329 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
Bram Moolenaarf94a13c2012-09-21 13:26:49 +02001330 @echo "python_DLLLIBRARY='$(DLLLIBRARY)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001331 @echo "python_INSTSONAME='$(INSTSONAME)'"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001332 @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'"
1333 @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
1334 @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001335eof
1336 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +00001337 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1338 rm -f -- "${tmp_mkf}"
Bram Moolenaard0573012017-10-28 21:11:06 +02001339 if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
Bram Moolenaar071d4272004-06-13 20:20:40 +00001340 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
1341 vi_cv_path_python_plibs="-framework Python"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001342 if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
1343 vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python"
1344 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001345 else
Bram Moolenaar9ce42132018-04-11 22:19:36 +02001346 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001347 dnl -- Check if the path contained in python_LINKFORSHARED is
1348 dnl usable for vim build. If not, make and try other
1349 dnl candidates.
Bram Moolenaara161e262015-03-24 15:14:27 +01001350 if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
Bram Moolenaar6c927552015-03-24 12:21:33 +01001351 python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'`
1352 python_link_path=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]][[ \t]]*\(.*\)/\2/'`
1353 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1354 dnl -- The path looks relative. Guess the absolute one using
1355 dnl the prefix and try that.
1356 python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}"
1357 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1358 dnl -- A last resort.
1359 python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}"
1360 dnl -- No check is done. The last word is left to the
1361 dnl "sanity" test on link flags that follows shortly.
1362 fi
1363 python_LINKFORSHARED="${python_link_symbol} ${python_link_path}"
1364 fi
1365 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +02001366 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 +00001367 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1368 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
1369 fi
1370 ])
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001371 AC_CACHE_CHECK(Python's dll name,vi_cv_dll_name_python,
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001372 [
1373 if test "X$python_DLLLIBRARY" != "X"; then
1374 vi_cv_dll_name_python="$python_DLLLIBRARY"
1375 else
1376 vi_cv_dll_name_python="$python_INSTSONAME"
1377 fi
1378 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001379
1380 PYTHON_LIBS="${vi_cv_path_python_plibs}"
1381 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
Bram Moolenaar04249582018-04-10 13:29:34 +02001382 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001383 else
Bram Moolenaar04249582018-04-10 13:29:34 +02001384 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 +00001385 fi
Bram Moolenaar3a21d9c2018-04-10 20:26:20 +02001386 if test "X$have_python_config_dir" = "X1" -a "$enable_pythoninterp" = "dynamic"; then
Bram Moolenaard0882402018-04-10 18:13:05 +02001387 dnl Define PYTHON_HOME if --with-python-config-dir was used
1388 PYTHON_CFLAGS="${PYTHON_CFLAGS} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
1389
1390 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001391 PYTHON_SRC="if_python.c"
Bram Moolenaar9bdb9a02012-07-25 16:32:08 +02001392 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001393
1394 dnl On FreeBSD linking with "-pthread" is required to use threads.
1395 dnl _THREAD_SAFE must be used for compiling then.
1396 dnl The "-pthread" is added to $LIBS, so that the following check for
1397 dnl sigaltstack() will look in libc_r (it's there in libc!).
1398 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1399 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1400 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1401 AC_MSG_CHECKING([if -pthread should be used])
1402 threadsafe_flag=
1403 thread_lib=
Bram Moolenaard0573012017-10-28 21:11:06 +02001404 dnl if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001405 if test "$vim_cv_uname_output" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001406 test "$GCC" = yes && threadsafe_flag="-pthread"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001407 if test "$vim_cv_uname_output" = FreeBSD; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001408 threadsafe_flag="-D_THREAD_SAFE"
1409 thread_lib="-pthread"
1410 fi
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001411 if test "$vim_cv_uname_output" = SunOS; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001412 threadsafe_flag="-pthreads"
1413 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001414 fi
1415 libs_save_old=$LIBS
1416 if test -n "$threadsafe_flag"; then
1417 cflags_save=$CFLAGS
1418 CFLAGS="$CFLAGS $threadsafe_flag"
1419 LIBS="$LIBS $thread_lib"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001420 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar69f787a2010-07-11 20:52:58 +02001421 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +00001422 AC_MSG_RESULT(no); LIBS=$libs_save_old
1423 )
1424 CFLAGS=$cflags_save
1425 else
1426 AC_MSG_RESULT(no)
1427 fi
1428
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001429 dnl Check that compiling a simple program still works with the flags
Bram Moolenaar071d4272004-06-13 20:20:40 +00001430 dnl added for Python.
1431 AC_MSG_CHECKING([if compile and link flags for Python are sane])
1432 cflags_save=$CFLAGS
1433 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +02001434 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001435 LIBS="$LIBS $PYTHON_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001436 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001437 AC_MSG_RESULT(yes); python_ok=yes,
1438 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
1439 CFLAGS=$cflags_save
1440 LIBS=$libs_save
1441 if test $python_ok = yes; then
1442 AC_DEFINE(FEAT_PYTHON)
1443 else
1444 LIBS=$libs_save_old
1445 PYTHON_SRC=
1446 PYTHON_OBJ=
1447 PYTHON_LIBS=
1448 PYTHON_CFLAGS=
1449 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001450 fi
1451 else
1452 AC_MSG_RESULT(too old)
1453 fi
1454 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001455
1456 if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then
1457 AC_MSG_ERROR([could not configure python])
1458 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001459fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001460
Bram Moolenaar071d4272004-06-13 20:20:40 +00001461AC_SUBST(PYTHON_LIBS)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001462AC_SUBST(PYTHON_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00001463AC_SUBST(PYTHON_CFLAGS_EXTRA)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001464AC_SUBST(PYTHON_SRC)
1465AC_SUBST(PYTHON_OBJ)
1466
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001467
1468AC_MSG_CHECKING(--enable-python3interp argument)
1469AC_ARG_ENABLE(python3interp,
Bram Moolenaar8008b632017-07-18 21:33:20 +02001470 [ --enable-python3interp[=OPTS] Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001471 [enable_python3interp="no"])
1472AC_MSG_RESULT($enable_python3interp)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001473if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00001474 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01001475 AC_MSG_ERROR([cannot use Python with tiny features])
Bram Moolenaar0b105412014-11-30 13:34:23 +01001476 fi
1477
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001478 dnl -- find the python3 executable
Bram Moolenaare1a32312018-04-15 16:03:25 +02001479 AC_MSG_CHECKING(--with-python3-command argument)
1480 AC_SUBST(vi_cv_path_python3)
1481 AC_ARG_WITH(python3-command, [ --with-python3-command=NAME name of the Python 3 command (default: python3 or python)],
1482 vi_cv_path_python3="$withval"; AC_MSG_RESULT($vi_cv_path_python3),
1483 AC_MSG_RESULT(no))
1484
1485 if test "X$vi_cv_path_python3" = "X"; then
1486 AC_PATH_PROGS(vi_cv_path_python3, python3 python)
1487 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001488 if test "X$vi_cv_path_python3" != "X"; then
1489
1490 dnl -- get its version number
1491 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
1492 [[vi_cv_var_python3_version=`
Bram Moolenaar23c01922021-05-21 11:43:58 +02001493 ${vi_cv_path_python3} -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001494 ]])
1495
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001496 dnl -- it must be at least version 3
1497 AC_MSG_CHECKING(Python is 3.0 or better)
1498 if ${vi_cv_path_python3} -c \
1499 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)"
1500 then
1501 AC_MSG_RESULT(yep)
Bram Moolenaar456f2bb2011-06-12 21:37:13 +02001502
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +02001503 dnl -- get the stable ABI version if passed in
1504 AC_MSG_CHECKING(--with-python3-stable-abi argument)
1505 AC_SUBST(vi_cv_var_python3_stable_abi)
1506 AC_ARG_WITH(python3-stable-abi, [ --with-python3-stable-abi=VERSION stable ABI version to target (e.g. 3.8)],
1507 vi_cv_var_python3_stable_abi="$withval"; AC_MSG_RESULT($vi_cv_var_python3_stable_abi),
1508 AC_MSG_RESULT(no))
1509 if test "X$vi_cv_var_python3_stable_abi" != "X"; then
1510 AC_CACHE_VAL(vi_cv_var_python3_stable_abi_hex,
1511 [
1512 vi_cv_var_python3_stable_abi_hex=`
1513 ${vi_cv_path_python3} -c \
1514 "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) ))"` ])
1515 if test "X$vi_cv_var_python3_stable_abi_hex" == "X"; then
1516 AC_MSG_ERROR([can't parse Python 3 stable ABI version. It should be "<major>.<minor>"])
1517 fi
1518 fi
1519
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001520 dnl -- get abiflags for python 3.2 or higher (PEP 3149)
1521 AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001522 [
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001523 vi_cv_var_python3_abiflags=
1524 if ${vi_cv_path_python3} -c \
1525 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)"
1526 then
Bram Moolenaare5303952022-06-19 17:05:47 +01001527 vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001528 "import sys; print(sys.abiflags)"`
1529 fi ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001530
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001531 dnl -- find where python3 thinks it was installed
1532 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
1533 [ vi_cv_path_python3_pfx=`
1534 ${vi_cv_path_python3} -c \
1535 "import sys; print(sys.prefix)"` ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001536
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001537 dnl -- and where it thinks it runs
1538 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
1539 [ vi_cv_path_python3_epfx=`
1540 ${vi_cv_path_python3} -c \
1541 "import sys; print(sys.exec_prefix)"` ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001542
Illia Bobyr74e1dad2023-08-27 18:26:54 +02001543 dnl -- python3's include path
1544 AC_CACHE_CHECK(Python's include path,vi_cv_path_python3_include,
1545 [ vi_cv_path_python3_include=`
1546 ${vi_cv_path_python3} -c \
1547 "import sysconfig; print(sysconfig.get_path(\"include\"))"` ])
1548
1549 dnl -- python3's platform include path
1550 AC_CACHE_CHECK(Python's include path,vi_cv_path_python3_platinclude,
1551 [ vi_cv_path_python3_platinclude=`
1552 ${vi_cv_path_python3} -c \
1553 "import sysconfig; print(sysconfig.get_path(\"platinclude\"))"` ])
1554
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001555 dnl -- python3's internal library path
Bram Moolenaare5303952022-06-19 17:05:47 +01001556
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001557 AC_CACHE_VAL(vi_cv_path_python3path,
1558 [ vi_cv_path_python3path=`
1559 unset PYTHONPATH;
1560 ${vi_cv_path_python3} -c \
1561 "import sys, string; print(':'.join(sys.path))"` ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001562
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001563 dnl -- where the Python implementation library archives are
Bram Moolenaare5303952022-06-19 17:05:47 +01001564
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001565 AC_ARG_WITH(python3-config-dir,
Bram Moolenaare1a32312018-04-15 16:03:25 +02001566 [ --with-python3-config-dir=PATH Python's config directory (deprecated)],
Bram Moolenaard0882402018-04-10 18:13:05 +02001567 [ vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 ] )
Bram Moolenaare5303952022-06-19 17:05:47 +01001568
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001569 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
1570 [
1571 vi_cv_path_python3_conf=
Bram Moolenaarfee496d2013-07-12 20:07:24 +02001572 config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
Zdenek Dohnal31e299c2021-06-10 18:50:55 +02001573 d=`${vi_cv_path_python3} -c "import sysconfig; print(sysconfig.get_config_var('LIBPL'))" 2> /dev/null`
1574 if test "x$d" = "x"; then
1575 d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
1576 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001577 if test -d "$d" && test -f "$d/config.c"; then
1578 vi_cv_path_python3_conf="$d"
1579 else
1580 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
1581 for subdir in lib64 lib share; do
1582 d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
1583 if test -d "$d" && test -f "$d/config.c"; then
1584 vi_cv_path_python3_conf="$d"
1585 fi
1586 done
1587 done
1588 fi
1589 ])
Bram Moolenaare5303952022-06-19 17:05:47 +01001590
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001591 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
Bram Moolenaare5303952022-06-19 17:05:47 +01001592
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001593 if test "X$PYTHON3_CONFDIR" = "X"; then
1594 AC_MSG_RESULT([can't find it!])
1595 else
Bram Moolenaare5303952022-06-19 17:05:47 +01001596
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001597 dnl -- we need to examine Python's config/Makefile too
1598 dnl see what the interpreter is built from
1599 AC_CACHE_VAL(vi_cv_path_python3_plibs,
1600 [
1601 pwd=`pwd`
1602 tmp_mkf="$pwd/config-PyMake$$"
1603 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001604__:
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001605 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001606 @echo "python3_LIBS='$(LIBS)'"
1607 @echo "python3_SYSLIBS='$(SYSLIBS)'"
Bram Moolenaarf94a13c2012-09-21 13:26:49 +02001608 @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001609 @echo "python3_INSTSONAME='$(INSTSONAME)'"
Yee Cheng Chinb6ebe5a2023-04-05 18:24:50 +01001610 @echo "python3_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001611eof
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001612 dnl -- delete the lines from make about Entering/Leaving directory
1613 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1614 rm -f -- "${tmp_mkf}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001615 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 +02001616 vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}"
1617 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1618 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1619 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1620 ])
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001621 AC_CACHE_CHECK(Python3's dll name,vi_cv_dll_name_python3,
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001622 [
1623 if test "X$python3_DLLLIBRARY" != "X"; then
1624 vi_cv_dll_name_python3="$python3_DLLLIBRARY"
Yee Cheng Chinb6ebe5a2023-04-05 18:24:50 +01001625 elif test "X$python3_PYTHONFRAMEWORKPREFIX" != "X"; then
1626 vi_cv_dll_name_python3="${python3_PYTHONFRAMEWORKPREFIX}/${python3_INSTSONAME}"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001627 else
1628 vi_cv_dll_name_python3="$python3_INSTSONAME"
1629 fi
1630 ])
1631
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001632 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
Illia Bobyr74e1dad2023-08-27 18:26:54 +02001633 if test "${vi_cv_path_python3_include}" = "${vi_cv_path_python3_platinclude}"; then
1634 PYTHON3_CFLAGS="-I${vi_cv_path_python3_include}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001635 else
Illia Bobyr74e1dad2023-08-27 18:26:54 +02001636 PYTHON3_CFLAGS="-I${vi_cv_path_python3_include} -I${vi_cv_path_python3_platinclude}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001637 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +02001638 if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then
1639 dnl Define PYTHON3_HOME if --with-python-config-dir was used
1640 PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'"
1641 fi
1642 if test "X$vi_cv_var_python3_stable_abi_hex" != "X"; then
1643 PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPy_LIMITED_API=${vi_cv_var_python3_stable_abi_hex}"
1644 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001645 PYTHON3_SRC="if_python3.c"
1646 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaare5303952022-06-19 17:05:47 +01001647
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001648 dnl On FreeBSD linking with "-pthread" is required to use threads.
1649 dnl _THREAD_SAFE must be used for compiling then.
1650 dnl The "-pthread" is added to $LIBS, so that the following check for
1651 dnl sigaltstack() will look in libc_r (it's there in libc!).
1652 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1653 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1654 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1655 AC_MSG_CHECKING([if -pthread should be used])
1656 threadsafe_flag=
1657 thread_lib=
Bram Moolenaard0573012017-10-28 21:11:06 +02001658 dnl if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001659 if test "$vim_cv_uname_output" != Darwin; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001660 test "$GCC" = yes && threadsafe_flag="-pthread"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001661 if test "$vim_cv_uname_output" = FreeBSD; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001662 threadsafe_flag="-D_THREAD_SAFE"
1663 thread_lib="-pthread"
1664 fi
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001665 if test "$vim_cv_uname_output" = SunOS; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001666 threadsafe_flag="-pthreads"
1667 fi
1668 fi
1669 libs_save_old=$LIBS
1670 if test -n "$threadsafe_flag"; then
1671 cflags_save=$CFLAGS
1672 CFLAGS="$CFLAGS $threadsafe_flag"
1673 LIBS="$LIBS $thread_lib"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001674 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001675 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1676 AC_MSG_RESULT(no); LIBS=$libs_save_old
1677 )
1678 CFLAGS=$cflags_save
1679 else
1680 AC_MSG_RESULT(no)
1681 fi
Bram Moolenaare5303952022-06-19 17:05:47 +01001682
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001683 dnl check that compiling a simple program still works with the flags
1684 dnl added for Python.
1685 AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
1686 cflags_save=$CFLAGS
1687 libs_save=$LIBS
1688 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1689 LIBS="$LIBS $PYTHON3_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001690 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001691 AC_MSG_RESULT(yes); python3_ok=yes,
1692 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1693 CFLAGS=$cflags_save
1694 LIBS=$libs_save
1695 if test "$python3_ok" = yes; then
1696 AC_DEFINE(FEAT_PYTHON3)
1697 else
1698 LIBS=$libs_save_old
1699 PYTHON3_SRC=
1700 PYTHON3_OBJ=
1701 PYTHON3_LIBS=
1702 PYTHON3_CFLAGS=
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001703 fi
1704 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001705 else
1706 AC_MSG_RESULT(too old)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001707 fi
1708 fi
Bram Moolenaar1612b1a2013-06-14 21:22:39 +02001709 if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then
1710 AC_MSG_ERROR([could not configure python3])
1711 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001712fi
1713
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001714AC_SUBST(PYTHON3_LIBS)
1715AC_SUBST(PYTHON3_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00001716AC_SUBST(PYTHON3_CFLAGS_EXTRA)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001717AC_SUBST(PYTHON3_SRC)
1718AC_SUBST(PYTHON3_OBJ)
1719
1720dnl if python2.x and python3.x are enabled one can only link in code
Bram Moolenaare5303952022-06-19 17:05:47 +01001721dnl with dlopen(), dlsym(), dlclose()
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001722if test "$python_ok" = yes && test "$python3_ok" = yes; then
1723 AC_DEFINE(DYNAMIC_PYTHON)
1724 AC_DEFINE(DYNAMIC_PYTHON3)
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +02001725 if test "X$vi_cv_var_python3_stable_abi_hex" != "X"; then
1726 AC_DEFINE(DYNAMIC_PYTHON3_STABLE_ABI)
1727 fi
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001728 AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001729 cflags_save=$CFLAGS
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001730 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001731 libs_save=$LIBS
Bram Moolenaar6fabcbe2011-09-02 12:27:25 +02001732 dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001733 LIBS="-ldl $LIBS"
Bram Moolenaar7db77842014-03-27 17:40:59 +01001734 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001735 #include <dlfcn.h>
1736 /* If this program fails, then RTLD_GLOBAL is needed.
1737 * RTLD_GLOBAL will be used and then it is not possible to
1738 * have both python versions enabled in the same vim instance.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02001739 * Only the first python version used will be switched on.
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001740 */
1741
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01001742 static int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001743 {
1744 int needed = 0;
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001745 void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001746 if (pylib != 0)
1747 {
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001748 void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001749 void (*init)(void) = dlsym(pylib, "Py_Initialize");
1750 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1751 void (*final)(void) = dlsym(pylib, "Py_Finalize");
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001752 (*pfx)(prefix);
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001753 (*init)();
1754 needed = (*simple)("import termios") == -1;
1755 (*final)();
1756 dlclose(pylib);
1757 }
1758 return !needed;
1759 }
1760
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01001761 int main()
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001762 {
1763 int not_needed = 0;
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001764 if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}"))
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001765 not_needed = 1;
1766 return !not_needed;
Bram Moolenaar7db77842014-03-27 17:40:59 +01001767 }])],
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001768 [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001769
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001770 CFLAGS=$cflags_save
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001771 LIBS=$libs_save
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001772
1773 AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
1774 cflags_save=$CFLAGS
1775 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001776 libs_save=$LIBS
Bram Moolenaar6fabcbe2011-09-02 12:27:25 +02001777 dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001778 LIBS="-ldl $LIBS"
Bram Moolenaar7db77842014-03-27 17:40:59 +01001779 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001780 #include <dlfcn.h>
1781 #include <wchar.h>
1782 /* If this program fails, then RTLD_GLOBAL is needed.
1783 * RTLD_GLOBAL will be used and then it is not possible to
1784 * have both python versions enabled in the same vim instance.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02001785 * Only the first python version used will be switched on.
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001786 */
1787
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01001788 static int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001789 {
1790 int needed = 0;
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001791 void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001792 if (pylib != 0)
1793 {
1794 void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
1795 void (*init)(void) = dlsym(pylib, "Py_Initialize");
1796 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1797 void (*final)(void) = dlsym(pylib, "Py_Finalize");
1798 (*pfx)(prefix);
1799 (*init)();
1800 needed = (*simple)("import termios") == -1;
1801 (*final)();
1802 dlclose(pylib);
1803 }
1804 return !needed;
1805 }
1806
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01001807 int main()
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001808 {
1809 int not_needed = 0;
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001810 if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}"))
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001811 not_needed = 1;
1812 return !not_needed;
Bram Moolenaar7db77842014-03-27 17:40:59 +01001813 }])],
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001814 [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1815
1816 CFLAGS=$cflags_save
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001817 LIBS=$libs_save
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001818
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001819 PYTHON_SRC="if_python.c"
1820 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001821 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001822 PYTHON_LIBS=
1823 PYTHON3_SRC="if_python3.c"
1824 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001825 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001826 PYTHON3_LIBS=
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001827elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
1828 AC_DEFINE(DYNAMIC_PYTHON)
1829 PYTHON_SRC="if_python.c"
1830 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001831 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001832 PYTHON_LIBS=
Bram Moolenaare741f272013-07-09 21:57:52 +02001833elif test "$python_ok" = yes; then
1834 dnl Check that adding -fPIE works. It may be needed when using a static
1835 dnl Python library.
1836 AC_MSG_CHECKING([if -fPIE can be added for Python])
1837 cflags_save=$CFLAGS
1838 libs_save=$LIBS
1839 CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
1840 LIBS="$LIBS $PYTHON_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001841 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaare741f272013-07-09 21:57:52 +02001842 AC_MSG_RESULT(yes); fpie_ok=yes,
1843 AC_MSG_RESULT(no); fpie_ok=no)
1844 CFLAGS=$cflags_save
1845 LIBS=$libs_save
1846 if test $fpie_ok = yes; then
1847 PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
1848 fi
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001849elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
1850 AC_DEFINE(DYNAMIC_PYTHON3)
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +02001851 if test "X$vi_cv_var_python3_stable_abi_hex" != "X"; then
1852 AC_DEFINE(DYNAMIC_PYTHON3_STABLE_ABI)
1853 fi
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001854 PYTHON3_SRC="if_python3.c"
1855 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001856 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001857 PYTHON3_LIBS=
Bram Moolenaare741f272013-07-09 21:57:52 +02001858elif test "$python3_ok" = yes; then
1859 dnl Check that adding -fPIE works. It may be needed when using a static
1860 dnl Python library.
1861 AC_MSG_CHECKING([if -fPIE can be added for Python3])
1862 cflags_save=$CFLAGS
1863 libs_save=$LIBS
1864 CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
1865 LIBS="$LIBS $PYTHON3_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01001866 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ ])],
Bram Moolenaare741f272013-07-09 21:57:52 +02001867 AC_MSG_RESULT(yes); fpie_ok=yes,
1868 AC_MSG_RESULT(no); fpie_ok=no)
1869 CFLAGS=$cflags_save
1870 LIBS=$libs_save
1871 if test $fpie_ok = yes; then
1872 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
1873 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001874fi
1875
Bram Moolenaar071d4272004-06-13 20:20:40 +00001876AC_MSG_CHECKING(--enable-tclinterp argument)
1877AC_ARG_ENABLE(tclinterp,
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001878 [ --enable-tclinterp[=OPTS] Include Tcl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001879 [enable_tclinterp="no"])
1880AC_MSG_RESULT($enable_tclinterp)
1881
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001882if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001883
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001884 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001885 AC_MSG_CHECKING(--with-tclsh argument)
1886 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
1887 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001888 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001889 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1890 AC_SUBST(vi_cv_path_tcl)
1891
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001892 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1893 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1894 tclsh_name="tclsh8.4"
1895 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1896 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001897 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001898 tclsh_name="tclsh8.2"
1899 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1900 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001901 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1902 tclsh_name="tclsh8.0"
1903 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1904 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001905 dnl still didn't find it, try without version number
1906 if test "X$vi_cv_path_tcl" = "X"; then
1907 tclsh_name="tclsh"
1908 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1909 fi
1910 if test "X$vi_cv_path_tcl" != "X"; then
1911 AC_MSG_CHECKING(Tcl version)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001912 if echo 'exit [[expr [info tclversion] < 8.0]]' | "$vi_cv_path_tcl" - ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001913 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1914 AC_MSG_RESULT($tclver - OK);
1915 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 +01001916 tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001917
1918 AC_MSG_CHECKING(for location of Tcl include)
Bram Moolenaard0573012017-10-28 21:11:06 +02001919 if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001920 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 +00001921 else
Bram Moolenaarf4ee5282020-07-30 20:18:08 +02001922 dnl For all macOS, use the value from TCL in case use of, say, homebrew
Bram Moolenaar071d4272004-06-13 20:20:40 +00001923 dnl For Mac OS X 10.3, use the OS-provided framework location
Bram Moolenaarf4ee5282020-07-30 20:18:08 +02001924 dnl For Mac OS X 10.14, the OS-provided framework location doesn't contain the headers, so also check the Xcode SDK
1925 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 +00001926 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001927 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001928 for try in $tclinc; do
1929 if test -f "$try/tcl.h"; then
1930 AC_MSG_RESULT($try/tcl.h)
1931 TCL_INC=$try
1932 break
1933 fi
1934 done
1935 if test -z "$TCL_INC"; then
1936 AC_MSG_RESULT(<not found>)
1937 SKIP_TCL=YES
1938 fi
1939 if test -z "$SKIP_TCL"; then
1940 AC_MSG_CHECKING(for location of tclConfig.sh script)
Bram Moolenaard0573012017-10-28 21:11:06 +02001941 if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001942 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001943 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001944 else
Bram Moolenaarf4ee5282020-07-30 20:18:08 +02001945 dnl For all macOS, use the value from TCL in case use of, say, homebrew
Bram Moolenaar071d4272004-06-13 20:20:40 +00001946 dnl For Mac OS X 10.3, use the OS-provided framework location
Bram Moolenaarf4ee5282020-07-30 20:18:08 +02001947 dnl For Mac OS X 10.14, the OS-provided framework location doesn't contain the headers, so also check the Xcode SDK
1948 tclcnf=`echo $tclinc | sed s/include/lib/g`
1949 tclcnf="$tclcnf /System/Library/Frameworks/Tcl.framework `xcrun --show-sdk-path`/System/Library/Frameworks/Tcl.framework"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001950 fi
1951 for try in $tclcnf; do
Bram Moolenaar49222be2015-12-11 18:11:30 +01001952 if test -f "$try/tclConfig.sh"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001953 AC_MSG_RESULT($try/tclConfig.sh)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001954 . "$try/tclConfig.sh"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001955 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001956 if test "$enable_tclinterp" = "dynamic"; then
1957 TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"`
1958 else
1959 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1960 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001961 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001962 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +00001963 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 +00001964 break
1965 fi
1966 done
1967 if test -z "$TCL_LIBS"; then
1968 AC_MSG_RESULT(<not found>)
1969 AC_MSG_CHECKING(for Tcl library by myself)
1970 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001971 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001972 for ext in .so .a ; do
1973 for ver in "" $tclver ; do
1974 for try in $tcllib ; do
1975 trylib=tcl$ver$ext
Bram Moolenaar49222be2015-12-11 18:11:30 +01001976 if test -f "$try/lib$trylib" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001977 AC_MSG_RESULT($try/lib$trylib)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001978 TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00001979 if test "$vim_cv_uname_output" = SunOS &&
1980 echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001981 TCL_LIBS="$TCL_LIBS -R $try"
1982 fi
1983 break 3
1984 fi
1985 done
1986 done
1987 done
1988 if test -z "$TCL_LIBS"; then
1989 AC_MSG_RESULT(<not found>)
1990 SKIP_TCL=YES
1991 fi
1992 fi
1993 if test -z "$SKIP_TCL"; then
1994 AC_DEFINE(FEAT_TCL)
1995 TCL_SRC=if_tcl.c
1996 TCL_OBJ=objects/if_tcl.o
1997 TCL_PRO=if_tcl.pro
1998 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1999 fi
2000 fi
2001 else
2002 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
2003 fi
2004 fi
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01002005 if test "$enable_tclinterp" = "dynamic"; then
2006 if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then
2007 AC_DEFINE(DYNAMIC_TCL)
2008 TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS"
2009 fi
2010 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01002011 if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then
2012 AC_MSG_ERROR([could not configure Tcl])
2013 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002014fi
2015AC_SUBST(TCL_SRC)
2016AC_SUBST(TCL_OBJ)
2017AC_SUBST(TCL_PRO)
2018AC_SUBST(TCL_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00002019AC_SUBST(TCL_CFLAGS_EXTRA)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002020AC_SUBST(TCL_LIBS)
2021
2022AC_MSG_CHECKING(--enable-rubyinterp argument)
2023AC_ARG_ENABLE(rubyinterp,
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002024 [ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00002025 [enable_rubyinterp="no"])
2026AC_MSG_RESULT($enable_rubyinterp)
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002027if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00002028 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01002029 AC_MSG_ERROR([cannot use Ruby with tiny features])
Bram Moolenaar0b105412014-11-30 13:34:23 +01002030 fi
2031
Bram Moolenaar165641d2010-02-17 16:23:09 +01002032 AC_MSG_CHECKING(--with-ruby-command argument)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002033 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar948733a2011-05-05 18:10:16 +02002034 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
2035 RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD),
2036 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar165641d2010-02-17 16:23:09 +01002037 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002038 if test "X$vi_cv_path_ruby" != "X"; then
2039 AC_MSG_CHECKING(Ruby version)
K.Takata236ccbf2022-09-22 16:12:06 +01002040 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 +00002041 AC_MSG_RESULT(OK)
Bram Moolenaar81398892012-10-03 21:09:35 +02002042 AC_MSG_CHECKING(Ruby rbconfig)
2043 ruby_rbconfig="RbConfig"
2044 if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then
2045 ruby_rbconfig="Config"
2046 fi
2047 AC_MSG_RESULT($ruby_rbconfig)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002048 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar81398892012-10-03 21:09:35 +02002049 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 +00002050 if test "X$rubyhdrdir" != "X"; then
2051 AC_MSG_RESULT($rubyhdrdir)
2052 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaara6fd37b2014-03-27 17:19:09 +01002053 rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"`
2054 if test -d "$rubyarchdir"; then
2055 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01002056 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02002057 rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
Bram Moolenaar026a4452013-08-07 15:22:23 +02002058 if test "X$rubyversion" = "X"; then
K.Takata236ccbf2022-09-22 16:12:06 +01002059 rubyversion=`$vi_cv_path_ruby -e "print RUBY_VERSION.gsub(/\./, '')[[0,2]]"`
Bram Moolenaar026a4452013-08-07 15:22:23 +02002060 fi
Bram Moolenaar165641d2010-02-17 16:23:09 +01002061 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar81398892012-10-03 21:09:35 +02002062 rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
Bram Moolenaar071d4272004-06-13 20:20:40 +00002063 if test "X$rubylibs" != "X"; then
2064 RUBY_LIBS="$rubylibs"
2065 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02002066 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"`
2067 librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"`
Bram Moolenaarac499e32013-06-02 19:14:17 +02002068 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"`
Bram Moolenaard5a986f2020-12-06 21:11:31 +01002069 if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then
Bram Moolenaarac499e32013-06-02 19:14:17 +02002070 RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
2071 elif test "$librubyarg" = "libruby.a"; then
2072 dnl required on Mac OS 10.3 where libruby.a doesn't exist
2073 librubyarg="-lruby"
2074 RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002075 fi
2076
2077 if test "X$librubyarg" != "X"; then
2078 RUBY_LIBS="$librubyarg $RUBY_LIBS"
2079 fi
Zdenek Dohnal1d822af2022-11-23 12:06:08 +00002080
2081 dnl Here the Ruby LDFLAGS used to be added to LDFLAGS, but that turns
2082 dnl out to cause trouble and was removed.
2083
Bram Moolenaar071d4272004-06-13 20:20:40 +00002084 RUBY_SRC="if_ruby.c"
2085 RUBY_OBJ="objects/if_ruby.o"
2086 RUBY_PRO="if_ruby.pro"
2087 AC_DEFINE(FEAT_RUBY)
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002088 if test "$enable_rubyinterp" = "dynamic"; then
Bram Moolenaar92021622017-10-12 12:33:43 +02002089 libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_ALIASES']].split[[0]]"`
Bram Moolenaar87ea64c2018-08-04 15:13:34 +02002090 if test -z "$libruby_soname"; then
2091 libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
2092 fi
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002093 AC_DEFINE(DYNAMIC_RUBY)
Bram Moolenaar41a41412020-01-07 21:32:19 +01002094 RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" $RUBY_CFLAGS"
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02002095 RUBY_LIBS=
2096 fi
Bram Moolenaar864a28b2020-12-28 21:36:56 +01002097 if test "X$CLANG_VERSION" != "X" -a "$rubyversion" -ge 30; then
2098 RUBY_CFLAGS="$RUBY_CFLAGS -fdeclspec"
2099 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002100 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01002101 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002102 fi
2103 else
K.Takata236ccbf2022-09-22 16:12:06 +01002104 AC_MSG_RESULT(too old; need Ruby version 1.9.1 or later)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002105 fi
2106 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01002107
2108 if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then
2109 AC_MSG_ERROR([could not configure Ruby])
2110 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002111fi
2112AC_SUBST(RUBY_SRC)
2113AC_SUBST(RUBY_OBJ)
2114AC_SUBST(RUBY_PRO)
2115AC_SUBST(RUBY_CFLAGS)
ichizok8bb3fe42021-12-28 15:51:45 +00002116AC_SUBST(RUBY_CFLAGS_EXTRA)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002117AC_SUBST(RUBY_LIBS)
2118
2119AC_MSG_CHECKING(--enable-cscope argument)
2120AC_ARG_ENABLE(cscope,
2121 [ --enable-cscope Include cscope interface.], ,
2122 [enable_cscope="no"])
2123AC_MSG_RESULT($enable_cscope)
2124if test "$enable_cscope" = "yes"; then
2125 AC_DEFINE(FEAT_CSCOPE)
2126fi
2127
Bram Moolenaar071d4272004-06-13 20:20:40 +00002128AC_MSG_CHECKING(--disable-netbeans argument)
2129AC_ARG_ENABLE(netbeans,
2130 [ --disable-netbeans Disable NetBeans integration support.],
2131 , [enable_netbeans="yes"])
2132if test "$enable_netbeans" = "yes"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00002133 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01002134 AC_MSG_RESULT([cannot use NetBeans with tiny features])
Bram Moolenaar3c124e32016-01-31 14:36:58 +01002135 enable_netbeans="no"
2136 else
2137 AC_MSG_RESULT(no)
2138 fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002139else
2140 AC_MSG_RESULT(yes)
2141fi
2142
2143AC_MSG_CHECKING(--disable-channel argument)
2144AC_ARG_ENABLE(channel,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002145 [ --disable-channel Disable process communication support.],
Bram Moolenaare0874f82016-01-24 20:36:41 +01002146 , [enable_channel="yes"])
2147if test "$enable_channel" = "yes"; then
Bram Moolenaar12471262022-01-18 11:11:25 +00002148 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01002149 AC_MSG_RESULT([cannot use channels with tiny features])
Bram Moolenaar3c124e32016-01-31 14:36:58 +01002150 enable_channel="no"
2151 else
2152 AC_MSG_RESULT(no)
2153 fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002154else
2155 if test "$enable_netbeans" = "yes"; then
Bram Moolenaar16435482016-01-24 21:31:54 +01002156 AC_MSG_RESULT([yes, netbeans also disabled])
Bram Moolenaare0874f82016-01-24 20:36:41 +01002157 enable_netbeans="no"
2158 else
2159 AC_MSG_RESULT(yes)
2160 fi
2161fi
2162
Bram Moolenaar16435482016-01-24 21:31:54 +01002163if test "$enable_channel" = "yes"; then
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002164 dnl On Solaris we need the socket library, or on Haiku the network library.
Bram Moolenaarb3f74062020-02-26 16:16:53 +01002165 if test "x$HAIKU" = "xyes"; then
2166 AC_CHECK_LIB(network, socket)
2167 else
2168 AC_CHECK_LIB(socket, socket)
2169 fi
2170
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002171 AC_CACHE_CHECK([whether compiling with IPv6 networking is possible], [vim_cv_ipv6_networking],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002172 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002173#include <stdio.h>
2174#include <stdlib.h>
2175#include <stdarg.h>
2176#include <fcntl.h>
2177#include <netdb.h>
2178#include <netinet/in.h>
2179#include <errno.h>
2180#include <sys/types.h>
2181#include <sys/socket.h>
2182 /* Check bitfields */
2183 struct nbbuf {
2184 unsigned int initDone:1;
2185 unsigned short signmaplen;
2186 };
2187 ], [
2188 /* Check creating a socket. */
2189 struct sockaddr_in server;
2190 struct addrinfo *res;
2191 (void)socket(AF_INET, SOCK_STREAM, 0);
2192 (void)htons(100);
2193 (void)getaddrinfo("microsoft.com", NULL, NULL, &res);
2194 if (errno == ECONNREFUSED)
2195 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
2196 (void)freeaddrinfo(res);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002197 ])],
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002198 [vim_cv_ipv6_networking="yes"],
2199 [vim_cv_ipv6_networking="no"])])
2200
2201 if test "x$vim_cv_ipv6_networking" = "xyes"; then
2202 AC_DEFINE(FEAT_IPV6)
Bram Moolenaarb6fb0512020-04-18 18:24:18 +02002203 AC_CHECK_FUNCS(inet_ntop)
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002204 else
2205 dnl On Solaris we need the nsl library.
2206 AC_CHECK_LIB(nsl, gethostbyname)
2207 AC_CACHE_CHECK([whether compiling with IPv4 networking is possible], [vim_cv_ipv4_networking],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002208 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00002209#include <stdio.h>
2210#include <stdlib.h>
2211#include <stdarg.h>
2212#include <fcntl.h>
2213#include <netdb.h>
2214#include <netinet/in.h>
2215#include <errno.h>
2216#include <sys/types.h>
2217#include <sys/socket.h>
2218 /* Check bitfields */
2219 struct nbbuf {
2220 unsigned int initDone:1;
Bram Moolenaar63de19e2016-12-09 20:11:26 +01002221 unsigned short signmaplen;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002222 };
2223 ], [
2224 /* Check creating a socket. */
2225 struct sockaddr_in server;
2226 (void)socket(AF_INET, SOCK_STREAM, 0);
2227 (void)htons(100);
2228 (void)gethostbyname("microsoft.com");
2229 if (errno == ECONNREFUSED)
2230 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002231 ])],
Bram Moolenaarbfe13cc2020-04-12 17:53:12 +02002232 [vim_cv_ipv4_networking="yes"],
2233 [vim_cv_ipv4_networking="no"; enable_netbeans="no"; enable_channel="no"])])
2234 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002235fi
2236if test "$enable_netbeans" = "yes"; then
2237 AC_DEFINE(FEAT_NETBEANS_INTG)
2238 NETBEANS_SRC="netbeans.c"
2239 AC_SUBST(NETBEANS_SRC)
2240 NETBEANS_OBJ="objects/netbeans.o"
2241 AC_SUBST(NETBEANS_OBJ)
2242fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002243if test "$enable_channel" = "yes"; then
Bram Moolenaar509ce2a2016-03-11 22:52:15 +01002244 AC_DEFINE(FEAT_JOB_CHANNEL)
Bram Moolenaar8b5866d2020-09-05 15:48:51 +02002245 CHANNEL_SRC="job.c channel.c"
Bram Moolenaare0874f82016-01-24 20:36:41 +01002246 AC_SUBST(CHANNEL_SRC)
Bram Moolenaar8b5866d2020-09-05 15:48:51 +02002247 CHANNEL_OBJ="objects/job.o objects/channel.o"
Bram Moolenaare0874f82016-01-24 20:36:41 +01002248 AC_SUBST(CHANNEL_OBJ)
2249fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002250
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002251AC_MSG_CHECKING(--enable-terminal argument)
2252AC_ARG_ENABLE(terminal,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002253 [ --enable-terminal Enable terminal emulation support.],
Bram Moolenaaref839562017-10-28 20:28:23 +02002254 , [enable_terminal="auto"])
Bram Moolenaar595a4022017-09-03 19:15:57 +02002255if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then
Bram Moolenaar12471262022-01-18 11:11:25 +00002256 if test "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01002257 AC_MSG_RESULT([cannot use terminal emulator with tiny features])
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002258 enable_terminal="no"
2259 else
Bram Moolenaar595a4022017-09-03 19:15:57 +02002260 if test "$enable_terminal" = "auto"; then
2261 enable_terminal="yes"
2262 AC_MSG_RESULT(defaulting to yes)
2263 else
2264 AC_MSG_RESULT(yes)
2265 fi
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002266 fi
2267else
Bram Moolenaar595a4022017-09-03 19:15:57 +02002268 if test "$enable_terminal" = "auto"; then
2269 enable_terminal="no"
2270 AC_MSG_RESULT(defaulting to no)
2271 else
2272 AC_MSG_RESULT(no)
2273 fi
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002274fi
Bram Moolenaar8b423282017-12-16 14:37:06 +01002275if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002276 AC_DEFINE(FEAT_TERMINAL)
Bram Moolenaar93268052019-10-10 13:22:54 +02002277 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 +02002278 AC_SUBST(TERM_SRC)
Bram Moolenaar93268052019-10-10 13:22:54 +02002279 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 +02002280 AC_SUBST(TERM_OBJ)
Bram Moolenaar823edd12019-10-23 22:35:36 +02002281 TERM_TEST="test_libvterm"
2282 AC_SUBST(TERM_TEST)
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002283fi
2284
Bram Moolenaare42a6d22017-11-12 19:21:51 +01002285AC_MSG_CHECKING(--enable-autoservername argument)
2286AC_ARG_ENABLE(autoservername,
2287 [ --enable-autoservername Automatically define servername at vim startup.], ,
2288 [enable_autoservername="no"])
2289AC_MSG_RESULT($enable_autoservername)
2290if test "$enable_autoservername" = "yes"; then
2291 AC_DEFINE(FEAT_AUTOSERVERNAME)
2292fi
2293
Bram Moolenaar071d4272004-06-13 20:20:40 +00002294AC_MSG_CHECKING(--enable-multibyte argument)
2295AC_ARG_ENABLE(multibyte,
2296 [ --enable-multibyte Include multibyte editing support.], ,
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01002297 [enable_multibyte="yes"])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002298AC_MSG_RESULT($enable_multibyte)
Bram Moolenaar30276f22019-01-24 17:59:39 +01002299if test "$enable_multibyte" != "yes"; then
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01002300 AC_MSG_ERROR([The multi-byte feature can no longer be disabled. If you have
2301 a problem with this, discuss on the Vim mailing list.])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002302fi
2303
Martin Tournoij25f3a142022-10-08 19:26:41 +01002304dnl Right-to-Left language support for Vim will be included with huge features,
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002305dnl unless ENABLE_RIGHTLEFT is undefined.
2306AC_MSG_CHECKING(--disable-rightleft argument)
2307AC_ARG_ENABLE(rightleft,
2308 [ --disable-rightleft Do not include Right-to-Left language support.],
2309 , [enable_rightleft="yes"])
2310if test "$enable_rightleft" = "yes"; then
2311 AC_MSG_RESULT(no)
2312else
2313 AC_MSG_RESULT(yes)
2314 AC_DEFINE(DISABLE_RIGHTLEFT)
2315fi
2316
Martin Tournoij25f3a142022-10-08 19:26:41 +01002317dnl Arabic language support for Vim will be included with huge features,
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002318dnl unless ENABLE_ARABIC is undefined.
2319AC_MSG_CHECKING(--disable-arabic argument)
2320AC_ARG_ENABLE(arabic,
2321 [ --disable-arabic Do not include Arabic language support.],
2322 , [enable_arabic="yes"])
2323if test "$enable_arabic" = "yes"; then
2324 AC_MSG_RESULT(no)
2325else
2326 AC_MSG_RESULT(yes)
2327 AC_DEFINE(DISABLE_ARABIC)
2328fi
2329
Bram Moolenaar14184a32019-02-16 15:10:30 +01002330dnl Farsi language support has been removed, ignore --disable-farsi
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002331AC_ARG_ENABLE(farsi,
Bram Moolenaar14184a32019-02-16 15:10:30 +01002332 [ --disable-farsi Deprecated.],,)
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002333
Bram Moolenaar071d4272004-06-13 20:20:40 +00002334AC_MSG_CHECKING(--enable-xim argument)
2335AC_ARG_ENABLE(xim,
2336 [ --enable-xim Include XIM input support.],
2337 AC_MSG_RESULT($enable_xim),
2338 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002339
2340AC_MSG_CHECKING(--enable-fontset argument)
2341AC_ARG_ENABLE(fontset,
2342 [ --enable-fontset Include X fontset output support.], ,
2343 [enable_fontset="no"])
2344AC_MSG_RESULT($enable_fontset)
2345dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
2346
2347test -z "$with_x" && with_x=yes
Bram Moolenaard0573012017-10-28 21:11:06 +02002348test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +00002349if test "$with_x" = no; then
2350 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
2351else
2352 dnl Do this check early, so that its failure can override user requests.
2353
2354 AC_PATH_PROG(xmkmfpath, xmkmf)
2355
2356 AC_PATH_XTRA
2357
Bram Moolenaar2c704a72010-06-03 21:17:25 +02002358 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00002359 dnl be compiled with a special option.
2360 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02002361 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002362 CFLAGS="$CFLAGS -W c,dll"
2363 LDFLAGS="$LDFLAGS -W l,dll"
2364 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
2365 fi
2366
2367 dnl On my HPUX system the X include dir is found, but the lib dir not.
Bram Moolenaar70778922020-02-05 20:44:24 +01002368 dnl This is a desperate try to fix this.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002369
2370 if test -d "$x_includes" && test ! -d "$x_libraries"; then
2371 x_libraries=`echo "$x_includes" | sed s/include/lib/`
2372 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
2373 X_LIBS="$X_LIBS -L$x_libraries"
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00002374 if test "$vim_cv_uname_output" = SunOS &&
2375 echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002376 X_LIBS="$X_LIBS -R $x_libraries"
2377 fi
2378 fi
2379
2380 if test -d "$x_libraries" && test ! -d "$x_includes"; then
2381 x_includes=`echo "$x_libraries" | sed s/lib/include/`
2382 AC_MSG_RESULT(Corrected X includes to $x_includes)
2383 X_CFLAGS="$X_CFLAGS -I$x_includes"
2384 fi
2385
2386 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
2387 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
2388 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
2389 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
2390 dnl Same for "-R/usr/lib ".
2391 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
2392
2393
2394 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002395 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
2396 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002397 AC_MSG_CHECKING(if X11 header files can be found)
2398 cflags_save=$CFLAGS
2399 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002400 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <X11/Xlib.h>
2401#include <X11/Intrinsic.h>], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002402 AC_MSG_RESULT(yes),
2403 AC_MSG_RESULT(no); no_x=yes)
2404 CFLAGS=$cflags_save
2405
2406 if test "${no_x-no}" = yes; then
2407 with_x=no
2408 else
2409 AC_DEFINE(HAVE_X11)
2410 X_LIB="-lXt -lX11";
2411 AC_SUBST(X_LIB)
2412
2413 ac_save_LDFLAGS="$LDFLAGS"
2414 LDFLAGS="-L$x_libraries $LDFLAGS"
2415
2416 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
2417 dnl For HP-UX 10.20 it must be before -lSM -lICE
2418 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
2419 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
2420
2421 dnl Some systems need -lnsl -lsocket when testing for ICE.
2422 dnl The check above doesn't do this, try here (again). Also needed to get
2423 dnl them after Xdmcp. link.sh will remove them when not needed.
2424 dnl Check for other function than above to avoid the cached value
2425 AC_CHECK_LIB(ICE, IceOpenConnection,
2426 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
2427
2428 dnl Check for -lXpm (needed for some versions of Motif)
2429 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
2430 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
2431 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
2432
2433 dnl Check that the X11 header files don't use implicit declarations
2434 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
2435 cflags_save=$CFLAGS
Bram Moolenaard1864592013-05-04 04:40:15 +02002436 dnl -Werror is GCC only, others like Solaris Studio might not like it
2437 if test "$GCC" = yes; then
2438 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
2439 else
2440 CFLAGS="$CFLAGS $X_CFLAGS"
2441 fi
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002442 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <X11/Xlib.h>], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002443 AC_MSG_RESULT(no),
2444 CFLAGS="$CFLAGS -Wno-implicit-int"
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(yes); cflags_save="$cflags_save -Wno-implicit-int",
2447 AC_MSG_RESULT(test failed)
2448 )
2449 )
2450 CFLAGS=$cflags_save
2451
2452 LDFLAGS="$ac_save_LDFLAGS"
2453
Mike Gilberta055b442023-08-20 19:01:41 +02002454 AC_CHECK_SIZEOF([wchar_t])
2455 if test "$ac_cv_sizeof_wchar_t" -le 2; then
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00002456 AC_DEFINE(SMALL_WCHAR_T)
2457 fi
2458
Bram Moolenaar071d4272004-06-13 20:20:40 +00002459 fi
2460fi
2461
Bram Moolenaard2a05492018-07-27 22:35:15 +02002462dnl Check if --with-x was given but it doesn't work.
2463if test "x$with_x" = xno -a "x$with_x_arg" = xyes; then
2464 AC_MSG_ERROR([could not configure X])
2465fi
2466
Bram Moolenaarb3f74062020-02-26 16:16:53 +01002467test "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 +00002468
2469AC_MSG_CHECKING(--enable-gui argument)
2470AC_ARG_ENABLE(gui,
Bram Moolenaarf52fac22022-03-11 16:01:26 +00002471 [ --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 +00002472
2473dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
2474dnl Do not use character classes for portability with old tools.
2475enable_gui_canon=`echo "_$enable_gui" | \
2476 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2477
2478dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002479SKIP_GTK2=YES
Bram Moolenaar1858a842016-02-23 22:30:31 +01002480SKIP_GTK3=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002481SKIP_GNOME=YES
2482SKIP_MOTIF=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002483SKIP_PHOTON=YES
Bram Moolenaarb3f74062020-02-26 16:16:53 +01002484SKIP_HAIKU=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002485GUITYPE=NONE
2486
Bram Moolenaarb3f74062020-02-26 16:16:53 +01002487if test "x$HAIKU" = "xyes"; then
2488 SKIP_HAIKU=
2489 case "$enable_gui_canon" in
2490 no) AC_MSG_RESULT(no GUI support)
2491 SKIP_HAIKU=YES ;;
2492 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
2493 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
2494 haiku) AC_MSG_RESULT(Haiku GUI support) ;;
2495 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2496 SKIP_HAIKU=YES ;;
2497 esac
2498elif test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002499 SKIP_PHOTON=
2500 case "$enable_gui_canon" in
2501 no) AC_MSG_RESULT(no GUI support)
2502 SKIP_PHOTON=YES ;;
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002503 yes|""|auto) AC_MSG_RESULT(automatic GUI support)
2504 gui_auto=yes ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002505 photon) AC_MSG_RESULT(Photon GUI support) ;;
2506 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2507 SKIP_PHOTON=YES ;;
2508 esac
2509
Bram Moolenaar040f9752020-08-11 23:08:48 +02002510elif test "x$MACOS_X" = "xyes" -a "x$with_x" = "xno" ; then
2511 case "$enable_gui_canon" in
2512 no) AC_MSG_RESULT(no GUI support) ;;
2513 yes|"") AC_MSG_RESULT(yes - automatic GUI support)
2514 gui_auto=yes ;;
2515 auto) AC_MSG_RESULT(auto - disable GUI support for Mac OS) ;;
Bram Moolenaarbe7529e2020-08-13 21:05:39 +02002516 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
Bram Moolenaar040f9752020-08-11 23:08:48 +02002517 esac
Bram Moolenaar071d4272004-06-13 20:20:40 +00002518else
2519
Bram Moolenaar071d4272004-06-13 20:20:40 +00002520 case "$enable_gui_canon" in
2521 no|none) AC_MSG_RESULT(no GUI support) ;;
2522 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002523 gui_auto=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +00002524 SKIP_GTK2=
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002525 SKIP_GTK3=
Bram Moolenaar071d4272004-06-13 20:20:40 +00002526 SKIP_GNOME=
Bram Moolenaarf52fac22022-03-11 16:01:26 +00002527 SKIP_MOTIF=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002528 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002529 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002530 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
2531 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00002532 SKIP_GTK2=;;
Bram Moolenaar98921892016-02-23 17:14:37 +01002533 gtk3) AC_MSG_RESULT(GTK+ 3.x GUI support)
2534 SKIP_GTK3=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002535 motif) AC_MSG_RESULT(Motif GUI support)
2536 SKIP_MOTIF=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002537 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
2538 esac
2539
2540fi
2541
Bram Moolenaar071d4272004-06-13 20:20:40 +00002542if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
2543 -a "$enable_gui_canon" != "gnome2"; then
2544 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
2545 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002546 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002547 , enable_gtk2_check="yes")
2548 AC_MSG_RESULT($enable_gtk2_check)
2549 if test "x$enable_gtk2_check" = "xno"; then
2550 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002551 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002552 fi
2553fi
2554
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002555if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002556 AC_MSG_CHECKING(whether or not to look for GNOME)
2557 AC_ARG_ENABLE(gnome-check,
2558 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
2559 , enable_gnome_check="no")
2560 AC_MSG_RESULT($enable_gnome_check)
2561 if test "x$enable_gnome_check" = "xno"; then
2562 SKIP_GNOME=YES
2563 fi
2564fi
2565
Bram Moolenaar98921892016-02-23 17:14:37 +01002566if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then
2567 AC_MSG_CHECKING(whether or not to look for GTK+ 3)
2568 AC_ARG_ENABLE(gtk3-check,
2569 [ --enable-gtk3-check If auto-select GUI, check for GTK+ 3 [default=yes]],
2570 , enable_gtk3_check="yes")
2571 AC_MSG_RESULT($enable_gtk3_check)
2572 if test "x$enable_gtk3_check" = "xno"; then
2573 SKIP_GTK3=YES
2574 fi
2575fi
2576
Bram Moolenaar071d4272004-06-13 20:20:40 +00002577if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
2578 AC_MSG_CHECKING(whether or not to look for Motif)
2579 AC_ARG_ENABLE(motif-check,
2580 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
2581 , enable_motif_check="yes")
2582 AC_MSG_RESULT($enable_motif_check)
2583 if test "x$enable_motif_check" = "xno"; then
2584 SKIP_MOTIF=YES
2585 fi
2586fi
2587
Bram Moolenaar071d4272004-06-13 20:20:40 +00002588dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002589dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002590dnl
2591dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00002592dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00002593dnl
2594AC_DEFUN(AM_PATH_GTK,
2595[
2596 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
2597 {
Bram Moolenaar071d4272004-06-13 20:20:40 +00002598 no_gtk=""
2599 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2600 && $PKG_CONFIG --exists gtk+-2.0; then
2601 {
Bram Moolenaar98921892016-02-23 17:14:37 +01002602 min_gtk_version=ifelse([$1], ,2.2.0,$1)
2603 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002604 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
2605 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
2606 dnl something like that.
2607 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00002608 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00002609 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
2610 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2611 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2612 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2613 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2614 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2615 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2616 }
Bram Moolenaar98921892016-02-23 17:14:37 +01002617 elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2618 && $PKG_CONFIG --exists gtk+-3.0; then
2619 {
2620 min_gtk_version=ifelse([$1], ,3.0.0,$1)
2621 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2622
2623 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0`
2624 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0`
2625 GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0`
2626 gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2627 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2628 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2629 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2630 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2631 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2632 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00002633 else
Bram Moolenaar67876de2021-01-12 20:51:24 +01002634 dnl Put some text before the "no" to hint at installing the gtk-dev
2635 dnl packages.
2636 AC_MSG_CHECKING(for GTK -dev package)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002637 no_gtk=yes
2638 fi
2639
2640 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
2641 {
2642 ac_save_CFLAGS="$CFLAGS"
2643 ac_save_LIBS="$LIBS"
2644 CFLAGS="$CFLAGS $GTK_CFLAGS"
2645 LIBS="$LIBS $GTK_LIBS"
2646
2647 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002648 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002649 dnl
2650 rm -f conf.gtktest
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002651 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaar071d4272004-06-13 20:20:40 +00002652#include <gtk/gtk.h>
2653#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002654#if STDC_HEADERS
2655# include <stdlib.h>
2656# include <stddef.h>
2657#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002658
2659int
2660main ()
2661{
2662int major, minor, micro;
2663char *tmp_version;
2664
2665system ("touch conf.gtktest");
2666
2667/* HP/UX 9 (%@#!) writes to sscanf strings */
2668tmp_version = g_strdup("$min_gtk_version");
2669if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2670 printf("%s, bad version string\n", "$min_gtk_version");
2671 exit(1);
2672 }
2673
2674if ((gtk_major_version > major) ||
2675 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2676 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
2677 (gtk_micro_version >= micro)))
2678{
2679 return 0;
2680}
2681return 1;
2682}
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01002683])],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002684 CFLAGS="$ac_save_CFLAGS"
2685 LIBS="$ac_save_LIBS"
2686 }
2687 fi
2688 if test "x$no_gtk" = x ; then
2689 if test "x$enable_gtktest" = "xyes"; then
2690 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2691 else
2692 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2693 fi
2694 ifelse([$2], , :, [$2])
2695 else
2696 {
2697 AC_MSG_RESULT(no)
2698 GTK_CFLAGS=""
2699 GTK_LIBS=""
2700 ifelse([$3], , :, [$3])
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002701 if test "$fail_if_missing" = "yes" -a "X$gui_auto" != "Xyes"; then
2702 AC_MSG_ERROR([could not configure GTK])
2703 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002704 }
2705 fi
2706 }
2707 else
2708 GTK_CFLAGS=""
2709 GTK_LIBS=""
2710 ifelse([$3], , :, [$3])
2711 fi
2712 AC_SUBST(GTK_CFLAGS)
2713 AC_SUBST(GTK_LIBS)
2714 rm -f conf.gtktest
2715])
2716
2717dnl ---------------------------------------------------------------------------
2718dnl gnome
2719dnl ---------------------------------------------------------------------------
2720AC_DEFUN([GNOME_INIT_HOOK],
2721[
2722 AC_SUBST(GNOME_LIBS)
2723 AC_SUBST(GNOME_LIBDIR)
2724 AC_SUBST(GNOME_INCLUDEDIR)
2725
2726 AC_ARG_WITH(gnome-includes,
2727 [ --with-gnome-includes=DIR Specify location of GNOME headers],
2728 [CFLAGS="$CFLAGS -I$withval"]
2729 )
2730
2731 AC_ARG_WITH(gnome-libs,
2732 [ --with-gnome-libs=DIR Specify location of GNOME libs],
2733 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
2734 )
2735
2736 AC_ARG_WITH(gnome,
2737 [ --with-gnome Specify prefix for GNOME files],
2738 if test x$withval = xyes; then
2739 want_gnome=yes
2740 ifelse([$1], [], :, [$1])
2741 else
2742 if test "x$withval" = xno; then
2743 want_gnome=no
2744 else
2745 want_gnome=yes
2746 LDFLAGS="$LDFLAGS -L$withval/lib"
2747 CFLAGS="$CFLAGS -I$withval/include"
2748 gnome_prefix=$withval/lib
2749 fi
2750 fi,
2751 want_gnome=yes)
2752
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002753 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002754 {
2755 AC_MSG_CHECKING(for libgnomeui-2.0)
2756 if $PKG_CONFIG --exists libgnomeui-2.0; then
2757 AC_MSG_RESULT(yes)
2758 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
2759 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
2760 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00002761
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002762 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
2763 dnl This might not be the right way but it works for me...
2764 AC_MSG_CHECKING(for FreeBSD)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00002765 if test "$vim_cv_uname_output" = FreeBSD; then
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002766 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00002767 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002768 GNOME_LIBS="$GNOME_LIBS -pthread"
2769 else
2770 AC_MSG_RESULT(no)
2771 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002772 $1
2773 else
2774 AC_MSG_RESULT(not found)
2775 if test "x$2" = xfail; then
2776 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
2777 fi
2778 fi
2779 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00002780 fi
2781])
2782
2783AC_DEFUN([GNOME_INIT],[
2784 GNOME_INIT_HOOK([],fail)
2785])
2786
Bram Moolenaar427f5b62019-06-09 13:43:51 +02002787if test "X$PKG_CONFIG" = "X"; then
2788 AC_PATH_TOOL(PKG_CONFIG, pkg-config, no)
2789fi
2790
Bram Moolenaar071d4272004-06-13 20:20:40 +00002791
2792dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002793dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00002794dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002795if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002796
2797 AC_MSG_CHECKING(--disable-gtktest argument)
2798 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2799 , enable_gtktest=yes)
2800 if test "x$enable_gtktest" = "xyes" ; then
2801 AC_MSG_RESULT(gtk test enabled)
2802 else
2803 AC_MSG_RESULT(gtk test disabled)
2804 fi
2805
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002806 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002807 dnl First try finding version 2.2.0 or later. The 2.0.x series has
2808 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002809 dnl Disable checking for GTK3 here, otherwise it's found when GTK2 is not
2810 dnl found.
2811 save_skip_gtk3=$SKIP_GTK3
2812 SKIP_GTK3=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002813 AM_PATH_GTK(2.2.0,
2814 [GUI_LIB_LOC="$GTK_LIBDIR"
2815 GTK_LIBNAME="$GTK_LIBS"
2816 GUI_INC_LOC="$GTK_CFLAGS"], )
2817 if test "x$GTK_CFLAGS" != "x"; then
Bram Moolenaar98921892016-02-23 17:14:37 +01002818 SKIP_GTK3=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002819 SKIP_MOTIF=YES
2820 GUITYPE=GTK
2821 AC_SUBST(GTK_LIBNAME)
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002822 else
2823 SKIP_GTK3=$save_skip_gtk3
Bram Moolenaar071d4272004-06-13 20:20:40 +00002824 fi
2825 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002826 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002827 dnl
2828 dnl if GTK exists, then check for GNOME.
2829 dnl
2830 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002831 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002832 GNOME_INIT_HOOK([have_gnome=yes])
2833 if test "x$have_gnome" = xyes ; then
2834 AC_DEFINE(FEAT_GUI_GNOME)
2835 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
2836 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002837 fi
2838 }
2839 fi
2840 fi
2841fi
2842
Bram Moolenaar98921892016-02-23 17:14:37 +01002843
2844dnl ---------------------------------------------------------------------------
2845dnl Check for GTK3.
2846dnl ---------------------------------------------------------------------------
2847if test -z "$SKIP_GTK3"; then
2848
2849 AC_MSG_CHECKING(--disable-gtktest argument)
2850 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2851 , enable_gtktest=yes)
2852 if test "x$enable_gtktest" = "xyes" ; then
2853 AC_MSG_RESULT(gtk test enabled)
2854 else
2855 AC_MSG_RESULT(gtk test disabled)
2856 fi
2857
Bram Moolenaar98921892016-02-23 17:14:37 +01002858 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002859 save_skip_gtk2=$SKIP_GTK2
2860 SKIP_GTK2=YES
Bram Moolenaar98921892016-02-23 17:14:37 +01002861 AM_PATH_GTK(3.0.0,
2862 [GUI_LIB_LOC="$GTK_LIBDIR"
2863 GTK_LIBNAME="$GTK_LIBS"
2864 GUI_INC_LOC="$GTK_CFLAGS"], )
2865 if test "x$GTK_CFLAGS" != "x"; then
2866 SKIP_GTK2=YES
2867 SKIP_GNOME=YES
Bram Moolenaar98921892016-02-23 17:14:37 +01002868 SKIP_MOTIF=YES
2869 GUITYPE=GTK
2870 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar98921892016-02-23 17:14:37 +01002871 AC_DEFINE(USE_GTK3)
Bram Moolenaarf272ae12021-01-31 19:52:50 +01002872 else
2873 SKIP_GTK2=$save_skip_gtk2
Bram Moolenaar98921892016-02-23 17:14:37 +01002874 fi
2875 fi
2876fi
2877
Bram Moolenaard2e03f02016-01-02 22:46:36 +01002878dnl Check the version of Gdk-Pixbuf. If the version is 2.31 or later and
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002879dnl glib-compile-resources is found in PATH, use GResource.
2880if test "x$GUITYPE" = "xGTK"; then
2881 AC_MSG_CHECKING([version of Gdk-Pixbuf])
2882 gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0`
2883 if test "x$gdk_pixbuf_version" != x ; then
2884 gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \
2885 sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'`
2886 if test "x$gdk_pixbuf_version_minor" != x -a \
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002887 $gdk_pixbuf_version_minor -ge 31 ; then
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002888 AC_MSG_RESULT([OK.])
2889 AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
2890 AC_MSG_CHECKING([glib-compile-resources])
2891 if test "x$GLIB_COMPILE_RESOURCES" = xno ; then
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002892 GLIB_COMPILE_RESOURCES=""
2893 AC_MSG_RESULT([cannot be found in PATH.])
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002894 else
2895 AC_MSG_RESULT([usable.])
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002896 AC_DEFINE(USE_GRESOURCE)
2897 GRESOURCE_SRC="auto/gui_gtk_gresources.c"
2898 GRESOURCE_OBJ="objects/gui_gtk_gresources.o"
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002899 fi
2900 else
2901 AC_MSG_RESULT([not usable.])
2902 fi
2903 else
2904 AC_MSG_RESULT([cannot obtain from pkg_config.])
2905 fi
Bram Moolenaar4adfaab2016-04-21 18:20:11 +02002906
2907 AC_MSG_CHECKING([--disable-icon-cache-update argument])
2908 AC_ARG_ENABLE(icon_cache_update,
2909 [ --disable-icon-cache-update update disabled],
2910 [],
2911 [enable_icon_cache_update="yes"])
2912 if test "$enable_icon_cache_update" = "yes"; then
2913 AC_MSG_RESULT([not set])
2914 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no)
2915 if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then
2916 AC_MSG_RESULT([not found in PATH.])
2917 fi
2918 else
2919 AC_MSG_RESULT([update disabled])
2920 fi
2921
2922 AC_MSG_CHECKING([--disable-desktop-database-update argument])
2923 AC_ARG_ENABLE(desktop_database_update,
2924 [ --disable-desktop-database-update update disabled],
2925 [],
2926 [enable_desktop_database_update="yes"])
2927 if test "$enable_desktop_database_update" = "yes"; then
2928 AC_MSG_RESULT([not set])
2929 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no)
2930 if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then
2931 AC_MSG_RESULT([not found in PATH.])
2932 fi
2933 else
2934 AC_MSG_RESULT([update disabled])
2935 fi
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002936fi
2937AC_SUBST(GLIB_COMPILE_RESOURCES)
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002938AC_SUBST(GRESOURCE_SRC)
2939AC_SUBST(GRESOURCE_OBJ)
Bram Moolenaar4adfaab2016-04-21 18:20:11 +02002940AC_SUBST(GTK_UPDATE_ICON_CACHE)
2941AC_SUBST(UPDATE_DESKTOP_DATABASE)
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002942
Bram Moolenaar071d4272004-06-13 20:20:40 +00002943dnl Check for Motif include files location.
2944dnl The LAST one found is used, this makes the highest version to be used,
2945dnl e.g. when Motif1.2 and Motif2.0 are both present.
2946
2947if test -z "$SKIP_MOTIF"; then
2948 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"
2949 dnl Remove "-I" from before $GUI_INC_LOC if it's there
2950 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
2951
2952 AC_MSG_CHECKING(for location of Motif GUI includes)
2953 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
2954 GUI_INC_LOC=
2955 for try in $gui_includes; do
2956 if test -f "$try/Xm/Xm.h"; then
2957 GUI_INC_LOC=$try
2958 fi
2959 done
2960 if test -n "$GUI_INC_LOC"; then
2961 if test "$GUI_INC_LOC" = /usr/include; then
2962 GUI_INC_LOC=
2963 AC_MSG_RESULT(in default path)
2964 else
2965 AC_MSG_RESULT($GUI_INC_LOC)
2966 fi
2967 else
2968 AC_MSG_RESULT(<not found>)
2969 SKIP_MOTIF=YES
2970 fi
2971fi
2972
2973dnl Check for Motif library files location. In the same order as the include
2974dnl files, to avoid a mixup if several versions are present
2975
2976if test -z "$SKIP_MOTIF"; then
2977 AC_MSG_CHECKING(--with-motif-lib argument)
2978 AC_ARG_WITH(motif-lib,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002979 [ --with-motif-lib=STRING Library for Motif ],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002980 [ MOTIF_LIBNAME="${withval}" ] )
2981
2982 if test -n "$MOTIF_LIBNAME"; then
2983 AC_MSG_RESULT($MOTIF_LIBNAME)
2984 GUI_LIB_LOC=
2985 else
2986 AC_MSG_RESULT(no)
2987
2988 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
2989 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
2990
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02002991 dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere. The
2992 dnl linker will figure out which one to use, we only check if one exists.
Kelvin Leeb4716902022-04-04 17:20:01 +01002993 dnl Cygwin uses the .dll.a extension.
Bram Moolenaar01967f52023-04-12 16:24:03 +01002994 dnl OpenSUSE appears to use /usr/lib64.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002995 AC_MSG_CHECKING(for location of Motif GUI libs)
Bram Moolenaar01967f52023-04-12 16:24:03 +01002996 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 +00002997 GUI_LIB_LOC=
2998 for try in $gui_libs; do
Kelvin Leeb4716902022-04-04 17:20:01 +01002999 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 +00003000 if test -f "$libtry"; then
3001 GUI_LIB_LOC=$try
3002 fi
3003 done
3004 done
3005 if test -n "$GUI_LIB_LOC"; then
Bram Moolenaar01967f52023-04-12 16:24:03 +01003006 dnl Remove /usr/lib, it causes trouble on some systems.
3007 dnl For consistency also remove other standard lib directories.
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02003008 if test "$GUI_LIB_LOC" = /usr/lib \
Bram Moolenaar01967f52023-04-12 16:24:03 +01003009 -o "$GUI_LIB_LOC" = /usr/lib64 \
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02003010 -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \
3011 -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003012 GUI_LIB_LOC=
3013 AC_MSG_RESULT(in default path)
3014 else
3015 if test -n "$GUI_LIB_LOC"; then
3016 AC_MSG_RESULT($GUI_LIB_LOC)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00003017 if test "$vim_cv_uname_output" = SunOS &&
3018 echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003019 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
3020 fi
3021 fi
3022 fi
3023 MOTIF_LIBNAME=-lXm
3024 else
3025 AC_MSG_RESULT(<not found>)
3026 SKIP_MOTIF=YES
3027 fi
3028 fi
3029fi
3030
3031if test -z "$SKIP_MOTIF"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003032 GUITYPE=MOTIF
3033 AC_SUBST(MOTIF_LIBNAME)
3034fi
3035
Bram Moolenaare2adcf32022-03-12 11:57:25 +00003036if test -z "$SKIP_MOTIF"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003037 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
3038 dnl Avoid adding it when it twice
3039 if test -n "$GUI_INC_LOC"; then
3040 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
3041 fi
3042 if test -n "$GUI_LIB_LOC"; then
3043 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
3044 fi
3045
3046 dnl Check for -lXext and then for -lXmu
3047 ldflags_save=$LDFLAGS
3048 LDFLAGS="$X_LIBS $LDFLAGS"
3049 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
3050 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3051 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
3052 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
3053 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3054 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
3055 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3056 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
3057 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3058 if test -z "$SKIP_MOTIF"; then
3059 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
3060 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3061 fi
3062 LDFLAGS=$ldflags_save
3063
3064 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
3065 AC_MSG_CHECKING(for extra X11 defines)
3066 NARROW_PROTO=
3067 rm -fr conftestdir
3068 if mkdir conftestdir; then
3069 cd conftestdir
3070 cat > Imakefile <<'EOF'
3071acfindx:
3072 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
3073EOF
3074 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
3075 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
3076 fi
3077 cd ..
3078 rm -fr conftestdir
3079 fi
3080 if test -z "$NARROW_PROTO"; then
3081 AC_MSG_RESULT(no)
3082 else
3083 AC_MSG_RESULT($NARROW_PROTO)
3084 fi
3085 AC_SUBST(NARROW_PROTO)
3086fi
3087
3088dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
3089dnl use the X11 include path
3090if test "$enable_xsmp" = "yes"; then
3091 cppflags_save=$CPPFLAGS
3092 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3093 AC_CHECK_HEADERS(X11/SM/SMlib.h)
3094 CPPFLAGS=$cppflags_save
3095fi
3096
3097
Bram Moolenaarf52fac22022-03-11 16:01:26 +00003098if test -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003099 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
3100 cppflags_save=$CPPFLAGS
3101 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3102 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
3103
3104 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
3105 if test ! "$enable_xim" = "no"; then
3106 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
3107 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
3108 AC_MSG_RESULT(yes),
Bram Moolenaare29b1fe2014-04-10 20:00:15 +02003109 AC_MSG_RESULT(no; xim has been disabled); enable_xim="no")
Bram Moolenaar071d4272004-06-13 20:20:40 +00003110 fi
3111 CPPFLAGS=$cppflags_save
3112
Bram Moolenaar54612582019-11-21 17:13:31 +01003113 dnl automatically enable XIM in the GUI
3114 if test "$enable_xim" = "auto" -a "x$GUITYPE" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003115 AC_MSG_RESULT(X GUI selected; xim has been enabled)
3116 enable_xim="yes"
3117 fi
3118fi
3119
Bram Moolenaarf52fac22022-03-11 16:01:26 +00003120if test -z "$SKIP_MOTIF"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003121 cppflags_save=$CPPFLAGS
3122 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00003123dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
3124 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003125 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00003126#include <X11/Intrinsic.h>
3127#include <X11/Xmu/Editres.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003128 [int i; i = 0;])],
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00003129 AC_MSG_RESULT(yes)
3130 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
3131 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00003132 CPPFLAGS=$cppflags_save
3133fi
3134
Bram Moolenaar0b40d082022-03-08 13:32:37 +00003135dnl Only use the Xm directory when compiling Motif.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003136if test -z "$SKIP_MOTIF"; then
3137 cppflags_save=$CPPFLAGS
3138 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar77c19352012-06-13 19:19:41 +02003139 if test "$zOSUnix" = "yes"; then
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003140 AC_CHECK_HEADERS(Xm/Xm.h)
Bram Moolenaar77c19352012-06-13 19:19:41 +02003141 else
Bram Moolenaarde1d7342022-06-05 20:03:17 +01003142 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 +01003143 fi
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003144
Bram Moolenaar77c19352012-06-13 19:19:41 +02003145 if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003146 dnl Solaris uses XpmAttributes_21, very annoying.
3147 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003148 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;])],
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003149 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
3150 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
3151 )
3152 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00003153 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003154 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003155 CPPFLAGS=$cppflags_save
3156fi
3157
3158if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
3159 AC_MSG_RESULT(no GUI selected; xim has been disabled)
3160 enable_xim="no"
3161fi
3162if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
3163 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
3164 enable_fontset="no"
3165fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02003166if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003167 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
3168 enable_fontset="no"
3169fi
3170
Bram Moolenaarb3f74062020-02-26 16:16:53 +01003171dnl There is no test for the Haiku GUI, if it's selected it's used
3172if test -z "$SKIP_HAIKU"; then
3173 GUITYPE=HAIKUGUI
3174fi
3175
Bram Moolenaar071d4272004-06-13 20:20:40 +00003176if test -z "$SKIP_PHOTON"; then
3177 GUITYPE=PHOTONGUI
3178fi
3179
3180AC_SUBST(GUI_INC_LOC)
3181AC_SUBST(GUI_LIB_LOC)
3182AC_SUBST(GUITYPE)
3183AC_SUBST(GUI_X_LIBS)
3184
3185if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
3186 AC_MSG_ERROR([cannot use workshop without Motif])
3187fi
3188
3189dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
3190if test "$enable_xim" = "yes"; then
3191 AC_DEFINE(FEAT_XIM)
3192fi
3193if test "$enable_fontset" = "yes"; then
3194 AC_DEFINE(FEAT_XFONTSET)
3195fi
3196
3197
3198dnl ---------------------------------------------------------------------------
3199dnl end of GUI-checking
3200dnl ---------------------------------------------------------------------------
3201
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003202AC_MSG_CHECKING([for /proc link to executable])
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003203if test -L "/proc/self/exe"; then
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003204 dnl Linux
3205 AC_MSG_RESULT([/proc/self/exe])
3206 AC_DEFINE(PROC_EXE_LINK, "/proc/self/exe")
3207elif test -L "/proc/self/path/a.out"; then
3208 dnl Solaris
3209 AC_MSG_RESULT([/proc/self/path/a.out])
3210 AC_DEFINE(PROC_EXE_LINK, "/proc/self/path/a.out")
3211elif test -L "/proc/curproc/file"; then
3212 dnl FreeBSD
3213 AC_MSG_RESULT([/proc/curproc/file])
3214 AC_DEFINE(PROC_EXE_LINK, "/proc/curproc/file")
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003215else
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003216 AC_MSG_RESULT(no)
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003217fi
3218
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003219dnl Check for Cygwin, which needs an extra source file if not using X11
Bram Moolenaar8def26a2015-12-17 15:34:53 +01003220AC_MSG_CHECKING(for CYGWIN or MSYS environment)
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00003221case $vim_cv_uname_output in
Bram Moolenaar8def26a2015-12-17 15:34:53 +01003222 CYGWIN*|MSYS*) CYGWIN=yes; AC_MSG_RESULT(yes)
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003223 AC_MSG_CHECKING(for CYGWIN clipboard support)
3224 if test "x$with_x" = "xno" ; then
3225 OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o
3226 AC_MSG_RESULT(yes)
3227 AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD)
3228 else
3229 AC_MSG_RESULT(no - using X11)
3230 fi ;;
3231
3232 *) CYGWIN=no; AC_MSG_RESULT(no);;
3233esac
Bram Moolenaar071d4272004-06-13 20:20:40 +00003234
Bram Moolenaar071d4272004-06-13 20:20:40 +00003235dnl Checks for libraries and include files.
3236
Bram Moolenaar446cb832008-06-24 21:56:24 +00003237AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
3238 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003239 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003240#include "confdefs.h"
3241#include <ctype.h>
3242#if STDC_HEADERS
3243# include <stdlib.h>
3244# include <stddef.h>
3245#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003246int main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003247 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003248 vim_cv_toupper_broken=yes
3249 ],[
3250 vim_cv_toupper_broken=no
3251 ],[
3252 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
3253 ])])
3254
3255if test "x$vim_cv_toupper_broken" = "xyes" ; then
3256 AC_DEFINE(BROKEN_TOUPPER)
3257fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003258
3259AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003260AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003261 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
3262 AC_MSG_RESULT(no))
3263
Bram Moolenaar0c094b92009-05-14 20:20:33 +00003264AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003265AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [int x __attribute__((unused));])],
Bram Moolenaar0c094b92009-05-14 20:20:33 +00003266 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
3267 AC_MSG_RESULT(no))
3268
Bram Moolenaar071d4272004-06-13 20:20:40 +00003269dnl Checks for header files.
3270AC_CHECK_HEADER(elf.h, HAS_ELF=1)
3271dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
3272if test "$HAS_ELF" = 1; then
3273 AC_CHECK_LIB(elf, main)
3274fi
3275
3276AC_HEADER_DIRENT
3277
Bram Moolenaar071d4272004-06-13 20:20:40 +00003278dnl If sys/wait.h is not found it might still exist but not be POSIX
3279dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
3280if test $ac_cv_header_sys_wait_h = no; then
3281 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003282 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/wait.h>],
3283 [union wait xx, yy; xx = yy])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003284 AC_MSG_RESULT(yes)
3285 AC_DEFINE(HAVE_SYS_WAIT_H)
3286 AC_DEFINE(HAVE_UNION_WAIT),
3287 AC_MSG_RESULT(no))
3288fi
3289
Bram Moolenaar779a7752016-01-30 23:26:34 +01003290AC_CHECK_HEADERS(stdint.h stdlib.h string.h \
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003291 sys/select.h sys/utsname.h termcap.h fcntl.h \
3292 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
3293 termio.h iconv.h inttypes.h langinfo.h math.h \
3294 unistd.h stropts.h errno.h sys/resource.h \
3295 sys/systeminfo.h locale.h sys/stream.h termios.h \
3296 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
Bram Moolenaar1ecc5e42019-01-26 15:12:55 +01003297 utime.h sys/param.h sys/ptms.h libintl.h libgen.h \
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003298 util/debug.h util/msg18n.h frame.h sys/acl.h \
3299 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003300
Bram Moolenaar00ca2842008-06-26 20:14:00 +00003301dnl sys/ptem.h depends on sys/stream.h on Solaris
3302AC_CHECK_HEADERS(sys/ptem.h, [], [],
3303[#if defined HAVE_SYS_STREAM_H
3304# include <sys/stream.h>
3305#endif])
3306
Bram Moolenaar32f31b12009-05-21 13:20:59 +00003307dnl sys/sysctl.h depends on sys/param.h on OpenBSD
3308AC_CHECK_HEADERS(sys/sysctl.h, [], [],
3309[#if defined HAVE_SYS_PARAM_H
3310# include <sys/param.h>
3311#endif])
3312
Bram Moolenaar00ca2842008-06-26 20:14:00 +00003313
Bram Moolenaardf3267e2005-01-25 22:07:05 +00003314dnl pthread_np.h may exist but can only be used after including pthread.h
3315AC_MSG_CHECKING([for pthread_np.h])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003316AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaardf3267e2005-01-25 22:07:05 +00003317#include <pthread.h>
3318#include <pthread_np.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003319 [int i; i = 0;])],
Bram Moolenaardf3267e2005-01-25 22:07:05 +00003320 AC_MSG_RESULT(yes)
3321 AC_DEFINE(HAVE_PTHREAD_NP_H),
3322 AC_MSG_RESULT(no))
3323
Bram Moolenaare344bea2005-09-01 20:46:49 +00003324AC_CHECK_HEADERS(strings.h)
Bram Moolenaard0573012017-10-28 21:11:06 +02003325if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +00003326 dnl The strings.h file on OS/X contains a warning and nothing useful.
3327 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3328else
Bram Moolenaar071d4272004-06-13 20:20:40 +00003329
3330dnl Check if strings.h and string.h can both be included when defined.
3331AC_MSG_CHECKING([if strings.h can be included after string.h])
3332cppflags_save=$CPPFLAGS
3333CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003334AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003335#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
3336# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
3337 /* but don't do it on AIX 5.1 (Uribarri) */
3338#endif
3339#ifdef HAVE_XM_XM_H
3340# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
3341#endif
3342#ifdef HAVE_STRING_H
3343# include <string.h>
3344#endif
3345#if defined(HAVE_STRINGS_H)
3346# include <strings.h>
3347#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003348 ], [int i; i = 0;])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003349 AC_MSG_RESULT(yes),
3350 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3351 AC_MSG_RESULT(no))
3352CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00003353fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003354
3355dnl Checks for typedefs, structures, and compiler characteristics.
3356AC_PROG_GCC_TRADITIONAL
3357AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00003358AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00003359AC_TYPE_MODE_T
3360AC_TYPE_OFF_T
3361AC_TYPE_PID_T
3362AC_TYPE_SIZE_T
3363AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02003364AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003365
Illia Bobyrf39842f2023-08-27 18:21:23 +02003366AC_CHECK_HEADERS_ONCE([sys/time.h])
3367
Bram Moolenaar071d4272004-06-13 20:20:40 +00003368AC_CHECK_TYPE(ino_t, long)
3369AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02003370AC_C_BIGENDIAN(,,,)
Bram Moolenaar136f29a2016-02-27 20:14:15 +01003371AC_C_INLINE
Bram Moolenaar071d4272004-06-13 20:20:40 +00003372
3373AC_MSG_CHECKING(for rlim_t)
3374if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
3375 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
3376else
3377 AC_EGREP_CPP(dnl
3378changequote(<<,>>)dnl
3379<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
3380changequote([,]),
3381 [
3382#include <sys/types.h>
3383#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003384# include <stdlib.h>
3385# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003386#endif
3387#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00003388# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003389#endif
3390 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
3391 AC_MSG_RESULT($ac_cv_type_rlim_t)
3392fi
3393if test $ac_cv_type_rlim_t = no; then
3394 cat >> confdefs.h <<\EOF
3395#define rlim_t unsigned long
3396EOF
3397fi
3398
3399AC_MSG_CHECKING(for stack_t)
3400if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
3401 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
3402else
3403 AC_EGREP_CPP(stack_t,
3404 [
3405#include <sys/types.h>
3406#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003407# include <stdlib.h>
3408# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003409#endif
3410#include <signal.h>
3411 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
3412 AC_MSG_RESULT($ac_cv_type_stack_t)
3413fi
3414if test $ac_cv_type_stack_t = no; then
3415 cat >> confdefs.h <<\EOF
3416#define stack_t struct sigaltstack
3417EOF
3418fi
3419
3420dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
3421AC_MSG_CHECKING(whether stack_t has an ss_base field)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003422AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003423#include <sys/types.h>
3424#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003425# include <stdlib.h>
3426# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003427#endif
3428#include <signal.h>
3429#include "confdefs.h"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003430 ], [stack_t sigstk; sigstk.ss_base = 0; ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003431 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
3432 AC_MSG_RESULT(no))
3433
3434olibs="$LIBS"
3435AC_MSG_CHECKING(--with-tlib argument)
3436AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
3437if test -n "$with_tlib"; then
3438 AC_MSG_RESULT($with_tlib)
3439 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003440 AC_MSG_CHECKING(for linking with $with_tlib library)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003441 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003442 dnl Need to check for tgetent() below.
3443 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003444else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003445 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003446 dnl On HP-UX 10.10 termcap or termlib should be used instead of
3447 dnl curses, because curses is much slower.
Bram Moolenaar4e509b62011-02-09 17:42:57 +01003448 dnl Newer versions of ncurses are preferred over anything, except
Bram Moolenaar8f4ba692011-05-05 17:24:27 +02003449 dnl when tinfo has been split off, it contains all we need.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003450 dnl Older versions of ncurses have bugs, get a new one!
3451 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00003452 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar6840a0f2021-12-13 20:37:59 +00003453 case "$vim_cv_uname_output" in
Bram Moolenaar4e509b62011-02-09 17:42:57 +01003454 OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";;
3455 *) tlibs="tinfo ncurses termlib termcap curses";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00003456 esac
3457 for libname in $tlibs; do
3458 AC_CHECK_LIB(${libname}, tgetent,,)
3459 if test "x$olibs" != "x$LIBS"; then
3460 dnl It's possible that a library is found but it doesn't work
3461 dnl e.g., shared library that cannot be found
3462 dnl compile and run a test program to be sure
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003463 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003464#ifdef HAVE_TERMCAP_H
3465# include <termcap.h>
3466#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003467#if STDC_HEADERS
3468# include <stdlib.h>
3469# include <stddef.h>
3470#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003471int main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003472 res="OK", res="FAIL", res="FAIL")
3473 if test "$res" = "OK"; then
3474 break
3475 fi
3476 AC_MSG_RESULT($libname library is not usable)
3477 LIBS="$olibs"
3478 fi
3479 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003480 if test "x$olibs" = "x$LIBS"; then
3481 AC_MSG_RESULT(no terminal library found)
3482 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003483fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003484
3485if test "x$olibs" = "x$LIBS"; then
3486 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003487 AC_LINK_IFELSE([AC_LANG_PROGRAM([int tgetent(char *, const char *);],
3488 [[char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");]])],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003489 AC_MSG_RESULT(yes),
3490 AC_MSG_ERROR([NOT FOUND!
3491 You need to install a terminal library; for example ncurses.
Bram Moolenaar16678eb2021-04-21 11:57:59 +02003492 On Linux that would be the libncurses-dev package.
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003493 Or specify the name of the library with --with-tlib.]))
3494fi
3495
Bram Moolenaar446cb832008-06-24 21:56:24 +00003496AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
3497 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003498 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003499#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003500#ifdef HAVE_TERMCAP_H
3501# include <termcap.h>
3502#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003503#ifdef HAVE_STRING_H
3504# include <string.h>
3505#endif
3506#if STDC_HEADERS
3507# include <stdlib.h>
3508# include <stddef.h>
3509#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003510int main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00003511{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003512 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003513 vim_cv_terminfo=no
3514 ],[
3515 vim_cv_terminfo=yes
3516 ],[
3517 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
3518 ])
3519 ])
3520
3521if test "x$vim_cv_terminfo" = "xyes" ; then
3522 AC_DEFINE(TERMINFO)
3523fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003524
Bram Moolenaara88254f2017-11-02 23:04:14 +01003525AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgetent],
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003526 [
3527 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003528#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003529#ifdef HAVE_TERMCAP_H
3530# include <termcap.h>
3531#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003532#if STDC_HEADERS
3533# include <stdlib.h>
3534# include <stddef.h>
3535#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003536int main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00003537{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003538 ]])],[
Bram Moolenaara88254f2017-11-02 23:04:14 +01003539 vim_cv_tgetent=zero
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003540 ],[
Bram Moolenaara88254f2017-11-02 23:04:14 +01003541 vim_cv_tgetent=non-zero
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003542 ],[
3543 AC_MSG_ERROR(failed to compile test program.)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003544 ])
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003545 ])
3546
Bram Moolenaara88254f2017-11-02 23:04:14 +01003547if test "x$vim_cv_tgetent" = "xzero" ; then
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003548 AC_DEFINE(TGETENT_ZERO_ERR, 0)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003549fi
3550
3551AC_MSG_CHECKING(whether termcap.h contains ospeed)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003552AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003553#ifdef HAVE_TERMCAP_H
3554# include <termcap.h>
3555#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003556 ], [ospeed = 20000])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003557 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
3558 [AC_MSG_RESULT(no)
3559 AC_MSG_CHECKING(whether ospeed can be extern)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003560 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003561#ifdef HAVE_TERMCAP_H
3562# include <termcap.h>
3563#endif
3564extern short ospeed;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003565 ], [ospeed = 20000])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003566 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
3567 AC_MSG_RESULT(no))]
3568 )
3569
3570AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003571AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003572#ifdef HAVE_TERMCAP_H
3573# include <termcap.h>
3574#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003575 ], [if (UP == 0 && BC == 0) PC = 1])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003576 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
3577 [AC_MSG_RESULT(no)
3578 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003579 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003580#ifdef HAVE_TERMCAP_H
3581# include <termcap.h>
3582#endif
3583extern char *UP, *BC, PC;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003584 ], [if (UP == 0 && BC == 0) PC = 1])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003585 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
3586 AC_MSG_RESULT(no))]
3587 )
3588
3589AC_MSG_CHECKING(whether tputs() uses outfuntype)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003590AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003591#ifdef HAVE_TERMCAP_H
3592# include <termcap.h>
3593#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003594 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003595 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
3596 AC_MSG_RESULT(no))
3597
Bram Moolenaarb3a29552021-11-19 11:28:04 +00003598AC_MSG_CHECKING([whether del_curterm() can be used])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003599AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaarb3a29552021-11-19 11:28:04 +00003600#ifdef HAVE_TERMCAP_H
3601# include <termcap.h>
3602#endif
3603#include <term.h>
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003604 ], [if (cur_term) del_curterm(cur_term);])],
Bram Moolenaarb3a29552021-11-19 11:28:04 +00003605 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DEL_CURTERM),
3606 AC_MSG_RESULT(no))
3607
Bram Moolenaar071d4272004-06-13 20:20:40 +00003608dnl On some SCO machines sys/select redefines struct timeval
3609AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003610AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003611#include <sys/types.h>
3612#include <sys/time.h>
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003613#include <sys/select.h>], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003614 AC_MSG_RESULT(yes)
3615 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
3616 AC_MSG_RESULT(no))
3617
Bram Moolenaar071d4272004-06-13 20:20:40 +00003618dnl Checks for pty.c (copied from screen) ==========================
3619AC_MSG_CHECKING(for /dev/ptc)
3620if test -r /dev/ptc; then
3621 AC_DEFINE(HAVE_DEV_PTC)
3622 AC_MSG_RESULT(yes)
3623else
3624 AC_MSG_RESULT(no)
3625fi
3626
3627AC_MSG_CHECKING(for SVR4 ptys)
3628if test -c /dev/ptmx ; then
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003629 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaarce7be3a2020-11-26 20:11:11 +01003630// These should be in stdlib.h, but it depends on _XOPEN_SOURCE.
3631char *ptsname(int);
3632int unlockpt(int);
3633int grantpt(int);
3634 ], [
3635 ptsname(0);
3636 grantpt(0);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003637 unlockpt(0);])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003638 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
3639 AC_MSG_RESULT(no))
3640else
3641 AC_MSG_RESULT(no)
3642fi
3643
3644AC_MSG_CHECKING(for ptyranges)
3645if test -d /dev/ptym ; then
3646 pdir='/dev/ptym'
3647else
3648 pdir='/dev'
3649fi
3650dnl SCO uses ptyp%d
3651AC_EGREP_CPP(yes,
3652[#ifdef M_UNIX
3653 yes;
3654#endif
3655 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
3656dnl if test -c /dev/ptyp19; then
3657dnl ptys=`echo /dev/ptyp??`
3658dnl else
3659dnl ptys=`echo $pdir/pty??`
3660dnl fi
3661if test "$ptys" != "$pdir/pty??" ; then
3662 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
3663 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
3664 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
3665 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
3666 AC_MSG_RESULT([$p0 / $p1])
3667else
3668 AC_MSG_RESULT([don't know])
3669fi
3670
Bram Moolenaar071d4272004-06-13 20:20:40 +00003671dnl Checks for library functions. ===================================
3672
Bram Moolenaar071d4272004-06-13 20:20:40 +00003673dnl check if struct sigcontext is defined (used for SGI only)
3674AC_MSG_CHECKING(for struct sigcontext)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003675AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003676#include <signal.h>
Sam Jamesf8ea1062022-11-05 15:13:50 +00003677int test_sig()
Bram Moolenaar071d4272004-06-13 20:20:40 +00003678{
3679 struct sigcontext *scont;
3680 scont = (struct sigcontext *)0;
3681 return 1;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003682} ], )],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003683 AC_MSG_RESULT(yes)
3684 AC_DEFINE(HAVE_SIGCONTEXT),
3685 AC_MSG_RESULT(no))
3686
3687dnl tricky stuff: try to find out if getcwd() is implemented with
3688dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00003689AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
3690 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003691 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003692#include "confdefs.h"
3693#ifdef HAVE_UNISTD_H
3694#include <unistd.h>
3695#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003696char *dagger[] = { "IFS=pwd", 0 };
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003697int main()
Bram Moolenaar071d4272004-06-13 20:20:40 +00003698{
3699 char buffer[500];
3700 extern char **environ;
3701 environ = dagger;
3702 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00003703}
Bram Moolenaar7db77842014-03-27 17:40:59 +01003704 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003705 vim_cv_getcwd_broken=no
3706 ],[
3707 vim_cv_getcwd_broken=yes
3708 ],[
3709 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
3710 ])
3711 ])
3712
3713if test "x$vim_cv_getcwd_broken" = "xyes" ; then
3714 AC_DEFINE(BAD_GETCWD)
Bram Moolenaar63d25552019-05-10 21:28:38 +02003715 AC_CHECK_FUNCS(getwd)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003716fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003717
Bram Moolenaar25153e12010-02-24 14:47:08 +01003718dnl Check for functions in one big call, to reduce the size of configure.
3719dnl Can only be used for functions that do not require any include.
Bram Moolenaarcd142e32017-11-16 17:03:45 +01003720AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \
Bram Moolenaar63d25552019-05-10 21:28:38 +02003721 getpwent getpwnam getpwuid getrlimit gettimeofday localtime_r lstat \
Bram Moolenaareaf03392009-11-17 11:08:52 +00003722 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar2fcf6682017-03-11 20:03:42 +01003723 getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar84cf6bd2020-06-16 20:03:43 +02003724 sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \
Bram Moolenaar10455d42019-11-21 15:36:18 +01003725 strnicmp strpbrk strptime strtol tgetent towlower towupper iswupper \
Bram Moolenaar08210f82023-04-13 19:15:54 +01003726 tzset usleep utime utimes mblen ftruncate unsetenv posix_openpt \
3727 clock_gettime)
Bram Moolenaar643b6142018-09-12 20:29:09 +02003728AC_FUNC_SELECT_ARGTYPES
Bram Moolenaar25153e12010-02-24 14:47:08 +01003729AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00003730
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02003731dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
3732dnl appropriate, so that off_t is 64 bits when needed.
3733AC_SYS_LARGEFILE
3734
Bram Moolenaar21606672019-06-14 20:40:58 +02003735AC_MSG_CHECKING(--enable-canberra argument)
3736AC_ARG_ENABLE(canberra,
3737 [ --disable-canberra Do not use libcanberra.],
3738 , [enable_canberra="maybe"])
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003739
Bram Moolenaar21606672019-06-14 20:40:58 +02003740if test "$enable_canberra" = "maybe"; then
Martin Tournoij25f3a142022-10-08 19:26:41 +01003741 if test "$features" = "huge"; then
Bram Moolenaar21606672019-06-14 20:40:58 +02003742 AC_MSG_RESULT(Defaulting to yes)
3743 enable_canberra="yes"
3744 else
3745 AC_MSG_RESULT(Defaulting to no)
3746 enable_canberra="no"
3747 fi
3748else
Bram Moolenaar12471262022-01-18 11:11:25 +00003749 if test "$enable_canberra" = "yes" -a "$has_eval" = "no"; then
Martin Tournoij7904fa42022-10-04 16:28:45 +01003750 AC_MSG_RESULT([cannot use sound with tiny features])
Bram Moolenaar12471262022-01-18 11:11:25 +00003751 enable_canberra="no"
3752 else
3753 AC_MSG_RESULT($enable_canberra)
3754 fi
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003755fi
Bram Moolenaar21606672019-06-14 20:40:58 +02003756if test "$enable_canberra" = "yes"; then
3757 if test "x$PKG_CONFIG" != "xno"; then
3758 canberra_lib=`$PKG_CONFIG --libs libcanberra 2>/dev/null`
3759 canberra_cflags=`$PKG_CONFIG --cflags libcanberra 2>/dev/null`
3760 fi
3761 if test "x$canberra_lib" = "x"; then
3762 canberra_lib=-lcanberra
3763 canberra_cflags=-D_REENTRANT
3764 fi
3765 AC_MSG_CHECKING(for libcanberra)
3766 ac_save_CFLAGS="$CFLAGS"
3767 ac_save_LIBS="$LIBS"
Bram Moolenaar12471262022-01-18 11:11:25 +00003768 if `echo "$CFLAGS" | grep -v "$canberra_cflags" 2>/dev/null`; then
Christian Brabandt6b9efdd2021-09-09 17:14:50 +02003769 CFLAGS="$CFLAGS $canberra_cflags"
3770 fi
Bram Moolenaar21606672019-06-14 20:40:58 +02003771 LIBS="$LIBS $canberra_lib"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003772 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar21606672019-06-14 20:40:58 +02003773 # include <canberra.h>
3774 ], [
3775 ca_context *hello;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003776 ca_context_create(&hello);])],
Bram Moolenaar21606672019-06-14 20:40:58 +02003777 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CANBERRA),
Bram Moolenaar91b992c2019-11-17 19:07:42 +01003778 AC_MSG_RESULT(no; try installing libcanberra-dev); CFLAGS="$ac_save_CFLAGS"; LIBS="$ac_save_LIBS")
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003779fi
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003780
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003781AC_MSG_CHECKING(--enable-libsodium argument)
3782AC_ARG_ENABLE(libsodium,
3783 [ --disable-libsodium Do not use libsodium.],
3784 , [enable_libsodium="maybe"])
3785
3786if test "$enable_libsodium" = "maybe"; then
Martin Tournoij25f3a142022-10-08 19:26:41 +01003787 if test "$features" = "huge"; then
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003788 AC_MSG_RESULT(Defaulting to yes)
3789 enable_libsodium="yes"
3790 else
3791 AC_MSG_RESULT(Defaulting to no)
3792 enable_libsodium="no"
3793 fi
3794else
3795 AC_MSG_RESULT($enable_libsodium)
3796fi
3797if test "$enable_libsodium" = "yes"; then
3798 if test "x$PKG_CONFIG" != "xno"; then
3799 libsodium_lib=`$PKG_CONFIG --libs libsodium 2>/dev/null`
3800 libsodium_cflags=`$PKG_CONFIG --cflags libsodium 2>/dev/null`
3801 fi
3802 if test "x$libsodium_lib" = "x"; then
3803 libsodium_lib=-lsodium
3804 libsodium_cflags=
3805 fi
ichizok8ce3ca82021-06-23 15:41:52 +02003806 AC_MSG_CHECKING(for libsodium)
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003807 ac_save_CFLAGS="$CFLAGS"
3808 ac_save_LIBS="$LIBS"
3809 CFLAGS="$CFLAGS $libsodium_cflags"
3810 LIBS="$LIBS $libsodium_lib"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003811 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003812 # include <sodium.h>
3813 ], [
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003814 printf("%d", sodium_init()); ])],
Christian Brabandtf573c6e2021-06-20 14:02:16 +02003815 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SODIUM),
3816 AC_MSG_RESULT(no; try installing libsodium-dev); CFLAGS="$ac_save_CFLAGS"; LIBS="$ac_save_LIBS")
3817fi
Bram Moolenaar427f5b62019-06-09 13:43:51 +02003818
Bram Moolenaar071d4272004-06-13 20:20:40 +00003819dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
3820AC_MSG_CHECKING(for st_blksize)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003821AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00003822[#include <sys/types.h>
3823#include <sys/stat.h>],
3824[ struct stat st;
3825 int n;
3826
3827 stat("/", &st);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003828 n = (int)st.st_blksize;])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003829 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
3830 AC_MSG_RESULT(no))
3831
Paul Ollis65745772022-06-05 16:55:54 +01003832dnl Check for timer_create. It probably requires the 'rt' library.
Bram Moolenaarf2ce76a2022-07-02 11:40:40 +01003833dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually
3834dnl works, on Solaris timer_create() exists but fails at runtime.
Bram Moolenaarefffa532022-07-28 22:39:54 +01003835AC_CACHE_CHECK([for timer_create without -lrt], [vim_cv_timer_create], [
Bram Moolenaarf2ce76a2022-07-02 11:40:40 +01003836AC_RUN_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar5748b7f2022-07-28 12:09:04 +01003837#if STDC_HEADERS
3838# include <stdlib.h>
3839# include <stddef.h>
3840#endif
3841#include <signal.h>
3842#include <time.h>
Bram Moolenaare5303952022-06-19 17:05:47 +01003843static void set_flag(union sigval sv) {}
Paul Ollis65745772022-06-05 16:55:54 +01003844], [
3845 struct timespec ts;
3846 struct sigevent action = {0};
3847 timer_t timer_id;
3848
3849 action.sigev_notify = SIGEV_THREAD;
3850 action.sigev_notify_function = set_flag;
Bram Moolenaarf2ce76a2022-07-02 11:40:40 +01003851 if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3852 exit(1); // cannot create a monotonic timer
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003853 ])],
Bram Moolenaarefffa532022-07-28 22:39:54 +01003854 vim_cv_timer_create=yes,
3855 vim_cv_timer_create=no,
Bram Moolenaar5f6cae82022-07-30 11:00:50 +01003856 AC_MSG_WARN([failed to build test program; if cross-compiling please set 'vim_cv_timer_create'])
Bram Moolenaarefffa532022-07-28 22:39:54 +01003857 )])
Paul Ollis65745772022-06-05 16:55:54 +01003858
Bram Moolenaarefffa532022-07-28 22:39:54 +01003859dnl If the previous failed, check for timer_create() and linking with -lrt.
3860if test "x$vim_cv_timer_create" = "xno" ; then
3861 save_LIBS="$LIBS"
3862 LIBS="$LIBS -lrt"
3863 AC_CACHE_CHECK([for timer_create with -lrt], [vim_cv_timer_create_with_lrt], [
3864 AC_RUN_IFELSE([AC_LANG_PROGRAM([
3865 #if STDC_HEADERS
3866 # include <stdlib.h>
3867 # include <stddef.h>
3868 #endif
3869 #include <signal.h>
3870 #include <time.h>
3871 static void set_flag(union sigval sv) {}
3872 ], [
3873 struct timespec ts;
3874 struct sigevent action = {0};
3875 timer_t timer_id;
3876
3877 action.sigev_notify = SIGEV_THREAD;
3878 action.sigev_notify_function = set_flag;
3879 if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3880 exit(1); // cannot create a monotonic timer
3881 ])],
3882 vim_cv_timer_create_with_lrt=yes,
3883 vim_cv_timer_create_with_lrt=no,
Bram Moolenaar5f6cae82022-07-30 11:00:50 +01003884 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 +01003885 )])
3886 LIBS="$save_LIBS"
3887else
3888 vim_cv_timer_create_with_lrt=no
3889fi
Richard Purdie509695c2022-07-24 20:48:00 +01003890
3891if test "x$vim_cv_timer_create" = "xyes" ; then
3892 AC_DEFINE(HAVE_TIMER_CREATE)
3893fi
Bram Moolenaarefffa532022-07-28 22:39:54 +01003894if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then
3895 AC_DEFINE(HAVE_TIMER_CREATE)
3896 LIBS="$LIBS -lrt"
3897fi
Paul Ollis65745772022-06-05 16:55:54 +01003898
Bram Moolenaar446cb832008-06-24 21:56:24 +00003899AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
3900 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003901 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003902#include "confdefs.h"
3903#if STDC_HEADERS
3904# include <stdlib.h>
3905# include <stddef.h>
3906#endif
3907#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003908#include <sys/stat.h>
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01003909int main() {struct stat st; exit(stat("configure/", &st) != 0); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003910 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003911 vim_cv_stat_ignores_slash=yes
3912 ],[
3913 vim_cv_stat_ignores_slash=no
3914 ],[
3915 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
3916 ])
3917 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003918
Bram Moolenaar446cb832008-06-24 21:56:24 +00003919if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
3920 AC_DEFINE(STAT_IGNORES_SLASH)
3921fi
Leah Neukirchen0a7984a2021-10-14 21:27:55 +01003922
3923dnl nanoseconds field of struct stat
3924AC_CACHE_CHECK([for nanoseconds field of struct stat],
3925 ac_cv_struct_st_mtim_nsec,
3926 [ac_save_CPPFLAGS="$CPPFLAGS"
3927 ac_cv_struct_st_mtim_nsec=no
3928 # st_mtim.tv_nsec -- the usual case
3929 # st_mtim._tv_nsec -- Solaris 2.6, if
3930 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
3931 # && !defined __EXTENSIONS__)
3932 # st_mtim.st__tim.tv_nsec -- UnixWare 2.1.2
3933 # st_mtime_n -- AIX 5.2 and above
3934 # st_mtimespec.tv_nsec -- Darwin (Mac OSX)
3935 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
3936 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003937 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
3938#include <sys/stat.h>], [struct stat s; s.ST_MTIM_NSEC;])],
Leah Neukirchen0a7984a2021-10-14 21:27:55 +01003939 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
3940 done
3941 CPPFLAGS="$ac_save_CPPFLAGS"
3942])
3943if test $ac_cv_struct_st_mtim_nsec != no; then
3944 AC_DEFINE_UNQUOTED([ST_MTIM_NSEC], [$ac_cv_struct_st_mtim_nsec],
3945 [Define if struct stat contains a nanoseconds field])
3946fi
Bram Moolenaare5303952022-06-19 17:05:47 +01003947
Bram Moolenaar071d4272004-06-13 20:20:40 +00003948dnl Link with iconv for charset translation, if not found without library.
3949dnl check for iconv() requires including iconv.h
3950dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
3951dnl has been installed.
3952AC_MSG_CHECKING(for iconv_open())
3953save_LIBS="$LIBS"
3954LIBS="$LIBS -liconv"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003955AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003956#ifdef HAVE_ICONV_H
3957# include <iconv.h>
3958#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003959 ], [iconv_open("fr", "to");])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003960 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
3961 LIBS="$save_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003962 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003963#ifdef HAVE_ICONV_H
3964# include <iconv.h>
3965#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003966 ], [iconv_open("fr", "to");])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003967 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
3968 AC_MSG_RESULT(no)))
3969
3970
3971AC_MSG_CHECKING(for nl_langinfo(CODESET))
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003972AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003973#ifdef HAVE_LANGINFO_H
3974# include <langinfo.h>
3975#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003976], [char *cs = nl_langinfo(CODESET);])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003977 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
3978 AC_MSG_RESULT(no))
3979
Bram Moolenaar73e28dc2022-09-17 21:08:33 +01003980dnl Floating point support may require the "m" library
Bram Moolenaar446cb832008-06-24 21:56:24 +00003981AC_CHECK_LIB(m, strtod)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003982
Bram Moolenaara6b89762016-02-29 21:38:26 +01003983dnl isinf() and isnan() need to include header files and may need -lm.
3984AC_MSG_CHECKING([for isinf()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003985AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaara6b89762016-02-29 21:38:26 +01003986#ifdef HAVE_MATH_H
3987# include <math.h>
3988#endif
3989#if STDC_HEADERS
3990# include <stdlib.h>
3991# include <stddef.h>
3992#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003993], [int r = isinf(1.11); ])],
Bram Moolenaara6b89762016-02-29 21:38:26 +01003994 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISINF),
3995 AC_MSG_RESULT(no))
3996
3997AC_MSG_CHECKING([for isnan()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01003998AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaara6b89762016-02-29 21:38:26 +01003999#ifdef HAVE_MATH_H
4000# include <math.h>
4001#endif
4002#if STDC_HEADERS
4003# include <stdlib.h>
4004# include <stddef.h>
4005#endif
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004006], [int r = isnan(1.11); ])],
Bram Moolenaara6b89762016-02-29 21:38:26 +01004007 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISNAN),
4008 AC_MSG_RESULT(no))
4009
Bram Moolenaar071d4272004-06-13 20:20:40 +00004010dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
4011dnl when -lacl works, also try to use -lattr (required for Debian).
Bram Moolenaar8d462f92012-02-05 22:51:33 +01004012dnl On Solaris, use the acl_get/set functions in libsec, if present.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004013AC_MSG_CHECKING(--disable-acl argument)
4014AC_ARG_ENABLE(acl,
Bram Moolenaard6d30422018-01-28 22:48:55 +01004015 [ --disable-acl No check for ACL support.],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004016 , [enable_acl="yes"])
4017if test "$enable_acl" = "yes"; then
Bram Moolenaard6d30422018-01-28 22:48:55 +01004018 AC_MSG_RESULT(no)
4019 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004020 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
4021 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
4022
Bram Moolenaard6d30422018-01-28 22:48:55 +01004023 AC_MSG_CHECKING(for POSIX ACL support)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004024 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00004025#include <sys/types.h>
4026#ifdef HAVE_SYS_ACL_H
4027# include <sys/acl.h>
4028#endif
4029acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
4030 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004031 acl_free(acl);])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004032 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
4033 AC_MSG_RESULT(no))
4034
Bram Moolenaard6d30422018-01-28 22:48:55 +01004035 AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)],
4036 AC_MSG_CHECKING(for Solaris ACL support)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004037 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar071d4272004-06-13 20:20:40 +00004038#ifdef HAVE_SYS_ACL_H
4039# include <sys/acl.h>
4040#endif], [acl("foo", GETACLCNT, 0, NULL);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004041 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004042 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
Bram Moolenaar8d462f92012-02-05 22:51:33 +01004043 AC_MSG_RESULT(no)))
Bram Moolenaar071d4272004-06-13 20:20:40 +00004044
Bram Moolenaard6d30422018-01-28 22:48:55 +01004045 AC_MSG_CHECKING(for AIX ACL support)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004046 AC_LINK_IFELSE([AC_LANG_PROGRAM([
Bram Moolenaar446cb832008-06-24 21:56:24 +00004047#if STDC_HEADERS
4048# include <stdlib.h>
4049# include <stddef.h>
4050#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00004051#ifdef HAVE_SYS_ACL_H
4052# include <sys/acl.h>
4053#endif
4054#ifdef HAVE_SYS_ACCESS_H
4055# include <sys/access.h>
4056#endif
4057#define _ALL_SOURCE
4058
4059#include <sys/stat.h>
4060
4061int aclsize;
4062struct acl *aclent;], [aclsize = sizeof(struct acl);
4063 aclent = (void *)malloc(aclsize);
4064 statacl("foo", STX_NORMAL, aclent, aclsize);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004065 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004066 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
4067 AC_MSG_RESULT(no))
4068else
4069 AC_MSG_RESULT(yes)
4070fi
4071
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02004072if test "x$GTK_CFLAGS" != "x"; then
4073 dnl pango_shape_full() is new, fall back to pango_shape().
4074 AC_MSG_CHECKING(for pango_shape_full)
4075 ac_save_CFLAGS="$CFLAGS"
4076 ac_save_LIBS="$LIBS"
4077 CFLAGS="$CFLAGS $GTK_CFLAGS"
4078 LIBS="$LIBS $GTK_LIBS"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004079 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02004080 [#include <gtk/gtk.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004081 [ pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); ])],
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02004082 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PANGO_SHAPE_FULL),
4083 AC_MSG_RESULT(no))
4084 CFLAGS="$ac_save_CFLAGS"
4085 LIBS="$ac_save_LIBS"
4086fi
4087
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004088AC_MSG_CHECKING(--enable-gpm argument)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004089AC_ARG_ENABLE(gpm,
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004090 [ --enable-gpm=OPTS Use gpm (Linux mouse daemon). default=yes OPTS=yes/no/dynamic], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00004091 [enable_gpm="yes"])
4092
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004093if test "$enable_gpm" = "yes" -o "$enable_gpm" = "dynamic"; then
4094 AC_MSG_RESULT($enable_gpm)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004095 dnl Checking if gpm support can be compiled
4096 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
4097 [olibs="$LIBS" ; LIBS="-lgpm"]
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004098 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004099 [#include <gpm.h>
4100 #include <linux/keyboard.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004101 [Gpm_GetLibVersion(NULL);])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004102 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
4103 dnl FEAT_MOUSE_GPM if mouse support is included
4104 [vi_cv_have_gpm=yes],
4105 [vi_cv_have_gpm=no])
4106 [LIBS="$olibs"]
4107 )
4108 if test $vi_cv_have_gpm = yes; then
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004109 if test "$enable_gpm" = "yes"; then
4110 LIBS="$LIBS -lgpm"
4111 else
4112 AC_DEFINE(DYNAMIC_GPM)
4113 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004114 AC_DEFINE(HAVE_GPM)
4115 fi
4116else
Bram Moolenaar33fc4a62022-02-23 18:07:38 +00004117 AC_MSG_RESULT(no)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004118fi
4119
Bram Moolenaar446cb832008-06-24 21:56:24 +00004120AC_MSG_CHECKING(--disable-sysmouse argument)
4121AC_ARG_ENABLE(sysmouse,
Bram Moolenaar8008b632017-07-18 21:33:20 +02004122 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
Bram Moolenaar446cb832008-06-24 21:56:24 +00004123 [enable_sysmouse="yes"])
4124
4125if test "$enable_sysmouse" = "yes"; then
4126 AC_MSG_RESULT(no)
4127 dnl Checking if sysmouse support can be compiled
4128 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
4129 dnl defines FEAT_SYSMOUSE if mouse support is included
4130 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004131 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar446cb832008-06-24 21:56:24 +00004132 [#include <sys/consio.h>
4133 #include <signal.h>
4134 #include <sys/fbio.h>],
4135 [struct mouse_info mouse;
4136 mouse.operation = MOUSE_MODE;
4137 mouse.operation = MOUSE_SHOW;
4138 mouse.u.mode.mode = 0;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004139 mouse.u.mode.signal = SIGUSR2;])],
Bram Moolenaar446cb832008-06-24 21:56:24 +00004140 [vi_cv_have_sysmouse=yes],
4141 [vi_cv_have_sysmouse=no])
4142 )
4143 if test $vi_cv_have_sysmouse = yes; then
4144 AC_DEFINE(HAVE_SYSMOUSE)
4145 fi
4146else
4147 AC_MSG_RESULT(yes)
4148fi
4149
Bram Moolenaarf05da212009-11-17 16:13:15 +00004150dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
4151AC_MSG_CHECKING(for FD_CLOEXEC)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004152AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaarf05da212009-11-17 16:13:15 +00004153[#if HAVE_FCNTL_H
4154# include <fcntl.h>
4155#endif],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004156[ int flag = FD_CLOEXEC;])],
Bram Moolenaarf05da212009-11-17 16:13:15 +00004157 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
4158 AC_MSG_RESULT(not usable))
4159
Bram Moolenaar071d4272004-06-13 20:20:40 +00004160dnl rename needs to be checked separately to work on Nextstep with cc
4161AC_MSG_CHECKING(for rename)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004162AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [rename("this", "that")])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004163 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
4164 AC_MSG_RESULT(no))
4165
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004166dnl check for dirfd()
4167AC_MSG_CHECKING(for dirfd)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004168AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004169[#include <sys/types.h>
4170#include <dirent.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004171[DIR * dir=opendir("dirname"); dirfd(dir);])],
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004172AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DIRFD), AC_MSG_RESULT(not usable))
4173
4174dnl check for flock()
4175AC_MSG_CHECKING(for flock)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004176AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004177[#include <sys/file.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004178[flock(10, LOCK_SH);])],
Bram Moolenaarb2d0e512020-05-07 18:37:03 +02004179AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOCK), AC_MSG_RESULT(not usable))
4180
Bram Moolenaar071d4272004-06-13 20:20:40 +00004181dnl sysctl() may exist but not the arguments we use
4182AC_MSG_CHECKING(for sysctl)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004183AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004184[#include <sys/types.h>
4185#include <sys/sysctl.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004186[[ int mib[2], r;
Bram Moolenaar071d4272004-06-13 20:20:40 +00004187 size_t len;
4188
4189 mib[0] = CTL_HW;
4190 mib[1] = HW_USERMEM;
4191 len = sizeof(r);
4192 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004193 ]])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004194 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
4195 AC_MSG_RESULT(not usable))
4196
Bram Moolenaare2982d62021-10-06 11:27:21 +01004197dnl sysinfo() may exist but not be Linux compatible.
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004198dnl On some FreeBSD systems it may depend on libsysinfo, try to link
Bram Moolenaar071d4272004-06-13 20:20:40 +00004199AC_MSG_CHECKING(for sysinfo)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004200AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004201[#include <sys/types.h>
4202#include <sys/sysinfo.h>],
4203[ struct sysinfo sinfo;
4204 int t;
4205
4206 (void)sysinfo(&sinfo);
4207 t = sinfo.totalram;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004208 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004209 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
4210 AC_MSG_RESULT(not usable))
4211
Bram Moolenaar914572a2007-05-01 11:37:47 +00004212dnl struct sysinfo may have the mem_unit field or not
4213AC_MSG_CHECKING(for sysinfo.mem_unit)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004214AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar914572a2007-05-01 11:37:47 +00004215[#include <sys/types.h>
4216#include <sys/sysinfo.h>],
4217[ struct sysinfo sinfo;
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02004218 sinfo.mem_unit = 1;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004219 ])],
Bram Moolenaar914572a2007-05-01 11:37:47 +00004220 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
4221 AC_MSG_RESULT(no))
4222
Bram Moolenaarf52f0602021-03-10 21:26:37 +01004223dnl struct sysinfo may have the uptime field or not
4224AC_MSG_CHECKING(for sysinfo.uptime)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004225AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaarf52f0602021-03-10 21:26:37 +01004226[#include <sys/types.h>
4227#include <sys/sysinfo.h>],
4228[ struct sysinfo sinfo;
4229 long ut;
4230
4231 (void)sysinfo(&sinfo);
4232 ut = sinfo.uptime;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004233 ])],
Bram Moolenaarf52f0602021-03-10 21:26:37 +01004234 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_UPTIME),
4235 AC_MSG_RESULT(no))
4236
Bram Moolenaar071d4272004-06-13 20:20:40 +00004237dnl sysconf() may exist but not support what we want to use
4238AC_MSG_CHECKING(for sysconf)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004239AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004240[#include <unistd.h>],
4241[ (void)sysconf(_SC_PAGESIZE);
4242 (void)sysconf(_SC_PHYS_PAGES);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004243 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004244 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
4245 AC_MSG_RESULT(not usable))
4246
Bram Moolenaar0e62a672021-02-25 17:17:56 +01004247dnl check if we have _SC_SIGSTKSZ via sysconf()
4248AC_MSG_CHECKING(for _SC_SIGSTKSZ via sysconf())
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004249AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar0e62a672021-02-25 17:17:56 +01004250[#include <unistd.h>],
4251[ (void)sysconf(_SC_SIGSTKSZ);
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004252 ])],
Bram Moolenaar0e62a672021-02-25 17:17:56 +01004253 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF_SIGSTKSZ),
4254 AC_MSG_RESULT(not usable))
4255
Bram Moolenaar914703b2010-05-31 21:59:46 +02004256AC_CHECK_SIZEOF([int])
4257AC_CHECK_SIZEOF([long])
4258AC_CHECK_SIZEOF([time_t])
4259AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02004260
Bram Moolenaara2aa31a2014-02-23 22:52:40 +01004261dnl Use different names to avoid clashing with other header files.
4262AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int])
4263AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long])
4264
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004265dnl Make sure that uint32_t is really 32 bits unsigned.
4266AC_MSG_CHECKING([uint32_t is 32 bits])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004267AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004268#ifdef HAVE_STDINT_H
4269# include <stdint.h>
4270#endif
4271#ifdef HAVE_INTTYPES_H
4272# include <inttypes.h>
4273#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01004274int main() {
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004275 uint32_t nr1 = (uint32_t)-1;
4276 uint32_t nr2 = (uint32_t)0xffffffffUL;
Bram Moolenaar52897832020-07-02 22:50:37 +02004277 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) return 1;
4278 return 0;
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004279}])],
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004280AC_MSG_RESULT(ok),
4281AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
Bram Moolenaar323cb952011-12-14 19:22:34 +01004282AC_MSG_WARN([cannot check uint32_t when cross-compiling.]))
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004283
Bram Moolenaar446cb832008-06-24 21:56:24 +00004284dnl Check for memmove() before bcopy(), makes memmove() be used when both are
4285dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
4286
Bram Moolenaar071d4272004-06-13 20:20:40 +00004287[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00004288#include "confdefs.h"
4289#ifdef HAVE_STRING_H
4290# include <string.h>
4291#endif
4292#if STDC_HEADERS
4293# include <stdlib.h>
4294# include <stddef.h>
4295#endif
Bram Moolenaar0f0d3a72022-06-19 18:02:05 +01004296int main() {
Bram Moolenaar071d4272004-06-13 20:20:40 +00004297 char buf[10];
4298 strcpy(buf, "abcdefghi");
4299 mch_memmove(buf, buf + 2, 3);
4300 if (strncmp(buf, "ababcf", 6))
4301 exit(1);
4302 strcpy(buf, "abcdefghi");
4303 mch_memmove(buf + 2, buf, 3);
4304 if (strncmp(buf, "cdedef", 6))
4305 exit(1);
4306 exit(0); /* libc version works properly. */
4307}']
4308
Bram Moolenaar446cb832008-06-24 21:56:24 +00004309AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
4310 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004311 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 +00004312 [
4313 vim_cv_memmove_handles_overlap=yes
4314 ],[
4315 vim_cv_memmove_handles_overlap=no
4316 ],[
4317 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
4318 ])
4319 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00004320
Bram Moolenaar446cb832008-06-24 21:56:24 +00004321if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
4322 AC_DEFINE(USEMEMMOVE)
4323else
4324 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
4325 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004326 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 +00004327 [
4328 vim_cv_bcopy_handles_overlap=yes
4329 ],[
4330 vim_cv_bcopy_handles_overlap=no
4331 ],[
4332 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
4333 ])
4334 ])
4335
4336 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
4337 AC_DEFINE(USEBCOPY)
4338 else
4339 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
4340 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004341 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 +00004342 [
4343 vim_cv_memcpy_handles_overlap=yes
4344 ],[
4345 vim_cv_memcpy_handles_overlap=no
4346 ],[
4347 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
4348 ])
4349 ])
4350
4351 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
4352 AC_DEFINE(USEMEMCPY)
4353 fi
4354 fi
4355fi
4356
Bram Moolenaar071d4272004-06-13 20:20:40 +00004357
4358dnl Check for multibyte locale functions
4359dnl Find out if _Xsetlocale() is supported by libX11.
4360dnl Check if X_LOCALE should be defined.
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004361if test "x$with_x" = "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004362 cflags_save=$CFLAGS
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004363 libs_save=$LIBS
4364 LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS"
4365 CFLAGS="$CFLAGS $X_CFLAGS"
4366
4367 AC_MSG_CHECKING(whether X_LOCALE needed)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004368 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <X11/Xlocale.h>],)],
4369 AC_LINK_IFELSE([AC_LANG_CALL([],[_Xsetlocale])], [AC_MSG_RESULT(yes)
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004370 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
4371 AC_MSG_RESULT(no))
4372
4373 AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used)
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004374 AC_LINK_IFELSE([AC_LANG_CALL([],[Xutf8SetWMProperties])], [AC_MSG_RESULT(yes)
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004375 AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no))
4376
Bram Moolenaar071d4272004-06-13 20:20:40 +00004377 CFLAGS=$cflags_save
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004378 LIBS=$libs_save
Bram Moolenaar071d4272004-06-13 20:20:40 +00004379fi
4380
4381dnl Link with xpg4, it is said to make Korean locale working
4382AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
4383
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00004384dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar8f4ba692011-05-05 17:24:27 +02004385dnl Use --version to detect Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00004386dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004387dnl -t for typedefs (many ctags have this)
4388dnl -s for static functions (Elvis ctags only?)
4389dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
4390dnl -i+m to test for older Exuberant ctags
4391AC_MSG_CHECKING(how to create tags)
4392test -f tags && mv tags tags.save
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004393if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1; then
Bram Moolenaar509ff062020-01-02 22:38:49 +01004394 TAGPRG="ctags -I INIT+,INIT2+,INIT3+,INIT4+,INIT5+ --fields=+S"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004395elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1; then
Bram Moolenaar509ff062020-01-02 22:38:49 +01004396 TAGPRG="exctags -I INIT+,INIT2+,INIT3+,INIT4+,INIT5+ --fields=+S"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004397elif (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 +01004398 TAGPRG="exuberant-ctags -I INIT+,INIT2+,INIT3+,INIT4+,INIT5+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004399else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00004400 TAGPRG="ctags"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004401 (eval etags /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="etags"
4402 (eval etags -c /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="etags -c"
4403 (eval ctags /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags"
4404 (eval ctags -t /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags -t"
4405 (eval ctags -ts /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags -ts"
4406 (eval ctags -tvs /dev/null) < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&1 && TAGPRG="ctags -tvs"
4407 (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 +00004408fi
4409test -f tags.save && mv tags.save tags
4410AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
4411
4412dnl Check how we can run man with a section number
4413AC_MSG_CHECKING(how to run man with a section nr)
4414MANDEF="man"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004415(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 +00004416AC_MSG_RESULT($MANDEF)
4417if test "$MANDEF" = "man -s"; then
4418 AC_DEFINE(USEMAN_S)
4419fi
4420
4421dnl Check if gettext() is working and if it needs -lintl
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004422dnl We take care to base this on an empty LIBS: on some systems libelf would be
4423dnl in LIBS and implicitly take along libintl. The final LIBS would then not
4424dnl contain libintl, and the link step would fail due to -Wl,--as-needed.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004425AC_MSG_CHECKING(--disable-nls argument)
4426AC_ARG_ENABLE(nls,
4427 [ --disable-nls Don't support NLS (gettext()).], ,
4428 [enable_nls="yes"])
4429
4430if test "$enable_nls" = "yes"; then
4431 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00004432
4433 INSTALL_LANGS=install-languages
4434 AC_SUBST(INSTALL_LANGS)
4435 INSTALL_TOOL_LANGS=install-tool-languages
4436 AC_SUBST(INSTALL_TOOL_LANGS)
4437
Bram Moolenaar071d4272004-06-13 20:20:40 +00004438 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
4439 AC_MSG_CHECKING([for NLS])
4440 if test -f po/Makefile; then
4441 have_gettext="no"
4442 if test -n "$MSGFMT"; then
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004443 olibs=$LIBS
4444 LIBS=""
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004445 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004446 [#include <libintl.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004447 [gettext("Test");])],
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004448 AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs,
4449 LIBS="-lintl"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004450 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004451 [#include <libintl.h>],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004452 [gettext("Test");])],
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004453 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes";
4454 LIBS="$olibs -lintl",
Bram Moolenaar071d4272004-06-13 20:20:40 +00004455 AC_MSG_RESULT([gettext() doesn't work]);
4456 LIBS=$olibs))
4457 else
4458 AC_MSG_RESULT([msgfmt not found - disabled]);
4459 fi
Martin Tournoij7904fa42022-10-04 16:28:45 +01004460 if test $have_gettext = "yes" -a "x$features" != "xtiny"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004461 AC_DEFINE(HAVE_GETTEXT)
4462 MAKEMO=yes
4463 AC_SUBST(MAKEMO)
4464 dnl this was added in GNU gettext 0.10.36
4465 AC_CHECK_FUNCS(bind_textdomain_codeset)
4466 dnl _nl_msg_cat_cntr is required for GNU gettext
4467 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004468 AC_LINK_IFELSE([AC_LANG_PROGRAM(
Bram Moolenaar071d4272004-06-13 20:20:40 +00004469 [#include <libintl.h>
4470 extern int _nl_msg_cat_cntr;],
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004471 [++_nl_msg_cat_cntr;])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004472 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
4473 AC_MSG_RESULT([no]))
Bram Moolenaar26096cc2019-04-11 15:25:40 +02004474 AC_MSG_CHECKING([if msgfmt supports --desktop])
4475 MSGFMT_DESKTOP=
4476 if "$MSGFMT" --help | grep -e '--desktop' >/dev/null; then
Bram Moolenaar62a88f42019-06-07 20:44:40 +02004477 if "$MSGFMT" --version | grep '0.19.[[3-7]]$' >/dev/null; then
4478 dnl GNU gettext 0.19.7's --desktop is broken. We assume back to
4479 dnl 0.19.3 is also broken.
4480 AC_MSG_RESULT([broken])
4481 else
4482 AC_MSG_RESULT([yes])
4483 MSGFMT_DESKTOP="gvim.desktop vim.desktop"
4484 fi
Bram Moolenaar26096cc2019-04-11 15:25:40 +02004485 else
4486 AC_MSG_RESULT([no])
4487 fi
4488 AC_SUBST(MSGFMT_DESKTOP)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004489 fi
4490 else
4491 AC_MSG_RESULT([no "po/Makefile" - disabled]);
4492 fi
4493else
4494 AC_MSG_RESULT(yes)
4495fi
4496
4497dnl Check for dynamic linking loader
4498AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
4499if test x${DLL} = xdlfcn.h; then
4500 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
4501 AC_MSG_CHECKING([for dlopen()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004502 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004503 extern void* dlopen();
4504 dlopen();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004505 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004506 AC_MSG_RESULT(yes);
4507 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4508 AC_MSG_RESULT(no);
4509 AC_MSG_CHECKING([for dlopen() in -ldl])
4510 olibs=$LIBS
4511 LIBS="$LIBS -ldl"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004512 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004513 extern void* dlopen();
4514 dlopen();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004515 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004516 AC_MSG_RESULT(yes);
4517 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4518 AC_MSG_RESULT(no);
4519 LIBS=$olibs))
4520 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
4521 dnl ick :-)
4522 AC_MSG_CHECKING([for dlsym()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004523 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004524 extern void* dlsym();
4525 dlsym();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004526 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004527 AC_MSG_RESULT(yes);
4528 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4529 AC_MSG_RESULT(no);
4530 AC_MSG_CHECKING([for dlsym() in -ldl])
4531 olibs=$LIBS
4532 LIBS="$LIBS -ldl"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004533 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004534 extern void* dlsym();
4535 dlsym();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004536 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004537 AC_MSG_RESULT(yes);
4538 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4539 AC_MSG_RESULT(no);
4540 LIBS=$olibs))
4541elif test x${DLL} = xdl.h; then
4542 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
4543 AC_MSG_CHECKING([for shl_load()])
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004544 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004545 extern void* shl_load();
4546 shl_load();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004547 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004548 AC_MSG_RESULT(yes);
4549 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4550 AC_MSG_RESULT(no);
4551 AC_MSG_CHECKING([for shl_load() in -ldld])
4552 olibs=$LIBS
4553 LIBS="$LIBS -ldld"
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004554 AC_LINK_IFELSE([AC_LANG_PROGRAM(,[
Bram Moolenaar071d4272004-06-13 20:20:40 +00004555 extern void* shl_load();
4556 shl_load();
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004557 ])],
Bram Moolenaar071d4272004-06-13 20:20:40 +00004558 AC_MSG_RESULT(yes);
4559 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4560 AC_MSG_RESULT(no);
4561 LIBS=$olibs))
4562fi
4563AC_CHECK_HEADERS(setjmp.h)
4564
Bram Moolenaard0573012017-10-28 21:11:06 +02004565if test "x$MACOS_X" = "xyes" -a -n "$PERL"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004566 dnl -ldl must come after DynaLoader.a
4567 if echo $LIBS | grep -e '-ldl' >/dev/null; then
4568 LIBS=`echo $LIBS | sed s/-ldl//`
4569 PERL_LIBS="$PERL_LIBS -ldl"
4570 fi
4571fi
4572
Bram Moolenaard0573012017-10-28 21:11:06 +02004573if test "$MACOS_X" = "yes"; then
4574 AC_MSG_CHECKING([whether we need macOS frameworks])
Bram Moolenaar097148e2020-08-11 21:58:20 +02004575 if test "$MACOS_X_DARWIN" = "yes"; then
Bram Moolenaard0573012017-10-28 21:11:06 +02004576 if test "$features" = "tiny"; then
Yee Cheng Chin4314e4f2022-10-08 13:50:05 +01004577 dnl Since no FEAT_CLIPBOARD or FEAT_SOUND, no need for os_macosx.m.
Bram Moolenaard0573012017-10-28 21:11:06 +02004578 OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'`
4579 OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'`
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01004580 AC_MSG_RESULT([yes, we need CoreServices])
4581 LIBS="$LIBS -framework CoreServices"
Bram Moolenaard0573012017-10-28 21:11:06 +02004582 else
4583 AC_MSG_RESULT([yes, we need AppKit])
4584 LIBS="$LIBS -framework AppKit"
Bram Moolenaard0573012017-10-28 21:11:06 +02004585 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004586 else
Bram Moolenaard0573012017-10-28 21:11:06 +02004587 AC_MSG_RESULT([no])
Bram Moolenaar3437b912013-07-03 19:52:53 +02004588 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004589fi
4590
Bram Moolenaar3ae5fc92021-09-06 18:57:30 +02004591dnl On some systems REENTRANT needs to be defined. It should not hurt to use
4592dnl it everywhere.
4593if `echo "$CFLAGS" | grep -v D_REENTRANT >/dev/null`; then
4594 CFLAGS="$CFLAGS -D_REENTRANT"
4595fi
4596
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004597dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
4598dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
4599dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00004600dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
4601dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004602DEPEND_CFLAGS_FILTER=
4603if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004604 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar348808f2020-02-07 20:50:07 +01004605 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]][[0-9]]*\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00004606 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004607 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004608 AC_MSG_RESULT(yes)
4609 else
4610 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004611 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004612 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
4613 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00004614 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaaraeabe052011-12-08 15:17:34 +01004615 dnl And undefine it first to avoid a warning.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004616 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
4617 if test "$gccmajor" -gt "3"; then
Zdenek Dohnal42196982023-01-18 16:09:51 +00004618 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/'`
4619 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 +00004620 AC_MSG_RESULT(yes)
4621 else
4622 AC_MSG_RESULT(no)
4623 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00004624fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004625AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004626
Bram Moolenaarec0557f2018-01-31 14:41:37 +01004627dnl On some systems AC_SYS_LARGEFILE determines that -D_FILE_OFFSET_BITS=64
4628dnl isn't required, but the CFLAGS for some of the libraries we're using
4629dnl include the define. Since the define changes the size of some datatypes
4630dnl (e.g. ino_t and off_t), all of Vim's modules must be compiled with a
4631dnl consistent value. It's therefore safest to force the use of the define
4632dnl if it's present in any of the *_CFLAGS variables.
4633AC_MSG_CHECKING(whether we need to force -D_FILE_OFFSET_BITS=64)
Bram Moolenaar9ce42132018-04-11 22:19:36 +02004634if 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 +01004635 AC_MSG_RESULT(yes)
4636 AC_DEFINE(_FILE_OFFSET_BITS, 64)
4637else
4638 AC_MSG_RESULT(no)
4639fi
4640
Bram Moolenaar6cd42db2020-12-04 18:09:54 +01004641dnl $LDFLAGS is passed to glibtool in libvterm, it doesn't like a space
4642dnl between "-L" and the path that follows.
4643LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-L /-L/g'`
4644
Bram Moolenaar22e193d2010-11-03 22:32:24 +01004645dnl link.sh tries to avoid overlinking in a hackish way.
4646dnl At least GNU ld supports --as-needed which provides the same functionality
4647dnl at linker level. Let's use it.
4648AC_MSG_CHECKING(linker --as-needed support)
4649LINK_AS_NEEDED=
4650# Check if linker supports --as-needed and --no-as-needed options
4651if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
Natanael Copa761ead42021-05-15 14:25:37 +02004652 if ! echo "$LDFLAGS" | grep -q -- '-Wl,[[^[:space:]]]*--as-needed'; then
4653 LDFLAGS="$LDFLAGS -Wl,--as-needed"
4654 fi
Bram Moolenaar22e193d2010-11-03 22:32:24 +01004655 LINK_AS_NEEDED=yes
4656fi
4657if test "$LINK_AS_NEEDED" = yes; then
4658 AC_MSG_RESULT(yes)
4659else
4660 AC_MSG_RESULT(no)
4661fi
4662AC_SUBST(LINK_AS_NEEDED)
4663
Bram Moolenaar77c19352012-06-13 19:19:41 +02004664# IBM z/OS reset CFLAGS for config.mk
4665if test "$zOSUnix" = "yes"; then
4666 CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
4667fi
4668
Bram Moolenaar071d4272004-06-13 20:20:40 +00004669dnl write output files
Bram Moolenaar1004b3d2022-06-05 19:51:55 +01004670AC_CONFIG_FILES(auto/config.mk:config.mk.in)
4671AC_OUTPUT
Bram Moolenaar071d4272004-06-13 20:20:40 +00004672
4673dnl vim: set sw=2 tw=78 fo+=l: