blob: c97603a716f30f439b951e939bdcc95c5786d62c [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)
348AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
349 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
350 AC_MSG_RESULT(no))
351
352AC_MSG_CHECKING(--with-modified-by argument)
353AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
354 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
355 AC_MSG_RESULT(no))
356
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200357dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358AC_MSG_CHECKING(if character set is EBCDIC)
359AC_TRY_COMPILE([ ],
360[ /* TryCompile function for CharSet.
361 Treat any failure as ASCII for compatibility with existing art.
362 Use compile-time rather than run-time tests for cross-compiler
363 tolerance. */
364#if '0'!=240
365make an error "Character set is not EBCDIC"
366#endif ],
367[ # TryCompile action if true
368cf_cv_ebcdic=yes ],
369[ # TryCompile action if false
370cf_cv_ebcdic=no])
371# end of TryCompile ])
372# end of CacheVal CvEbcdic
373AC_MSG_RESULT($cf_cv_ebcdic)
374case "$cf_cv_ebcdic" in #(vi
375 yes) AC_DEFINE(EBCDIC)
376 line_break='"\\n"'
377 ;;
378 *) line_break='"\\012"';;
379esac
380AC_SUBST(line_break)
381
382if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar84a05ac2013-05-06 04:24:17 +0200383dnl If we have EBCDIC we most likely have z/OS Unix, let's test it!
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200384AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000385case `uname` in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200386 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000387 dnl If using cc the environment variable _CC_CCMODE must be
388 dnl set to "1", so that some compiler extensions are enabled.
389 dnl If using c89 the environment variable is named _CC_C89MODE.
390 dnl Note: compile with c89 never tested.
391 if test "$CC" = "cc"; then
392 ccm="$_CC_CCMODE"
393 ccn="CC"
394 else
395 if test "$CC" = "c89"; then
396 ccm="$_CC_C89MODE"
397 ccn="C89"
398 else
399 ccm=1
400 fi
401 fi
402 if test "$ccm" != "1"; then
403 echo ""
404 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200405 echo " On z/OS Unix, the environment variable"
Bram Moolenaar77c19352012-06-13 19:19:41 +0200406 echo " _CC_${ccn}MODE must be set to \"1\"!"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000407 echo " Do:"
408 echo " export _CC_${ccn}MODE=1"
409 echo " and then call configure again."
410 echo "------------------------------------------"
411 exit 1
412 fi
Bram Moolenaar77c19352012-06-13 19:19:41 +0200413 # Set CFLAGS for configure process.
414 # This will be reset later for config.mk.
415 # Use haltonmsg to force error for missing H files.
416 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
417 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000418 AC_MSG_RESULT(yes)
419 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200420 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000421 AC_MSG_RESULT(no)
422 ;;
423esac
424fi
425
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200426dnl Set QUOTESED. Needs additional backslashes on zOS
427if test "$zOSUnix" = "yes"; then
428 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
429else
430 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
431fi
432AC_SUBST(QUOTESED)
433
434
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200435dnl Link with -lsmack for Smack stuff; if not found
436AC_MSG_CHECKING(--disable-smack argument)
437AC_ARG_ENABLE(smack,
438 [ --disable-smack Do not check for Smack support.],
439 , enable_smack="yes")
440if test "$enable_smack" = "yes"; then
Bram Moolenaar4ed89cd2014-04-05 12:02:25 +0200441 AC_MSG_RESULT(no)
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200442 AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no")
Bram Moolenaar4ed89cd2014-04-05 12:02:25 +0200443else
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200444 AC_MSG_RESULT(yes)
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200445fi
446if test "$enable_smack" = "yes"; then
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200447 AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no")
448fi
449if test "$enable_smack" = "yes"; then
450 AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h)
451 AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>],
452 AC_MSG_RESULT(yes),
Bram Moolenaare29b1fe2014-04-10 20:00:15 +0200453 AC_MSG_RESULT(no); enable_smack="no")
Bram Moolenaarc09551a2014-04-10 11:09:17 +0200454fi
455if test "$enable_smack" = "yes"; then
456 AC_CHECK_LIB(attr, setxattr,
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200457 [LIBS="$LIBS -lattr"
458 found_smack="yes"
459 AC_DEFINE(HAVE_SMACK)])
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000460fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000461
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200462dnl When smack was found don't search for SELinux
463if test "x$found_smack" = "x"; then
464 dnl Link with -lselinux for SELinux stuff; if not found
465 AC_MSG_CHECKING(--disable-selinux argument)
466 AC_ARG_ENABLE(selinux,
467 [ --disable-selinux Do not check for SELinux support.],
468 , enable_selinux="yes")
469 if test "$enable_selinux" = "yes"; then
470 AC_MSG_RESULT(no)
471 AC_CHECK_LIB(selinux, is_selinux_enabled,
Bram Moolenaare4b78e22017-12-07 22:29:11 +0100472 [AC_CHECK_HEADER(selinux/selinux.h,
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200473 [LIBS="$LIBS -lselinux"
Bram Moolenaare4b78e22017-12-07 22:29:11 +0100474 AC_DEFINE(HAVE_SELINUX)])])
Bram Moolenaar5bd32f42014-04-02 14:05:38 +0200475 else
476 AC_MSG_RESULT(yes)
477 fi
478fi
479
Bram Moolenaar071d4272004-06-13 20:20:40 +0000480dnl Check user requested features.
481
482AC_MSG_CHECKING(--with-features argument)
Bram Moolenaareec29812016-07-26 21:27:36 +0200483AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: huge)],
Bram Moolenaar071d4272004-06-13 20:20:40 +0000484 features="$withval"; AC_MSG_RESULT($features),
Bram Moolenaar23c4f712016-01-20 22:11:59 +0100485 features="huge"; AC_MSG_RESULT(Defaulting to huge))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000486
487dovimdiff=""
488dogvimdiff=""
489case "$features" in
490 tiny) AC_DEFINE(FEAT_TINY) ;;
491 small) AC_DEFINE(FEAT_SMALL) ;;
492 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
493 dogvimdiff="installgvimdiff" ;;
494 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
495 dogvimdiff="installgvimdiff" ;;
496 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
497 dogvimdiff="installgvimdiff" ;;
498 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
499esac
500
501AC_SUBST(dovimdiff)
502AC_SUBST(dogvimdiff)
503
504AC_MSG_CHECKING(--with-compiledby argument)
505AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
506 compiledby="$withval"; AC_MSG_RESULT($withval),
507 compiledby=""; AC_MSG_RESULT(no))
508AC_SUBST(compiledby)
509
510AC_MSG_CHECKING(--disable-xsmp argument)
511AC_ARG_ENABLE(xsmp,
512 [ --disable-xsmp Disable XSMP session management],
513 , enable_xsmp="yes")
514
515if test "$enable_xsmp" = "yes"; then
516 AC_MSG_RESULT(no)
517 AC_MSG_CHECKING(--disable-xsmp-interact argument)
518 AC_ARG_ENABLE(xsmp-interact,
519 [ --disable-xsmp-interact Disable XSMP interaction],
520 , enable_xsmp_interact="yes")
521 if test "$enable_xsmp_interact" = "yes"; then
522 AC_MSG_RESULT(no)
523 AC_DEFINE(USE_XSMP_INTERACT)
524 else
525 AC_MSG_RESULT(yes)
526 fi
527else
528 AC_MSG_RESULT(yes)
529fi
530
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200531dnl Check for Lua feature.
532AC_MSG_CHECKING(--enable-luainterp argument)
533AC_ARG_ENABLE(luainterp,
Bram Moolenaar8008b632017-07-18 21:33:20 +0200534 [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200535 [enable_luainterp="no"])
536AC_MSG_RESULT($enable_luainterp)
537
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200538if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
Bram Moolenaar3c124e32016-01-31 14:36:58 +0100539 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
540 AC_MSG_ERROR([cannot use Lua with tiny or small features])
541 fi
542
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200543 dnl -- find the lua executable
544 AC_SUBST(vi_cv_path_lua)
545
546 AC_MSG_CHECKING(--with-lua-prefix argument)
547 AC_ARG_WITH(lua_prefix,
548 [ --with-lua-prefix=PFX Prefix where Lua is installed.],
549 with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200550 with_lua_prefix="";AC_MSG_RESULT(no))
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200551
552 if test "X$with_lua_prefix" != "X"; then
553 vi_cv_path_lua_pfx="$with_lua_prefix"
554 else
555 AC_MSG_CHECKING(LUA_PREFIX environment var)
556 if test "X$LUA_PREFIX" != "X"; then
557 AC_MSG_RESULT("$LUA_PREFIX")
558 vi_cv_path_lua_pfx="$LUA_PREFIX"
559 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200560 AC_MSG_RESULT([not set, default to /usr])
561 vi_cv_path_lua_pfx="/usr"
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200562 fi
563 fi
564
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200565 AC_MSG_CHECKING(--with-luajit)
566 AC_ARG_WITH(luajit,
567 [ --with-luajit Link with LuaJIT instead of Lua.],
568 [vi_cv_with_luajit="$withval"],
569 [vi_cv_with_luajit="no"])
570 AC_MSG_RESULT($vi_cv_with_luajit)
571
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200572 LUA_INC=
573 if test "X$vi_cv_path_lua_pfx" != "X"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200574 if test "x$vi_cv_with_luajit" != "xno"; then
575 dnl -- try to find LuaJIT executable
576 AC_PATH_PROG(vi_cv_path_luajit, luajit)
577 if test "X$vi_cv_path_luajit" != "X"; then
578 dnl -- find LuaJIT version
579 AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit,
Bram Moolenaar49b10272013-11-21 12:17:51 +0100580 [ 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 +0200581 AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit,
582 [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ])
583 vi_cv_path_lua="$vi_cv_path_luajit"
584 vi_cv_version_lua="$vi_cv_version_lua_luajit"
585 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200586 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200587 dnl -- try to find Lua executable
588 AC_PATH_PROG(vi_cv_path_plain_lua, lua)
589 if test "X$vi_cv_path_plain_lua" != "X"; then
590 dnl -- find Lua version
591 AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua,
592 [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
593 fi
594 vi_cv_path_lua="$vi_cv_path_plain_lua"
595 vi_cv_version_lua="$vi_cv_version_plain_lua"
596 fi
597 if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then
598 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 +0100599 if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200600 AC_MSG_RESULT(yes)
601 LUA_INC=/luajit-$vi_cv_version_luajit
602 fi
603 fi
604 if test "X$LUA_INC" = "X"; then
605 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
Bram Moolenaar49222be2015-12-11 18:11:30 +0100606 if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200607 AC_MSG_RESULT(yes)
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200608 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200609 AC_MSG_RESULT(no)
610 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 +0100611 if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200612 AC_MSG_RESULT(yes)
613 LUA_INC=/lua$vi_cv_version_lua
614 else
615 AC_MSG_RESULT(no)
616 vi_cv_path_lua_pfx=
617 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200618 fi
619 fi
620 fi
621
622 if test "X$vi_cv_path_lua_pfx" != "X"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200623 if test "x$vi_cv_with_luajit" != "xno"; then
624 multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
625 if test "X$multiarch" != "X"; then
626 lib_multiarch="lib/${multiarch}"
627 else
628 lib_multiarch="lib"
629 fi
630 if test "X$vi_cv_version_lua" = "X"; then
631 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit"
632 else
633 LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua"
634 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200635 else
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200636 if test "X$LUA_INC" != "X"; then
637 dnl Test alternate location using version
638 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
639 else
640 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
641 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200642 fi
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200643 if test "$enable_luainterp" = "dynamic"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200644 lua_ok="yes"
645 else
646 AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane])
647 libs_save=$LIBS
648 LIBS="$LIBS $LUA_LIBS"
649 AC_TRY_LINK(,[ ],
650 AC_MSG_RESULT(yes); lua_ok="yes",
651 AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="")
652 LIBS=$libs_save
653 fi
654 if test "x$lua_ok" = "xyes"; then
655 LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
656 LUA_SRC="if_lua.c"
657 LUA_OBJ="objects/if_lua.o"
658 LUA_PRO="if_lua.pro"
659 AC_DEFINE(FEAT_LUA)
660 fi
661 if test "$enable_luainterp" = "dynamic"; then
662 if test "x$vi_cv_with_luajit" != "xno"; then
663 luajit="jit"
664 fi
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200665 if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
666 vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
667 else
Bram Moolenaard0573012017-10-28 21:11:06 +0200668 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200669 ext="dylib"
670 indexes=""
671 else
672 ext="so"
673 indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9"
674 multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
675 if test "X$multiarch" != "X"; then
676 lib_multiarch="lib/${multiarch}"
677 fi
Bram Moolenaar768baac2013-04-15 14:44:57 +0200678 fi
679 dnl Determine the sover for the current version, but fallback to
680 dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found.
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200681 AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx)
Bram Moolenaar768baac2013-04-15 14:44:57 +0200682 for subdir in "${lib_multiarch}" lib64 lib; do
683 if test -z "$subdir"; then
684 continue
685 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200686 for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \
687 ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do
688 for i in $indexes ""; do
689 if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then
Bram Moolenaar768baac2013-04-15 14:44:57 +0200690 sover2="$i"
691 break 3
692 fi
693 done
Bram Moolenaar07e1da62013-02-06 19:49:43 +0100694 done
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200695 sover=""
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200696 done
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200697 if test "X$sover" = "X"; then
698 AC_MSG_RESULT(no)
699 lua_ok="no"
700 vi_cv_dll_name_lua="liblua${luajit}.${ext}"
701 else
702 AC_MSG_RESULT(yes)
703 lua_ok="yes"
704 vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2"
705 fi
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200706 fi
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200707 AC_DEFINE(DYNAMIC_LUA)
708 LUA_LIBS=""
Bram Moolenaar1e91f262012-10-03 14:48:08 +0200709 LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS"
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200710 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200711 if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \
Bram Moolenaard0573012017-10-28 21:11:06 +0200712 test "x$MACOS_X" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200713 test "`(uname -m) 2>/dev/null`" = "x86_64"; then
714 dnl OSX/x64 requires these flags. See http://luajit.org/install.html
715 LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS"
716 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200717 fi
Bram Moolenaare855ccf2013-07-28 13:32:15 +0200718 if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then
Bram Moolenaarf788a062011-12-14 20:51:25 +0100719 AC_MSG_ERROR([could not configure lua])
720 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200721 AC_SUBST(LUA_SRC)
722 AC_SUBST(LUA_OBJ)
723 AC_SUBST(LUA_PRO)
724 AC_SUBST(LUA_LIBS)
725 AC_SUBST(LUA_CFLAGS)
726fi
727
728
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000729dnl Check for MzScheme feature.
730AC_MSG_CHECKING(--enable-mzschemeinterp argument)
731AC_ARG_ENABLE(mzschemeinterp,
Bram Moolenaar8008b632017-07-18 21:33:20 +0200732 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000733 [enable_mzschemeinterp="no"])
734AC_MSG_RESULT($enable_mzschemeinterp)
735
736if test "$enable_mzschemeinterp" = "yes"; then
737 dnl -- find the mzscheme executable
738 AC_SUBST(vi_cv_path_mzscheme)
739
740 AC_MSG_CHECKING(--with-plthome argument)
741 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000742 [ --with-plthome=PLTHOME Use PLTHOME.],
743 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000744 with_plthome="";AC_MSG_RESULT("no"))
745
746 if test "X$with_plthome" != "X"; then
747 vi_cv_path_mzscheme_pfx="$with_plthome"
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100748 vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000749 else
750 AC_MSG_CHECKING(PLTHOME environment var)
751 if test "X$PLTHOME" != "X"; then
752 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000753 vi_cv_path_mzscheme_pfx="$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
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000756 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000757 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000758 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000759
760 dnl resolve symbolic link, the executable is often elsewhere and there
761 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000762 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000763 lsout=`ls -l $vi_cv_path_mzscheme`
764 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
765 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
766 fi
767 fi
768
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000769 if test "X$vi_cv_path_mzscheme" != "X"; then
770 dnl -- find where MzScheme thinks it was installed
771 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000772 dnl different versions of MzScheme differ in command line processing
773 dnl use universal approach
774 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000775 (build-path (call-with-values \
776 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000777 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
778 dnl Remove a trailing slash
779 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
780 sed -e 's+/$++'` ])
781 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000782 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000783 fi
784 fi
785
786 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100787 AC_MSG_CHECKING(for racket include directory)
788 SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'`
789 if test "X$SCHEME_INC" != "X"; then
790 AC_MSG_RESULT(${SCHEME_INC})
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000791 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100792 AC_MSG_RESULT(not found)
793 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
794 if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then
795 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000796 AC_MSG_RESULT(yes)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000797 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000798 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100799 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
800 if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000801 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100802 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000803 else
804 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/racket)
806 if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100807 AC_MSG_RESULT(yes)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100808 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100809 else
810 AC_MSG_RESULT(no)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100811 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
812 if test -f /usr/include/plt/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=/usr/include/plt
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/racket/)
818 if test -f /usr/include/racket/scheme.h; then
819 AC_MSG_RESULT(yes)
820 SCHEME_INC=/usr/include/racket
821 else
822 AC_MSG_RESULT(no)
823 vi_cv_path_mzscheme_pfx=
824 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100825 fi
826 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000827 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000828 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000829 fi
830 fi
831
832 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100833
834 AC_MSG_CHECKING(for racket lib directory)
835 SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'`
836 if test "X$SCHEME_LIB" != "X"; then
837 AC_MSG_RESULT(${SCHEME_LIB})
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000838 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100839 AC_MSG_RESULT(not found)
840 fi
841
842 for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
843 if test "X$path" != "X"; then
Bram Moolenaard0573012017-10-28 21:11:06 +0200844 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100845 MZSCHEME_LIBS="-framework Racket"
846 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
847 elif test -f "${path}/libmzscheme3m.a"; then
848 MZSCHEME_LIBS="${path}/libmzscheme3m.a"
849 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
850 elif test -f "${path}/libracket3m.a"; then
851 MZSCHEME_LIBS="${path}/libracket3m.a"
852 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
853 elif test -f "${path}/libracket.a"; then
854 MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a"
855 elif test -f "${path}/libmzscheme.a"; then
856 MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a"
857 else
858 dnl Using shared objects
859 if test -f "${path}/libmzscheme3m.so"; then
860 MZSCHEME_LIBS="-L${path} -lmzscheme3m"
861 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
862 elif test -f "${path}/libracket3m.so"; then
863 MZSCHEME_LIBS="-L${path} -lracket3m"
864 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
865 elif test -f "${path}/libracket.so"; then
866 MZSCHEME_LIBS="-L${path} -lracket -lmzgc"
867 else
868 dnl try next until last
869 if test "$path" != "$SCHEME_LIB"; then
870 continue
871 fi
872 MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc"
873 fi
874 if test "$GCC" = yes; then
875 dnl Make Vim remember the path to the library. For when it's not in
876 dnl $LD_LIBRARY_PATH.
877 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}"
878 elif test "`(uname) 2>/dev/null`" = SunOS &&
879 uname -r | grep '^5' >/dev/null; then
880 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}"
881 fi
882 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000883 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100884 if test "X$MZSCHEME_LIBS" != "X"; then
885 break
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000886 fi
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100887 done
888
889 AC_MSG_CHECKING([if racket requires -pthread])
890 if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then
891 AC_MSG_RESULT(yes)
892 MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread"
893 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread"
894 else
895 AC_MSG_RESULT(no)
896 fi
897
898 AC_MSG_CHECKING(for racket config directory)
899 SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'`
900 if test "X$SCHEME_CONFIGDIR" != "X"; then
901 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'"
902 AC_MSG_RESULT(${SCHEME_CONFIGDIR})
903 else
904 AC_MSG_RESULT(not found)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000905 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100906
907 AC_MSG_CHECKING(for racket collects directory)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100908 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))))'`
909 if test "X$SCHEME_COLLECTS" = "X"; then
910 if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then
911 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100912 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100913 if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then
914 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/
Bram Moolenaar75676462013-01-30 14:55:42 +0100915 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100916 if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then
917 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
918 else
919 if test -d "$vi_cv_path_mzscheme_pfx/collects"; then
920 SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
921 fi
Bram Moolenaar75676462013-01-30 14:55:42 +0100922 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100923 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100924 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000925 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100926 if test "X$SCHEME_COLLECTS" != "X" ; then
927 AC_MSG_RESULT(${SCHEME_COLLECTS})
928 else
929 AC_MSG_RESULT(not found)
930 fi
931
932 AC_MSG_CHECKING(for mzscheme_base.c)
933 if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000934 MZSCHEME_EXTRA="mzscheme_base.c"
Bram Moolenaar45e2bcc2014-02-15 17:19:00 +0100935 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
936 MZSCHEME_MOD="++lib scheme/base"
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100937 else
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100938 if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100939 MZSCHEME_EXTRA="mzscheme_base.c"
Bram Moolenaar45e2bcc2014-02-15 17:19:00 +0100940 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
941 MZSCHEME_MOD="++lib scheme/base"
942 else
943 if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then
944 MZSCHEME_EXTRA="mzscheme_base.c"
945 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool"
946 MZSCHEME_MOD=""
947 fi
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100948 fi
949 fi
950 if test "X$MZSCHEME_EXTRA" != "X" ; then
951 dnl need to generate bytecode for MzScheme base
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000952 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100953 AC_MSG_RESULT(needed)
954 else
955 AC_MSG_RESULT(not needed)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000956 fi
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100957
Bram Moolenaar9e902192013-07-17 18:58:11 +0200958 dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'".
959 AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"])
960
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000961 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaarfe9fb922012-11-23 21:54:48 +0100962 -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar9e902192013-07-17 18:58:11 +0200963
964 dnl Test that we can compile a simple program with these CFLAGS and LIBS.
965 AC_MSG_CHECKING([if compile and link flags for MzScheme are sane])
966 cflags_save=$CFLAGS
967 libs_save=$LIBS
968 CFLAGS="$CFLAGS $MZSCHEME_CFLAGS"
969 LIBS="$LIBS $MZSCHEME_LIBS"
970 AC_TRY_LINK(,[ ],
971 AC_MSG_RESULT(yes); mzs_ok=yes,
972 AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no)
973 CFLAGS=$cflags_save
974 LIBS=$libs_save
975 if test $mzs_ok = yes; then
976 MZSCHEME_SRC="if_mzsch.c"
977 MZSCHEME_OBJ="objects/if_mzsch.o"
978 MZSCHEME_PRO="if_mzsch.pro"
979 AC_DEFINE(FEAT_MZSCHEME)
980 else
981 MZSCHEME_CFLAGS=
982 MZSCHEME_LIBS=
983 MZSCHEME_EXTRA=
984 MZSCHEME_MZC=
985 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000986 fi
987 AC_SUBST(MZSCHEME_SRC)
988 AC_SUBST(MZSCHEME_OBJ)
989 AC_SUBST(MZSCHEME_PRO)
990 AC_SUBST(MZSCHEME_LIBS)
991 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000992 AC_SUBST(MZSCHEME_EXTRA)
993 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000994fi
995
996
Bram Moolenaar071d4272004-06-13 20:20:40 +0000997AC_MSG_CHECKING(--enable-perlinterp argument)
998AC_ARG_ENABLE(perlinterp,
Bram Moolenaare06c1882010-07-21 22:05:20 +0200999 [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001000 [enable_perlinterp="no"])
1001AC_MSG_RESULT($enable_perlinterp)
Bram Moolenaare06c1882010-07-21 22:05:20 +02001002if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
Bram Moolenaar3c124e32016-01-31 14:36:58 +01001003 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1004 AC_MSG_ERROR([cannot use Perl with tiny or small features])
1005 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001006 AC_SUBST(vi_cv_path_perl)
1007 AC_PATH_PROG(vi_cv_path_perl, perl)
1008 if test "X$vi_cv_path_perl" != "X"; then
1009 AC_MSG_CHECKING(Perl version)
1010 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
1011 eval `$vi_cv_path_perl -V:usethreads`
Bram Moolenaare06c1882010-07-21 22:05:20 +02001012 eval `$vi_cv_path_perl -V:libperl`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001013 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
1014 badthreads=no
1015 else
1016 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
1017 eval `$vi_cv_path_perl -V:use5005threads`
1018 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
1019 badthreads=no
1020 else
1021 badthreads=yes
1022 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
1023 fi
1024 else
1025 badthreads=yes
1026 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
1027 fi
1028 fi
1029 if test $badthreads = no; then
1030 AC_MSG_RESULT(OK)
1031 eval `$vi_cv_path_perl -V:shrpenv`
1032 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
1033 shrpenv=""
1034 fi
1035 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
1036 AC_SUBST(vi_cv_perllib)
Bram Moolenaard5f62b12014-08-17 17:05:44 +02001037 vi_cv_perl_extutils=unknown_perl_extutils_path
1038 for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do
1039 xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp"
1040 if test -f "$xsubpp_path"; then
1041 vi_cv_perl_xsubpp="$xsubpp_path"
1042 fi
1043 done
1044 AC_SUBST(vi_cv_perl_xsubpp)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001045 dnl Remove "-fno-something", it breaks using cproto.
Bram Moolenaar280a8682015-06-21 13:41:08 +02001046 dnl Remove "-fdebug-prefix-map", it isn't supported by clang.
Bram Moolenaare8ff56b2017-09-14 23:06:23 +02001047 dnl Remove "FORTIFY_SOURCE", it will be defined twice.
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001048 dnl remove -pipe and -Wxxx, it confuses cproto
Bram Moolenaar071d4272004-06-13 20:20:40 +00001049 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
Bram Moolenaare8ff56b2017-09-14 23:06:23 +02001050 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \
1051 -e 's/-fdebug-prefix-map[[^ ]]*//g' \
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001052 -e 's/-pipe //' \
1053 -e 's/-W[[^ ]]*//g' \
1054 -e 's/-D_FORTIFY_SOURCE=.//g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001055 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
1056 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
1057 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
1058 -e 's/-bE:perl.exp//' -e 's/-lc //'`
1059 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
1060 dnl a test in configure may fail because of that.
1061 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
1062 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
1063
1064 dnl check that compiling a simple program still works with the flags
1065 dnl added for Perl.
1066 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
1067 cflags_save=$CFLAGS
1068 libs_save=$LIBS
1069 ldflags_save=$LDFLAGS
1070 CFLAGS="$CFLAGS $perlcppflags"
1071 LIBS="$LIBS $perllibs"
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001072 perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001073 LDFLAGS="$perlldflags $LDFLAGS"
1074 AC_TRY_LINK(,[ ],
1075 AC_MSG_RESULT(yes); perl_ok=yes,
1076 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
1077 CFLAGS=$cflags_save
1078 LIBS=$libs_save
1079 LDFLAGS=$ldflags_save
1080 if test $perl_ok = yes; then
1081 if test "X$perlcppflags" != "X"; then
Bram Moolenaar1ec96c92017-09-27 21:42:08 +02001082 PERL_CFLAGS=$perlcppflags
Bram Moolenaar071d4272004-06-13 20:20:40 +00001083 fi
1084 if test "X$perlldflags" != "X"; then
Bram Moolenaar2bcaec32014-03-27 18:51:11 +01001085 if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001086 LDFLAGS="$perlldflags $LDFLAGS"
1087 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001088 fi
1089 PERL_LIBS=$perllibs
1090 PERL_SRC="auto/if_perl.c if_perlsfio.c"
1091 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
1092 PERL_PRO="if_perl.pro if_perlsfio.pro"
1093 AC_DEFINE(FEAT_PERL)
1094 fi
1095 fi
1096 else
1097 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
1098 fi
1099 fi
1100
Bram Moolenaard0573012017-10-28 21:11:06 +02001101 if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +00001102 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +00001103 dir=/System/Library/Perl
1104 darwindir=$dir/darwin
1105 if test -d $darwindir; then
1106 PERL=/usr/bin/perl
1107 else
1108 dnl Mac OS X 10.3
1109 dir=/System/Library/Perl/5.8.1
1110 darwindir=$dir/darwin-thread-multi-2level
1111 if test -d $darwindir; then
1112 PERL=/usr/bin/perl
1113 fi
1114 fi
1115 if test -n "$PERL"; then
1116 PERL_DIR="$dir"
1117 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
1118 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
1119 PERL_LIBS="-L$darwindir/CORE -lperl"
1120 fi
Bram Moolenaar5dff57d2010-07-24 16:19:44 +02001121 dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only
1122 dnl be included if requested by passing --with-mac-arch to
1123 dnl configure, so strip these flags first (if present)
1124 PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
1125 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 +00001126 fi
Bram Moolenaare06c1882010-07-21 22:05:20 +02001127 if test "$enable_perlinterp" = "dynamic"; then
1128 if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
1129 AC_DEFINE(DYNAMIC_PERL)
1130 PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
1131 fi
1132 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001133
1134 if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then
1135 AC_MSG_ERROR([could not configure perl])
1136 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001137fi
1138AC_SUBST(shrpenv)
1139AC_SUBST(PERL_SRC)
1140AC_SUBST(PERL_OBJ)
1141AC_SUBST(PERL_PRO)
1142AC_SUBST(PERL_CFLAGS)
1143AC_SUBST(PERL_LIBS)
1144
1145AC_MSG_CHECKING(--enable-pythoninterp argument)
1146AC_ARG_ENABLE(pythoninterp,
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001147 [ --enable-pythoninterp[=OPTS] Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001148 [enable_pythoninterp="no"])
1149AC_MSG_RESULT($enable_pythoninterp)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001150if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
Bram Moolenaar0b105412014-11-30 13:34:23 +01001151 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1152 AC_MSG_ERROR([cannot use Python with tiny or small features])
1153 fi
1154
Bram Moolenaar071d4272004-06-13 20:20:40 +00001155 dnl -- find the python executable
Bram Moolenaare1a32312018-04-15 16:03:25 +02001156 AC_MSG_CHECKING(--with-python-command argument)
1157 AC_SUBST(vi_cv_path_python)
1158 AC_ARG_WITH(python-command, [ --with-python-command=NAME name of the Python 2 command (default: python2 or python)],
1159 vi_cv_path_python="$withval"; AC_MSG_RESULT($vi_cv_path_python),
1160 AC_MSG_RESULT(no))
1161
1162 if test "X$vi_cv_path_python" = "X"; then
1163 AC_PATH_PROGS(vi_cv_path_python, python2 python)
1164 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001165 if test "X$vi_cv_path_python" != "X"; then
1166
1167 dnl -- get its version number
1168 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
1169 [[vi_cv_var_python_version=`
1170 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
1171 ]])
1172
Bram Moolenaarc09a6d62013-06-10 21:27:29 +02001173 dnl -- it must be at least version 2.3
1174 AC_MSG_CHECKING(Python is 2.3 or better)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001175 if ${vi_cv_path_python} -c \
Bram Moolenaarc09a6d62013-06-10 21:27:29 +02001176 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001177 then
1178 AC_MSG_RESULT(yep)
1179
1180 dnl -- find where python thinks it was installed
1181 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
1182 [ vi_cv_path_python_pfx=`
1183 ${vi_cv_path_python} -c \
1184 "import sys; print sys.prefix"` ])
1185
1186 dnl -- and where it thinks it runs
1187 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
1188 [ vi_cv_path_python_epfx=`
1189 ${vi_cv_path_python} -c \
1190 "import sys; print sys.exec_prefix"` ])
1191
1192 dnl -- python's internal library path
1193
1194 AC_CACHE_VAL(vi_cv_path_pythonpath,
1195 [ vi_cv_path_pythonpath=`
1196 unset PYTHONPATH;
1197 ${vi_cv_path_python} -c \
1198 "import sys, string; print string.join(sys.path,':')"` ])
1199
1200 dnl -- where the Python implementation library archives are
1201
1202 AC_ARG_WITH(python-config-dir,
Bram Moolenaare1a32312018-04-15 16:03:25 +02001203 [ --with-python-config-dir=PATH Python's config directory (deprecated)],
Bram Moolenaard0882402018-04-10 18:13:05 +02001204 [ vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 ] )
Bram Moolenaar071d4272004-06-13 20:20:40 +00001205
1206 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
1207 [
1208 vi_cv_path_python_conf=
Bram Moolenaarac499e32013-06-02 19:14:17 +02001209 d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
1210 if test -d "$d" && test -f "$d/config.c"; then
1211 vi_cv_path_python_conf="$d"
1212 else
1213 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
1214 for subdir in lib64 lib share; do
1215 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
1216 if test -d "$d" && test -f "$d/config.c"; then
1217 vi_cv_path_python_conf="$d"
1218 fi
1219 done
Bram Moolenaar071d4272004-06-13 20:20:40 +00001220 done
Bram Moolenaarac499e32013-06-02 19:14:17 +02001221 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001222 ])
1223
1224 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
1225
1226 if test "X$PYTHON_CONFDIR" = "X"; then
1227 AC_MSG_RESULT([can't find it!])
1228 else
1229
1230 dnl -- we need to examine Python's config/Makefile too
1231 dnl see what the interpreter is built from
1232 AC_CACHE_VAL(vi_cv_path_python_plibs,
1233 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +00001234 pwd=`pwd`
1235 tmp_mkf="$pwd/config-PyMake$$"
1236 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001237__:
Bram Moolenaar218116c2010-05-20 21:46:00 +02001238 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001239 @echo "python_LIBS='$(LIBS)'"
1240 @echo "python_SYSLIBS='$(SYSLIBS)'"
1241 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
Bram Moolenaarf94a13c2012-09-21 13:26:49 +02001242 @echo "python_DLLLIBRARY='$(DLLLIBRARY)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001243 @echo "python_INSTSONAME='$(INSTSONAME)'"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001244 @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'"
1245 @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
1246 @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001247eof
1248 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +00001249 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1250 rm -f -- "${tmp_mkf}"
Bram Moolenaard0573012017-10-28 21:11:06 +02001251 if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
Bram Moolenaar071d4272004-06-13 20:20:40 +00001252 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
1253 vi_cv_path_python_plibs="-framework Python"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001254 if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
1255 vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python"
1256 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001257 else
Bram Moolenaar9ce42132018-04-11 22:19:36 +02001258 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
Bram Moolenaar6c927552015-03-24 12:21:33 +01001259 dnl -- Check if the path contained in python_LINKFORSHARED is
1260 dnl usable for vim build. If not, make and try other
1261 dnl candidates.
Bram Moolenaara161e262015-03-24 15:14:27 +01001262 if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
Bram Moolenaar6c927552015-03-24 12:21:33 +01001263 python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'`
1264 python_link_path=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]][[ \t]]*\(.*\)/\2/'`
1265 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1266 dnl -- The path looks relative. Guess the absolute one using
1267 dnl the prefix and try that.
1268 python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}"
1269 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1270 dnl -- A last resort.
1271 python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}"
1272 dnl -- No check is done. The last word is left to the
1273 dnl "sanity" test on link flags that follows shortly.
1274 fi
1275 python_LINKFORSHARED="${python_link_symbol} ${python_link_path}"
1276 fi
1277 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +02001278 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 +00001279 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1280 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
1281 fi
1282 ])
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001283 AC_CACHE_CHECK(Python's dll name,vi_cv_dll_name_python,
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001284 [
1285 if test "X$python_DLLLIBRARY" != "X"; then
1286 vi_cv_dll_name_python="$python_DLLLIBRARY"
1287 else
1288 vi_cv_dll_name_python="$python_INSTSONAME"
1289 fi
1290 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001291
1292 PYTHON_LIBS="${vi_cv_path_python_plibs}"
1293 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
Bram Moolenaar04249582018-04-10 13:29:34 +02001294 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001295 else
Bram Moolenaar04249582018-04-10 13:29:34 +02001296 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 +00001297 fi
Bram Moolenaar3a21d9c2018-04-10 20:26:20 +02001298 if test "X$have_python_config_dir" = "X1" -a "$enable_pythoninterp" = "dynamic"; then
Bram Moolenaard0882402018-04-10 18:13:05 +02001299 dnl Define PYTHON_HOME if --with-python-config-dir was used
1300 PYTHON_CFLAGS="${PYTHON_CFLAGS} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
1301
1302 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001303 PYTHON_SRC="if_python.c"
Bram Moolenaar9bdb9a02012-07-25 16:32:08 +02001304 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001305
1306 dnl On FreeBSD linking with "-pthread" is required to use threads.
1307 dnl _THREAD_SAFE must be used for compiling then.
1308 dnl The "-pthread" is added to $LIBS, so that the following check for
1309 dnl sigaltstack() will look in libc_r (it's there in libc!).
1310 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1311 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1312 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1313 AC_MSG_CHECKING([if -pthread should be used])
1314 threadsafe_flag=
1315 thread_lib=
Bram Moolenaard0573012017-10-28 21:11:06 +02001316 dnl if test "x$MACOS_X" != "xyes"; then
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00001317 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001318 test "$GCC" = yes && threadsafe_flag="-pthread"
1319 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1320 threadsafe_flag="-D_THREAD_SAFE"
1321 thread_lib="-pthread"
1322 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001323 if test "`(uname) 2>/dev/null`" = SunOS; then
1324 threadsafe_flag="-pthreads"
1325 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001326 fi
1327 libs_save_old=$LIBS
1328 if test -n "$threadsafe_flag"; then
1329 cflags_save=$CFLAGS
1330 CFLAGS="$CFLAGS $threadsafe_flag"
1331 LIBS="$LIBS $thread_lib"
1332 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +02001333 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +00001334 AC_MSG_RESULT(no); LIBS=$libs_save_old
1335 )
1336 CFLAGS=$cflags_save
1337 else
1338 AC_MSG_RESULT(no)
1339 fi
1340
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001341 dnl Check that compiling a simple program still works with the flags
Bram Moolenaar071d4272004-06-13 20:20:40 +00001342 dnl added for Python.
1343 AC_MSG_CHECKING([if compile and link flags for Python are sane])
1344 cflags_save=$CFLAGS
1345 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +02001346 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001347 LIBS="$LIBS $PYTHON_LIBS"
1348 AC_TRY_LINK(,[ ],
1349 AC_MSG_RESULT(yes); python_ok=yes,
1350 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
1351 CFLAGS=$cflags_save
1352 LIBS=$libs_save
1353 if test $python_ok = yes; then
1354 AC_DEFINE(FEAT_PYTHON)
1355 else
1356 LIBS=$libs_save_old
1357 PYTHON_SRC=
1358 PYTHON_OBJ=
1359 PYTHON_LIBS=
1360 PYTHON_CFLAGS=
1361 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001362 fi
1363 else
1364 AC_MSG_RESULT(too old)
1365 fi
1366 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001367
1368 if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then
1369 AC_MSG_ERROR([could not configure python])
1370 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001371fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001372
Bram Moolenaar071d4272004-06-13 20:20:40 +00001373AC_SUBST(PYTHON_LIBS)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001374AC_SUBST(PYTHON_CFLAGS)
1375AC_SUBST(PYTHON_SRC)
1376AC_SUBST(PYTHON_OBJ)
1377
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001378
1379AC_MSG_CHECKING(--enable-python3interp argument)
1380AC_ARG_ENABLE(python3interp,
Bram Moolenaar8008b632017-07-18 21:33:20 +02001381 [ --enable-python3interp[=OPTS] Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001382 [enable_python3interp="no"])
1383AC_MSG_RESULT($enable_python3interp)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001384if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
Bram Moolenaar0b105412014-11-30 13:34:23 +01001385 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1386 AC_MSG_ERROR([cannot use Python with tiny or small features])
1387 fi
1388
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001389 dnl -- find the python3 executable
Bram Moolenaare1a32312018-04-15 16:03:25 +02001390 AC_MSG_CHECKING(--with-python3-command argument)
1391 AC_SUBST(vi_cv_path_python3)
1392 AC_ARG_WITH(python3-command, [ --with-python3-command=NAME name of the Python 3 command (default: python3 or python)],
1393 vi_cv_path_python3="$withval"; AC_MSG_RESULT($vi_cv_path_python3),
1394 AC_MSG_RESULT(no))
1395
1396 if test "X$vi_cv_path_python3" = "X"; then
1397 AC_PATH_PROGS(vi_cv_path_python3, python3 python)
1398 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001399 if test "X$vi_cv_path_python3" != "X"; then
1400
1401 dnl -- get its version number
1402 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
1403 [[vi_cv_var_python3_version=`
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001404 ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001405 ]])
1406
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001407 dnl -- it must be at least version 3
1408 AC_MSG_CHECKING(Python is 3.0 or better)
1409 if ${vi_cv_path_python3} -c \
1410 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)"
1411 then
1412 AC_MSG_RESULT(yep)
Bram Moolenaar456f2bb2011-06-12 21:37:13 +02001413
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001414 dnl -- get abiflags for python 3.2 or higher (PEP 3149)
1415 AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001416 [
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001417 vi_cv_var_python3_abiflags=
1418 if ${vi_cv_path_python3} -c \
1419 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)"
1420 then
1421 vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \
1422 "import sys; print(sys.abiflags)"`
1423 fi ])
1424
1425 dnl -- find where python3 thinks it was installed
1426 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
1427 [ vi_cv_path_python3_pfx=`
1428 ${vi_cv_path_python3} -c \
1429 "import sys; print(sys.prefix)"` ])
1430
1431 dnl -- and where it thinks it runs
1432 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
1433 [ vi_cv_path_python3_epfx=`
1434 ${vi_cv_path_python3} -c \
1435 "import sys; print(sys.exec_prefix)"` ])
1436
1437 dnl -- python3's internal library path
1438
1439 AC_CACHE_VAL(vi_cv_path_python3path,
1440 [ vi_cv_path_python3path=`
1441 unset PYTHONPATH;
1442 ${vi_cv_path_python3} -c \
1443 "import sys, string; print(':'.join(sys.path))"` ])
1444
1445 dnl -- where the Python implementation library archives are
1446
1447 AC_ARG_WITH(python3-config-dir,
Bram Moolenaare1a32312018-04-15 16:03:25 +02001448 [ --with-python3-config-dir=PATH Python's config directory (deprecated)],
Bram Moolenaard0882402018-04-10 18:13:05 +02001449 [ vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 ] )
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001450
1451 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
1452 [
1453 vi_cv_path_python3_conf=
Bram Moolenaarfee496d2013-07-12 20:07:24 +02001454 config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001455 d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
1456 if test -d "$d" && test -f "$d/config.c"; then
1457 vi_cv_path_python3_conf="$d"
1458 else
1459 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
1460 for subdir in lib64 lib share; do
1461 d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
1462 if test -d "$d" && test -f "$d/config.c"; then
1463 vi_cv_path_python3_conf="$d"
1464 fi
1465 done
1466 done
1467 fi
1468 ])
1469
1470 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
1471
1472 if test "X$PYTHON3_CONFDIR" = "X"; then
1473 AC_MSG_RESULT([can't find it!])
1474 else
1475
1476 dnl -- we need to examine Python's config/Makefile too
1477 dnl see what the interpreter is built from
1478 AC_CACHE_VAL(vi_cv_path_python3_plibs,
1479 [
1480 pwd=`pwd`
1481 tmp_mkf="$pwd/config-PyMake$$"
1482 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001483__:
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001484 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001485 @echo "python3_LIBS='$(LIBS)'"
1486 @echo "python3_SYSLIBS='$(SYSLIBS)'"
Bram Moolenaarf94a13c2012-09-21 13:26:49 +02001487 @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001488 @echo "python3_INSTSONAME='$(INSTSONAME)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001489eof
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001490 dnl -- delete the lines from make about Entering/Leaving directory
1491 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1492 rm -f -- "${tmp_mkf}"
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001493 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 +02001494 vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}"
1495 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1496 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1497 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1498 ])
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001499 AC_CACHE_CHECK(Python3's dll name,vi_cv_dll_name_python3,
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001500 [
1501 if test "X$python3_DLLLIBRARY" != "X"; then
1502 vi_cv_dll_name_python3="$python3_DLLLIBRARY"
1503 else
1504 vi_cv_dll_name_python3="$python3_INSTSONAME"
1505 fi
1506 ])
1507
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001508 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
1509 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
Bram Moolenaar04249582018-04-10 13:29:34 +02001510 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 +02001511 else
Bram Moolenaar04249582018-04-10 13:29:34 +02001512 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 +02001513 fi
Bram Moolenaar3a21d9c2018-04-10 20:26:20 +02001514 if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then
Bram Moolenaard0882402018-04-10 18:13:05 +02001515 dnl Define PYTHON3_HOME if --with-python-config-dir was used
1516 PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'"
1517 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001518 PYTHON3_SRC="if_python3.c"
1519 PYTHON3_OBJ="objects/if_python3.o"
1520
1521 dnl On FreeBSD linking with "-pthread" is required to use threads.
1522 dnl _THREAD_SAFE must be used for compiling then.
1523 dnl The "-pthread" is added to $LIBS, so that the following check for
1524 dnl sigaltstack() will look in libc_r (it's there in libc!).
1525 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1526 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1527 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1528 AC_MSG_CHECKING([if -pthread should be used])
1529 threadsafe_flag=
1530 thread_lib=
Bram Moolenaard0573012017-10-28 21:11:06 +02001531 dnl if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001532 if test "`(uname) 2>/dev/null`" != Darwin; then
1533 test "$GCC" = yes && threadsafe_flag="-pthread"
1534 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1535 threadsafe_flag="-D_THREAD_SAFE"
1536 thread_lib="-pthread"
1537 fi
1538 if test "`(uname) 2>/dev/null`" = SunOS; then
1539 threadsafe_flag="-pthreads"
1540 fi
1541 fi
1542 libs_save_old=$LIBS
1543 if test -n "$threadsafe_flag"; then
1544 cflags_save=$CFLAGS
1545 CFLAGS="$CFLAGS $threadsafe_flag"
1546 LIBS="$LIBS $thread_lib"
1547 AC_TRY_LINK(,[ ],
1548 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1549 AC_MSG_RESULT(no); LIBS=$libs_save_old
1550 )
1551 CFLAGS=$cflags_save
1552 else
1553 AC_MSG_RESULT(no)
1554 fi
1555
1556 dnl check that compiling a simple program still works with the flags
1557 dnl added for Python.
1558 AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
1559 cflags_save=$CFLAGS
1560 libs_save=$LIBS
1561 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1562 LIBS="$LIBS $PYTHON3_LIBS"
1563 AC_TRY_LINK(,[ ],
1564 AC_MSG_RESULT(yes); python3_ok=yes,
1565 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1566 CFLAGS=$cflags_save
1567 LIBS=$libs_save
1568 if test "$python3_ok" = yes; then
1569 AC_DEFINE(FEAT_PYTHON3)
1570 else
1571 LIBS=$libs_save_old
1572 PYTHON3_SRC=
1573 PYTHON3_OBJ=
1574 PYTHON3_LIBS=
1575 PYTHON3_CFLAGS=
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001576 fi
1577 fi
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02001578 else
1579 AC_MSG_RESULT(too old)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001580 fi
1581 fi
Bram Moolenaar1612b1a2013-06-14 21:22:39 +02001582 if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then
1583 AC_MSG_ERROR([could not configure python3])
1584 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001585fi
1586
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001587AC_SUBST(PYTHON3_LIBS)
1588AC_SUBST(PYTHON3_CFLAGS)
1589AC_SUBST(PYTHON3_SRC)
1590AC_SUBST(PYTHON3_OBJ)
1591
1592dnl if python2.x and python3.x are enabled one can only link in code
1593dnl with dlopen(), dlsym(), dlclose()
1594if test "$python_ok" = yes && test "$python3_ok" = yes; then
1595 AC_DEFINE(DYNAMIC_PYTHON)
1596 AC_DEFINE(DYNAMIC_PYTHON3)
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001597 AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001598 cflags_save=$CFLAGS
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001599 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001600 libs_save=$LIBS
Bram Moolenaar6fabcbe2011-09-02 12:27:25 +02001601 dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001602 LIBS="-ldl $LIBS"
Bram Moolenaar7db77842014-03-27 17:40:59 +01001603 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001604 #include <dlfcn.h>
1605 /* If this program fails, then RTLD_GLOBAL is needed.
1606 * RTLD_GLOBAL will be used and then it is not possible to
1607 * have both python versions enabled in the same vim instance.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02001608 * Only the first python version used will be switched on.
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001609 */
1610
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001611 int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001612 {
1613 int needed = 0;
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001614 void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001615 if (pylib != 0)
1616 {
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001617 void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001618 void (*init)(void) = dlsym(pylib, "Py_Initialize");
1619 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1620 void (*final)(void) = dlsym(pylib, "Py_Finalize");
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001621 (*pfx)(prefix);
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001622 (*init)();
1623 needed = (*simple)("import termios") == -1;
1624 (*final)();
1625 dlclose(pylib);
1626 }
1627 return !needed;
1628 }
1629
1630 int main(int argc, char** argv)
1631 {
1632 int not_needed = 0;
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001633 if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}"))
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001634 not_needed = 1;
1635 return !not_needed;
Bram Moolenaar7db77842014-03-27 17:40:59 +01001636 }])],
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001637 [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001638
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001639 CFLAGS=$cflags_save
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001640 LIBS=$libs_save
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001641
1642 AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
1643 cflags_save=$CFLAGS
1644 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001645 libs_save=$LIBS
Bram Moolenaar6fabcbe2011-09-02 12:27:25 +02001646 dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001647 LIBS="-ldl $LIBS"
Bram Moolenaar7db77842014-03-27 17:40:59 +01001648 AC_RUN_IFELSE([AC_LANG_SOURCE([
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001649 #include <dlfcn.h>
1650 #include <wchar.h>
1651 /* If this program fails, then RTLD_GLOBAL is needed.
1652 * RTLD_GLOBAL will be used and then it is not possible to
1653 * have both python versions enabled in the same vim instance.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02001654 * Only the first python version used will be switched on.
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001655 */
1656
1657 int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
1658 {
1659 int needed = 0;
Bram Moolenaarba59ddb2016-01-28 15:34:25 +01001660 void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001661 if (pylib != 0)
1662 {
1663 void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
1664 void (*init)(void) = dlsym(pylib, "Py_Initialize");
1665 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1666 void (*final)(void) = dlsym(pylib, "Py_Finalize");
1667 (*pfx)(prefix);
1668 (*init)();
1669 needed = (*simple)("import termios") == -1;
1670 (*final)();
1671 dlclose(pylib);
1672 }
1673 return !needed;
1674 }
1675
1676 int main(int argc, char** argv)
1677 {
1678 int not_needed = 0;
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001679 if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}"))
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001680 not_needed = 1;
1681 return !not_needed;
Bram Moolenaar7db77842014-03-27 17:40:59 +01001682 }])],
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001683 [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1684
1685 CFLAGS=$cflags_save
Bram Moolenaar5d3fbf32015-03-05 16:47:20 +01001686 LIBS=$libs_save
Bram Moolenaar644d37b2010-11-16 19:26:02 +01001687
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001688 PYTHON_SRC="if_python.c"
1689 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001690 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001691 PYTHON_LIBS=
1692 PYTHON3_SRC="if_python3.c"
1693 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001694 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001695 PYTHON3_LIBS=
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001696elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
1697 AC_DEFINE(DYNAMIC_PYTHON)
1698 PYTHON_SRC="if_python.c"
1699 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001700 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001701 PYTHON_LIBS=
Bram Moolenaare741f272013-07-09 21:57:52 +02001702elif test "$python_ok" = yes; then
1703 dnl Check that adding -fPIE works. It may be needed when using a static
1704 dnl Python library.
1705 AC_MSG_CHECKING([if -fPIE can be added for Python])
1706 cflags_save=$CFLAGS
1707 libs_save=$LIBS
1708 CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
1709 LIBS="$LIBS $PYTHON_LIBS"
1710 AC_TRY_LINK(,[ ],
1711 AC_MSG_RESULT(yes); fpie_ok=yes,
1712 AC_MSG_RESULT(no); fpie_ok=no)
1713 CFLAGS=$cflags_save
1714 LIBS=$libs_save
1715 if test $fpie_ok = yes; then
1716 PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
1717 fi
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001718elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
1719 AC_DEFINE(DYNAMIC_PYTHON3)
1720 PYTHON3_SRC="if_python3.c"
1721 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaarcf1b0572014-05-22 14:44:22 +02001722 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
Bram Moolenaarb744b2f2010-08-13 16:22:57 +02001723 PYTHON3_LIBS=
Bram Moolenaare741f272013-07-09 21:57:52 +02001724elif test "$python3_ok" = yes; then
1725 dnl Check that adding -fPIE works. It may be needed when using a static
1726 dnl Python library.
1727 AC_MSG_CHECKING([if -fPIE can be added for Python3])
1728 cflags_save=$CFLAGS
1729 libs_save=$LIBS
1730 CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
1731 LIBS="$LIBS $PYTHON3_LIBS"
1732 AC_TRY_LINK(,[ ],
1733 AC_MSG_RESULT(yes); fpie_ok=yes,
1734 AC_MSG_RESULT(no); fpie_ok=no)
1735 CFLAGS=$cflags_save
1736 LIBS=$libs_save
1737 if test $fpie_ok = yes; then
1738 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
1739 fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001740fi
1741
Bram Moolenaar071d4272004-06-13 20:20:40 +00001742AC_MSG_CHECKING(--enable-tclinterp argument)
1743AC_ARG_ENABLE(tclinterp,
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001744 [ --enable-tclinterp[=OPTS] Include Tcl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001745 [enable_tclinterp="no"])
1746AC_MSG_RESULT($enable_tclinterp)
1747
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001748if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001749
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001750 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001751 AC_MSG_CHECKING(--with-tclsh argument)
1752 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
1753 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001754 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001755 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1756 AC_SUBST(vi_cv_path_tcl)
1757
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001758 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1759 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1760 tclsh_name="tclsh8.4"
1761 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1762 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001763 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001764 tclsh_name="tclsh8.2"
1765 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1766 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001767 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1768 tclsh_name="tclsh8.0"
1769 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1770 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001771 dnl still didn't find it, try without version number
1772 if test "X$vi_cv_path_tcl" = "X"; then
1773 tclsh_name="tclsh"
1774 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1775 fi
1776 if test "X$vi_cv_path_tcl" != "X"; then
1777 AC_MSG_CHECKING(Tcl version)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001778 if echo 'exit [[expr [info tclversion] < 8.0]]' | "$vi_cv_path_tcl" - ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001779 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1780 AC_MSG_RESULT($tclver - OK);
1781 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 +01001782 tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001783
1784 AC_MSG_CHECKING(for location of Tcl include)
Bram Moolenaard0573012017-10-28 21:11:06 +02001785 if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001786 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 +00001787 else
1788 dnl For Mac OS X 10.3, use the OS-provided framework location
1789 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
1790 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001791 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001792 for try in $tclinc; do
1793 if test -f "$try/tcl.h"; then
1794 AC_MSG_RESULT($try/tcl.h)
1795 TCL_INC=$try
1796 break
1797 fi
1798 done
1799 if test -z "$TCL_INC"; then
1800 AC_MSG_RESULT(<not found>)
1801 SKIP_TCL=YES
1802 fi
1803 if test -z "$SKIP_TCL"; then
1804 AC_MSG_CHECKING(for location of tclConfig.sh script)
Bram Moolenaard0573012017-10-28 21:11:06 +02001805 if test "x$MACOS_X" != "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001806 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001807 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001808 else
1809 dnl For Mac OS X 10.3, use the OS-provided framework location
1810 tclcnf="/System/Library/Frameworks/Tcl.framework"
1811 fi
1812 for try in $tclcnf; do
Bram Moolenaar49222be2015-12-11 18:11:30 +01001813 if test -f "$try/tclConfig.sh"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001814 AC_MSG_RESULT($try/tclConfig.sh)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001815 . "$try/tclConfig.sh"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001816 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001817 if test "$enable_tclinterp" = "dynamic"; then
1818 TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"`
1819 else
1820 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1821 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001822 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001823 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +00001824 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 +00001825 break
1826 fi
1827 done
1828 if test -z "$TCL_LIBS"; then
1829 AC_MSG_RESULT(<not found>)
1830 AC_MSG_CHECKING(for Tcl library by myself)
1831 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001832 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001833 for ext in .so .a ; do
1834 for ver in "" $tclver ; do
1835 for try in $tcllib ; do
1836 trylib=tcl$ver$ext
Bram Moolenaar49222be2015-12-11 18:11:30 +01001837 if test -f "$try/lib$trylib" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001838 AC_MSG_RESULT($try/lib$trylib)
Bram Moolenaar49222be2015-12-11 18:11:30 +01001839 TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001840 if test "`(uname) 2>/dev/null`" = SunOS &&
1841 uname -r | grep '^5' >/dev/null; then
1842 TCL_LIBS="$TCL_LIBS -R $try"
1843 fi
1844 break 3
1845 fi
1846 done
1847 done
1848 done
1849 if test -z "$TCL_LIBS"; then
1850 AC_MSG_RESULT(<not found>)
1851 SKIP_TCL=YES
1852 fi
1853 fi
1854 if test -z "$SKIP_TCL"; then
1855 AC_DEFINE(FEAT_TCL)
1856 TCL_SRC=if_tcl.c
1857 TCL_OBJ=objects/if_tcl.o
1858 TCL_PRO=if_tcl.pro
1859 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1860 fi
1861 fi
1862 else
1863 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
1864 fi
1865 fi
Bram Moolenaar8a5115c2016-01-09 19:41:11 +01001866 if test "$enable_tclinterp" = "dynamic"; then
1867 if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then
1868 AC_DEFINE(DYNAMIC_TCL)
1869 TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS"
1870 fi
1871 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001872 if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then
1873 AC_MSG_ERROR([could not configure Tcl])
1874 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001875fi
1876AC_SUBST(TCL_SRC)
1877AC_SUBST(TCL_OBJ)
1878AC_SUBST(TCL_PRO)
1879AC_SUBST(TCL_CFLAGS)
1880AC_SUBST(TCL_LIBS)
1881
1882AC_MSG_CHECKING(--enable-rubyinterp argument)
1883AC_ARG_ENABLE(rubyinterp,
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001884 [ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001885 [enable_rubyinterp="no"])
1886AC_MSG_RESULT($enable_rubyinterp)
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001887if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
Bram Moolenaar0b105412014-11-30 13:34:23 +01001888 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1889 AC_MSG_ERROR([cannot use Ruby with tiny or small features])
1890 fi
1891
Bram Moolenaar165641d2010-02-17 16:23:09 +01001892 AC_MSG_CHECKING(--with-ruby-command argument)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001893 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar948733a2011-05-05 18:10:16 +02001894 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
1895 RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD),
1896 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar165641d2010-02-17 16:23:09 +01001897 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001898 if test "X$vi_cv_path_ruby" != "X"; then
1899 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +00001900 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 +00001901 AC_MSG_RESULT(OK)
Bram Moolenaar81398892012-10-03 21:09:35 +02001902 AC_MSG_CHECKING(Ruby rbconfig)
1903 ruby_rbconfig="RbConfig"
1904 if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then
1905 ruby_rbconfig="Config"
1906 fi
1907 AC_MSG_RESULT($ruby_rbconfig)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001908 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar81398892012-10-03 21:09:35 +02001909 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 +00001910 if test "X$rubyhdrdir" != "X"; then
1911 AC_MSG_RESULT($rubyhdrdir)
1912 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaara6fd37b2014-03-27 17:19:09 +01001913 rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"`
1914 if test -d "$rubyarchdir"; then
1915 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01001916 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02001917 rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
Bram Moolenaar026a4452013-08-07 15:22:23 +02001918 if test "X$rubyversion" = "X"; then
1919 rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"`
1920 fi
Bram Moolenaar165641d2010-02-17 16:23:09 +01001921 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar81398892012-10-03 21:09:35 +02001922 rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001923 if test "X$rubylibs" != "X"; then
1924 RUBY_LIBS="$rubylibs"
1925 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02001926 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"`
1927 librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"`
Bram Moolenaarac499e32013-06-02 19:14:17 +02001928 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"`
Bram Moolenaar948733a2011-05-05 18:10:16 +02001929 if test -f "$rubylibdir/$librubya"; then
1930 librubyarg="$librubyarg"
Bram Moolenaarac499e32013-06-02 19:14:17 +02001931 RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
1932 elif test "$librubyarg" = "libruby.a"; then
1933 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1934 librubyarg="-lruby"
1935 RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001936 fi
1937
1938 if test "X$librubyarg" != "X"; then
1939 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1940 fi
Bram Moolenaar81398892012-10-03 21:09:35 +02001941 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LDFLAGS']]"`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001942 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001943 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1944 dnl be included if requested by passing --with-mac-arch to
1945 dnl configure, so strip these flags first (if present)
Bram Moolenaar5dff57d2010-07-24 16:19:44 +02001946 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001947 if test "X$rubyldflags" != "X"; then
Bram Moolenaar2bcaec32014-03-27 18:51:11 +01001948 if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$rubyldflags\"`" = "X"; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02001949 LDFLAGS="$rubyldflags $LDFLAGS"
1950 fi
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001951 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001952 fi
1953 RUBY_SRC="if_ruby.c"
1954 RUBY_OBJ="objects/if_ruby.o"
1955 RUBY_PRO="if_ruby.pro"
1956 AC_DEFINE(FEAT_RUBY)
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001957 if test "$enable_rubyinterp" = "dynamic"; then
Bram Moolenaar92021622017-10-12 12:33:43 +02001958 libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_ALIASES']].split[[0]]"`
Bram Moolenaar87ea64c2018-08-04 15:13:34 +02001959 if test -z "$libruby_soname"; then
1960 libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
1961 fi
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001962 AC_DEFINE(DYNAMIC_RUBY)
Bram Moolenaar92021622017-10-12 12:33:43 +02001963 RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
Bram Moolenaar3ca71f12010-10-27 16:49:47 +02001964 RUBY_LIBS=
1965 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001966 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001967 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001968 fi
1969 else
1970 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1971 fi
1972 fi
Bram Moolenaarf788a062011-12-14 20:51:25 +01001973
1974 if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then
1975 AC_MSG_ERROR([could not configure Ruby])
1976 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001977fi
1978AC_SUBST(RUBY_SRC)
1979AC_SUBST(RUBY_OBJ)
1980AC_SUBST(RUBY_PRO)
1981AC_SUBST(RUBY_CFLAGS)
1982AC_SUBST(RUBY_LIBS)
1983
1984AC_MSG_CHECKING(--enable-cscope argument)
1985AC_ARG_ENABLE(cscope,
1986 [ --enable-cscope Include cscope interface.], ,
1987 [enable_cscope="no"])
1988AC_MSG_RESULT($enable_cscope)
1989if test "$enable_cscope" = "yes"; then
1990 AC_DEFINE(FEAT_CSCOPE)
1991fi
1992
1993AC_MSG_CHECKING(--enable-workshop argument)
1994AC_ARG_ENABLE(workshop,
1995 [ --enable-workshop Include Sun Visual Workshop support.], ,
1996 [enable_workshop="no"])
1997AC_MSG_RESULT($enable_workshop)
1998if test "$enable_workshop" = "yes"; then
1999 AC_DEFINE(FEAT_SUN_WORKSHOP)
2000 WORKSHOP_SRC="workshop.c integration.c"
2001 AC_SUBST(WORKSHOP_SRC)
2002 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
2003 AC_SUBST(WORKSHOP_OBJ)
2004 if test "${enable_gui-xxx}" = xxx; then
2005 enable_gui=motif
2006 fi
2007fi
2008
2009AC_MSG_CHECKING(--disable-netbeans argument)
2010AC_ARG_ENABLE(netbeans,
2011 [ --disable-netbeans Disable NetBeans integration support.],
2012 , [enable_netbeans="yes"])
2013if test "$enable_netbeans" = "yes"; then
Bram Moolenaar3c124e32016-01-31 14:36:58 +01002014 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
2015 AC_MSG_RESULT([cannot use NetBeans with tiny or small features])
2016 enable_netbeans="no"
2017 else
2018 AC_MSG_RESULT(no)
2019 fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002020else
2021 AC_MSG_RESULT(yes)
2022fi
2023
2024AC_MSG_CHECKING(--disable-channel argument)
2025AC_ARG_ENABLE(channel,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002026 [ --disable-channel Disable process communication support.],
Bram Moolenaare0874f82016-01-24 20:36:41 +01002027 , [enable_channel="yes"])
2028if test "$enable_channel" = "yes"; then
Bram Moolenaar3c124e32016-01-31 14:36:58 +01002029 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
2030 AC_MSG_RESULT([cannot use channels with tiny or small features])
2031 enable_channel="no"
2032 else
2033 AC_MSG_RESULT(no)
2034 fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002035else
2036 if test "$enable_netbeans" = "yes"; then
Bram Moolenaar16435482016-01-24 21:31:54 +01002037 AC_MSG_RESULT([yes, netbeans also disabled])
Bram Moolenaare0874f82016-01-24 20:36:41 +01002038 enable_netbeans="no"
2039 else
2040 AC_MSG_RESULT(yes)
2041 fi
2042fi
2043
Bram Moolenaar16435482016-01-24 21:31:54 +01002044if test "$enable_channel" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002045 dnl On Solaris we need the socket and nsl library.
2046 AC_CHECK_LIB(socket, socket)
2047 AC_CHECK_LIB(nsl, gethostbyname)
Bram Moolenaare0874f82016-01-24 20:36:41 +01002048 AC_MSG_CHECKING(whether compiling with process communication is possible)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002049 AC_TRY_LINK([
2050#include <stdio.h>
2051#include <stdlib.h>
2052#include <stdarg.h>
2053#include <fcntl.h>
2054#include <netdb.h>
2055#include <netinet/in.h>
2056#include <errno.h>
2057#include <sys/types.h>
2058#include <sys/socket.h>
2059 /* Check bitfields */
2060 struct nbbuf {
2061 unsigned int initDone:1;
Bram Moolenaar63de19e2016-12-09 20:11:26 +01002062 unsigned short signmaplen;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002063 };
2064 ], [
2065 /* Check creating a socket. */
2066 struct sockaddr_in server;
2067 (void)socket(AF_INET, SOCK_STREAM, 0);
2068 (void)htons(100);
2069 (void)gethostbyname("microsoft.com");
2070 if (errno == ECONNREFUSED)
2071 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
2072 ],
2073 AC_MSG_RESULT(yes),
Bram Moolenaare0874f82016-01-24 20:36:41 +01002074 AC_MSG_RESULT(no); enable_netbeans="no"; enable_channel="no")
Bram Moolenaar071d4272004-06-13 20:20:40 +00002075fi
2076if test "$enable_netbeans" = "yes"; then
2077 AC_DEFINE(FEAT_NETBEANS_INTG)
2078 NETBEANS_SRC="netbeans.c"
2079 AC_SUBST(NETBEANS_SRC)
2080 NETBEANS_OBJ="objects/netbeans.o"
2081 AC_SUBST(NETBEANS_OBJ)
2082fi
Bram Moolenaare0874f82016-01-24 20:36:41 +01002083if test "$enable_channel" = "yes"; then
Bram Moolenaar509ce2a2016-03-11 22:52:15 +01002084 AC_DEFINE(FEAT_JOB_CHANNEL)
Bram Moolenaare0874f82016-01-24 20:36:41 +01002085 CHANNEL_SRC="channel.c"
2086 AC_SUBST(CHANNEL_SRC)
2087 CHANNEL_OBJ="objects/channel.o"
2088 AC_SUBST(CHANNEL_OBJ)
2089fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002090
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002091AC_MSG_CHECKING(--enable-terminal argument)
2092AC_ARG_ENABLE(terminal,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002093 [ --enable-terminal Enable terminal emulation support.],
Bram Moolenaaref839562017-10-28 20:28:23 +02002094 , [enable_terminal="auto"])
Bram Moolenaar595a4022017-09-03 19:15:57 +02002095if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002096 if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
2097 AC_MSG_RESULT([cannot use terminal emulator with tiny or small features])
2098 enable_terminal="no"
2099 else
Bram Moolenaar595a4022017-09-03 19:15:57 +02002100 if test "$enable_terminal" = "auto"; then
2101 enable_terminal="yes"
2102 AC_MSG_RESULT(defaulting to yes)
2103 else
2104 AC_MSG_RESULT(yes)
2105 fi
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002106 fi
2107else
Bram Moolenaar595a4022017-09-03 19:15:57 +02002108 if test "$enable_terminal" = "auto"; then
2109 enable_terminal="no"
2110 AC_MSG_RESULT(defaulting to no)
2111 else
2112 AC_MSG_RESULT(no)
2113 fi
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002114fi
Bram Moolenaar8b423282017-12-16 14:37:06 +01002115if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then
Bram Moolenaare4f25e42017-07-07 11:54:15 +02002116 AC_DEFINE(FEAT_TERMINAL)
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02002117 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 +02002118 AC_SUBST(TERM_SRC)
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02002119 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 +02002120 AC_SUBST(TERM_OBJ)
2121fi
2122
Bram Moolenaare42a6d22017-11-12 19:21:51 +01002123AC_MSG_CHECKING(--enable-autoservername argument)
2124AC_ARG_ENABLE(autoservername,
2125 [ --enable-autoservername Automatically define servername at vim startup.], ,
2126 [enable_autoservername="no"])
2127AC_MSG_RESULT($enable_autoservername)
2128if test "$enable_autoservername" = "yes"; then
2129 AC_DEFINE(FEAT_AUTOSERVERNAME)
2130fi
2131
Bram Moolenaar071d4272004-06-13 20:20:40 +00002132AC_MSG_CHECKING(--enable-multibyte argument)
2133AC_ARG_ENABLE(multibyte,
2134 [ --enable-multibyte Include multibyte editing support.], ,
2135 [enable_multibyte="no"])
2136AC_MSG_RESULT($enable_multibyte)
2137if test "$enable_multibyte" = "yes"; then
2138 AC_DEFINE(FEAT_MBYTE)
2139fi
2140
Bram Moolenaar5c5697f2018-12-12 20:34:09 +01002141dnl Right-to-Left language support for Vim will be included with big features,
2142dnl unless ENABLE_RIGHTLEFT is undefined.
2143AC_MSG_CHECKING(--disable-rightleft argument)
2144AC_ARG_ENABLE(rightleft,
2145 [ --disable-rightleft Do not include Right-to-Left language support.],
2146 , [enable_rightleft="yes"])
2147if test "$enable_rightleft" = "yes"; then
2148 AC_MSG_RESULT(no)
2149else
2150 AC_MSG_RESULT(yes)
2151 AC_DEFINE(DISABLE_RIGHTLEFT)
2152fi
2153
2154dnl Arabic language support for Vim will be included with big features,
2155dnl unless ENABLE_ARABIC is undefined.
2156AC_MSG_CHECKING(--disable-arabic argument)
2157AC_ARG_ENABLE(arabic,
2158 [ --disable-arabic Do not include Arabic language support.],
2159 , [enable_arabic="yes"])
2160if test "$enable_arabic" = "yes"; then
2161 AC_MSG_RESULT(no)
2162else
2163 AC_MSG_RESULT(yes)
2164 AC_DEFINE(DISABLE_ARABIC)
2165fi
2166
2167dnl Farsi language support for vim will be included with big features,
2168dnl unless ENABLE_FARSI is undefined.
2169AC_MSG_CHECKING(--disable-farsi argument)
2170AC_ARG_ENABLE(farsi,
2171 [ --disable-farsi Do not include Farsi language support.],
2172 , [enable_farsi="yes"])
2173if test "$enable_farsi" = "yes"; then
2174 AC_MSG_RESULT(no)
2175else
2176 AC_MSG_RESULT(yes)
2177 AC_DEFINE(DISABLE_FARSI)
2178fi
2179
Bram Moolenaar071d4272004-06-13 20:20:40 +00002180AC_MSG_CHECKING(--enable-hangulinput argument)
2181AC_ARG_ENABLE(hangulinput,
2182 [ --enable-hangulinput Include Hangul input support.], ,
2183 [enable_hangulinput="no"])
2184AC_MSG_RESULT($enable_hangulinput)
2185
2186AC_MSG_CHECKING(--enable-xim argument)
2187AC_ARG_ENABLE(xim,
2188 [ --enable-xim Include XIM input support.],
2189 AC_MSG_RESULT($enable_xim),
2190 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002191
2192AC_MSG_CHECKING(--enable-fontset argument)
2193AC_ARG_ENABLE(fontset,
2194 [ --enable-fontset Include X fontset output support.], ,
2195 [enable_fontset="no"])
2196AC_MSG_RESULT($enable_fontset)
2197dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
2198
2199test -z "$with_x" && with_x=yes
Bram Moolenaard0573012017-10-28 21:11:06 +02002200test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
Bram Moolenaar071d4272004-06-13 20:20:40 +00002201if test "$with_x" = no; then
2202 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
2203else
2204 dnl Do this check early, so that its failure can override user requests.
2205
2206 AC_PATH_PROG(xmkmfpath, xmkmf)
2207
2208 AC_PATH_XTRA
2209
Bram Moolenaar2c704a72010-06-03 21:17:25 +02002210 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00002211 dnl be compiled with a special option.
2212 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02002213 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002214 CFLAGS="$CFLAGS -W c,dll"
2215 LDFLAGS="$LDFLAGS -W l,dll"
2216 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
2217 fi
2218
2219 dnl On my HPUX system the X include dir is found, but the lib dir not.
2220 dnl This is a desparate try to fix this.
2221
2222 if test -d "$x_includes" && test ! -d "$x_libraries"; then
2223 x_libraries=`echo "$x_includes" | sed s/include/lib/`
2224 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
2225 X_LIBS="$X_LIBS -L$x_libraries"
2226 if test "`(uname) 2>/dev/null`" = SunOS &&
2227 uname -r | grep '^5' >/dev/null; then
2228 X_LIBS="$X_LIBS -R $x_libraries"
2229 fi
2230 fi
2231
2232 if test -d "$x_libraries" && test ! -d "$x_includes"; then
2233 x_includes=`echo "$x_libraries" | sed s/lib/include/`
2234 AC_MSG_RESULT(Corrected X includes to $x_includes)
2235 X_CFLAGS="$X_CFLAGS -I$x_includes"
2236 fi
2237
2238 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
2239 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
2240 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
2241 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
2242 dnl Same for "-R/usr/lib ".
2243 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
2244
2245
2246 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002247 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
2248 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002249 AC_MSG_CHECKING(if X11 header files can be found)
2250 cflags_save=$CFLAGS
2251 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002252 AC_TRY_COMPILE([#include <X11/Xlib.h>
2253#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00002254 AC_MSG_RESULT(yes),
2255 AC_MSG_RESULT(no); no_x=yes)
2256 CFLAGS=$cflags_save
2257
2258 if test "${no_x-no}" = yes; then
2259 with_x=no
2260 else
2261 AC_DEFINE(HAVE_X11)
2262 X_LIB="-lXt -lX11";
2263 AC_SUBST(X_LIB)
2264
2265 ac_save_LDFLAGS="$LDFLAGS"
2266 LDFLAGS="-L$x_libraries $LDFLAGS"
2267
2268 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
2269 dnl For HP-UX 10.20 it must be before -lSM -lICE
2270 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
2271 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
2272
2273 dnl Some systems need -lnsl -lsocket when testing for ICE.
2274 dnl The check above doesn't do this, try here (again). Also needed to get
2275 dnl them after Xdmcp. link.sh will remove them when not needed.
2276 dnl Check for other function than above to avoid the cached value
2277 AC_CHECK_LIB(ICE, IceOpenConnection,
2278 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
2279
2280 dnl Check for -lXpm (needed for some versions of Motif)
2281 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
2282 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
2283 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
2284
2285 dnl Check that the X11 header files don't use implicit declarations
2286 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
2287 cflags_save=$CFLAGS
Bram Moolenaard1864592013-05-04 04:40:15 +02002288 dnl -Werror is GCC only, others like Solaris Studio might not like it
2289 if test "$GCC" = yes; then
2290 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
2291 else
2292 CFLAGS="$CFLAGS $X_CFLAGS"
2293 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002294 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
2295 AC_MSG_RESULT(no),
2296 CFLAGS="$CFLAGS -Wno-implicit-int"
2297 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
2298 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
2299 AC_MSG_RESULT(test failed)
2300 )
2301 )
2302 CFLAGS=$cflags_save
2303
2304 LDFLAGS="$ac_save_LDFLAGS"
2305
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00002306 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
2307 AC_CACHE_VAL(ac_cv_small_wchar_t,
2308 [AC_TRY_RUN([
2309#include <X11/Xlib.h>
2310#if STDC_HEADERS
2311# include <stdlib.h>
2312# include <stddef.h>
2313#endif
2314 main()
2315 {
2316 if (sizeof(wchar_t) <= 2)
2317 exit(1);
2318 exit(0);
2319 }],
2320 ac_cv_small_wchar_t="no",
2321 ac_cv_small_wchar_t="yes",
2322 AC_MSG_ERROR(failed to compile test program))])
2323 AC_MSG_RESULT($ac_cv_small_wchar_t)
2324 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
2325 AC_DEFINE(SMALL_WCHAR_T)
2326 fi
2327
Bram Moolenaar071d4272004-06-13 20:20:40 +00002328 fi
2329fi
2330
Bram Moolenaard2a05492018-07-27 22:35:15 +02002331dnl Check if --with-x was given but it doesn't work.
2332if test "x$with_x" = xno -a "x$with_x_arg" = xyes; then
2333 AC_MSG_ERROR([could not configure X])
2334fi
2335
Bram Moolenaard0573012017-10-28 21:11:06 +02002336test "x$with_x" = xno -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00002337
2338AC_MSG_CHECKING(--enable-gui argument)
2339AC_ARG_ENABLE(gui,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002340 [ --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 +00002341
2342dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
2343dnl Do not use character classes for portability with old tools.
2344enable_gui_canon=`echo "_$enable_gui" | \
2345 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2346
2347dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002348SKIP_GTK2=YES
Bram Moolenaar1858a842016-02-23 22:30:31 +01002349SKIP_GTK3=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002350SKIP_GNOME=YES
2351SKIP_MOTIF=YES
2352SKIP_ATHENA=YES
2353SKIP_NEXTAW=YES
2354SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002355SKIP_CARBON=YES
2356GUITYPE=NONE
2357
Bram Moolenaarb11160e2005-01-04 21:31:43 +00002358if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002359 SKIP_PHOTON=
2360 case "$enable_gui_canon" in
2361 no) AC_MSG_RESULT(no GUI support)
2362 SKIP_PHOTON=YES ;;
2363 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
2364 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
2365 photon) AC_MSG_RESULT(Photon GUI support) ;;
2366 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2367 SKIP_PHOTON=YES ;;
2368 esac
2369
Bram Moolenaard0573012017-10-28 21:11:06 +02002370elif test "x$MACOS_X" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002371 SKIP_CARBON=
2372 case "$enable_gui_canon" in
2373 no) AC_MSG_RESULT(no GUI support)
2374 SKIP_CARBON=YES ;;
2375 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
Bram Moolenaar164fca32010-07-14 13:58:07 +02002376 auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
2377 SKIP_CARBON=YES ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002378 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
2379 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2380 SKIP_CARBON=YES ;;
2381 esac
2382
2383else
2384
Bram Moolenaar071d4272004-06-13 20:20:40 +00002385 case "$enable_gui_canon" in
2386 no|none) AC_MSG_RESULT(no GUI support) ;;
2387 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002388 SKIP_GTK2=
2389 SKIP_GNOME=
2390 SKIP_MOTIF=
2391 SKIP_ATHENA=
2392 SKIP_NEXTAW=
2393 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002394 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002395 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002396 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
2397 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00002398 SKIP_GTK2=;;
Bram Moolenaar98921892016-02-23 17:14:37 +01002399 gtk3) AC_MSG_RESULT(GTK+ 3.x GUI support)
2400 SKIP_GTK3=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002401 motif) AC_MSG_RESULT(Motif GUI support)
2402 SKIP_MOTIF=;;
2403 athena) AC_MSG_RESULT(Athena GUI support)
2404 SKIP_ATHENA=;;
2405 nextaw) AC_MSG_RESULT(neXtaw GUI support)
2406 SKIP_NEXTAW=;;
2407 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
2408 esac
2409
2410fi
2411
Bram Moolenaar071d4272004-06-13 20:20:40 +00002412if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
2413 -a "$enable_gui_canon" != "gnome2"; then
2414 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
2415 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002416 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002417 , enable_gtk2_check="yes")
2418 AC_MSG_RESULT($enable_gtk2_check)
2419 if test "x$enable_gtk2_check" = "xno"; then
2420 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002421 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00002422 fi
2423fi
2424
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002425if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002426 AC_MSG_CHECKING(whether or not to look for GNOME)
2427 AC_ARG_ENABLE(gnome-check,
2428 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
2429 , enable_gnome_check="no")
2430 AC_MSG_RESULT($enable_gnome_check)
2431 if test "x$enable_gnome_check" = "xno"; then
2432 SKIP_GNOME=YES
2433 fi
2434fi
2435
Bram Moolenaar98921892016-02-23 17:14:37 +01002436if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then
2437 AC_MSG_CHECKING(whether or not to look for GTK+ 3)
2438 AC_ARG_ENABLE(gtk3-check,
2439 [ --enable-gtk3-check If auto-select GUI, check for GTK+ 3 [default=yes]],
2440 , enable_gtk3_check="yes")
2441 AC_MSG_RESULT($enable_gtk3_check)
2442 if test "x$enable_gtk3_check" = "xno"; then
2443 SKIP_GTK3=YES
2444 fi
2445fi
2446
Bram Moolenaar071d4272004-06-13 20:20:40 +00002447if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
2448 AC_MSG_CHECKING(whether or not to look for Motif)
2449 AC_ARG_ENABLE(motif-check,
2450 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
2451 , enable_motif_check="yes")
2452 AC_MSG_RESULT($enable_motif_check)
2453 if test "x$enable_motif_check" = "xno"; then
2454 SKIP_MOTIF=YES
2455 fi
2456fi
2457
2458if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
2459 AC_MSG_CHECKING(whether or not to look for Athena)
2460 AC_ARG_ENABLE(athena-check,
2461 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
2462 , enable_athena_check="yes")
2463 AC_MSG_RESULT($enable_athena_check)
2464 if test "x$enable_athena_check" = "xno"; then
2465 SKIP_ATHENA=YES
2466 fi
2467fi
2468
2469if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
2470 AC_MSG_CHECKING(whether or not to look for neXtaw)
2471 AC_ARG_ENABLE(nextaw-check,
2472 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
2473 , enable_nextaw_check="yes")
2474 AC_MSG_RESULT($enable_nextaw_check);
2475 if test "x$enable_nextaw_check" = "xno"; then
2476 SKIP_NEXTAW=YES
2477 fi
2478fi
2479
2480if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
2481 AC_MSG_CHECKING(whether or not to look for Carbon)
2482 AC_ARG_ENABLE(carbon-check,
2483 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
2484 , enable_carbon_check="yes")
2485 AC_MSG_RESULT($enable_carbon_check);
2486 if test "x$enable_carbon_check" = "xno"; then
2487 SKIP_CARBON=YES
2488 fi
2489fi
2490
Bram Moolenaar843ee412004-06-30 16:16:41 +00002491
Bram Moolenaard0573012017-10-28 21:11:06 +02002492if test "x$MACOS_X" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002493 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00002494 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00002495 AC_MSG_RESULT(yes);
2496 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00002497 if test "$VIMNAME" = "vim"; then
2498 VIMNAME=Vim
2499 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00002500
Bram Moolenaar164fca32010-07-14 13:58:07 +02002501 if test "x$MACARCH" = "xboth"; then
2502 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
2503 else
2504 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
2505 fi
2506
Bram Moolenaar14716812006-05-04 21:54:08 +00002507 dnl Default install directory is not /usr/local
2508 if test x$prefix = xNONE; then
2509 prefix=/Applications
2510 fi
2511
2512 dnl Sorry for the hard coded default
2513 datadir='${prefix}/Vim.app/Contents/Resources'
2514
Bram Moolenaar071d4272004-06-13 20:20:40 +00002515 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002516 SKIP_GTK2=YES;
2517 SKIP_GNOME=YES;
2518 SKIP_MOTIF=YES;
2519 SKIP_ATHENA=YES;
2520 SKIP_NEXTAW=YES;
2521 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002522 SKIP_CARBON=YES
2523fi
2524
Bram Moolenaar071d4272004-06-13 20:20:40 +00002525dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002526dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002527dnl
2528dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00002529dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00002530dnl
2531AC_DEFUN(AM_PATH_GTK,
2532[
2533 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
2534 {
Bram Moolenaar071d4272004-06-13 20:20:40 +00002535 no_gtk=""
2536 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2537 && $PKG_CONFIG --exists gtk+-2.0; then
2538 {
Bram Moolenaar98921892016-02-23 17:14:37 +01002539 min_gtk_version=ifelse([$1], ,2.2.0,$1)
2540 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002541 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
2542 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
2543 dnl something like that.
2544 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00002545 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00002546 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
2547 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2548 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2549 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2550 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2551 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2552 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2553 }
Bram Moolenaar98921892016-02-23 17:14:37 +01002554 elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2555 && $PKG_CONFIG --exists gtk+-3.0; then
2556 {
2557 min_gtk_version=ifelse([$1], ,3.0.0,$1)
2558 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2559
2560 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0`
2561 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0`
2562 GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0`
2563 gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2564 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2565 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2566 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2567 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2568 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2569 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00002570 else
2571 no_gtk=yes
2572 fi
2573
2574 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
2575 {
2576 ac_save_CFLAGS="$CFLAGS"
2577 ac_save_LIBS="$LIBS"
2578 CFLAGS="$CFLAGS $GTK_CFLAGS"
2579 LIBS="$LIBS $GTK_LIBS"
2580
2581 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002582 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002583 dnl
2584 rm -f conf.gtktest
2585 AC_TRY_RUN([
2586#include <gtk/gtk.h>
2587#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002588#if STDC_HEADERS
2589# include <stdlib.h>
2590# include <stddef.h>
2591#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002592
2593int
2594main ()
2595{
2596int major, minor, micro;
2597char *tmp_version;
2598
2599system ("touch conf.gtktest");
2600
2601/* HP/UX 9 (%@#!) writes to sscanf strings */
2602tmp_version = g_strdup("$min_gtk_version");
2603if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2604 printf("%s, bad version string\n", "$min_gtk_version");
2605 exit(1);
2606 }
2607
2608if ((gtk_major_version > major) ||
2609 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2610 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
2611 (gtk_micro_version >= micro)))
2612{
2613 return 0;
2614}
2615return 1;
2616}
2617],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2618 CFLAGS="$ac_save_CFLAGS"
2619 LIBS="$ac_save_LIBS"
2620 }
2621 fi
2622 if test "x$no_gtk" = x ; then
2623 if test "x$enable_gtktest" = "xyes"; then
2624 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2625 else
2626 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2627 fi
2628 ifelse([$2], , :, [$2])
2629 else
2630 {
2631 AC_MSG_RESULT(no)
2632 GTK_CFLAGS=""
2633 GTK_LIBS=""
2634 ifelse([$3], , :, [$3])
2635 }
2636 fi
2637 }
2638 else
2639 GTK_CFLAGS=""
2640 GTK_LIBS=""
2641 ifelse([$3], , :, [$3])
2642 fi
2643 AC_SUBST(GTK_CFLAGS)
2644 AC_SUBST(GTK_LIBS)
2645 rm -f conf.gtktest
2646])
2647
2648dnl ---------------------------------------------------------------------------
2649dnl gnome
2650dnl ---------------------------------------------------------------------------
2651AC_DEFUN([GNOME_INIT_HOOK],
2652[
2653 AC_SUBST(GNOME_LIBS)
2654 AC_SUBST(GNOME_LIBDIR)
2655 AC_SUBST(GNOME_INCLUDEDIR)
2656
2657 AC_ARG_WITH(gnome-includes,
2658 [ --with-gnome-includes=DIR Specify location of GNOME headers],
2659 [CFLAGS="$CFLAGS -I$withval"]
2660 )
2661
2662 AC_ARG_WITH(gnome-libs,
2663 [ --with-gnome-libs=DIR Specify location of GNOME libs],
2664 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
2665 )
2666
2667 AC_ARG_WITH(gnome,
2668 [ --with-gnome Specify prefix for GNOME files],
2669 if test x$withval = xyes; then
2670 want_gnome=yes
2671 ifelse([$1], [], :, [$1])
2672 else
2673 if test "x$withval" = xno; then
2674 want_gnome=no
2675 else
2676 want_gnome=yes
2677 LDFLAGS="$LDFLAGS -L$withval/lib"
2678 CFLAGS="$CFLAGS -I$withval/include"
2679 gnome_prefix=$withval/lib
2680 fi
2681 fi,
2682 want_gnome=yes)
2683
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002684 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002685 {
2686 AC_MSG_CHECKING(for libgnomeui-2.0)
2687 if $PKG_CONFIG --exists libgnomeui-2.0; then
2688 AC_MSG_RESULT(yes)
2689 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
2690 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
2691 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00002692
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002693 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
2694 dnl This might not be the right way but it works for me...
2695 AC_MSG_CHECKING(for FreeBSD)
2696 if test "`(uname) 2>/dev/null`" = FreeBSD; then
2697 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00002698 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00002699 GNOME_LIBS="$GNOME_LIBS -pthread"
2700 else
2701 AC_MSG_RESULT(no)
2702 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002703 $1
2704 else
2705 AC_MSG_RESULT(not found)
2706 if test "x$2" = xfail; then
2707 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
2708 fi
2709 fi
2710 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00002711 fi
2712])
2713
2714AC_DEFUN([GNOME_INIT],[
2715 GNOME_INIT_HOOK([],fail)
2716])
2717
2718
2719dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002720dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00002721dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002722if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002723
2724 AC_MSG_CHECKING(--disable-gtktest argument)
2725 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2726 , enable_gtktest=yes)
2727 if test "x$enable_gtktest" = "xyes" ; then
2728 AC_MSG_RESULT(gtk test enabled)
2729 else
2730 AC_MSG_RESULT(gtk test disabled)
2731 fi
2732
Bram Moolenaar071d4272004-06-13 20:20:40 +00002733 if test "X$PKG_CONFIG" = "X"; then
Bram Moolenaard6d30422018-01-28 22:48:55 +01002734 AC_PATH_TOOL(PKG_CONFIG, pkg-config, no)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002735 fi
2736
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002737 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002738 dnl First try finding version 2.2.0 or later. The 2.0.x series has
2739 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002740 AM_PATH_GTK(2.2.0,
2741 [GUI_LIB_LOC="$GTK_LIBDIR"
2742 GTK_LIBNAME="$GTK_LIBS"
2743 GUI_INC_LOC="$GTK_CFLAGS"], )
2744 if test "x$GTK_CFLAGS" != "x"; then
Bram Moolenaar98921892016-02-23 17:14:37 +01002745 SKIP_GTK3=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002746 SKIP_ATHENA=YES
2747 SKIP_NEXTAW=YES
2748 SKIP_MOTIF=YES
2749 GUITYPE=GTK
2750 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002751 fi
2752 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002753 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002754 dnl
2755 dnl if GTK exists, then check for GNOME.
2756 dnl
2757 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002758 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002759 GNOME_INIT_HOOK([have_gnome=yes])
2760 if test "x$have_gnome" = xyes ; then
2761 AC_DEFINE(FEAT_GUI_GNOME)
2762 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
2763 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002764 fi
2765 }
2766 fi
2767 fi
2768fi
2769
Bram Moolenaar98921892016-02-23 17:14:37 +01002770
2771dnl ---------------------------------------------------------------------------
2772dnl Check for GTK3.
2773dnl ---------------------------------------------------------------------------
2774if test -z "$SKIP_GTK3"; then
2775
2776 AC_MSG_CHECKING(--disable-gtktest argument)
2777 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
2778 , enable_gtktest=yes)
2779 if test "x$enable_gtktest" = "xyes" ; then
2780 AC_MSG_RESULT(gtk test enabled)
2781 else
2782 AC_MSG_RESULT(gtk test disabled)
2783 fi
2784
2785 if test "X$PKG_CONFIG" = "X"; then
Bram Moolenaard6d30422018-01-28 22:48:55 +01002786 AC_PATH_TOOL(PKG_CONFIG, pkg-config, no)
Bram Moolenaar98921892016-02-23 17:14:37 +01002787 fi
2788
2789 if test "x$PKG_CONFIG" != "xno"; then
2790 AM_PATH_GTK(3.0.0,
2791 [GUI_LIB_LOC="$GTK_LIBDIR"
2792 GTK_LIBNAME="$GTK_LIBS"
2793 GUI_INC_LOC="$GTK_CFLAGS"], )
2794 if test "x$GTK_CFLAGS" != "x"; then
2795 SKIP_GTK2=YES
2796 SKIP_GNOME=YES
2797 SKIP_ATHENA=YES
2798 SKIP_NEXTAW=YES
2799 SKIP_MOTIF=YES
2800 GUITYPE=GTK
2801 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar98921892016-02-23 17:14:37 +01002802 AC_DEFINE(USE_GTK3)
2803 fi
2804 fi
2805fi
2806
Bram Moolenaard2e03f02016-01-02 22:46:36 +01002807dnl Check the version of Gdk-Pixbuf. If the version is 2.31 or later and
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002808dnl glib-compile-resources is found in PATH, use GResource.
2809if test "x$GUITYPE" = "xGTK"; then
2810 AC_MSG_CHECKING([version of Gdk-Pixbuf])
2811 gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0`
2812 if test "x$gdk_pixbuf_version" != x ; then
2813 gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \
2814 sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'`
2815 if test "x$gdk_pixbuf_version_minor" != x -a \
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002816 $gdk_pixbuf_version_minor -ge 31 ; then
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002817 AC_MSG_RESULT([OK.])
2818 AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
2819 AC_MSG_CHECKING([glib-compile-resources])
2820 if test "x$GLIB_COMPILE_RESOURCES" = xno ; then
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002821 GLIB_COMPILE_RESOURCES=""
2822 AC_MSG_RESULT([cannot be found in PATH.])
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002823 else
2824 AC_MSG_RESULT([usable.])
Bram Moolenaar33c31d52016-02-22 21:07:06 +01002825 AC_DEFINE(USE_GRESOURCE)
2826 GRESOURCE_SRC="auto/gui_gtk_gresources.c"
2827 GRESOURCE_OBJ="objects/gui_gtk_gresources.o"
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002828 fi
2829 else
2830 AC_MSG_RESULT([not usable.])
2831 fi
2832 else
2833 AC_MSG_RESULT([cannot obtain from pkg_config.])
2834 fi
Bram Moolenaar4adfaab2016-04-21 18:20:11 +02002835
2836 AC_MSG_CHECKING([--disable-icon-cache-update argument])
2837 AC_ARG_ENABLE(icon_cache_update,
2838 [ --disable-icon-cache-update update disabled],
2839 [],
2840 [enable_icon_cache_update="yes"])
2841 if test "$enable_icon_cache_update" = "yes"; then
2842 AC_MSG_RESULT([not set])
2843 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no)
2844 if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then
2845 AC_MSG_RESULT([not found in PATH.])
2846 fi
2847 else
2848 AC_MSG_RESULT([update disabled])
2849 fi
2850
2851 AC_MSG_CHECKING([--disable-desktop-database-update argument])
2852 AC_ARG_ENABLE(desktop_database_update,
2853 [ --disable-desktop-database-update update disabled],
2854 [],
2855 [enable_desktop_database_update="yes"])
2856 if test "$enable_desktop_database_update" = "yes"; then
2857 AC_MSG_RESULT([not set])
2858 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no)
2859 if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then
2860 AC_MSG_RESULT([not found in PATH.])
2861 fi
2862 else
2863 AC_MSG_RESULT([update disabled])
2864 fi
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002865fi
2866AC_SUBST(GLIB_COMPILE_RESOURCES)
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002867AC_SUBST(GRESOURCE_SRC)
2868AC_SUBST(GRESOURCE_OBJ)
Bram Moolenaar4adfaab2016-04-21 18:20:11 +02002869AC_SUBST(GTK_UPDATE_ICON_CACHE)
2870AC_SUBST(UPDATE_DESKTOP_DATABASE)
Bram Moolenaar36e294c2015-12-29 18:55:46 +01002871
Bram Moolenaar071d4272004-06-13 20:20:40 +00002872dnl Check for Motif include files location.
2873dnl The LAST one found is used, this makes the highest version to be used,
2874dnl e.g. when Motif1.2 and Motif2.0 are both present.
2875
2876if test -z "$SKIP_MOTIF"; then
2877 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"
2878 dnl Remove "-I" from before $GUI_INC_LOC if it's there
2879 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
2880
2881 AC_MSG_CHECKING(for location of Motif GUI includes)
2882 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
2883 GUI_INC_LOC=
2884 for try in $gui_includes; do
2885 if test -f "$try/Xm/Xm.h"; then
2886 GUI_INC_LOC=$try
2887 fi
2888 done
2889 if test -n "$GUI_INC_LOC"; then
2890 if test "$GUI_INC_LOC" = /usr/include; then
2891 GUI_INC_LOC=
2892 AC_MSG_RESULT(in default path)
2893 else
2894 AC_MSG_RESULT($GUI_INC_LOC)
2895 fi
2896 else
2897 AC_MSG_RESULT(<not found>)
2898 SKIP_MOTIF=YES
2899 fi
2900fi
2901
2902dnl Check for Motif library files location. In the same order as the include
2903dnl files, to avoid a mixup if several versions are present
2904
2905if test -z "$SKIP_MOTIF"; then
2906 AC_MSG_CHECKING(--with-motif-lib argument)
2907 AC_ARG_WITH(motif-lib,
Bram Moolenaar8008b632017-07-18 21:33:20 +02002908 [ --with-motif-lib=STRING Library for Motif ],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002909 [ MOTIF_LIBNAME="${withval}" ] )
2910
2911 if test -n "$MOTIF_LIBNAME"; then
2912 AC_MSG_RESULT($MOTIF_LIBNAME)
2913 GUI_LIB_LOC=
2914 else
2915 AC_MSG_RESULT(no)
2916
2917 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
2918 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
2919
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02002920 dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere. The
2921 dnl linker will figure out which one to use, we only check if one exists.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002922 AC_MSG_CHECKING(for location of Motif GUI libs)
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02002923 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 +00002924 GUI_LIB_LOC=
2925 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00002926 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00002927 if test -f "$libtry"; then
2928 GUI_LIB_LOC=$try
2929 fi
2930 done
2931 done
2932 if test -n "$GUI_LIB_LOC"; then
2933 dnl Remove /usr/lib, it causes trouble on some systems
Bram Moolenaar6324c3b2013-06-17 20:27:18 +02002934 if test "$GUI_LIB_LOC" = /usr/lib \
2935 -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \
2936 -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002937 GUI_LIB_LOC=
2938 AC_MSG_RESULT(in default path)
2939 else
2940 if test -n "$GUI_LIB_LOC"; then
2941 AC_MSG_RESULT($GUI_LIB_LOC)
2942 if test "`(uname) 2>/dev/null`" = SunOS &&
2943 uname -r | grep '^5' >/dev/null; then
2944 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
2945 fi
2946 fi
2947 fi
2948 MOTIF_LIBNAME=-lXm
2949 else
2950 AC_MSG_RESULT(<not found>)
2951 SKIP_MOTIF=YES
2952 fi
2953 fi
2954fi
2955
2956if test -z "$SKIP_MOTIF"; then
2957 SKIP_ATHENA=YES
2958 SKIP_NEXTAW=YES
2959 GUITYPE=MOTIF
2960 AC_SUBST(MOTIF_LIBNAME)
2961fi
2962
2963dnl Check if the Athena files can be found
2964
2965GUI_X_LIBS=
2966
2967if test -z "$SKIP_ATHENA"; then
2968 AC_MSG_CHECKING(if Athena header files can be found)
2969 cflags_save=$CFLAGS
2970 CFLAGS="$CFLAGS $X_CFLAGS"
2971 AC_TRY_COMPILE([
2972#include <X11/Intrinsic.h>
2973#include <X11/Xaw/Paned.h>], ,
2974 AC_MSG_RESULT(yes),
2975 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
2976 CFLAGS=$cflags_save
2977fi
2978
2979if test -z "$SKIP_ATHENA"; then
2980 GUITYPE=ATHENA
2981fi
2982
2983if test -z "$SKIP_NEXTAW"; then
2984 AC_MSG_CHECKING(if neXtaw header files can be found)
2985 cflags_save=$CFLAGS
2986 CFLAGS="$CFLAGS $X_CFLAGS"
2987 AC_TRY_COMPILE([
2988#include <X11/Intrinsic.h>
2989#include <X11/neXtaw/Paned.h>], ,
2990 AC_MSG_RESULT(yes),
2991 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
2992 CFLAGS=$cflags_save
2993fi
2994
2995if test -z "$SKIP_NEXTAW"; then
2996 GUITYPE=NEXTAW
2997fi
2998
2999if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
3000 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
3001 dnl Avoid adding it when it twice
3002 if test -n "$GUI_INC_LOC"; then
3003 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
3004 fi
3005 if test -n "$GUI_LIB_LOC"; then
3006 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
3007 fi
3008
3009 dnl Check for -lXext and then for -lXmu
3010 ldflags_save=$LDFLAGS
3011 LDFLAGS="$X_LIBS $LDFLAGS"
3012 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
3013 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3014 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
3015 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
3016 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3017 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
3018 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3019 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
3020 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3021 if test -z "$SKIP_MOTIF"; then
3022 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
3023 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
3024 fi
3025 LDFLAGS=$ldflags_save
3026
3027 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
3028 AC_MSG_CHECKING(for extra X11 defines)
3029 NARROW_PROTO=
3030 rm -fr conftestdir
3031 if mkdir conftestdir; then
3032 cd conftestdir
3033 cat > Imakefile <<'EOF'
3034acfindx:
3035 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
3036EOF
3037 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
3038 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
3039 fi
3040 cd ..
3041 rm -fr conftestdir
3042 fi
3043 if test -z "$NARROW_PROTO"; then
3044 AC_MSG_RESULT(no)
3045 else
3046 AC_MSG_RESULT($NARROW_PROTO)
3047 fi
3048 AC_SUBST(NARROW_PROTO)
3049fi
3050
3051dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
3052dnl use the X11 include path
3053if test "$enable_xsmp" = "yes"; then
3054 cppflags_save=$CPPFLAGS
3055 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3056 AC_CHECK_HEADERS(X11/SM/SMlib.h)
3057 CPPFLAGS=$cppflags_save
3058fi
3059
3060
Bram Moolenaar98921892016-02-23 17:14:37 +01003061if 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 +00003062 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
3063 cppflags_save=$CPPFLAGS
3064 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3065 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
3066
3067 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
3068 if test ! "$enable_xim" = "no"; then
3069 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
3070 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
3071 AC_MSG_RESULT(yes),
Bram Moolenaare29b1fe2014-04-10 20:00:15 +02003072 AC_MSG_RESULT(no; xim has been disabled); enable_xim="no")
Bram Moolenaar071d4272004-06-13 20:20:40 +00003073 fi
3074 CPPFLAGS=$cppflags_save
3075
3076 dnl automatically enable XIM when hangul input isn't enabled
3077 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
3078 -a "x$GUITYPE" != "xNONE" ; then
3079 AC_MSG_RESULT(X GUI selected; xim has been enabled)
3080 enable_xim="yes"
3081 fi
3082fi
3083
3084if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
3085 cppflags_save=$CPPFLAGS
3086 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00003087dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
3088 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
3089 AC_TRY_COMPILE([
3090#include <X11/Intrinsic.h>
3091#include <X11/Xmu/Editres.h>],
3092 [int i; i = 0;],
3093 AC_MSG_RESULT(yes)
3094 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
3095 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00003096 CPPFLAGS=$cppflags_save
3097fi
3098
3099dnl Only use the Xm directory when compiling Motif, don't use it for Athena
3100if test -z "$SKIP_MOTIF"; then
3101 cppflags_save=$CPPFLAGS
3102 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar77c19352012-06-13 19:19:41 +02003103 if test "$zOSUnix" = "yes"; then
3104 xmheader="Xm/Xm.h"
3105 else
3106 xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02003107 Xm/UnhighlightT.h Xm/Notebook.h"
Bram Moolenaar77c19352012-06-13 19:19:41 +02003108 fi
3109 AC_CHECK_HEADERS($xmheader)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003110
Bram Moolenaar77c19352012-06-13 19:19:41 +02003111 if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003112 dnl Solaris uses XpmAttributes_21, very annoying.
3113 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
3114 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
3115 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
3116 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
3117 )
3118 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00003119 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003120 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003121 CPPFLAGS=$cppflags_save
3122fi
3123
3124if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
3125 AC_MSG_RESULT(no GUI selected; xim has been disabled)
3126 enable_xim="no"
3127fi
3128if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
3129 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
3130 enable_fontset="no"
3131fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02003132if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003133 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
3134 enable_fontset="no"
3135fi
3136
Bram Moolenaar071d4272004-06-13 20:20:40 +00003137if test -z "$SKIP_PHOTON"; then
3138 GUITYPE=PHOTONGUI
3139fi
3140
3141AC_SUBST(GUI_INC_LOC)
3142AC_SUBST(GUI_LIB_LOC)
3143AC_SUBST(GUITYPE)
3144AC_SUBST(GUI_X_LIBS)
3145
3146if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
3147 AC_MSG_ERROR([cannot use workshop without Motif])
3148fi
3149
3150dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
3151if test "$enable_xim" = "yes"; then
3152 AC_DEFINE(FEAT_XIM)
3153fi
3154if test "$enable_fontset" = "yes"; then
3155 AC_DEFINE(FEAT_XFONTSET)
3156fi
3157
3158
3159dnl ---------------------------------------------------------------------------
3160dnl end of GUI-checking
3161dnl ---------------------------------------------------------------------------
3162
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003163AC_MSG_CHECKING([for /proc link to executable])
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003164if test -L "/proc/self/exe"; then
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003165 dnl Linux
3166 AC_MSG_RESULT([/proc/self/exe])
3167 AC_DEFINE(PROC_EXE_LINK, "/proc/self/exe")
3168elif test -L "/proc/self/path/a.out"; then
3169 dnl Solaris
3170 AC_MSG_RESULT([/proc/self/path/a.out])
3171 AC_DEFINE(PROC_EXE_LINK, "/proc/self/path/a.out")
3172elif test -L "/proc/curproc/file"; then
3173 dnl FreeBSD
3174 AC_MSG_RESULT([/proc/curproc/file])
3175 AC_DEFINE(PROC_EXE_LINK, "/proc/curproc/file")
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003176else
Bram Moolenaarf3757f02017-03-16 15:13:45 +01003177 AC_MSG_RESULT(no)
Bram Moolenaar5f69fee2017-03-09 11:58:40 +01003178fi
3179
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003180dnl Check for Cygwin, which needs an extra source file if not using X11
Bram Moolenaar8def26a2015-12-17 15:34:53 +01003181AC_MSG_CHECKING(for CYGWIN or MSYS environment)
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003182case `uname` in
Bram Moolenaar8def26a2015-12-17 15:34:53 +01003183 CYGWIN*|MSYS*) CYGWIN=yes; AC_MSG_RESULT(yes)
Bram Moolenaar693e40c2013-02-26 14:56:42 +01003184 AC_MSG_CHECKING(for CYGWIN clipboard support)
3185 if test "x$with_x" = "xno" ; then
3186 OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o
3187 AC_MSG_RESULT(yes)
3188 AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD)
3189 else
3190 AC_MSG_RESULT(no - using X11)
3191 fi ;;
3192
3193 *) CYGWIN=no; AC_MSG_RESULT(no);;
3194esac
Bram Moolenaar071d4272004-06-13 20:20:40 +00003195
3196dnl Only really enable hangul input when GUI and XFONTSET are available
3197if test "$enable_hangulinput" = "yes"; then
3198 if test "x$GUITYPE" = "xNONE"; then
3199 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
3200 enable_hangulinput=no
3201 else
3202 AC_DEFINE(FEAT_HANGULIN)
3203 HANGULIN_SRC=hangulin.c
3204 AC_SUBST(HANGULIN_SRC)
3205 HANGULIN_OBJ=objects/hangulin.o
3206 AC_SUBST(HANGULIN_OBJ)
3207 fi
3208fi
3209
3210dnl Checks for libraries and include files.
3211
Bram Moolenaar446cb832008-06-24 21:56:24 +00003212AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
3213 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003214 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003215#include "confdefs.h"
3216#include <ctype.h>
3217#if STDC_HEADERS
3218# include <stdlib.h>
3219# include <stddef.h>
3220#endif
3221main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003222 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003223 vim_cv_toupper_broken=yes
3224 ],[
3225 vim_cv_toupper_broken=no
3226 ],[
3227 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
3228 ])])
3229
3230if test "x$vim_cv_toupper_broken" = "xyes" ; then
3231 AC_DEFINE(BROKEN_TOUPPER)
3232fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003233
3234AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003235AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003236 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
3237 AC_MSG_RESULT(no))
3238
Bram Moolenaar0c094b92009-05-14 20:20:33 +00003239AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
3240AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
3241 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
3242 AC_MSG_RESULT(no))
3243
Bram Moolenaar071d4272004-06-13 20:20:40 +00003244dnl Checks for header files.
3245AC_CHECK_HEADER(elf.h, HAS_ELF=1)
3246dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
3247if test "$HAS_ELF" = 1; then
3248 AC_CHECK_LIB(elf, main)
3249fi
3250
3251AC_HEADER_DIRENT
3252
Bram Moolenaar071d4272004-06-13 20:20:40 +00003253dnl If sys/wait.h is not found it might still exist but not be POSIX
3254dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
3255if test $ac_cv_header_sys_wait_h = no; then
3256 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
3257 AC_TRY_COMPILE([#include <sys/wait.h>],
3258 [union wait xx, yy; xx = yy],
3259 AC_MSG_RESULT(yes)
3260 AC_DEFINE(HAVE_SYS_WAIT_H)
3261 AC_DEFINE(HAVE_UNION_WAIT),
3262 AC_MSG_RESULT(no))
3263fi
3264
Bram Moolenaar779a7752016-01-30 23:26:34 +01003265AC_CHECK_HEADERS(stdint.h stdlib.h string.h \
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003266 sys/select.h sys/utsname.h termcap.h fcntl.h \
3267 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
3268 termio.h iconv.h inttypes.h langinfo.h math.h \
3269 unistd.h stropts.h errno.h sys/resource.h \
3270 sys/systeminfo.h locale.h sys/stream.h termios.h \
3271 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
3272 utime.h sys/param.h libintl.h libgen.h \
3273 util/debug.h util/msg18n.h frame.h sys/acl.h \
3274 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003275
Bram Moolenaar00ca2842008-06-26 20:14:00 +00003276dnl sys/ptem.h depends on sys/stream.h on Solaris
3277AC_CHECK_HEADERS(sys/ptem.h, [], [],
3278[#if defined HAVE_SYS_STREAM_H
3279# include <sys/stream.h>
3280#endif])
3281
Bram Moolenaar32f31b12009-05-21 13:20:59 +00003282dnl sys/sysctl.h depends on sys/param.h on OpenBSD
3283AC_CHECK_HEADERS(sys/sysctl.h, [], [],
3284[#if defined HAVE_SYS_PARAM_H
3285# include <sys/param.h>
3286#endif])
3287
Bram Moolenaar00ca2842008-06-26 20:14:00 +00003288
Bram Moolenaardf3267e2005-01-25 22:07:05 +00003289dnl pthread_np.h may exist but can only be used after including pthread.h
3290AC_MSG_CHECKING([for pthread_np.h])
3291AC_TRY_COMPILE([
3292#include <pthread.h>
3293#include <pthread_np.h>],
3294 [int i; i = 0;],
3295 AC_MSG_RESULT(yes)
3296 AC_DEFINE(HAVE_PTHREAD_NP_H),
3297 AC_MSG_RESULT(no))
3298
Bram Moolenaare344bea2005-09-01 20:46:49 +00003299AC_CHECK_HEADERS(strings.h)
Bram Moolenaard0573012017-10-28 21:11:06 +02003300if test "x$MACOS_X" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +00003301 dnl The strings.h file on OS/X contains a warning and nothing useful.
3302 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3303else
Bram Moolenaar071d4272004-06-13 20:20:40 +00003304
3305dnl Check if strings.h and string.h can both be included when defined.
3306AC_MSG_CHECKING([if strings.h can be included after string.h])
3307cppflags_save=$CPPFLAGS
3308CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3309AC_TRY_COMPILE([
3310#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
3311# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
3312 /* but don't do it on AIX 5.1 (Uribarri) */
3313#endif
3314#ifdef HAVE_XM_XM_H
3315# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
3316#endif
3317#ifdef HAVE_STRING_H
3318# include <string.h>
3319#endif
3320#if defined(HAVE_STRINGS_H)
3321# include <strings.h>
3322#endif
3323 ], [int i; i = 0;],
3324 AC_MSG_RESULT(yes),
3325 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3326 AC_MSG_RESULT(no))
3327CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00003328fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003329
3330dnl Checks for typedefs, structures, and compiler characteristics.
3331AC_PROG_GCC_TRADITIONAL
3332AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00003333AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00003334AC_TYPE_MODE_T
3335AC_TYPE_OFF_T
3336AC_TYPE_PID_T
3337AC_TYPE_SIZE_T
3338AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02003339AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003340
Bram Moolenaar071d4272004-06-13 20:20:40 +00003341AC_HEADER_TIME
3342AC_CHECK_TYPE(ino_t, long)
3343AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02003344AC_C_BIGENDIAN(,,,)
Bram Moolenaar136f29a2016-02-27 20:14:15 +01003345AC_C_INLINE
Bram Moolenaar071d4272004-06-13 20:20:40 +00003346
3347AC_MSG_CHECKING(for rlim_t)
3348if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
3349 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
3350else
3351 AC_EGREP_CPP(dnl
3352changequote(<<,>>)dnl
3353<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
3354changequote([,]),
3355 [
3356#include <sys/types.h>
3357#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003358# include <stdlib.h>
3359# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003360#endif
3361#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00003362# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003363#endif
3364 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
3365 AC_MSG_RESULT($ac_cv_type_rlim_t)
3366fi
3367if test $ac_cv_type_rlim_t = no; then
3368 cat >> confdefs.h <<\EOF
3369#define rlim_t unsigned long
3370EOF
3371fi
3372
3373AC_MSG_CHECKING(for stack_t)
3374if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
3375 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
3376else
3377 AC_EGREP_CPP(stack_t,
3378 [
3379#include <sys/types.h>
3380#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003381# include <stdlib.h>
3382# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003383#endif
3384#include <signal.h>
3385 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
3386 AC_MSG_RESULT($ac_cv_type_stack_t)
3387fi
3388if test $ac_cv_type_stack_t = no; then
3389 cat >> confdefs.h <<\EOF
3390#define stack_t struct sigaltstack
3391EOF
3392fi
3393
3394dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
3395AC_MSG_CHECKING(whether stack_t has an ss_base field)
3396AC_TRY_COMPILE([
3397#include <sys/types.h>
3398#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00003399# include <stdlib.h>
3400# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003401#endif
3402#include <signal.h>
3403#include "confdefs.h"
3404 ], [stack_t sigstk; sigstk.ss_base = 0; ],
3405 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
3406 AC_MSG_RESULT(no))
3407
3408olibs="$LIBS"
3409AC_MSG_CHECKING(--with-tlib argument)
3410AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
3411if test -n "$with_tlib"; then
3412 AC_MSG_RESULT($with_tlib)
3413 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003414 AC_MSG_CHECKING(for linking with $with_tlib library)
3415 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
3416 dnl Need to check for tgetent() below.
3417 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003418else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003419 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003420 dnl On HP-UX 10.10 termcap or termlib should be used instead of
3421 dnl curses, because curses is much slower.
Bram Moolenaar4e509b62011-02-09 17:42:57 +01003422 dnl Newer versions of ncurses are preferred over anything, except
Bram Moolenaar8f4ba692011-05-05 17:24:27 +02003423 dnl when tinfo has been split off, it contains all we need.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003424 dnl Older versions of ncurses have bugs, get a new one!
3425 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00003426 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00003427 case "`uname -s 2>/dev/null`" in
Bram Moolenaar4e509b62011-02-09 17:42:57 +01003428 OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";;
3429 *) tlibs="tinfo ncurses termlib termcap curses";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00003430 esac
3431 for libname in $tlibs; do
3432 AC_CHECK_LIB(${libname}, tgetent,,)
3433 if test "x$olibs" != "x$LIBS"; then
3434 dnl It's possible that a library is found but it doesn't work
3435 dnl e.g., shared library that cannot be found
3436 dnl compile and run a test program to be sure
3437 AC_TRY_RUN([
3438#ifdef HAVE_TERMCAP_H
3439# include <termcap.h>
3440#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003441#if STDC_HEADERS
3442# include <stdlib.h>
3443# include <stddef.h>
3444#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003445main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
3446 res="OK", res="FAIL", res="FAIL")
3447 if test "$res" = "OK"; then
3448 break
3449 fi
3450 AC_MSG_RESULT($libname library is not usable)
3451 LIBS="$olibs"
3452 fi
3453 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003454 if test "x$olibs" = "x$LIBS"; then
3455 AC_MSG_RESULT(no terminal library found)
3456 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003457fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003458
3459if test "x$olibs" = "x$LIBS"; then
3460 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00003461 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00003462 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
3463 AC_MSG_RESULT(yes),
3464 AC_MSG_ERROR([NOT FOUND!
3465 You need to install a terminal library; for example ncurses.
3466 Or specify the name of the library with --with-tlib.]))
3467fi
3468
Bram Moolenaar446cb832008-06-24 21:56:24 +00003469AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
3470 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003471 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003472#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003473#ifdef HAVE_TERMCAP_H
3474# include <termcap.h>
3475#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003476#ifdef HAVE_STRING_H
3477# include <string.h>
3478#endif
3479#if STDC_HEADERS
3480# include <stdlib.h>
3481# include <stddef.h>
3482#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003483main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00003484{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003485 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003486 vim_cv_terminfo=no
3487 ],[
3488 vim_cv_terminfo=yes
3489 ],[
3490 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
3491 ])
3492 ])
3493
3494if test "x$vim_cv_terminfo" = "xyes" ; then
3495 AC_DEFINE(TERMINFO)
3496fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003497
Bram Moolenaara88254f2017-11-02 23:04:14 +01003498AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgetent],
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003499 [
3500 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003501#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003502#ifdef HAVE_TERMCAP_H
3503# include <termcap.h>
3504#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00003505#if STDC_HEADERS
3506# include <stdlib.h>
3507# include <stddef.h>
3508#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003509main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00003510{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003511 ]])],[
Bram Moolenaara88254f2017-11-02 23:04:14 +01003512 vim_cv_tgetent=zero
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003513 ],[
Bram Moolenaara88254f2017-11-02 23:04:14 +01003514 vim_cv_tgetent=non-zero
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003515 ],[
3516 AC_MSG_ERROR(failed to compile test program.)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003517 ])
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003518 ])
3519
Bram Moolenaara88254f2017-11-02 23:04:14 +01003520if test "x$vim_cv_tgetent" = "xzero" ; then
Bram Moolenaar696cbd22017-04-28 15:45:46 +02003521 AC_DEFINE(TGETENT_ZERO_ERR, 0)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003522fi
3523
3524AC_MSG_CHECKING(whether termcap.h contains ospeed)
3525AC_TRY_LINK([
3526#ifdef HAVE_TERMCAP_H
3527# include <termcap.h>
3528#endif
3529 ], [ospeed = 20000],
3530 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
3531 [AC_MSG_RESULT(no)
3532 AC_MSG_CHECKING(whether ospeed can be extern)
3533 AC_TRY_LINK([
3534#ifdef HAVE_TERMCAP_H
3535# include <termcap.h>
3536#endif
3537extern short ospeed;
3538 ], [ospeed = 20000],
3539 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
3540 AC_MSG_RESULT(no))]
3541 )
3542
3543AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
3544AC_TRY_LINK([
3545#ifdef HAVE_TERMCAP_H
3546# include <termcap.h>
3547#endif
3548 ], [if (UP == 0 && BC == 0) PC = 1],
3549 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
3550 [AC_MSG_RESULT(no)
3551 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
3552 AC_TRY_LINK([
3553#ifdef HAVE_TERMCAP_H
3554# include <termcap.h>
3555#endif
3556extern char *UP, *BC, PC;
3557 ], [if (UP == 0 && BC == 0) PC = 1],
3558 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
3559 AC_MSG_RESULT(no))]
3560 )
3561
3562AC_MSG_CHECKING(whether tputs() uses outfuntype)
3563AC_TRY_COMPILE([
3564#ifdef HAVE_TERMCAP_H
3565# include <termcap.h>
3566#endif
3567 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
3568 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
3569 AC_MSG_RESULT(no))
3570
3571dnl On some SCO machines sys/select redefines struct timeval
3572AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
3573AC_TRY_COMPILE([
3574#include <sys/types.h>
3575#include <sys/time.h>
3576#include <sys/select.h>], ,
3577 AC_MSG_RESULT(yes)
3578 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
3579 AC_MSG_RESULT(no))
3580
3581dnl AC_DECL_SYS_SIGLIST
3582
3583dnl Checks for pty.c (copied from screen) ==========================
3584AC_MSG_CHECKING(for /dev/ptc)
3585if test -r /dev/ptc; then
3586 AC_DEFINE(HAVE_DEV_PTC)
3587 AC_MSG_RESULT(yes)
3588else
3589 AC_MSG_RESULT(no)
3590fi
3591
3592AC_MSG_CHECKING(for SVR4 ptys)
3593if test -c /dev/ptmx ; then
3594 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
3595 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
3596 AC_MSG_RESULT(no))
3597else
3598 AC_MSG_RESULT(no)
3599fi
3600
3601AC_MSG_CHECKING(for ptyranges)
3602if test -d /dev/ptym ; then
3603 pdir='/dev/ptym'
3604else
3605 pdir='/dev'
3606fi
3607dnl SCO uses ptyp%d
3608AC_EGREP_CPP(yes,
3609[#ifdef M_UNIX
3610 yes;
3611#endif
3612 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
3613dnl if test -c /dev/ptyp19; then
3614dnl ptys=`echo /dev/ptyp??`
3615dnl else
3616dnl ptys=`echo $pdir/pty??`
3617dnl fi
3618if test "$ptys" != "$pdir/pty??" ; then
3619 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
3620 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
3621 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
3622 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
3623 AC_MSG_RESULT([$p0 / $p1])
3624else
3625 AC_MSG_RESULT([don't know])
3626fi
3627
3628dnl **** pty mode/group handling ****
3629dnl
3630dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00003631rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00003632AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
3633 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003634 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003635#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003636#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00003637#if STDC_HEADERS
3638# include <stdlib.h>
3639# include <stddef.h>
3640#endif
3641#ifdef HAVE_UNISTD_H
3642#include <unistd.h>
3643#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003644#include <sys/stat.h>
3645#include <stdio.h>
3646main()
3647{
3648 struct stat sb;
3649 char *x,*ttyname();
3650 int om, m;
3651 FILE *fp;
3652
3653 if (!(x = ttyname(0))) exit(1);
3654 if (stat(x, &sb)) exit(1);
3655 om = sb.st_mode;
3656 if (om & 002) exit(0);
3657 m = system("mesg y");
3658 if (m == -1 || m == 127) exit(1);
3659 if (stat(x, &sb)) exit(1);
3660 m = sb.st_mode;
3661 if (chmod(x, om)) exit(1);
3662 if (m & 002) exit(0);
3663 if (sb.st_gid == getgid()) exit(1);
3664 if (!(fp=fopen("conftest_grp", "w")))
3665 exit(1);
3666 fprintf(fp, "%d\n", sb.st_gid);
3667 fclose(fp);
3668 exit(0);
3669}
Bram Moolenaar7db77842014-03-27 17:40:59 +01003670 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003671 if test -f conftest_grp; then
3672 vim_cv_tty_group=`cat conftest_grp`
3673 if test "x$vim_cv_tty_mode" = "x" ; then
3674 vim_cv_tty_mode=0620
3675 fi
3676 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
3677 else
3678 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00003679 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00003680 fi
3681 ],[
3682 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00003683 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00003684 ],[
3685 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
3686 ])
3687 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003688rm -f conftest_grp
3689
Bram Moolenaar446cb832008-06-24 21:56:24 +00003690if test "x$vim_cv_tty_group" != "xworld" ; then
3691 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
3692 if test "x$vim_cv_tty_mode" = "x" ; then
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02003693 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 +00003694 else
3695 AC_DEFINE(PTYMODE, 0620)
3696 fi
3697fi
3698
Bram Moolenaar071d4272004-06-13 20:20:40 +00003699dnl Checks for library functions. ===================================
3700
3701AC_TYPE_SIGNAL
3702
3703dnl find out what to use at the end of a signal function
3704if test $ac_cv_type_signal = void; then
3705 AC_DEFINE(SIGRETURN, [return])
3706else
3707 AC_DEFINE(SIGRETURN, [return 0])
3708fi
3709
3710dnl check if struct sigcontext is defined (used for SGI only)
3711AC_MSG_CHECKING(for struct sigcontext)
3712AC_TRY_COMPILE([
3713#include <signal.h>
3714test_sig()
3715{
3716 struct sigcontext *scont;
3717 scont = (struct sigcontext *)0;
3718 return 1;
3719} ], ,
3720 AC_MSG_RESULT(yes)
3721 AC_DEFINE(HAVE_SIGCONTEXT),
3722 AC_MSG_RESULT(no))
3723
3724dnl tricky stuff: try to find out if getcwd() is implemented with
3725dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00003726AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
3727 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003728 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003729#include "confdefs.h"
3730#ifdef HAVE_UNISTD_H
3731#include <unistd.h>
3732#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003733char *dagger[] = { "IFS=pwd", 0 };
3734main()
3735{
3736 char buffer[500];
3737 extern char **environ;
3738 environ = dagger;
3739 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00003740}
Bram Moolenaar7db77842014-03-27 17:40:59 +01003741 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003742 vim_cv_getcwd_broken=no
3743 ],[
3744 vim_cv_getcwd_broken=yes
3745 ],[
3746 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
3747 ])
3748 ])
3749
3750if test "x$vim_cv_getcwd_broken" = "xyes" ; then
3751 AC_DEFINE(BAD_GETCWD)
3752fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003753
Bram Moolenaar25153e12010-02-24 14:47:08 +01003754dnl Check for functions in one big call, to reduce the size of configure.
3755dnl Can only be used for functions that do not require any include.
Bram Moolenaarcd142e32017-11-16 17:03:45 +01003756AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \
Bram Moolenaarb129a442016-12-01 17:25:20 +01003757 getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat \
Bram Moolenaareaf03392009-11-17 11:08:52 +00003758 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar2fcf6682017-03-11 20:03:42 +01003759 getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaarbb09ceb2016-10-18 16:27:23 +02003760 sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00003761 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
Bram Moolenaar137374f2018-05-13 15:59:50 +02003762 usleep utime utimes mblen ftruncate unsetenv)
Bram Moolenaar643b6142018-09-12 20:29:09 +02003763AC_FUNC_SELECT_ARGTYPES
Bram Moolenaar25153e12010-02-24 14:47:08 +01003764AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00003765
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02003766dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
3767dnl appropriate, so that off_t is 64 bits when needed.
3768AC_SYS_LARGEFILE
3769
Bram Moolenaar071d4272004-06-13 20:20:40 +00003770dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
3771AC_MSG_CHECKING(for st_blksize)
3772AC_TRY_COMPILE(
3773[#include <sys/types.h>
3774#include <sys/stat.h>],
3775[ struct stat st;
3776 int n;
3777
3778 stat("/", &st);
3779 n = (int)st.st_blksize;],
3780 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
3781 AC_MSG_RESULT(no))
3782
Bram Moolenaar446cb832008-06-24 21:56:24 +00003783AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
3784 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01003785 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003786#include "confdefs.h"
3787#if STDC_HEADERS
3788# include <stdlib.h>
3789# include <stddef.h>
3790#endif
3791#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003792#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00003793main() {struct stat st; exit(stat("configure/", &st) != 0); }
Bram Moolenaar7db77842014-03-27 17:40:59 +01003794 ]])],[
Bram Moolenaar446cb832008-06-24 21:56:24 +00003795 vim_cv_stat_ignores_slash=yes
3796 ],[
3797 vim_cv_stat_ignores_slash=no
3798 ],[
3799 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
3800 ])
3801 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003802
Bram Moolenaar446cb832008-06-24 21:56:24 +00003803if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
3804 AC_DEFINE(STAT_IGNORES_SLASH)
3805fi
3806
Bram Moolenaar071d4272004-06-13 20:20:40 +00003807dnl Link with iconv for charset translation, if not found without library.
3808dnl check for iconv() requires including iconv.h
3809dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
3810dnl has been installed.
3811AC_MSG_CHECKING(for iconv_open())
3812save_LIBS="$LIBS"
3813LIBS="$LIBS -liconv"
3814AC_TRY_LINK([
3815#ifdef HAVE_ICONV_H
3816# include <iconv.h>
3817#endif
3818 ], [iconv_open("fr", "to");],
3819 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
3820 LIBS="$save_LIBS"
3821 AC_TRY_LINK([
3822#ifdef HAVE_ICONV_H
3823# include <iconv.h>
3824#endif
3825 ], [iconv_open("fr", "to");],
3826 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
3827 AC_MSG_RESULT(no)))
3828
3829
3830AC_MSG_CHECKING(for nl_langinfo(CODESET))
3831AC_TRY_LINK([
3832#ifdef HAVE_LANGINFO_H
3833# include <langinfo.h>
3834#endif
3835], [char *cs = nl_langinfo(CODESET);],
3836 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
3837 AC_MSG_RESULT(no))
3838
Bram Moolenaar446cb832008-06-24 21:56:24 +00003839dnl Need various functions for floating point support. Only enable
3840dnl floating point when they are all present.
3841AC_CHECK_LIB(m, strtod)
3842AC_MSG_CHECKING([for strtod() and other floating point functions])
3843AC_TRY_LINK([
3844#ifdef HAVE_MATH_H
3845# include <math.h>
3846#endif
3847#if STDC_HEADERS
3848# include <stdlib.h>
3849# include <stddef.h>
3850#endif
3851], [char *s; double d;
3852 d = strtod("1.1", &s);
3853 d = fabs(1.11);
3854 d = ceil(1.11);
3855 d = floor(1.11);
3856 d = log10(1.11);
3857 d = pow(1.11, 2.22);
3858 d = sqrt(1.11);
3859 d = sin(1.11);
3860 d = cos(1.11);
3861 d = atan(1.11);
3862 ],
3863 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
3864 AC_MSG_RESULT(no))
3865
Bram Moolenaara6b89762016-02-29 21:38:26 +01003866dnl isinf() and isnan() need to include header files and may need -lm.
3867AC_MSG_CHECKING([for isinf()])
3868AC_TRY_LINK([
3869#ifdef HAVE_MATH_H
3870# include <math.h>
3871#endif
3872#if STDC_HEADERS
3873# include <stdlib.h>
3874# include <stddef.h>
3875#endif
3876], [int r = isinf(1.11); ],
3877 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISINF),
3878 AC_MSG_RESULT(no))
3879
3880AC_MSG_CHECKING([for isnan()])
3881AC_TRY_LINK([
3882#ifdef HAVE_MATH_H
3883# include <math.h>
3884#endif
3885#if STDC_HEADERS
3886# include <stdlib.h>
3887# include <stddef.h>
3888#endif
3889], [int r = isnan(1.11); ],
3890 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISNAN),
3891 AC_MSG_RESULT(no))
3892
Bram Moolenaar071d4272004-06-13 20:20:40 +00003893dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
3894dnl when -lacl works, also try to use -lattr (required for Debian).
Bram Moolenaar8d462f92012-02-05 22:51:33 +01003895dnl On Solaris, use the acl_get/set functions in libsec, if present.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003896AC_MSG_CHECKING(--disable-acl argument)
3897AC_ARG_ENABLE(acl,
Bram Moolenaard6d30422018-01-28 22:48:55 +01003898 [ --disable-acl No check for ACL support.],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003899 , [enable_acl="yes"])
3900if test "$enable_acl" = "yes"; then
Bram Moolenaard6d30422018-01-28 22:48:55 +01003901 AC_MSG_RESULT(no)
3902 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
Bram Moolenaar071d4272004-06-13 20:20:40 +00003903 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
3904 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
3905
Bram Moolenaard6d30422018-01-28 22:48:55 +01003906 AC_MSG_CHECKING(for POSIX ACL support)
3907 AC_TRY_LINK([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003908#include <sys/types.h>
3909#ifdef HAVE_SYS_ACL_H
3910# include <sys/acl.h>
3911#endif
3912acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
3913 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
3914 acl_free(acl);],
3915 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
3916 AC_MSG_RESULT(no))
3917
Bram Moolenaard6d30422018-01-28 22:48:55 +01003918 AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)],
3919 AC_MSG_CHECKING(for Solaris ACL support)
3920 AC_TRY_LINK([
Bram Moolenaar071d4272004-06-13 20:20:40 +00003921#ifdef HAVE_SYS_ACL_H
3922# include <sys/acl.h>
3923#endif], [acl("foo", GETACLCNT, 0, NULL);
3924 ],
3925 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
Bram Moolenaar8d462f92012-02-05 22:51:33 +01003926 AC_MSG_RESULT(no)))
Bram Moolenaar071d4272004-06-13 20:20:40 +00003927
Bram Moolenaard6d30422018-01-28 22:48:55 +01003928 AC_MSG_CHECKING(for AIX ACL support)
3929 AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00003930#if STDC_HEADERS
3931# include <stdlib.h>
3932# include <stddef.h>
3933#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003934#ifdef HAVE_SYS_ACL_H
3935# include <sys/acl.h>
3936#endif
3937#ifdef HAVE_SYS_ACCESS_H
3938# include <sys/access.h>
3939#endif
3940#define _ALL_SOURCE
3941
3942#include <sys/stat.h>
3943
3944int aclsize;
3945struct acl *aclent;], [aclsize = sizeof(struct acl);
3946 aclent = (void *)malloc(aclsize);
3947 statacl("foo", STX_NORMAL, aclent, aclsize);
3948 ],
3949 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
3950 AC_MSG_RESULT(no))
3951else
3952 AC_MSG_RESULT(yes)
3953fi
3954
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02003955if test "x$GTK_CFLAGS" != "x"; then
3956 dnl pango_shape_full() is new, fall back to pango_shape().
3957 AC_MSG_CHECKING(for pango_shape_full)
3958 ac_save_CFLAGS="$CFLAGS"
3959 ac_save_LIBS="$LIBS"
3960 CFLAGS="$CFLAGS $GTK_CFLAGS"
3961 LIBS="$LIBS $GTK_LIBS"
Bram Moolenaar5325b9b2015-09-09 20:27:02 +02003962 AC_TRY_LINK(
Bram Moolenaar3cbe0c02015-09-08 20:00:22 +02003963 [#include <gtk/gtk.h>],
3964 [ pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); ],
3965 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PANGO_SHAPE_FULL),
3966 AC_MSG_RESULT(no))
3967 CFLAGS="$ac_save_CFLAGS"
3968 LIBS="$ac_save_LIBS"
3969fi
3970
Bram Moolenaar071d4272004-06-13 20:20:40 +00003971AC_MSG_CHECKING(--disable-gpm argument)
3972AC_ARG_ENABLE(gpm,
3973 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
3974 [enable_gpm="yes"])
3975
3976if test "$enable_gpm" = "yes"; then
3977 AC_MSG_RESULT(no)
3978 dnl Checking if gpm support can be compiled
3979 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
3980 [olibs="$LIBS" ; LIBS="-lgpm"]
3981 AC_TRY_LINK(
3982 [#include <gpm.h>
3983 #include <linux/keyboard.h>],
3984 [Gpm_GetLibVersion(NULL);],
3985 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
3986 dnl FEAT_MOUSE_GPM if mouse support is included
3987 [vi_cv_have_gpm=yes],
3988 [vi_cv_have_gpm=no])
3989 [LIBS="$olibs"]
3990 )
3991 if test $vi_cv_have_gpm = yes; then
3992 LIBS="$LIBS -lgpm"
3993 AC_DEFINE(HAVE_GPM)
3994 fi
3995else
3996 AC_MSG_RESULT(yes)
3997fi
3998
Bram Moolenaar446cb832008-06-24 21:56:24 +00003999AC_MSG_CHECKING(--disable-sysmouse argument)
4000AC_ARG_ENABLE(sysmouse,
Bram Moolenaar8008b632017-07-18 21:33:20 +02004001 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
Bram Moolenaar446cb832008-06-24 21:56:24 +00004002 [enable_sysmouse="yes"])
4003
4004if test "$enable_sysmouse" = "yes"; then
4005 AC_MSG_RESULT(no)
4006 dnl Checking if sysmouse support can be compiled
4007 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
4008 dnl defines FEAT_SYSMOUSE if mouse support is included
4009 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
4010 AC_TRY_LINK(
4011 [#include <sys/consio.h>
4012 #include <signal.h>
4013 #include <sys/fbio.h>],
4014 [struct mouse_info mouse;
4015 mouse.operation = MOUSE_MODE;
4016 mouse.operation = MOUSE_SHOW;
4017 mouse.u.mode.mode = 0;
4018 mouse.u.mode.signal = SIGUSR2;],
4019 [vi_cv_have_sysmouse=yes],
4020 [vi_cv_have_sysmouse=no])
4021 )
4022 if test $vi_cv_have_sysmouse = yes; then
4023 AC_DEFINE(HAVE_SYSMOUSE)
4024 fi
4025else
4026 AC_MSG_RESULT(yes)
4027fi
4028
Bram Moolenaarf05da212009-11-17 16:13:15 +00004029dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
4030AC_MSG_CHECKING(for FD_CLOEXEC)
4031AC_TRY_COMPILE(
4032[#if HAVE_FCNTL_H
4033# include <fcntl.h>
4034#endif],
4035[ int flag = FD_CLOEXEC;],
4036 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
4037 AC_MSG_RESULT(not usable))
4038
Bram Moolenaar071d4272004-06-13 20:20:40 +00004039dnl rename needs to be checked separately to work on Nextstep with cc
4040AC_MSG_CHECKING(for rename)
4041AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
4042 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
4043 AC_MSG_RESULT(no))
4044
4045dnl sysctl() may exist but not the arguments we use
4046AC_MSG_CHECKING(for sysctl)
4047AC_TRY_COMPILE(
4048[#include <sys/types.h>
4049#include <sys/sysctl.h>],
4050[ int mib[2], r;
4051 size_t len;
4052
4053 mib[0] = CTL_HW;
4054 mib[1] = HW_USERMEM;
4055 len = sizeof(r);
4056 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
4057 ],
4058 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
4059 AC_MSG_RESULT(not usable))
4060
4061dnl sysinfo() may exist but not be Linux compatible
4062AC_MSG_CHECKING(for sysinfo)
4063AC_TRY_COMPILE(
4064[#include <sys/types.h>
4065#include <sys/sysinfo.h>],
4066[ struct sysinfo sinfo;
4067 int t;
4068
4069 (void)sysinfo(&sinfo);
4070 t = sinfo.totalram;
4071 ],
4072 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
4073 AC_MSG_RESULT(not usable))
4074
Bram Moolenaar914572a2007-05-01 11:37:47 +00004075dnl struct sysinfo may have the mem_unit field or not
4076AC_MSG_CHECKING(for sysinfo.mem_unit)
4077AC_TRY_COMPILE(
4078[#include <sys/types.h>
4079#include <sys/sysinfo.h>],
4080[ struct sysinfo sinfo;
Bram Moolenaar3c7ad012013-06-11 19:53:45 +02004081 sinfo.mem_unit = 1;
Bram Moolenaar914572a2007-05-01 11:37:47 +00004082 ],
4083 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
4084 AC_MSG_RESULT(no))
4085
Bram Moolenaar071d4272004-06-13 20:20:40 +00004086dnl sysconf() may exist but not support what we want to use
4087AC_MSG_CHECKING(for sysconf)
4088AC_TRY_COMPILE(
4089[#include <unistd.h>],
4090[ (void)sysconf(_SC_PAGESIZE);
4091 (void)sysconf(_SC_PHYS_PAGES);
4092 ],
4093 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
4094 AC_MSG_RESULT(not usable))
4095
Bram Moolenaar914703b2010-05-31 21:59:46 +02004096AC_CHECK_SIZEOF([int])
4097AC_CHECK_SIZEOF([long])
4098AC_CHECK_SIZEOF([time_t])
4099AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02004100
Bram Moolenaara2aa31a2014-02-23 22:52:40 +01004101dnl Use different names to avoid clashing with other header files.
4102AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int])
4103AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long])
4104
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004105dnl Make sure that uint32_t is really 32 bits unsigned.
4106AC_MSG_CHECKING([uint32_t is 32 bits])
4107AC_TRY_RUN([
4108#ifdef HAVE_STDINT_H
4109# include <stdint.h>
4110#endif
4111#ifdef HAVE_INTTYPES_H
4112# include <inttypes.h>
4113#endif
4114main() {
4115 uint32_t nr1 = (uint32_t)-1;
4116 uint32_t nr2 = (uint32_t)0xffffffffUL;
4117 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
4118 exit(0);
4119}],
4120AC_MSG_RESULT(ok),
4121AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
Bram Moolenaar323cb952011-12-14 19:22:34 +01004122AC_MSG_WARN([cannot check uint32_t when cross-compiling.]))
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02004123
Bram Moolenaar446cb832008-06-24 21:56:24 +00004124dnl Check for memmove() before bcopy(), makes memmove() be used when both are
4125dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
4126
Bram Moolenaar071d4272004-06-13 20:20:40 +00004127[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00004128#include "confdefs.h"
4129#ifdef HAVE_STRING_H
4130# include <string.h>
4131#endif
4132#if STDC_HEADERS
4133# include <stdlib.h>
4134# include <stddef.h>
4135#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00004136main() {
4137 char buf[10];
4138 strcpy(buf, "abcdefghi");
4139 mch_memmove(buf, buf + 2, 3);
4140 if (strncmp(buf, "ababcf", 6))
4141 exit(1);
4142 strcpy(buf, "abcdefghi");
4143 mch_memmove(buf + 2, buf, 3);
4144 if (strncmp(buf, "cdedef", 6))
4145 exit(1);
4146 exit(0); /* libc version works properly. */
4147}']
4148
Bram Moolenaar446cb832008-06-24 21:56:24 +00004149AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
4150 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004151 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 +00004152 [
4153 vim_cv_memmove_handles_overlap=yes
4154 ],[
4155 vim_cv_memmove_handles_overlap=no
4156 ],[
4157 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
4158 ])
4159 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00004160
Bram Moolenaar446cb832008-06-24 21:56:24 +00004161if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
4162 AC_DEFINE(USEMEMMOVE)
4163else
4164 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
4165 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004166 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 +00004167 [
4168 vim_cv_bcopy_handles_overlap=yes
4169 ],[
4170 vim_cv_bcopy_handles_overlap=no
4171 ],[
4172 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
4173 ])
4174 ])
4175
4176 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
4177 AC_DEFINE(USEBCOPY)
4178 else
4179 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
4180 [
Bram Moolenaar7db77842014-03-27 17:40:59 +01004181 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 +00004182 [
4183 vim_cv_memcpy_handles_overlap=yes
4184 ],[
4185 vim_cv_memcpy_handles_overlap=no
4186 ],[
4187 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
4188 ])
4189 ])
4190
4191 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
4192 AC_DEFINE(USEMEMCPY)
4193 fi
4194 fi
4195fi
4196
Bram Moolenaar071d4272004-06-13 20:20:40 +00004197
4198dnl Check for multibyte locale functions
4199dnl Find out if _Xsetlocale() is supported by libX11.
4200dnl Check if X_LOCALE should be defined.
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004201if test "x$with_x" = "xyes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004202 cflags_save=$CFLAGS
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004203 libs_save=$LIBS
4204 LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS"
4205 CFLAGS="$CFLAGS $X_CFLAGS"
4206
4207 AC_MSG_CHECKING(whether X_LOCALE needed)
4208 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
4209 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
4210 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
4211 AC_MSG_RESULT(no))
4212
4213 AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used)
4214 AC_TRY_LINK_FUNC([Xutf8SetWMProperties], [AC_MSG_RESULT(yes)
4215 AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no))
4216
Bram Moolenaar071d4272004-06-13 20:20:40 +00004217 CFLAGS=$cflags_save
Bram Moolenaarcbc246a2014-10-11 14:47:26 +02004218 LIBS=$libs_save
Bram Moolenaar071d4272004-06-13 20:20:40 +00004219fi
4220
4221dnl Link with xpg4, it is said to make Korean locale working
4222AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
4223
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00004224dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar8f4ba692011-05-05 17:24:27 +02004225dnl Use --version to detect Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00004226dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004227dnl -t for typedefs (many ctags have this)
4228dnl -s for static functions (Elvis ctags only?)
4229dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
4230dnl -i+m to test for older Exuberant ctags
4231AC_MSG_CHECKING(how to create tags)
4232test -f tags && mv tags tags.save
Bram Moolenaar5897e0c2011-05-10 15:42:03 +02004233if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00004234 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar5897e0c2011-05-10 15:42:03 +02004235elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
4236 TAGPRG="exctags -I INIT+ --fields=+S"
4237elif (eval exuberant-ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
4238 TAGPRG="exuberant-ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004239else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00004240 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004241 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
4242 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
4243 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
4244 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
4245 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
4246 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
4247 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
4248fi
4249test -f tags.save && mv tags.save tags
4250AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
4251
4252dnl Check how we can run man with a section number
4253AC_MSG_CHECKING(how to run man with a section nr)
4254MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00004255(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 +00004256AC_MSG_RESULT($MANDEF)
4257if test "$MANDEF" = "man -s"; then
4258 AC_DEFINE(USEMAN_S)
4259fi
4260
4261dnl Check if gettext() is working and if it needs -lintl
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004262dnl We take care to base this on an empty LIBS: on some systems libelf would be
4263dnl in LIBS and implicitly take along libintl. The final LIBS would then not
4264dnl contain libintl, and the link step would fail due to -Wl,--as-needed.
Bram Moolenaar071d4272004-06-13 20:20:40 +00004265AC_MSG_CHECKING(--disable-nls argument)
4266AC_ARG_ENABLE(nls,
4267 [ --disable-nls Don't support NLS (gettext()).], ,
4268 [enable_nls="yes"])
4269
4270if test "$enable_nls" = "yes"; then
4271 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00004272
4273 INSTALL_LANGS=install-languages
4274 AC_SUBST(INSTALL_LANGS)
4275 INSTALL_TOOL_LANGS=install-tool-languages
4276 AC_SUBST(INSTALL_TOOL_LANGS)
4277
Bram Moolenaar071d4272004-06-13 20:20:40 +00004278 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
4279 AC_MSG_CHECKING([for NLS])
4280 if test -f po/Makefile; then
4281 have_gettext="no"
4282 if test -n "$MSGFMT"; then
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004283 olibs=$LIBS
4284 LIBS=""
Bram Moolenaar071d4272004-06-13 20:20:40 +00004285 AC_TRY_LINK(
4286 [#include <libintl.h>],
4287 [gettext("Test");],
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004288 AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs,
4289 LIBS="-lintl"
Bram Moolenaar071d4272004-06-13 20:20:40 +00004290 AC_TRY_LINK(
4291 [#include <libintl.h>],
4292 [gettext("Test");],
Bram Moolenaar49b6a572013-11-17 20:32:54 +01004293 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes";
4294 LIBS="$olibs -lintl",
Bram Moolenaar071d4272004-06-13 20:20:40 +00004295 AC_MSG_RESULT([gettext() doesn't work]);
4296 LIBS=$olibs))
4297 else
4298 AC_MSG_RESULT([msgfmt not found - disabled]);
4299 fi
Bram Moolenaar278eb582014-07-30 13:22:52 +02004300 if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004301 AC_DEFINE(HAVE_GETTEXT)
4302 MAKEMO=yes
4303 AC_SUBST(MAKEMO)
4304 dnl this was added in GNU gettext 0.10.36
4305 AC_CHECK_FUNCS(bind_textdomain_codeset)
4306 dnl _nl_msg_cat_cntr is required for GNU gettext
4307 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
4308 AC_TRY_LINK(
4309 [#include <libintl.h>
4310 extern int _nl_msg_cat_cntr;],
4311 [++_nl_msg_cat_cntr;],
4312 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
4313 AC_MSG_RESULT([no]))
4314 fi
4315 else
4316 AC_MSG_RESULT([no "po/Makefile" - disabled]);
4317 fi
4318else
4319 AC_MSG_RESULT(yes)
4320fi
4321
4322dnl Check for dynamic linking loader
4323AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
4324if test x${DLL} = xdlfcn.h; then
4325 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
4326 AC_MSG_CHECKING([for dlopen()])
4327 AC_TRY_LINK(,[
4328 extern void* dlopen();
4329 dlopen();
4330 ],
4331 AC_MSG_RESULT(yes);
4332 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4333 AC_MSG_RESULT(no);
4334 AC_MSG_CHECKING([for dlopen() in -ldl])
4335 olibs=$LIBS
4336 LIBS="$LIBS -ldl"
4337 AC_TRY_LINK(,[
4338 extern void* dlopen();
4339 dlopen();
4340 ],
4341 AC_MSG_RESULT(yes);
4342 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4343 AC_MSG_RESULT(no);
4344 LIBS=$olibs))
4345 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
4346 dnl ick :-)
4347 AC_MSG_CHECKING([for dlsym()])
4348 AC_TRY_LINK(,[
4349 extern void* dlsym();
4350 dlsym();
4351 ],
4352 AC_MSG_RESULT(yes);
4353 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4354 AC_MSG_RESULT(no);
4355 AC_MSG_CHECKING([for dlsym() in -ldl])
4356 olibs=$LIBS
4357 LIBS="$LIBS -ldl"
4358 AC_TRY_LINK(,[
4359 extern void* dlsym();
4360 dlsym();
4361 ],
4362 AC_MSG_RESULT(yes);
4363 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4364 AC_MSG_RESULT(no);
4365 LIBS=$olibs))
4366elif test x${DLL} = xdl.h; then
4367 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
4368 AC_MSG_CHECKING([for shl_load()])
4369 AC_TRY_LINK(,[
4370 extern void* shl_load();
4371 shl_load();
4372 ],
4373 AC_MSG_RESULT(yes);
4374 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4375 AC_MSG_RESULT(no);
4376 AC_MSG_CHECKING([for shl_load() in -ldld])
4377 olibs=$LIBS
4378 LIBS="$LIBS -ldld"
4379 AC_TRY_LINK(,[
4380 extern void* shl_load();
4381 shl_load();
4382 ],
4383 AC_MSG_RESULT(yes);
4384 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4385 AC_MSG_RESULT(no);
4386 LIBS=$olibs))
4387fi
4388AC_CHECK_HEADERS(setjmp.h)
4389
Bram Moolenaard0573012017-10-28 21:11:06 +02004390if test "x$MACOS_X" = "xyes" -a -n "$PERL"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00004391 dnl -ldl must come after DynaLoader.a
4392 if echo $LIBS | grep -e '-ldl' >/dev/null; then
4393 LIBS=`echo $LIBS | sed s/-ldl//`
4394 PERL_LIBS="$PERL_LIBS -ldl"
4395 fi
4396fi
4397
Bram Moolenaard0573012017-10-28 21:11:06 +02004398if test "$MACOS_X" = "yes"; then
4399 AC_MSG_CHECKING([whether we need macOS frameworks])
4400 if test "$GUITYPE" = "CARBONGUI"; then
4401 AC_MSG_RESULT([yes, we need Carbon])
4402 LIBS="$LIBS -framework Carbon"
4403 elif test "$MACOS_X_DARWIN" = "yes"; then
4404 if test "$features" = "tiny"; then
4405 dnl Since no FEAT_CLIPBOARD, no longer need for os_macosx.m.
4406 OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'`
4407 OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'`
4408 if test "$enable_multibyte" = "yes"; then
4409 AC_MSG_RESULT([yes, we need CoreServices])
4410 LIBS="$LIBS -framework CoreServices"
4411 else
4412 dnl Since no FEAT_MBYTE, no longer need for os_mac_conv.c.
4413 AC_MSG_RESULT([no])
4414 OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_mac_conv.c++'`
4415 OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_mac_conv.o++'`
4416 CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's+-DMACOS_X_DARWIN++'`
4417 fi
4418 else
4419 AC_MSG_RESULT([yes, we need AppKit])
4420 LIBS="$LIBS -framework AppKit"
4421 if test "$features" = "small" -a "$enable_multibyte" = "no"; then
4422 dnl Since FEAT_CLIPBOARD is to be defined in vim.h for FEAT_SMALL, define
4423 dnl FEAT_MBYTE in order not to compromise the interoperability of the
4424 dnl clipboard.
4425 AC_MSG_NOTICE([+multi_byte will be set in favor of +clipboard])
4426 enable_multibyte=yes
4427 AC_DEFINE(FEAT_MBYTE)
4428 fi
4429 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004430 else
Bram Moolenaard0573012017-10-28 21:11:06 +02004431 AC_MSG_RESULT([no])
Bram Moolenaar3437b912013-07-03 19:52:53 +02004432 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004433fi
Bram Moolenaar164fca32010-07-14 13:58:07 +02004434if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01004435 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00004436fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00004437
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004438dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
4439dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
4440dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00004441dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
4442dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004443DEPEND_CFLAGS_FILTER=
4444if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004445 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00004446 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00004447 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004448 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004449 AC_MSG_RESULT(yes)
4450 else
4451 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004452 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004453 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
4454 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00004455 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaaraeabe052011-12-08 15:17:34 +01004456 dnl And undefine it first to avoid a warning.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00004457 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
4458 if test "$gccmajor" -gt "3"; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02004459 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 +00004460 AC_MSG_RESULT(yes)
4461 else
4462 AC_MSG_RESULT(no)
4463 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00004464fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00004465AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00004466
Bram Moolenaarec0557f2018-01-31 14:41:37 +01004467dnl On some systems AC_SYS_LARGEFILE determines that -D_FILE_OFFSET_BITS=64
4468dnl isn't required, but the CFLAGS for some of the libraries we're using
4469dnl include the define. Since the define changes the size of some datatypes
4470dnl (e.g. ino_t and off_t), all of Vim's modules must be compiled with a
4471dnl consistent value. It's therefore safest to force the use of the define
4472dnl if it's present in any of the *_CFLAGS variables.
4473AC_MSG_CHECKING(whether we need to force -D_FILE_OFFSET_BITS=64)
Bram Moolenaar9ce42132018-04-11 22:19:36 +02004474if 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 +01004475 AC_MSG_RESULT(yes)
4476 AC_DEFINE(_FILE_OFFSET_BITS, 64)
4477else
4478 AC_MSG_RESULT(no)
4479fi
4480
Bram Moolenaar22e193d2010-11-03 22:32:24 +01004481dnl link.sh tries to avoid overlinking in a hackish way.
4482dnl At least GNU ld supports --as-needed which provides the same functionality
4483dnl at linker level. Let's use it.
4484AC_MSG_CHECKING(linker --as-needed support)
4485LINK_AS_NEEDED=
4486# Check if linker supports --as-needed and --no-as-needed options
4487if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
Bram Moolenaara6cc0312013-06-18 23:31:55 +02004488 LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'`
Bram Moolenaar22e193d2010-11-03 22:32:24 +01004489 LINK_AS_NEEDED=yes
4490fi
4491if test "$LINK_AS_NEEDED" = yes; then
4492 AC_MSG_RESULT(yes)
4493else
4494 AC_MSG_RESULT(no)
4495fi
4496AC_SUBST(LINK_AS_NEEDED)
4497
Bram Moolenaar77c19352012-06-13 19:19:41 +02004498# IBM z/OS reset CFLAGS for config.mk
4499if test "$zOSUnix" = "yes"; then
4500 CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
4501fi
4502
Bram Moolenaar071d4272004-06-13 20:20:40 +00004503dnl write output files
4504AC_OUTPUT(auto/config.mk:config.mk.in)
4505
4506dnl vim: set sw=2 tw=78 fo+=l: