blob: 39237b9081d35b7bbe90e42713c34ca573c36476 [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
3dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
4dnl Should also work with autoconf 2.54 and later.
5
6AC_INIT(vim.h)
7AC_CONFIG_HEADER(auto/config.h:config.h.in)
8
9dnl Being able to run configure means the system is Unix (compatible).
10AC_DEFINE(UNIX)
11AC_PROG_MAKE_SET
12
13dnl Checks for programs.
Bram Moolenaar22640082018-04-19 20:39:41 +020014AC_PROG_CC_C99 dnl required by almost everything
Bram Moolenaarc0394412017-04-20 20:20:23 +020015AC_PROG_CPP dnl required by header file checks
16AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
17AC_PROG_FGREP dnl finds working grep -F
18AC_ISC_POSIX dnl required by AC_C_CROSS
19AC_PROG_AWK dnl required for "make html" in ../doc
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
21dnl Don't strip if we don't have it
22AC_CHECK_PROG(STRIP, strip, strip, :)
23
Bram Moolenaar325b7a22004-07-05 15:58:32 +000024dnl Check for extension of executables
Bram Moolenaar071d4272004-06-13 20:20:40 +000025AC_EXEEXT
26
Bram Moolenaar446cb832008-06-24 21:56:24 +000027dnl Check for standard headers. We don't use this in Vim but other stuff
28dnl in autoconf needs it, where it uses STDC_HEADERS.
29AC_HEADER_STDC
30AC_HEADER_SYS_WAIT
31
Bram Moolenaar561f8a52018-04-17 22:02:45 +020032dnl Check that the C99 features that Vim uses are supported:
Bram Moolenaar22640082018-04-19 20:39:41 +020033if test x"$ac_cv_prog_cc_c99" != xno; then
34 dnl If the compiler doesn't explicitly support C99, then check
35 dnl for the specific features Vim uses
36
37 AC_TYPE_LONG_LONG_INT
38 if test "$ac_cv_type_long_long_int" = no; then
39 AC_MSG_FAILURE([Compiler does not support long long int])
40 fi
41
42 AC_MSG_CHECKING([if the compiler supports trailing commas])
43 trailing_commas=no
44 AC_TRY_COMPILE([], [
45 enum {
46 one,
47 };],
48 [AC_MSG_RESULT(yes); trailing_commas=yes],
49 [AC_MSG_RESULT(no)])
50 if test "$trailing_commas" = no; then
51 AC_MSG_FAILURE([Compiler does not support trailing comma in enum])
52 fi
53
54 AC_MSG_CHECKING([if the compiler supports C++ comments])
55 slash_comments=no
56 AC_TRY_COMPILE([],
57 [// C++ comments?],
58 [AC_MSG_RESULT(yes); slash_comments=yes],
59 [AC_MSG_RESULT(no)])
60 if test "$slash_comments" = no; then
61 AC_MSG_FAILURE([Compiler does not support C++ comments])
62 fi
63fi
Bram Moolenaar561f8a52018-04-17 22:02:45 +020064
Bram Moolenaarf788a062011-12-14 20:51:25 +010065dnl Check for the flag that fails if stuff are missing.
66
67AC_MSG_CHECKING(--enable-fail-if-missing argument)
68AC_ARG_ENABLE(fail_if_missing,
69 [ --enable-fail-if-missing Fail if dependencies on additional features
70 specified on the command line are missing.],
71 [fail_if_missing="yes"],
72 [fail_if_missing="no"])
73AC_MSG_RESULT($fail_if_missing)
74
Bram Moolenaard2a05492018-07-27 22:35:15 +020075dnl Keep original value to check later.
76with_x_arg="$with_x"
77
Bram Moolenaar071d4272004-06-13 20:20:40 +000078dnl Set default value for CFLAGS if none is defined or it's empty
79if test -z "$CFLAGS"; then
80 CFLAGS="-O"
81 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
82fi
83if test "$GCC" = yes; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +000084 dnl method that should work for nearly all versions
Bram Moolenaarc8836f72014-04-12 13:12:24 +020085 gccversion=`$CC -dumpversion`
Bram Moolenaar910f66f2006-04-05 20:41:53 +000086 if test "x$gccversion" = "x"; then
87 dnl old method; fall-back for when -dumpversion doesn't work
Bram Moolenaarc8836f72014-04-12 13:12:24 +020088 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 +000089 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +000090 dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
91 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +000092 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +000093 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
94 else
95 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
96 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
97 CFLAGS="$CFLAGS -fno-strength-reduce"
98 fi
99 fi
100fi
101
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200102dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
103dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on
104dnl the version number of the clang in use.
105dnl Note that this does not work to get the version of clang 3.1 or 3.2.
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100106AC_MSG_CHECKING(for clang version)
107CLANG_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 +0200108if test x"$CLANG_VERSION_STRING" != x"" ; then
109 CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'`
110 CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'`
111 CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'`
112 CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
113 AC_MSG_RESULT($CLANG_VERSION)
114 dnl If you find the same issue with versions earlier than 500.2.75,
115 dnl change the constant 500002075 below appropriately. To get the
116 dnl integer corresponding to a version number, refer to the
117 dnl definition of CLANG_VERSION above.
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100118 AC_MSG_CHECKING(if clang supports -fno-strength-reduce)
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200119 if test "$CLANG_VERSION" -ge 500002075 ; then
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100120 AC_MSG_RESULT(no)
121 CFLAGS=`echo "$CFLAGS" | sed -e 's/-fno-strength-reduce/ /'`
122 else
123 AC_MSG_RESULT(yes)
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200124 fi
125else
Bram Moolenaar5f69fee2017-03-09 11:58:40 +0100126 AC_MSG_RESULT(N/A)
Bram Moolenaar0c6ccfd2013-10-02 18:23:07 +0200127fi
128
Bram Moolenaar446cb832008-06-24 21:56:24 +0000129dnl If configure thinks we are cross compiling, there might be something
130dnl wrong with the CC or CFLAGS settings, give a useful warning message
Bram Moolenaar839e9542016-04-14 16:46:02 +0200131CROSS_COMPILING=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132if test "$cross_compiling" = yes; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000133 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
Bram Moolenaar839e9542016-04-14 16:46:02 +0200134 CROSS_COMPILING=1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135fi
Bram Moolenaar839e9542016-04-14 16:46:02 +0200136AC_SUBST(CROSS_COMPILING)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000137
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000138dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
139dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000140test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
141
142if test -f ./toolcheck; then
143 AC_CHECKING(for buggy tools)
144 sh ./toolcheck 1>&AC_FD_MSG
145fi
146
147OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
148
149dnl Check for BeOS, which needs an extra source file
150AC_MSG_CHECKING(for BeOS)
151case `uname` in
152 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
153 BEOS=yes; AC_MSG_RESULT(yes);;
154 *) BEOS=no; AC_MSG_RESULT(no);;
155esac
156
157dnl If QNX is found, assume we don't want to use Xphoton
158dnl unless it was specifically asked for (--with-x)
159AC_MSG_CHECKING(for QNX)
160case `uname` in
161 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
162 test -z "$with_x" && with_x=no
163 QNX=yes; AC_MSG_RESULT(yes);;
164 *) QNX=no; AC_MSG_RESULT(no);;
165esac
166
167dnl Check for Darwin and MacOS X
168dnl We do a check for MacOS X in the very beginning because there
169dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +0000170AC_MSG_CHECKING([for Darwin (Mac OS X)])
171if test "`(uname) 2>/dev/null`" = Darwin; then
172 AC_MSG_RESULT(yes)
Bram Moolenaard0573012017-10-28 21:11:06 +0200173 MACOS_X=yes
Bram Moolenaar52ecaaa2018-05-12 21:38:13 +0200174 CPPFLAGS="$CPPFLAGS -DMACOS_X"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175
176 AC_MSG_CHECKING(--disable-darwin argument)
177 AC_ARG_ENABLE(darwin,
178 [ --disable-darwin Disable Darwin (Mac OS X) support.],
179 , [enable_darwin="yes"])
180 if test "$enable_darwin" = "yes"; then
181 AC_MSG_RESULT(no)
182 AC_MSG_CHECKING(if Darwin files are there)
Bram Moolenaar164fca32010-07-14 13:58:07 +0200183 if test -f os_macosx.m; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000184 AC_MSG_RESULT(yes)
185 else
186 AC_MSG_RESULT([no, Darwin support disabled])
187 enable_darwin=no
188 fi
189 else
190 AC_MSG_RESULT([yes, Darwin support excluded])
191 fi
192
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000193 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000194 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000195 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000196 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000197
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100198 AC_MSG_CHECKING(--with-developer-dir argument)
199 AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
200 DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
Bram Moolenaar32d03b32015-11-19 13:46:48 +0100201 AC_MSG_RESULT(not present))
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100202
203 if test "x$DEVELOPER_DIR" = "x"; then
204 AC_PATH_PROG(XCODE_SELECT, xcode-select)
205 if test "x$XCODE_SELECT" != "x"; then
206 AC_MSG_CHECKING(for developer dir using xcode-select)
207 DEVELOPER_DIR=`$XCODE_SELECT -print-path`
208 AC_MSG_RESULT([$DEVELOPER_DIR])
209 else
210 DEVELOPER_DIR=/Developer
211 fi
212 fi
213
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000214 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000215 AC_MSG_CHECKING(for 10.4 universal SDK)
216 dnl There is a terrible inconsistency (but we appear to get away with it):
217 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
218 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
219 dnl tests using the preprocessor are actually done with the wrong header
220 dnl files. $LDFLAGS is set at the end, because configure uses it together
221 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000222 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000223 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000224 save_ldflags="$LDFLAGS"
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100225 CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000226 AC_TRY_LINK([ ], [ ],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000227 AC_MSG_RESULT(found, will make universal binary),
228
229 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000230 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000231 AC_MSG_CHECKING(if Intel architecture is supported)
232 CPPFLAGS="$CPPFLAGS -arch i386"
233 LDFLAGS="$save_ldflags -arch i386"
234 AC_TRY_LINK([ ], [ ],
235 AC_MSG_RESULT(yes); MACARCH="intel",
236 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000237 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000238 CPPFLAGS="$save_cppflags -arch ppc"
239 LDFLAGS="$save_ldflags -arch ppc"))
240 elif test "x$MACARCH" = "xintel"; then
241 CPPFLAGS="$CPPFLAGS -arch intel"
242 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000243 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000244 CPPFLAGS="$CPPFLAGS -arch ppc"
245 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000246 fi
247
Bram Moolenaar071d4272004-06-13 20:20:40 +0000248 if test "$enable_darwin" = "yes"; then
Bram Moolenaard0573012017-10-28 21:11:06 +0200249 MACOS_X_DARWIN=yes
Bram Moolenaar164fca32010-07-14 13:58:07 +0200250 OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000251 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000252 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaar0958e0f2013-11-04 04:57:50 +0100253 dnl Removed -no-cpp-precomp, only for very old compilers.
Bram Moolenaard0573012017-10-28 21:11:06 +0200254 CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000255
256 dnl If Carbon is found, assume we don't want X11
257 dnl unless it was specifically asked for (--with-x)
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000258 dnl or Motif, Athena or GTK GUI is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000259 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
260 if test "x$CARBON" = "xyes"; then
Bram Moolenaar98921892016-02-23 17:14:37 +0100261 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000262 with_x=no
Bram Moolenaar071d4272004-06-13 20:20:40 +0000263 fi
264 fi
265 fi
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000266
Bram Moolenaardb552d602006-03-23 22:59:57 +0000267 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000268 dnl free. This happens in expand_filename(), because the optimizer swaps
Bram Moolenaardb552d602006-03-23 22:59:57 +0000269 dnl two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000270 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
271 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
272 fi
273
Bram Moolenaar071d4272004-06-13 20:20:40 +0000274else
275 AC_MSG_RESULT(no)
276fi
277
Bram Moolenaar39766a72013-11-03 00:41:00 +0100278dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon
279dnl so we need to include it to have access to version macros.
Bram Moolenaar18e54692013-11-03 20:26:31 +0100280AC_CHECK_HEADERS(AvailabilityMacros.h)
Bram Moolenaar39766a72013-11-03 00:41:00 +0100281
Bram Moolenaar071d4272004-06-13 20:20:40 +0000282AC_SUBST(OS_EXTRA_SRC)
283AC_SUBST(OS_EXTRA_OBJ)
284
285dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
286dnl Only when the directory exists and it wasn't there yet.
287dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000288dnl Skip all of this when cross-compiling.
289if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000290 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000291 have_local_include=''
292 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000293 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
294 --without-local-dir do not search /usr/local for local libraries.], [
295 local_dir="$withval"
296 case "$withval" in
297 */*) ;;
298 no)
299 # avoid adding local dir to LDFLAGS and CPPFLAGS
Bram Moolenaare06c1882010-07-21 22:05:20 +0200300 have_local_include=yes
Bram Moolenaarc236c162008-07-13 17:41:49 +0000301 have_local_lib=yes
302 ;;
303 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
304 esac
305 AC_MSG_RESULT($local_dir)
306 ], [
307 local_dir=/usr/local
308 AC_MSG_RESULT(Defaulting to $local_dir)
309 ])
310 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000311 echo 'void f(){}' > conftest.c
Bram Moolenaar0958e0f2013-11-04 04:57:50 +0100312 dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler)
313 have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
Bram Moolenaarc236c162008-07-13 17:41:49 +0000314 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000315 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000316 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000317 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
318 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 +0000319 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000320 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000321 fi
322 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000323 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
324 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 +0000325 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000326 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000327 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000328 fi
329fi
330
331AC_MSG_CHECKING(--with-vim-name argument)
332AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
333 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000334 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000335AC_SUBST(VIMNAME)
336AC_MSG_CHECKING(--with-ex-name argument)
337AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
338 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
339 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
340AC_SUBST(EXNAME)
341AC_MSG_CHECKING(--with-view-name argument)
342AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
343 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
344 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
345AC_SUBST(VIEWNAME)
346
347AC_MSG_CHECKING(--with-global-runtime argument)
Bram Moolenaar9d302ad2018-12-21 11:48:51 +0100348AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath', comma-separated for multiple directories],
349 RUNTIME_GLOBAL="$withval"; AC_MSG_RESULT($withval),
Bram Moolenaar071d4272004-06-13 20:20:40 +0000350 AC_MSG_RESULT(no))
351
Bram Moolenaar9d302ad2018-12-21 11:48:51 +0100352if test "X$RUNTIME_GLOBAL" != "X"; then
353 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" }')
354 AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$RUNTIME_GLOBAL")
355 AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL_AFTER, "$RUNTIME_GLOBAL_AFTER")
356fi
357
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358AC_MSG_CHECKING(--with-modified-by argument)
359AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
360 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
361 AC_MSG_RESULT(no))
362
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200363dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000364AC_MSG_CHECKING(if character set is EBCDIC)
365AC_TRY_COMPILE([ ],
366[ /* TryCompile function for CharSet.
367 Treat any failure as ASCII for compatibility with existing art.
368 Use compile-time rather than run-time tests for cross-compiler
369 tolerance. */
370#if '0'!=240
371make an error "Character set is not EBCDIC"
372#endif ],
373[ # TryCompile action if true
374cf_cv_ebcdic=yes ],
375[ # TryCompile action if false
376cf_cv_ebcdic=no])
377# end of TryCompile ])
378# end of CacheVal CvEbcdic
379AC_MSG_RESULT($cf_cv_ebcdic)
380case "$cf_cv_ebcdic" in #(vi
381 yes) AC_DEFINE(EBCDIC)
382 line_break='"\\n"'
383 ;;
384 *) line_break='"\\012"';;
385esac
386AC_SUBST(line_break)
387
388if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar84a05ac2013-05-06 04:24:17 +0200389dnl If we have EBCDIC we most likely have z/OS Unix, let's test it!
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200390AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000391case `uname` in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200392 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000393 dnl If using cc the environment variable _CC_CCMODE must be
394 dnl set to "1", so that some compiler extensions are enabled.
395 dnl If using c89 the environment variable is named _CC_C89MODE.
396 dnl Note: compile with c89 never tested.
397 if test "$CC" = "cc"; then
398 ccm="$_CC_CCMODE"
399 ccn="CC"
400 else
401 if test "$CC" = "c89"; then
402 ccm="$_CC_C89MODE"
403 ccn="C89"
404 else
405 ccm=1
406 fi
407 fi
408 if test "$ccm" != "1"; then
409 echo ""
410 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200411 echo " On z/OS Unix, the environment variable"
Bram Moolenaar77c19352012-06-13 19:19:41 +0200412 echo " _CC_${ccn}MODE must be set to \"1\"!"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000413 echo " Do:"
414 echo " export _CC_${ccn}MODE=1"
415 echo " and then call configure again."
416 echo "------------------------------------------"
417 exit 1
418 fi
Bram Moolenaar77c19352012-06-13 19:19:41 +0200419 # Set CFLAGS for configure process.
420 # This will be reset later for config.mk.
421 # Use haltonmsg to force error for missing H files.
422 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
423 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000424 AC_MSG_RESULT(yes)
425 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200426 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000427 AC_MSG_RESULT(no)
428 ;;
429esac
430fi
431
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200432dnl Set QUOTESED. Needs additional backslashes on zOS
433if test "$zOSUnix" = "yes"; then
434 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
435else
436 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
437fi
438AC_SUBST(QUOTESED)
439
440
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200441dnl Link with -lsmack for Smack stuff; if not found
442AC_MSG_CHECKING(--disable-smack argument)
443AC_ARG_ENABLE(smack,
444 [ --disable-smack Do not check for Smack support.],
445 , enable_smack="yes")
446if test "$enable_smack" = "yes"; then
Bram Moolenaar4ed89cd2014-04-05 12:02:25 +0200447 AC_MSG_RESULT(no)
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200448 AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no")
Bram Moolenaar4ed89cd2014-04-05 12:02:25 +0200449else
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200450 AC_MSG_RESULT(yes)
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200451fi
452if test "$enable_smack" = "yes"; then
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200453 AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no")
454fi
455if test "$enable_smack" = "yes"; then
456 AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h)
457 AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>],
458 AC_MSG_RESULT(yes),
Bram Moolenaare29b1fe2014-04-10 20:00:15 +0200459 AC_MSG_RESULT(no); enable_smack="no")
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200460fi
461if test "$enable_smack" = "yes"; then
462 AC_CHECK_LIB(attr, setxattr,
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200463 [LIBS="$LIBS -lattr"
464 found_smack="yes"
465 AC_DEFINE(HAVE_SMACK)])
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000466fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000467
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200468dnl When smack was found don't search for SELinux
469if test "x$found_smack" = "x"; then
470 dnl Link with -lselinux for SELinux stuff; if not found
471 AC_MSG_CHECKING(--disable-selinux argument)
472 AC_ARG_ENABLE(selinux,
473 [ --disable-selinux Do not check for SELinux support.],
474 , enable_selinux="yes")
475 if test "$enable_selinux" = "yes"; then
476 AC_MSG_RESULT(no)
477 AC_CHECK_LIB(selinux, is_selinux_enabled,
Bram Moolenaare4b78e22017-12-07 22:29:11 +0100478 [AC_CHECK_HEADER(selinux/selinux.h,
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200479 [LIBS="$LIBS -lselinux"
Bram Moolenaare4b78e22017-12-07 22:29:11 +0100480 AC_DEFINE(HAVE_SELINUX)])])
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200481 else
482 AC_MSG_RESULT(yes)
483 fi
484fi
485
Bram Moolenaar071d4272004-06-13 20:20:40 +0000486dnl Check user requested features.
487
488AC_MSG_CHECKING(--with-features argument)
Bram Moolenaareec29812016-07-26 21:27:36 +0200489AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: huge)],
Bram Moolenaar071d4272004-06-13 20:20:40 +0000490 features="$withval"; AC_MSG_RESULT($features),
Bram Moolenaar23c4f712016-01-20 22:11:59 +0100491 features="huge"; AC_MSG_RESULT(Defaulting to huge))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000492
493dovimdiff=""
494dogvimdiff=""
495case "$features" in
496 tiny) AC_DEFINE(FEAT_TINY) ;;
497 small) AC_DEFINE(FEAT_SMALL) ;;
498 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
499 dogvimdiff="installgvimdiff" ;;
500 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
501 dogvimdiff="installgvimdiff" ;;
502 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
503 dogvimdiff="installgvimdiff" ;;
504 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
505esac
506
507AC_SUBST(dovimdiff)
508AC_SUBST(dogvimdiff)
509
510AC_MSG_CHECKING(--with-compiledby argument)
511AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
512 compiledby="$withval"; AC_MSG_RESULT($withval),
513 compiledby=""; AC_MSG_RESULT(no))
514AC_SUBST(compiledby)
515
516AC_MSG_CHECKING(--disable-xsmp argument)
517AC_ARG_ENABLE(xsmp,
518 [ --disable-xsmp Disable XSMP session management],
519 , enable_xsmp="yes")
520
521if test "$enable_xsmp" = "yes"; then
522 AC_MSG_RESULT(no)
523 AC_MSG_CHECKING(--disable-xsmp-interact argument)
524 AC_ARG_ENABLE(xsmp-interact,
525 [ --disable-xsmp-interact Disable XSMP interaction],
526 , enable_xsmp_interact="yes")
527 if test "$enable_xsmp_interact" = "yes"; then
528 AC_MSG_RESULT(no)
529 AC_DEFINE(USE_XSMP_INTERACT)
530 else
531 AC_MSG_RESULT(yes)
532 fi
533else
534 AC_MSG_RESULT(yes)
535fi
536
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200537dnl Check for Lua feature.
538AC_MSG_CHECKING(--enable-luainterp argument)
539AC_ARG_ENABLE(luainterp,
Bram Moolenaar8008b632017-07-18 21:33:20 +0200540 [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200541 [enable_luainterp="no"])
542AC_MSG_RESULT($enable_luainterp)
543
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200544if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
Bram Moolenaar3c124e32016-01-31 14:36:58 +0100545 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
546 AC_MSG_ERROR([cannot use Lua with tiny or small features])
547 fi
548
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200549 dnl -- find the lua executable
550 AC_SUBST(vi_cv_path_lua)
551
552 AC_MSG_CHECKING(--with-lua-prefix argument)
553 AC_ARG_WITH(lua_prefix,
554 [ --with-lua-prefix=PFX Prefix where Lua is installed.],
555 with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200556 with_lua_prefix="";AC_MSG_RESULT(no))
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200557
558 if test "X$with_lua_prefix" != "X"; then
559 vi_cv_path_lua_pfx="$with_lua_prefix"
560 else
561 AC_MSG_CHECKING(LUA_PREFIX environment var)
562 if test "X$LUA_PREFIX" != "X"; then
563 AC_MSG_RESULT("$LUA_PREFIX")
564 vi_cv_path_lua_pfx="$LUA_PREFIX"
565 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200566 AC_MSG_RESULT([not set, default to /usr])
567 vi_cv_path_lua_pfx="/usr"
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200568 fi
569 fi
570
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200571 AC_MSG_CHECKING(--with-luajit)
572 AC_ARG_WITH(luajit,
573 [ --with-luajit Link with LuaJIT instead of Lua.],
574 [vi_cv_with_luajit="$withval"],
575 [vi_cv_with_luajit="no"])
576 AC_MSG_RESULT($vi_cv_with_luajit)
577
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200578 LUA_INC=
579 if test "X$vi_cv_path_lua_pfx" != "X"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200580 if test "x$vi_cv_with_luajit" != "xno"; then
581 dnl -- try to find LuaJIT executable
582 AC_PATH_PROG(vi_cv_path_luajit, luajit)
583 if test "X$vi_cv_path_luajit" != "X"; then
584 dnl -- find LuaJIT version
585 AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit,
Bram Moolenaar49b10272013-11-21 12:17:51 +0100586 [ 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 +0200587 AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit,
588 [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ])
589 vi_cv_path_lua="$vi_cv_path_luajit"
590 vi_cv_version_lua="$vi_cv_version_lua_luajit"
591 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200592 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200593 dnl -- try to find Lua executable
594 AC_PATH_PROG(vi_cv_path_plain_lua, lua)
595 if test "X$vi_cv_path_plain_lua" != "X"; then
596 dnl -- find Lua version
597 AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua,
598 [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
599 fi
600 vi_cv_path_lua="$vi_cv_path_plain_lua"
601 vi_cv_version_lua="$vi_cv_version_plain_lua"
602 fi
603 if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then
604 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 +0100605 if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200606 AC_MSG_RESULT(yes)
607 LUA_INC=/luajit-$vi_cv_version_luajit
608 fi
609 fi
610 if test "X$LUA_INC" = "X"; then
611 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
Bram Moolenaar49222be2015-12-11 18:11:30 +0100612 if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200613 AC_MSG_RESULT(yes)
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200614 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200615 AC_MSG_RESULT(no)
616 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 +0100617 if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200618 AC_MSG_RESULT(yes)
619 LUA_INC=/lua$vi_cv_version_lua
620 else
621 AC_MSG_RESULT(no)
622 vi_cv_path_lua_pfx=
623 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200624 fi
625 fi
626 fi
627
628 if test "X$vi_cv_path_lua_pfx" != "X"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200629 if test "x$vi_cv_with_luajit" != "xno"; then
630 multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
631 if test "X$multiarch" != "X"; then
632 lib_multiarch="lib/${multiarch}"
633 else
634 lib_multiarch="lib"
635 fi
636 if test "X$vi_cv_version_lua" = "X"; then
637 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit"
638 else
639 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua"
640 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200641 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200642 if test "X$LUA_INC" != "X"; then
643 dnl Test alternate location using version
644 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
645 else
646 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
647 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200648 fi
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200649 if test "$enable_luainterp" = "dynamic"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200650 lua_ok="yes"
651 else
652 AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane])
653 libs_save=$LIBS
654 LIBS="$LIBS $LUA_LIBS"
655 AC_TRY_LINK(,[ ],
656 AC_MSG_RESULT(yes); lua_ok="yes",
657 AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="")
658 LIBS=$libs_save
659 fi
660 if test "x$lua_ok" = "xyes"; then
661 LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
662 LUA_SRC="if_lua.c"
663 LUA_OBJ="objects/if_lua.o"
664 LUA_PRO="if_lua.pro"
665 AC_DEFINE(FEAT_LUA)
666 fi
667 if test "$enable_luainterp" = "dynamic"; then
668 if test "x$vi_cv_with_luajit" != "xno"; then
669 luajit="jit"
670 fi
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200671 if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
672 vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
673 else
Bram Moolenaard0573012017-10-28 21:11:06 +0200674 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200675 ext="dylib"
676 indexes=""
677 else
678 ext="so"
679 indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9"
680 multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
681 if test "X$multiarch" != "X"; then
682 lib_multiarch="lib/${multiarch}"
683 fi
Bram Moolenaar768baac2013-04-15 14:44:57 +0200684 fi
685 dnl Determine the sover for the current version, but fallback to
686 dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found.
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200687 AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx)
Bram Moolenaar768baac2013-04-15 14:44:57 +0200688 for subdir in "${lib_multiarch}" lib64 lib; do
689 if test -z "$subdir"; then
690 continue
691 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200692 for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \
693 ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do
694 for i in $indexes ""; do
695 if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then
Bram Moolenaar768baac2013-04-15 14:44:57 +0200696 sover2="$i"
697 break 3
698 fi
699 done
Bram Moolenaar07e1da62013-02-06 19:49:43 +0100700 done
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200701 sover=""
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200702 done
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200703 if test "X$sover" = "X"; then
704 AC_MSG_RESULT(no)
705 lua_ok="no"
706 vi_cv_dll_name_lua="liblua${luajit}.${ext}"
707 else
708 AC_MSG_RESULT(yes)
709 lua_ok="yes"
710 vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2"
711 fi
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200712 fi
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200713 AC_DEFINE(DYNAMIC_LUA)
714 LUA_LIBS=""
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200715 LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS"
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200716 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200717 if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \
Bram Moolenaard0573012017-10-28 21:11:06 +0200718 test "x$MACOS_X" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200719 test "`(uname -m) 2>/dev/null`" = "x86_64"; then
720 dnl OSX/x64 requires these flags. See http://luajit.org/install.html
721 LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS"
722 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200723 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200724 if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then
Bram Moolenaarf788a062011-12-14 20:51:25 +0100725 AC_MSG_ERROR([could not configure lua])
726 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200727 AC_SUBST(LUA_SRC)
728 AC_SUBST(LUA_OBJ)
729 AC_SUBST(LUA_PRO)
730 AC_SUBST(LUA_LIBS)
731 AC_SUBST(LUA_CFLAGS)
732fi
733
734
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000735dnl Check for MzScheme feature.
736AC_MSG_CHECKING(--enable-mzschemeinterp argument)
737AC_ARG_ENABLE(mzschemeinterp,
Bram Moolenaar8008b632017-07-18 21:33:20 +0200738 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000739 [enable_mzschemeinterp="no"])
740AC_MSG_RESULT($enable_mzschemeinterp)
741
742if test "$enable_mzschemeinterp" = "yes"; then
743 dnl -- find the mzscheme executable
744 AC_SUBST(vi_cv_path_mzscheme)
745
746 AC_MSG_CHECKING(--with-plthome argument)
747 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000748 [ --with-plthome=PLTHOME Use PLTHOME.],
749 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000750 with_plthome="";AC_MSG_RESULT("no"))
751
752 if test "X$with_plthome" != "X"; then
753 vi_cv_path_mzscheme_pfx="$with_plthome"
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100754 vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000755 else
756 AC_MSG_CHECKING(PLTHOME environment var)
757 if test "X$PLTHOME" != "X"; then
758 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000759 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100760 vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000761 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000762 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000763 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000764 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000765
766 dnl resolve symbolic link, the executable is often elsewhere and there
767 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000768 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000769 lsout=`ls -l $vi_cv_path_mzscheme`
770 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
771 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
772 fi
773 fi
774
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000775 if test "X$vi_cv_path_mzscheme" != "X"; then
776 dnl -- find where MzScheme thinks it was installed
777 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000778 dnl different versions of MzScheme differ in command line processing
779 dnl use universal approach
780 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000781 (build-path (call-with-values \
782 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000783 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
784 dnl Remove a trailing slash
785 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
786 sed -e 's+/$++'` ])
787 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000788 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000789 fi
790 fi
791
792 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100793 AC_MSG_CHECKING(for racket include directory)
794 SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'`
795 if test "X$SCHEME_INC" != "X"; then
796 AC_MSG_RESULT(${SCHEME_INC})
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000797 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100798 AC_MSG_RESULT(not found)
799 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
800 if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then
801 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000802 AC_MSG_RESULT(yes)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000803 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000804 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100805 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
806 if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000807 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100808 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000809 else
810 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100811 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket)
812 if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100813 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100814 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100815 else
816 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100817 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
818 if test -f /usr/include/plt/scheme.h; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100819 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100820 SCHEME_INC=/usr/include/plt
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100821 else
822 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100823 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/)
824 if test -f /usr/include/racket/scheme.h; then
825 AC_MSG_RESULT(yes)
826 SCHEME_INC=/usr/include/racket
827 else
828 AC_MSG_RESULT(no)
829 vi_cv_path_mzscheme_pfx=
830 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100831 fi
832 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000833 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000834 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000835 fi
836 fi
837
838 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100839
840 AC_MSG_CHECKING(for racket lib directory)
841 SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'`
842 if test "X$SCHEME_LIB" != "X"; then
843 AC_MSG_RESULT(${SCHEME_LIB})
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000844 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100845 AC_MSG_RESULT(not found)
846 fi
847
848 for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
849 if test "X$path" != "X"; then
Bram Moolenaard0573012017-10-28 21:11:06 +0200850 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100851 MZSCHEME_LIBS="-framework Racket"
852 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
853 elif test -f "${path}/libmzscheme3m.a"; then
854 MZSCHEME_LIBS="${path}/libmzscheme3m.a"
855 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
856 elif test -f "${path}/libracket3m.a"; then
857 MZSCHEME_LIBS="${path}/libracket3m.a"
858 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
859 elif test -f "${path}/libracket.a"; then
860 MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a"
861 elif test -f "${path}/libmzscheme.a"; then
862 MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a"
863 else
864 dnl Using shared objects
865 if test -f "${path}/libmzscheme3m.so"; then
866 MZSCHEME_LIBS="-L${path} -lmzscheme3m"
867 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
868 elif test -f "${path}/libracket3m.so"; then
869 MZSCHEME_LIBS="-L${path} -lracket3m"
870 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
871 elif test -f "${path}/libracket.so"; then
872 MZSCHEME_LIBS="-L${path} -lracket -lmzgc"
873 else
874 dnl try next until last
875 if test "$path" != "$SCHEME_LIB"; then
876 continue
877 fi
878 MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc"
879 fi
880 if test "$GCC" = yes; then
881 dnl Make Vim remember the path to the library. For when it's not in
882 dnl $LD_LIBRARY_PATH.
883 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}"
884 elif test "`(uname) 2>/dev/null`" = SunOS &&
885 uname -r | grep '^5' >/dev/null; then
886 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}"
887 fi
888 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000889 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100890 if test "X$MZSCHEME_LIBS" != "X"; then
891 break
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000892 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100893 done
894
895 AC_MSG_CHECKING([if racket requires -pthread])
896 if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then
897 AC_MSG_RESULT(yes)
898 MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread"
899 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread"
900 else
901 AC_MSG_RESULT(no)
902 fi
903
904 AC_MSG_CHECKING(for racket config directory)
905 SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'`
906 if test "X$SCHEME_CONFIGDIR" != "X"; then
907 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'"
908 AC_MSG_RESULT(${SCHEME_CONFIGDIR})
909 else
910 AC_MSG_RESULT(not found)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000911 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100912
913 AC_MSG_CHECKING(for racket collects directory)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100914 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))))'`
915 if test "X$SCHEME_COLLECTS" = "X"; then
916 if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then
917 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100918 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100919 if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then
920 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/
Bram Moolenaar75676462013-01-30 14:55:42 +0100921 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100922 if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then
923 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
924 else
925 if test -d "$vi_cv_path_mzscheme_pfx/collects"; then
926 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
927 fi
Bram Moolenaar75676462013-01-30 14:55:42 +0100928 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100929 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100930 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000931 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100932 if test "X$SCHEME_COLLECTS" != "X" ; then
933 AC_MSG_RESULT(${SCHEME_COLLECTS})
934 else
935 AC_MSG_RESULT(not found)
936 fi
937
938 AC_MSG_CHECKING(for mzscheme_base.c)
939 if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000940 MZSCHEME_EXTRA="mzscheme_base.c"
Bram Moolenaar45e2bcc2014-02-15 17:19:00 +0100941 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
942 MZSCHEME_MOD="++lib scheme/base"
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100943 else
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100944 if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100945 MZSCHEME_EXTRA="mzscheme_base.c"
Bram Moolenaar45e2bcc2014-02-15 17:19:00 +0100946 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
947 MZSCHEME_MOD="++lib scheme/base"
948 else
949 if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then
950 MZSCHEME_EXTRA="mzscheme_base.c"
951 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool"
952 MZSCHEME_MOD=""
953 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100954 fi
955 fi
956 if test "X$MZSCHEME_EXTRA" != "X" ; then
957 dnl need to generate bytecode for MzScheme base
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000958 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100959 AC_MSG_RESULT(needed)
960 else
961 AC_MSG_RESULT(not needed)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000962 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100963
Bram Moolenaar9e902192013-07-17 18:58:11 +0200964 dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'".
965 AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"])
966
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000967 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100968 -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar9e902192013-07-17 18:58:11 +0200969
970 dnl Test that we can compile a simple program with these CFLAGS and LIBS.
971 AC_MSG_CHECKING([if compile and link flags for MzScheme are sane])
972 cflags_save=$CFLAGS
973 libs_save=$LIBS
974 CFLAGS="$CFLAGS $MZSCHEME_CFLAGS"
975 LIBS="$LIBS $MZSCHEME_LIBS"
976 AC_TRY_LINK(,[ ],
977 AC_MSG_RESULT(yes); mzs_ok=yes,
978 AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no)
979 CFLAGS=$cflags_save
980 LIBS=$libs_save
981 if test $mzs_ok = yes; then
982 MZSCHEME_SRC="if_mzsch.c"
983 MZSCHEME_OBJ="objects/if_mzsch.o"
984 MZSCHEME_PRO="if_mzsch.pro"
985 AC_DEFINE(FEAT_MZSCHEME)
986 else
987 MZSCHEME_CFLAGS=
988 MZSCHEME_LIBS=
989 MZSCHEME_EXTRA=
990 MZSCHEME_MZC=
991 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000992 fi
993 AC_SUBST(MZSCHEME_SRC)
994 AC_SUBST(MZSCHEME_OBJ)
995 AC_SUBST(MZSCHEME_PRO)
996 AC_SUBST(MZSCHEME_LIBS)
997 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000998 AC_SUBST(MZSCHEME_EXTRA)
999 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001000fi
1001
1002
Bram Moolenaar071d4272004-06-13 20:20:40 +00001003AC_MSG_CHECKING(--enable-perlinterp argument)
1004AC_ARG_ENABLE(perlinterp,
Bram Moolenaare06c1882010-07-21 22:05:20 +02001005 [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001006 [enable_perlinterp="no"])
1007AC_MSG_RESULT($enable_perlinterp)
Bram Moolenaare06c1882010-07-21 22:05:20 +02001008if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
Bram Moolenaar3c124e32016-01-31 14:36:58 +01001009 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1010 AC_MSG_ERROR([cannot use Perl with tiny or small features])
1011 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001012 AC_SUBST(vi_cv_path_perl)
1013 AC_PATH_PROG(vi_cv_path_perl, perl)
1014 if test "X$vi_cv_path_perl" != "X"; then
1015 AC_MSG_CHECKING(Perl version)
1016 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
1017 eval `$vi_cv_path_perl -V:usethreads`
Bram Moolenaare06c1882010-07-21 22:05:20 +02001018 eval `$vi_cv_path_perl -V:libperl`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001019 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
1020 badthreads=no
1021 else
1022 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
1023 eval `$vi_cv_path_perl -V:use5005threads`
1024 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
1025 badthreads=no
1026 else
1027 badthreads=yes
1028 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
1029 fi
1030 else
1031 badthreads=yes
1032 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
1033 fi
1034 fi
1035 if test $badthreads = no; then
1036 AC_MSG_RESULT(OK)
1037 eval `$vi_cv_path_perl -V:shrpenv`
1038 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
1039 shrpenv=""
1040 fi
1041 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
1042 AC_SUBST(vi_cv_perllib)
Bram Moolenaard5f62b12014-08-17 17:05:44 +02001043 vi_cv_perl_extutils=unknown_perl_extutils_path
1044 for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do
1045 xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp"
1046 if test -f "$xsubpp_path"; then
1047 vi_cv_perl_xsubpp="$xsubpp_path"
1048 fi
1049 done
1050 AC_SUBST(vi_cv_perl_xsubpp)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001051 dnl Remove "-fno-something", it breaks using cproto.
Bram Moolenaar280a8682015-06-21 13:41:08 +02001052 dnl Remove "-fdebug-prefix-map", it isn't supported by clang.
Bram Moolenaare8ff56b2017-09-14 23:06:23 +02001053 dnl Remove "FORTIFY_SOURCE", it will be defined twice.
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001054 dnl remove -pipe and -Wxxx, it confuses cproto
Bram Moolenaar071d4272004-06-13 20:20:40 +00001055 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
Bram Moolenaare8ff56b2017-09-14 23:06:23 +02001056 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \
1057 -e 's/-fdebug-prefix-map[[^ ]]*//g' \
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001058 -e 's/-pipe //' \
1059 -e 's/-W[[^ ]]*//g' \
1060 -e 's/-D_FORTIFY_SOURCE=.//g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001061 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
1062 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
1063 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
1064 -e 's/-bE:perl.exp//' -e 's/-lc //'`
1065 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
1066 dnl a test in configure may fail because of that.
1067 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
1068 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
1069
1070 dnl check that compiling a simple program still works with the flags
1071 dnl added for Perl.
1072 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
1073 cflags_save=$CFLAGS
1074 libs_save=$LIBS
1075 ldflags_save=$LDFLAGS
1076 CFLAGS="$CFLAGS $perlcppflags"
1077 LIBS="$LIBS $perllibs"
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001078 perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001079 LDFLAGS="$perlldflags $LDFLAGS"
1080 AC_TRY_LINK(,[ ],
1081 AC_MSG_RESULT(yes); perl_ok=yes,
1082 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
1083 CFLAGS=$cflags_save
1084 LIBS=$libs_save
1085 LDFLAGS=$ldflags_save
1086 if test $perl_ok = yes; then
1087 if test "X$perlcppflags" != "X"; then
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001088 PERL_CFLAGS=$perlcppflags
Bram Moolenaar071d4272004-06-13 20:20:40 +00001089 fi
1090 if test "X$perlldflags" != "X"; then
Bram Moolenaar2bcaec32014-03-27 18:51:11 +01001091 if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001092 LDFLAGS="$perlldflags $LDFLAGS"
1093 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001094 fi
1095 PERL_LIBS=$perllibs
1096 PERL_SRC="auto/if_perl.c if_perlsfio.c"
1097 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
1098 PERL_PRO="if_perl.pro if_perlsfio.pro"
1099 AC_DEFINE(FEAT_PERL)
1100 fi
1101 fi
1102 else
1103 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
1104 fi
1105 fi
1106
Bram Moolenaard0573012017-10-28 21:11:06 +02001107 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +00001108 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +00001109 dir=/System/Library/Perl
1110 darwindir=$dir/darwin
1111 if test -d $darwindir; then
1112 PERL=/usr/bin/perl
1113 else
1114 dnl Mac OS X 10.3
1115 dir=/System/Library/Perl/5.8.1
1116 darwindir=$dir/darwin-thread-multi-2level
1117 if test -d $darwindir; then
1118 PERL=/usr/bin/perl
1119 fi
1120 fi
1121 if test -n "$PERL"; then
1122 PERL_DIR="$dir"
1123 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
1124 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
1125 PERL_LIBS="-L$darwindir/CORE -lperl"
1126 fi
Bram Moolenaar5dff57d2010-07-24 16:19:44 +02001127 dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only
1128 dnl be included if requested by passing --with-mac-arch to
1129 dnl configure, so strip these flags first (if present)
1130 PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
1131 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 +00001132 fi
Bram Moolenaare06c1882010-07-21 22:05:20 +02001133 if test "$enable_perlinterp" = "dynamic"; then
1134 if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
1135 AC_DEFINE(DYNAMIC_PERL)
1136 PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
1137 fi
1138 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001139
1140 if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then
1141 AC_MSG_ERROR([could not configure perl])
1142 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001143fi
1144AC_SUBST(shrpenv)
1145AC_SUBST(PERL_SRC)
1146AC_SUBST(PERL_OBJ)
1147AC_SUBST(PERL_PRO)
1148AC_SUBST(PERL_CFLAGS)
1149AC_SUBST(PERL_LIBS)
1150
1151AC_MSG_CHECKING(--enable-pythoninterp argument)
1152AC_ARG_ENABLE(pythoninterp,
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001153 [ --enable-pythoninterp[=OPTS] Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001154 [enable_pythoninterp="no"])
1155AC_MSG_RESULT($enable_pythoninterp)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001156if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
Bram Moolenaar0b105412014-11-30 13:34:23 +01001157 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1158 AC_MSG_ERROR([cannot use Python with tiny or small features])
1159 fi
1160
Bram Moolenaar071d4272004-06-13 20:20:40 +00001161 dnl -- find the python executable
Bram Moolenaare1a32312018-04-15 16:03:25 +02001162 AC_MSG_CHECKING(--with-python-command argument)
1163 AC_SUBST(vi_cv_path_python)
1164 AC_ARG_WITH(python-command, [ --with-python-command=NAME name of the Python 2 command (default: python2 or python)],
1165 vi_cv_path_python="$withval"; AC_MSG_RESULT($vi_cv_path_python),
1166 AC_MSG_RESULT(no))
1167
1168 if test "X$vi_cv_path_python" = "X"; then
1169 AC_PATH_PROGS(vi_cv_path_python, python2 python)
1170 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001171 if test "X$vi_cv_path_python" != "X"; then
1172
1173 dnl -- get its version number
1174 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
1175 [[vi_cv_var_python_version=`
1176 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
1177 ]])
1178
Bram Moolenaarc09a6d62013-06-10 21:27:29 +02001179 dnl -- it must be at least version 2.3
1180 AC_MSG_CHECKING(Python is 2.3 or better)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001181 if ${vi_cv_path_python} -c \
Bram Moolenaarc09a6d62013-06-10 21:27:29 +02001182 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001183 then
1184 AC_MSG_RESULT(yep)
1185
1186 dnl -- find where python thinks it was installed
1187 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
1188 [ vi_cv_path_python_pfx=`
1189 ${vi_cv_path_python} -c \
1190 "import sys; print sys.prefix"` ])
1191
1192 dnl -- and where it thinks it runs
1193 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
1194 [ vi_cv_path_python_epfx=`
1195 ${vi_cv_path_python} -c \
1196 "import sys; print sys.exec_prefix"` ])
1197
1198 dnl -- python's internal library path
1199
1200 AC_CACHE_VAL(vi_cv_path_pythonpath,
1201 [ vi_cv_path_pythonpath=`
1202 unset PYTHONPATH;
1203 ${vi_cv_path_python} -c \
1204 "import sys, string; print string.join(sys.path,':')"` ])
1205
1206 dnl -- where the Python implementation library archives are
1207
1208 AC_ARG_WITH(python-config-dir,
Bram Moolenaare1a32312018-04-15 16:03:25 +02001209 [ --with-python-config-dir=PATH Python's config directory (deprecated)],
Bram Moolenaard0882402018-04-10 18:13:05 +02001210 [ vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 ] )
Bram Moolenaar071d4272004-06-13 20:20:40 +00001211
1212 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
1213 [
1214 vi_cv_path_python_conf=
Bram Moolenaarac499e32013-06-02 19:14:17 +02001215 d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
1216 if test -d "$d" && test -f "$d/config.c"; then
1217 vi_cv_path_python_conf="$d"
1218 else
1219 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
1220 for subdir in lib64 lib share; do
1221 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
1222 if test -d "$d" && test -f "$d/config.c"; then
1223 vi_cv_path_python_conf="$d"
1224 fi
1225 done
Bram Moolenaar071d4272004-06-13 20:20:40 +00001226 done
Bram Moolenaarac499e32013-06-02 19:14:17 +02001227 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001228 ])
1229
1230 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
1231
1232 if test "X$PYTHON_CONFDIR" = "X"; then
1233 AC_MSG_RESULT([can't find it!])
1234 else
1235
1236 dnl -- we need to examine Python's config/Makefile too
1237 dnl see what the interpreter is built from
1238 AC_CACHE_VAL(vi_cv_path_python_plibs,
1239 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +00001240 pwd=`pwd`
1241 tmp_mkf="$pwd/config-PyMake$$"
1242 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001243__:
Bram Moolenaar218116c2010-05-20 21:46:00 +02001244 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001245 @echo "python_LIBS='$(LIBS)'"
1246 @echo "python_SYSLIBS='$(SYSLIBS)'"
1247 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
Bram Moolenaarf94a13c2012-09-21 13:26:49 +02001248 @echo "python_DLLLIBRARY='$(DLLLIBRARY)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001249 @echo "python_INSTSONAME='$(INSTSONAME)'"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001250 @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'"
1251 @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
1252 @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001253eof
1254 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +00001255 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1256 rm -f -- "${tmp_mkf}"
Bram Moolenaard0573012017-10-28 21:11:06 +02001257 if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
Bram Moolenaar071d4272004-06-13 20:20:40 +00001258 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
1259 vi_cv_path_python_plibs="-framework Python"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001260 if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
1261 vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python"
1262 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001263 else
Bram Moolenaar9ce42132018-04-11 22:19:36 +02001264 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001265 dnl -- Check if the path contained in python_LINKFORSHARED is
1266 dnl usable for vim build. If not, make and try other
1267 dnl candidates.
Bram Moolenaara161e262015-03-24 15:14:27 +01001268 if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
Bram Moolenaar6c927552015-03-24 12:21:33 +01001269 python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'`
1270 python_link_path=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]][[ \t]]*\(.*\)/\2/'`
1271 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1272 dnl -- The path looks relative. Guess the absolute one using
1273 dnl the prefix and try that.
1274 python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}"
1275 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1276 dnl -- A last resort.
1277 python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}"
1278 dnl -- No check is done. The last word is left to the
1279 dnl "sanity" test on link flags that follows shortly.
1280 fi
1281 python_LINKFORSHARED="${python_link_symbol} ${python_link_path}"
1282 fi
1283 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +02001284 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 +00001285 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1286 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
1287 fi
1288 ])
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001289 AC_CACHE_CHECK(Python's dll name,vi_cv_dll_name_python,
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001290 [
1291 if test "X$python_DLLLIBRARY" != "X"; then
1292 vi_cv_dll_name_python="$python_DLLLIBRARY"
1293 else
1294 vi_cv_dll_name_python="$python_INSTSONAME"
1295 fi
1296 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001297
1298 PYTHON_LIBS="${vi_cv_path_python_plibs}"
1299 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
Bram Moolenaar04249582018-04-10 13:29:34 +02001300 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001301 else
Bram Moolenaar04249582018-04-10 13:29:34 +02001302 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 +00001303 fi
Bram Moolenaar3a21d9c2018-04-10 20:26:20 +02001304 if test "X$have_python_config_dir" = "X1" -a "$enable_pythoninterp" = "dynamic"; then
Bram Moolenaard0882402018-04-10 18:13:05 +02001305 dnl Define PYTHON_HOME if --with-python-config-dir was used
1306 PYTHON_CFLAGS="${PYTHON_CFLAGS} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
1307
1308 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001309 PYTHON_SRC="if_python.c"
Bram Moolenaar9bdb9a02012-07-25 16:32:08 +02001310 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001311
1312 dnl On FreeBSD linking with "-pthread" is required to use threads.
1313 dnl _THREAD_SAFE must be used for compiling then.
1314 dnl The "-pthread" is added to $LIBS, so that the following check for
1315 dnl sigaltstack() will look in libc_r (it's there in libc!).
1316 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1317 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1318 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1319 AC_MSG_CHECKING([if -pthread should be used])
1320 threadsafe_flag=
1321 thread_lib=
Bram Moolenaard0573012017-10-28 21:11:06 +02001322 dnl if test "x$MACOS_X" != "xyes"; then
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00001323 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001324 test "$GCC" = yes && threadsafe_flag="-pthread"
1325 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1326 threadsafe_flag="-D_THREAD_SAFE"
1327 thread_lib="-pthread"
1328 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001329 if test "`(uname) 2>/dev/null`" = SunOS; then
1330 threadsafe_flag="-pthreads"
1331 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001332 fi
1333 libs_save_old=$LIBS
1334 if test -n "$threadsafe_flag"; then
1335 cflags_save=$CFLAGS
1336 CFLAGS="$CFLAGS $threadsafe_flag"
1337 LIBS="$LIBS $thread_lib"
1338 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +02001339 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +00001340 AC_MSG_RESULT(no); LIBS=$libs_save_old
1341 )
1342 CFLAGS=$cflags_save
1343 else
1344 AC_MSG_RESULT(no)
1345 fi
1346
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001347 dnl Check that compiling a simple program still works with the flags
Bram Moolenaar071d4272004-06-13 20:20:40 +00001348 dnl added for Python.
1349 AC_MSG_CHECKING([if compile and link flags for Python are sane])
1350 cflags_save=$CFLAGS
1351 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +02001352 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001353 LIBS="$LIBS $PYTHON_LIBS"
1354 AC_TRY_LINK(,[ ],
1355 AC_MSG_RESULT(yes); python_ok=yes,
1356 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
1357 CFLAGS=$cflags_save
1358 LIBS=$libs_save
1359 if test $python_ok = yes; then
1360 AC_DEFINE(FEAT_PYTHON)
1361 else
1362 LIBS=$libs_save_old
1363 PYTHON_SRC=
1364 PYTHON_OBJ=
1365 PYTHON_LIBS=
1366 PYTHON_CFLAGS=
1367 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001368 fi
1369 else
1370 AC_MSG_RESULT(too old)
1371 fi
1372 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001373
1374 if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then
1375 AC_MSG_ERROR([could not configure python])
1376 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001377fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001378
Bram Moolenaar071d4272004-06-13 20:20:40 +00001379AC_SUBST(PYTHON_LIBS)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001380AC_SUBST(PYTHON_CFLAGS)
1381AC_SUBST(PYTHON_SRC)
1382AC_SUBST(PYTHON_OBJ)
1383
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001384
1385AC_MSG_CHECKING(--enable-python3interp argument)
1386AC_ARG_ENABLE(python3interp,
Bram Moolenaar8008b632017-07-18 21:33:20 +02001387 [ --enable-python3interp[=OPTS] Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001388 [enable_python3interp="no"])
1389AC_MSG_RESULT($enable_python3interp)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001390if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
Bram Moolenaar0b105412014-11-30 13:34:23 +01001391 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1392 AC_MSG_ERROR([cannot use Python with tiny or small features])
1393 fi
1394
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001395 dnl -- find the python3 executable
Bram Moolenaare1a32312018-04-15 16:03:25 +02001396 AC_MSG_CHECKING(--with-python3-command argument)
1397 AC_SUBST(vi_cv_path_python3)
1398 AC_ARG_WITH(python3-command, [ --with-python3-command=NAME name of the Python 3 command (default: python3 or python)],
1399 vi_cv_path_python3="$withval"; AC_MSG_RESULT($vi_cv_path_python3),
1400 AC_MSG_RESULT(no))
1401
1402 if test "X$vi_cv_path_python3" = "X"; then
1403 AC_PATH_PROGS(vi_cv_path_python3, python3 python)
1404 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001405 if test "X$vi_cv_path_python3" != "X"; then
1406
1407 dnl -- get its version number
1408 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
1409 [[vi_cv_var_python3_version=`
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001410 ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001411 ]])
1412
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001413 dnl -- it must be at least version 3
1414 AC_MSG_CHECKING(Python is 3.0 or better)
1415 if ${vi_cv_path_python3} -c \
1416 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)"
1417 then
1418 AC_MSG_RESULT(yep)
Bram Moolenaar456f2bb2011-06-12 21:37:13 +02001419
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001420 dnl -- get abiflags for python 3.2 or higher (PEP 3149)
1421 AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001422 [
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001423 vi_cv_var_python3_abiflags=
1424 if ${vi_cv_path_python3} -c \
1425 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)"
1426 then
1427 vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \
1428 "import sys; print(sys.abiflags)"`
1429 fi ])
1430
1431 dnl -- find where python3 thinks it was installed
1432 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
1433 [ vi_cv_path_python3_pfx=`
1434 ${vi_cv_path_python3} -c \
1435 "import sys; print(sys.prefix)"` ])
1436
1437 dnl -- and where it thinks it runs
1438 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
1439 [ vi_cv_path_python3_epfx=`
1440 ${vi_cv_path_python3} -c \
1441 "import sys; print(sys.exec_prefix)"` ])
1442
1443 dnl -- python3's internal library path
1444
1445 AC_CACHE_VAL(vi_cv_path_python3path,
1446 [ vi_cv_path_python3path=`
1447 unset PYTHONPATH;
1448 ${vi_cv_path_python3} -c \
1449 "import sys, string; print(':'.join(sys.path))"` ])
1450
1451 dnl -- where the Python implementation library archives are
1452
1453 AC_ARG_WITH(python3-config-dir,
Bram Moolenaare1a32312018-04-15 16:03:25 +02001454 [ --with-python3-config-dir=PATH Python's config directory (deprecated)],
Bram Moolenaard0882402018-04-10 18:13:05 +02001455 [ vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 ] )
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001456
1457 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
1458 [
1459 vi_cv_path_python3_conf=
Bram Moolenaarfee496d2013-07-12 20:07:24 +02001460 config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001461 d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
1462 if test -d "$d" && test -f "$d/config.c"; then
1463 vi_cv_path_python3_conf="$d"
1464 else
1465 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
1466 for subdir in lib64 lib share; do
1467 d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
1468 if test -d "$d" && test -f "$d/config.c"; then
1469 vi_cv_path_python3_conf="$d"
1470 fi
1471 done
1472 done
1473 fi
1474 ])
1475
1476 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
1477
1478 if test "X$PYTHON3_CONFDIR" = "X"; then
1479 AC_MSG_RESULT([can't find it!])
1480 else
1481
1482 dnl -- we need to examine Python's config/Makefile too
1483 dnl see what the interpreter is built from
1484 AC_CACHE_VAL(vi_cv_path_python3_plibs,
1485 [
1486 pwd=`pwd`
1487 tmp_mkf="$pwd/config-PyMake$$"
1488 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001489__:
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001490 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001491 @echo "python3_LIBS='$(LIBS)'"
1492 @echo "python3_SYSLIBS='$(SYSLIBS)'"
Bram Moolenaarf94a13c2012-09-21 13:26:49 +02001493 @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001494 @echo "python3_INSTSONAME='$(INSTSONAME)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001495eof
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001496 dnl -- delete the lines from make about Entering/Leaving directory
1497 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1498 rm -f -- "${tmp_mkf}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001499 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 +02001500 vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}"
1501 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1502 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1503 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1504 ])
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001505 AC_CACHE_CHECK(Python3's dll name,vi_cv_dll_name_python3,
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001506 [
1507 if test "X$python3_DLLLIBRARY" != "X"; then
1508 vi_cv_dll_name_python3="$python3_DLLLIBRARY"
1509 else
1510 vi_cv_dll_name_python3="$python3_INSTSONAME"
1511 fi
1512 ])
1513
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001514 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
1515 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
Bram Moolenaar04249582018-04-10 13:29:34 +02001516 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001517 else
Bram Moolenaar04249582018-04-10 13:29:34 +02001518 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001519 fi
Bram Moolenaar3a21d9c2018-04-10 20:26:20 +02001520 if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then
Bram Moolenaard0882402018-04-10 18:13:05 +02001521 dnl Define PYTHON3_HOME if --with-python-config-dir was used
1522 PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'"
1523 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001524 PYTHON3_SRC="if_python3.c"
1525 PYTHON3_OBJ="objects/if_python3.o"
1526
1527 dnl On FreeBSD linking with "-pthread" is required to use threads.
1528 dnl _THREAD_SAFE must be used for compiling then.
1529 dnl The "-pthread" is added to $LIBS, so that the following check for
1530 dnl sigaltstack() will look in libc_r (it's there in libc!).
1531 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1532 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1533 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1534 AC_MSG_CHECKING([if -pthread should be used])
1535 threadsafe_flag=
1536 thread_lib=
Bram Moolenaard0573012017-10-28 21:11:06 +02001537 dnl if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001538 if test "`(uname) 2>/dev/null`" != Darwin; then
1539 test "$GCC" = yes && threadsafe_flag="-pthread"
1540 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1541 threadsafe_flag="-D_THREAD_SAFE"
1542 thread_lib="-pthread"
1543 fi
1544 if test "`(uname) 2>/dev/null`" = SunOS; then
1545 threadsafe_flag="-pthreads"
1546 fi
1547 fi
1548 libs_save_old=$LIBS
1549 if test -n "$threadsafe_flag"; then
1550 cflags_save=$CFLAGS
1551 CFLAGS="$CFLAGS $threadsafe_flag"
1552 LIBS="$LIBS $thread_lib"
1553 AC_TRY_LINK(,[ ],
1554 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1555 AC_MSG_RESULT(no); LIBS=$libs_save_old
1556 )
1557 CFLAGS=$cflags_save
1558 else
1559 AC_MSG_RESULT(no)
1560 fi
1561
1562 dnl check that compiling a simple program still works with the flags
1563 dnl added for Python.
1564 AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
1565 cflags_save=$CFLAGS
1566 libs_save=$LIBS
1567 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1568 LIBS="$LIBS $PYTHON3_LIBS"
1569 AC_TRY_LINK(,[ ],
1570 AC_MSG_RESULT(yes); python3_ok=yes,
1571 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1572 CFLAGS=$cflags_save
1573 LIBS=$libs_save
1574 if test "$python3_ok" = yes; then
1575 AC_DEFINE(FEAT_PYTHON3)
1576 else
1577 LIBS=$libs_save_old
1578 PYTHON3_SRC=
1579 PYTHON3_OBJ=
1580 PYTHON3_LIBS=
1581 PYTHON3_CFLAGS=
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001582 fi
1583 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001584 else
1585 AC_MSG_RESULT(too old)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001586 fi
1587 fi
Bram Moolenaar1612b1a2013-06-14 21:22:39 +02001588 if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then
1589 AC_MSG_ERROR([could not configure python3])
1590 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001591fi
1592
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001593AC_SUBST(PYTHON3_LIBS)
1594AC_SUBST(PYTHON3_CFLAGS)
1595AC_SUBST(PYTHON3_SRC)
1596AC_SUBST(PYTHON3_OBJ)
1597
1598dnl if python2.x and python3.x are enabled one can only link in code
1599dnl with dlopen(), dlsym(), dlclose()
1600if test "$python_ok" = yes && test "$python3_ok" = yes; then
1601 AC_DEFINE(DYNAMIC_PYTHON)
1602 AC_DEFINE(DYNAMIC_PYTHON3)
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001603 AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001604 cflags_save=$CFLAGS
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001605 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001606 libs_save=$LIBS
Bram Moolenaar6fabcbe2011-09-02 12:27:25 +02001607 dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001608 LIBS="-ldl $LIBS"
Bram Moolenaar7db77842014-03-27 17:40:59 +01001609 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001610 #include <dlfcn.h>
1611 /* If this program fails, then RTLD_GLOBAL is needed.
1612 * RTLD_GLOBAL will be used and then it is not possible to
1613 * have both python versions enabled in the same vim instance.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02001614 * Only the first python version used will be switched on.
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001615 */
1616
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001617 int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001618 {
1619 int needed = 0;
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001620 void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001621 if (pylib != 0)
1622 {
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001623 void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001624 void (*init)(void) = dlsym(pylib, "Py_Initialize");
1625 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1626 void (*final)(void) = dlsym(pylib, "Py_Finalize");
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001627 (*pfx)(prefix);
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001628 (*init)();
1629 needed = (*simple)("import termios") == -1;
1630 (*final)();
1631 dlclose(pylib);
1632 }
1633 return !needed;
1634 }
1635
1636 int main(int argc, char** argv)
1637 {
1638 int not_needed = 0;
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001639 if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}"))
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001640 not_needed = 1;
1641 return !not_needed;
Bram Moolenaar7db77842014-03-27 17:40:59 +01001642 }])],
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001643 [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001644
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001645 CFLAGS=$cflags_save
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001646 LIBS=$libs_save
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001647
1648 AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
1649 cflags_save=$CFLAGS
1650 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001651 libs_save=$LIBS
Bram Moolenaar6fabcbe2011-09-02 12:27:25 +02001652 dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001653 LIBS="-ldl $LIBS"
Bram Moolenaar7db77842014-03-27 17:40:59 +01001654 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001655 #include <dlfcn.h>
1656 #include <wchar.h>
1657 /* If this program fails, then RTLD_GLOBAL is needed.
1658 * RTLD_GLOBAL will be used and then it is not possible to
1659 * have both python versions enabled in the same vim instance.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02001660 * Only the first python version used will be switched on.
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001661 */
1662
1663 int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
1664 {
1665 int needed = 0;
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001666 void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001667 if (pylib != 0)
1668 {
1669 void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
1670 void (*init)(void) = dlsym(pylib, "Py_Initialize");
1671 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1672 void (*final)(void) = dlsym(pylib, "Py_Finalize");
1673 (*pfx)(prefix);
1674 (*init)();
1675 needed = (*simple)("import termios") == -1;
1676 (*final)();
1677 dlclose(pylib);
1678 }
1679 return !needed;
1680 }
1681
1682 int main(int argc, char** argv)
1683 {
1684 int not_needed = 0;
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001685 if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}"))
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001686 not_needed = 1;
1687 return !not_needed;
Bram Moolenaar7db77842014-03-27 17:40:59 +01001688 }])],
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001689 [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1690
1691 CFLAGS=$cflags_save
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001692 LIBS=$libs_save
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001693
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001694 PYTHON_SRC="if_python.c"
1695 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001696 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001697 PYTHON_LIBS=
1698 PYTHON3_SRC="if_python3.c"
1699 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001700 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001701 PYTHON3_LIBS=
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001702elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
1703 AC_DEFINE(DYNAMIC_PYTHON)
1704 PYTHON_SRC="if_python.c"
1705 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001706 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001707 PYTHON_LIBS=
Bram Moolenaare741f272013-07-09 21:57:52 +02001708elif test "$python_ok" = yes; then
1709 dnl Check that adding -fPIE works. It may be needed when using a static
1710 dnl Python library.
1711 AC_MSG_CHECKING([if -fPIE can be added for Python])
1712 cflags_save=$CFLAGS
1713 libs_save=$LIBS
1714 CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
1715 LIBS="$LIBS $PYTHON_LIBS"
1716 AC_TRY_LINK(,[ ],
1717 AC_MSG_RESULT(yes); fpie_ok=yes,
1718 AC_MSG_RESULT(no); fpie_ok=no)
1719 CFLAGS=$cflags_save
1720 LIBS=$libs_save
1721 if test $fpie_ok = yes; then
1722 PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
1723 fi
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001724elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
1725 AC_DEFINE(DYNAMIC_PYTHON3)
1726 PYTHON3_SRC="if_python3.c"
1727 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001728 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001729 PYTHON3_LIBS=
Bram Moolenaare741f272013-07-09 21:57:52 +02001730elif test "$python3_ok" = yes; then
1731 dnl Check that adding -fPIE works. It may be needed when using a static
1732 dnl Python library.
1733 AC_MSG_CHECKING([if -fPIE can be added for Python3])
1734 cflags_save=$CFLAGS
1735 libs_save=$LIBS
1736 CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
1737 LIBS="$LIBS $PYTHON3_LIBS"
1738 AC_TRY_LINK(,[ ],
1739 AC_MSG_RESULT(yes); fpie_ok=yes,
1740 AC_MSG_RESULT(no); fpie_ok=no)
1741 CFLAGS=$cflags_save
1742 LIBS=$libs_save
1743 if test $fpie_ok = yes; then
1744 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
1745 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001746fi
1747
Bram Moolenaar071d4272004-06-13 20:20:40 +00001748AC_MSG_CHECKING(--enable-tclinterp argument)
1749AC_ARG_ENABLE(tclinterp,
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001750 [ --enable-tclinterp[=OPTS] Include Tcl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001751 [enable_tclinterp="no"])
1752AC_MSG_RESULT($enable_tclinterp)
1753
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001754if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001755
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001756 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001757 AC_MSG_CHECKING(--with-tclsh argument)
1758 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
1759 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001760 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001761 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1762 AC_SUBST(vi_cv_path_tcl)
1763
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001764 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1765 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1766 tclsh_name="tclsh8.4"
1767 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1768 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001769 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001770 tclsh_name="tclsh8.2"
1771 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1772 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001773 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1774 tclsh_name="tclsh8.0"
1775 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1776 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001777 dnl still didn't find it, try without version number
1778 if test "X$vi_cv_path_tcl" = "X"; then
1779 tclsh_name="tclsh"
1780 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1781 fi
1782 if test "X$vi_cv_path_tcl" != "X"; then
1783 AC_MSG_CHECKING(Tcl version)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001784 if echo 'exit [[expr [info tclversion] < 8.0]]' | "$vi_cv_path_tcl" - ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001785 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1786 AC_MSG_RESULT($tclver - OK);
1787 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 +01001788 tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001789
1790 AC_MSG_CHECKING(for location of Tcl include)
Bram Moolenaard0573012017-10-28 21:11:06 +02001791 if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001792 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 +00001793 else
1794 dnl For Mac OS X 10.3, use the OS-provided framework location
1795 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
1796 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001797 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001798 for try in $tclinc; do
1799 if test -f "$try/tcl.h"; then
1800 AC_MSG_RESULT($try/tcl.h)
1801 TCL_INC=$try
1802 break
1803 fi
1804 done
1805 if test -z "$TCL_INC"; then
1806 AC_MSG_RESULT(<not found>)
1807 SKIP_TCL=YES
1808 fi
1809 if test -z "$SKIP_TCL"; then
1810 AC_MSG_CHECKING(for location of tclConfig.sh script)
Bram Moolenaard0573012017-10-28 21:11:06 +02001811 if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001812 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001813 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001814 else
1815 dnl For Mac OS X 10.3, use the OS-provided framework location
1816 tclcnf="/System/Library/Frameworks/Tcl.framework"
1817 fi
1818 for try in $tclcnf; do
Bram Moolenaar49222be2015-12-11 18:11:30 +01001819 if test -f "$try/tclConfig.sh"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001820 AC_MSG_RESULT($try/tclConfig.sh)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001821 . "$try/tclConfig.sh"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001822 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001823 if test "$enable_tclinterp" = "dynamic"; then
1824 TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"`
1825 else
1826 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1827 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001828 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001829 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +00001830 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 +00001831 break
1832 fi
1833 done
1834 if test -z "$TCL_LIBS"; then
1835 AC_MSG_RESULT(<not found>)
1836 AC_MSG_CHECKING(for Tcl library by myself)
1837 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001838 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001839 for ext in .so .a ; do
1840 for ver in "" $tclver ; do
1841 for try in $tcllib ; do
1842 trylib=tcl$ver$ext
Bram Moolenaar49222be2015-12-11 18:11:30 +01001843 if test -f "$try/lib$trylib" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001844 AC_MSG_RESULT($try/lib$trylib)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001845 TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001846 if test "`(uname) 2>/dev/null`" = SunOS &&
1847 uname -r | grep '^5' >/dev/null; then
1848 TCL_LIBS="$TCL_LIBS -R $try"
1849 fi
1850 break 3
1851 fi
1852 done
1853 done
1854 done
1855 if test -z "$TCL_LIBS"; then
1856 AC_MSG_RESULT(<not found>)
1857 SKIP_TCL=YES
1858 fi
1859 fi
1860 if test -z "$SKIP_TCL"; then
1861 AC_DEFINE(FEAT_TCL)
1862 TCL_SRC=if_tcl.c
1863 TCL_OBJ=objects/if_tcl.o
1864 TCL_PRO=if_tcl.pro
1865 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1866 fi
1867 fi
1868 else
1869 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
1870 fi
1871 fi
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001872 if test "$enable_tclinterp" = "dynamic"; then
1873 if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then
1874 AC_DEFINE(DYNAMIC_TCL)
1875 TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS"
1876 fi
1877 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001878 if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then
1879 AC_MSG_ERROR([could not configure Tcl])
1880 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001881fi
1882AC_SUBST(TCL_SRC)
1883AC_SUBST(TCL_OBJ)
1884AC_SUBST(TCL_PRO)
1885AC_SUBST(TCL_CFLAGS)
1886AC_SUBST(TCL_LIBS)
1887
1888AC_MSG_CHECKING(--enable-rubyinterp argument)
1889AC_ARG_ENABLE(rubyinterp,
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001890 [ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001891 [enable_rubyinterp="no"])
1892AC_MSG_RESULT($enable_rubyinterp)
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001893if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
Bram Moolenaar0b105412014-11-30 13:34:23 +01001894 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1895 AC_MSG_ERROR([cannot use Ruby with tiny or small features])
1896 fi
1897
Bram Moolenaar165641d2010-02-17 16:23:09 +01001898 AC_MSG_CHECKING(--with-ruby-command argument)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001899 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar948733a2011-05-05 18:10:16 +02001900 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
1901 RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD),
1902 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar165641d2010-02-17 16:23:09 +01001903 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001904 if test "X$vi_cv_path_ruby" != "X"; then
1905 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +00001906 if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001907 AC_MSG_RESULT(OK)
Bram Moolenaar81398892012-10-03 21:09:35 +02001908 AC_MSG_CHECKING(Ruby rbconfig)
1909 ruby_rbconfig="RbConfig"
1910 if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then
1911 ruby_rbconfig="Config"
1912 fi
1913 AC_MSG_RESULT($ruby_rbconfig)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001914 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar81398892012-10-03 21:09:35 +02001915 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 +00001916 if test "X$rubyhdrdir" != "X"; then
1917 AC_MSG_RESULT($rubyhdrdir)
1918 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaara6fd37b2014-03-27 17:19:09 +01001919 rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"`
1920 if test -d "$rubyarchdir"; then
1921 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01001922 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02001923 rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
Bram Moolenaar026a4452013-08-07 15:22:23 +02001924 if test "X$rubyversion" = "X"; then
1925 rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"`
1926 fi
Bram Moolenaar165641d2010-02-17 16:23:09 +01001927 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar81398892012-10-03 21:09:35 +02001928 rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001929 if test "X$rubylibs" != "X"; then
1930 RUBY_LIBS="$rubylibs"
1931 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02001932 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"`
1933 librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"`
Bram Moolenaarac499e32013-06-02 19:14:17 +02001934 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"`
Bram Moolenaar948733a2011-05-05 18:10:16 +02001935 if test -f "$rubylibdir/$librubya"; then
1936 librubyarg="$librubyarg"
Bram Moolenaarac499e32013-06-02 19:14:17 +02001937 RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
1938 elif test "$librubyarg" = "libruby.a"; then
1939 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1940 librubyarg="-lruby"
1941 RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001942 fi
1943
1944 if test "X$librubyarg" != "X"; then
1945 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1946 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02001947 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LDFLAGS']]"`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001948 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001949 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1950 dnl be included if requested by passing --with-mac-arch to
1951 dnl configure, so strip these flags first (if present)
Bram Moolenaar5dff57d2010-07-24 16:19:44 +02001952 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001953 if test "X$rubyldflags" != "X"; then
Bram Moolenaar2bcaec32014-03-27 18:51:11 +01001954 if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$rubyldflags\"`" = "X"; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001955 LDFLAGS="$rubyldflags $LDFLAGS"
1956 fi
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001957 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001958 fi
1959 RUBY_SRC="if_ruby.c"
1960 RUBY_OBJ="objects/if_ruby.o"
1961 RUBY_PRO="if_ruby.pro"
1962 AC_DEFINE(FEAT_RUBY)
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001963 if test "$enable_rubyinterp" = "dynamic"; then
Bram Moolenaar92021622017-10-12 12:33:43 +02001964 libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_ALIASES']].split[[0]]"`
Bram Moolenaar87ea64c2018-08-04 15:13:34 +02001965 if test -z "$libruby_soname"; then
1966 libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
1967 fi
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001968 AC_DEFINE(DYNAMIC_RUBY)
Bram Moolenaar92021622017-10-12 12:33:43 +02001969 RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001970 RUBY_LIBS=
1971 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001972 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001973 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001974 fi
1975 else
1976 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1977 fi
1978 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001979
1980 if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then
1981 AC_MSG_ERROR([could not configure Ruby])
1982 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001983fi
1984AC_SUBST(RUBY_SRC)
1985AC_SUBST(RUBY_OBJ)
1986AC_SUBST(RUBY_PRO)
1987AC_SUBST(RUBY_CFLAGS)
1988AC_SUBST(RUBY_LIBS)
1989
1990AC_MSG_CHECKING(--enable-cscope argument)
1991AC_ARG_ENABLE(cscope,
1992 [ --enable-cscope Include cscope interface.], ,
1993 [enable_cscope="no"])
1994AC_MSG_RESULT($enable_cscope)
1995if test "$enable_cscope" = "yes"; then
1996 AC_DEFINE(FEAT_CSCOPE)
1997fi
1998
1999AC_MSG_CHECKING(--enable-workshop argument)
2000AC_ARG_ENABLE(workshop,
2001 [ --enable-workshop Include Sun Visual Workshop support.], ,
2002 [enable_workshop="no"])
2003AC_MSG_RESULT($enable_workshop)
2004if test "$enable_workshop" = "yes"; then
2005 AC_DEFINE(FEAT_SUN_WORKSHOP)
2006 WORKSHOP_SRC="workshop.c integration.c"
2007 AC_SUBST(WORKSHOP_SRC)
2008 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
2009 AC_SUBST(WORKSHOP_OBJ)
2010 if test "${enable_gui-xxx}" = xxx; then
2011 enable_gui=motif
2012 fi
2013fi
2014
2015AC_MSG_CHECKING(--disable-netbeans argument)
2016AC_ARG_ENABLE(netbeans,
2017 [ --disable-netbeans Disable NetBeans integration support.],
2018 , [enable_netbeans="yes"])
2019if test "$enable_netbeans" = "yes"; then
Bram Moolenaar3c124e32016-01-31 14:36:58 +01002020 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
2021 AC_MSG_RESULT([cannot use NetBeans with tiny or small features])
2022 enable_netbeans="no"
2023 else
2024 AC_MSG_RESULT(no)
2025 fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002026else
2027 AC_MSG_RESULT(yes)
2028fi
2029
2030AC_MSG_CHECKING(--disable-channel argument)
2031AC_ARG_ENABLE(channel,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002032 [ --disable-channel Disable process communication support.],
Bram Moolenaare0874f82016-01-24 20:36:41 +01002033 , [enable_channel="yes"])
2034if test "$enable_channel" = "yes"; then
Bram Moolenaar3c124e32016-01-31 14:36:58 +01002035 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
2036 AC_MSG_RESULT([cannot use channels with tiny or small features])
2037 enable_channel="no"
2038 else
2039 AC_MSG_RESULT(no)
2040 fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002041else
2042 if test "$enable_netbeans" = "yes"; then
Bram Moolenaar16435482016-01-24 21:31:54 +01002043 AC_MSG_RESULT([yes, netbeans also disabled])
Bram Moolenaare0874f82016-01-24 20:36:41 +01002044 enable_netbeans="no"
2045 else
2046 AC_MSG_RESULT(yes)
2047 fi
2048fi
2049
Bram Moolenaar16435482016-01-24 21:31:54 +01002050if test "$enable_channel" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002051 dnl On Solaris we need the socket and nsl library.
2052 AC_CHECK_LIB(socket, socket)
2053 AC_CHECK_LIB(nsl, gethostbyname)
Bram Moolenaare0874f82016-01-24 20:36:41 +01002054 AC_MSG_CHECKING(whether compiling with process communication is possible)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002055 AC_TRY_LINK([
2056#include <stdio.h>
2057#include <stdlib.h>
2058#include <stdarg.h>
2059#include <fcntl.h>
2060#include <netdb.h>
2061#include <netinet/in.h>
2062#include <errno.h>
2063#include <sys/types.h>
2064#include <sys/socket.h>
2065 /* Check bitfields */
2066 struct nbbuf {
2067 unsigned int initDone:1;
Bram Moolenaar63de19e2016-12-09 20:11:26 +01002068 unsigned short signmaplen;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002069 };
2070 ], [
2071 /* Check creating a socket. */
2072 struct sockaddr_in server;
2073 (void)socket(AF_INET, SOCK_STREAM, 0);
2074 (void)htons(100);
2075 (void)gethostbyname("microsoft.com");
2076 if (errno == ECONNREFUSED)
2077 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
2078 ],
2079 AC_MSG_RESULT(yes),
Bram Moolenaare0874f82016-01-24 20:36:41 +01002080 AC_MSG_RESULT(no); enable_netbeans="no"; enable_channel="no")
Bram Moolenaar071d4272004-06-13 20:20:40 +00002081fi
2082if test "$enable_netbeans" = "yes"; then
2083 AC_DEFINE(FEAT_NETBEANS_INTG)
2084 NETBEANS_SRC="netbeans.c"
2085 AC_SUBST(NETBEANS_SRC)
2086 NETBEANS_OBJ="objects/netbeans.o"
2087 AC_SUBST(NETBEANS_OBJ)
2088fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002089if test "$enable_channel" = "yes"; then
Bram Moolenaar509ce2a2016-03-11 22:52:15 +01002090 AC_DEFINE(FEAT_JOB_CHANNEL)
Bram Moolenaare0874f82016-01-24 20:36:41 +01002091 CHANNEL_SRC="channel.c"
2092 AC_SUBST(CHANNEL_SRC)
2093 CHANNEL_OBJ="objects/channel.o"
2094 AC_SUBST(CHANNEL_OBJ)
2095fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002096
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002097AC_MSG_CHECKING(--enable-terminal argument)
2098AC_ARG_ENABLE(terminal,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002099 [ --enable-terminal Enable terminal emulation support.],
Bram Moolenaaref839562017-10-28 20:28:23 +02002100 , [enable_terminal="auto"])
Bram Moolenaar595a4022017-09-03 19:15:57 +02002101if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002102 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
2103 AC_MSG_RESULT([cannot use terminal emulator with tiny or small features])
2104 enable_terminal="no"
2105 else
Bram Moolenaar595a4022017-09-03 19:15:57 +02002106 if test "$enable_terminal" = "auto"; then
2107 enable_terminal="yes"
2108 AC_MSG_RESULT(defaulting to yes)
2109 else
2110 AC_MSG_RESULT(yes)
2111 fi
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002112 fi
2113else
Bram Moolenaar595a4022017-09-03 19:15:57 +02002114 if test "$enable_terminal" = "auto"; then
2115 enable_terminal="no"
2116 AC_MSG_RESULT(defaulting to no)
2117 else
2118 AC_MSG_RESULT(no)
2119 fi
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002120fi
Bram Moolenaar8b423282017-12-16 14:37:06 +01002121if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002122 AC_DEFINE(FEAT_TERMINAL)
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02002123 TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/termscreen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c"
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002124 AC_SUBST(TERM_SRC)
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02002125 TERM_OBJ="objects/encoding.o objects/keyboard.o objects/mouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o"
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002126 AC_SUBST(TERM_OBJ)
2127fi
2128
Bram Moolenaare42a6d22017-11-12 19:21:51 +01002129AC_MSG_CHECKING(--enable-autoservername argument)
2130AC_ARG_ENABLE(autoservername,
2131 [ --enable-autoservername Automatically define servername at vim startup.], ,
2132 [enable_autoservername="no"])
2133AC_MSG_RESULT($enable_autoservername)
2134if test "$enable_autoservername" = "yes"; then
2135 AC_DEFINE(FEAT_AUTOSERVERNAME)
2136fi
2137
Bram Moolenaar071d4272004-06-13 20:20:40 +00002138AC_MSG_CHECKING(--enable-multibyte argument)
2139AC_ARG_ENABLE(multibyte,
2140 [ --enable-multibyte Include multibyte editing support.], ,
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01002141 [enable_multibyte="yes"])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002142AC_MSG_RESULT($enable_multibyte)
2143if test "$enable_multibyte" = "yes"; then
2144 AC_DEFINE(FEAT_MBYTE)
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01002145else
2146 AC_MSG_ERROR([The multi-byte feature can no longer be disabled. If you have
2147 a problem with this, discuss on the Vim mailing list.])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002148fi
2149
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002150dnl Right-to-Left language support for Vim will be included with big features,
2151dnl unless ENABLE_RIGHTLEFT is undefined.
2152AC_MSG_CHECKING(--disable-rightleft argument)
2153AC_ARG_ENABLE(rightleft,
2154 [ --disable-rightleft Do not include Right-to-Left language support.],
2155 , [enable_rightleft="yes"])
2156if test "$enable_rightleft" = "yes"; then
2157 AC_MSG_RESULT(no)
2158else
2159 AC_MSG_RESULT(yes)
2160 AC_DEFINE(DISABLE_RIGHTLEFT)
2161fi
2162
2163dnl Arabic language support for Vim will be included with big features,
2164dnl unless ENABLE_ARABIC is undefined.
2165AC_MSG_CHECKING(--disable-arabic argument)
2166AC_ARG_ENABLE(arabic,
2167 [ --disable-arabic Do not include Arabic language support.],
2168 , [enable_arabic="yes"])
2169if test "$enable_arabic" = "yes"; then
2170 AC_MSG_RESULT(no)
2171else
2172 AC_MSG_RESULT(yes)
2173 AC_DEFINE(DISABLE_ARABIC)
2174fi
2175
2176dnl Farsi language support for vim will be included with big features,
2177dnl unless ENABLE_FARSI is undefined.
2178AC_MSG_CHECKING(--disable-farsi argument)
2179AC_ARG_ENABLE(farsi,
2180 [ --disable-farsi Do not include Farsi language support.],
2181 , [enable_farsi="yes"])
2182if test "$enable_farsi" = "yes"; then
2183 AC_MSG_RESULT(no)
2184else
2185 AC_MSG_RESULT(yes)
2186 AC_DEFINE(DISABLE_FARSI)
2187fi
2188
Bram Moolenaar071d4272004-06-13 20:20:40 +00002189AC_MSG_CHECKING(--enable-hangulinput argument)
2190AC_ARG_ENABLE(hangulinput,
2191 [ --enable-hangulinput Include Hangul input support.], ,
2192 [enable_hangulinput="no"])
2193AC_MSG_RESULT($enable_hangulinput)
2194
2195AC_MSG_CHECKING(--enable-xim argument)
2196AC_ARG_ENABLE(xim,
2197 [ --enable-xim Include XIM input support.],
2198 AC_MSG_RESULT($enable_xim),
2199 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002200
2201AC_MSG_CHECKING(--enable-fontset argument)
2202AC_ARG_ENABLE(fontset,
2203 [ --enable-fontset Include X fontset output support.], ,
2204 [enable_fontset="no"])
2205AC_MSG_RESULT($enable_fontset)
2206dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
2207
2208test -z "$with_x" && with_x=yes
Bram Moolenaard0573012017-10-28 21:11:06 +02002209test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +00002210if test "$with_x" = no; then
2211 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
2212else
2213 dnl Do this check early, so that its failure can override user requests.
2214
2215 AC_PATH_PROG(xmkmfpath, xmkmf)
2216
2217 AC_PATH_XTRA
2218
Bram Moolenaar2c704a72010-06-03 21:17:25 +02002219 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00002220 dnl be compiled with a special option.
2221 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02002222 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002223 CFLAGS="$CFLAGS -W c,dll"
2224 LDFLAGS="$LDFLAGS -W l,dll"
2225 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
2226 fi
2227
2228 dnl On my HPUX system the X include dir is found, but the lib dir not.
2229 dnl This is a desparate try to fix this.
2230
2231 if test -d "$x_includes" && test ! -d "$x_libraries"; then
2232 x_libraries=`echo "$x_includes" | sed s/include/lib/`
2233 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
2234 X_LIBS="$X_LIBS -L$x_libraries"
2235 if test "`(uname) 2>/dev/null`" = SunOS &&
2236 uname -r | grep '^5' >/dev/null; then
2237 X_LIBS="$X_LIBS -R $x_libraries"
2238 fi
2239 fi
2240
2241 if test -d "$x_libraries" && test ! -d "$x_includes"; then
2242 x_includes=`echo "$x_libraries" | sed s/lib/include/`
2243 AC_MSG_RESULT(Corrected X includes to $x_includes)
2244 X_CFLAGS="$X_CFLAGS -I$x_includes"
2245 fi
2246
2247 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
2248 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
2249 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
2250 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
2251 dnl Same for "-R/usr/lib ".
2252 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
2253
2254
2255 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002256 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
2257 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002258 AC_MSG_CHECKING(if X11 header files can be found)
2259 cflags_save=$CFLAGS
2260 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002261 AC_TRY_COMPILE([#include <X11/Xlib.h>
2262#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00002263 AC_MSG_RESULT(yes),
2264 AC_MSG_RESULT(no); no_x=yes)
2265 CFLAGS=$cflags_save
2266
2267 if test "${no_x-no}" = yes; then
2268 with_x=no
2269 else
2270 AC_DEFINE(HAVE_X11)
2271 X_LIB="-lXt -lX11";
2272 AC_SUBST(X_LIB)
2273
2274 ac_save_LDFLAGS="$LDFLAGS"
2275 LDFLAGS="-L$x_libraries $LDFLAGS"
2276
2277 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
2278 dnl For HP-UX 10.20 it must be before -lSM -lICE
2279 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
2280 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
2281
2282 dnl Some systems need -lnsl -lsocket when testing for ICE.
2283 dnl The check above doesn't do this, try here (again). Also needed to get
2284 dnl them after Xdmcp. link.sh will remove them when not needed.
2285 dnl Check for other function than above to avoid the cached value
2286 AC_CHECK_LIB(ICE, IceOpenConnection,
2287 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
2288
2289 dnl Check for -lXpm (needed for some versions of Motif)
2290 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
2291 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
2292 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
2293
2294 dnl Check that the X11 header files don't use implicit declarations
2295 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
2296 cflags_save=$CFLAGS
Bram Moolenaard1864592013-05-04 04:40:15 +02002297 dnl -Werror is GCC only, others like Solaris Studio might not like it
2298 if test "$GCC" = yes; then
2299 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
2300 else
2301 CFLAGS="$CFLAGS $X_CFLAGS"
2302 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002303 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
2304 AC_MSG_RESULT(no),
2305 CFLAGS="$CFLAGS -Wno-implicit-int"
2306 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
2307 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
2308 AC_MSG_RESULT(test failed)
2309 )
2310 )
2311 CFLAGS=$cflags_save
2312
2313 LDFLAGS="$ac_save_LDFLAGS"
2314
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00002315 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
2316 AC_CACHE_VAL(ac_cv_small_wchar_t,
2317 [AC_TRY_RUN([
2318#include <X11/Xlib.h>
2319#if STDC_HEADERS
2320# include <stdlib.h>
2321# include <stddef.h>
2322#endif
2323 main()
2324 {
2325 if (sizeof(wchar_t) <= 2)
2326 exit(1);
2327 exit(0);
2328 }],
2329 ac_cv_small_wchar_t="no",
2330 ac_cv_small_wchar_t="yes",
2331 AC_MSG_ERROR(failed to compile test program))])
2332 AC_MSG_RESULT($ac_cv_small_wchar_t)
2333 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
2334 AC_DEFINE(SMALL_WCHAR_T)
2335 fi
2336
Bram Moolenaar071d4272004-06-13 20:20:40 +00002337 fi
2338fi
2339
Bram Moolenaard2a05492018-07-27 22:35:15 +02002340dnl Check if --with-x was given but it doesn't work.
2341if test "x$with_x" = xno -a "x$with_x_arg" = xyes; then
2342 AC_MSG_ERROR([could not configure X])
2343fi
2344
Bram Moolenaard0573012017-10-28 21:11:06 +02002345test "x$with_x" = xno -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00002346
2347AC_MSG_CHECKING(--enable-gui argument)
2348AC_ARG_ENABLE(gui,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002349 [ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto")
Bram Moolenaar071d4272004-06-13 20:20:40 +00002350
2351dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
2352dnl Do not use character classes for portability with old tools.
2353enable_gui_canon=`echo "_$enable_gui" | \
2354 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2355
2356dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002357SKIP_GTK2=YES
Bram Moolenaar1858a842016-02-23 22:30:31 +01002358SKIP_GTK3=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002359SKIP_GNOME=YES
2360SKIP_MOTIF=YES
2361SKIP_ATHENA=YES
2362SKIP_NEXTAW=YES
2363SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002364SKIP_CARBON=YES
2365GUITYPE=NONE
2366
Bram Moolenaarb11160e2005-01-04 21:31:43 +00002367if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002368 SKIP_PHOTON=
2369 case "$enable_gui_canon" in
2370 no) AC_MSG_RESULT(no GUI support)
2371 SKIP_PHOTON=YES ;;
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002372 yes|""|auto) AC_MSG_RESULT(automatic GUI support)
2373 gui_auto=yes ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002374 photon) AC_MSG_RESULT(Photon GUI support) ;;
2375 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2376 SKIP_PHOTON=YES ;;
2377 esac
2378
Bram Moolenaard0573012017-10-28 21:11:06 +02002379elif test "x$MACOS_X" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002380 SKIP_CARBON=
2381 case "$enable_gui_canon" in
2382 no) AC_MSG_RESULT(no GUI support)
2383 SKIP_CARBON=YES ;;
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002384 yes|"") AC_MSG_RESULT(yes - automatic GUI support)
2385 gui_auto=yes ;;
Bram Moolenaar164fca32010-07-14 13:58:07 +02002386 auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
2387 SKIP_CARBON=YES ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002388 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
2389 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2390 SKIP_CARBON=YES ;;
2391 esac
2392
2393else
2394
Bram Moolenaar071d4272004-06-13 20:20:40 +00002395 case "$enable_gui_canon" in
2396 no|none) AC_MSG_RESULT(no GUI support) ;;
2397 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002398 gui_auto=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +00002399 SKIP_GTK2=
2400 SKIP_GNOME=
2401 SKIP_MOTIF=
2402 SKIP_ATHENA=
2403 SKIP_NEXTAW=
2404 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002405 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002406 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002407 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
2408 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00002409 SKIP_GTK2=;;
Bram Moolenaar98921892016-02-23 17:14:37 +01002410 gtk3) AC_MSG_RESULT(GTK+ 3.x GUI support)
2411 SKIP_GTK3=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002412 motif) AC_MSG_RESULT(Motif GUI support)
2413 SKIP_MOTIF=;;
2414 athena) AC_MSG_RESULT(Athena GUI support)
2415 SKIP_ATHENA=;;
2416 nextaw) AC_MSG_RESULT(neXtaw GUI support)
2417 SKIP_NEXTAW=;;
2418 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
2419 esac
2420
2421fi
2422
Bram Moolenaar071d4272004-06-13 20:20:40 +00002423if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
2424 -a "$enable_gui_canon" != "gnome2"; then
2425 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
2426 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002427 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002428 , enable_gtk2_check="yes")
2429 AC_MSG_RESULT($enable_gtk2_check)
2430 if test "x$enable_gtk2_check" = "xno"; then
2431 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002432 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002433 fi
2434fi
2435
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002436if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002437 AC_MSG_CHECKING(whether or not to look for GNOME)
2438 AC_ARG_ENABLE(gnome-check,
2439 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
2440 , enable_gnome_check="no")
2441 AC_MSG_RESULT($enable_gnome_check)
2442 if test "x$enable_gnome_check" = "xno"; then
2443 SKIP_GNOME=YES
2444 fi
2445fi
2446
Bram Moolenaar98921892016-02-23 17:14:37 +01002447if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then
2448 AC_MSG_CHECKING(whether or not to look for GTK+ 3)
2449 AC_ARG_ENABLE(gtk3-check,
2450 [ --enable-gtk3-check If auto-select GUI, check for GTK+ 3 [default=yes]],
2451 , enable_gtk3_check="yes")
2452 AC_MSG_RESULT($enable_gtk3_check)
2453 if test "x$enable_gtk3_check" = "xno"; then
2454 SKIP_GTK3=YES
2455 fi
2456fi
2457
Bram Moolenaar071d4272004-06-13 20:20:40 +00002458if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
2459 AC_MSG_CHECKING(whether or not to look for Motif)
2460 AC_ARG_ENABLE(motif-check,
2461 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
2462 , enable_motif_check="yes")
2463 AC_MSG_RESULT($enable_motif_check)
2464 if test "x$enable_motif_check" = "xno"; then
2465 SKIP_MOTIF=YES
2466 fi
2467fi
2468
2469if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
2470 AC_MSG_CHECKING(whether or not to look for Athena)
2471 AC_ARG_ENABLE(athena-check,
2472 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
2473 , enable_athena_check="yes")
2474 AC_MSG_RESULT($enable_athena_check)
2475 if test "x$enable_athena_check" = "xno"; then
2476 SKIP_ATHENA=YES
2477 fi
2478fi
2479
2480if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
2481 AC_MSG_CHECKING(whether or not to look for neXtaw)
2482 AC_ARG_ENABLE(nextaw-check,
2483 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
2484 , enable_nextaw_check="yes")
2485 AC_MSG_RESULT($enable_nextaw_check);
2486 if test "x$enable_nextaw_check" = "xno"; then
2487 SKIP_NEXTAW=YES
2488 fi
2489fi
2490
2491if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
2492 AC_MSG_CHECKING(whether or not to look for Carbon)
2493 AC_ARG_ENABLE(carbon-check,
2494 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
2495 , enable_carbon_check="yes")
2496 AC_MSG_RESULT($enable_carbon_check);
2497 if test "x$enable_carbon_check" = "xno"; then
2498 SKIP_CARBON=YES
2499 fi
2500fi
2501
Bram Moolenaar843ee412004-06-30 16:16:41 +00002502
Bram Moolenaard0573012017-10-28 21:11:06 +02002503if test "x$MACOS_X" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002504 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00002505 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00002506 AC_MSG_RESULT(yes);
2507 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00002508 if test "$VIMNAME" = "vim"; then
2509 VIMNAME=Vim
2510 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00002511
Bram Moolenaar164fca32010-07-14 13:58:07 +02002512 if test "x$MACARCH" = "xboth"; then
2513 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
2514 else
2515 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
2516 fi
2517
Bram Moolenaar14716812006-05-04 21:54:08 +00002518 dnl Default install directory is not /usr/local
2519 if test x$prefix = xNONE; then
2520 prefix=/Applications
2521 fi
2522
2523 dnl Sorry for the hard coded default
2524 datadir='${prefix}/Vim.app/Contents/Resources'
2525
Bram Moolenaar071d4272004-06-13 20:20:40 +00002526 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002527 SKIP_GTK2=YES;
2528 SKIP_GNOME=YES;
2529 SKIP_MOTIF=YES;
2530 SKIP_ATHENA=YES;
2531 SKIP_NEXTAW=YES;
2532 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002533 SKIP_CARBON=YES
2534fi
2535
Bram Moolenaar071d4272004-06-13 20:20:40 +00002536dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002537dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002538dnl
2539dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00002540dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00002541dnl
2542AC_DEFUN(AM_PATH_GTK,
2543[
2544 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
2545 {
Bram Moolenaar071d4272004-06-13 20:20:40 +00002546 no_gtk=""
2547 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2548 && $PKG_CONFIG --exists gtk+-2.0; then
2549 {
Bram Moolenaar98921892016-02-23 17:14:37 +01002550 min_gtk_version=ifelse([$1], ,2.2.0,$1)
2551 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002552 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
2553 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
2554 dnl something like that.
2555 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00002556 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00002557 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
2558 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2559 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2560 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2561 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2562 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2563 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2564 }
Bram Moolenaar98921892016-02-23 17:14:37 +01002565 elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2566 && $PKG_CONFIG --exists gtk+-3.0; then
2567 {
2568 min_gtk_version=ifelse([$1], ,3.0.0,$1)
2569 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2570
2571 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0`
2572 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0`
2573 GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0`
2574 gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2575 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2576 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2577 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2578 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2579 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2580 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00002581 else
2582 no_gtk=yes
2583 fi
2584
2585 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
2586 {
2587 ac_save_CFLAGS="$CFLAGS"
2588 ac_save_LIBS="$LIBS"
2589 CFLAGS="$CFLAGS $GTK_CFLAGS"
2590 LIBS="$LIBS $GTK_LIBS"
2591
2592 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002593 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002594 dnl
2595 rm -f conf.gtktest
2596 AC_TRY_RUN([
2597#include <gtk/gtk.h>
2598#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002599#if STDC_HEADERS
2600# include <stdlib.h>
2601# include <stddef.h>
2602#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002603
2604int
2605main ()
2606{
2607int major, minor, micro;
2608char *tmp_version;
2609
2610system ("touch conf.gtktest");
2611
2612/* HP/UX 9 (%@#!) writes to sscanf strings */
2613tmp_version = g_strdup("$min_gtk_version");
2614if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2615 printf("%s, bad version string\n", "$min_gtk_version");
2616 exit(1);
2617 }
2618
2619if ((gtk_major_version > major) ||
2620 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2621 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
2622 (gtk_micro_version >= micro)))
2623{
2624 return 0;
2625}
2626return 1;
2627}
2628],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2629 CFLAGS="$ac_save_CFLAGS"
2630 LIBS="$ac_save_LIBS"
2631 }
2632 fi
2633 if test "x$no_gtk" = x ; then
2634 if test "x$enable_gtktest" = "xyes"; then
2635 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2636 else
2637 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2638 fi
2639 ifelse([$2], , :, [$2])
2640 else
2641 {
2642 AC_MSG_RESULT(no)
2643 GTK_CFLAGS=""
2644 GTK_LIBS=""
2645 ifelse([$3], , :, [$3])
Bram Moolenaaraf0839a2018-12-30 22:55:47 +01002646 if test "$fail_if_missing" = "yes" -a "X$gui_auto" != "Xyes"; then
2647 AC_MSG_ERROR([could not configure GTK])
2648 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002649 }
2650 fi
2651 }
2652 else
2653 GTK_CFLAGS=""
2654 GTK_LIBS=""
2655 ifelse([$3], , :, [$3])
2656 fi
2657 AC_SUBST(GTK_CFLAGS)
2658 AC_SUBST(GTK_LIBS)
2659 rm -f conf.gtktest
2660])
2661
2662dnl ---------------------------------------------------------------------------
2663dnl gnome
2664dnl ---------------------------------------------------------------------------
2665AC_DEFUN([GNOME_INIT_HOOK],
2666[
2667 AC_SUBST(GNOME_LIBS)
2668 AC_SUBST(GNOME_LIBDIR)
2669 AC_SUBST(GNOME_INCLUDEDIR)
2670
2671 AC_ARG_WITH(gnome-includes,
2672 [ --with-gnome-includes=DIR Specify location of GNOME headers],
2673 [CFLAGS="$CFLAGS -I$withval"]
2674 )
2675
2676 AC_ARG_WITH(gnome-libs,
2677 [ --with-gnome-libs=DIR Specify location of GNOME libs],
2678 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
2679 )
2680
2681 AC_ARG_WITH(gnome,
2682 [ --with-gnome Specify prefix for GNOME files],
2683 if test x$withval = xyes; then
2684 want_gnome=yes
2685 ifelse([$1], [], :, [$1])
2686 else
2687 if test "x$withval" = xno; then
2688 want_gnome=no
2689 else
2690 want_gnome=yes
2691 LDFLAGS="$LDFLAGS -L$withval/lib"
2692 CFLAGS="$CFLAGS -I$withval/include"
2693 gnome_prefix=$withval/lib
2694 fi
2695 fi,
2696 want_gnome=yes)
2697
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002698 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002699 {
2700 AC_MSG_CHECKING(for libgnomeui-2.0)
2701 if $PKG_CONFIG --exists libgnomeui-2.0; then
2702 AC_MSG_RESULT(yes)
2703 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
2704 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
2705 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00002706
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002707 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
2708 dnl This might not be the right way but it works for me...
2709 AC_MSG_CHECKING(for FreeBSD)
2710 if test "`(uname) 2>/dev/null`" = FreeBSD; then
2711 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00002712 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002713 GNOME_LIBS="$GNOME_LIBS -pthread"
2714 else
2715 AC_MSG_RESULT(no)
2716 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002717 $1
2718 else
2719 AC_MSG_RESULT(not found)
2720 if test "x$2" = xfail; then
2721 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
2722 fi
2723 fi
2724 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00002725 fi
2726])
2727
2728AC_DEFUN([GNOME_INIT],[
2729 GNOME_INIT_HOOK([],fail)
2730])
2731
2732
2733dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002734dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00002735dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002736if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002737
2738 AC_MSG_CHECKING(--disable-gtktest argument)
2739 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2740 , enable_gtktest=yes)
2741 if test "x$enable_gtktest" = "xyes" ; then
2742 AC_MSG_RESULT(gtk test enabled)
2743 else
2744 AC_MSG_RESULT(gtk test disabled)
2745 fi
2746
Bram Moolenaar071d4272004-06-13 20:20:40 +00002747 if test "X$PKG_CONFIG" = "X"; then
Bram Moolenaard6d30422018-01-28 22:48:55 +01002748 AC_PATH_TOOL(PKG_CONFIG, pkg-config, no)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002749 fi
2750
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002751 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002752 dnl First try finding version 2.2.0 or later. The 2.0.x series has
2753 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002754 AM_PATH_GTK(2.2.0,
2755 [GUI_LIB_LOC="$GTK_LIBDIR"
2756 GTK_LIBNAME="$GTK_LIBS"
2757 GUI_INC_LOC="$GTK_CFLAGS"], )
2758 if test "x$GTK_CFLAGS" != "x"; then
Bram Moolenaar98921892016-02-23 17:14:37 +01002759 SKIP_GTK3=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002760 SKIP_ATHENA=YES
2761 SKIP_NEXTAW=YES
2762 SKIP_MOTIF=YES
2763 GUITYPE=GTK
2764 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002765 fi
2766 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002767 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002768 dnl
2769 dnl if GTK exists, then check for GNOME.
2770 dnl
2771 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002772 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002773 GNOME_INIT_HOOK([have_gnome=yes])
2774 if test "x$have_gnome" = xyes ; then
2775 AC_DEFINE(FEAT_GUI_GNOME)
2776 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
2777 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002778 fi
2779 }
2780 fi
2781 fi
2782fi
2783
Bram Moolenaar98921892016-02-23 17:14:37 +01002784
2785dnl ---------------------------------------------------------------------------
2786dnl Check for GTK3.
2787dnl ---------------------------------------------------------------------------
2788if test -z "$SKIP_GTK3"; then
2789
2790 AC_MSG_CHECKING(--disable-gtktest argument)
2791 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2792 , enable_gtktest=yes)
2793 if test "x$enable_gtktest" = "xyes" ; then
2794 AC_MSG_RESULT(gtk test enabled)
2795 else
2796 AC_MSG_RESULT(gtk test disabled)
2797 fi
2798
2799 if test "X$PKG_CONFIG" = "X"; then
Bram Moolenaard6d30422018-01-28 22:48:55 +01002800 AC_PATH_TOOL(PKG_CONFIG, pkg-config, no)
Bram Moolenaar98921892016-02-23 17:14:37 +01002801 fi
2802
2803 if test "x$PKG_CONFIG" != "xno"; then
2804 AM_PATH_GTK(3.0.0,
2805 [GUI_LIB_LOC="$GTK_LIBDIR"
2806 GTK_LIBNAME="$GTK_LIBS"
2807 GUI_INC_LOC="$GTK_CFLAGS"], )
2808 if test "x$GTK_CFLAGS" != "x"; then
2809 SKIP_GTK2=YES
2810 SKIP_GNOME=YES
2811 SKIP_ATHENA=YES
2812 SKIP_NEXTAW=YES
2813 SKIP_MOTIF=YES
2814 GUITYPE=GTK
2815 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar98921892016-02-23 17:14:37 +01002816 AC_DEFINE(USE_GTK3)
2817 fi
2818 fi
2819fi
2820
Bram Moolenaard2e03f02016-01-02 22:46:36 +01002821dnl Check the version of Gdk-Pixbuf. If the version is 2.31 or later and
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002822dnl glib-compile-resources is found in PATH, use GResource.
2823if test "x$GUITYPE" = "xGTK"; then
2824 AC_MSG_CHECKING([version of Gdk-Pixbuf])
2825 gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0`
2826 if test "x$gdk_pixbuf_version" != x ; then
2827 gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \
2828 sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'`
2829 if test "x$gdk_pixbuf_version_minor" != x -a \
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002830 $gdk_pixbuf_version_minor -ge 31 ; then
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002831 AC_MSG_RESULT([OK.])
2832 AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
2833 AC_MSG_CHECKING([glib-compile-resources])
2834 if test "x$GLIB_COMPILE_RESOURCES" = xno ; then
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002835 GLIB_COMPILE_RESOURCES=""
2836 AC_MSG_RESULT([cannot be found in PATH.])
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002837 else
2838 AC_MSG_RESULT([usable.])
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002839 AC_DEFINE(USE_GRESOURCE)
2840 GRESOURCE_SRC="auto/gui_gtk_gresources.c"
2841 GRESOURCE_OBJ="objects/gui_gtk_gresources.o"
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002842 fi
2843 else
2844 AC_MSG_RESULT([not usable.])
2845 fi
2846 else
2847 AC_MSG_RESULT([cannot obtain from pkg_config.])
2848 fi
Bram Moolenaar4adfaab2016-04-21 18:20:11 +02002849
2850 AC_MSG_CHECKING([--disable-icon-cache-update argument])
2851 AC_ARG_ENABLE(icon_cache_update,
2852 [ --disable-icon-cache-update update disabled],
2853 [],
2854 [enable_icon_cache_update="yes"])
2855 if test "$enable_icon_cache_update" = "yes"; then
2856 AC_MSG_RESULT([not set])
2857 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no)
2858 if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then
2859 AC_MSG_RESULT([not found in PATH.])
2860 fi
2861 else
2862 AC_MSG_RESULT([update disabled])
2863 fi
2864
2865 AC_MSG_CHECKING([--disable-desktop-database-update argument])
2866 AC_ARG_ENABLE(desktop_database_update,
2867 [ --disable-desktop-database-update update disabled],
2868 [],
2869 [enable_desktop_database_update="yes"])
2870 if test "$enable_desktop_database_update" = "yes"; then
2871 AC_MSG_RESULT([not set])
2872 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no)
2873 if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then
2874 AC_MSG_RESULT([not found in PATH.])
2875 fi
2876 else
2877 AC_MSG_RESULT([update disabled])
2878 fi
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002879fi
2880AC_SUBST(GLIB_COMPILE_RESOURCES)
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002881AC_SUBST(GRESOURCE_SRC)
2882AC_SUBST(GRESOURCE_OBJ)
Bram Moolenaar4adfaab2016-04-21 18:20:11 +02002883AC_SUBST(GTK_UPDATE_ICON_CACHE)
2884AC_SUBST(UPDATE_DESKTOP_DATABASE)
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002885
Bram Moolenaar071d4272004-06-13 20:20:40 +00002886dnl Check for Motif include files location.
2887dnl The LAST one found is used, this makes the highest version to be used,
2888dnl e.g. when Motif1.2 and Motif2.0 are both present.
2889
2890if test -z "$SKIP_MOTIF"; then
2891 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"
2892 dnl Remove "-I" from before $GUI_INC_LOC if it's there
2893 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
2894
2895 AC_MSG_CHECKING(for location of Motif GUI includes)
2896 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
2897 GUI_INC_LOC=
2898 for try in $gui_includes; do
2899 if test -f "$try/Xm/Xm.h"; then
2900 GUI_INC_LOC=$try
2901 fi
2902 done
2903 if test -n "$GUI_INC_LOC"; then
2904 if test "$GUI_INC_LOC" = /usr/include; then
2905 GUI_INC_LOC=
2906 AC_MSG_RESULT(in default path)
2907 else
2908 AC_MSG_RESULT($GUI_INC_LOC)
2909 fi
2910 else
2911 AC_MSG_RESULT(<not found>)
2912 SKIP_MOTIF=YES
2913 fi
2914fi
2915
2916dnl Check for Motif library files location. In the same order as the include
2917dnl files, to avoid a mixup if several versions are present
2918
2919if test -z "$SKIP_MOTIF"; then
2920 AC_MSG_CHECKING(--with-motif-lib argument)
2921 AC_ARG_WITH(motif-lib,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002922 [ --with-motif-lib=STRING Library for Motif ],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002923 [ MOTIF_LIBNAME="${withval}" ] )
2924
2925 if test -n "$MOTIF_LIBNAME"; then
2926 AC_MSG_RESULT($MOTIF_LIBNAME)
2927 GUI_LIB_LOC=
2928 else
2929 AC_MSG_RESULT(no)
2930
2931 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
2932 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
2933
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02002934 dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere. The
2935 dnl linker will figure out which one to use, we only check if one exists.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002936 AC_MSG_CHECKING(for location of Motif GUI libs)
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02002937 gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002938 GUI_LIB_LOC=
2939 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00002940 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00002941 if test -f "$libtry"; then
2942 GUI_LIB_LOC=$try
2943 fi
2944 done
2945 done
2946 if test -n "$GUI_LIB_LOC"; then
2947 dnl Remove /usr/lib, it causes trouble on some systems
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02002948 if test "$GUI_LIB_LOC" = /usr/lib \
2949 -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \
2950 -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002951 GUI_LIB_LOC=
2952 AC_MSG_RESULT(in default path)
2953 else
2954 if test -n "$GUI_LIB_LOC"; then
2955 AC_MSG_RESULT($GUI_LIB_LOC)
2956 if test "`(uname) 2>/dev/null`" = SunOS &&
2957 uname -r | grep '^5' >/dev/null; then
2958 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
2959 fi
2960 fi
2961 fi
2962 MOTIF_LIBNAME=-lXm
2963 else
2964 AC_MSG_RESULT(<not found>)
2965 SKIP_MOTIF=YES
2966 fi
2967 fi
2968fi
2969
2970if test -z "$SKIP_MOTIF"; then
2971 SKIP_ATHENA=YES
2972 SKIP_NEXTAW=YES
2973 GUITYPE=MOTIF
2974 AC_SUBST(MOTIF_LIBNAME)
2975fi
2976
2977dnl Check if the Athena files can be found
2978
2979GUI_X_LIBS=
2980
2981if test -z "$SKIP_ATHENA"; then
2982 AC_MSG_CHECKING(if Athena header files can be found)
2983 cflags_save=$CFLAGS
2984 CFLAGS="$CFLAGS $X_CFLAGS"
2985 AC_TRY_COMPILE([
2986#include <X11/Intrinsic.h>
2987#include <X11/Xaw/Paned.h>], ,
2988 AC_MSG_RESULT(yes),
2989 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
2990 CFLAGS=$cflags_save
2991fi
2992
2993if test -z "$SKIP_ATHENA"; then
2994 GUITYPE=ATHENA
2995fi
2996
2997if test -z "$SKIP_NEXTAW"; then
2998 AC_MSG_CHECKING(if neXtaw header files can be found)
2999 cflags_save=$CFLAGS
3000 CFLAGS="$CFLAGS $X_CFLAGS"
3001 AC_TRY_COMPILE([
3002#include <X11/Intrinsic.h>
3003#include <X11/neXtaw/Paned.h>], ,
3004 AC_MSG_RESULT(yes),
3005 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
3006 CFLAGS=$cflags_save
3007fi
3008
3009if test -z "$SKIP_NEXTAW"; then
3010 GUITYPE=NEXTAW
3011fi
3012
3013if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
3014 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
3015 dnl Avoid adding it when it twice
3016 if test -n "$GUI_INC_LOC"; then
3017 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
3018 fi
3019 if test -n "$GUI_LIB_LOC"; then
3020 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
3021 fi
3022
3023 dnl Check for -lXext and then for -lXmu
3024 ldflags_save=$LDFLAGS
3025 LDFLAGS="$X_LIBS $LDFLAGS"
3026 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
3027 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3028 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
3029 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
3030 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3031 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
3032 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3033 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
3034 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3035 if test -z "$SKIP_MOTIF"; then
3036 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
3037 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3038 fi
3039 LDFLAGS=$ldflags_save
3040
3041 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
3042 AC_MSG_CHECKING(for extra X11 defines)
3043 NARROW_PROTO=
3044 rm -fr conftestdir
3045 if mkdir conftestdir; then
3046 cd conftestdir
3047 cat > Imakefile <<'EOF'
3048acfindx:
3049 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
3050EOF
3051 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
3052 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
3053 fi
3054 cd ..
3055 rm -fr conftestdir
3056 fi
3057 if test -z "$NARROW_PROTO"; then
3058 AC_MSG_RESULT(no)
3059 else
3060 AC_MSG_RESULT($NARROW_PROTO)
3061 fi
3062 AC_SUBST(NARROW_PROTO)
3063fi
3064
3065dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
3066dnl use the X11 include path
3067if test "$enable_xsmp" = "yes"; then
3068 cppflags_save=$CPPFLAGS
3069 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3070 AC_CHECK_HEADERS(X11/SM/SMlib.h)
3071 CPPFLAGS=$cppflags_save
3072fi
3073
3074
Bram Moolenaar98921892016-02-23 17:14:37 +01003075if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003076 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
3077 cppflags_save=$CPPFLAGS
3078 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3079 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
3080
3081 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
3082 if test ! "$enable_xim" = "no"; then
3083 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
3084 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
3085 AC_MSG_RESULT(yes),
Bram Moolenaare29b1fe2014-04-10 20:00:15 +02003086 AC_MSG_RESULT(no; xim has been disabled); enable_xim="no")
Bram Moolenaar071d4272004-06-13 20:20:40 +00003087 fi
3088 CPPFLAGS=$cppflags_save
3089
3090 dnl automatically enable XIM when hangul input isn't enabled
3091 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
3092 -a "x$GUITYPE" != "xNONE" ; then
3093 AC_MSG_RESULT(X GUI selected; xim has been enabled)
3094 enable_xim="yes"
3095 fi
3096fi
3097
3098if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
3099 cppflags_save=$CPPFLAGS
3100 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00003101dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
3102 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
3103 AC_TRY_COMPILE([
3104#include <X11/Intrinsic.h>
3105#include <X11/Xmu/Editres.h>],
3106 [int i; i = 0;],
3107 AC_MSG_RESULT(yes)
3108 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
3109 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00003110 CPPFLAGS=$cppflags_save
3111fi
3112
3113dnl Only use the Xm directory when compiling Motif, don't use it for Athena
3114if test -z "$SKIP_MOTIF"; then
3115 cppflags_save=$CPPFLAGS
3116 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar77c19352012-06-13 19:19:41 +02003117 if test "$zOSUnix" = "yes"; then
3118 xmheader="Xm/Xm.h"
3119 else
3120 xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02003121 Xm/UnhighlightT.h Xm/Notebook.h"
Bram Moolenaar77c19352012-06-13 19:19:41 +02003122 fi
3123 AC_CHECK_HEADERS($xmheader)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003124
Bram Moolenaar77c19352012-06-13 19:19:41 +02003125 if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003126 dnl Solaris uses XpmAttributes_21, very annoying.
3127 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
3128 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
3129 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
3130 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
3131 )
3132 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00003133 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003134 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003135 CPPFLAGS=$cppflags_save
3136fi
3137
3138if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
3139 AC_MSG_RESULT(no GUI selected; xim has been disabled)
3140 enable_xim="no"
3141fi
3142if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
3143 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
3144 enable_fontset="no"
3145fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02003146if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003147 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
3148 enable_fontset="no"
3149fi
3150
Bram Moolenaar071d4272004-06-13 20:20:40 +00003151if test -z "$SKIP_PHOTON"; then
3152 GUITYPE=PHOTONGUI
3153fi
3154
3155AC_SUBST(GUI_INC_LOC)
3156AC_SUBST(GUI_LIB_LOC)
3157AC_SUBST(GUITYPE)
3158AC_SUBST(GUI_X_LIBS)
3159
3160if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
3161 AC_MSG_ERROR([cannot use workshop without Motif])
3162fi
3163
3164dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
3165if test "$enable_xim" = "yes"; then
3166 AC_DEFINE(FEAT_XIM)
3167fi
3168if test "$enable_fontset" = "yes"; then
3169 AC_DEFINE(FEAT_XFONTSET)
3170fi
3171
3172
3173dnl ---------------------------------------------------------------------------
3174dnl end of GUI-checking
3175dnl ---------------------------------------------------------------------------
3176
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003177AC_MSG_CHECKING([for /proc link to executable])
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003178if test -L "/proc/self/exe"; then
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003179 dnl Linux
3180 AC_MSG_RESULT([/proc/self/exe])
3181 AC_DEFINE(PROC_EXE_LINK, "/proc/self/exe")
3182elif test -L "/proc/self/path/a.out"; then
3183 dnl Solaris
3184 AC_MSG_RESULT([/proc/self/path/a.out])
3185 AC_DEFINE(PROC_EXE_LINK, "/proc/self/path/a.out")
3186elif test -L "/proc/curproc/file"; then
3187 dnl FreeBSD
3188 AC_MSG_RESULT([/proc/curproc/file])
3189 AC_DEFINE(PROC_EXE_LINK, "/proc/curproc/file")
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003190else
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003191 AC_MSG_RESULT(no)
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003192fi
3193
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003194dnl Check for Cygwin, which needs an extra source file if not using X11
Bram Moolenaar8def26a2015-12-17 15:34:53 +01003195AC_MSG_CHECKING(for CYGWIN or MSYS environment)
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003196case `uname` in
Bram Moolenaar8def26a2015-12-17 15:34:53 +01003197 CYGWIN*|MSYS*) CYGWIN=yes; AC_MSG_RESULT(yes)
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003198 AC_MSG_CHECKING(for CYGWIN clipboard support)
3199 if test "x$with_x" = "xno" ; then
3200 OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o
3201 AC_MSG_RESULT(yes)
3202 AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD)
3203 else
3204 AC_MSG_RESULT(no - using X11)
3205 fi ;;
3206
3207 *) CYGWIN=no; AC_MSG_RESULT(no);;
3208esac
Bram Moolenaar071d4272004-06-13 20:20:40 +00003209
3210dnl Only really enable hangul input when GUI and XFONTSET are available
3211if test "$enable_hangulinput" = "yes"; then
3212 if test "x$GUITYPE" = "xNONE"; then
3213 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
3214 enable_hangulinput=no
3215 else
3216 AC_DEFINE(FEAT_HANGULIN)
3217 HANGULIN_SRC=hangulin.c
3218 AC_SUBST(HANGULIN_SRC)
3219 HANGULIN_OBJ=objects/hangulin.o
3220 AC_SUBST(HANGULIN_OBJ)
3221 fi
3222fi
3223
3224dnl Checks for libraries and include files.
3225
Bram Moolenaar446cb832008-06-24 21:56:24 +00003226AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
3227 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003228 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003229#include "confdefs.h"
3230#include <ctype.h>
3231#if STDC_HEADERS
3232# include <stdlib.h>
3233# include <stddef.h>
3234#endif
3235main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003236 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003237 vim_cv_toupper_broken=yes
3238 ],[
3239 vim_cv_toupper_broken=no
3240 ],[
3241 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
3242 ])])
3243
3244if test "x$vim_cv_toupper_broken" = "xyes" ; then
3245 AC_DEFINE(BROKEN_TOUPPER)
3246fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003247
3248AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003249AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003250 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
3251 AC_MSG_RESULT(no))
3252
Bram Moolenaar0c094b92009-05-14 20:20:33 +00003253AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
3254AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
3255 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
3256 AC_MSG_RESULT(no))
3257
Bram Moolenaar071d4272004-06-13 20:20:40 +00003258dnl Checks for header files.
3259AC_CHECK_HEADER(elf.h, HAS_ELF=1)
3260dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
3261if test "$HAS_ELF" = 1; then
3262 AC_CHECK_LIB(elf, main)
3263fi
3264
3265AC_HEADER_DIRENT
3266
Bram Moolenaar071d4272004-06-13 20:20:40 +00003267dnl If sys/wait.h is not found it might still exist but not be POSIX
3268dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
3269if test $ac_cv_header_sys_wait_h = no; then
3270 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
3271 AC_TRY_COMPILE([#include <sys/wait.h>],
3272 [union wait xx, yy; xx = yy],
3273 AC_MSG_RESULT(yes)
3274 AC_DEFINE(HAVE_SYS_WAIT_H)
3275 AC_DEFINE(HAVE_UNION_WAIT),
3276 AC_MSG_RESULT(no))
3277fi
3278
Bram Moolenaar779a7752016-01-30 23:26:34 +01003279AC_CHECK_HEADERS(stdint.h stdlib.h string.h \
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003280 sys/select.h sys/utsname.h termcap.h fcntl.h \
3281 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
3282 termio.h iconv.h inttypes.h langinfo.h math.h \
3283 unistd.h stropts.h errno.h sys/resource.h \
3284 sys/systeminfo.h locale.h sys/stream.h termios.h \
3285 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
3286 utime.h sys/param.h libintl.h libgen.h \
3287 util/debug.h util/msg18n.h frame.h sys/acl.h \
3288 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003289
Bram Moolenaar00ca2842008-06-26 20:14:00 +00003290dnl sys/ptem.h depends on sys/stream.h on Solaris
3291AC_CHECK_HEADERS(sys/ptem.h, [], [],
3292[#if defined HAVE_SYS_STREAM_H
3293# include <sys/stream.h>
3294#endif])
3295
Bram Moolenaar32f31b12009-05-21 13:20:59 +00003296dnl sys/sysctl.h depends on sys/param.h on OpenBSD
3297AC_CHECK_HEADERS(sys/sysctl.h, [], [],
3298[#if defined HAVE_SYS_PARAM_H
3299# include <sys/param.h>
3300#endif])
3301
Bram Moolenaar00ca2842008-06-26 20:14:00 +00003302
Bram Moolenaardf3267e2005-01-25 22:07:05 +00003303dnl pthread_np.h may exist but can only be used after including pthread.h
3304AC_MSG_CHECKING([for pthread_np.h])
3305AC_TRY_COMPILE([
3306#include <pthread.h>
3307#include <pthread_np.h>],
3308 [int i; i = 0;],
3309 AC_MSG_RESULT(yes)
3310 AC_DEFINE(HAVE_PTHREAD_NP_H),
3311 AC_MSG_RESULT(no))
3312
Bram Moolenaare344bea2005-09-01 20:46:49 +00003313AC_CHECK_HEADERS(strings.h)
Bram Moolenaard0573012017-10-28 21:11:06 +02003314if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +00003315 dnl The strings.h file on OS/X contains a warning and nothing useful.
3316 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3317else
Bram Moolenaar071d4272004-06-13 20:20:40 +00003318
3319dnl Check if strings.h and string.h can both be included when defined.
3320AC_MSG_CHECKING([if strings.h can be included after string.h])
3321cppflags_save=$CPPFLAGS
3322CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3323AC_TRY_COMPILE([
3324#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
3325# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
3326 /* but don't do it on AIX 5.1 (Uribarri) */
3327#endif
3328#ifdef HAVE_XM_XM_H
3329# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
3330#endif
3331#ifdef HAVE_STRING_H
3332# include <string.h>
3333#endif
3334#if defined(HAVE_STRINGS_H)
3335# include <strings.h>
3336#endif
3337 ], [int i; i = 0;],
3338 AC_MSG_RESULT(yes),
3339 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3340 AC_MSG_RESULT(no))
3341CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00003342fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003343
3344dnl Checks for typedefs, structures, and compiler characteristics.
3345AC_PROG_GCC_TRADITIONAL
3346AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00003347AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00003348AC_TYPE_MODE_T
3349AC_TYPE_OFF_T
3350AC_TYPE_PID_T
3351AC_TYPE_SIZE_T
3352AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02003353AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003354
Bram Moolenaar071d4272004-06-13 20:20:40 +00003355AC_HEADER_TIME
3356AC_CHECK_TYPE(ino_t, long)
3357AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02003358AC_C_BIGENDIAN(,,,)
Bram Moolenaar136f29a2016-02-27 20:14:15 +01003359AC_C_INLINE
Bram Moolenaar071d4272004-06-13 20:20:40 +00003360
3361AC_MSG_CHECKING(for rlim_t)
3362if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
3363 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
3364else
3365 AC_EGREP_CPP(dnl
3366changequote(<<,>>)dnl
3367<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
3368changequote([,]),
3369 [
3370#include <sys/types.h>
3371#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003372# include <stdlib.h>
3373# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003374#endif
3375#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00003376# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003377#endif
3378 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
3379 AC_MSG_RESULT($ac_cv_type_rlim_t)
3380fi
3381if test $ac_cv_type_rlim_t = no; then
3382 cat >> confdefs.h <<\EOF
3383#define rlim_t unsigned long
3384EOF
3385fi
3386
3387AC_MSG_CHECKING(for stack_t)
3388if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
3389 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
3390else
3391 AC_EGREP_CPP(stack_t,
3392 [
3393#include <sys/types.h>
3394#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003395# include <stdlib.h>
3396# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003397#endif
3398#include <signal.h>
3399 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
3400 AC_MSG_RESULT($ac_cv_type_stack_t)
3401fi
3402if test $ac_cv_type_stack_t = no; then
3403 cat >> confdefs.h <<\EOF
3404#define stack_t struct sigaltstack
3405EOF
3406fi
3407
3408dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
3409AC_MSG_CHECKING(whether stack_t has an ss_base field)
3410AC_TRY_COMPILE([
3411#include <sys/types.h>
3412#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003413# include <stdlib.h>
3414# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003415#endif
3416#include <signal.h>
3417#include "confdefs.h"
3418 ], [stack_t sigstk; sigstk.ss_base = 0; ],
3419 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
3420 AC_MSG_RESULT(no))
3421
3422olibs="$LIBS"
3423AC_MSG_CHECKING(--with-tlib argument)
3424AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
3425if test -n "$with_tlib"; then
3426 AC_MSG_RESULT($with_tlib)
3427 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003428 AC_MSG_CHECKING(for linking with $with_tlib library)
3429 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
3430 dnl Need to check for tgetent() below.
3431 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003432else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003433 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003434 dnl On HP-UX 10.10 termcap or termlib should be used instead of
3435 dnl curses, because curses is much slower.
Bram Moolenaar4e509b62011-02-09 17:42:57 +01003436 dnl Newer versions of ncurses are preferred over anything, except
Bram Moolenaar8f4ba692011-05-05 17:24:27 +02003437 dnl when tinfo has been split off, it contains all we need.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003438 dnl Older versions of ncurses have bugs, get a new one!
3439 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00003440 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00003441 case "`uname -s 2>/dev/null`" in
Bram Moolenaar4e509b62011-02-09 17:42:57 +01003442 OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";;
3443 *) tlibs="tinfo ncurses termlib termcap curses";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00003444 esac
3445 for libname in $tlibs; do
3446 AC_CHECK_LIB(${libname}, tgetent,,)
3447 if test "x$olibs" != "x$LIBS"; then
3448 dnl It's possible that a library is found but it doesn't work
3449 dnl e.g., shared library that cannot be found
3450 dnl compile and run a test program to be sure
3451 AC_TRY_RUN([
3452#ifdef HAVE_TERMCAP_H
3453# include <termcap.h>
3454#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003455#if STDC_HEADERS
3456# include <stdlib.h>
3457# include <stddef.h>
3458#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003459main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
3460 res="OK", res="FAIL", res="FAIL")
3461 if test "$res" = "OK"; then
3462 break
3463 fi
3464 AC_MSG_RESULT($libname library is not usable)
3465 LIBS="$olibs"
3466 fi
3467 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003468 if test "x$olibs" = "x$LIBS"; then
3469 AC_MSG_RESULT(no terminal library found)
3470 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003471fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003472
3473if test "x$olibs" = "x$LIBS"; then
3474 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00003475 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003476 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
3477 AC_MSG_RESULT(yes),
3478 AC_MSG_ERROR([NOT FOUND!
3479 You need to install a terminal library; for example ncurses.
3480 Or specify the name of the library with --with-tlib.]))
3481fi
3482
Bram Moolenaar446cb832008-06-24 21:56:24 +00003483AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
3484 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003485 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003486#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003487#ifdef HAVE_TERMCAP_H
3488# include <termcap.h>
3489#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003490#ifdef HAVE_STRING_H
3491# include <string.h>
3492#endif
3493#if STDC_HEADERS
3494# include <stdlib.h>
3495# include <stddef.h>
3496#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003497main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00003498{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003499 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003500 vim_cv_terminfo=no
3501 ],[
3502 vim_cv_terminfo=yes
3503 ],[
3504 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
3505 ])
3506 ])
3507
3508if test "x$vim_cv_terminfo" = "xyes" ; then
3509 AC_DEFINE(TERMINFO)
3510fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003511
Bram Moolenaara88254f2017-11-02 23:04:14 +01003512AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgetent],
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003513 [
3514 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003515#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003516#ifdef HAVE_TERMCAP_H
3517# include <termcap.h>
3518#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003519#if STDC_HEADERS
3520# include <stdlib.h>
3521# include <stddef.h>
3522#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003523main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00003524{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003525 ]])],[
Bram Moolenaara88254f2017-11-02 23:04:14 +01003526 vim_cv_tgetent=zero
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003527 ],[
Bram Moolenaara88254f2017-11-02 23:04:14 +01003528 vim_cv_tgetent=non-zero
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003529 ],[
3530 AC_MSG_ERROR(failed to compile test program.)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003531 ])
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003532 ])
3533
Bram Moolenaara88254f2017-11-02 23:04:14 +01003534if test "x$vim_cv_tgetent" = "xzero" ; then
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003535 AC_DEFINE(TGETENT_ZERO_ERR, 0)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003536fi
3537
3538AC_MSG_CHECKING(whether termcap.h contains ospeed)
3539AC_TRY_LINK([
3540#ifdef HAVE_TERMCAP_H
3541# include <termcap.h>
3542#endif
3543 ], [ospeed = 20000],
3544 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
3545 [AC_MSG_RESULT(no)
3546 AC_MSG_CHECKING(whether ospeed can be extern)
3547 AC_TRY_LINK([
3548#ifdef HAVE_TERMCAP_H
3549# include <termcap.h>
3550#endif
3551extern short ospeed;
3552 ], [ospeed = 20000],
3553 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
3554 AC_MSG_RESULT(no))]
3555 )
3556
3557AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
3558AC_TRY_LINK([
3559#ifdef HAVE_TERMCAP_H
3560# include <termcap.h>
3561#endif
3562 ], [if (UP == 0 && BC == 0) PC = 1],
3563 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
3564 [AC_MSG_RESULT(no)
3565 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
3566 AC_TRY_LINK([
3567#ifdef HAVE_TERMCAP_H
3568# include <termcap.h>
3569#endif
3570extern char *UP, *BC, PC;
3571 ], [if (UP == 0 && BC == 0) PC = 1],
3572 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
3573 AC_MSG_RESULT(no))]
3574 )
3575
3576AC_MSG_CHECKING(whether tputs() uses outfuntype)
3577AC_TRY_COMPILE([
3578#ifdef HAVE_TERMCAP_H
3579# include <termcap.h>
3580#endif
3581 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
3582 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
3583 AC_MSG_RESULT(no))
3584
3585dnl On some SCO machines sys/select redefines struct timeval
3586AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
3587AC_TRY_COMPILE([
3588#include <sys/types.h>
3589#include <sys/time.h>
3590#include <sys/select.h>], ,
3591 AC_MSG_RESULT(yes)
3592 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
3593 AC_MSG_RESULT(no))
3594
3595dnl AC_DECL_SYS_SIGLIST
3596
3597dnl Checks for pty.c (copied from screen) ==========================
3598AC_MSG_CHECKING(for /dev/ptc)
3599if test -r /dev/ptc; then
3600 AC_DEFINE(HAVE_DEV_PTC)
3601 AC_MSG_RESULT(yes)
3602else
3603 AC_MSG_RESULT(no)
3604fi
3605
3606AC_MSG_CHECKING(for SVR4 ptys)
3607if test -c /dev/ptmx ; then
3608 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
3609 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
3610 AC_MSG_RESULT(no))
3611else
3612 AC_MSG_RESULT(no)
3613fi
3614
3615AC_MSG_CHECKING(for ptyranges)
3616if test -d /dev/ptym ; then
3617 pdir='/dev/ptym'
3618else
3619 pdir='/dev'
3620fi
3621dnl SCO uses ptyp%d
3622AC_EGREP_CPP(yes,
3623[#ifdef M_UNIX
3624 yes;
3625#endif
3626 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
3627dnl if test -c /dev/ptyp19; then
3628dnl ptys=`echo /dev/ptyp??`
3629dnl else
3630dnl ptys=`echo $pdir/pty??`
3631dnl fi
3632if test "$ptys" != "$pdir/pty??" ; then
3633 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
3634 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
3635 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
3636 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
3637 AC_MSG_RESULT([$p0 / $p1])
3638else
3639 AC_MSG_RESULT([don't know])
3640fi
3641
3642dnl **** pty mode/group handling ****
3643dnl
3644dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00003645rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00003646AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
3647 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003648 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003649#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003650#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00003651#if STDC_HEADERS
3652# include <stdlib.h>
3653# include <stddef.h>
3654#endif
3655#ifdef HAVE_UNISTD_H
3656#include <unistd.h>
3657#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003658#include <sys/stat.h>
3659#include <stdio.h>
3660main()
3661{
3662 struct stat sb;
3663 char *x,*ttyname();
3664 int om, m;
3665 FILE *fp;
3666
3667 if (!(x = ttyname(0))) exit(1);
3668 if (stat(x, &sb)) exit(1);
3669 om = sb.st_mode;
3670 if (om & 002) exit(0);
3671 m = system("mesg y");
3672 if (m == -1 || m == 127) exit(1);
3673 if (stat(x, &sb)) exit(1);
3674 m = sb.st_mode;
3675 if (chmod(x, om)) exit(1);
3676 if (m & 002) exit(0);
3677 if (sb.st_gid == getgid()) exit(1);
3678 if (!(fp=fopen("conftest_grp", "w")))
3679 exit(1);
3680 fprintf(fp, "%d\n", sb.st_gid);
3681 fclose(fp);
3682 exit(0);
3683}
Bram Moolenaar7db77842014-03-27 17:40:59 +01003684 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003685 if test -f conftest_grp; then
3686 vim_cv_tty_group=`cat conftest_grp`
3687 if test "x$vim_cv_tty_mode" = "x" ; then
3688 vim_cv_tty_mode=0620
3689 fi
3690 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
3691 else
3692 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00003693 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00003694 fi
3695 ],[
3696 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00003697 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00003698 ],[
3699 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
3700 ])
3701 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003702rm -f conftest_grp
3703
Bram Moolenaar446cb832008-06-24 21:56:24 +00003704if test "x$vim_cv_tty_group" != "xworld" ; then
3705 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
3706 if test "x$vim_cv_tty_mode" = "x" ; then
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02003707 AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (probably 0620)])
Bram Moolenaar446cb832008-06-24 21:56:24 +00003708 else
3709 AC_DEFINE(PTYMODE, 0620)
3710 fi
3711fi
3712
Bram Moolenaar071d4272004-06-13 20:20:40 +00003713dnl Checks for library functions. ===================================
3714
3715AC_TYPE_SIGNAL
3716
3717dnl find out what to use at the end of a signal function
3718if test $ac_cv_type_signal = void; then
3719 AC_DEFINE(SIGRETURN, [return])
3720else
3721 AC_DEFINE(SIGRETURN, [return 0])
3722fi
3723
3724dnl check if struct sigcontext is defined (used for SGI only)
3725AC_MSG_CHECKING(for struct sigcontext)
3726AC_TRY_COMPILE([
3727#include <signal.h>
3728test_sig()
3729{
3730 struct sigcontext *scont;
3731 scont = (struct sigcontext *)0;
3732 return 1;
3733} ], ,
3734 AC_MSG_RESULT(yes)
3735 AC_DEFINE(HAVE_SIGCONTEXT),
3736 AC_MSG_RESULT(no))
3737
3738dnl tricky stuff: try to find out if getcwd() is implemented with
3739dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00003740AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
3741 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003742 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003743#include "confdefs.h"
3744#ifdef HAVE_UNISTD_H
3745#include <unistd.h>
3746#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003747char *dagger[] = { "IFS=pwd", 0 };
3748main()
3749{
3750 char buffer[500];
3751 extern char **environ;
3752 environ = dagger;
3753 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00003754}
Bram Moolenaar7db77842014-03-27 17:40:59 +01003755 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003756 vim_cv_getcwd_broken=no
3757 ],[
3758 vim_cv_getcwd_broken=yes
3759 ],[
3760 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
3761 ])
3762 ])
3763
3764if test "x$vim_cv_getcwd_broken" = "xyes" ; then
3765 AC_DEFINE(BAD_GETCWD)
3766fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003767
Bram Moolenaar25153e12010-02-24 14:47:08 +01003768dnl Check for functions in one big call, to reduce the size of configure.
3769dnl Can only be used for functions that do not require any include.
Bram Moolenaarcd142e32017-11-16 17:03:45 +01003770AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \
Bram Moolenaarb129a442016-12-01 17:25:20 +01003771 getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat \
Bram Moolenaareaf03392009-11-17 11:08:52 +00003772 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar2fcf6682017-03-11 20:03:42 +01003773 getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaarbb09ceb2016-10-18 16:27:23 +02003774 sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00003775 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
Bram Moolenaar137374f2018-05-13 15:59:50 +02003776 usleep utime utimes mblen ftruncate unsetenv)
Bram Moolenaar643b6142018-09-12 20:29:09 +02003777AC_FUNC_SELECT_ARGTYPES
Bram Moolenaar25153e12010-02-24 14:47:08 +01003778AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00003779
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02003780dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
3781dnl appropriate, so that off_t is 64 bits when needed.
3782AC_SYS_LARGEFILE
3783
Bram Moolenaar071d4272004-06-13 20:20:40 +00003784dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
3785AC_MSG_CHECKING(for st_blksize)
3786AC_TRY_COMPILE(
3787[#include <sys/types.h>
3788#include <sys/stat.h>],
3789[ struct stat st;
3790 int n;
3791
3792 stat("/", &st);
3793 n = (int)st.st_blksize;],
3794 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
3795 AC_MSG_RESULT(no))
3796
Bram Moolenaar446cb832008-06-24 21:56:24 +00003797AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
3798 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003799 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003800#include "confdefs.h"
3801#if STDC_HEADERS
3802# include <stdlib.h>
3803# include <stddef.h>
3804#endif
3805#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003806#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00003807main() {struct stat st; exit(stat("configure/", &st) != 0); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003808 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003809 vim_cv_stat_ignores_slash=yes
3810 ],[
3811 vim_cv_stat_ignores_slash=no
3812 ],[
3813 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
3814 ])
3815 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003816
Bram Moolenaar446cb832008-06-24 21:56:24 +00003817if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
3818 AC_DEFINE(STAT_IGNORES_SLASH)
3819fi
3820
Bram Moolenaar071d4272004-06-13 20:20:40 +00003821dnl Link with iconv for charset translation, if not found without library.
3822dnl check for iconv() requires including iconv.h
3823dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
3824dnl has been installed.
3825AC_MSG_CHECKING(for iconv_open())
3826save_LIBS="$LIBS"
3827LIBS="$LIBS -liconv"
3828AC_TRY_LINK([
3829#ifdef HAVE_ICONV_H
3830# include <iconv.h>
3831#endif
3832 ], [iconv_open("fr", "to");],
3833 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
3834 LIBS="$save_LIBS"
3835 AC_TRY_LINK([
3836#ifdef HAVE_ICONV_H
3837# include <iconv.h>
3838#endif
3839 ], [iconv_open("fr", "to");],
3840 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
3841 AC_MSG_RESULT(no)))
3842
3843
3844AC_MSG_CHECKING(for nl_langinfo(CODESET))
3845AC_TRY_LINK([
3846#ifdef HAVE_LANGINFO_H
3847# include <langinfo.h>
3848#endif
3849], [char *cs = nl_langinfo(CODESET);],
3850 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
3851 AC_MSG_RESULT(no))
3852
Bram Moolenaar446cb832008-06-24 21:56:24 +00003853dnl Need various functions for floating point support. Only enable
3854dnl floating point when they are all present.
3855AC_CHECK_LIB(m, strtod)
3856AC_MSG_CHECKING([for strtod() and other floating point functions])
3857AC_TRY_LINK([
3858#ifdef HAVE_MATH_H
3859# include <math.h>
3860#endif
3861#if STDC_HEADERS
3862# include <stdlib.h>
3863# include <stddef.h>
3864#endif
3865], [char *s; double d;
3866 d = strtod("1.1", &s);
3867 d = fabs(1.11);
3868 d = ceil(1.11);
3869 d = floor(1.11);
3870 d = log10(1.11);
3871 d = pow(1.11, 2.22);
3872 d = sqrt(1.11);
3873 d = sin(1.11);
3874 d = cos(1.11);
3875 d = atan(1.11);
3876 ],
3877 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
3878 AC_MSG_RESULT(no))
3879
Bram Moolenaara6b89762016-02-29 21:38:26 +01003880dnl isinf() and isnan() need to include header files and may need -lm.
3881AC_MSG_CHECKING([for isinf()])
3882AC_TRY_LINK([
3883#ifdef HAVE_MATH_H
3884# include <math.h>
3885#endif
3886#if STDC_HEADERS
3887# include <stdlib.h>
3888# include <stddef.h>
3889#endif
3890], [int r = isinf(1.11); ],
3891 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISINF),
3892 AC_MSG_RESULT(no))
3893
3894AC_MSG_CHECKING([for isnan()])
3895AC_TRY_LINK([
3896#ifdef HAVE_MATH_H
3897# include <math.h>
3898#endif
3899#if STDC_HEADERS
3900# include <stdlib.h>
3901# include <stddef.h>
3902#endif
3903], [int r = isnan(1.11); ],
3904 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISNAN),
3905 AC_MSG_RESULT(no))
3906
Bram Moolenaar071d4272004-06-13 20:20:40 +00003907dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
3908dnl when -lacl works, also try to use -lattr (required for Debian).
Bram Moolenaar8d462f92012-02-05 22:51:33 +01003909dnl On Solaris, use the acl_get/set functions in libsec, if present.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003910AC_MSG_CHECKING(--disable-acl argument)
3911AC_ARG_ENABLE(acl,
Bram Moolenaard6d30422018-01-28 22:48:55 +01003912 [ --disable-acl No check for ACL support.],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003913 , [enable_acl="yes"])
3914if test "$enable_acl" = "yes"; then
Bram Moolenaard6d30422018-01-28 22:48:55 +01003915 AC_MSG_RESULT(no)
3916 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003917 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
3918 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
3919
Bram Moolenaard6d30422018-01-28 22:48:55 +01003920 AC_MSG_CHECKING(for POSIX ACL support)
3921 AC_TRY_LINK([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003922#include <sys/types.h>
3923#ifdef HAVE_SYS_ACL_H
3924# include <sys/acl.h>
3925#endif
3926acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
3927 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
3928 acl_free(acl);],
3929 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
3930 AC_MSG_RESULT(no))
3931
Bram Moolenaard6d30422018-01-28 22:48:55 +01003932 AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)],
3933 AC_MSG_CHECKING(for Solaris ACL support)
3934 AC_TRY_LINK([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003935#ifdef HAVE_SYS_ACL_H
3936# include <sys/acl.h>
3937#endif], [acl("foo", GETACLCNT, 0, NULL);
3938 ],
3939 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
Bram Moolenaar8d462f92012-02-05 22:51:33 +01003940 AC_MSG_RESULT(no)))
Bram Moolenaar071d4272004-06-13 20:20:40 +00003941
Bram Moolenaard6d30422018-01-28 22:48:55 +01003942 AC_MSG_CHECKING(for AIX ACL support)
3943 AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00003944#if STDC_HEADERS
3945# include <stdlib.h>
3946# include <stddef.h>
3947#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003948#ifdef HAVE_SYS_ACL_H
3949# include <sys/acl.h>
3950#endif
3951#ifdef HAVE_SYS_ACCESS_H
3952# include <sys/access.h>
3953#endif
3954#define _ALL_SOURCE
3955
3956#include <sys/stat.h>
3957
3958int aclsize;
3959struct acl *aclent;], [aclsize = sizeof(struct acl);
3960 aclent = (void *)malloc(aclsize);
3961 statacl("foo", STX_NORMAL, aclent, aclsize);
3962 ],
3963 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
3964 AC_MSG_RESULT(no))
3965else
3966 AC_MSG_RESULT(yes)
3967fi
3968
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02003969if test "x$GTK_CFLAGS" != "x"; then
3970 dnl pango_shape_full() is new, fall back to pango_shape().
3971 AC_MSG_CHECKING(for pango_shape_full)
3972 ac_save_CFLAGS="$CFLAGS"
3973 ac_save_LIBS="$LIBS"
3974 CFLAGS="$CFLAGS $GTK_CFLAGS"
3975 LIBS="$LIBS $GTK_LIBS"
Bram Moolenaar5325b9b2015-09-09 20:27:02 +02003976 AC_TRY_LINK(
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02003977 [#include <gtk/gtk.h>],
3978 [ pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); ],
3979 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PANGO_SHAPE_FULL),
3980 AC_MSG_RESULT(no))
3981 CFLAGS="$ac_save_CFLAGS"
3982 LIBS="$ac_save_LIBS"
3983fi
3984
Bram Moolenaar071d4272004-06-13 20:20:40 +00003985AC_MSG_CHECKING(--disable-gpm argument)
3986AC_ARG_ENABLE(gpm,
3987 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
3988 [enable_gpm="yes"])
3989
3990if test "$enable_gpm" = "yes"; then
3991 AC_MSG_RESULT(no)
3992 dnl Checking if gpm support can be compiled
3993 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
3994 [olibs="$LIBS" ; LIBS="-lgpm"]
3995 AC_TRY_LINK(
3996 [#include <gpm.h>
3997 #include <linux/keyboard.h>],
3998 [Gpm_GetLibVersion(NULL);],
3999 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
4000 dnl FEAT_MOUSE_GPM if mouse support is included
4001 [vi_cv_have_gpm=yes],
4002 [vi_cv_have_gpm=no])
4003 [LIBS="$olibs"]
4004 )
4005 if test $vi_cv_have_gpm = yes; then
4006 LIBS="$LIBS -lgpm"
4007 AC_DEFINE(HAVE_GPM)
4008 fi
4009else
4010 AC_MSG_RESULT(yes)
4011fi
4012
Bram Moolenaar446cb832008-06-24 21:56:24 +00004013AC_MSG_CHECKING(--disable-sysmouse argument)
4014AC_ARG_ENABLE(sysmouse,
Bram Moolenaar8008b632017-07-18 21:33:20 +02004015 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
Bram Moolenaar446cb832008-06-24 21:56:24 +00004016 [enable_sysmouse="yes"])
4017
4018if test "$enable_sysmouse" = "yes"; then
4019 AC_MSG_RESULT(no)
4020 dnl Checking if sysmouse support can be compiled
4021 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
4022 dnl defines FEAT_SYSMOUSE if mouse support is included
4023 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
4024 AC_TRY_LINK(
4025 [#include <sys/consio.h>
4026 #include <signal.h>
4027 #include <sys/fbio.h>],
4028 [struct mouse_info mouse;
4029 mouse.operation = MOUSE_MODE;
4030 mouse.operation = MOUSE_SHOW;
4031 mouse.u.mode.mode = 0;
4032 mouse.u.mode.signal = SIGUSR2;],
4033 [vi_cv_have_sysmouse=yes],
4034 [vi_cv_have_sysmouse=no])
4035 )
4036 if test $vi_cv_have_sysmouse = yes; then
4037 AC_DEFINE(HAVE_SYSMOUSE)
4038 fi
4039else
4040 AC_MSG_RESULT(yes)
4041fi
4042
Bram Moolenaarf05da212009-11-17 16:13:15 +00004043dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
4044AC_MSG_CHECKING(for FD_CLOEXEC)
4045AC_TRY_COMPILE(
4046[#if HAVE_FCNTL_H
4047# include <fcntl.h>
4048#endif],
4049[ int flag = FD_CLOEXEC;],
4050 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
4051 AC_MSG_RESULT(not usable))
4052
Bram Moolenaar071d4272004-06-13 20:20:40 +00004053dnl rename needs to be checked separately to work on Nextstep with cc
4054AC_MSG_CHECKING(for rename)
4055AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
4056 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
4057 AC_MSG_RESULT(no))
4058
4059dnl sysctl() may exist but not the arguments we use
4060AC_MSG_CHECKING(for sysctl)
4061AC_TRY_COMPILE(
4062[#include <sys/types.h>
4063#include <sys/sysctl.h>],
4064[ int mib[2], r;
4065 size_t len;
4066
4067 mib[0] = CTL_HW;
4068 mib[1] = HW_USERMEM;
4069 len = sizeof(r);
4070 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
4071 ],
4072 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
4073 AC_MSG_RESULT(not usable))
4074
4075dnl sysinfo() may exist but not be Linux compatible
4076AC_MSG_CHECKING(for sysinfo)
4077AC_TRY_COMPILE(
4078[#include <sys/types.h>
4079#include <sys/sysinfo.h>],
4080[ struct sysinfo sinfo;
4081 int t;
4082
4083 (void)sysinfo(&sinfo);
4084 t = sinfo.totalram;
4085 ],
4086 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
4087 AC_MSG_RESULT(not usable))
4088
Bram Moolenaar914572a2007-05-01 11:37:47 +00004089dnl struct sysinfo may have the mem_unit field or not
4090AC_MSG_CHECKING(for sysinfo.mem_unit)
4091AC_TRY_COMPILE(
4092[#include <sys/types.h>
4093#include <sys/sysinfo.h>],
4094[ struct sysinfo sinfo;
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02004095 sinfo.mem_unit = 1;
Bram Moolenaar914572a2007-05-01 11:37:47 +00004096 ],
4097 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
4098 AC_MSG_RESULT(no))
4099
Bram Moolenaar071d4272004-06-13 20:20:40 +00004100dnl sysconf() may exist but not support what we want to use
4101AC_MSG_CHECKING(for sysconf)
4102AC_TRY_COMPILE(
4103[#include <unistd.h>],
4104[ (void)sysconf(_SC_PAGESIZE);
4105 (void)sysconf(_SC_PHYS_PAGES);
4106 ],
4107 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
4108 AC_MSG_RESULT(not usable))
4109
Bram Moolenaar914703b2010-05-31 21:59:46 +02004110AC_CHECK_SIZEOF([int])
4111AC_CHECK_SIZEOF([long])
4112AC_CHECK_SIZEOF([time_t])
4113AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02004114
Bram Moolenaara2aa31a2014-02-23 22:52:40 +01004115dnl Use different names to avoid clashing with other header files.
4116AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int])
4117AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long])
4118
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004119dnl Make sure that uint32_t is really 32 bits unsigned.
4120AC_MSG_CHECKING([uint32_t is 32 bits])
4121AC_TRY_RUN([
4122#ifdef HAVE_STDINT_H
4123# include <stdint.h>
4124#endif
4125#ifdef HAVE_INTTYPES_H
4126# include <inttypes.h>
4127#endif
4128main() {
4129 uint32_t nr1 = (uint32_t)-1;
4130 uint32_t nr2 = (uint32_t)0xffffffffUL;
4131 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
4132 exit(0);
4133}],
4134AC_MSG_RESULT(ok),
4135AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
Bram Moolenaar323cb952011-12-14 19:22:34 +01004136AC_MSG_WARN([cannot check uint32_t when cross-compiling.]))
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004137
Bram Moolenaar446cb832008-06-24 21:56:24 +00004138dnl Check for memmove() before bcopy(), makes memmove() be used when both are
4139dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
4140
Bram Moolenaar071d4272004-06-13 20:20:40 +00004141[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00004142#include "confdefs.h"
4143#ifdef HAVE_STRING_H
4144# include <string.h>
4145#endif
4146#if STDC_HEADERS
4147# include <stdlib.h>
4148# include <stddef.h>
4149#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00004150main() {
4151 char buf[10];
4152 strcpy(buf, "abcdefghi");
4153 mch_memmove(buf, buf + 2, 3);
4154 if (strncmp(buf, "ababcf", 6))
4155 exit(1);
4156 strcpy(buf, "abcdefghi");
4157 mch_memmove(buf + 2, buf, 3);
4158 if (strncmp(buf, "cdedef", 6))
4159 exit(1);
4160 exit(0); /* libc version works properly. */
4161}']
4162
Bram Moolenaar446cb832008-06-24 21:56:24 +00004163AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
4164 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004165 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 +00004166 [
4167 vim_cv_memmove_handles_overlap=yes
4168 ],[
4169 vim_cv_memmove_handles_overlap=no
4170 ],[
4171 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
4172 ])
4173 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00004174
Bram Moolenaar446cb832008-06-24 21:56:24 +00004175if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
4176 AC_DEFINE(USEMEMMOVE)
4177else
4178 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
4179 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004180 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 +00004181 [
4182 vim_cv_bcopy_handles_overlap=yes
4183 ],[
4184 vim_cv_bcopy_handles_overlap=no
4185 ],[
4186 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
4187 ])
4188 ])
4189
4190 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
4191 AC_DEFINE(USEBCOPY)
4192 else
4193 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
4194 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004195 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 +00004196 [
4197 vim_cv_memcpy_handles_overlap=yes
4198 ],[
4199 vim_cv_memcpy_handles_overlap=no
4200 ],[
4201 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
4202 ])
4203 ])
4204
4205 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
4206 AC_DEFINE(USEMEMCPY)
4207 fi
4208 fi
4209fi
4210
Bram Moolenaar071d4272004-06-13 20:20:40 +00004211
4212dnl Check for multibyte locale functions
4213dnl Find out if _Xsetlocale() is supported by libX11.
4214dnl Check if X_LOCALE should be defined.
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004215if test "x$with_x" = "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004216 cflags_save=$CFLAGS
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004217 libs_save=$LIBS
4218 LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS"
4219 CFLAGS="$CFLAGS $X_CFLAGS"
4220
4221 AC_MSG_CHECKING(whether X_LOCALE needed)
4222 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
4223 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
4224 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
4225 AC_MSG_RESULT(no))
4226
4227 AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used)
4228 AC_TRY_LINK_FUNC([Xutf8SetWMProperties], [AC_MSG_RESULT(yes)
4229 AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no))
4230
Bram Moolenaar071d4272004-06-13 20:20:40 +00004231 CFLAGS=$cflags_save
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004232 LIBS=$libs_save
Bram Moolenaar071d4272004-06-13 20:20:40 +00004233fi
4234
4235dnl Link with xpg4, it is said to make Korean locale working
4236AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
4237
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00004238dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar8f4ba692011-05-05 17:24:27 +02004239dnl Use --version to detect Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00004240dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004241dnl -t for typedefs (many ctags have this)
4242dnl -s for static functions (Elvis ctags only?)
4243dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
4244dnl -i+m to test for older Exuberant ctags
4245AC_MSG_CHECKING(how to create tags)
4246test -f tags && mv tags tags.save
Bram Moolenaar5897e0c2011-05-10 15:42:03 +02004247if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00004248 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar5897e0c2011-05-10 15:42:03 +02004249elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
4250 TAGPRG="exctags -I INIT+ --fields=+S"
4251elif (eval exuberant-ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
4252 TAGPRG="exuberant-ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004253else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00004254 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004255 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
4256 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
4257 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
4258 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
4259 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
4260 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
4261 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
4262fi
4263test -f tags.save && mv tags.save tags
4264AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
4265
4266dnl Check how we can run man with a section number
4267AC_MSG_CHECKING(how to run man with a section nr)
4268MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00004269(eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004270AC_MSG_RESULT($MANDEF)
4271if test "$MANDEF" = "man -s"; then
4272 AC_DEFINE(USEMAN_S)
4273fi
4274
4275dnl Check if gettext() is working and if it needs -lintl
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004276dnl We take care to base this on an empty LIBS: on some systems libelf would be
4277dnl in LIBS and implicitly take along libintl. The final LIBS would then not
4278dnl contain libintl, and the link step would fail due to -Wl,--as-needed.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004279AC_MSG_CHECKING(--disable-nls argument)
4280AC_ARG_ENABLE(nls,
4281 [ --disable-nls Don't support NLS (gettext()).], ,
4282 [enable_nls="yes"])
4283
4284if test "$enable_nls" = "yes"; then
4285 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00004286
4287 INSTALL_LANGS=install-languages
4288 AC_SUBST(INSTALL_LANGS)
4289 INSTALL_TOOL_LANGS=install-tool-languages
4290 AC_SUBST(INSTALL_TOOL_LANGS)
4291
Bram Moolenaar071d4272004-06-13 20:20:40 +00004292 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
4293 AC_MSG_CHECKING([for NLS])
4294 if test -f po/Makefile; then
4295 have_gettext="no"
4296 if test -n "$MSGFMT"; then
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004297 olibs=$LIBS
4298 LIBS=""
Bram Moolenaar071d4272004-06-13 20:20:40 +00004299 AC_TRY_LINK(
4300 [#include <libintl.h>],
4301 [gettext("Test");],
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004302 AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs,
4303 LIBS="-lintl"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004304 AC_TRY_LINK(
4305 [#include <libintl.h>],
4306 [gettext("Test");],
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004307 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes";
4308 LIBS="$olibs -lintl",
Bram Moolenaar071d4272004-06-13 20:20:40 +00004309 AC_MSG_RESULT([gettext() doesn't work]);
4310 LIBS=$olibs))
4311 else
4312 AC_MSG_RESULT([msgfmt not found - disabled]);
4313 fi
Bram Moolenaar278eb582014-07-30 13:22:52 +02004314 if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004315 AC_DEFINE(HAVE_GETTEXT)
4316 MAKEMO=yes
4317 AC_SUBST(MAKEMO)
4318 dnl this was added in GNU gettext 0.10.36
4319 AC_CHECK_FUNCS(bind_textdomain_codeset)
4320 dnl _nl_msg_cat_cntr is required for GNU gettext
4321 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
4322 AC_TRY_LINK(
4323 [#include <libintl.h>
4324 extern int _nl_msg_cat_cntr;],
4325 [++_nl_msg_cat_cntr;],
4326 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
4327 AC_MSG_RESULT([no]))
4328 fi
4329 else
4330 AC_MSG_RESULT([no "po/Makefile" - disabled]);
4331 fi
4332else
4333 AC_MSG_RESULT(yes)
4334fi
4335
4336dnl Check for dynamic linking loader
4337AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
4338if test x${DLL} = xdlfcn.h; then
4339 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
4340 AC_MSG_CHECKING([for dlopen()])
4341 AC_TRY_LINK(,[
4342 extern void* dlopen();
4343 dlopen();
4344 ],
4345 AC_MSG_RESULT(yes);
4346 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4347 AC_MSG_RESULT(no);
4348 AC_MSG_CHECKING([for dlopen() in -ldl])
4349 olibs=$LIBS
4350 LIBS="$LIBS -ldl"
4351 AC_TRY_LINK(,[
4352 extern void* dlopen();
4353 dlopen();
4354 ],
4355 AC_MSG_RESULT(yes);
4356 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4357 AC_MSG_RESULT(no);
4358 LIBS=$olibs))
4359 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
4360 dnl ick :-)
4361 AC_MSG_CHECKING([for dlsym()])
4362 AC_TRY_LINK(,[
4363 extern void* dlsym();
4364 dlsym();
4365 ],
4366 AC_MSG_RESULT(yes);
4367 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4368 AC_MSG_RESULT(no);
4369 AC_MSG_CHECKING([for dlsym() in -ldl])
4370 olibs=$LIBS
4371 LIBS="$LIBS -ldl"
4372 AC_TRY_LINK(,[
4373 extern void* dlsym();
4374 dlsym();
4375 ],
4376 AC_MSG_RESULT(yes);
4377 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4378 AC_MSG_RESULT(no);
4379 LIBS=$olibs))
4380elif test x${DLL} = xdl.h; then
4381 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
4382 AC_MSG_CHECKING([for shl_load()])
4383 AC_TRY_LINK(,[
4384 extern void* shl_load();
4385 shl_load();
4386 ],
4387 AC_MSG_RESULT(yes);
4388 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4389 AC_MSG_RESULT(no);
4390 AC_MSG_CHECKING([for shl_load() in -ldld])
4391 olibs=$LIBS
4392 LIBS="$LIBS -ldld"
4393 AC_TRY_LINK(,[
4394 extern void* shl_load();
4395 shl_load();
4396 ],
4397 AC_MSG_RESULT(yes);
4398 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4399 AC_MSG_RESULT(no);
4400 LIBS=$olibs))
4401fi
4402AC_CHECK_HEADERS(setjmp.h)
4403
Bram Moolenaard0573012017-10-28 21:11:06 +02004404if test "x$MACOS_X" = "xyes" -a -n "$PERL"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004405 dnl -ldl must come after DynaLoader.a
4406 if echo $LIBS | grep -e '-ldl' >/dev/null; then
4407 LIBS=`echo $LIBS | sed s/-ldl//`
4408 PERL_LIBS="$PERL_LIBS -ldl"
4409 fi
4410fi
4411
Bram Moolenaard0573012017-10-28 21:11:06 +02004412if test "$MACOS_X" = "yes"; then
4413 AC_MSG_CHECKING([whether we need macOS frameworks])
4414 if test "$GUITYPE" = "CARBONGUI"; then
4415 AC_MSG_RESULT([yes, we need Carbon])
4416 LIBS="$LIBS -framework Carbon"
4417 elif test "$MACOS_X_DARWIN" = "yes"; then
4418 if test "$features" = "tiny"; then
4419 dnl Since no FEAT_CLIPBOARD, no longer need for os_macosx.m.
4420 OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'`
4421 OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'`
Bram Moolenaar2be7cb72019-01-12 16:10:51 +01004422 AC_MSG_RESULT([yes, we need CoreServices])
4423 LIBS="$LIBS -framework CoreServices"
Bram Moolenaard0573012017-10-28 21:11:06 +02004424 else
4425 AC_MSG_RESULT([yes, we need AppKit])
4426 LIBS="$LIBS -framework AppKit"
Bram Moolenaard0573012017-10-28 21:11:06 +02004427 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004428 else
Bram Moolenaard0573012017-10-28 21:11:06 +02004429 AC_MSG_RESULT([no])
Bram Moolenaar3437b912013-07-03 19:52:53 +02004430 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004431fi
Bram Moolenaar164fca32010-07-14 13:58:07 +02004432if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01004433 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00004434fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004435
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004436dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
4437dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
4438dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00004439dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
4440dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004441DEPEND_CFLAGS_FILTER=
4442if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004443 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00004444 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00004445 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004446 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004447 AC_MSG_RESULT(yes)
4448 else
4449 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004450 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004451 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
4452 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00004453 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaaraeabe052011-12-08 15:17:34 +01004454 dnl And undefine it first to avoid a warning.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004455 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
4456 if test "$gccmajor" -gt "3"; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02004457 CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004458 AC_MSG_RESULT(yes)
4459 else
4460 AC_MSG_RESULT(no)
4461 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00004462fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004463AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004464
Bram Moolenaarec0557f2018-01-31 14:41:37 +01004465dnl On some systems AC_SYS_LARGEFILE determines that -D_FILE_OFFSET_BITS=64
4466dnl isn't required, but the CFLAGS for some of the libraries we're using
4467dnl include the define. Since the define changes the size of some datatypes
4468dnl (e.g. ino_t and off_t), all of Vim's modules must be compiled with a
4469dnl consistent value. It's therefore safest to force the use of the define
4470dnl if it's present in any of the *_CFLAGS variables.
4471AC_MSG_CHECKING(whether we need to force -D_FILE_OFFSET_BITS=64)
Bram Moolenaar9ce42132018-04-11 22:19:36 +02004472if 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 +01004473 AC_MSG_RESULT(yes)
4474 AC_DEFINE(_FILE_OFFSET_BITS, 64)
4475else
4476 AC_MSG_RESULT(no)
4477fi
4478
Bram Moolenaar22e193d2010-11-03 22:32:24 +01004479dnl link.sh tries to avoid overlinking in a hackish way.
4480dnl At least GNU ld supports --as-needed which provides the same functionality
4481dnl at linker level. Let's use it.
4482AC_MSG_CHECKING(linker --as-needed support)
4483LINK_AS_NEEDED=
4484# Check if linker supports --as-needed and --no-as-needed options
4485if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02004486 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'`
Bram Moolenaar22e193d2010-11-03 22:32:24 +01004487 LINK_AS_NEEDED=yes
4488fi
4489if test "$LINK_AS_NEEDED" = yes; then
4490 AC_MSG_RESULT(yes)
4491else
4492 AC_MSG_RESULT(no)
4493fi
4494AC_SUBST(LINK_AS_NEEDED)
4495
Bram Moolenaar77c19352012-06-13 19:19:41 +02004496# IBM z/OS reset CFLAGS for config.mk
4497if test "$zOSUnix" = "yes"; then
4498 CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
4499fi
4500
Bram Moolenaar071d4272004-06-13 20:20:40 +00004501dnl write output files
4502AC_OUTPUT(auto/config.mk:config.mk.in)
4503
4504dnl vim: set sw=2 tw=78 fo+=l: