blob: 0492eb08dd48b915aded463591882e7a2dabb11d [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001dnl configure.in: autoconf script for Vim
2
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.
14AC_PROG_CC dnl required by almost everything
15AC_PROG_CPP dnl required by header file checks
16AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
17AC_ISC_POSIX dnl required by AC_C_CROSS
18AC_PROG_AWK dnl required for "make html" in ../doc
19
20dnl Don't strip if we don't have it
21AC_CHECK_PROG(STRIP, strip, strip, :)
22
Bram Moolenaar325b7a22004-07-05 15:58:32 +000023dnl Check for extension of executables
Bram Moolenaar071d4272004-06-13 20:20:40 +000024AC_EXEEXT
25
Bram Moolenaar446cb832008-06-24 21:56:24 +000026dnl Check for standard headers. We don't use this in Vim but other stuff
27dnl in autoconf needs it, where it uses STDC_HEADERS.
28AC_HEADER_STDC
29AC_HEADER_SYS_WAIT
30
Bram Moolenaar071d4272004-06-13 20:20:40 +000031dnl Set default value for CFLAGS if none is defined or it's empty
32if test -z "$CFLAGS"; then
33 CFLAGS="-O"
34 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
35fi
36if test "$GCC" = yes; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +000037 dnl method that should work for nearly all versions
38 gccversion=`"$CC" -dumpversion`
39 if test "x$gccversion" = "x"; then
40 dnl old method; fall-back for when -dumpversion doesn't work
41 gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
42 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +000043 dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
44 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +000045 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +000046 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
47 else
48 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
49 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
50 CFLAGS="$CFLAGS -fno-strength-reduce"
51 fi
52 fi
53fi
54
Bram Moolenaar446cb832008-06-24 21:56:24 +000055dnl If configure thinks we are cross compiling, there might be something
56dnl wrong with the CC or CFLAGS settings, give a useful warning message
Bram Moolenaar071d4272004-06-13 20:20:40 +000057if test "$cross_compiling" = yes; then
Bram Moolenaar446cb832008-06-24 21:56:24 +000058 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
Bram Moolenaar071d4272004-06-13 20:20:40 +000059fi
60
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000061dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
62dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +000063test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
64
65if test -f ./toolcheck; then
66 AC_CHECKING(for buggy tools)
67 sh ./toolcheck 1>&AC_FD_MSG
68fi
69
70OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
71
72dnl Check for BeOS, which needs an extra source file
73AC_MSG_CHECKING(for BeOS)
74case `uname` in
75 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
76 BEOS=yes; AC_MSG_RESULT(yes);;
77 *) BEOS=no; AC_MSG_RESULT(no);;
78esac
79
80dnl If QNX is found, assume we don't want to use Xphoton
81dnl unless it was specifically asked for (--with-x)
82AC_MSG_CHECKING(for QNX)
83case `uname` in
84 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
85 test -z "$with_x" && with_x=no
86 QNX=yes; AC_MSG_RESULT(yes);;
87 *) QNX=no; AC_MSG_RESULT(no);;
88esac
89
90dnl Check for Darwin and MacOS X
91dnl We do a check for MacOS X in the very beginning because there
92dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +000093AC_MSG_CHECKING([for Darwin (Mac OS X)])
94if test "`(uname) 2>/dev/null`" = Darwin; then
95 AC_MSG_RESULT(yes)
96
97 AC_MSG_CHECKING(--disable-darwin argument)
98 AC_ARG_ENABLE(darwin,
99 [ --disable-darwin Disable Darwin (Mac OS X) support.],
100 , [enable_darwin="yes"])
101 if test "$enable_darwin" = "yes"; then
102 AC_MSG_RESULT(no)
103 AC_MSG_CHECKING(if Darwin files are there)
Bram Moolenaar164fca32010-07-14 13:58:07 +0200104 if test -f os_macosx.m; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105 AC_MSG_RESULT(yes)
106 else
107 AC_MSG_RESULT([no, Darwin support disabled])
108 enable_darwin=no
109 fi
110 else
111 AC_MSG_RESULT([yes, Darwin support excluded])
112 fi
113
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000114 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000115 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000116 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000117 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000118
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100119 AC_MSG_CHECKING(--with-developer-dir argument)
120 AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
121 DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
122 DEVELOPER_DIR=""; AC_MSG_RESULT(not present))
123
124 if test "x$DEVELOPER_DIR" = "x"; then
125 AC_PATH_PROG(XCODE_SELECT, xcode-select)
126 if test "x$XCODE_SELECT" != "x"; then
127 AC_MSG_CHECKING(for developer dir using xcode-select)
128 DEVELOPER_DIR=`$XCODE_SELECT -print-path`
129 AC_MSG_RESULT([$DEVELOPER_DIR])
130 else
131 DEVELOPER_DIR=/Developer
132 fi
133 fi
134
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000135 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000136 AC_MSG_CHECKING(for 10.4 universal SDK)
137 dnl There is a terrible inconsistency (but we appear to get away with it):
138 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
139 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
140 dnl tests using the preprocessor are actually done with the wrong header
141 dnl files. $LDFLAGS is set at the end, because configure uses it together
142 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000143 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000144 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000145 save_ldflags="$LDFLAGS"
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100146 CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000147 AC_TRY_LINK([ ], [ ],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000148 AC_MSG_RESULT(found, will make universal binary),
149
150 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000151 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000152 AC_MSG_CHECKING(if Intel architecture is supported)
153 CPPFLAGS="$CPPFLAGS -arch i386"
154 LDFLAGS="$save_ldflags -arch i386"
155 AC_TRY_LINK([ ], [ ],
156 AC_MSG_RESULT(yes); MACARCH="intel",
157 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000158 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000159 CPPFLAGS="$save_cppflags -arch ppc"
160 LDFLAGS="$save_ldflags -arch ppc"))
161 elif test "x$MACARCH" = "xintel"; then
162 CPPFLAGS="$CPPFLAGS -arch intel"
163 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000164 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000165 CPPFLAGS="$CPPFLAGS -arch ppc"
166 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000167 fi
168
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169 if test "$enable_darwin" = "yes"; then
170 MACOSX=yes
Bram Moolenaar164fca32010-07-14 13:58:07 +0200171 OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000172 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000173 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000174 CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175
176 dnl If Carbon is found, assume we don't want X11
177 dnl unless it was specifically asked for (--with-x)
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000178 dnl or Motif, Athena or GTK GUI is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000179 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
180 if test "x$CARBON" = "xyes"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +0200181 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000182 with_x=no
Bram Moolenaar071d4272004-06-13 20:20:40 +0000183 fi
184 fi
185 fi
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000186
Bram Moolenaardb552d602006-03-23 22:59:57 +0000187 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000188 dnl free. This happens in expand_filename(), because the optimizer swaps
Bram Moolenaardb552d602006-03-23 22:59:57 +0000189 dnl two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000190 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
191 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
192 fi
193
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194else
195 AC_MSG_RESULT(no)
196fi
197
198AC_SUBST(OS_EXTRA_SRC)
199AC_SUBST(OS_EXTRA_OBJ)
200
201dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
202dnl Only when the directory exists and it wasn't there yet.
203dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000204dnl Skip all of this when cross-compiling.
205if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000206 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000207 have_local_include=''
208 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000209 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
210 --without-local-dir do not search /usr/local for local libraries.], [
211 local_dir="$withval"
212 case "$withval" in
213 */*) ;;
214 no)
215 # avoid adding local dir to LDFLAGS and CPPFLAGS
Bram Moolenaare06c1882010-07-21 22:05:20 +0200216 have_local_include=yes
Bram Moolenaarc236c162008-07-13 17:41:49 +0000217 have_local_lib=yes
218 ;;
219 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
220 esac
221 AC_MSG_RESULT($local_dir)
222 ], [
223 local_dir=/usr/local
224 AC_MSG_RESULT(Defaulting to $local_dir)
225 ])
226 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000227 echo 'void f(){}' > conftest.c
228 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
Bram Moolenaarc236c162008-07-13 17:41:49 +0000229 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
230 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000231 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000233 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
234 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 +0000235 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000236 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000237 fi
238 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000239 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
240 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 +0000241 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000242 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000243 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244 fi
245fi
246
247AC_MSG_CHECKING(--with-vim-name argument)
248AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
249 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000250 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251AC_SUBST(VIMNAME)
252AC_MSG_CHECKING(--with-ex-name argument)
253AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
254 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
255 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
256AC_SUBST(EXNAME)
257AC_MSG_CHECKING(--with-view-name argument)
258AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
259 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
260 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
261AC_SUBST(VIEWNAME)
262
263AC_MSG_CHECKING(--with-global-runtime argument)
264AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
265 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
266 AC_MSG_RESULT(no))
267
268AC_MSG_CHECKING(--with-modified-by argument)
269AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
270 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
271 AC_MSG_RESULT(no))
272
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200273dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000274AC_MSG_CHECKING(if character set is EBCDIC)
275AC_TRY_COMPILE([ ],
276[ /* TryCompile function for CharSet.
277 Treat any failure as ASCII for compatibility with existing art.
278 Use compile-time rather than run-time tests for cross-compiler
279 tolerance. */
280#if '0'!=240
281make an error "Character set is not EBCDIC"
282#endif ],
283[ # TryCompile action if true
284cf_cv_ebcdic=yes ],
285[ # TryCompile action if false
286cf_cv_ebcdic=no])
287# end of TryCompile ])
288# end of CacheVal CvEbcdic
289AC_MSG_RESULT($cf_cv_ebcdic)
290case "$cf_cv_ebcdic" in #(vi
291 yes) AC_DEFINE(EBCDIC)
292 line_break='"\\n"'
293 ;;
294 *) line_break='"\\012"';;
295esac
296AC_SUBST(line_break)
297
298if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200299dnl If we have EBCDIC we most likley have z/OS Unix, let's test it!
300AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000301case `uname` in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200302 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303 dnl If using cc the environment variable _CC_CCMODE must be
304 dnl set to "1", so that some compiler extensions are enabled.
305 dnl If using c89 the environment variable is named _CC_C89MODE.
306 dnl Note: compile with c89 never tested.
307 if test "$CC" = "cc"; then
308 ccm="$_CC_CCMODE"
309 ccn="CC"
310 else
311 if test "$CC" = "c89"; then
312 ccm="$_CC_C89MODE"
313 ccn="C89"
314 else
315 ccm=1
316 fi
317 fi
318 if test "$ccm" != "1"; then
319 echo ""
320 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200321 echo " On z/OS Unix, the environment variable"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000322 echo " __CC_${ccn}MODE must be set to \"1\"!"
323 echo " Do:"
324 echo " export _CC_${ccn}MODE=1"
325 echo " and then call configure again."
326 echo "------------------------------------------"
327 exit 1
328 fi
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200329 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
330 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331 AC_MSG_RESULT(yes)
332 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200333 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334 AC_MSG_RESULT(no)
335 ;;
336esac
337fi
338
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200339dnl Set QUOTESED. Needs additional backslashes on zOS
340if test "$zOSUnix" = "yes"; then
341 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
342else
343 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
344fi
345AC_SUBST(QUOTESED)
346
347
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000348dnl Link with -lselinux for SELinux stuff; if not found
349AC_MSG_CHECKING(--disable-selinux argument)
350AC_ARG_ENABLE(selinux,
351 [ --disable-selinux Don't check for SELinux support.],
352 , enable_selinux="yes")
353if test "$enable_selinux" = "yes"; then
354 AC_MSG_RESULT(no)
355 AC_CHECK_LIB(selinux, is_selinux_enabled,
356 [LIBS="$LIBS -lselinux"
357 AC_DEFINE(HAVE_SELINUX)])
358else
359 AC_MSG_RESULT(yes)
360fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000361
362dnl Check user requested features.
363
364AC_MSG_CHECKING(--with-features argument)
365AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
366 features="$withval"; AC_MSG_RESULT($features),
367 features="normal"; AC_MSG_RESULT(Defaulting to normal))
368
369dovimdiff=""
370dogvimdiff=""
371case "$features" in
372 tiny) AC_DEFINE(FEAT_TINY) ;;
373 small) AC_DEFINE(FEAT_SMALL) ;;
374 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
375 dogvimdiff="installgvimdiff" ;;
376 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
377 dogvimdiff="installgvimdiff" ;;
378 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
379 dogvimdiff="installgvimdiff" ;;
380 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
381esac
382
383AC_SUBST(dovimdiff)
384AC_SUBST(dogvimdiff)
385
386AC_MSG_CHECKING(--with-compiledby argument)
387AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
388 compiledby="$withval"; AC_MSG_RESULT($withval),
389 compiledby=""; AC_MSG_RESULT(no))
390AC_SUBST(compiledby)
391
392AC_MSG_CHECKING(--disable-xsmp argument)
393AC_ARG_ENABLE(xsmp,
394 [ --disable-xsmp Disable XSMP session management],
395 , enable_xsmp="yes")
396
397if test "$enable_xsmp" = "yes"; then
398 AC_MSG_RESULT(no)
399 AC_MSG_CHECKING(--disable-xsmp-interact argument)
400 AC_ARG_ENABLE(xsmp-interact,
401 [ --disable-xsmp-interact Disable XSMP interaction],
402 , enable_xsmp_interact="yes")
403 if test "$enable_xsmp_interact" = "yes"; then
404 AC_MSG_RESULT(no)
405 AC_DEFINE(USE_XSMP_INTERACT)
406 else
407 AC_MSG_RESULT(yes)
408 fi
409else
410 AC_MSG_RESULT(yes)
411fi
412
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200413dnl Check for Lua feature.
414AC_MSG_CHECKING(--enable-luainterp argument)
415AC_ARG_ENABLE(luainterp,
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200416 [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200417 [enable_luainterp="no"])
418AC_MSG_RESULT($enable_luainterp)
419
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200420if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200421 dnl -- find the lua executable
422 AC_SUBST(vi_cv_path_lua)
423
424 AC_MSG_CHECKING(--with-lua-prefix argument)
425 AC_ARG_WITH(lua_prefix,
426 [ --with-lua-prefix=PFX Prefix where Lua is installed.],
427 with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200428 with_lua_prefix="";AC_MSG_RESULT(no))
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200429
430 if test "X$with_lua_prefix" != "X"; then
431 vi_cv_path_lua_pfx="$with_lua_prefix"
432 else
433 AC_MSG_CHECKING(LUA_PREFIX environment var)
434 if test "X$LUA_PREFIX" != "X"; then
435 AC_MSG_RESULT("$LUA_PREFIX")
436 vi_cv_path_lua_pfx="$LUA_PREFIX"
437 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200438 AC_MSG_RESULT([not set, default to /usr])
439 vi_cv_path_lua_pfx="/usr"
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200440 fi
441 fi
442
443 LUA_INC=
444 if test "X$vi_cv_path_lua_pfx" != "X"; then
445 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
446 if test -f $vi_cv_path_lua_pfx/include/lua.h; then
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200447 AC_MSG_RESULT(yes)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200448 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200449 AC_MSG_RESULT(no)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200450 dnl -- try to find Lua executable
451 AC_PATH_PROG(vi_cv_path_lua, lua)
452 if test "X$vi_cv_path_lua" != "X"; then
453 dnl -- find Lua version
454 AC_CACHE_CHECK(Lua version, vi_cv_version_lua,
455 [ vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION:sub(5,7))"` ])
456 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
457 if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200458 AC_MSG_RESULT(yes)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200459 LUA_INC=/lua$vi_cv_version_lua
460 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200461 AC_MSG_RESULT(no)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200462 vi_cv_path_lua_pfx=
463 fi
464 fi
465 fi
466 fi
467
468 if test "X$vi_cv_path_lua_pfx" != "X"; then
469 if test "X$vi_cv_version_lua" != "X"; then
470 dnl Test alternate location using version
471 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
472 else
473 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
474 fi
475 LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
476 LUA_SRC="if_lua.c"
477 LUA_OBJ="objects/if_lua.o"
478 LUA_PRO="if_lua.pro"
479 AC_DEFINE(FEAT_LUA)
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200480 if test "$enable_luainterp" = "dynamic"; then
481 AC_DEFINE(DYNAMIC_LUA)
482 LUA_LIBS=""
483 LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"liblua${vi_cv_version_lua}.so\\\" $LUA_CFLAGS"
484 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200485 fi
486 AC_SUBST(LUA_SRC)
487 AC_SUBST(LUA_OBJ)
488 AC_SUBST(LUA_PRO)
489 AC_SUBST(LUA_LIBS)
490 AC_SUBST(LUA_CFLAGS)
491fi
492
493
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000494dnl Check for MzScheme feature.
495AC_MSG_CHECKING(--enable-mzschemeinterp argument)
496AC_ARG_ENABLE(mzschemeinterp,
497 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
498 [enable_mzschemeinterp="no"])
499AC_MSG_RESULT($enable_mzschemeinterp)
500
501if test "$enable_mzschemeinterp" = "yes"; then
502 dnl -- find the mzscheme executable
503 AC_SUBST(vi_cv_path_mzscheme)
504
505 AC_MSG_CHECKING(--with-plthome argument)
506 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000507 [ --with-plthome=PLTHOME Use PLTHOME.],
508 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000509 with_plthome="";AC_MSG_RESULT("no"))
510
511 if test "X$with_plthome" != "X"; then
512 vi_cv_path_mzscheme_pfx="$with_plthome"
513 else
514 AC_MSG_CHECKING(PLTHOME environment var)
515 if test "X$PLTHOME" != "X"; then
516 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000517 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000518 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000519 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000520 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000521 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000522
523 dnl resolve symbolic link, the executable is often elsewhere and there
524 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000525 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000526 lsout=`ls -l $vi_cv_path_mzscheme`
527 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
528 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
529 fi
530 fi
531
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000532 if test "X$vi_cv_path_mzscheme" != "X"; then
533 dnl -- find where MzScheme thinks it was installed
534 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000535 dnl different versions of MzScheme differ in command line processing
536 dnl use universal approach
537 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000538 (build-path (call-with-values \
539 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000540 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
541 dnl Remove a trailing slash
542 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
543 sed -e 's+/$++'` ])
544 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000545 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000546 fi
547 fi
548
Bram Moolenaard7afed32007-05-06 13:26:41 +0000549 SCHEME_INC=
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000550 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
551 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
552 if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000553 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
554 AC_MSG_RESULT(yes)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000555 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000556 AC_MSG_RESULT(no)
557 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000558 if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000559 AC_MSG_RESULT(yes)
560 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaard7afed32007-05-06 13:26:41 +0000561 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000562 AC_MSG_RESULT(no)
563 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
564 if test -f /usr/include/plt/scheme.h; then
565 AC_MSG_RESULT(yes)
566 SCHEME_INC=/usr/include/plt
567 else
568 AC_MSG_RESULT(no)
569 vi_cv_path_mzscheme_pfx=
570 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000571 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000572 fi
573 fi
574
575 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000576 if test "x$MACOSX" = "xyes"; then
577 MZSCHEME_LIBS="-framework PLT_MzScheme"
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000578 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
579 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
580 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000581 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
Bram Moolenaar9048f942007-05-12 14:32:25 +0000582 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000583 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000584 dnl Using shared objects
585 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
586 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
587 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
588 else
589 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
590 fi
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000591 if test "$GCC" = yes; then
592 dnl Make Vim remember the path to the library. For when it's not in
593 dnl $LD_LIBRARY_PATH.
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000594 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000595 elif test "`(uname) 2>/dev/null`" = SunOS &&
596 uname -r | grep '^5' >/dev/null; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000597 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000598 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000599 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000600 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
601 SCHEME_COLLECTS=lib/plt/
602 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000603 if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
604 dnl need to generate bytecode for MzScheme base
605 MZSCHEME_EXTRA="mzscheme_base.c"
606 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
607 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
608 fi
609 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaard7afed32007-05-06 13:26:41 +0000610 -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000611 MZSCHEME_SRC="if_mzsch.c"
612 MZSCHEME_OBJ="objects/if_mzsch.o"
613 MZSCHEME_PRO="if_mzsch.pro"
614 AC_DEFINE(FEAT_MZSCHEME)
615 fi
616 AC_SUBST(MZSCHEME_SRC)
617 AC_SUBST(MZSCHEME_OBJ)
618 AC_SUBST(MZSCHEME_PRO)
619 AC_SUBST(MZSCHEME_LIBS)
620 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000621 AC_SUBST(MZSCHEME_EXTRA)
622 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000623fi
624
625
Bram Moolenaar071d4272004-06-13 20:20:40 +0000626AC_MSG_CHECKING(--enable-perlinterp argument)
627AC_ARG_ENABLE(perlinterp,
Bram Moolenaare06c1882010-07-21 22:05:20 +0200628 [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000629 [enable_perlinterp="no"])
630AC_MSG_RESULT($enable_perlinterp)
Bram Moolenaare06c1882010-07-21 22:05:20 +0200631if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000632 AC_SUBST(vi_cv_path_perl)
633 AC_PATH_PROG(vi_cv_path_perl, perl)
634 if test "X$vi_cv_path_perl" != "X"; then
635 AC_MSG_CHECKING(Perl version)
636 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
637 eval `$vi_cv_path_perl -V:usethreads`
Bram Moolenaare06c1882010-07-21 22:05:20 +0200638 eval `$vi_cv_path_perl -V:libperl`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000639 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
640 badthreads=no
641 else
642 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
643 eval `$vi_cv_path_perl -V:use5005threads`
644 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
645 badthreads=no
646 else
647 badthreads=yes
648 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
649 fi
650 else
651 badthreads=yes
652 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
653 fi
654 fi
655 if test $badthreads = no; then
656 AC_MSG_RESULT(OK)
657 eval `$vi_cv_path_perl -V:shrpenv`
658 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
659 shrpenv=""
660 fi
661 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
662 AC_SUBST(vi_cv_perllib)
663 dnl Remove "-fno-something", it breaks using cproto.
664 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
665 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
666 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
667 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
668 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
669 -e 's/-bE:perl.exp//' -e 's/-lc //'`
670 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
671 dnl a test in configure may fail because of that.
672 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
673 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
674
675 dnl check that compiling a simple program still works with the flags
676 dnl added for Perl.
677 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
678 cflags_save=$CFLAGS
679 libs_save=$LIBS
680 ldflags_save=$LDFLAGS
681 CFLAGS="$CFLAGS $perlcppflags"
682 LIBS="$LIBS $perllibs"
683 LDFLAGS="$perlldflags $LDFLAGS"
684 AC_TRY_LINK(,[ ],
685 AC_MSG_RESULT(yes); perl_ok=yes,
686 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
687 CFLAGS=$cflags_save
688 LIBS=$libs_save
689 LDFLAGS=$ldflags_save
690 if test $perl_ok = yes; then
691 if test "X$perlcppflags" != "X"; then
Bram Moolenaard7afed32007-05-06 13:26:41 +0000692 dnl remove -pipe and -Wxxx, it confuses cproto
693 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000694 fi
695 if test "X$perlldflags" != "X"; then
696 LDFLAGS="$perlldflags $LDFLAGS"
697 fi
698 PERL_LIBS=$perllibs
699 PERL_SRC="auto/if_perl.c if_perlsfio.c"
700 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
701 PERL_PRO="if_perl.pro if_perlsfio.pro"
702 AC_DEFINE(FEAT_PERL)
703 fi
704 fi
705 else
706 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
707 fi
708 fi
709
710 if test "x$MACOSX" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +0000711 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000712 dir=/System/Library/Perl
713 darwindir=$dir/darwin
714 if test -d $darwindir; then
715 PERL=/usr/bin/perl
716 else
717 dnl Mac OS X 10.3
718 dir=/System/Library/Perl/5.8.1
719 darwindir=$dir/darwin-thread-multi-2level
720 if test -d $darwindir; then
721 PERL=/usr/bin/perl
722 fi
723 fi
724 if test -n "$PERL"; then
725 PERL_DIR="$dir"
726 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
727 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
728 PERL_LIBS="-L$darwindir/CORE -lperl"
729 fi
730 fi
Bram Moolenaare06c1882010-07-21 22:05:20 +0200731 if test "$enable_perlinterp" = "dynamic"; then
732 if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
733 AC_DEFINE(DYNAMIC_PERL)
734 PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
735 fi
736 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000737fi
738AC_SUBST(shrpenv)
739AC_SUBST(PERL_SRC)
740AC_SUBST(PERL_OBJ)
741AC_SUBST(PERL_PRO)
742AC_SUBST(PERL_CFLAGS)
743AC_SUBST(PERL_LIBS)
744
745AC_MSG_CHECKING(--enable-pythoninterp argument)
746AC_ARG_ENABLE(pythoninterp,
747 [ --enable-pythoninterp Include Python interpreter.], ,
748 [enable_pythoninterp="no"])
749AC_MSG_RESULT($enable_pythoninterp)
750if test "$enable_pythoninterp" = "yes"; then
751 dnl -- find the python executable
752 AC_PATH_PROG(vi_cv_path_python, python)
753 if test "X$vi_cv_path_python" != "X"; then
754
755 dnl -- get its version number
756 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
757 [[vi_cv_var_python_version=`
758 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
759 ]])
760
761 dnl -- it must be at least version 1.4
762 AC_MSG_CHECKING(Python is 1.4 or better)
763 if ${vi_cv_path_python} -c \
764 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
765 then
766 AC_MSG_RESULT(yep)
767
768 dnl -- find where python thinks it was installed
769 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
770 [ vi_cv_path_python_pfx=`
771 ${vi_cv_path_python} -c \
772 "import sys; print sys.prefix"` ])
773
774 dnl -- and where it thinks it runs
775 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
776 [ vi_cv_path_python_epfx=`
777 ${vi_cv_path_python} -c \
778 "import sys; print sys.exec_prefix"` ])
779
780 dnl -- python's internal library path
781
782 AC_CACHE_VAL(vi_cv_path_pythonpath,
783 [ vi_cv_path_pythonpath=`
784 unset PYTHONPATH;
785 ${vi_cv_path_python} -c \
786 "import sys, string; print string.join(sys.path,':')"` ])
787
788 dnl -- where the Python implementation library archives are
789
790 AC_ARG_WITH(python-config-dir,
791 [ --with-python-config-dir=PATH Python's config directory],
792 [ vi_cv_path_python_conf="${withval}" ] )
793
794 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
795 [
796 vi_cv_path_python_conf=
797 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
Bram Moolenaar72951072009-12-02 16:58:33 +0000798 for subdir in lib64 lib share; do
Bram Moolenaar071d4272004-06-13 20:20:40 +0000799 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
800 if test -d "$d" && test -f "$d/config.c"; then
801 vi_cv_path_python_conf="$d"
802 fi
803 done
804 done
805 ])
806
807 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
808
809 if test "X$PYTHON_CONFDIR" = "X"; then
810 AC_MSG_RESULT([can't find it!])
811 else
812
813 dnl -- we need to examine Python's config/Makefile too
814 dnl see what the interpreter is built from
815 AC_CACHE_VAL(vi_cv_path_python_plibs,
816 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000817 pwd=`pwd`
818 tmp_mkf="$pwd/config-PyMake$$"
819 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000820__:
Bram Moolenaar218116c2010-05-20 21:46:00 +0200821 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000822 @echo "python_LIBS='$(LIBS)'"
823 @echo "python_SYSLIBS='$(SYSLIBS)'"
824 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
825eof
826 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000827 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
828 rm -f -- "${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000829 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
830 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
831 vi_cv_path_python_plibs="-framework Python"
832 else
833 if test "${vi_cv_var_python_version}" = "1.4"; then
834 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
835 else
836 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
837 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +0200838 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 +0000839 dnl remove -ltermcap, it can conflict with an earlier -lncurses
840 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
841 fi
842 ])
843
844 PYTHON_LIBS="${vi_cv_path_python_plibs}"
845 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
846 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
847 else
848 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}"
849 fi
850 PYTHON_SRC="if_python.c"
851 dnl For Mac OSX 10.2 config.o is included in the Python library.
852 if test "x$MACOSX" = "xyes"; then
853 PYTHON_OBJ="objects/if_python.o"
854 else
855 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
856 fi
857 if test "${vi_cv_var_python_version}" = "1.4"; then
858 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
859 fi
860 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
861
862 dnl On FreeBSD linking with "-pthread" is required to use threads.
863 dnl _THREAD_SAFE must be used for compiling then.
864 dnl The "-pthread" is added to $LIBS, so that the following check for
865 dnl sigaltstack() will look in libc_r (it's there in libc!).
866 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
867 dnl will then define target-specific defines, e.g., -D_REENTRANT.
868 dnl Don't do this for Mac OSX, -pthread will generate a warning.
869 AC_MSG_CHECKING([if -pthread should be used])
870 threadsafe_flag=
871 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000872 dnl if test "x$MACOSX" != "xyes"; then
873 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000874 test "$GCC" = yes && threadsafe_flag="-pthread"
875 if test "`(uname) 2>/dev/null`" = FreeBSD; then
876 threadsafe_flag="-D_THREAD_SAFE"
877 thread_lib="-pthread"
878 fi
879 fi
880 libs_save_old=$LIBS
881 if test -n "$threadsafe_flag"; then
882 cflags_save=$CFLAGS
883 CFLAGS="$CFLAGS $threadsafe_flag"
884 LIBS="$LIBS $thread_lib"
885 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200886 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000887 AC_MSG_RESULT(no); LIBS=$libs_save_old
888 )
889 CFLAGS=$cflags_save
890 else
891 AC_MSG_RESULT(no)
892 fi
893
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200894 dnl Check that compiling a simple program still works with the flags
Bram Moolenaar071d4272004-06-13 20:20:40 +0000895 dnl added for Python.
896 AC_MSG_CHECKING([if compile and link flags for Python are sane])
897 cflags_save=$CFLAGS
898 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200899 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000900 LIBS="$LIBS $PYTHON_LIBS"
901 AC_TRY_LINK(,[ ],
902 AC_MSG_RESULT(yes); python_ok=yes,
903 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
904 CFLAGS=$cflags_save
905 LIBS=$libs_save
906 if test $python_ok = yes; then
907 AC_DEFINE(FEAT_PYTHON)
908 else
909 LIBS=$libs_save_old
910 PYTHON_SRC=
911 PYTHON_OBJ=
912 PYTHON_LIBS=
913 PYTHON_CFLAGS=
914 fi
915
916 fi
917 else
918 AC_MSG_RESULT(too old)
919 fi
920 fi
921fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200922
Bram Moolenaar071d4272004-06-13 20:20:40 +0000923AC_SUBST(PYTHON_CONFDIR)
924AC_SUBST(PYTHON_LIBS)
925AC_SUBST(PYTHON_GETPATH_CFLAGS)
926AC_SUBST(PYTHON_CFLAGS)
927AC_SUBST(PYTHON_SRC)
928AC_SUBST(PYTHON_OBJ)
929
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200930
931AC_MSG_CHECKING(--enable-python3interp argument)
932AC_ARG_ENABLE(python3interp,
933 [ --enable-python3interp Include Python3 interpreter.], ,
934 [enable_python3interp="no"])
935AC_MSG_RESULT($enable_python3interp)
936if test "$enable_python3interp" = "yes"; then
937 dnl -- find the python3 executable
938 AC_PATH_PROG(vi_cv_path_python3, python3)
939 if test "X$vi_cv_path_python3" != "X"; then
940
941 dnl -- get its version number
942 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
943 [[vi_cv_var_python3_version=`
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200944 ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200945 ]])
946
947 dnl -- find where python3 thinks it was installed
948 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
949 [ vi_cv_path_python3_pfx=`
950 ${vi_cv_path_python3} -c \
951 "import sys; print(sys.prefix)"` ])
952
953 dnl -- and where it thinks it runs
954 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
955 [ vi_cv_path_python3_epfx=`
956 ${vi_cv_path_python3} -c \
957 "import sys; print(sys.exec_prefix)"` ])
958
959 dnl -- python3's internal library path
960
961 AC_CACHE_VAL(vi_cv_path_python3path,
962 [ vi_cv_path_python3path=`
963 unset PYTHONPATH;
964 ${vi_cv_path_python3} -c \
965 "import sys, string; print(':'.join(sys.path))"` ])
966
967 dnl -- where the Python implementation library archives are
968
969 AC_ARG_WITH(python3-config-dir,
970 [ --with-python3-config-dir=PATH Python's config directory],
971 [ vi_cv_path_python3_conf="${withval}" ] )
972
973 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
974 [
975 vi_cv_path_python3_conf=
976 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
977 for subdir in lib share; do
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200978 d="${path}/${subdir}/python${vi_cv_var_python3_version}/config"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200979 if test -d "$d" && test -f "$d/config.c"; then
980 vi_cv_path_python3_conf="$d"
981 fi
982 done
983 done
984 ])
985
986 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
987
988 if test "X$PYTHON3_CONFDIR" = "X"; then
989 AC_MSG_RESULT([can't find it!])
990 else
991
992 dnl -- we need to examine Python's config/Makefile too
993 dnl see what the interpreter is built from
994 AC_CACHE_VAL(vi_cv_path_python3_plibs,
995 [
996 pwd=`pwd`
997 tmp_mkf="$pwd/config-PyMake$$"
998 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
999__:
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001000 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001001 @echo "python3_LIBS='$(LIBS)'"
1002 @echo "python3_SYSLIBS='$(SYSLIBS)'"
1003 @echo "python3_LINKFORSHARED='$(LINKFORSHARED)'"
1004eof
1005 dnl -- delete the lines from make about Entering/Leaving directory
1006 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1007 rm -f -- "${tmp_mkf}"
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001008 vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}"
1009 vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS} ${python3_LINKFORSHARED}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001010 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1011 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1012 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1013 ])
1014
1015 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
1016 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001017 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001018 else
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001019 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001020 fi
1021 PYTHON3_SRC="if_python3.c"
1022 dnl For Mac OSX 10.2 config.o is included in the Python library.
1023 if test "x$MACOSX" = "xyes"; then
1024 PYTHON3_OBJ="objects/if_python3.o"
1025 else
1026 PYTHON3_OBJ="objects/if_python3.o objects/py3_config.o"
1027 fi
1028
1029 dnl On FreeBSD linking with "-pthread" is required to use threads.
1030 dnl _THREAD_SAFE must be used for compiling then.
1031 dnl The "-pthread" is added to $LIBS, so that the following check for
1032 dnl sigaltstack() will look in libc_r (it's there in libc!).
1033 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1034 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1035 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1036 AC_MSG_CHECKING([if -pthread should be used])
1037 threadsafe_flag=
1038 thread_lib=
1039 dnl if test "x$MACOSX" != "xyes"; then
1040 if test "`(uname) 2>/dev/null`" != Darwin; then
1041 test "$GCC" = yes && threadsafe_flag="-pthread"
1042 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1043 threadsafe_flag="-D_THREAD_SAFE"
1044 thread_lib="-pthread"
1045 fi
1046 fi
1047 libs_save_old=$LIBS
1048 if test -n "$threadsafe_flag"; then
1049 cflags_save=$CFLAGS
1050 CFLAGS="$CFLAGS $threadsafe_flag"
1051 LIBS="$LIBS $thread_lib"
1052 AC_TRY_LINK(,[ ],
1053 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1054 AC_MSG_RESULT(no); LIBS=$libs_save_old
1055 )
1056 CFLAGS=$cflags_save
1057 else
1058 AC_MSG_RESULT(no)
1059 fi
1060
1061 dnl check that compiling a simple program still works with the flags
1062 dnl added for Python.
1063 AC_MSG_CHECKING([if compile and link flags for Python are sane])
1064 cflags_save=$CFLAGS
1065 libs_save=$LIBS
1066 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1067 LIBS="$LIBS $PYTHON3_LIBS"
1068 AC_TRY_LINK(,[ ],
1069 AC_MSG_RESULT(yes); python3_ok=yes,
1070 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1071 CFLAGS=$cflags_save
1072 LIBS=$libs_save
1073 if test "$python3_ok" = yes; then
1074 AC_DEFINE(FEAT_PYTHON3)
1075 else
1076 LIBS=$libs_save_old
1077 PYTHON3_SRC=
1078 PYTHON3_OBJ=
1079 PYTHON3_LIBS=
1080 PYTHON3_CFLAGS=
1081 fi
1082 fi
1083 fi
1084fi
1085
1086AC_SUBST(PYTHON3_CONFDIR)
1087AC_SUBST(PYTHON3_LIBS)
1088AC_SUBST(PYTHON3_CFLAGS)
1089AC_SUBST(PYTHON3_SRC)
1090AC_SUBST(PYTHON3_OBJ)
1091
1092dnl if python2.x and python3.x are enabled one can only link in code
1093dnl with dlopen(), dlsym(), dlclose()
1094if test "$python_ok" = yes && test "$python3_ok" = yes; then
1095 AC_DEFINE(DYNAMIC_PYTHON)
1096 AC_DEFINE(DYNAMIC_PYTHON3)
1097 PYTHON_SRC="if_python.c"
1098 PYTHON_OBJ="objects/if_python.o"
1099 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"libpython${vi_cv_var_python_version}.so\\\""
1100 PYTHON_LIBS=
1101 PYTHON3_SRC="if_python3.c"
1102 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001103 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"libpython${vi_cv_var_python3_version}.so\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001104 PYTHON3_LIBS=
1105fi
1106
Bram Moolenaar071d4272004-06-13 20:20:40 +00001107AC_MSG_CHECKING(--enable-tclinterp argument)
1108AC_ARG_ENABLE(tclinterp,
1109 [ --enable-tclinterp Include Tcl interpreter.], ,
1110 [enable_tclinterp="no"])
1111AC_MSG_RESULT($enable_tclinterp)
1112
1113if test "$enable_tclinterp" = "yes"; then
1114
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001115 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001116 AC_MSG_CHECKING(--with-tclsh argument)
1117 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
1118 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001119 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001120 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1121 AC_SUBST(vi_cv_path_tcl)
1122
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001123 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1124 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1125 tclsh_name="tclsh8.4"
1126 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1127 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001128 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001129 tclsh_name="tclsh8.2"
1130 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1131 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001132 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1133 tclsh_name="tclsh8.0"
1134 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1135 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001136 dnl still didn't find it, try without version number
1137 if test "X$vi_cv_path_tcl" = "X"; then
1138 tclsh_name="tclsh"
1139 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1140 fi
1141 if test "X$vi_cv_path_tcl" != "X"; then
1142 AC_MSG_CHECKING(Tcl version)
1143 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
1144 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1145 AC_MSG_RESULT($tclver - OK);
1146 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 -`
1147
1148 AC_MSG_CHECKING(for location of Tcl include)
1149 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001150 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 +00001151 else
1152 dnl For Mac OS X 10.3, use the OS-provided framework location
1153 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
1154 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001155 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001156 for try in $tclinc; do
1157 if test -f "$try/tcl.h"; then
1158 AC_MSG_RESULT($try/tcl.h)
1159 TCL_INC=$try
1160 break
1161 fi
1162 done
1163 if test -z "$TCL_INC"; then
1164 AC_MSG_RESULT(<not found>)
1165 SKIP_TCL=YES
1166 fi
1167 if test -z "$SKIP_TCL"; then
1168 AC_MSG_CHECKING(for location of tclConfig.sh script)
1169 if test "x$MACOSX" != "xyes"; then
1170 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001171 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001172 else
1173 dnl For Mac OS X 10.3, use the OS-provided framework location
1174 tclcnf="/System/Library/Frameworks/Tcl.framework"
1175 fi
1176 for try in $tclcnf; do
1177 if test -f $try/tclConfig.sh; then
1178 AC_MSG_RESULT($try/tclConfig.sh)
1179 . $try/tclConfig.sh
1180 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
1181 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1182 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001183 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +00001184 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 +00001185 break
1186 fi
1187 done
1188 if test -z "$TCL_LIBS"; then
1189 AC_MSG_RESULT(<not found>)
1190 AC_MSG_CHECKING(for Tcl library by myself)
1191 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001192 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001193 for ext in .so .a ; do
1194 for ver in "" $tclver ; do
1195 for try in $tcllib ; do
1196 trylib=tcl$ver$ext
1197 if test -f $try/lib$trylib ; then
1198 AC_MSG_RESULT($try/lib$trylib)
1199 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
1200 if test "`(uname) 2>/dev/null`" = SunOS &&
1201 uname -r | grep '^5' >/dev/null; then
1202 TCL_LIBS="$TCL_LIBS -R $try"
1203 fi
1204 break 3
1205 fi
1206 done
1207 done
1208 done
1209 if test -z "$TCL_LIBS"; then
1210 AC_MSG_RESULT(<not found>)
1211 SKIP_TCL=YES
1212 fi
1213 fi
1214 if test -z "$SKIP_TCL"; then
1215 AC_DEFINE(FEAT_TCL)
1216 TCL_SRC=if_tcl.c
1217 TCL_OBJ=objects/if_tcl.o
1218 TCL_PRO=if_tcl.pro
1219 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1220 fi
1221 fi
1222 else
1223 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
1224 fi
1225 fi
1226fi
1227AC_SUBST(TCL_SRC)
1228AC_SUBST(TCL_OBJ)
1229AC_SUBST(TCL_PRO)
1230AC_SUBST(TCL_CFLAGS)
1231AC_SUBST(TCL_LIBS)
1232
1233AC_MSG_CHECKING(--enable-rubyinterp argument)
1234AC_ARG_ENABLE(rubyinterp,
1235 [ --enable-rubyinterp Include Ruby interpreter.], ,
1236 [enable_rubyinterp="no"])
1237AC_MSG_RESULT($enable_rubyinterp)
1238if test "$enable_rubyinterp" = "yes"; then
Bram Moolenaar165641d2010-02-17 16:23:09 +01001239 AC_MSG_CHECKING(--with-ruby-command argument)
1240 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
1241 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
1242 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001243 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001244 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001245 if test "X$vi_cv_path_ruby" != "X"; then
1246 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +00001247 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 +00001248 AC_MSG_RESULT(OK)
1249 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001250 rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["rubyhdrdir"]] || Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001251 if test "X$rubyhdrdir" != "X"; then
1252 AC_MSG_RESULT($rubyhdrdir)
1253 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01001254 rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
1255 if test -d "$rubyhdrdir/$rubyarch"; then
1256 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
1257 fi
1258 rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
1259 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001260 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
1261 if test "X$rubylibs" != "X"; then
1262 RUBY_LIBS="$rubylibs"
1263 fi
1264 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
1265 if test -f "$rubyhdrdir/$librubyarg"; then
1266 librubyarg="$rubyhdrdir/$librubyarg"
1267 else
1268 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
1269 if test -f "$rubylibdir/$librubyarg"; then
1270 librubyarg="$rubylibdir/$librubyarg"
1271 elif test "$librubyarg" = "libruby.a"; then
1272 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1273 librubyarg="-lruby"
1274 else
1275 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
1276 fi
1277 fi
1278
1279 if test "X$librubyarg" != "X"; then
1280 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1281 fi
1282 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
1283 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001284 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1285 dnl be included if requested by passing --with-mac-arch to
1286 dnl configure, so strip these flags first (if present)
1287 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//'`
1288 if test "X$rubyldflags" != "X"; then
1289 LDFLAGS="$rubyldflags $LDFLAGS"
1290 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001291 fi
1292 RUBY_SRC="if_ruby.c"
1293 RUBY_OBJ="objects/if_ruby.o"
1294 RUBY_PRO="if_ruby.pro"
1295 AC_DEFINE(FEAT_RUBY)
1296 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001297 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001298 fi
1299 else
1300 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1301 fi
1302 fi
1303fi
1304AC_SUBST(RUBY_SRC)
1305AC_SUBST(RUBY_OBJ)
1306AC_SUBST(RUBY_PRO)
1307AC_SUBST(RUBY_CFLAGS)
1308AC_SUBST(RUBY_LIBS)
1309
1310AC_MSG_CHECKING(--enable-cscope argument)
1311AC_ARG_ENABLE(cscope,
1312 [ --enable-cscope Include cscope interface.], ,
1313 [enable_cscope="no"])
1314AC_MSG_RESULT($enable_cscope)
1315if test "$enable_cscope" = "yes"; then
1316 AC_DEFINE(FEAT_CSCOPE)
1317fi
1318
1319AC_MSG_CHECKING(--enable-workshop argument)
1320AC_ARG_ENABLE(workshop,
1321 [ --enable-workshop Include Sun Visual Workshop support.], ,
1322 [enable_workshop="no"])
1323AC_MSG_RESULT($enable_workshop)
1324if test "$enable_workshop" = "yes"; then
1325 AC_DEFINE(FEAT_SUN_WORKSHOP)
1326 WORKSHOP_SRC="workshop.c integration.c"
1327 AC_SUBST(WORKSHOP_SRC)
1328 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1329 AC_SUBST(WORKSHOP_OBJ)
1330 if test "${enable_gui-xxx}" = xxx; then
1331 enable_gui=motif
1332 fi
1333fi
1334
1335AC_MSG_CHECKING(--disable-netbeans argument)
1336AC_ARG_ENABLE(netbeans,
1337 [ --disable-netbeans Disable NetBeans integration support.],
1338 , [enable_netbeans="yes"])
1339if test "$enable_netbeans" = "yes"; then
1340 AC_MSG_RESULT(no)
1341 dnl On Solaris we need the socket and nsl library.
1342 AC_CHECK_LIB(socket, socket)
1343 AC_CHECK_LIB(nsl, gethostbyname)
1344 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1345 AC_TRY_LINK([
1346#include <stdio.h>
1347#include <stdlib.h>
1348#include <stdarg.h>
1349#include <fcntl.h>
1350#include <netdb.h>
1351#include <netinet/in.h>
1352#include <errno.h>
1353#include <sys/types.h>
1354#include <sys/socket.h>
1355 /* Check bitfields */
1356 struct nbbuf {
1357 unsigned int initDone:1;
1358 ushort signmaplen;
1359 };
1360 ], [
1361 /* Check creating a socket. */
1362 struct sockaddr_in server;
1363 (void)socket(AF_INET, SOCK_STREAM, 0);
1364 (void)htons(100);
1365 (void)gethostbyname("microsoft.com");
1366 if (errno == ECONNREFUSED)
1367 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1368 ],
1369 AC_MSG_RESULT(yes),
1370 AC_MSG_RESULT(no); enable_netbeans="no")
1371else
1372 AC_MSG_RESULT(yes)
1373fi
1374if test "$enable_netbeans" = "yes"; then
1375 AC_DEFINE(FEAT_NETBEANS_INTG)
1376 NETBEANS_SRC="netbeans.c"
1377 AC_SUBST(NETBEANS_SRC)
1378 NETBEANS_OBJ="objects/netbeans.o"
1379 AC_SUBST(NETBEANS_OBJ)
1380fi
1381
1382AC_MSG_CHECKING(--enable-sniff argument)
1383AC_ARG_ENABLE(sniff,
1384 [ --enable-sniff Include Sniff interface.], ,
1385 [enable_sniff="no"])
1386AC_MSG_RESULT($enable_sniff)
1387if test "$enable_sniff" = "yes"; then
1388 AC_DEFINE(FEAT_SNIFF)
1389 SNIFF_SRC="if_sniff.c"
1390 AC_SUBST(SNIFF_SRC)
1391 SNIFF_OBJ="objects/if_sniff.o"
1392 AC_SUBST(SNIFF_OBJ)
1393fi
1394
1395AC_MSG_CHECKING(--enable-multibyte argument)
1396AC_ARG_ENABLE(multibyte,
1397 [ --enable-multibyte Include multibyte editing support.], ,
1398 [enable_multibyte="no"])
1399AC_MSG_RESULT($enable_multibyte)
1400if test "$enable_multibyte" = "yes"; then
1401 AC_DEFINE(FEAT_MBYTE)
1402fi
1403
1404AC_MSG_CHECKING(--enable-hangulinput argument)
1405AC_ARG_ENABLE(hangulinput,
1406 [ --enable-hangulinput Include Hangul input support.], ,
1407 [enable_hangulinput="no"])
1408AC_MSG_RESULT($enable_hangulinput)
1409
1410AC_MSG_CHECKING(--enable-xim argument)
1411AC_ARG_ENABLE(xim,
1412 [ --enable-xim Include XIM input support.],
1413 AC_MSG_RESULT($enable_xim),
1414 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001415
1416AC_MSG_CHECKING(--enable-fontset argument)
1417AC_ARG_ENABLE(fontset,
1418 [ --enable-fontset Include X fontset output support.], ,
1419 [enable_fontset="no"])
1420AC_MSG_RESULT($enable_fontset)
1421dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1422
1423test -z "$with_x" && with_x=yes
1424test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1425if test "$with_x" = no; then
1426 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1427else
1428 dnl Do this check early, so that its failure can override user requests.
1429
1430 AC_PATH_PROG(xmkmfpath, xmkmf)
1431
1432 AC_PATH_XTRA
1433
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001434 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001435 dnl be compiled with a special option.
1436 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001437 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001438 CFLAGS="$CFLAGS -W c,dll"
1439 LDFLAGS="$LDFLAGS -W l,dll"
1440 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1441 fi
1442
1443 dnl On my HPUX system the X include dir is found, but the lib dir not.
1444 dnl This is a desparate try to fix this.
1445
1446 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1447 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1448 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1449 X_LIBS="$X_LIBS -L$x_libraries"
1450 if test "`(uname) 2>/dev/null`" = SunOS &&
1451 uname -r | grep '^5' >/dev/null; then
1452 X_LIBS="$X_LIBS -R $x_libraries"
1453 fi
1454 fi
1455
1456 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1457 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1458 AC_MSG_RESULT(Corrected X includes to $x_includes)
1459 X_CFLAGS="$X_CFLAGS -I$x_includes"
1460 fi
1461
1462 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1463 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1464 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1465 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1466 dnl Same for "-R/usr/lib ".
1467 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1468
1469
1470 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001471 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1472 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001473 AC_MSG_CHECKING(if X11 header files can be found)
1474 cflags_save=$CFLAGS
1475 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001476 AC_TRY_COMPILE([#include <X11/Xlib.h>
1477#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001478 AC_MSG_RESULT(yes),
1479 AC_MSG_RESULT(no); no_x=yes)
1480 CFLAGS=$cflags_save
1481
1482 if test "${no_x-no}" = yes; then
1483 with_x=no
1484 else
1485 AC_DEFINE(HAVE_X11)
1486 X_LIB="-lXt -lX11";
1487 AC_SUBST(X_LIB)
1488
1489 ac_save_LDFLAGS="$LDFLAGS"
1490 LDFLAGS="-L$x_libraries $LDFLAGS"
1491
1492 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1493 dnl For HP-UX 10.20 it must be before -lSM -lICE
1494 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1495 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1496
1497 dnl Some systems need -lnsl -lsocket when testing for ICE.
1498 dnl The check above doesn't do this, try here (again). Also needed to get
1499 dnl them after Xdmcp. link.sh will remove them when not needed.
1500 dnl Check for other function than above to avoid the cached value
1501 AC_CHECK_LIB(ICE, IceOpenConnection,
1502 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1503
1504 dnl Check for -lXpm (needed for some versions of Motif)
1505 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1506 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1507 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1508
1509 dnl Check that the X11 header files don't use implicit declarations
1510 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1511 cflags_save=$CFLAGS
1512 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1513 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1514 AC_MSG_RESULT(no),
1515 CFLAGS="$CFLAGS -Wno-implicit-int"
1516 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1517 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1518 AC_MSG_RESULT(test failed)
1519 )
1520 )
1521 CFLAGS=$cflags_save
1522
1523 LDFLAGS="$ac_save_LDFLAGS"
1524
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001525 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1526 AC_CACHE_VAL(ac_cv_small_wchar_t,
1527 [AC_TRY_RUN([
1528#include <X11/Xlib.h>
1529#if STDC_HEADERS
1530# include <stdlib.h>
1531# include <stddef.h>
1532#endif
1533 main()
1534 {
1535 if (sizeof(wchar_t) <= 2)
1536 exit(1);
1537 exit(0);
1538 }],
1539 ac_cv_small_wchar_t="no",
1540 ac_cv_small_wchar_t="yes",
1541 AC_MSG_ERROR(failed to compile test program))])
1542 AC_MSG_RESULT($ac_cv_small_wchar_t)
1543 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1544 AC_DEFINE(SMALL_WCHAR_T)
1545 fi
1546
Bram Moolenaar071d4272004-06-13 20:20:40 +00001547 fi
1548fi
1549
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001550test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001551
1552AC_MSG_CHECKING(--enable-gui argument)
1553AC_ARG_ENABLE(gui,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001554 [ --enable-gui[=OPTS] X11 GUI [default=auto] [OPTS=auto/no/gtk2/gnome2/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto")
Bram Moolenaar071d4272004-06-13 20:20:40 +00001555
1556dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1557dnl Do not use character classes for portability with old tools.
1558enable_gui_canon=`echo "_$enable_gui" | \
1559 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1560
1561dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001562SKIP_GTK2=YES
1563SKIP_GNOME=YES
1564SKIP_MOTIF=YES
1565SKIP_ATHENA=YES
1566SKIP_NEXTAW=YES
1567SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001568SKIP_CARBON=YES
1569GUITYPE=NONE
1570
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001571if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001572 SKIP_PHOTON=
1573 case "$enable_gui_canon" in
1574 no) AC_MSG_RESULT(no GUI support)
1575 SKIP_PHOTON=YES ;;
1576 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1577 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1578 photon) AC_MSG_RESULT(Photon GUI support) ;;
1579 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1580 SKIP_PHOTON=YES ;;
1581 esac
1582
1583elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1584 SKIP_CARBON=
1585 case "$enable_gui_canon" in
1586 no) AC_MSG_RESULT(no GUI support)
1587 SKIP_CARBON=YES ;;
1588 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
Bram Moolenaar164fca32010-07-14 13:58:07 +02001589 auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
1590 SKIP_CARBON=YES ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001591 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1592 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1593 SKIP_CARBON=YES ;;
1594 esac
1595
1596else
1597
Bram Moolenaar071d4272004-06-13 20:20:40 +00001598 case "$enable_gui_canon" in
1599 no|none) AC_MSG_RESULT(no GUI support) ;;
1600 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001601 SKIP_GTK2=
1602 SKIP_GNOME=
1603 SKIP_MOTIF=
1604 SKIP_ATHENA=
1605 SKIP_NEXTAW=
1606 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001607 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001608 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001609 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1610 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001611 SKIP_GTK2=;;
1612 motif) AC_MSG_RESULT(Motif GUI support)
1613 SKIP_MOTIF=;;
1614 athena) AC_MSG_RESULT(Athena GUI support)
1615 SKIP_ATHENA=;;
1616 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1617 SKIP_NEXTAW=;;
1618 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1619 esac
1620
1621fi
1622
Bram Moolenaar071d4272004-06-13 20:20:40 +00001623if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1624 -a "$enable_gui_canon" != "gnome2"; then
1625 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1626 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001627 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001628 , enable_gtk2_check="yes")
1629 AC_MSG_RESULT($enable_gtk2_check)
1630 if test "x$enable_gtk2_check" = "xno"; then
1631 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001632 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001633 fi
1634fi
1635
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001636if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001637 AC_MSG_CHECKING(whether or not to look for GNOME)
1638 AC_ARG_ENABLE(gnome-check,
1639 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1640 , enable_gnome_check="no")
1641 AC_MSG_RESULT($enable_gnome_check)
1642 if test "x$enable_gnome_check" = "xno"; then
1643 SKIP_GNOME=YES
1644 fi
1645fi
1646
1647if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1648 AC_MSG_CHECKING(whether or not to look for Motif)
1649 AC_ARG_ENABLE(motif-check,
1650 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1651 , enable_motif_check="yes")
1652 AC_MSG_RESULT($enable_motif_check)
1653 if test "x$enable_motif_check" = "xno"; then
1654 SKIP_MOTIF=YES
1655 fi
1656fi
1657
1658if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1659 AC_MSG_CHECKING(whether or not to look for Athena)
1660 AC_ARG_ENABLE(athena-check,
1661 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1662 , enable_athena_check="yes")
1663 AC_MSG_RESULT($enable_athena_check)
1664 if test "x$enable_athena_check" = "xno"; then
1665 SKIP_ATHENA=YES
1666 fi
1667fi
1668
1669if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1670 AC_MSG_CHECKING(whether or not to look for neXtaw)
1671 AC_ARG_ENABLE(nextaw-check,
1672 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1673 , enable_nextaw_check="yes")
1674 AC_MSG_RESULT($enable_nextaw_check);
1675 if test "x$enable_nextaw_check" = "xno"; then
1676 SKIP_NEXTAW=YES
1677 fi
1678fi
1679
1680if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1681 AC_MSG_CHECKING(whether or not to look for Carbon)
1682 AC_ARG_ENABLE(carbon-check,
1683 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1684 , enable_carbon_check="yes")
1685 AC_MSG_RESULT($enable_carbon_check);
1686 if test "x$enable_carbon_check" = "xno"; then
1687 SKIP_CARBON=YES
1688 fi
1689fi
1690
Bram Moolenaar843ee412004-06-30 16:16:41 +00001691
Bram Moolenaar071d4272004-06-13 20:20:40 +00001692if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1693 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001694 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001695 AC_MSG_RESULT(yes);
1696 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001697 if test "$VIMNAME" = "vim"; then
1698 VIMNAME=Vim
1699 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001700
Bram Moolenaar164fca32010-07-14 13:58:07 +02001701 if test "x$MACARCH" = "xboth"; then
1702 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
1703 else
1704 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
1705 fi
1706
Bram Moolenaar14716812006-05-04 21:54:08 +00001707 dnl Default install directory is not /usr/local
1708 if test x$prefix = xNONE; then
1709 prefix=/Applications
1710 fi
1711
1712 dnl Sorry for the hard coded default
1713 datadir='${prefix}/Vim.app/Contents/Resources'
1714
Bram Moolenaar071d4272004-06-13 20:20:40 +00001715 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001716 SKIP_GTK2=YES;
1717 SKIP_GNOME=YES;
1718 SKIP_MOTIF=YES;
1719 SKIP_ATHENA=YES;
1720 SKIP_NEXTAW=YES;
1721 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001722 SKIP_CARBON=YES
1723fi
1724
Bram Moolenaar071d4272004-06-13 20:20:40 +00001725dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001726dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001727dnl
1728dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001729dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001730dnl
1731AC_DEFUN(AM_PATH_GTK,
1732[
1733 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1734 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001735 min_gtk_version=ifelse([$1], ,2.2.0,$1)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001736 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1737 no_gtk=""
1738 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1739 && $PKG_CONFIG --exists gtk+-2.0; then
1740 {
1741 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1742 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1743 dnl something like that.
1744 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001745 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001746 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1747 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1748 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1749 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1750 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1751 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1752 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1753 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001754 else
1755 no_gtk=yes
1756 fi
1757
1758 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1759 {
1760 ac_save_CFLAGS="$CFLAGS"
1761 ac_save_LIBS="$LIBS"
1762 CFLAGS="$CFLAGS $GTK_CFLAGS"
1763 LIBS="$LIBS $GTK_LIBS"
1764
1765 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001766 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001767 dnl
1768 rm -f conf.gtktest
1769 AC_TRY_RUN([
1770#include <gtk/gtk.h>
1771#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001772#if STDC_HEADERS
1773# include <stdlib.h>
1774# include <stddef.h>
1775#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001776
1777int
1778main ()
1779{
1780int major, minor, micro;
1781char *tmp_version;
1782
1783system ("touch conf.gtktest");
1784
1785/* HP/UX 9 (%@#!) writes to sscanf strings */
1786tmp_version = g_strdup("$min_gtk_version");
1787if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1788 printf("%s, bad version string\n", "$min_gtk_version");
1789 exit(1);
1790 }
1791
1792if ((gtk_major_version > major) ||
1793 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1794 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1795 (gtk_micro_version >= micro)))
1796{
1797 return 0;
1798}
1799return 1;
1800}
1801],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1802 CFLAGS="$ac_save_CFLAGS"
1803 LIBS="$ac_save_LIBS"
1804 }
1805 fi
1806 if test "x$no_gtk" = x ; then
1807 if test "x$enable_gtktest" = "xyes"; then
1808 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1809 else
1810 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1811 fi
1812 ifelse([$2], , :, [$2])
1813 else
1814 {
1815 AC_MSG_RESULT(no)
1816 GTK_CFLAGS=""
1817 GTK_LIBS=""
1818 ifelse([$3], , :, [$3])
1819 }
1820 fi
1821 }
1822 else
1823 GTK_CFLAGS=""
1824 GTK_LIBS=""
1825 ifelse([$3], , :, [$3])
1826 fi
1827 AC_SUBST(GTK_CFLAGS)
1828 AC_SUBST(GTK_LIBS)
1829 rm -f conf.gtktest
1830])
1831
1832dnl ---------------------------------------------------------------------------
1833dnl gnome
1834dnl ---------------------------------------------------------------------------
1835AC_DEFUN([GNOME_INIT_HOOK],
1836[
1837 AC_SUBST(GNOME_LIBS)
1838 AC_SUBST(GNOME_LIBDIR)
1839 AC_SUBST(GNOME_INCLUDEDIR)
1840
1841 AC_ARG_WITH(gnome-includes,
1842 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1843 [CFLAGS="$CFLAGS -I$withval"]
1844 )
1845
1846 AC_ARG_WITH(gnome-libs,
1847 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1848 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1849 )
1850
1851 AC_ARG_WITH(gnome,
1852 [ --with-gnome Specify prefix for GNOME files],
1853 if test x$withval = xyes; then
1854 want_gnome=yes
1855 ifelse([$1], [], :, [$1])
1856 else
1857 if test "x$withval" = xno; then
1858 want_gnome=no
1859 else
1860 want_gnome=yes
1861 LDFLAGS="$LDFLAGS -L$withval/lib"
1862 CFLAGS="$CFLAGS -I$withval/include"
1863 gnome_prefix=$withval/lib
1864 fi
1865 fi,
1866 want_gnome=yes)
1867
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001868 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001869 {
1870 AC_MSG_CHECKING(for libgnomeui-2.0)
1871 if $PKG_CONFIG --exists libgnomeui-2.0; then
1872 AC_MSG_RESULT(yes)
1873 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1874 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1875 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001876
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001877 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1878 dnl This might not be the right way but it works for me...
1879 AC_MSG_CHECKING(for FreeBSD)
1880 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1881 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001882 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001883 GNOME_LIBS="$GNOME_LIBS -pthread"
1884 else
1885 AC_MSG_RESULT(no)
1886 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001887 $1
1888 else
1889 AC_MSG_RESULT(not found)
1890 if test "x$2" = xfail; then
1891 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1892 fi
1893 fi
1894 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001895 fi
1896])
1897
1898AC_DEFUN([GNOME_INIT],[
1899 GNOME_INIT_HOOK([],fail)
1900])
1901
1902
1903dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001904dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001905dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001906if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001907
1908 AC_MSG_CHECKING(--disable-gtktest argument)
1909 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1910 , enable_gtktest=yes)
1911 if test "x$enable_gtktest" = "xyes" ; then
1912 AC_MSG_RESULT(gtk test enabled)
1913 else
1914 AC_MSG_RESULT(gtk test disabled)
1915 fi
1916
Bram Moolenaar071d4272004-06-13 20:20:40 +00001917 if test "X$PKG_CONFIG" = "X"; then
1918 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1919 fi
1920
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001921 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001922 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1923 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001924 AM_PATH_GTK(2.2.0,
1925 [GUI_LIB_LOC="$GTK_LIBDIR"
1926 GTK_LIBNAME="$GTK_LIBS"
1927 GUI_INC_LOC="$GTK_CFLAGS"], )
1928 if test "x$GTK_CFLAGS" != "x"; then
1929 SKIP_ATHENA=YES
1930 SKIP_NEXTAW=YES
1931 SKIP_MOTIF=YES
1932 GUITYPE=GTK
1933 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001934 fi
1935 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001936 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001937 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1938 || test "0$gtk_minor_version" -ge 2; then
1939 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1940 fi
1941 dnl
1942 dnl if GTK exists, then check for GNOME.
1943 dnl
1944 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001945 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001946 GNOME_INIT_HOOK([have_gnome=yes])
1947 if test "x$have_gnome" = xyes ; then
1948 AC_DEFINE(FEAT_GUI_GNOME)
1949 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1950 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001951 fi
1952 }
1953 fi
1954 fi
1955fi
1956
1957dnl Check for Motif include files location.
1958dnl The LAST one found is used, this makes the highest version to be used,
1959dnl e.g. when Motif1.2 and Motif2.0 are both present.
1960
1961if test -z "$SKIP_MOTIF"; then
1962 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"
1963 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1964 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1965
1966 AC_MSG_CHECKING(for location of Motif GUI includes)
1967 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1968 GUI_INC_LOC=
1969 for try in $gui_includes; do
1970 if test -f "$try/Xm/Xm.h"; then
1971 GUI_INC_LOC=$try
1972 fi
1973 done
1974 if test -n "$GUI_INC_LOC"; then
1975 if test "$GUI_INC_LOC" = /usr/include; then
1976 GUI_INC_LOC=
1977 AC_MSG_RESULT(in default path)
1978 else
1979 AC_MSG_RESULT($GUI_INC_LOC)
1980 fi
1981 else
1982 AC_MSG_RESULT(<not found>)
1983 SKIP_MOTIF=YES
1984 fi
1985fi
1986
1987dnl Check for Motif library files location. In the same order as the include
1988dnl files, to avoid a mixup if several versions are present
1989
1990if test -z "$SKIP_MOTIF"; then
1991 AC_MSG_CHECKING(--with-motif-lib argument)
1992 AC_ARG_WITH(motif-lib,
1993 [ --with-motif-lib=STRING Library for Motif ],
1994 [ MOTIF_LIBNAME="${withval}" ] )
1995
1996 if test -n "$MOTIF_LIBNAME"; then
1997 AC_MSG_RESULT($MOTIF_LIBNAME)
1998 GUI_LIB_LOC=
1999 else
2000 AC_MSG_RESULT(no)
2001
2002 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
2003 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
2004
2005 AC_MSG_CHECKING(for location of Motif GUI libs)
2006 gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
2007 GUI_LIB_LOC=
2008 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00002009 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00002010 if test -f "$libtry"; then
2011 GUI_LIB_LOC=$try
2012 fi
2013 done
2014 done
2015 if test -n "$GUI_LIB_LOC"; then
2016 dnl Remove /usr/lib, it causes trouble on some systems
2017 if test "$GUI_LIB_LOC" = /usr/lib; then
2018 GUI_LIB_LOC=
2019 AC_MSG_RESULT(in default path)
2020 else
2021 if test -n "$GUI_LIB_LOC"; then
2022 AC_MSG_RESULT($GUI_LIB_LOC)
2023 if test "`(uname) 2>/dev/null`" = SunOS &&
2024 uname -r | grep '^5' >/dev/null; then
2025 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
2026 fi
2027 fi
2028 fi
2029 MOTIF_LIBNAME=-lXm
2030 else
2031 AC_MSG_RESULT(<not found>)
2032 SKIP_MOTIF=YES
2033 fi
2034 fi
2035fi
2036
2037if test -z "$SKIP_MOTIF"; then
2038 SKIP_ATHENA=YES
2039 SKIP_NEXTAW=YES
2040 GUITYPE=MOTIF
2041 AC_SUBST(MOTIF_LIBNAME)
2042fi
2043
2044dnl Check if the Athena files can be found
2045
2046GUI_X_LIBS=
2047
2048if test -z "$SKIP_ATHENA"; then
2049 AC_MSG_CHECKING(if Athena header files can be found)
2050 cflags_save=$CFLAGS
2051 CFLAGS="$CFLAGS $X_CFLAGS"
2052 AC_TRY_COMPILE([
2053#include <X11/Intrinsic.h>
2054#include <X11/Xaw/Paned.h>], ,
2055 AC_MSG_RESULT(yes),
2056 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
2057 CFLAGS=$cflags_save
2058fi
2059
2060if test -z "$SKIP_ATHENA"; then
2061 GUITYPE=ATHENA
2062fi
2063
2064if test -z "$SKIP_NEXTAW"; then
2065 AC_MSG_CHECKING(if neXtaw header files can be found)
2066 cflags_save=$CFLAGS
2067 CFLAGS="$CFLAGS $X_CFLAGS"
2068 AC_TRY_COMPILE([
2069#include <X11/Intrinsic.h>
2070#include <X11/neXtaw/Paned.h>], ,
2071 AC_MSG_RESULT(yes),
2072 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
2073 CFLAGS=$cflags_save
2074fi
2075
2076if test -z "$SKIP_NEXTAW"; then
2077 GUITYPE=NEXTAW
2078fi
2079
2080if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2081 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
2082 dnl Avoid adding it when it twice
2083 if test -n "$GUI_INC_LOC"; then
2084 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
2085 fi
2086 if test -n "$GUI_LIB_LOC"; then
2087 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
2088 fi
2089
2090 dnl Check for -lXext and then for -lXmu
2091 ldflags_save=$LDFLAGS
2092 LDFLAGS="$X_LIBS $LDFLAGS"
2093 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
2094 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2095 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
2096 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
2097 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2098 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
2099 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2100 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
2101 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2102 if test -z "$SKIP_MOTIF"; then
2103 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
2104 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2105 fi
2106 LDFLAGS=$ldflags_save
2107
2108 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
2109 AC_MSG_CHECKING(for extra X11 defines)
2110 NARROW_PROTO=
2111 rm -fr conftestdir
2112 if mkdir conftestdir; then
2113 cd conftestdir
2114 cat > Imakefile <<'EOF'
2115acfindx:
2116 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
2117EOF
2118 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2119 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
2120 fi
2121 cd ..
2122 rm -fr conftestdir
2123 fi
2124 if test -z "$NARROW_PROTO"; then
2125 AC_MSG_RESULT(no)
2126 else
2127 AC_MSG_RESULT($NARROW_PROTO)
2128 fi
2129 AC_SUBST(NARROW_PROTO)
2130fi
2131
2132dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
2133dnl use the X11 include path
2134if test "$enable_xsmp" = "yes"; then
2135 cppflags_save=$CPPFLAGS
2136 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2137 AC_CHECK_HEADERS(X11/SM/SMlib.h)
2138 CPPFLAGS=$cppflags_save
2139fi
2140
2141
Bram Moolenaare667c952010-07-05 22:57:59 +02002142if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002143 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
2144 cppflags_save=$CPPFLAGS
2145 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2146 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
2147
2148 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
2149 if test ! "$enable_xim" = "no"; then
2150 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
2151 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
2152 AC_MSG_RESULT(yes),
2153 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
2154 fi
2155 CPPFLAGS=$cppflags_save
2156
2157 dnl automatically enable XIM when hangul input isn't enabled
2158 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
2159 -a "x$GUITYPE" != "xNONE" ; then
2160 AC_MSG_RESULT(X GUI selected; xim has been enabled)
2161 enable_xim="yes"
2162 fi
2163fi
2164
2165if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2166 cppflags_save=$CPPFLAGS
2167 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002168dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
2169 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
2170 AC_TRY_COMPILE([
2171#include <X11/Intrinsic.h>
2172#include <X11/Xmu/Editres.h>],
2173 [int i; i = 0;],
2174 AC_MSG_RESULT(yes)
2175 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
2176 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00002177 CPPFLAGS=$cppflags_save
2178fi
2179
2180dnl Only use the Xm directory when compiling Motif, don't use it for Athena
2181if test -z "$SKIP_MOTIF"; then
2182 cppflags_save=$CPPFLAGS
2183 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002184 AC_CHECK_HEADERS(Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h \
Bram Moolenaarfc1421e2006-04-20 22:17:20 +00002185 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002186
2187 if test $ac_cv_header_Xm_XpmP_h = yes; then
2188 dnl Solaris uses XpmAttributes_21, very annoying.
2189 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
2190 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
2191 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
2192 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2193 )
2194 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00002195 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002196 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002197 CPPFLAGS=$cppflags_save
2198fi
2199
2200if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
2201 AC_MSG_RESULT(no GUI selected; xim has been disabled)
2202 enable_xim="no"
2203fi
2204if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
2205 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
2206 enable_fontset="no"
2207fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002208if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002209 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
2210 enable_fontset="no"
2211fi
2212
Bram Moolenaar071d4272004-06-13 20:20:40 +00002213if test -z "$SKIP_PHOTON"; then
2214 GUITYPE=PHOTONGUI
2215fi
2216
2217AC_SUBST(GUI_INC_LOC)
2218AC_SUBST(GUI_LIB_LOC)
2219AC_SUBST(GUITYPE)
2220AC_SUBST(GUI_X_LIBS)
2221
2222if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2223 AC_MSG_ERROR([cannot use workshop without Motif])
2224fi
2225
2226dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2227if test "$enable_xim" = "yes"; then
2228 AC_DEFINE(FEAT_XIM)
2229fi
2230if test "$enable_fontset" = "yes"; then
2231 AC_DEFINE(FEAT_XFONTSET)
2232fi
2233
2234
2235dnl ---------------------------------------------------------------------------
2236dnl end of GUI-checking
2237dnl ---------------------------------------------------------------------------
2238
2239
2240dnl Only really enable hangul input when GUI and XFONTSET are available
2241if test "$enable_hangulinput" = "yes"; then
2242 if test "x$GUITYPE" = "xNONE"; then
2243 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2244 enable_hangulinput=no
2245 else
2246 AC_DEFINE(FEAT_HANGULIN)
2247 HANGULIN_SRC=hangulin.c
2248 AC_SUBST(HANGULIN_SRC)
2249 HANGULIN_OBJ=objects/hangulin.o
2250 AC_SUBST(HANGULIN_OBJ)
2251 fi
2252fi
2253
2254dnl Checks for libraries and include files.
2255
Bram Moolenaar446cb832008-06-24 21:56:24 +00002256AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
2257 [
2258 AC_RUN_IFELSE([[
2259#include "confdefs.h"
2260#include <ctype.h>
2261#if STDC_HEADERS
2262# include <stdlib.h>
2263# include <stddef.h>
2264#endif
2265main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2266 ]],[
2267 vim_cv_toupper_broken=yes
2268 ],[
2269 vim_cv_toupper_broken=no
2270 ],[
2271 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2272 ])])
2273
2274if test "x$vim_cv_toupper_broken" = "xyes" ; then
2275 AC_DEFINE(BROKEN_TOUPPER)
2276fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002277
2278AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002279AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002280 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2281 AC_MSG_RESULT(no))
2282
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002283AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2284AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2285 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2286 AC_MSG_RESULT(no))
2287
Bram Moolenaar071d4272004-06-13 20:20:40 +00002288dnl Checks for header files.
2289AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2290dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2291if test "$HAS_ELF" = 1; then
2292 AC_CHECK_LIB(elf, main)
2293fi
2294
2295AC_HEADER_DIRENT
2296
Bram Moolenaar071d4272004-06-13 20:20:40 +00002297dnl If sys/wait.h is not found it might still exist but not be POSIX
2298dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2299if test $ac_cv_header_sys_wait_h = no; then
2300 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2301 AC_TRY_COMPILE([#include <sys/wait.h>],
2302 [union wait xx, yy; xx = yy],
2303 AC_MSG_RESULT(yes)
2304 AC_DEFINE(HAVE_SYS_WAIT_H)
2305 AC_DEFINE(HAVE_UNION_WAIT),
2306 AC_MSG_RESULT(no))
2307fi
2308
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002309AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2310 sys/select.h sys/utsname.h termcap.h fcntl.h \
2311 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2312 termio.h iconv.h inttypes.h langinfo.h math.h \
2313 unistd.h stropts.h errno.h sys/resource.h \
2314 sys/systeminfo.h locale.h sys/stream.h termios.h \
2315 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2316 utime.h sys/param.h libintl.h libgen.h \
2317 util/debug.h util/msg18n.h frame.h sys/acl.h \
2318 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002319
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002320dnl sys/ptem.h depends on sys/stream.h on Solaris
2321AC_CHECK_HEADERS(sys/ptem.h, [], [],
2322[#if defined HAVE_SYS_STREAM_H
2323# include <sys/stream.h>
2324#endif])
2325
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002326dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2327AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2328[#if defined HAVE_SYS_PARAM_H
2329# include <sys/param.h>
2330#endif])
2331
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002332
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002333dnl pthread_np.h may exist but can only be used after including pthread.h
2334AC_MSG_CHECKING([for pthread_np.h])
2335AC_TRY_COMPILE([
2336#include <pthread.h>
2337#include <pthread_np.h>],
2338 [int i; i = 0;],
2339 AC_MSG_RESULT(yes)
2340 AC_DEFINE(HAVE_PTHREAD_NP_H),
2341 AC_MSG_RESULT(no))
2342
Bram Moolenaare344bea2005-09-01 20:46:49 +00002343AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002344if test "x$MACOSX" = "xyes"; then
2345 dnl The strings.h file on OS/X contains a warning and nothing useful.
2346 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2347else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002348
2349dnl Check if strings.h and string.h can both be included when defined.
2350AC_MSG_CHECKING([if strings.h can be included after string.h])
2351cppflags_save=$CPPFLAGS
2352CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2353AC_TRY_COMPILE([
2354#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2355# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2356 /* but don't do it on AIX 5.1 (Uribarri) */
2357#endif
2358#ifdef HAVE_XM_XM_H
2359# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2360#endif
2361#ifdef HAVE_STRING_H
2362# include <string.h>
2363#endif
2364#if defined(HAVE_STRINGS_H)
2365# include <strings.h>
2366#endif
2367 ], [int i; i = 0;],
2368 AC_MSG_RESULT(yes),
2369 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2370 AC_MSG_RESULT(no))
2371CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002372fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002373
2374dnl Checks for typedefs, structures, and compiler characteristics.
2375AC_PROG_GCC_TRADITIONAL
2376AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002377AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002378AC_TYPE_MODE_T
2379AC_TYPE_OFF_T
2380AC_TYPE_PID_T
2381AC_TYPE_SIZE_T
2382AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002383AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002384
Bram Moolenaar071d4272004-06-13 20:20:40 +00002385AC_HEADER_TIME
2386AC_CHECK_TYPE(ino_t, long)
2387AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002388AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002389
2390AC_MSG_CHECKING(for rlim_t)
2391if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2392 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2393else
2394 AC_EGREP_CPP(dnl
2395changequote(<<,>>)dnl
2396<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2397changequote([,]),
2398 [
2399#include <sys/types.h>
2400#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002401# include <stdlib.h>
2402# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002403#endif
2404#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002405# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002406#endif
2407 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2408 AC_MSG_RESULT($ac_cv_type_rlim_t)
2409fi
2410if test $ac_cv_type_rlim_t = no; then
2411 cat >> confdefs.h <<\EOF
2412#define rlim_t unsigned long
2413EOF
2414fi
2415
2416AC_MSG_CHECKING(for stack_t)
2417if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2418 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2419else
2420 AC_EGREP_CPP(stack_t,
2421 [
2422#include <sys/types.h>
2423#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002424# include <stdlib.h>
2425# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002426#endif
2427#include <signal.h>
2428 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2429 AC_MSG_RESULT($ac_cv_type_stack_t)
2430fi
2431if test $ac_cv_type_stack_t = no; then
2432 cat >> confdefs.h <<\EOF
2433#define stack_t struct sigaltstack
2434EOF
2435fi
2436
2437dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2438AC_MSG_CHECKING(whether stack_t has an ss_base field)
2439AC_TRY_COMPILE([
2440#include <sys/types.h>
2441#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002442# include <stdlib.h>
2443# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002444#endif
2445#include <signal.h>
2446#include "confdefs.h"
2447 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2448 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2449 AC_MSG_RESULT(no))
2450
2451olibs="$LIBS"
2452AC_MSG_CHECKING(--with-tlib argument)
2453AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2454if test -n "$with_tlib"; then
2455 AC_MSG_RESULT($with_tlib)
2456 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002457 AC_MSG_CHECKING(for linking with $with_tlib library)
2458 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2459 dnl Need to check for tgetent() below.
2460 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002461else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002462 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002463 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2464 dnl curses, because curses is much slower.
2465 dnl Newer versions of ncurses are preferred over anything.
2466 dnl Older versions of ncurses have bugs, get a new one!
2467 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002468 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002469 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002470 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002471 *) tlibs="ncurses termlib termcap curses";;
2472 esac
2473 for libname in $tlibs; do
2474 AC_CHECK_LIB(${libname}, tgetent,,)
2475 if test "x$olibs" != "x$LIBS"; then
2476 dnl It's possible that a library is found but it doesn't work
2477 dnl e.g., shared library that cannot be found
2478 dnl compile and run a test program to be sure
2479 AC_TRY_RUN([
2480#ifdef HAVE_TERMCAP_H
2481# include <termcap.h>
2482#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002483#if STDC_HEADERS
2484# include <stdlib.h>
2485# include <stddef.h>
2486#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002487main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2488 res="OK", res="FAIL", res="FAIL")
2489 if test "$res" = "OK"; then
2490 break
2491 fi
2492 AC_MSG_RESULT($libname library is not usable)
2493 LIBS="$olibs"
2494 fi
2495 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002496 if test "x$olibs" = "x$LIBS"; then
2497 AC_MSG_RESULT(no terminal library found)
2498 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002499fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002500
2501if test "x$olibs" = "x$LIBS"; then
2502 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002503 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002504 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2505 AC_MSG_RESULT(yes),
2506 AC_MSG_ERROR([NOT FOUND!
2507 You need to install a terminal library; for example ncurses.
2508 Or specify the name of the library with --with-tlib.]))
2509fi
2510
Bram Moolenaar446cb832008-06-24 21:56:24 +00002511AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2512 [
2513 AC_RUN_IFELSE([[
2514#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002515#ifdef HAVE_TERMCAP_H
2516# include <termcap.h>
2517#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002518#ifdef HAVE_STRING_H
2519# include <string.h>
2520#endif
2521#if STDC_HEADERS
2522# include <stdlib.h>
2523# include <stddef.h>
2524#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002525main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002526{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2527 ]],[
2528 vim_cv_terminfo=no
2529 ],[
2530 vim_cv_terminfo=yes
2531 ],[
2532 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2533 ])
2534 ])
2535
2536if test "x$vim_cv_terminfo" = "xyes" ; then
2537 AC_DEFINE(TERMINFO)
2538fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002539
2540if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002541 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2542 [
2543 AC_RUN_IFELSE([[
2544#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002545#ifdef HAVE_TERMCAP_H
2546# include <termcap.h>
2547#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002548#if STDC_HEADERS
2549# include <stdlib.h>
2550# include <stddef.h>
2551#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002552main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002553{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2554 ]],[
2555 vim_cv_tgent=zero
2556 ],[
2557 vim_cv_tgent=non-zero
2558 ],[
2559 AC_MSG_ERROR(failed to compile test program.)
2560 ])
2561 ])
2562
2563 if test "x$vim_cv_tgent" = "xzero" ; then
2564 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2565 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002566fi
2567
2568AC_MSG_CHECKING(whether termcap.h contains ospeed)
2569AC_TRY_LINK([
2570#ifdef HAVE_TERMCAP_H
2571# include <termcap.h>
2572#endif
2573 ], [ospeed = 20000],
2574 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2575 [AC_MSG_RESULT(no)
2576 AC_MSG_CHECKING(whether ospeed can be extern)
2577 AC_TRY_LINK([
2578#ifdef HAVE_TERMCAP_H
2579# include <termcap.h>
2580#endif
2581extern short ospeed;
2582 ], [ospeed = 20000],
2583 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2584 AC_MSG_RESULT(no))]
2585 )
2586
2587AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2588AC_TRY_LINK([
2589#ifdef HAVE_TERMCAP_H
2590# include <termcap.h>
2591#endif
2592 ], [if (UP == 0 && BC == 0) PC = 1],
2593 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2594 [AC_MSG_RESULT(no)
2595 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2596 AC_TRY_LINK([
2597#ifdef HAVE_TERMCAP_H
2598# include <termcap.h>
2599#endif
2600extern char *UP, *BC, PC;
2601 ], [if (UP == 0 && BC == 0) PC = 1],
2602 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2603 AC_MSG_RESULT(no))]
2604 )
2605
2606AC_MSG_CHECKING(whether tputs() uses outfuntype)
2607AC_TRY_COMPILE([
2608#ifdef HAVE_TERMCAP_H
2609# include <termcap.h>
2610#endif
2611 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2612 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2613 AC_MSG_RESULT(no))
2614
2615dnl On some SCO machines sys/select redefines struct timeval
2616AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2617AC_TRY_COMPILE([
2618#include <sys/types.h>
2619#include <sys/time.h>
2620#include <sys/select.h>], ,
2621 AC_MSG_RESULT(yes)
2622 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2623 AC_MSG_RESULT(no))
2624
2625dnl AC_DECL_SYS_SIGLIST
2626
2627dnl Checks for pty.c (copied from screen) ==========================
2628AC_MSG_CHECKING(for /dev/ptc)
2629if test -r /dev/ptc; then
2630 AC_DEFINE(HAVE_DEV_PTC)
2631 AC_MSG_RESULT(yes)
2632else
2633 AC_MSG_RESULT(no)
2634fi
2635
2636AC_MSG_CHECKING(for SVR4 ptys)
2637if test -c /dev/ptmx ; then
2638 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2639 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2640 AC_MSG_RESULT(no))
2641else
2642 AC_MSG_RESULT(no)
2643fi
2644
2645AC_MSG_CHECKING(for ptyranges)
2646if test -d /dev/ptym ; then
2647 pdir='/dev/ptym'
2648else
2649 pdir='/dev'
2650fi
2651dnl SCO uses ptyp%d
2652AC_EGREP_CPP(yes,
2653[#ifdef M_UNIX
2654 yes;
2655#endif
2656 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2657dnl if test -c /dev/ptyp19; then
2658dnl ptys=`echo /dev/ptyp??`
2659dnl else
2660dnl ptys=`echo $pdir/pty??`
2661dnl fi
2662if test "$ptys" != "$pdir/pty??" ; then
2663 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2664 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2665 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2666 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2667 AC_MSG_RESULT([$p0 / $p1])
2668else
2669 AC_MSG_RESULT([don't know])
2670fi
2671
2672dnl **** pty mode/group handling ****
2673dnl
2674dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002675rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002676AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2677 [
2678 AC_RUN_IFELSE([[
2679#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002680#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002681#if STDC_HEADERS
2682# include <stdlib.h>
2683# include <stddef.h>
2684#endif
2685#ifdef HAVE_UNISTD_H
2686#include <unistd.h>
2687#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002688#include <sys/stat.h>
2689#include <stdio.h>
2690main()
2691{
2692 struct stat sb;
2693 char *x,*ttyname();
2694 int om, m;
2695 FILE *fp;
2696
2697 if (!(x = ttyname(0))) exit(1);
2698 if (stat(x, &sb)) exit(1);
2699 om = sb.st_mode;
2700 if (om & 002) exit(0);
2701 m = system("mesg y");
2702 if (m == -1 || m == 127) exit(1);
2703 if (stat(x, &sb)) exit(1);
2704 m = sb.st_mode;
2705 if (chmod(x, om)) exit(1);
2706 if (m & 002) exit(0);
2707 if (sb.st_gid == getgid()) exit(1);
2708 if (!(fp=fopen("conftest_grp", "w")))
2709 exit(1);
2710 fprintf(fp, "%d\n", sb.st_gid);
2711 fclose(fp);
2712 exit(0);
2713}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002714 ]],[
2715 if test -f conftest_grp; then
2716 vim_cv_tty_group=`cat conftest_grp`
2717 if test "x$vim_cv_tty_mode" = "x" ; then
2718 vim_cv_tty_mode=0620
2719 fi
2720 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2721 else
2722 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002723 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002724 fi
2725 ],[
2726 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002727 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002728 ],[
2729 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2730 ])
2731 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002732rm -f conftest_grp
2733
Bram Moolenaar446cb832008-06-24 21:56:24 +00002734if test "x$vim_cv_tty_group" != "xworld" ; then
2735 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2736 if test "x$vim_cv_tty_mode" = "x" ; then
2737 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 (propably 0620)])
2738 else
2739 AC_DEFINE(PTYMODE, 0620)
2740 fi
2741fi
2742
Bram Moolenaar071d4272004-06-13 20:20:40 +00002743dnl Checks for library functions. ===================================
2744
2745AC_TYPE_SIGNAL
2746
2747dnl find out what to use at the end of a signal function
2748if test $ac_cv_type_signal = void; then
2749 AC_DEFINE(SIGRETURN, [return])
2750else
2751 AC_DEFINE(SIGRETURN, [return 0])
2752fi
2753
2754dnl check if struct sigcontext is defined (used for SGI only)
2755AC_MSG_CHECKING(for struct sigcontext)
2756AC_TRY_COMPILE([
2757#include <signal.h>
2758test_sig()
2759{
2760 struct sigcontext *scont;
2761 scont = (struct sigcontext *)0;
2762 return 1;
2763} ], ,
2764 AC_MSG_RESULT(yes)
2765 AC_DEFINE(HAVE_SIGCONTEXT),
2766 AC_MSG_RESULT(no))
2767
2768dnl tricky stuff: try to find out if getcwd() is implemented with
2769dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002770AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2771 [
2772 AC_RUN_IFELSE([[
2773#include "confdefs.h"
2774#ifdef HAVE_UNISTD_H
2775#include <unistd.h>
2776#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002777char *dagger[] = { "IFS=pwd", 0 };
2778main()
2779{
2780 char buffer[500];
2781 extern char **environ;
2782 environ = dagger;
2783 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002784}
2785 ]],[
2786 vim_cv_getcwd_broken=no
2787 ],[
2788 vim_cv_getcwd_broken=yes
2789 ],[
2790 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2791 ])
2792 ])
2793
2794if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2795 AC_DEFINE(BAD_GETCWD)
2796fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002797
Bram Moolenaar25153e12010-02-24 14:47:08 +01002798dnl Check for functions in one big call, to reduce the size of configure.
2799dnl Can only be used for functions that do not require any include.
2800AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002801 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002802 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002803 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002804 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002805 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2806 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002807AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002808
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002809dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2810dnl appropriate, so that off_t is 64 bits when needed.
2811AC_SYS_LARGEFILE
2812
Bram Moolenaar071d4272004-06-13 20:20:40 +00002813dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2814AC_MSG_CHECKING(for st_blksize)
2815AC_TRY_COMPILE(
2816[#include <sys/types.h>
2817#include <sys/stat.h>],
2818[ struct stat st;
2819 int n;
2820
2821 stat("/", &st);
2822 n = (int)st.st_blksize;],
2823 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2824 AC_MSG_RESULT(no))
2825
Bram Moolenaar446cb832008-06-24 21:56:24 +00002826AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2827 [
2828 AC_RUN_IFELSE([[
2829#include "confdefs.h"
2830#if STDC_HEADERS
2831# include <stdlib.h>
2832# include <stddef.h>
2833#endif
2834#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002835#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002836main() {struct stat st; exit(stat("configure/", &st) != 0); }
2837 ]],[
2838 vim_cv_stat_ignores_slash=yes
2839 ],[
2840 vim_cv_stat_ignores_slash=no
2841 ],[
2842 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2843 ])
2844 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002845
Bram Moolenaar446cb832008-06-24 21:56:24 +00002846if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2847 AC_DEFINE(STAT_IGNORES_SLASH)
2848fi
2849
Bram Moolenaar071d4272004-06-13 20:20:40 +00002850dnl Link with iconv for charset translation, if not found without library.
2851dnl check for iconv() requires including iconv.h
2852dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2853dnl has been installed.
2854AC_MSG_CHECKING(for iconv_open())
2855save_LIBS="$LIBS"
2856LIBS="$LIBS -liconv"
2857AC_TRY_LINK([
2858#ifdef HAVE_ICONV_H
2859# include <iconv.h>
2860#endif
2861 ], [iconv_open("fr", "to");],
2862 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2863 LIBS="$save_LIBS"
2864 AC_TRY_LINK([
2865#ifdef HAVE_ICONV_H
2866# include <iconv.h>
2867#endif
2868 ], [iconv_open("fr", "to");],
2869 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2870 AC_MSG_RESULT(no)))
2871
2872
2873AC_MSG_CHECKING(for nl_langinfo(CODESET))
2874AC_TRY_LINK([
2875#ifdef HAVE_LANGINFO_H
2876# include <langinfo.h>
2877#endif
2878], [char *cs = nl_langinfo(CODESET);],
2879 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2880 AC_MSG_RESULT(no))
2881
Bram Moolenaar446cb832008-06-24 21:56:24 +00002882dnl Need various functions for floating point support. Only enable
2883dnl floating point when they are all present.
2884AC_CHECK_LIB(m, strtod)
2885AC_MSG_CHECKING([for strtod() and other floating point functions])
2886AC_TRY_LINK([
2887#ifdef HAVE_MATH_H
2888# include <math.h>
2889#endif
2890#if STDC_HEADERS
2891# include <stdlib.h>
2892# include <stddef.h>
2893#endif
2894], [char *s; double d;
2895 d = strtod("1.1", &s);
2896 d = fabs(1.11);
2897 d = ceil(1.11);
2898 d = floor(1.11);
2899 d = log10(1.11);
2900 d = pow(1.11, 2.22);
2901 d = sqrt(1.11);
2902 d = sin(1.11);
2903 d = cos(1.11);
2904 d = atan(1.11);
2905 ],
2906 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2907 AC_MSG_RESULT(no))
2908
Bram Moolenaar071d4272004-06-13 20:20:40 +00002909dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2910dnl when -lacl works, also try to use -lattr (required for Debian).
2911AC_MSG_CHECKING(--disable-acl argument)
2912AC_ARG_ENABLE(acl,
2913 [ --disable-acl Don't check for ACL support.],
2914 , [enable_acl="yes"])
2915if test "$enable_acl" = "yes"; then
2916AC_MSG_RESULT(no)
2917AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2918 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2919 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2920
2921AC_MSG_CHECKING(for POSIX ACL support)
2922AC_TRY_LINK([
2923#include <sys/types.h>
2924#ifdef HAVE_SYS_ACL_H
2925# include <sys/acl.h>
2926#endif
2927acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2928 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2929 acl_free(acl);],
2930 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2931 AC_MSG_RESULT(no))
2932
2933AC_MSG_CHECKING(for Solaris ACL support)
2934AC_TRY_LINK([
2935#ifdef HAVE_SYS_ACL_H
2936# include <sys/acl.h>
2937#endif], [acl("foo", GETACLCNT, 0, NULL);
2938 ],
2939 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2940 AC_MSG_RESULT(no))
2941
2942AC_MSG_CHECKING(for AIX ACL support)
2943AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002944#if STDC_HEADERS
2945# include <stdlib.h>
2946# include <stddef.h>
2947#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002948#ifdef HAVE_SYS_ACL_H
2949# include <sys/acl.h>
2950#endif
2951#ifdef HAVE_SYS_ACCESS_H
2952# include <sys/access.h>
2953#endif
2954#define _ALL_SOURCE
2955
2956#include <sys/stat.h>
2957
2958int aclsize;
2959struct acl *aclent;], [aclsize = sizeof(struct acl);
2960 aclent = (void *)malloc(aclsize);
2961 statacl("foo", STX_NORMAL, aclent, aclsize);
2962 ],
2963 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2964 AC_MSG_RESULT(no))
2965else
2966 AC_MSG_RESULT(yes)
2967fi
2968
2969AC_MSG_CHECKING(--disable-gpm argument)
2970AC_ARG_ENABLE(gpm,
2971 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2972 [enable_gpm="yes"])
2973
2974if test "$enable_gpm" = "yes"; then
2975 AC_MSG_RESULT(no)
2976 dnl Checking if gpm support can be compiled
2977 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2978 [olibs="$LIBS" ; LIBS="-lgpm"]
2979 AC_TRY_LINK(
2980 [#include <gpm.h>
2981 #include <linux/keyboard.h>],
2982 [Gpm_GetLibVersion(NULL);],
2983 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2984 dnl FEAT_MOUSE_GPM if mouse support is included
2985 [vi_cv_have_gpm=yes],
2986 [vi_cv_have_gpm=no])
2987 [LIBS="$olibs"]
2988 )
2989 if test $vi_cv_have_gpm = yes; then
2990 LIBS="$LIBS -lgpm"
2991 AC_DEFINE(HAVE_GPM)
2992 fi
2993else
2994 AC_MSG_RESULT(yes)
2995fi
2996
Bram Moolenaar446cb832008-06-24 21:56:24 +00002997AC_MSG_CHECKING(--disable-sysmouse argument)
2998AC_ARG_ENABLE(sysmouse,
2999 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
3000 [enable_sysmouse="yes"])
3001
3002if test "$enable_sysmouse" = "yes"; then
3003 AC_MSG_RESULT(no)
3004 dnl Checking if sysmouse support can be compiled
3005 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
3006 dnl defines FEAT_SYSMOUSE if mouse support is included
3007 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
3008 AC_TRY_LINK(
3009 [#include <sys/consio.h>
3010 #include <signal.h>
3011 #include <sys/fbio.h>],
3012 [struct mouse_info mouse;
3013 mouse.operation = MOUSE_MODE;
3014 mouse.operation = MOUSE_SHOW;
3015 mouse.u.mode.mode = 0;
3016 mouse.u.mode.signal = SIGUSR2;],
3017 [vi_cv_have_sysmouse=yes],
3018 [vi_cv_have_sysmouse=no])
3019 )
3020 if test $vi_cv_have_sysmouse = yes; then
3021 AC_DEFINE(HAVE_SYSMOUSE)
3022 fi
3023else
3024 AC_MSG_RESULT(yes)
3025fi
3026
Bram Moolenaarf05da212009-11-17 16:13:15 +00003027dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
3028AC_MSG_CHECKING(for FD_CLOEXEC)
3029AC_TRY_COMPILE(
3030[#if HAVE_FCNTL_H
3031# include <fcntl.h>
3032#endif],
3033[ int flag = FD_CLOEXEC;],
3034 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
3035 AC_MSG_RESULT(not usable))
3036
Bram Moolenaar071d4272004-06-13 20:20:40 +00003037dnl rename needs to be checked separately to work on Nextstep with cc
3038AC_MSG_CHECKING(for rename)
3039AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
3040 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
3041 AC_MSG_RESULT(no))
3042
3043dnl sysctl() may exist but not the arguments we use
3044AC_MSG_CHECKING(for sysctl)
3045AC_TRY_COMPILE(
3046[#include <sys/types.h>
3047#include <sys/sysctl.h>],
3048[ int mib[2], r;
3049 size_t len;
3050
3051 mib[0] = CTL_HW;
3052 mib[1] = HW_USERMEM;
3053 len = sizeof(r);
3054 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
3055 ],
3056 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
3057 AC_MSG_RESULT(not usable))
3058
3059dnl sysinfo() may exist but not be Linux compatible
3060AC_MSG_CHECKING(for sysinfo)
3061AC_TRY_COMPILE(
3062[#include <sys/types.h>
3063#include <sys/sysinfo.h>],
3064[ struct sysinfo sinfo;
3065 int t;
3066
3067 (void)sysinfo(&sinfo);
3068 t = sinfo.totalram;
3069 ],
3070 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
3071 AC_MSG_RESULT(not usable))
3072
Bram Moolenaar914572a2007-05-01 11:37:47 +00003073dnl struct sysinfo may have the mem_unit field or not
3074AC_MSG_CHECKING(for sysinfo.mem_unit)
3075AC_TRY_COMPILE(
3076[#include <sys/types.h>
3077#include <sys/sysinfo.h>],
3078[ struct sysinfo sinfo;
3079 sinfo.mem_unit = 1;
3080 ],
3081 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
3082 AC_MSG_RESULT(no))
3083
Bram Moolenaar071d4272004-06-13 20:20:40 +00003084dnl sysconf() may exist but not support what we want to use
3085AC_MSG_CHECKING(for sysconf)
3086AC_TRY_COMPILE(
3087[#include <unistd.h>],
3088[ (void)sysconf(_SC_PAGESIZE);
3089 (void)sysconf(_SC_PHYS_PAGES);
3090 ],
3091 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
3092 AC_MSG_RESULT(not usable))
3093
Bram Moolenaar914703b2010-05-31 21:59:46 +02003094AC_CHECK_SIZEOF([int])
3095AC_CHECK_SIZEOF([long])
3096AC_CHECK_SIZEOF([time_t])
3097AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02003098
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003099dnl Make sure that uint32_t is really 32 bits unsigned.
3100AC_MSG_CHECKING([uint32_t is 32 bits])
3101AC_TRY_RUN([
3102#ifdef HAVE_STDINT_H
3103# include <stdint.h>
3104#endif
3105#ifdef HAVE_INTTYPES_H
3106# include <inttypes.h>
3107#endif
3108main() {
3109 uint32_t nr1 = (uint32_t)-1;
3110 uint32_t nr2 = (uint32_t)0xffffffffUL;
3111 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
3112 exit(0);
3113}],
3114AC_MSG_RESULT(ok),
3115AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
3116AC_MSG_ERROR([could not compile program using uint32_t.]))
3117
Bram Moolenaar446cb832008-06-24 21:56:24 +00003118dnl Check for memmove() before bcopy(), makes memmove() be used when both are
3119dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
3120
Bram Moolenaar071d4272004-06-13 20:20:40 +00003121[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00003122#include "confdefs.h"
3123#ifdef HAVE_STRING_H
3124# include <string.h>
3125#endif
3126#if STDC_HEADERS
3127# include <stdlib.h>
3128# include <stddef.h>
3129#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003130main() {
3131 char buf[10];
3132 strcpy(buf, "abcdefghi");
3133 mch_memmove(buf, buf + 2, 3);
3134 if (strncmp(buf, "ababcf", 6))
3135 exit(1);
3136 strcpy(buf, "abcdefghi");
3137 mch_memmove(buf + 2, buf, 3);
3138 if (strncmp(buf, "cdedef", 6))
3139 exit(1);
3140 exit(0); /* libc version works properly. */
3141}']
3142
Bram Moolenaar446cb832008-06-24 21:56:24 +00003143AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
3144 [
3145 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
3146 [
3147 vim_cv_memmove_handles_overlap=yes
3148 ],[
3149 vim_cv_memmove_handles_overlap=no
3150 ],[
3151 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
3152 ])
3153 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003154
Bram Moolenaar446cb832008-06-24 21:56:24 +00003155if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
3156 AC_DEFINE(USEMEMMOVE)
3157else
3158 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
3159 [
3160 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
3161 [
3162 vim_cv_bcopy_handles_overlap=yes
3163 ],[
3164 vim_cv_bcopy_handles_overlap=no
3165 ],[
3166 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
3167 ])
3168 ])
3169
3170 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
3171 AC_DEFINE(USEBCOPY)
3172 else
3173 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
3174 [
3175 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
3176 [
3177 vim_cv_memcpy_handles_overlap=yes
3178 ],[
3179 vim_cv_memcpy_handles_overlap=no
3180 ],[
3181 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
3182 ])
3183 ])
3184
3185 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
3186 AC_DEFINE(USEMEMCPY)
3187 fi
3188 fi
3189fi
3190
Bram Moolenaar071d4272004-06-13 20:20:40 +00003191
3192dnl Check for multibyte locale functions
3193dnl Find out if _Xsetlocale() is supported by libX11.
3194dnl Check if X_LOCALE should be defined.
3195
3196if test "$enable_multibyte" = "yes"; then
3197 cflags_save=$CFLAGS
3198 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00003199 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003200 CFLAGS="$CFLAGS -I$x_includes"
3201 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
3202 AC_MSG_CHECKING(whether X_LOCALE needed)
3203 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
3204 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
3205 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
3206 AC_MSG_RESULT(no))
3207 fi
3208 CFLAGS=$cflags_save
3209 LDFLAGS=$ldflags_save
3210fi
3211
3212dnl Link with xpg4, it is said to make Korean locale working
3213AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
3214
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003215dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003216dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003217dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003218dnl -t for typedefs (many ctags have this)
3219dnl -s for static functions (Elvis ctags only?)
3220dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
3221dnl -i+m to test for older Exuberant ctags
3222AC_MSG_CHECKING(how to create tags)
3223test -f tags && mv tags tags.save
3224if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003225 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003226else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003227 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003228 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
3229 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
3230 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
3231 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
3232 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
3233 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
3234 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
3235fi
3236test -f tags.save && mv tags.save tags
3237AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
3238
3239dnl Check how we can run man with a section number
3240AC_MSG_CHECKING(how to run man with a section nr)
3241MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00003242(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 +00003243AC_MSG_RESULT($MANDEF)
3244if test "$MANDEF" = "man -s"; then
3245 AC_DEFINE(USEMAN_S)
3246fi
3247
3248dnl Check if gettext() is working and if it needs -lintl
3249AC_MSG_CHECKING(--disable-nls argument)
3250AC_ARG_ENABLE(nls,
3251 [ --disable-nls Don't support NLS (gettext()).], ,
3252 [enable_nls="yes"])
3253
3254if test "$enable_nls" = "yes"; then
3255 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00003256
3257 INSTALL_LANGS=install-languages
3258 AC_SUBST(INSTALL_LANGS)
3259 INSTALL_TOOL_LANGS=install-tool-languages
3260 AC_SUBST(INSTALL_TOOL_LANGS)
3261
Bram Moolenaar071d4272004-06-13 20:20:40 +00003262 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
3263 AC_MSG_CHECKING([for NLS])
3264 if test -f po/Makefile; then
3265 have_gettext="no"
3266 if test -n "$MSGFMT"; then
3267 AC_TRY_LINK(
3268 [#include <libintl.h>],
3269 [gettext("Test");],
3270 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3271 olibs=$LIBS
3272 LIBS="$LIBS -lintl"
3273 AC_TRY_LINK(
3274 [#include <libintl.h>],
3275 [gettext("Test");],
3276 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3277 AC_MSG_RESULT([gettext() doesn't work]);
3278 LIBS=$olibs))
3279 else
3280 AC_MSG_RESULT([msgfmt not found - disabled]);
3281 fi
3282 if test $have_gettext = "yes"; then
3283 AC_DEFINE(HAVE_GETTEXT)
3284 MAKEMO=yes
3285 AC_SUBST(MAKEMO)
3286 dnl this was added in GNU gettext 0.10.36
3287 AC_CHECK_FUNCS(bind_textdomain_codeset)
3288 dnl _nl_msg_cat_cntr is required for GNU gettext
3289 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3290 AC_TRY_LINK(
3291 [#include <libintl.h>
3292 extern int _nl_msg_cat_cntr;],
3293 [++_nl_msg_cat_cntr;],
3294 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3295 AC_MSG_RESULT([no]))
3296 fi
3297 else
3298 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3299 fi
3300else
3301 AC_MSG_RESULT(yes)
3302fi
3303
3304dnl Check for dynamic linking loader
3305AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3306if test x${DLL} = xdlfcn.h; then
3307 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3308 AC_MSG_CHECKING([for dlopen()])
3309 AC_TRY_LINK(,[
3310 extern void* dlopen();
3311 dlopen();
3312 ],
3313 AC_MSG_RESULT(yes);
3314 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3315 AC_MSG_RESULT(no);
3316 AC_MSG_CHECKING([for dlopen() in -ldl])
3317 olibs=$LIBS
3318 LIBS="$LIBS -ldl"
3319 AC_TRY_LINK(,[
3320 extern void* dlopen();
3321 dlopen();
3322 ],
3323 AC_MSG_RESULT(yes);
3324 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3325 AC_MSG_RESULT(no);
3326 LIBS=$olibs))
3327 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3328 dnl ick :-)
3329 AC_MSG_CHECKING([for dlsym()])
3330 AC_TRY_LINK(,[
3331 extern void* dlsym();
3332 dlsym();
3333 ],
3334 AC_MSG_RESULT(yes);
3335 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3336 AC_MSG_RESULT(no);
3337 AC_MSG_CHECKING([for dlsym() in -ldl])
3338 olibs=$LIBS
3339 LIBS="$LIBS -ldl"
3340 AC_TRY_LINK(,[
3341 extern void* dlsym();
3342 dlsym();
3343 ],
3344 AC_MSG_RESULT(yes);
3345 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3346 AC_MSG_RESULT(no);
3347 LIBS=$olibs))
3348elif test x${DLL} = xdl.h; then
3349 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3350 AC_MSG_CHECKING([for shl_load()])
3351 AC_TRY_LINK(,[
3352 extern void* shl_load();
3353 shl_load();
3354 ],
3355 AC_MSG_RESULT(yes);
3356 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3357 AC_MSG_RESULT(no);
3358 AC_MSG_CHECKING([for shl_load() in -ldld])
3359 olibs=$LIBS
3360 LIBS="$LIBS -ldld"
3361 AC_TRY_LINK(,[
3362 extern void* shl_load();
3363 shl_load();
3364 ],
3365 AC_MSG_RESULT(yes);
3366 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3367 AC_MSG_RESULT(no);
3368 LIBS=$olibs))
3369fi
3370AC_CHECK_HEADERS(setjmp.h)
3371
3372if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3373 dnl -ldl must come after DynaLoader.a
3374 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3375 LIBS=`echo $LIBS | sed s/-ldl//`
3376 PERL_LIBS="$PERL_LIBS -ldl"
3377 fi
3378fi
3379
Bram Moolenaar164fca32010-07-14 13:58:07 +02003380if test "x$MACOSX" = "xyes"; then
3381 AC_MSG_CHECKING(whether we need -framework Cocoa)
3382 dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
3383 dnl disabled during tiny build)
3384 if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
3385 LIBS=$"$LIBS -framework Cocoa"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003386 AC_MSG_RESULT(yes)
3387 else
3388 AC_MSG_RESULT(no)
3389 fi
3390fi
Bram Moolenaar164fca32010-07-14 13:58:07 +02003391if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003392 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003393fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003394
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003395dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3396dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3397dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003398dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3399dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003400DEPEND_CFLAGS_FILTER=
3401if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003402 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003403 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003404 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003405 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003406 AC_MSG_RESULT(yes)
3407 else
3408 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003409 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003410 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3411 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003412 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003413 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3414 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003415 CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/-D_FORTIFY_SOURCE=.//g' -e 's/$/ -D_FORTIFY_SOURCE=1/'`
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003416 AC_MSG_RESULT(yes)
3417 else
3418 AC_MSG_RESULT(no)
3419 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003420fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003421AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003422
3423dnl write output files
3424AC_OUTPUT(auto/config.mk:config.mk.in)
3425
3426dnl vim: set sw=2 tw=78 fo+=l: