blob: 112f8a62769ddbeeac25e6562134664b26716e12 [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
216 have_local_dir=yes
217 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,
416 [ --enable-luainterp Include Lua interpreter.], ,
417 [enable_luainterp="no"])
418AC_MSG_RESULT($enable_luainterp)
419
420if test "$enable_luainterp" = "yes"; then
421 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)
480 fi
481 AC_SUBST(LUA_SRC)
482 AC_SUBST(LUA_OBJ)
483 AC_SUBST(LUA_PRO)
484 AC_SUBST(LUA_LIBS)
485 AC_SUBST(LUA_CFLAGS)
486fi
487
488
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000489dnl Check for MzScheme feature.
490AC_MSG_CHECKING(--enable-mzschemeinterp argument)
491AC_ARG_ENABLE(mzschemeinterp,
492 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
493 [enable_mzschemeinterp="no"])
494AC_MSG_RESULT($enable_mzschemeinterp)
495
496if test "$enable_mzschemeinterp" = "yes"; then
497 dnl -- find the mzscheme executable
498 AC_SUBST(vi_cv_path_mzscheme)
499
500 AC_MSG_CHECKING(--with-plthome argument)
501 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000502 [ --with-plthome=PLTHOME Use PLTHOME.],
503 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000504 with_plthome="";AC_MSG_RESULT("no"))
505
506 if test "X$with_plthome" != "X"; then
507 vi_cv_path_mzscheme_pfx="$with_plthome"
508 else
509 AC_MSG_CHECKING(PLTHOME environment var)
510 if test "X$PLTHOME" != "X"; then
511 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000512 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000513 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000514 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000515 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000516 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000517
518 dnl resolve symbolic link, the executable is often elsewhere and there
519 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000520 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000521 lsout=`ls -l $vi_cv_path_mzscheme`
522 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
523 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
524 fi
525 fi
526
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000527 if test "X$vi_cv_path_mzscheme" != "X"; then
528 dnl -- find where MzScheme thinks it was installed
529 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000530 dnl different versions of MzScheme differ in command line processing
531 dnl use universal approach
532 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000533 (build-path (call-with-values \
534 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000535 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
536 dnl Remove a trailing slash
537 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
538 sed -e 's+/$++'` ])
539 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000540 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000541 fi
542 fi
543
Bram Moolenaard7afed32007-05-06 13:26:41 +0000544 SCHEME_INC=
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000545 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
546 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
547 if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000548 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
549 AC_MSG_RESULT(yes)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000550 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000551 AC_MSG_RESULT(no)
552 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000553 if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000554 AC_MSG_RESULT(yes)
555 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaard7afed32007-05-06 13:26:41 +0000556 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000557 AC_MSG_RESULT(no)
558 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
559 if test -f /usr/include/plt/scheme.h; then
560 AC_MSG_RESULT(yes)
561 SCHEME_INC=/usr/include/plt
562 else
563 AC_MSG_RESULT(no)
564 vi_cv_path_mzscheme_pfx=
565 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000566 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000567 fi
568 fi
569
570 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000571 if test "x$MACOSX" = "xyes"; then
572 MZSCHEME_LIBS="-framework PLT_MzScheme"
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000573 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
574 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
575 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000576 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
Bram Moolenaar9048f942007-05-12 14:32:25 +0000577 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 +0000578 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000579 dnl Using shared objects
580 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
581 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
582 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
583 else
584 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
585 fi
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000586 if test "$GCC" = yes; then
587 dnl Make Vim remember the path to the library. For when it's not in
588 dnl $LD_LIBRARY_PATH.
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000589 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000590 elif test "`(uname) 2>/dev/null`" = SunOS &&
591 uname -r | grep '^5' >/dev/null; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000592 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000593 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000594 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000595 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
596 SCHEME_COLLECTS=lib/plt/
597 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000598 if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
599 dnl need to generate bytecode for MzScheme base
600 MZSCHEME_EXTRA="mzscheme_base.c"
601 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
602 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
603 fi
604 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaard7afed32007-05-06 13:26:41 +0000605 -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000606 MZSCHEME_SRC="if_mzsch.c"
607 MZSCHEME_OBJ="objects/if_mzsch.o"
608 MZSCHEME_PRO="if_mzsch.pro"
609 AC_DEFINE(FEAT_MZSCHEME)
610 fi
611 AC_SUBST(MZSCHEME_SRC)
612 AC_SUBST(MZSCHEME_OBJ)
613 AC_SUBST(MZSCHEME_PRO)
614 AC_SUBST(MZSCHEME_LIBS)
615 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000616 AC_SUBST(MZSCHEME_EXTRA)
617 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000618fi
619
620
Bram Moolenaar071d4272004-06-13 20:20:40 +0000621AC_MSG_CHECKING(--enable-perlinterp argument)
622AC_ARG_ENABLE(perlinterp,
623 [ --enable-perlinterp Include Perl interpreter.], ,
624 [enable_perlinterp="no"])
625AC_MSG_RESULT($enable_perlinterp)
626if test "$enable_perlinterp" = "yes"; then
627 AC_SUBST(vi_cv_path_perl)
628 AC_PATH_PROG(vi_cv_path_perl, perl)
629 if test "X$vi_cv_path_perl" != "X"; then
630 AC_MSG_CHECKING(Perl version)
631 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
632 eval `$vi_cv_path_perl -V:usethreads`
633 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
634 badthreads=no
635 else
636 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
637 eval `$vi_cv_path_perl -V:use5005threads`
638 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
639 badthreads=no
640 else
641 badthreads=yes
642 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
643 fi
644 else
645 badthreads=yes
646 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
647 fi
648 fi
649 if test $badthreads = no; then
650 AC_MSG_RESULT(OK)
651 eval `$vi_cv_path_perl -V:shrpenv`
652 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
653 shrpenv=""
654 fi
655 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
656 AC_SUBST(vi_cv_perllib)
657 dnl Remove "-fno-something", it breaks using cproto.
658 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
659 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
660 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
661 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
662 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
663 -e 's/-bE:perl.exp//' -e 's/-lc //'`
664 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
665 dnl a test in configure may fail because of that.
666 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
667 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
668
669 dnl check that compiling a simple program still works with the flags
670 dnl added for Perl.
671 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
672 cflags_save=$CFLAGS
673 libs_save=$LIBS
674 ldflags_save=$LDFLAGS
675 CFLAGS="$CFLAGS $perlcppflags"
676 LIBS="$LIBS $perllibs"
677 LDFLAGS="$perlldflags $LDFLAGS"
678 AC_TRY_LINK(,[ ],
679 AC_MSG_RESULT(yes); perl_ok=yes,
680 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
681 CFLAGS=$cflags_save
682 LIBS=$libs_save
683 LDFLAGS=$ldflags_save
684 if test $perl_ok = yes; then
685 if test "X$perlcppflags" != "X"; then
Bram Moolenaard7afed32007-05-06 13:26:41 +0000686 dnl remove -pipe and -Wxxx, it confuses cproto
687 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000688 fi
689 if test "X$perlldflags" != "X"; then
690 LDFLAGS="$perlldflags $LDFLAGS"
691 fi
692 PERL_LIBS=$perllibs
693 PERL_SRC="auto/if_perl.c if_perlsfio.c"
694 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
695 PERL_PRO="if_perl.pro if_perlsfio.pro"
696 AC_DEFINE(FEAT_PERL)
697 fi
698 fi
699 else
700 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
701 fi
702 fi
703
704 if test "x$MACOSX" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +0000705 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000706 dir=/System/Library/Perl
707 darwindir=$dir/darwin
708 if test -d $darwindir; then
709 PERL=/usr/bin/perl
710 else
711 dnl Mac OS X 10.3
712 dir=/System/Library/Perl/5.8.1
713 darwindir=$dir/darwin-thread-multi-2level
714 if test -d $darwindir; then
715 PERL=/usr/bin/perl
716 fi
717 fi
718 if test -n "$PERL"; then
719 PERL_DIR="$dir"
720 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
721 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
722 PERL_LIBS="-L$darwindir/CORE -lperl"
723 fi
724 fi
725fi
726AC_SUBST(shrpenv)
727AC_SUBST(PERL_SRC)
728AC_SUBST(PERL_OBJ)
729AC_SUBST(PERL_PRO)
730AC_SUBST(PERL_CFLAGS)
731AC_SUBST(PERL_LIBS)
732
733AC_MSG_CHECKING(--enable-pythoninterp argument)
734AC_ARG_ENABLE(pythoninterp,
735 [ --enable-pythoninterp Include Python interpreter.], ,
736 [enable_pythoninterp="no"])
737AC_MSG_RESULT($enable_pythoninterp)
738if test "$enable_pythoninterp" = "yes"; then
739 dnl -- find the python executable
740 AC_PATH_PROG(vi_cv_path_python, python)
741 if test "X$vi_cv_path_python" != "X"; then
742
743 dnl -- get its version number
744 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
745 [[vi_cv_var_python_version=`
746 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
747 ]])
748
749 dnl -- it must be at least version 1.4
750 AC_MSG_CHECKING(Python is 1.4 or better)
751 if ${vi_cv_path_python} -c \
752 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
753 then
754 AC_MSG_RESULT(yep)
755
756 dnl -- find where python thinks it was installed
757 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
758 [ vi_cv_path_python_pfx=`
759 ${vi_cv_path_python} -c \
760 "import sys; print sys.prefix"` ])
761
762 dnl -- and where it thinks it runs
763 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
764 [ vi_cv_path_python_epfx=`
765 ${vi_cv_path_python} -c \
766 "import sys; print sys.exec_prefix"` ])
767
768 dnl -- python's internal library path
769
770 AC_CACHE_VAL(vi_cv_path_pythonpath,
771 [ vi_cv_path_pythonpath=`
772 unset PYTHONPATH;
773 ${vi_cv_path_python} -c \
774 "import sys, string; print string.join(sys.path,':')"` ])
775
776 dnl -- where the Python implementation library archives are
777
778 AC_ARG_WITH(python-config-dir,
779 [ --with-python-config-dir=PATH Python's config directory],
780 [ vi_cv_path_python_conf="${withval}" ] )
781
782 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
783 [
784 vi_cv_path_python_conf=
785 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
Bram Moolenaar72951072009-12-02 16:58:33 +0000786 for subdir in lib64 lib share; do
Bram Moolenaar071d4272004-06-13 20:20:40 +0000787 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
788 if test -d "$d" && test -f "$d/config.c"; then
789 vi_cv_path_python_conf="$d"
790 fi
791 done
792 done
793 ])
794
795 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
796
797 if test "X$PYTHON_CONFDIR" = "X"; then
798 AC_MSG_RESULT([can't find it!])
799 else
800
801 dnl -- we need to examine Python's config/Makefile too
802 dnl see what the interpreter is built from
803 AC_CACHE_VAL(vi_cv_path_python_plibs,
804 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000805 pwd=`pwd`
806 tmp_mkf="$pwd/config-PyMake$$"
807 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000808__:
Bram Moolenaar218116c2010-05-20 21:46:00 +0200809 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000810 @echo "python_LIBS='$(LIBS)'"
811 @echo "python_SYSLIBS='$(SYSLIBS)'"
812 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
813eof
814 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000815 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
816 rm -f -- "${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000817 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
818 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
819 vi_cv_path_python_plibs="-framework Python"
820 else
821 if test "${vi_cv_var_python_version}" = "1.4"; then
822 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
823 else
824 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
825 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +0200826 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 +0000827 dnl remove -ltermcap, it can conflict with an earlier -lncurses
828 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
829 fi
830 ])
831
832 PYTHON_LIBS="${vi_cv_path_python_plibs}"
833 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
834 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
835 else
836 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}"
837 fi
838 PYTHON_SRC="if_python.c"
839 dnl For Mac OSX 10.2 config.o is included in the Python library.
840 if test "x$MACOSX" = "xyes"; then
841 PYTHON_OBJ="objects/if_python.o"
842 else
843 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
844 fi
845 if test "${vi_cv_var_python_version}" = "1.4"; then
846 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
847 fi
848 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
849
850 dnl On FreeBSD linking with "-pthread" is required to use threads.
851 dnl _THREAD_SAFE must be used for compiling then.
852 dnl The "-pthread" is added to $LIBS, so that the following check for
853 dnl sigaltstack() will look in libc_r (it's there in libc!).
854 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
855 dnl will then define target-specific defines, e.g., -D_REENTRANT.
856 dnl Don't do this for Mac OSX, -pthread will generate a warning.
857 AC_MSG_CHECKING([if -pthread should be used])
858 threadsafe_flag=
859 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000860 dnl if test "x$MACOSX" != "xyes"; then
861 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000862 test "$GCC" = yes && threadsafe_flag="-pthread"
863 if test "`(uname) 2>/dev/null`" = FreeBSD; then
864 threadsafe_flag="-D_THREAD_SAFE"
865 thread_lib="-pthread"
866 fi
867 fi
868 libs_save_old=$LIBS
869 if test -n "$threadsafe_flag"; then
870 cflags_save=$CFLAGS
871 CFLAGS="$CFLAGS $threadsafe_flag"
872 LIBS="$LIBS $thread_lib"
873 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200874 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000875 AC_MSG_RESULT(no); LIBS=$libs_save_old
876 )
877 CFLAGS=$cflags_save
878 else
879 AC_MSG_RESULT(no)
880 fi
881
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200882 dnl Check that compiling a simple program still works with the flags
Bram Moolenaar071d4272004-06-13 20:20:40 +0000883 dnl added for Python.
884 AC_MSG_CHECKING([if compile and link flags for Python are sane])
885 cflags_save=$CFLAGS
886 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200887 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000888 LIBS="$LIBS $PYTHON_LIBS"
889 AC_TRY_LINK(,[ ],
890 AC_MSG_RESULT(yes); python_ok=yes,
891 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
892 CFLAGS=$cflags_save
893 LIBS=$libs_save
894 if test $python_ok = yes; then
895 AC_DEFINE(FEAT_PYTHON)
896 else
897 LIBS=$libs_save_old
898 PYTHON_SRC=
899 PYTHON_OBJ=
900 PYTHON_LIBS=
901 PYTHON_CFLAGS=
902 fi
903
904 fi
905 else
906 AC_MSG_RESULT(too old)
907 fi
908 fi
909fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200910
Bram Moolenaar071d4272004-06-13 20:20:40 +0000911AC_SUBST(PYTHON_CONFDIR)
912AC_SUBST(PYTHON_LIBS)
913AC_SUBST(PYTHON_GETPATH_CFLAGS)
914AC_SUBST(PYTHON_CFLAGS)
915AC_SUBST(PYTHON_SRC)
916AC_SUBST(PYTHON_OBJ)
917
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200918
919AC_MSG_CHECKING(--enable-python3interp argument)
920AC_ARG_ENABLE(python3interp,
921 [ --enable-python3interp Include Python3 interpreter.], ,
922 [enable_python3interp="no"])
923AC_MSG_RESULT($enable_python3interp)
924if test "$enable_python3interp" = "yes"; then
925 dnl -- find the python3 executable
926 AC_PATH_PROG(vi_cv_path_python3, python3)
927 if test "X$vi_cv_path_python3" != "X"; then
928
929 dnl -- get its version number
930 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
931 [[vi_cv_var_python3_version=`
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200932 ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200933 ]])
934
935 dnl -- find where python3 thinks it was installed
936 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
937 [ vi_cv_path_python3_pfx=`
938 ${vi_cv_path_python3} -c \
939 "import sys; print(sys.prefix)"` ])
940
941 dnl -- and where it thinks it runs
942 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
943 [ vi_cv_path_python3_epfx=`
944 ${vi_cv_path_python3} -c \
945 "import sys; print(sys.exec_prefix)"` ])
946
947 dnl -- python3's internal library path
948
949 AC_CACHE_VAL(vi_cv_path_python3path,
950 [ vi_cv_path_python3path=`
951 unset PYTHONPATH;
952 ${vi_cv_path_python3} -c \
953 "import sys, string; print(':'.join(sys.path))"` ])
954
955 dnl -- where the Python implementation library archives are
956
957 AC_ARG_WITH(python3-config-dir,
958 [ --with-python3-config-dir=PATH Python's config directory],
959 [ vi_cv_path_python3_conf="${withval}" ] )
960
961 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
962 [
963 vi_cv_path_python3_conf=
964 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
965 for subdir in lib share; do
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200966 d="${path}/${subdir}/python${vi_cv_var_python3_version}/config"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200967 if test -d "$d" && test -f "$d/config.c"; then
968 vi_cv_path_python3_conf="$d"
969 fi
970 done
971 done
972 ])
973
974 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
975
976 if test "X$PYTHON3_CONFDIR" = "X"; then
977 AC_MSG_RESULT([can't find it!])
978 else
979
980 dnl -- we need to examine Python's config/Makefile too
981 dnl see what the interpreter is built from
982 AC_CACHE_VAL(vi_cv_path_python3_plibs,
983 [
984 pwd=`pwd`
985 tmp_mkf="$pwd/config-PyMake$$"
986 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
987__:
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200988 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200989 @echo "python3_LIBS='$(LIBS)'"
990 @echo "python3_SYSLIBS='$(SYSLIBS)'"
991 @echo "python3_LINKFORSHARED='$(LINKFORSHARED)'"
992eof
993 dnl -- delete the lines from make about Entering/Leaving directory
994 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
995 rm -f -- "${tmp_mkf}"
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200996 vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}"
997 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 +0200998 dnl remove -ltermcap, it can conflict with an earlier -lncurses
999 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1000 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1001 ])
1002
1003 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
1004 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001005 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001006 else
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001007 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 +02001008 fi
1009 PYTHON3_SRC="if_python3.c"
1010 dnl For Mac OSX 10.2 config.o is included in the Python library.
1011 if test "x$MACOSX" = "xyes"; then
1012 PYTHON3_OBJ="objects/if_python3.o"
1013 else
1014 PYTHON3_OBJ="objects/if_python3.o objects/py3_config.o"
1015 fi
1016
1017 dnl On FreeBSD linking with "-pthread" is required to use threads.
1018 dnl _THREAD_SAFE must be used for compiling then.
1019 dnl The "-pthread" is added to $LIBS, so that the following check for
1020 dnl sigaltstack() will look in libc_r (it's there in libc!).
1021 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1022 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1023 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1024 AC_MSG_CHECKING([if -pthread should be used])
1025 threadsafe_flag=
1026 thread_lib=
1027 dnl if test "x$MACOSX" != "xyes"; then
1028 if test "`(uname) 2>/dev/null`" != Darwin; then
1029 test "$GCC" = yes && threadsafe_flag="-pthread"
1030 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1031 threadsafe_flag="-D_THREAD_SAFE"
1032 thread_lib="-pthread"
1033 fi
1034 fi
1035 libs_save_old=$LIBS
1036 if test -n "$threadsafe_flag"; then
1037 cflags_save=$CFLAGS
1038 CFLAGS="$CFLAGS $threadsafe_flag"
1039 LIBS="$LIBS $thread_lib"
1040 AC_TRY_LINK(,[ ],
1041 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1042 AC_MSG_RESULT(no); LIBS=$libs_save_old
1043 )
1044 CFLAGS=$cflags_save
1045 else
1046 AC_MSG_RESULT(no)
1047 fi
1048
1049 dnl check that compiling a simple program still works with the flags
1050 dnl added for Python.
1051 AC_MSG_CHECKING([if compile and link flags for Python are sane])
1052 cflags_save=$CFLAGS
1053 libs_save=$LIBS
1054 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1055 LIBS="$LIBS $PYTHON3_LIBS"
1056 AC_TRY_LINK(,[ ],
1057 AC_MSG_RESULT(yes); python3_ok=yes,
1058 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1059 CFLAGS=$cflags_save
1060 LIBS=$libs_save
1061 if test "$python3_ok" = yes; then
1062 AC_DEFINE(FEAT_PYTHON3)
1063 else
1064 LIBS=$libs_save_old
1065 PYTHON3_SRC=
1066 PYTHON3_OBJ=
1067 PYTHON3_LIBS=
1068 PYTHON3_CFLAGS=
1069 fi
1070 fi
1071 fi
1072fi
1073
1074AC_SUBST(PYTHON3_CONFDIR)
1075AC_SUBST(PYTHON3_LIBS)
1076AC_SUBST(PYTHON3_CFLAGS)
1077AC_SUBST(PYTHON3_SRC)
1078AC_SUBST(PYTHON3_OBJ)
1079
1080dnl if python2.x and python3.x are enabled one can only link in code
1081dnl with dlopen(), dlsym(), dlclose()
1082if test "$python_ok" = yes && test "$python3_ok" = yes; then
1083 AC_DEFINE(DYNAMIC_PYTHON)
1084 AC_DEFINE(DYNAMIC_PYTHON3)
1085 PYTHON_SRC="if_python.c"
1086 PYTHON_OBJ="objects/if_python.o"
1087 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"libpython${vi_cv_var_python_version}.so\\\""
1088 PYTHON_LIBS=
1089 PYTHON3_SRC="if_python3.c"
1090 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001091 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"libpython${vi_cv_var_python3_version}.so\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001092 PYTHON3_LIBS=
1093fi
1094
Bram Moolenaar071d4272004-06-13 20:20:40 +00001095AC_MSG_CHECKING(--enable-tclinterp argument)
1096AC_ARG_ENABLE(tclinterp,
1097 [ --enable-tclinterp Include Tcl interpreter.], ,
1098 [enable_tclinterp="no"])
1099AC_MSG_RESULT($enable_tclinterp)
1100
1101if test "$enable_tclinterp" = "yes"; then
1102
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001103 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001104 AC_MSG_CHECKING(--with-tclsh argument)
1105 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
1106 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001107 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001108 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1109 AC_SUBST(vi_cv_path_tcl)
1110
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001111 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1112 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1113 tclsh_name="tclsh8.4"
1114 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1115 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001116 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001117 tclsh_name="tclsh8.2"
1118 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1119 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001120 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1121 tclsh_name="tclsh8.0"
1122 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1123 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001124 dnl still didn't find it, try without version number
1125 if test "X$vi_cv_path_tcl" = "X"; then
1126 tclsh_name="tclsh"
1127 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1128 fi
1129 if test "X$vi_cv_path_tcl" != "X"; then
1130 AC_MSG_CHECKING(Tcl version)
1131 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
1132 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1133 AC_MSG_RESULT($tclver - OK);
1134 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 -`
1135
1136 AC_MSG_CHECKING(for location of Tcl include)
1137 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001138 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 +00001139 else
1140 dnl For Mac OS X 10.3, use the OS-provided framework location
1141 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
1142 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001143 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001144 for try in $tclinc; do
1145 if test -f "$try/tcl.h"; then
1146 AC_MSG_RESULT($try/tcl.h)
1147 TCL_INC=$try
1148 break
1149 fi
1150 done
1151 if test -z "$TCL_INC"; then
1152 AC_MSG_RESULT(<not found>)
1153 SKIP_TCL=YES
1154 fi
1155 if test -z "$SKIP_TCL"; then
1156 AC_MSG_CHECKING(for location of tclConfig.sh script)
1157 if test "x$MACOSX" != "xyes"; then
1158 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001159 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001160 else
1161 dnl For Mac OS X 10.3, use the OS-provided framework location
1162 tclcnf="/System/Library/Frameworks/Tcl.framework"
1163 fi
1164 for try in $tclcnf; do
1165 if test -f $try/tclConfig.sh; then
1166 AC_MSG_RESULT($try/tclConfig.sh)
1167 . $try/tclConfig.sh
1168 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
1169 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1170 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001171 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +00001172 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 +00001173 break
1174 fi
1175 done
1176 if test -z "$TCL_LIBS"; then
1177 AC_MSG_RESULT(<not found>)
1178 AC_MSG_CHECKING(for Tcl library by myself)
1179 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001180 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001181 for ext in .so .a ; do
1182 for ver in "" $tclver ; do
1183 for try in $tcllib ; do
1184 trylib=tcl$ver$ext
1185 if test -f $try/lib$trylib ; then
1186 AC_MSG_RESULT($try/lib$trylib)
1187 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
1188 if test "`(uname) 2>/dev/null`" = SunOS &&
1189 uname -r | grep '^5' >/dev/null; then
1190 TCL_LIBS="$TCL_LIBS -R $try"
1191 fi
1192 break 3
1193 fi
1194 done
1195 done
1196 done
1197 if test -z "$TCL_LIBS"; then
1198 AC_MSG_RESULT(<not found>)
1199 SKIP_TCL=YES
1200 fi
1201 fi
1202 if test -z "$SKIP_TCL"; then
1203 AC_DEFINE(FEAT_TCL)
1204 TCL_SRC=if_tcl.c
1205 TCL_OBJ=objects/if_tcl.o
1206 TCL_PRO=if_tcl.pro
1207 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1208 fi
1209 fi
1210 else
1211 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
1212 fi
1213 fi
1214fi
1215AC_SUBST(TCL_SRC)
1216AC_SUBST(TCL_OBJ)
1217AC_SUBST(TCL_PRO)
1218AC_SUBST(TCL_CFLAGS)
1219AC_SUBST(TCL_LIBS)
1220
1221AC_MSG_CHECKING(--enable-rubyinterp argument)
1222AC_ARG_ENABLE(rubyinterp,
1223 [ --enable-rubyinterp Include Ruby interpreter.], ,
1224 [enable_rubyinterp="no"])
1225AC_MSG_RESULT($enable_rubyinterp)
1226if test "$enable_rubyinterp" = "yes"; then
Bram Moolenaar165641d2010-02-17 16:23:09 +01001227 AC_MSG_CHECKING(--with-ruby-command argument)
1228 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
1229 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
1230 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001231 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001232 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001233 if test "X$vi_cv_path_ruby" != "X"; then
1234 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +00001235 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 +00001236 AC_MSG_RESULT(OK)
1237 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001238 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 +00001239 if test "X$rubyhdrdir" != "X"; then
1240 AC_MSG_RESULT($rubyhdrdir)
1241 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01001242 rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
1243 if test -d "$rubyhdrdir/$rubyarch"; then
1244 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
1245 fi
1246 rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
1247 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001248 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
1249 if test "X$rubylibs" != "X"; then
1250 RUBY_LIBS="$rubylibs"
1251 fi
1252 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
1253 if test -f "$rubyhdrdir/$librubyarg"; then
1254 librubyarg="$rubyhdrdir/$librubyarg"
1255 else
1256 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
1257 if test -f "$rubylibdir/$librubyarg"; then
1258 librubyarg="$rubylibdir/$librubyarg"
1259 elif test "$librubyarg" = "libruby.a"; then
1260 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1261 librubyarg="-lruby"
1262 else
1263 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
1264 fi
1265 fi
1266
1267 if test "X$librubyarg" != "X"; then
1268 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1269 fi
1270 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
1271 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001272 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1273 dnl be included if requested by passing --with-mac-arch to
1274 dnl configure, so strip these flags first (if present)
1275 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//'`
1276 if test "X$rubyldflags" != "X"; then
1277 LDFLAGS="$rubyldflags $LDFLAGS"
1278 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001279 fi
1280 RUBY_SRC="if_ruby.c"
1281 RUBY_OBJ="objects/if_ruby.o"
1282 RUBY_PRO="if_ruby.pro"
1283 AC_DEFINE(FEAT_RUBY)
1284 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001285 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001286 fi
1287 else
1288 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1289 fi
1290 fi
1291fi
1292AC_SUBST(RUBY_SRC)
1293AC_SUBST(RUBY_OBJ)
1294AC_SUBST(RUBY_PRO)
1295AC_SUBST(RUBY_CFLAGS)
1296AC_SUBST(RUBY_LIBS)
1297
1298AC_MSG_CHECKING(--enable-cscope argument)
1299AC_ARG_ENABLE(cscope,
1300 [ --enable-cscope Include cscope interface.], ,
1301 [enable_cscope="no"])
1302AC_MSG_RESULT($enable_cscope)
1303if test "$enable_cscope" = "yes"; then
1304 AC_DEFINE(FEAT_CSCOPE)
1305fi
1306
1307AC_MSG_CHECKING(--enable-workshop argument)
1308AC_ARG_ENABLE(workshop,
1309 [ --enable-workshop Include Sun Visual Workshop support.], ,
1310 [enable_workshop="no"])
1311AC_MSG_RESULT($enable_workshop)
1312if test "$enable_workshop" = "yes"; then
1313 AC_DEFINE(FEAT_SUN_WORKSHOP)
1314 WORKSHOP_SRC="workshop.c integration.c"
1315 AC_SUBST(WORKSHOP_SRC)
1316 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1317 AC_SUBST(WORKSHOP_OBJ)
1318 if test "${enable_gui-xxx}" = xxx; then
1319 enable_gui=motif
1320 fi
1321fi
1322
1323AC_MSG_CHECKING(--disable-netbeans argument)
1324AC_ARG_ENABLE(netbeans,
1325 [ --disable-netbeans Disable NetBeans integration support.],
1326 , [enable_netbeans="yes"])
1327if test "$enable_netbeans" = "yes"; then
1328 AC_MSG_RESULT(no)
1329 dnl On Solaris we need the socket and nsl library.
1330 AC_CHECK_LIB(socket, socket)
1331 AC_CHECK_LIB(nsl, gethostbyname)
1332 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1333 AC_TRY_LINK([
1334#include <stdio.h>
1335#include <stdlib.h>
1336#include <stdarg.h>
1337#include <fcntl.h>
1338#include <netdb.h>
1339#include <netinet/in.h>
1340#include <errno.h>
1341#include <sys/types.h>
1342#include <sys/socket.h>
1343 /* Check bitfields */
1344 struct nbbuf {
1345 unsigned int initDone:1;
1346 ushort signmaplen;
1347 };
1348 ], [
1349 /* Check creating a socket. */
1350 struct sockaddr_in server;
1351 (void)socket(AF_INET, SOCK_STREAM, 0);
1352 (void)htons(100);
1353 (void)gethostbyname("microsoft.com");
1354 if (errno == ECONNREFUSED)
1355 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1356 ],
1357 AC_MSG_RESULT(yes),
1358 AC_MSG_RESULT(no); enable_netbeans="no")
1359else
1360 AC_MSG_RESULT(yes)
1361fi
1362if test "$enable_netbeans" = "yes"; then
1363 AC_DEFINE(FEAT_NETBEANS_INTG)
1364 NETBEANS_SRC="netbeans.c"
1365 AC_SUBST(NETBEANS_SRC)
1366 NETBEANS_OBJ="objects/netbeans.o"
1367 AC_SUBST(NETBEANS_OBJ)
1368fi
1369
1370AC_MSG_CHECKING(--enable-sniff argument)
1371AC_ARG_ENABLE(sniff,
1372 [ --enable-sniff Include Sniff interface.], ,
1373 [enable_sniff="no"])
1374AC_MSG_RESULT($enable_sniff)
1375if test "$enable_sniff" = "yes"; then
1376 AC_DEFINE(FEAT_SNIFF)
1377 SNIFF_SRC="if_sniff.c"
1378 AC_SUBST(SNIFF_SRC)
1379 SNIFF_OBJ="objects/if_sniff.o"
1380 AC_SUBST(SNIFF_OBJ)
1381fi
1382
1383AC_MSG_CHECKING(--enable-multibyte argument)
1384AC_ARG_ENABLE(multibyte,
1385 [ --enable-multibyte Include multibyte editing support.], ,
1386 [enable_multibyte="no"])
1387AC_MSG_RESULT($enable_multibyte)
1388if test "$enable_multibyte" = "yes"; then
1389 AC_DEFINE(FEAT_MBYTE)
1390fi
1391
1392AC_MSG_CHECKING(--enable-hangulinput argument)
1393AC_ARG_ENABLE(hangulinput,
1394 [ --enable-hangulinput Include Hangul input support.], ,
1395 [enable_hangulinput="no"])
1396AC_MSG_RESULT($enable_hangulinput)
1397
1398AC_MSG_CHECKING(--enable-xim argument)
1399AC_ARG_ENABLE(xim,
1400 [ --enable-xim Include XIM input support.],
1401 AC_MSG_RESULT($enable_xim),
1402 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001403
1404AC_MSG_CHECKING(--enable-fontset argument)
1405AC_ARG_ENABLE(fontset,
1406 [ --enable-fontset Include X fontset output support.], ,
1407 [enable_fontset="no"])
1408AC_MSG_RESULT($enable_fontset)
1409dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1410
1411test -z "$with_x" && with_x=yes
1412test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1413if test "$with_x" = no; then
1414 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1415else
1416 dnl Do this check early, so that its failure can override user requests.
1417
1418 AC_PATH_PROG(xmkmfpath, xmkmf)
1419
1420 AC_PATH_XTRA
1421
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001422 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001423 dnl be compiled with a special option.
1424 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001425 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001426 CFLAGS="$CFLAGS -W c,dll"
1427 LDFLAGS="$LDFLAGS -W l,dll"
1428 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1429 fi
1430
1431 dnl On my HPUX system the X include dir is found, but the lib dir not.
1432 dnl This is a desparate try to fix this.
1433
1434 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1435 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1436 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1437 X_LIBS="$X_LIBS -L$x_libraries"
1438 if test "`(uname) 2>/dev/null`" = SunOS &&
1439 uname -r | grep '^5' >/dev/null; then
1440 X_LIBS="$X_LIBS -R $x_libraries"
1441 fi
1442 fi
1443
1444 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1445 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1446 AC_MSG_RESULT(Corrected X includes to $x_includes)
1447 X_CFLAGS="$X_CFLAGS -I$x_includes"
1448 fi
1449
1450 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1451 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1452 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1453 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1454 dnl Same for "-R/usr/lib ".
1455 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1456
1457
1458 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001459 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1460 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001461 AC_MSG_CHECKING(if X11 header files can be found)
1462 cflags_save=$CFLAGS
1463 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001464 AC_TRY_COMPILE([#include <X11/Xlib.h>
1465#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001466 AC_MSG_RESULT(yes),
1467 AC_MSG_RESULT(no); no_x=yes)
1468 CFLAGS=$cflags_save
1469
1470 if test "${no_x-no}" = yes; then
1471 with_x=no
1472 else
1473 AC_DEFINE(HAVE_X11)
1474 X_LIB="-lXt -lX11";
1475 AC_SUBST(X_LIB)
1476
1477 ac_save_LDFLAGS="$LDFLAGS"
1478 LDFLAGS="-L$x_libraries $LDFLAGS"
1479
1480 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1481 dnl For HP-UX 10.20 it must be before -lSM -lICE
1482 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1483 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1484
1485 dnl Some systems need -lnsl -lsocket when testing for ICE.
1486 dnl The check above doesn't do this, try here (again). Also needed to get
1487 dnl them after Xdmcp. link.sh will remove them when not needed.
1488 dnl Check for other function than above to avoid the cached value
1489 AC_CHECK_LIB(ICE, IceOpenConnection,
1490 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1491
1492 dnl Check for -lXpm (needed for some versions of Motif)
1493 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1494 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1495 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1496
1497 dnl Check that the X11 header files don't use implicit declarations
1498 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1499 cflags_save=$CFLAGS
1500 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1501 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1502 AC_MSG_RESULT(no),
1503 CFLAGS="$CFLAGS -Wno-implicit-int"
1504 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1505 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1506 AC_MSG_RESULT(test failed)
1507 )
1508 )
1509 CFLAGS=$cflags_save
1510
1511 LDFLAGS="$ac_save_LDFLAGS"
1512
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001513 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1514 AC_CACHE_VAL(ac_cv_small_wchar_t,
1515 [AC_TRY_RUN([
1516#include <X11/Xlib.h>
1517#if STDC_HEADERS
1518# include <stdlib.h>
1519# include <stddef.h>
1520#endif
1521 main()
1522 {
1523 if (sizeof(wchar_t) <= 2)
1524 exit(1);
1525 exit(0);
1526 }],
1527 ac_cv_small_wchar_t="no",
1528 ac_cv_small_wchar_t="yes",
1529 AC_MSG_ERROR(failed to compile test program))])
1530 AC_MSG_RESULT($ac_cv_small_wchar_t)
1531 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1532 AC_DEFINE(SMALL_WCHAR_T)
1533 fi
1534
Bram Moolenaar071d4272004-06-13 20:20:40 +00001535 fi
1536fi
1537
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001538test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001539
1540AC_MSG_CHECKING(--enable-gui argument)
1541AC_ARG_ENABLE(gui,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001542 [ --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 +00001543
1544dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1545dnl Do not use character classes for portability with old tools.
1546enable_gui_canon=`echo "_$enable_gui" | \
1547 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1548
1549dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001550SKIP_GTK2=YES
1551SKIP_GNOME=YES
1552SKIP_MOTIF=YES
1553SKIP_ATHENA=YES
1554SKIP_NEXTAW=YES
1555SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001556SKIP_CARBON=YES
1557GUITYPE=NONE
1558
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001559if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001560 SKIP_PHOTON=
1561 case "$enable_gui_canon" in
1562 no) AC_MSG_RESULT(no GUI support)
1563 SKIP_PHOTON=YES ;;
1564 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1565 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1566 photon) AC_MSG_RESULT(Photon GUI support) ;;
1567 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1568 SKIP_PHOTON=YES ;;
1569 esac
1570
1571elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1572 SKIP_CARBON=
1573 case "$enable_gui_canon" in
1574 no) AC_MSG_RESULT(no GUI support)
1575 SKIP_CARBON=YES ;;
1576 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
Bram Moolenaar164fca32010-07-14 13:58:07 +02001577 auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
1578 SKIP_CARBON=YES ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001579 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1580 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1581 SKIP_CARBON=YES ;;
1582 esac
1583
1584else
1585
Bram Moolenaar071d4272004-06-13 20:20:40 +00001586 case "$enable_gui_canon" in
1587 no|none) AC_MSG_RESULT(no GUI support) ;;
1588 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001589 SKIP_GTK2=
1590 SKIP_GNOME=
1591 SKIP_MOTIF=
1592 SKIP_ATHENA=
1593 SKIP_NEXTAW=
1594 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001595 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001596 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001597 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1598 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001599 SKIP_GTK2=;;
1600 motif) AC_MSG_RESULT(Motif GUI support)
1601 SKIP_MOTIF=;;
1602 athena) AC_MSG_RESULT(Athena GUI support)
1603 SKIP_ATHENA=;;
1604 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1605 SKIP_NEXTAW=;;
1606 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1607 esac
1608
1609fi
1610
Bram Moolenaar071d4272004-06-13 20:20:40 +00001611if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1612 -a "$enable_gui_canon" != "gnome2"; then
1613 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1614 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001615 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001616 , enable_gtk2_check="yes")
1617 AC_MSG_RESULT($enable_gtk2_check)
1618 if test "x$enable_gtk2_check" = "xno"; then
1619 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001620 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001621 fi
1622fi
1623
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001624if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001625 AC_MSG_CHECKING(whether or not to look for GNOME)
1626 AC_ARG_ENABLE(gnome-check,
1627 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1628 , enable_gnome_check="no")
1629 AC_MSG_RESULT($enable_gnome_check)
1630 if test "x$enable_gnome_check" = "xno"; then
1631 SKIP_GNOME=YES
1632 fi
1633fi
1634
1635if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1636 AC_MSG_CHECKING(whether or not to look for Motif)
1637 AC_ARG_ENABLE(motif-check,
1638 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1639 , enable_motif_check="yes")
1640 AC_MSG_RESULT($enable_motif_check)
1641 if test "x$enable_motif_check" = "xno"; then
1642 SKIP_MOTIF=YES
1643 fi
1644fi
1645
1646if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1647 AC_MSG_CHECKING(whether or not to look for Athena)
1648 AC_ARG_ENABLE(athena-check,
1649 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1650 , enable_athena_check="yes")
1651 AC_MSG_RESULT($enable_athena_check)
1652 if test "x$enable_athena_check" = "xno"; then
1653 SKIP_ATHENA=YES
1654 fi
1655fi
1656
1657if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1658 AC_MSG_CHECKING(whether or not to look for neXtaw)
1659 AC_ARG_ENABLE(nextaw-check,
1660 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1661 , enable_nextaw_check="yes")
1662 AC_MSG_RESULT($enable_nextaw_check);
1663 if test "x$enable_nextaw_check" = "xno"; then
1664 SKIP_NEXTAW=YES
1665 fi
1666fi
1667
1668if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1669 AC_MSG_CHECKING(whether or not to look for Carbon)
1670 AC_ARG_ENABLE(carbon-check,
1671 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1672 , enable_carbon_check="yes")
1673 AC_MSG_RESULT($enable_carbon_check);
1674 if test "x$enable_carbon_check" = "xno"; then
1675 SKIP_CARBON=YES
1676 fi
1677fi
1678
Bram Moolenaar843ee412004-06-30 16:16:41 +00001679
Bram Moolenaar071d4272004-06-13 20:20:40 +00001680if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1681 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001682 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001683 AC_MSG_RESULT(yes);
1684 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001685 if test "$VIMNAME" = "vim"; then
1686 VIMNAME=Vim
1687 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001688
Bram Moolenaar164fca32010-07-14 13:58:07 +02001689 if test "x$MACARCH" = "xboth"; then
1690 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
1691 else
1692 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
1693 fi
1694
Bram Moolenaar14716812006-05-04 21:54:08 +00001695 dnl Default install directory is not /usr/local
1696 if test x$prefix = xNONE; then
1697 prefix=/Applications
1698 fi
1699
1700 dnl Sorry for the hard coded default
1701 datadir='${prefix}/Vim.app/Contents/Resources'
1702
Bram Moolenaar071d4272004-06-13 20:20:40 +00001703 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001704 SKIP_GTK2=YES;
1705 SKIP_GNOME=YES;
1706 SKIP_MOTIF=YES;
1707 SKIP_ATHENA=YES;
1708 SKIP_NEXTAW=YES;
1709 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001710 SKIP_CARBON=YES
1711fi
1712
Bram Moolenaar071d4272004-06-13 20:20:40 +00001713dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001714dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001715dnl
1716dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001717dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001718dnl
1719AC_DEFUN(AM_PATH_GTK,
1720[
1721 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1722 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001723 min_gtk_version=ifelse([$1], ,2.2.0,$1)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001724 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1725 no_gtk=""
1726 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1727 && $PKG_CONFIG --exists gtk+-2.0; then
1728 {
1729 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1730 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1731 dnl something like that.
1732 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001733 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001734 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1735 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1736 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1737 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1738 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1739 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1740 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1741 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001742 else
1743 no_gtk=yes
1744 fi
1745
1746 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1747 {
1748 ac_save_CFLAGS="$CFLAGS"
1749 ac_save_LIBS="$LIBS"
1750 CFLAGS="$CFLAGS $GTK_CFLAGS"
1751 LIBS="$LIBS $GTK_LIBS"
1752
1753 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001754 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001755 dnl
1756 rm -f conf.gtktest
1757 AC_TRY_RUN([
1758#include <gtk/gtk.h>
1759#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001760#if STDC_HEADERS
1761# include <stdlib.h>
1762# include <stddef.h>
1763#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001764
1765int
1766main ()
1767{
1768int major, minor, micro;
1769char *tmp_version;
1770
1771system ("touch conf.gtktest");
1772
1773/* HP/UX 9 (%@#!) writes to sscanf strings */
1774tmp_version = g_strdup("$min_gtk_version");
1775if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1776 printf("%s, bad version string\n", "$min_gtk_version");
1777 exit(1);
1778 }
1779
1780if ((gtk_major_version > major) ||
1781 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1782 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1783 (gtk_micro_version >= micro)))
1784{
1785 return 0;
1786}
1787return 1;
1788}
1789],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1790 CFLAGS="$ac_save_CFLAGS"
1791 LIBS="$ac_save_LIBS"
1792 }
1793 fi
1794 if test "x$no_gtk" = x ; then
1795 if test "x$enable_gtktest" = "xyes"; then
1796 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1797 else
1798 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1799 fi
1800 ifelse([$2], , :, [$2])
1801 else
1802 {
1803 AC_MSG_RESULT(no)
1804 GTK_CFLAGS=""
1805 GTK_LIBS=""
1806 ifelse([$3], , :, [$3])
1807 }
1808 fi
1809 }
1810 else
1811 GTK_CFLAGS=""
1812 GTK_LIBS=""
1813 ifelse([$3], , :, [$3])
1814 fi
1815 AC_SUBST(GTK_CFLAGS)
1816 AC_SUBST(GTK_LIBS)
1817 rm -f conf.gtktest
1818])
1819
1820dnl ---------------------------------------------------------------------------
1821dnl gnome
1822dnl ---------------------------------------------------------------------------
1823AC_DEFUN([GNOME_INIT_HOOK],
1824[
1825 AC_SUBST(GNOME_LIBS)
1826 AC_SUBST(GNOME_LIBDIR)
1827 AC_SUBST(GNOME_INCLUDEDIR)
1828
1829 AC_ARG_WITH(gnome-includes,
1830 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1831 [CFLAGS="$CFLAGS -I$withval"]
1832 )
1833
1834 AC_ARG_WITH(gnome-libs,
1835 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1836 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1837 )
1838
1839 AC_ARG_WITH(gnome,
1840 [ --with-gnome Specify prefix for GNOME files],
1841 if test x$withval = xyes; then
1842 want_gnome=yes
1843 ifelse([$1], [], :, [$1])
1844 else
1845 if test "x$withval" = xno; then
1846 want_gnome=no
1847 else
1848 want_gnome=yes
1849 LDFLAGS="$LDFLAGS -L$withval/lib"
1850 CFLAGS="$CFLAGS -I$withval/include"
1851 gnome_prefix=$withval/lib
1852 fi
1853 fi,
1854 want_gnome=yes)
1855
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001856 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001857 {
1858 AC_MSG_CHECKING(for libgnomeui-2.0)
1859 if $PKG_CONFIG --exists libgnomeui-2.0; then
1860 AC_MSG_RESULT(yes)
1861 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1862 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1863 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001864
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001865 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1866 dnl This might not be the right way but it works for me...
1867 AC_MSG_CHECKING(for FreeBSD)
1868 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1869 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001870 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001871 GNOME_LIBS="$GNOME_LIBS -pthread"
1872 else
1873 AC_MSG_RESULT(no)
1874 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001875 $1
1876 else
1877 AC_MSG_RESULT(not found)
1878 if test "x$2" = xfail; then
1879 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1880 fi
1881 fi
1882 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001883 fi
1884])
1885
1886AC_DEFUN([GNOME_INIT],[
1887 GNOME_INIT_HOOK([],fail)
1888])
1889
1890
1891dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001892dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001893dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001894if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001895
1896 AC_MSG_CHECKING(--disable-gtktest argument)
1897 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1898 , enable_gtktest=yes)
1899 if test "x$enable_gtktest" = "xyes" ; then
1900 AC_MSG_RESULT(gtk test enabled)
1901 else
1902 AC_MSG_RESULT(gtk test disabled)
1903 fi
1904
Bram Moolenaar071d4272004-06-13 20:20:40 +00001905 if test "X$PKG_CONFIG" = "X"; then
1906 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1907 fi
1908
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001909 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001910 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1911 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001912 AM_PATH_GTK(2.2.0,
1913 [GUI_LIB_LOC="$GTK_LIBDIR"
1914 GTK_LIBNAME="$GTK_LIBS"
1915 GUI_INC_LOC="$GTK_CFLAGS"], )
1916 if test "x$GTK_CFLAGS" != "x"; then
1917 SKIP_ATHENA=YES
1918 SKIP_NEXTAW=YES
1919 SKIP_MOTIF=YES
1920 GUITYPE=GTK
1921 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001922 fi
1923 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001924 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001925 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1926 || test "0$gtk_minor_version" -ge 2; then
1927 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1928 fi
1929 dnl
1930 dnl if GTK exists, then check for GNOME.
1931 dnl
1932 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001933 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001934 GNOME_INIT_HOOK([have_gnome=yes])
1935 if test "x$have_gnome" = xyes ; then
1936 AC_DEFINE(FEAT_GUI_GNOME)
1937 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1938 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001939 fi
1940 }
1941 fi
1942 fi
1943fi
1944
1945dnl Check for Motif include files location.
1946dnl The LAST one found is used, this makes the highest version to be used,
1947dnl e.g. when Motif1.2 and Motif2.0 are both present.
1948
1949if test -z "$SKIP_MOTIF"; then
1950 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"
1951 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1952 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1953
1954 AC_MSG_CHECKING(for location of Motif GUI includes)
1955 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1956 GUI_INC_LOC=
1957 for try in $gui_includes; do
1958 if test -f "$try/Xm/Xm.h"; then
1959 GUI_INC_LOC=$try
1960 fi
1961 done
1962 if test -n "$GUI_INC_LOC"; then
1963 if test "$GUI_INC_LOC" = /usr/include; then
1964 GUI_INC_LOC=
1965 AC_MSG_RESULT(in default path)
1966 else
1967 AC_MSG_RESULT($GUI_INC_LOC)
1968 fi
1969 else
1970 AC_MSG_RESULT(<not found>)
1971 SKIP_MOTIF=YES
1972 fi
1973fi
1974
1975dnl Check for Motif library files location. In the same order as the include
1976dnl files, to avoid a mixup if several versions are present
1977
1978if test -z "$SKIP_MOTIF"; then
1979 AC_MSG_CHECKING(--with-motif-lib argument)
1980 AC_ARG_WITH(motif-lib,
1981 [ --with-motif-lib=STRING Library for Motif ],
1982 [ MOTIF_LIBNAME="${withval}" ] )
1983
1984 if test -n "$MOTIF_LIBNAME"; then
1985 AC_MSG_RESULT($MOTIF_LIBNAME)
1986 GUI_LIB_LOC=
1987 else
1988 AC_MSG_RESULT(no)
1989
1990 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1991 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1992
1993 AC_MSG_CHECKING(for location of Motif GUI libs)
1994 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"
1995 GUI_LIB_LOC=
1996 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001997 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00001998 if test -f "$libtry"; then
1999 GUI_LIB_LOC=$try
2000 fi
2001 done
2002 done
2003 if test -n "$GUI_LIB_LOC"; then
2004 dnl Remove /usr/lib, it causes trouble on some systems
2005 if test "$GUI_LIB_LOC" = /usr/lib; then
2006 GUI_LIB_LOC=
2007 AC_MSG_RESULT(in default path)
2008 else
2009 if test -n "$GUI_LIB_LOC"; then
2010 AC_MSG_RESULT($GUI_LIB_LOC)
2011 if test "`(uname) 2>/dev/null`" = SunOS &&
2012 uname -r | grep '^5' >/dev/null; then
2013 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
2014 fi
2015 fi
2016 fi
2017 MOTIF_LIBNAME=-lXm
2018 else
2019 AC_MSG_RESULT(<not found>)
2020 SKIP_MOTIF=YES
2021 fi
2022 fi
2023fi
2024
2025if test -z "$SKIP_MOTIF"; then
2026 SKIP_ATHENA=YES
2027 SKIP_NEXTAW=YES
2028 GUITYPE=MOTIF
2029 AC_SUBST(MOTIF_LIBNAME)
2030fi
2031
2032dnl Check if the Athena files can be found
2033
2034GUI_X_LIBS=
2035
2036if test -z "$SKIP_ATHENA"; then
2037 AC_MSG_CHECKING(if Athena header files can be found)
2038 cflags_save=$CFLAGS
2039 CFLAGS="$CFLAGS $X_CFLAGS"
2040 AC_TRY_COMPILE([
2041#include <X11/Intrinsic.h>
2042#include <X11/Xaw/Paned.h>], ,
2043 AC_MSG_RESULT(yes),
2044 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
2045 CFLAGS=$cflags_save
2046fi
2047
2048if test -z "$SKIP_ATHENA"; then
2049 GUITYPE=ATHENA
2050fi
2051
2052if test -z "$SKIP_NEXTAW"; then
2053 AC_MSG_CHECKING(if neXtaw header files can be found)
2054 cflags_save=$CFLAGS
2055 CFLAGS="$CFLAGS $X_CFLAGS"
2056 AC_TRY_COMPILE([
2057#include <X11/Intrinsic.h>
2058#include <X11/neXtaw/Paned.h>], ,
2059 AC_MSG_RESULT(yes),
2060 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
2061 CFLAGS=$cflags_save
2062fi
2063
2064if test -z "$SKIP_NEXTAW"; then
2065 GUITYPE=NEXTAW
2066fi
2067
2068if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2069 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
2070 dnl Avoid adding it when it twice
2071 if test -n "$GUI_INC_LOC"; then
2072 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
2073 fi
2074 if test -n "$GUI_LIB_LOC"; then
2075 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
2076 fi
2077
2078 dnl Check for -lXext and then for -lXmu
2079 ldflags_save=$LDFLAGS
2080 LDFLAGS="$X_LIBS $LDFLAGS"
2081 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
2082 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2083 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
2084 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
2085 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2086 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
2087 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2088 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
2089 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2090 if test -z "$SKIP_MOTIF"; then
2091 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
2092 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2093 fi
2094 LDFLAGS=$ldflags_save
2095
2096 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
2097 AC_MSG_CHECKING(for extra X11 defines)
2098 NARROW_PROTO=
2099 rm -fr conftestdir
2100 if mkdir conftestdir; then
2101 cd conftestdir
2102 cat > Imakefile <<'EOF'
2103acfindx:
2104 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
2105EOF
2106 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2107 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
2108 fi
2109 cd ..
2110 rm -fr conftestdir
2111 fi
2112 if test -z "$NARROW_PROTO"; then
2113 AC_MSG_RESULT(no)
2114 else
2115 AC_MSG_RESULT($NARROW_PROTO)
2116 fi
2117 AC_SUBST(NARROW_PROTO)
2118fi
2119
2120dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
2121dnl use the X11 include path
2122if test "$enable_xsmp" = "yes"; then
2123 cppflags_save=$CPPFLAGS
2124 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2125 AC_CHECK_HEADERS(X11/SM/SMlib.h)
2126 CPPFLAGS=$cppflags_save
2127fi
2128
2129
Bram Moolenaare667c952010-07-05 22:57:59 +02002130if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002131 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
2132 cppflags_save=$CPPFLAGS
2133 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2134 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
2135
2136 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
2137 if test ! "$enable_xim" = "no"; then
2138 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
2139 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
2140 AC_MSG_RESULT(yes),
2141 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
2142 fi
2143 CPPFLAGS=$cppflags_save
2144
2145 dnl automatically enable XIM when hangul input isn't enabled
2146 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
2147 -a "x$GUITYPE" != "xNONE" ; then
2148 AC_MSG_RESULT(X GUI selected; xim has been enabled)
2149 enable_xim="yes"
2150 fi
2151fi
2152
2153if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2154 cppflags_save=$CPPFLAGS
2155 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002156dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
2157 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
2158 AC_TRY_COMPILE([
2159#include <X11/Intrinsic.h>
2160#include <X11/Xmu/Editres.h>],
2161 [int i; i = 0;],
2162 AC_MSG_RESULT(yes)
2163 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
2164 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00002165 CPPFLAGS=$cppflags_save
2166fi
2167
2168dnl Only use the Xm directory when compiling Motif, don't use it for Athena
2169if test -z "$SKIP_MOTIF"; then
2170 cppflags_save=$CPPFLAGS
2171 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002172 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 +00002173 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002174
2175 if test $ac_cv_header_Xm_XpmP_h = yes; then
2176 dnl Solaris uses XpmAttributes_21, very annoying.
2177 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
2178 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
2179 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
2180 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2181 )
2182 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00002183 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002184 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002185 CPPFLAGS=$cppflags_save
2186fi
2187
2188if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
2189 AC_MSG_RESULT(no GUI selected; xim has been disabled)
2190 enable_xim="no"
2191fi
2192if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
2193 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
2194 enable_fontset="no"
2195fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002196if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002197 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
2198 enable_fontset="no"
2199fi
2200
Bram Moolenaar071d4272004-06-13 20:20:40 +00002201if test -z "$SKIP_PHOTON"; then
2202 GUITYPE=PHOTONGUI
2203fi
2204
2205AC_SUBST(GUI_INC_LOC)
2206AC_SUBST(GUI_LIB_LOC)
2207AC_SUBST(GUITYPE)
2208AC_SUBST(GUI_X_LIBS)
2209
2210if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2211 AC_MSG_ERROR([cannot use workshop without Motif])
2212fi
2213
2214dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2215if test "$enable_xim" = "yes"; then
2216 AC_DEFINE(FEAT_XIM)
2217fi
2218if test "$enable_fontset" = "yes"; then
2219 AC_DEFINE(FEAT_XFONTSET)
2220fi
2221
2222
2223dnl ---------------------------------------------------------------------------
2224dnl end of GUI-checking
2225dnl ---------------------------------------------------------------------------
2226
2227
2228dnl Only really enable hangul input when GUI and XFONTSET are available
2229if test "$enable_hangulinput" = "yes"; then
2230 if test "x$GUITYPE" = "xNONE"; then
2231 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2232 enable_hangulinput=no
2233 else
2234 AC_DEFINE(FEAT_HANGULIN)
2235 HANGULIN_SRC=hangulin.c
2236 AC_SUBST(HANGULIN_SRC)
2237 HANGULIN_OBJ=objects/hangulin.o
2238 AC_SUBST(HANGULIN_OBJ)
2239 fi
2240fi
2241
2242dnl Checks for libraries and include files.
2243
Bram Moolenaar446cb832008-06-24 21:56:24 +00002244AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
2245 [
2246 AC_RUN_IFELSE([[
2247#include "confdefs.h"
2248#include <ctype.h>
2249#if STDC_HEADERS
2250# include <stdlib.h>
2251# include <stddef.h>
2252#endif
2253main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2254 ]],[
2255 vim_cv_toupper_broken=yes
2256 ],[
2257 vim_cv_toupper_broken=no
2258 ],[
2259 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2260 ])])
2261
2262if test "x$vim_cv_toupper_broken" = "xyes" ; then
2263 AC_DEFINE(BROKEN_TOUPPER)
2264fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002265
2266AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002267AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002268 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2269 AC_MSG_RESULT(no))
2270
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002271AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2272AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2273 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2274 AC_MSG_RESULT(no))
2275
Bram Moolenaar071d4272004-06-13 20:20:40 +00002276dnl Checks for header files.
2277AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2278dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2279if test "$HAS_ELF" = 1; then
2280 AC_CHECK_LIB(elf, main)
2281fi
2282
2283AC_HEADER_DIRENT
2284
Bram Moolenaar071d4272004-06-13 20:20:40 +00002285dnl If sys/wait.h is not found it might still exist but not be POSIX
2286dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2287if test $ac_cv_header_sys_wait_h = no; then
2288 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2289 AC_TRY_COMPILE([#include <sys/wait.h>],
2290 [union wait xx, yy; xx = yy],
2291 AC_MSG_RESULT(yes)
2292 AC_DEFINE(HAVE_SYS_WAIT_H)
2293 AC_DEFINE(HAVE_UNION_WAIT),
2294 AC_MSG_RESULT(no))
2295fi
2296
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002297AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2298 sys/select.h sys/utsname.h termcap.h fcntl.h \
2299 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2300 termio.h iconv.h inttypes.h langinfo.h math.h \
2301 unistd.h stropts.h errno.h sys/resource.h \
2302 sys/systeminfo.h locale.h sys/stream.h termios.h \
2303 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2304 utime.h sys/param.h libintl.h libgen.h \
2305 util/debug.h util/msg18n.h frame.h sys/acl.h \
2306 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002307
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002308dnl sys/ptem.h depends on sys/stream.h on Solaris
2309AC_CHECK_HEADERS(sys/ptem.h, [], [],
2310[#if defined HAVE_SYS_STREAM_H
2311# include <sys/stream.h>
2312#endif])
2313
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002314dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2315AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2316[#if defined HAVE_SYS_PARAM_H
2317# include <sys/param.h>
2318#endif])
2319
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002320
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002321dnl pthread_np.h may exist but can only be used after including pthread.h
2322AC_MSG_CHECKING([for pthread_np.h])
2323AC_TRY_COMPILE([
2324#include <pthread.h>
2325#include <pthread_np.h>],
2326 [int i; i = 0;],
2327 AC_MSG_RESULT(yes)
2328 AC_DEFINE(HAVE_PTHREAD_NP_H),
2329 AC_MSG_RESULT(no))
2330
Bram Moolenaare344bea2005-09-01 20:46:49 +00002331AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002332if test "x$MACOSX" = "xyes"; then
2333 dnl The strings.h file on OS/X contains a warning and nothing useful.
2334 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2335else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002336
2337dnl Check if strings.h and string.h can both be included when defined.
2338AC_MSG_CHECKING([if strings.h can be included after string.h])
2339cppflags_save=$CPPFLAGS
2340CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2341AC_TRY_COMPILE([
2342#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2343# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2344 /* but don't do it on AIX 5.1 (Uribarri) */
2345#endif
2346#ifdef HAVE_XM_XM_H
2347# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2348#endif
2349#ifdef HAVE_STRING_H
2350# include <string.h>
2351#endif
2352#if defined(HAVE_STRINGS_H)
2353# include <strings.h>
2354#endif
2355 ], [int i; i = 0;],
2356 AC_MSG_RESULT(yes),
2357 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2358 AC_MSG_RESULT(no))
2359CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002360fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002361
2362dnl Checks for typedefs, structures, and compiler characteristics.
2363AC_PROG_GCC_TRADITIONAL
2364AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002365AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002366AC_TYPE_MODE_T
2367AC_TYPE_OFF_T
2368AC_TYPE_PID_T
2369AC_TYPE_SIZE_T
2370AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002371AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002372
Bram Moolenaar071d4272004-06-13 20:20:40 +00002373AC_HEADER_TIME
2374AC_CHECK_TYPE(ino_t, long)
2375AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002376AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002377
2378AC_MSG_CHECKING(for rlim_t)
2379if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2380 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2381else
2382 AC_EGREP_CPP(dnl
2383changequote(<<,>>)dnl
2384<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2385changequote([,]),
2386 [
2387#include <sys/types.h>
2388#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002389# include <stdlib.h>
2390# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002391#endif
2392#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002393# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002394#endif
2395 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2396 AC_MSG_RESULT($ac_cv_type_rlim_t)
2397fi
2398if test $ac_cv_type_rlim_t = no; then
2399 cat >> confdefs.h <<\EOF
2400#define rlim_t unsigned long
2401EOF
2402fi
2403
2404AC_MSG_CHECKING(for stack_t)
2405if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2406 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2407else
2408 AC_EGREP_CPP(stack_t,
2409 [
2410#include <sys/types.h>
2411#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002412# include <stdlib.h>
2413# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002414#endif
2415#include <signal.h>
2416 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2417 AC_MSG_RESULT($ac_cv_type_stack_t)
2418fi
2419if test $ac_cv_type_stack_t = no; then
2420 cat >> confdefs.h <<\EOF
2421#define stack_t struct sigaltstack
2422EOF
2423fi
2424
2425dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2426AC_MSG_CHECKING(whether stack_t has an ss_base field)
2427AC_TRY_COMPILE([
2428#include <sys/types.h>
2429#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002430# include <stdlib.h>
2431# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002432#endif
2433#include <signal.h>
2434#include "confdefs.h"
2435 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2436 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2437 AC_MSG_RESULT(no))
2438
2439olibs="$LIBS"
2440AC_MSG_CHECKING(--with-tlib argument)
2441AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2442if test -n "$with_tlib"; then
2443 AC_MSG_RESULT($with_tlib)
2444 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002445 AC_MSG_CHECKING(for linking with $with_tlib library)
2446 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2447 dnl Need to check for tgetent() below.
2448 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002449else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002450 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002451 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2452 dnl curses, because curses is much slower.
2453 dnl Newer versions of ncurses are preferred over anything.
2454 dnl Older versions of ncurses have bugs, get a new one!
2455 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002456 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002457 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002458 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002459 *) tlibs="ncurses termlib termcap curses";;
2460 esac
2461 for libname in $tlibs; do
2462 AC_CHECK_LIB(${libname}, tgetent,,)
2463 if test "x$olibs" != "x$LIBS"; then
2464 dnl It's possible that a library is found but it doesn't work
2465 dnl e.g., shared library that cannot be found
2466 dnl compile and run a test program to be sure
2467 AC_TRY_RUN([
2468#ifdef HAVE_TERMCAP_H
2469# include <termcap.h>
2470#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002471#if STDC_HEADERS
2472# include <stdlib.h>
2473# include <stddef.h>
2474#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002475main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2476 res="OK", res="FAIL", res="FAIL")
2477 if test "$res" = "OK"; then
2478 break
2479 fi
2480 AC_MSG_RESULT($libname library is not usable)
2481 LIBS="$olibs"
2482 fi
2483 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002484 if test "x$olibs" = "x$LIBS"; then
2485 AC_MSG_RESULT(no terminal library found)
2486 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002487fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002488
2489if test "x$olibs" = "x$LIBS"; then
2490 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002491 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002492 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2493 AC_MSG_RESULT(yes),
2494 AC_MSG_ERROR([NOT FOUND!
2495 You need to install a terminal library; for example ncurses.
2496 Or specify the name of the library with --with-tlib.]))
2497fi
2498
Bram Moolenaar446cb832008-06-24 21:56:24 +00002499AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2500 [
2501 AC_RUN_IFELSE([[
2502#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002503#ifdef HAVE_TERMCAP_H
2504# include <termcap.h>
2505#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002506#ifdef HAVE_STRING_H
2507# include <string.h>
2508#endif
2509#if STDC_HEADERS
2510# include <stdlib.h>
2511# include <stddef.h>
2512#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002513main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002514{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2515 ]],[
2516 vim_cv_terminfo=no
2517 ],[
2518 vim_cv_terminfo=yes
2519 ],[
2520 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2521 ])
2522 ])
2523
2524if test "x$vim_cv_terminfo" = "xyes" ; then
2525 AC_DEFINE(TERMINFO)
2526fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002527
2528if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002529 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2530 [
2531 AC_RUN_IFELSE([[
2532#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002533#ifdef HAVE_TERMCAP_H
2534# include <termcap.h>
2535#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002536#if STDC_HEADERS
2537# include <stdlib.h>
2538# include <stddef.h>
2539#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002540main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002541{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2542 ]],[
2543 vim_cv_tgent=zero
2544 ],[
2545 vim_cv_tgent=non-zero
2546 ],[
2547 AC_MSG_ERROR(failed to compile test program.)
2548 ])
2549 ])
2550
2551 if test "x$vim_cv_tgent" = "xzero" ; then
2552 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2553 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002554fi
2555
2556AC_MSG_CHECKING(whether termcap.h contains ospeed)
2557AC_TRY_LINK([
2558#ifdef HAVE_TERMCAP_H
2559# include <termcap.h>
2560#endif
2561 ], [ospeed = 20000],
2562 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2563 [AC_MSG_RESULT(no)
2564 AC_MSG_CHECKING(whether ospeed can be extern)
2565 AC_TRY_LINK([
2566#ifdef HAVE_TERMCAP_H
2567# include <termcap.h>
2568#endif
2569extern short ospeed;
2570 ], [ospeed = 20000],
2571 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2572 AC_MSG_RESULT(no))]
2573 )
2574
2575AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2576AC_TRY_LINK([
2577#ifdef HAVE_TERMCAP_H
2578# include <termcap.h>
2579#endif
2580 ], [if (UP == 0 && BC == 0) PC = 1],
2581 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2582 [AC_MSG_RESULT(no)
2583 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2584 AC_TRY_LINK([
2585#ifdef HAVE_TERMCAP_H
2586# include <termcap.h>
2587#endif
2588extern char *UP, *BC, PC;
2589 ], [if (UP == 0 && BC == 0) PC = 1],
2590 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2591 AC_MSG_RESULT(no))]
2592 )
2593
2594AC_MSG_CHECKING(whether tputs() uses outfuntype)
2595AC_TRY_COMPILE([
2596#ifdef HAVE_TERMCAP_H
2597# include <termcap.h>
2598#endif
2599 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2600 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2601 AC_MSG_RESULT(no))
2602
2603dnl On some SCO machines sys/select redefines struct timeval
2604AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2605AC_TRY_COMPILE([
2606#include <sys/types.h>
2607#include <sys/time.h>
2608#include <sys/select.h>], ,
2609 AC_MSG_RESULT(yes)
2610 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2611 AC_MSG_RESULT(no))
2612
2613dnl AC_DECL_SYS_SIGLIST
2614
2615dnl Checks for pty.c (copied from screen) ==========================
2616AC_MSG_CHECKING(for /dev/ptc)
2617if test -r /dev/ptc; then
2618 AC_DEFINE(HAVE_DEV_PTC)
2619 AC_MSG_RESULT(yes)
2620else
2621 AC_MSG_RESULT(no)
2622fi
2623
2624AC_MSG_CHECKING(for SVR4 ptys)
2625if test -c /dev/ptmx ; then
2626 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2627 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2628 AC_MSG_RESULT(no))
2629else
2630 AC_MSG_RESULT(no)
2631fi
2632
2633AC_MSG_CHECKING(for ptyranges)
2634if test -d /dev/ptym ; then
2635 pdir='/dev/ptym'
2636else
2637 pdir='/dev'
2638fi
2639dnl SCO uses ptyp%d
2640AC_EGREP_CPP(yes,
2641[#ifdef M_UNIX
2642 yes;
2643#endif
2644 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2645dnl if test -c /dev/ptyp19; then
2646dnl ptys=`echo /dev/ptyp??`
2647dnl else
2648dnl ptys=`echo $pdir/pty??`
2649dnl fi
2650if test "$ptys" != "$pdir/pty??" ; then
2651 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2652 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2653 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2654 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2655 AC_MSG_RESULT([$p0 / $p1])
2656else
2657 AC_MSG_RESULT([don't know])
2658fi
2659
2660dnl **** pty mode/group handling ****
2661dnl
2662dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002663rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002664AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2665 [
2666 AC_RUN_IFELSE([[
2667#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002668#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002669#if STDC_HEADERS
2670# include <stdlib.h>
2671# include <stddef.h>
2672#endif
2673#ifdef HAVE_UNISTD_H
2674#include <unistd.h>
2675#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002676#include <sys/stat.h>
2677#include <stdio.h>
2678main()
2679{
2680 struct stat sb;
2681 char *x,*ttyname();
2682 int om, m;
2683 FILE *fp;
2684
2685 if (!(x = ttyname(0))) exit(1);
2686 if (stat(x, &sb)) exit(1);
2687 om = sb.st_mode;
2688 if (om & 002) exit(0);
2689 m = system("mesg y");
2690 if (m == -1 || m == 127) exit(1);
2691 if (stat(x, &sb)) exit(1);
2692 m = sb.st_mode;
2693 if (chmod(x, om)) exit(1);
2694 if (m & 002) exit(0);
2695 if (sb.st_gid == getgid()) exit(1);
2696 if (!(fp=fopen("conftest_grp", "w")))
2697 exit(1);
2698 fprintf(fp, "%d\n", sb.st_gid);
2699 fclose(fp);
2700 exit(0);
2701}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002702 ]],[
2703 if test -f conftest_grp; then
2704 vim_cv_tty_group=`cat conftest_grp`
2705 if test "x$vim_cv_tty_mode" = "x" ; then
2706 vim_cv_tty_mode=0620
2707 fi
2708 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2709 else
2710 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002711 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002712 fi
2713 ],[
2714 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002715 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002716 ],[
2717 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2718 ])
2719 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002720rm -f conftest_grp
2721
Bram Moolenaar446cb832008-06-24 21:56:24 +00002722if test "x$vim_cv_tty_group" != "xworld" ; then
2723 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2724 if test "x$vim_cv_tty_mode" = "x" ; then
2725 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)])
2726 else
2727 AC_DEFINE(PTYMODE, 0620)
2728 fi
2729fi
2730
Bram Moolenaar071d4272004-06-13 20:20:40 +00002731dnl Checks for library functions. ===================================
2732
2733AC_TYPE_SIGNAL
2734
2735dnl find out what to use at the end of a signal function
2736if test $ac_cv_type_signal = void; then
2737 AC_DEFINE(SIGRETURN, [return])
2738else
2739 AC_DEFINE(SIGRETURN, [return 0])
2740fi
2741
2742dnl check if struct sigcontext is defined (used for SGI only)
2743AC_MSG_CHECKING(for struct sigcontext)
2744AC_TRY_COMPILE([
2745#include <signal.h>
2746test_sig()
2747{
2748 struct sigcontext *scont;
2749 scont = (struct sigcontext *)0;
2750 return 1;
2751} ], ,
2752 AC_MSG_RESULT(yes)
2753 AC_DEFINE(HAVE_SIGCONTEXT),
2754 AC_MSG_RESULT(no))
2755
2756dnl tricky stuff: try to find out if getcwd() is implemented with
2757dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002758AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2759 [
2760 AC_RUN_IFELSE([[
2761#include "confdefs.h"
2762#ifdef HAVE_UNISTD_H
2763#include <unistd.h>
2764#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002765char *dagger[] = { "IFS=pwd", 0 };
2766main()
2767{
2768 char buffer[500];
2769 extern char **environ;
2770 environ = dagger;
2771 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002772}
2773 ]],[
2774 vim_cv_getcwd_broken=no
2775 ],[
2776 vim_cv_getcwd_broken=yes
2777 ],[
2778 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2779 ])
2780 ])
2781
2782if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2783 AC_DEFINE(BAD_GETCWD)
2784fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002785
Bram Moolenaar25153e12010-02-24 14:47:08 +01002786dnl Check for functions in one big call, to reduce the size of configure.
2787dnl Can only be used for functions that do not require any include.
2788AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002789 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002790 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002791 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002792 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002793 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2794 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002795AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002796
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002797dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2798dnl appropriate, so that off_t is 64 bits when needed.
2799AC_SYS_LARGEFILE
2800
Bram Moolenaar071d4272004-06-13 20:20:40 +00002801dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2802AC_MSG_CHECKING(for st_blksize)
2803AC_TRY_COMPILE(
2804[#include <sys/types.h>
2805#include <sys/stat.h>],
2806[ struct stat st;
2807 int n;
2808
2809 stat("/", &st);
2810 n = (int)st.st_blksize;],
2811 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2812 AC_MSG_RESULT(no))
2813
Bram Moolenaar446cb832008-06-24 21:56:24 +00002814AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2815 [
2816 AC_RUN_IFELSE([[
2817#include "confdefs.h"
2818#if STDC_HEADERS
2819# include <stdlib.h>
2820# include <stddef.h>
2821#endif
2822#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002823#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002824main() {struct stat st; exit(stat("configure/", &st) != 0); }
2825 ]],[
2826 vim_cv_stat_ignores_slash=yes
2827 ],[
2828 vim_cv_stat_ignores_slash=no
2829 ],[
2830 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2831 ])
2832 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002833
Bram Moolenaar446cb832008-06-24 21:56:24 +00002834if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2835 AC_DEFINE(STAT_IGNORES_SLASH)
2836fi
2837
Bram Moolenaar071d4272004-06-13 20:20:40 +00002838dnl Link with iconv for charset translation, if not found without library.
2839dnl check for iconv() requires including iconv.h
2840dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2841dnl has been installed.
2842AC_MSG_CHECKING(for iconv_open())
2843save_LIBS="$LIBS"
2844LIBS="$LIBS -liconv"
2845AC_TRY_LINK([
2846#ifdef HAVE_ICONV_H
2847# include <iconv.h>
2848#endif
2849 ], [iconv_open("fr", "to");],
2850 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2851 LIBS="$save_LIBS"
2852 AC_TRY_LINK([
2853#ifdef HAVE_ICONV_H
2854# include <iconv.h>
2855#endif
2856 ], [iconv_open("fr", "to");],
2857 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2858 AC_MSG_RESULT(no)))
2859
2860
2861AC_MSG_CHECKING(for nl_langinfo(CODESET))
2862AC_TRY_LINK([
2863#ifdef HAVE_LANGINFO_H
2864# include <langinfo.h>
2865#endif
2866], [char *cs = nl_langinfo(CODESET);],
2867 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2868 AC_MSG_RESULT(no))
2869
Bram Moolenaar446cb832008-06-24 21:56:24 +00002870dnl Need various functions for floating point support. Only enable
2871dnl floating point when they are all present.
2872AC_CHECK_LIB(m, strtod)
2873AC_MSG_CHECKING([for strtod() and other floating point functions])
2874AC_TRY_LINK([
2875#ifdef HAVE_MATH_H
2876# include <math.h>
2877#endif
2878#if STDC_HEADERS
2879# include <stdlib.h>
2880# include <stddef.h>
2881#endif
2882], [char *s; double d;
2883 d = strtod("1.1", &s);
2884 d = fabs(1.11);
2885 d = ceil(1.11);
2886 d = floor(1.11);
2887 d = log10(1.11);
2888 d = pow(1.11, 2.22);
2889 d = sqrt(1.11);
2890 d = sin(1.11);
2891 d = cos(1.11);
2892 d = atan(1.11);
2893 ],
2894 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2895 AC_MSG_RESULT(no))
2896
Bram Moolenaar071d4272004-06-13 20:20:40 +00002897dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2898dnl when -lacl works, also try to use -lattr (required for Debian).
2899AC_MSG_CHECKING(--disable-acl argument)
2900AC_ARG_ENABLE(acl,
2901 [ --disable-acl Don't check for ACL support.],
2902 , [enable_acl="yes"])
2903if test "$enable_acl" = "yes"; then
2904AC_MSG_RESULT(no)
2905AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2906 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2907 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2908
2909AC_MSG_CHECKING(for POSIX ACL support)
2910AC_TRY_LINK([
2911#include <sys/types.h>
2912#ifdef HAVE_SYS_ACL_H
2913# include <sys/acl.h>
2914#endif
2915acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2916 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2917 acl_free(acl);],
2918 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2919 AC_MSG_RESULT(no))
2920
2921AC_MSG_CHECKING(for Solaris ACL support)
2922AC_TRY_LINK([
2923#ifdef HAVE_SYS_ACL_H
2924# include <sys/acl.h>
2925#endif], [acl("foo", GETACLCNT, 0, NULL);
2926 ],
2927 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2928 AC_MSG_RESULT(no))
2929
2930AC_MSG_CHECKING(for AIX ACL support)
2931AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002932#if STDC_HEADERS
2933# include <stdlib.h>
2934# include <stddef.h>
2935#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002936#ifdef HAVE_SYS_ACL_H
2937# include <sys/acl.h>
2938#endif
2939#ifdef HAVE_SYS_ACCESS_H
2940# include <sys/access.h>
2941#endif
2942#define _ALL_SOURCE
2943
2944#include <sys/stat.h>
2945
2946int aclsize;
2947struct acl *aclent;], [aclsize = sizeof(struct acl);
2948 aclent = (void *)malloc(aclsize);
2949 statacl("foo", STX_NORMAL, aclent, aclsize);
2950 ],
2951 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2952 AC_MSG_RESULT(no))
2953else
2954 AC_MSG_RESULT(yes)
2955fi
2956
2957AC_MSG_CHECKING(--disable-gpm argument)
2958AC_ARG_ENABLE(gpm,
2959 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2960 [enable_gpm="yes"])
2961
2962if test "$enable_gpm" = "yes"; then
2963 AC_MSG_RESULT(no)
2964 dnl Checking if gpm support can be compiled
2965 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2966 [olibs="$LIBS" ; LIBS="-lgpm"]
2967 AC_TRY_LINK(
2968 [#include <gpm.h>
2969 #include <linux/keyboard.h>],
2970 [Gpm_GetLibVersion(NULL);],
2971 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2972 dnl FEAT_MOUSE_GPM if mouse support is included
2973 [vi_cv_have_gpm=yes],
2974 [vi_cv_have_gpm=no])
2975 [LIBS="$olibs"]
2976 )
2977 if test $vi_cv_have_gpm = yes; then
2978 LIBS="$LIBS -lgpm"
2979 AC_DEFINE(HAVE_GPM)
2980 fi
2981else
2982 AC_MSG_RESULT(yes)
2983fi
2984
Bram Moolenaar446cb832008-06-24 21:56:24 +00002985AC_MSG_CHECKING(--disable-sysmouse argument)
2986AC_ARG_ENABLE(sysmouse,
2987 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2988 [enable_sysmouse="yes"])
2989
2990if test "$enable_sysmouse" = "yes"; then
2991 AC_MSG_RESULT(no)
2992 dnl Checking if sysmouse support can be compiled
2993 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
2994 dnl defines FEAT_SYSMOUSE if mouse support is included
2995 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
2996 AC_TRY_LINK(
2997 [#include <sys/consio.h>
2998 #include <signal.h>
2999 #include <sys/fbio.h>],
3000 [struct mouse_info mouse;
3001 mouse.operation = MOUSE_MODE;
3002 mouse.operation = MOUSE_SHOW;
3003 mouse.u.mode.mode = 0;
3004 mouse.u.mode.signal = SIGUSR2;],
3005 [vi_cv_have_sysmouse=yes],
3006 [vi_cv_have_sysmouse=no])
3007 )
3008 if test $vi_cv_have_sysmouse = yes; then
3009 AC_DEFINE(HAVE_SYSMOUSE)
3010 fi
3011else
3012 AC_MSG_RESULT(yes)
3013fi
3014
Bram Moolenaarf05da212009-11-17 16:13:15 +00003015dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
3016AC_MSG_CHECKING(for FD_CLOEXEC)
3017AC_TRY_COMPILE(
3018[#if HAVE_FCNTL_H
3019# include <fcntl.h>
3020#endif],
3021[ int flag = FD_CLOEXEC;],
3022 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
3023 AC_MSG_RESULT(not usable))
3024
Bram Moolenaar071d4272004-06-13 20:20:40 +00003025dnl rename needs to be checked separately to work on Nextstep with cc
3026AC_MSG_CHECKING(for rename)
3027AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
3028 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
3029 AC_MSG_RESULT(no))
3030
3031dnl sysctl() may exist but not the arguments we use
3032AC_MSG_CHECKING(for sysctl)
3033AC_TRY_COMPILE(
3034[#include <sys/types.h>
3035#include <sys/sysctl.h>],
3036[ int mib[2], r;
3037 size_t len;
3038
3039 mib[0] = CTL_HW;
3040 mib[1] = HW_USERMEM;
3041 len = sizeof(r);
3042 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
3043 ],
3044 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
3045 AC_MSG_RESULT(not usable))
3046
3047dnl sysinfo() may exist but not be Linux compatible
3048AC_MSG_CHECKING(for sysinfo)
3049AC_TRY_COMPILE(
3050[#include <sys/types.h>
3051#include <sys/sysinfo.h>],
3052[ struct sysinfo sinfo;
3053 int t;
3054
3055 (void)sysinfo(&sinfo);
3056 t = sinfo.totalram;
3057 ],
3058 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
3059 AC_MSG_RESULT(not usable))
3060
Bram Moolenaar914572a2007-05-01 11:37:47 +00003061dnl struct sysinfo may have the mem_unit field or not
3062AC_MSG_CHECKING(for sysinfo.mem_unit)
3063AC_TRY_COMPILE(
3064[#include <sys/types.h>
3065#include <sys/sysinfo.h>],
3066[ struct sysinfo sinfo;
3067 sinfo.mem_unit = 1;
3068 ],
3069 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
3070 AC_MSG_RESULT(no))
3071
Bram Moolenaar071d4272004-06-13 20:20:40 +00003072dnl sysconf() may exist but not support what we want to use
3073AC_MSG_CHECKING(for sysconf)
3074AC_TRY_COMPILE(
3075[#include <unistd.h>],
3076[ (void)sysconf(_SC_PAGESIZE);
3077 (void)sysconf(_SC_PHYS_PAGES);
3078 ],
3079 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
3080 AC_MSG_RESULT(not usable))
3081
Bram Moolenaar914703b2010-05-31 21:59:46 +02003082AC_CHECK_SIZEOF([int])
3083AC_CHECK_SIZEOF([long])
3084AC_CHECK_SIZEOF([time_t])
3085AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02003086
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003087dnl Make sure that uint32_t is really 32 bits unsigned.
3088AC_MSG_CHECKING([uint32_t is 32 bits])
3089AC_TRY_RUN([
3090#ifdef HAVE_STDINT_H
3091# include <stdint.h>
3092#endif
3093#ifdef HAVE_INTTYPES_H
3094# include <inttypes.h>
3095#endif
3096main() {
3097 uint32_t nr1 = (uint32_t)-1;
3098 uint32_t nr2 = (uint32_t)0xffffffffUL;
3099 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
3100 exit(0);
3101}],
3102AC_MSG_RESULT(ok),
3103AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
3104AC_MSG_ERROR([could not compile program using uint32_t.]))
3105
Bram Moolenaar446cb832008-06-24 21:56:24 +00003106dnl Check for memmove() before bcopy(), makes memmove() be used when both are
3107dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
3108
Bram Moolenaar071d4272004-06-13 20:20:40 +00003109[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00003110#include "confdefs.h"
3111#ifdef HAVE_STRING_H
3112# include <string.h>
3113#endif
3114#if STDC_HEADERS
3115# include <stdlib.h>
3116# include <stddef.h>
3117#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003118main() {
3119 char buf[10];
3120 strcpy(buf, "abcdefghi");
3121 mch_memmove(buf, buf + 2, 3);
3122 if (strncmp(buf, "ababcf", 6))
3123 exit(1);
3124 strcpy(buf, "abcdefghi");
3125 mch_memmove(buf + 2, buf, 3);
3126 if (strncmp(buf, "cdedef", 6))
3127 exit(1);
3128 exit(0); /* libc version works properly. */
3129}']
3130
Bram Moolenaar446cb832008-06-24 21:56:24 +00003131AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
3132 [
3133 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
3134 [
3135 vim_cv_memmove_handles_overlap=yes
3136 ],[
3137 vim_cv_memmove_handles_overlap=no
3138 ],[
3139 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
3140 ])
3141 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003142
Bram Moolenaar446cb832008-06-24 21:56:24 +00003143if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
3144 AC_DEFINE(USEMEMMOVE)
3145else
3146 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
3147 [
3148 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
3149 [
3150 vim_cv_bcopy_handles_overlap=yes
3151 ],[
3152 vim_cv_bcopy_handles_overlap=no
3153 ],[
3154 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
3155 ])
3156 ])
3157
3158 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
3159 AC_DEFINE(USEBCOPY)
3160 else
3161 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
3162 [
3163 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
3164 [
3165 vim_cv_memcpy_handles_overlap=yes
3166 ],[
3167 vim_cv_memcpy_handles_overlap=no
3168 ],[
3169 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
3170 ])
3171 ])
3172
3173 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
3174 AC_DEFINE(USEMEMCPY)
3175 fi
3176 fi
3177fi
3178
Bram Moolenaar071d4272004-06-13 20:20:40 +00003179
3180dnl Check for multibyte locale functions
3181dnl Find out if _Xsetlocale() is supported by libX11.
3182dnl Check if X_LOCALE should be defined.
3183
3184if test "$enable_multibyte" = "yes"; then
3185 cflags_save=$CFLAGS
3186 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00003187 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003188 CFLAGS="$CFLAGS -I$x_includes"
3189 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
3190 AC_MSG_CHECKING(whether X_LOCALE needed)
3191 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
3192 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
3193 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
3194 AC_MSG_RESULT(no))
3195 fi
3196 CFLAGS=$cflags_save
3197 LDFLAGS=$ldflags_save
3198fi
3199
3200dnl Link with xpg4, it is said to make Korean locale working
3201AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
3202
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003203dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003204dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003205dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003206dnl -t for typedefs (many ctags have this)
3207dnl -s for static functions (Elvis ctags only?)
3208dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
3209dnl -i+m to test for older Exuberant ctags
3210AC_MSG_CHECKING(how to create tags)
3211test -f tags && mv tags tags.save
3212if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003213 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003214else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003215 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003216 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
3217 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
3218 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
3219 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
3220 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
3221 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
3222 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
3223fi
3224test -f tags.save && mv tags.save tags
3225AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
3226
3227dnl Check how we can run man with a section number
3228AC_MSG_CHECKING(how to run man with a section nr)
3229MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00003230(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 +00003231AC_MSG_RESULT($MANDEF)
3232if test "$MANDEF" = "man -s"; then
3233 AC_DEFINE(USEMAN_S)
3234fi
3235
3236dnl Check if gettext() is working and if it needs -lintl
3237AC_MSG_CHECKING(--disable-nls argument)
3238AC_ARG_ENABLE(nls,
3239 [ --disable-nls Don't support NLS (gettext()).], ,
3240 [enable_nls="yes"])
3241
3242if test "$enable_nls" = "yes"; then
3243 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00003244
3245 INSTALL_LANGS=install-languages
3246 AC_SUBST(INSTALL_LANGS)
3247 INSTALL_TOOL_LANGS=install-tool-languages
3248 AC_SUBST(INSTALL_TOOL_LANGS)
3249
Bram Moolenaar071d4272004-06-13 20:20:40 +00003250 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
3251 AC_MSG_CHECKING([for NLS])
3252 if test -f po/Makefile; then
3253 have_gettext="no"
3254 if test -n "$MSGFMT"; then
3255 AC_TRY_LINK(
3256 [#include <libintl.h>],
3257 [gettext("Test");],
3258 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3259 olibs=$LIBS
3260 LIBS="$LIBS -lintl"
3261 AC_TRY_LINK(
3262 [#include <libintl.h>],
3263 [gettext("Test");],
3264 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3265 AC_MSG_RESULT([gettext() doesn't work]);
3266 LIBS=$olibs))
3267 else
3268 AC_MSG_RESULT([msgfmt not found - disabled]);
3269 fi
3270 if test $have_gettext = "yes"; then
3271 AC_DEFINE(HAVE_GETTEXT)
3272 MAKEMO=yes
3273 AC_SUBST(MAKEMO)
3274 dnl this was added in GNU gettext 0.10.36
3275 AC_CHECK_FUNCS(bind_textdomain_codeset)
3276 dnl _nl_msg_cat_cntr is required for GNU gettext
3277 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3278 AC_TRY_LINK(
3279 [#include <libintl.h>
3280 extern int _nl_msg_cat_cntr;],
3281 [++_nl_msg_cat_cntr;],
3282 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3283 AC_MSG_RESULT([no]))
3284 fi
3285 else
3286 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3287 fi
3288else
3289 AC_MSG_RESULT(yes)
3290fi
3291
3292dnl Check for dynamic linking loader
3293AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3294if test x${DLL} = xdlfcn.h; then
3295 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3296 AC_MSG_CHECKING([for dlopen()])
3297 AC_TRY_LINK(,[
3298 extern void* dlopen();
3299 dlopen();
3300 ],
3301 AC_MSG_RESULT(yes);
3302 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3303 AC_MSG_RESULT(no);
3304 AC_MSG_CHECKING([for dlopen() in -ldl])
3305 olibs=$LIBS
3306 LIBS="$LIBS -ldl"
3307 AC_TRY_LINK(,[
3308 extern void* dlopen();
3309 dlopen();
3310 ],
3311 AC_MSG_RESULT(yes);
3312 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3313 AC_MSG_RESULT(no);
3314 LIBS=$olibs))
3315 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3316 dnl ick :-)
3317 AC_MSG_CHECKING([for dlsym()])
3318 AC_TRY_LINK(,[
3319 extern void* dlsym();
3320 dlsym();
3321 ],
3322 AC_MSG_RESULT(yes);
3323 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3324 AC_MSG_RESULT(no);
3325 AC_MSG_CHECKING([for dlsym() in -ldl])
3326 olibs=$LIBS
3327 LIBS="$LIBS -ldl"
3328 AC_TRY_LINK(,[
3329 extern void* dlsym();
3330 dlsym();
3331 ],
3332 AC_MSG_RESULT(yes);
3333 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3334 AC_MSG_RESULT(no);
3335 LIBS=$olibs))
3336elif test x${DLL} = xdl.h; then
3337 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3338 AC_MSG_CHECKING([for shl_load()])
3339 AC_TRY_LINK(,[
3340 extern void* shl_load();
3341 shl_load();
3342 ],
3343 AC_MSG_RESULT(yes);
3344 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3345 AC_MSG_RESULT(no);
3346 AC_MSG_CHECKING([for shl_load() in -ldld])
3347 olibs=$LIBS
3348 LIBS="$LIBS -ldld"
3349 AC_TRY_LINK(,[
3350 extern void* shl_load();
3351 shl_load();
3352 ],
3353 AC_MSG_RESULT(yes);
3354 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3355 AC_MSG_RESULT(no);
3356 LIBS=$olibs))
3357fi
3358AC_CHECK_HEADERS(setjmp.h)
3359
3360if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3361 dnl -ldl must come after DynaLoader.a
3362 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3363 LIBS=`echo $LIBS | sed s/-ldl//`
3364 PERL_LIBS="$PERL_LIBS -ldl"
3365 fi
3366fi
3367
Bram Moolenaar164fca32010-07-14 13:58:07 +02003368if test "x$MACOSX" = "xyes"; then
3369 AC_MSG_CHECKING(whether we need -framework Cocoa)
3370 dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
3371 dnl disabled during tiny build)
3372 if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
3373 LIBS=$"$LIBS -framework Cocoa"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003374 AC_MSG_RESULT(yes)
3375 else
3376 AC_MSG_RESULT(no)
3377 fi
3378fi
Bram Moolenaar164fca32010-07-14 13:58:07 +02003379if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003380 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003381fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003382
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003383dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3384dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3385dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003386dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3387dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003388DEPEND_CFLAGS_FILTER=
3389if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003390 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003391 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003392 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003393 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003394 AC_MSG_RESULT(yes)
3395 else
3396 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003397 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003398 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3399 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003400 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003401 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3402 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003403 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 +00003404 AC_MSG_RESULT(yes)
3405 else
3406 AC_MSG_RESULT(no)
3407 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003408fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003409AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003410
3411dnl write output files
3412AC_OUTPUT(auto/config.mk:config.mk.in)
3413
3414dnl vim: set sw=2 tw=78 fo+=l: