blob: b10d5c9da90e4f796a25988ea56ea2b7eb733134 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001dnl configure.in: autoconf script for Vim
2
3dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
4dnl Should also work with autoconf 2.54 and later.
5
6AC_INIT(vim.h)
7AC_CONFIG_HEADER(auto/config.h:config.h.in)
8
9dnl Being able to run configure means the system is Unix (compatible).
10AC_DEFINE(UNIX)
11AC_PROG_MAKE_SET
12
13dnl Checks for programs.
14AC_PROG_CC dnl required by almost everything
15AC_PROG_CPP dnl required by header file checks
16AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
17AC_ISC_POSIX dnl required by AC_C_CROSS
18AC_PROG_AWK dnl required for "make html" in ../doc
19
20dnl Don't strip if we don't have it
21AC_CHECK_PROG(STRIP, strip, strip, :)
22
Bram Moolenaar325b7a22004-07-05 15:58:32 +000023dnl Check for extension of executables
Bram Moolenaar071d4272004-06-13 20:20:40 +000024AC_EXEEXT
25
Bram Moolenaar446cb832008-06-24 21:56:24 +000026dnl Check for standard headers. We don't use this in Vim but other stuff
27dnl in autoconf needs it, where it uses STDC_HEADERS.
28AC_HEADER_STDC
29AC_HEADER_SYS_WAIT
30
Bram Moolenaar071d4272004-06-13 20:20:40 +000031dnl Set default value for CFLAGS if none is defined or it's empty
32if test -z "$CFLAGS"; then
33 CFLAGS="-O"
34 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
35fi
36if test "$GCC" = yes; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +000037 dnl method that should work for nearly all versions
38 gccversion=`"$CC" -dumpversion`
39 if test "x$gccversion" = "x"; then
40 dnl old method; fall-back for when -dumpversion doesn't work
41 gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
42 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +000043 dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
44 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +000045 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +000046 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
47 else
48 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
49 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
50 CFLAGS="$CFLAGS -fno-strength-reduce"
51 fi
52 fi
53fi
54
Bram Moolenaar446cb832008-06-24 21:56:24 +000055dnl If configure thinks we are cross compiling, there might be something
56dnl wrong with the CC or CFLAGS settings, give a useful warning message
Bram Moolenaar071d4272004-06-13 20:20:40 +000057if test "$cross_compiling" = yes; then
Bram Moolenaar446cb832008-06-24 21:56:24 +000058 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
Bram Moolenaar071d4272004-06-13 20:20:40 +000059fi
60
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000061dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
62dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +000063test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
64
65if test -f ./toolcheck; then
66 AC_CHECKING(for buggy tools)
67 sh ./toolcheck 1>&AC_FD_MSG
68fi
69
70OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
71
72dnl Check for BeOS, which needs an extra source file
73AC_MSG_CHECKING(for BeOS)
74case `uname` in
75 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
76 BEOS=yes; AC_MSG_RESULT(yes);;
77 *) BEOS=no; AC_MSG_RESULT(no);;
78esac
79
80dnl If QNX is found, assume we don't want to use Xphoton
81dnl unless it was specifically asked for (--with-x)
82AC_MSG_CHECKING(for QNX)
83case `uname` in
84 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
85 test -z "$with_x" && with_x=no
86 QNX=yes; AC_MSG_RESULT(yes);;
87 *) QNX=no; AC_MSG_RESULT(no);;
88esac
89
90dnl Check for Darwin and MacOS X
91dnl We do a check for MacOS X in the very beginning because there
92dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +000093AC_MSG_CHECKING([for Darwin (Mac OS X)])
94if test "`(uname) 2>/dev/null`" = Darwin; then
95 AC_MSG_RESULT(yes)
96
97 AC_MSG_CHECKING(--disable-darwin argument)
98 AC_ARG_ENABLE(darwin,
99 [ --disable-darwin Disable Darwin (Mac OS X) support.],
100 , [enable_darwin="yes"])
101 if test "$enable_darwin" = "yes"; then
102 AC_MSG_RESULT(no)
103 AC_MSG_CHECKING(if Darwin files are there)
Bram Moolenaar164fca32010-07-14 13:58:07 +0200104 if test -f os_macosx.m; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105 AC_MSG_RESULT(yes)
106 else
107 AC_MSG_RESULT([no, Darwin support disabled])
108 enable_darwin=no
109 fi
110 else
111 AC_MSG_RESULT([yes, Darwin support excluded])
112 fi
113
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000114 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000115 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000116 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000117 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000118
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100119 AC_MSG_CHECKING(--with-developer-dir argument)
120 AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
121 DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
122 DEVELOPER_DIR=""; AC_MSG_RESULT(not present))
123
124 if test "x$DEVELOPER_DIR" = "x"; then
125 AC_PATH_PROG(XCODE_SELECT, xcode-select)
126 if test "x$XCODE_SELECT" != "x"; then
127 AC_MSG_CHECKING(for developer dir using xcode-select)
128 DEVELOPER_DIR=`$XCODE_SELECT -print-path`
129 AC_MSG_RESULT([$DEVELOPER_DIR])
130 else
131 DEVELOPER_DIR=/Developer
132 fi
133 fi
134
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000135 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000136 AC_MSG_CHECKING(for 10.4 universal SDK)
137 dnl There is a terrible inconsistency (but we appear to get away with it):
138 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
139 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
140 dnl tests using the preprocessor are actually done with the wrong header
141 dnl files. $LDFLAGS is set at the end, because configure uses it together
142 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000143 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000144 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000145 save_ldflags="$LDFLAGS"
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100146 CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000147 AC_TRY_LINK([ ], [ ],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000148 AC_MSG_RESULT(found, will make universal binary),
149
150 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000151 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000152 AC_MSG_CHECKING(if Intel architecture is supported)
153 CPPFLAGS="$CPPFLAGS -arch i386"
154 LDFLAGS="$save_ldflags -arch i386"
155 AC_TRY_LINK([ ], [ ],
156 AC_MSG_RESULT(yes); MACARCH="intel",
157 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000158 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000159 CPPFLAGS="$save_cppflags -arch ppc"
160 LDFLAGS="$save_ldflags -arch ppc"))
161 elif test "x$MACARCH" = "xintel"; then
162 CPPFLAGS="$CPPFLAGS -arch intel"
163 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000164 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000165 CPPFLAGS="$CPPFLAGS -arch ppc"
166 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000167 fi
168
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169 if test "$enable_darwin" = "yes"; then
170 MACOSX=yes
Bram Moolenaar164fca32010-07-14 13:58:07 +0200171 OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000172 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000173 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000174 CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175
176 dnl If Carbon is found, assume we don't want X11
177 dnl unless it was specifically asked for (--with-x)
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000178 dnl or Motif, Athena or GTK GUI is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000179 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
180 if test "x$CARBON" = "xyes"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +0200181 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000182 with_x=no
Bram Moolenaar071d4272004-06-13 20:20:40 +0000183 fi
184 fi
185 fi
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000186
Bram Moolenaardb552d602006-03-23 22:59:57 +0000187 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000188 dnl free. This happens in expand_filename(), because the optimizer swaps
Bram Moolenaardb552d602006-03-23 22:59:57 +0000189 dnl two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000190 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
191 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
192 fi
193
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194else
195 AC_MSG_RESULT(no)
196fi
197
198AC_SUBST(OS_EXTRA_SRC)
199AC_SUBST(OS_EXTRA_OBJ)
200
201dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
202dnl Only when the directory exists and it wasn't there yet.
203dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000204dnl Skip all of this when cross-compiling.
205if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000206 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000207 have_local_include=''
208 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000209 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
210 --without-local-dir do not search /usr/local for local libraries.], [
211 local_dir="$withval"
212 case "$withval" in
213 */*) ;;
214 no)
215 # avoid adding local dir to LDFLAGS and CPPFLAGS
Bram Moolenaare06c1882010-07-21 22:05:20 +0200216 have_local_include=yes
Bram Moolenaarc236c162008-07-13 17:41:49 +0000217 have_local_lib=yes
218 ;;
219 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
220 esac
221 AC_MSG_RESULT($local_dir)
222 ], [
223 local_dir=/usr/local
224 AC_MSG_RESULT(Defaulting to $local_dir)
225 ])
226 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000227 echo 'void f(){}' > conftest.c
228 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
Bram Moolenaarc236c162008-07-13 17:41:49 +0000229 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
230 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000231 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000233 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
234 tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000235 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000236 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000237 fi
238 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000239 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
240 tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000241 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000242 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000243 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244 fi
245fi
246
247AC_MSG_CHECKING(--with-vim-name argument)
248AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
249 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000250 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251AC_SUBST(VIMNAME)
252AC_MSG_CHECKING(--with-ex-name argument)
253AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
254 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
255 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
256AC_SUBST(EXNAME)
257AC_MSG_CHECKING(--with-view-name argument)
258AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
259 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
260 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
261AC_SUBST(VIEWNAME)
262
263AC_MSG_CHECKING(--with-global-runtime argument)
264AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
265 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
266 AC_MSG_RESULT(no))
267
268AC_MSG_CHECKING(--with-modified-by argument)
269AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
270 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
271 AC_MSG_RESULT(no))
272
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200273dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000274AC_MSG_CHECKING(if character set is EBCDIC)
275AC_TRY_COMPILE([ ],
276[ /* TryCompile function for CharSet.
277 Treat any failure as ASCII for compatibility with existing art.
278 Use compile-time rather than run-time tests for cross-compiler
279 tolerance. */
280#if '0'!=240
281make an error "Character set is not EBCDIC"
282#endif ],
283[ # TryCompile action if true
284cf_cv_ebcdic=yes ],
285[ # TryCompile action if false
286cf_cv_ebcdic=no])
287# end of TryCompile ])
288# end of CacheVal CvEbcdic
289AC_MSG_RESULT($cf_cv_ebcdic)
290case "$cf_cv_ebcdic" in #(vi
291 yes) AC_DEFINE(EBCDIC)
292 line_break='"\\n"'
293 ;;
294 *) line_break='"\\012"';;
295esac
296AC_SUBST(line_break)
297
298if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200299dnl If we have EBCDIC we most likley have z/OS Unix, let's test it!
300AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000301case `uname` in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200302 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303 dnl If using cc the environment variable _CC_CCMODE must be
304 dnl set to "1", so that some compiler extensions are enabled.
305 dnl If using c89 the environment variable is named _CC_C89MODE.
306 dnl Note: compile with c89 never tested.
307 if test "$CC" = "cc"; then
308 ccm="$_CC_CCMODE"
309 ccn="CC"
310 else
311 if test "$CC" = "c89"; then
312 ccm="$_CC_C89MODE"
313 ccn="C89"
314 else
315 ccm=1
316 fi
317 fi
318 if test "$ccm" != "1"; then
319 echo ""
320 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200321 echo " On z/OS Unix, the environment variable"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000322 echo " __CC_${ccn}MODE must be set to \"1\"!"
323 echo " Do:"
324 echo " export _CC_${ccn}MODE=1"
325 echo " and then call configure again."
326 echo "------------------------------------------"
327 exit 1
328 fi
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200329 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
330 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331 AC_MSG_RESULT(yes)
332 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200333 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334 AC_MSG_RESULT(no)
335 ;;
336esac
337fi
338
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200339dnl Set QUOTESED. Needs additional backslashes on zOS
340if test "$zOSUnix" = "yes"; then
341 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
342else
343 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
344fi
345AC_SUBST(QUOTESED)
346
347
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000348dnl Link with -lselinux for SELinux stuff; if not found
349AC_MSG_CHECKING(--disable-selinux argument)
350AC_ARG_ENABLE(selinux,
351 [ --disable-selinux Don't check for SELinux support.],
352 , enable_selinux="yes")
353if test "$enable_selinux" = "yes"; then
354 AC_MSG_RESULT(no)
355 AC_CHECK_LIB(selinux, is_selinux_enabled,
356 [LIBS="$LIBS -lselinux"
357 AC_DEFINE(HAVE_SELINUX)])
358else
359 AC_MSG_RESULT(yes)
360fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000361
362dnl Check user requested features.
363
364AC_MSG_CHECKING(--with-features argument)
365AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
366 features="$withval"; AC_MSG_RESULT($features),
367 features="normal"; AC_MSG_RESULT(Defaulting to normal))
368
369dovimdiff=""
370dogvimdiff=""
371case "$features" in
372 tiny) AC_DEFINE(FEAT_TINY) ;;
373 small) AC_DEFINE(FEAT_SMALL) ;;
374 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
375 dogvimdiff="installgvimdiff" ;;
376 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
377 dogvimdiff="installgvimdiff" ;;
378 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
379 dogvimdiff="installgvimdiff" ;;
380 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
381esac
382
383AC_SUBST(dovimdiff)
384AC_SUBST(dogvimdiff)
385
386AC_MSG_CHECKING(--with-compiledby argument)
387AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
388 compiledby="$withval"; AC_MSG_RESULT($withval),
389 compiledby=""; AC_MSG_RESULT(no))
390AC_SUBST(compiledby)
391
392AC_MSG_CHECKING(--disable-xsmp argument)
393AC_ARG_ENABLE(xsmp,
394 [ --disable-xsmp Disable XSMP session management],
395 , enable_xsmp="yes")
396
397if test "$enable_xsmp" = "yes"; then
398 AC_MSG_RESULT(no)
399 AC_MSG_CHECKING(--disable-xsmp-interact argument)
400 AC_ARG_ENABLE(xsmp-interact,
401 [ --disable-xsmp-interact Disable XSMP interaction],
402 , enable_xsmp_interact="yes")
403 if test "$enable_xsmp_interact" = "yes"; then
404 AC_MSG_RESULT(no)
405 AC_DEFINE(USE_XSMP_INTERACT)
406 else
407 AC_MSG_RESULT(yes)
408 fi
409else
410 AC_MSG_RESULT(yes)
411fi
412
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200413dnl Check for Lua feature.
414AC_MSG_CHECKING(--enable-luainterp argument)
415AC_ARG_ENABLE(luainterp,
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,
Bram Moolenaare06c1882010-07-21 22:05:20 +0200623 [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000624 [enable_perlinterp="no"])
625AC_MSG_RESULT($enable_perlinterp)
Bram Moolenaare06c1882010-07-21 22:05:20 +0200626if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000627 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`
Bram Moolenaare06c1882010-07-21 22:05:20 +0200633 eval `$vi_cv_path_perl -V:libperl`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000634 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
635 badthreads=no
636 else
637 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
638 eval `$vi_cv_path_perl -V:use5005threads`
639 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
640 badthreads=no
641 else
642 badthreads=yes
643 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
644 fi
645 else
646 badthreads=yes
647 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
648 fi
649 fi
650 if test $badthreads = no; then
651 AC_MSG_RESULT(OK)
652 eval `$vi_cv_path_perl -V:shrpenv`
653 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
654 shrpenv=""
655 fi
656 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
657 AC_SUBST(vi_cv_perllib)
658 dnl Remove "-fno-something", it breaks using cproto.
659 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
660 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
661 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
662 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
663 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
664 -e 's/-bE:perl.exp//' -e 's/-lc //'`
665 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
666 dnl a test in configure may fail because of that.
667 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
668 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
669
670 dnl check that compiling a simple program still works with the flags
671 dnl added for Perl.
672 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
673 cflags_save=$CFLAGS
674 libs_save=$LIBS
675 ldflags_save=$LDFLAGS
676 CFLAGS="$CFLAGS $perlcppflags"
677 LIBS="$LIBS $perllibs"
678 LDFLAGS="$perlldflags $LDFLAGS"
679 AC_TRY_LINK(,[ ],
680 AC_MSG_RESULT(yes); perl_ok=yes,
681 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
682 CFLAGS=$cflags_save
683 LIBS=$libs_save
684 LDFLAGS=$ldflags_save
685 if test $perl_ok = yes; then
686 if test "X$perlcppflags" != "X"; then
Bram Moolenaard7afed32007-05-06 13:26:41 +0000687 dnl remove -pipe and -Wxxx, it confuses cproto
688 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000689 fi
690 if test "X$perlldflags" != "X"; then
691 LDFLAGS="$perlldflags $LDFLAGS"
692 fi
693 PERL_LIBS=$perllibs
694 PERL_SRC="auto/if_perl.c if_perlsfio.c"
695 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
696 PERL_PRO="if_perl.pro if_perlsfio.pro"
697 AC_DEFINE(FEAT_PERL)
698 fi
699 fi
700 else
701 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
702 fi
703 fi
704
705 if test "x$MACOSX" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +0000706 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000707 dir=/System/Library/Perl
708 darwindir=$dir/darwin
709 if test -d $darwindir; then
710 PERL=/usr/bin/perl
711 else
712 dnl Mac OS X 10.3
713 dir=/System/Library/Perl/5.8.1
714 darwindir=$dir/darwin-thread-multi-2level
715 if test -d $darwindir; then
716 PERL=/usr/bin/perl
717 fi
718 fi
719 if test -n "$PERL"; then
720 PERL_DIR="$dir"
721 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
722 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
723 PERL_LIBS="-L$darwindir/CORE -lperl"
724 fi
725 fi
Bram Moolenaare06c1882010-07-21 22:05:20 +0200726 if test "$enable_perlinterp" = "dynamic"; then
727 if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
728 AC_DEFINE(DYNAMIC_PERL)
729 PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
730 fi
731 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000732fi
733AC_SUBST(shrpenv)
734AC_SUBST(PERL_SRC)
735AC_SUBST(PERL_OBJ)
736AC_SUBST(PERL_PRO)
737AC_SUBST(PERL_CFLAGS)
738AC_SUBST(PERL_LIBS)
739
740AC_MSG_CHECKING(--enable-pythoninterp argument)
741AC_ARG_ENABLE(pythoninterp,
742 [ --enable-pythoninterp Include Python interpreter.], ,
743 [enable_pythoninterp="no"])
744AC_MSG_RESULT($enable_pythoninterp)
745if test "$enable_pythoninterp" = "yes"; then
746 dnl -- find the python executable
747 AC_PATH_PROG(vi_cv_path_python, python)
748 if test "X$vi_cv_path_python" != "X"; then
749
750 dnl -- get its version number
751 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
752 [[vi_cv_var_python_version=`
753 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
754 ]])
755
756 dnl -- it must be at least version 1.4
757 AC_MSG_CHECKING(Python is 1.4 or better)
758 if ${vi_cv_path_python} -c \
759 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
760 then
761 AC_MSG_RESULT(yep)
762
763 dnl -- find where python thinks it was installed
764 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
765 [ vi_cv_path_python_pfx=`
766 ${vi_cv_path_python} -c \
767 "import sys; print sys.prefix"` ])
768
769 dnl -- and where it thinks it runs
770 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
771 [ vi_cv_path_python_epfx=`
772 ${vi_cv_path_python} -c \
773 "import sys; print sys.exec_prefix"` ])
774
775 dnl -- python's internal library path
776
777 AC_CACHE_VAL(vi_cv_path_pythonpath,
778 [ vi_cv_path_pythonpath=`
779 unset PYTHONPATH;
780 ${vi_cv_path_python} -c \
781 "import sys, string; print string.join(sys.path,':')"` ])
782
783 dnl -- where the Python implementation library archives are
784
785 AC_ARG_WITH(python-config-dir,
786 [ --with-python-config-dir=PATH Python's config directory],
787 [ vi_cv_path_python_conf="${withval}" ] )
788
789 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
790 [
791 vi_cv_path_python_conf=
792 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
Bram Moolenaar72951072009-12-02 16:58:33 +0000793 for subdir in lib64 lib share; do
Bram Moolenaar071d4272004-06-13 20:20:40 +0000794 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
795 if test -d "$d" && test -f "$d/config.c"; then
796 vi_cv_path_python_conf="$d"
797 fi
798 done
799 done
800 ])
801
802 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
803
804 if test "X$PYTHON_CONFDIR" = "X"; then
805 AC_MSG_RESULT([can't find it!])
806 else
807
808 dnl -- we need to examine Python's config/Makefile too
809 dnl see what the interpreter is built from
810 AC_CACHE_VAL(vi_cv_path_python_plibs,
811 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000812 pwd=`pwd`
813 tmp_mkf="$pwd/config-PyMake$$"
814 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000815__:
Bram Moolenaar218116c2010-05-20 21:46:00 +0200816 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000817 @echo "python_LIBS='$(LIBS)'"
818 @echo "python_SYSLIBS='$(SYSLIBS)'"
819 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
820eof
821 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000822 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
823 rm -f -- "${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000824 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
825 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
826 vi_cv_path_python_plibs="-framework Python"
827 else
828 if test "${vi_cv_var_python_version}" = "1.4"; then
829 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
830 else
831 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
832 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +0200833 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 +0000834 dnl remove -ltermcap, it can conflict with an earlier -lncurses
835 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
836 fi
837 ])
838
839 PYTHON_LIBS="${vi_cv_path_python_plibs}"
840 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
841 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
842 else
843 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}"
844 fi
845 PYTHON_SRC="if_python.c"
846 dnl For Mac OSX 10.2 config.o is included in the Python library.
847 if test "x$MACOSX" = "xyes"; then
848 PYTHON_OBJ="objects/if_python.o"
849 else
850 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
851 fi
852 if test "${vi_cv_var_python_version}" = "1.4"; then
853 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
854 fi
855 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
856
857 dnl On FreeBSD linking with "-pthread" is required to use threads.
858 dnl _THREAD_SAFE must be used for compiling then.
859 dnl The "-pthread" is added to $LIBS, so that the following check for
860 dnl sigaltstack() will look in libc_r (it's there in libc!).
861 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
862 dnl will then define target-specific defines, e.g., -D_REENTRANT.
863 dnl Don't do this for Mac OSX, -pthread will generate a warning.
864 AC_MSG_CHECKING([if -pthread should be used])
865 threadsafe_flag=
866 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000867 dnl if test "x$MACOSX" != "xyes"; then
868 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000869 test "$GCC" = yes && threadsafe_flag="-pthread"
870 if test "`(uname) 2>/dev/null`" = FreeBSD; then
871 threadsafe_flag="-D_THREAD_SAFE"
872 thread_lib="-pthread"
873 fi
874 fi
875 libs_save_old=$LIBS
876 if test -n "$threadsafe_flag"; then
877 cflags_save=$CFLAGS
878 CFLAGS="$CFLAGS $threadsafe_flag"
879 LIBS="$LIBS $thread_lib"
880 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200881 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000882 AC_MSG_RESULT(no); LIBS=$libs_save_old
883 )
884 CFLAGS=$cflags_save
885 else
886 AC_MSG_RESULT(no)
887 fi
888
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200889 dnl Check that compiling a simple program still works with the flags
Bram Moolenaar071d4272004-06-13 20:20:40 +0000890 dnl added for Python.
891 AC_MSG_CHECKING([if compile and link flags for Python are sane])
892 cflags_save=$CFLAGS
893 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200894 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000895 LIBS="$LIBS $PYTHON_LIBS"
896 AC_TRY_LINK(,[ ],
897 AC_MSG_RESULT(yes); python_ok=yes,
898 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
899 CFLAGS=$cflags_save
900 LIBS=$libs_save
901 if test $python_ok = yes; then
902 AC_DEFINE(FEAT_PYTHON)
903 else
904 LIBS=$libs_save_old
905 PYTHON_SRC=
906 PYTHON_OBJ=
907 PYTHON_LIBS=
908 PYTHON_CFLAGS=
909 fi
910
911 fi
912 else
913 AC_MSG_RESULT(too old)
914 fi
915 fi
916fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200917
Bram Moolenaar071d4272004-06-13 20:20:40 +0000918AC_SUBST(PYTHON_CONFDIR)
919AC_SUBST(PYTHON_LIBS)
920AC_SUBST(PYTHON_GETPATH_CFLAGS)
921AC_SUBST(PYTHON_CFLAGS)
922AC_SUBST(PYTHON_SRC)
923AC_SUBST(PYTHON_OBJ)
924
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200925
926AC_MSG_CHECKING(--enable-python3interp argument)
927AC_ARG_ENABLE(python3interp,
928 [ --enable-python3interp Include Python3 interpreter.], ,
929 [enable_python3interp="no"])
930AC_MSG_RESULT($enable_python3interp)
931if test "$enable_python3interp" = "yes"; then
932 dnl -- find the python3 executable
933 AC_PATH_PROG(vi_cv_path_python3, python3)
934 if test "X$vi_cv_path_python3" != "X"; then
935
936 dnl -- get its version number
937 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
938 [[vi_cv_var_python3_version=`
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200939 ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200940 ]])
941
942 dnl -- find where python3 thinks it was installed
943 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
944 [ vi_cv_path_python3_pfx=`
945 ${vi_cv_path_python3} -c \
946 "import sys; print(sys.prefix)"` ])
947
948 dnl -- and where it thinks it runs
949 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
950 [ vi_cv_path_python3_epfx=`
951 ${vi_cv_path_python3} -c \
952 "import sys; print(sys.exec_prefix)"` ])
953
954 dnl -- python3's internal library path
955
956 AC_CACHE_VAL(vi_cv_path_python3path,
957 [ vi_cv_path_python3path=`
958 unset PYTHONPATH;
959 ${vi_cv_path_python3} -c \
960 "import sys, string; print(':'.join(sys.path))"` ])
961
962 dnl -- where the Python implementation library archives are
963
964 AC_ARG_WITH(python3-config-dir,
965 [ --with-python3-config-dir=PATH Python's config directory],
966 [ vi_cv_path_python3_conf="${withval}" ] )
967
968 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
969 [
970 vi_cv_path_python3_conf=
971 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
972 for subdir in lib share; do
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200973 d="${path}/${subdir}/python${vi_cv_var_python3_version}/config"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200974 if test -d "$d" && test -f "$d/config.c"; then
975 vi_cv_path_python3_conf="$d"
976 fi
977 done
978 done
979 ])
980
981 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
982
983 if test "X$PYTHON3_CONFDIR" = "X"; then
984 AC_MSG_RESULT([can't find it!])
985 else
986
987 dnl -- we need to examine Python's config/Makefile too
988 dnl see what the interpreter is built from
989 AC_CACHE_VAL(vi_cv_path_python3_plibs,
990 [
991 pwd=`pwd`
992 tmp_mkf="$pwd/config-PyMake$$"
993 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
994__:
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200995 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200996 @echo "python3_LIBS='$(LIBS)'"
997 @echo "python3_SYSLIBS='$(SYSLIBS)'"
998 @echo "python3_LINKFORSHARED='$(LINKFORSHARED)'"
999eof
1000 dnl -- delete the lines from make about Entering/Leaving directory
1001 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1002 rm -f -- "${tmp_mkf}"
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001003 vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}"
1004 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 +02001005 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1006 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1007 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1008 ])
1009
1010 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
1011 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001012 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001013 else
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001014 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 +02001015 fi
1016 PYTHON3_SRC="if_python3.c"
1017 dnl For Mac OSX 10.2 config.o is included in the Python library.
1018 if test "x$MACOSX" = "xyes"; then
1019 PYTHON3_OBJ="objects/if_python3.o"
1020 else
1021 PYTHON3_OBJ="objects/if_python3.o objects/py3_config.o"
1022 fi
1023
1024 dnl On FreeBSD linking with "-pthread" is required to use threads.
1025 dnl _THREAD_SAFE must be used for compiling then.
1026 dnl The "-pthread" is added to $LIBS, so that the following check for
1027 dnl sigaltstack() will look in libc_r (it's there in libc!).
1028 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1029 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1030 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1031 AC_MSG_CHECKING([if -pthread should be used])
1032 threadsafe_flag=
1033 thread_lib=
1034 dnl if test "x$MACOSX" != "xyes"; then
1035 if test "`(uname) 2>/dev/null`" != Darwin; then
1036 test "$GCC" = yes && threadsafe_flag="-pthread"
1037 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1038 threadsafe_flag="-D_THREAD_SAFE"
1039 thread_lib="-pthread"
1040 fi
1041 fi
1042 libs_save_old=$LIBS
1043 if test -n "$threadsafe_flag"; then
1044 cflags_save=$CFLAGS
1045 CFLAGS="$CFLAGS $threadsafe_flag"
1046 LIBS="$LIBS $thread_lib"
1047 AC_TRY_LINK(,[ ],
1048 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1049 AC_MSG_RESULT(no); LIBS=$libs_save_old
1050 )
1051 CFLAGS=$cflags_save
1052 else
1053 AC_MSG_RESULT(no)
1054 fi
1055
1056 dnl check that compiling a simple program still works with the flags
1057 dnl added for Python.
1058 AC_MSG_CHECKING([if compile and link flags for Python are sane])
1059 cflags_save=$CFLAGS
1060 libs_save=$LIBS
1061 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1062 LIBS="$LIBS $PYTHON3_LIBS"
1063 AC_TRY_LINK(,[ ],
1064 AC_MSG_RESULT(yes); python3_ok=yes,
1065 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1066 CFLAGS=$cflags_save
1067 LIBS=$libs_save
1068 if test "$python3_ok" = yes; then
1069 AC_DEFINE(FEAT_PYTHON3)
1070 else
1071 LIBS=$libs_save_old
1072 PYTHON3_SRC=
1073 PYTHON3_OBJ=
1074 PYTHON3_LIBS=
1075 PYTHON3_CFLAGS=
1076 fi
1077 fi
1078 fi
1079fi
1080
1081AC_SUBST(PYTHON3_CONFDIR)
1082AC_SUBST(PYTHON3_LIBS)
1083AC_SUBST(PYTHON3_CFLAGS)
1084AC_SUBST(PYTHON3_SRC)
1085AC_SUBST(PYTHON3_OBJ)
1086
1087dnl if python2.x and python3.x are enabled one can only link in code
1088dnl with dlopen(), dlsym(), dlclose()
1089if test "$python_ok" = yes && test "$python3_ok" = yes; then
1090 AC_DEFINE(DYNAMIC_PYTHON)
1091 AC_DEFINE(DYNAMIC_PYTHON3)
1092 PYTHON_SRC="if_python.c"
1093 PYTHON_OBJ="objects/if_python.o"
1094 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"libpython${vi_cv_var_python_version}.so\\\""
1095 PYTHON_LIBS=
1096 PYTHON3_SRC="if_python3.c"
1097 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001098 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"libpython${vi_cv_var_python3_version}.so\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001099 PYTHON3_LIBS=
1100fi
1101
Bram Moolenaar071d4272004-06-13 20:20:40 +00001102AC_MSG_CHECKING(--enable-tclinterp argument)
1103AC_ARG_ENABLE(tclinterp,
1104 [ --enable-tclinterp Include Tcl interpreter.], ,
1105 [enable_tclinterp="no"])
1106AC_MSG_RESULT($enable_tclinterp)
1107
1108if test "$enable_tclinterp" = "yes"; then
1109
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001110 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001111 AC_MSG_CHECKING(--with-tclsh argument)
1112 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
1113 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001114 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001115 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1116 AC_SUBST(vi_cv_path_tcl)
1117
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001118 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1119 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1120 tclsh_name="tclsh8.4"
1121 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1122 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001123 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001124 tclsh_name="tclsh8.2"
1125 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1126 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001127 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1128 tclsh_name="tclsh8.0"
1129 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1130 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001131 dnl still didn't find it, try without version number
1132 if test "X$vi_cv_path_tcl" = "X"; then
1133 tclsh_name="tclsh"
1134 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1135 fi
1136 if test "X$vi_cv_path_tcl" != "X"; then
1137 AC_MSG_CHECKING(Tcl version)
1138 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
1139 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1140 AC_MSG_RESULT($tclver - OK);
1141 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 -`
1142
1143 AC_MSG_CHECKING(for location of Tcl include)
1144 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001145 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 +00001146 else
1147 dnl For Mac OS X 10.3, use the OS-provided framework location
1148 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
1149 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001150 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001151 for try in $tclinc; do
1152 if test -f "$try/tcl.h"; then
1153 AC_MSG_RESULT($try/tcl.h)
1154 TCL_INC=$try
1155 break
1156 fi
1157 done
1158 if test -z "$TCL_INC"; then
1159 AC_MSG_RESULT(<not found>)
1160 SKIP_TCL=YES
1161 fi
1162 if test -z "$SKIP_TCL"; then
1163 AC_MSG_CHECKING(for location of tclConfig.sh script)
1164 if test "x$MACOSX" != "xyes"; then
1165 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001166 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001167 else
1168 dnl For Mac OS X 10.3, use the OS-provided framework location
1169 tclcnf="/System/Library/Frameworks/Tcl.framework"
1170 fi
1171 for try in $tclcnf; do
1172 if test -f $try/tclConfig.sh; then
1173 AC_MSG_RESULT($try/tclConfig.sh)
1174 . $try/tclConfig.sh
1175 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
1176 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1177 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001178 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +00001179 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 +00001180 break
1181 fi
1182 done
1183 if test -z "$TCL_LIBS"; then
1184 AC_MSG_RESULT(<not found>)
1185 AC_MSG_CHECKING(for Tcl library by myself)
1186 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001187 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001188 for ext in .so .a ; do
1189 for ver in "" $tclver ; do
1190 for try in $tcllib ; do
1191 trylib=tcl$ver$ext
1192 if test -f $try/lib$trylib ; then
1193 AC_MSG_RESULT($try/lib$trylib)
1194 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
1195 if test "`(uname) 2>/dev/null`" = SunOS &&
1196 uname -r | grep '^5' >/dev/null; then
1197 TCL_LIBS="$TCL_LIBS -R $try"
1198 fi
1199 break 3
1200 fi
1201 done
1202 done
1203 done
1204 if test -z "$TCL_LIBS"; then
1205 AC_MSG_RESULT(<not found>)
1206 SKIP_TCL=YES
1207 fi
1208 fi
1209 if test -z "$SKIP_TCL"; then
1210 AC_DEFINE(FEAT_TCL)
1211 TCL_SRC=if_tcl.c
1212 TCL_OBJ=objects/if_tcl.o
1213 TCL_PRO=if_tcl.pro
1214 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1215 fi
1216 fi
1217 else
1218 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
1219 fi
1220 fi
1221fi
1222AC_SUBST(TCL_SRC)
1223AC_SUBST(TCL_OBJ)
1224AC_SUBST(TCL_PRO)
1225AC_SUBST(TCL_CFLAGS)
1226AC_SUBST(TCL_LIBS)
1227
1228AC_MSG_CHECKING(--enable-rubyinterp argument)
1229AC_ARG_ENABLE(rubyinterp,
1230 [ --enable-rubyinterp Include Ruby interpreter.], ,
1231 [enable_rubyinterp="no"])
1232AC_MSG_RESULT($enable_rubyinterp)
1233if test "$enable_rubyinterp" = "yes"; then
Bram Moolenaar165641d2010-02-17 16:23:09 +01001234 AC_MSG_CHECKING(--with-ruby-command argument)
1235 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
1236 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
1237 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001238 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001239 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001240 if test "X$vi_cv_path_ruby" != "X"; then
1241 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +00001242 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 +00001243 AC_MSG_RESULT(OK)
1244 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001245 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 +00001246 if test "X$rubyhdrdir" != "X"; then
1247 AC_MSG_RESULT($rubyhdrdir)
1248 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01001249 rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
1250 if test -d "$rubyhdrdir/$rubyarch"; then
1251 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
1252 fi
1253 rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
1254 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001255 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
1256 if test "X$rubylibs" != "X"; then
1257 RUBY_LIBS="$rubylibs"
1258 fi
1259 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
1260 if test -f "$rubyhdrdir/$librubyarg"; then
1261 librubyarg="$rubyhdrdir/$librubyarg"
1262 else
1263 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
1264 if test -f "$rubylibdir/$librubyarg"; then
1265 librubyarg="$rubylibdir/$librubyarg"
1266 elif test "$librubyarg" = "libruby.a"; then
1267 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1268 librubyarg="-lruby"
1269 else
1270 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
1271 fi
1272 fi
1273
1274 if test "X$librubyarg" != "X"; then
1275 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1276 fi
1277 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
1278 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001279 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1280 dnl be included if requested by passing --with-mac-arch to
1281 dnl configure, so strip these flags first (if present)
1282 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//'`
1283 if test "X$rubyldflags" != "X"; then
1284 LDFLAGS="$rubyldflags $LDFLAGS"
1285 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001286 fi
1287 RUBY_SRC="if_ruby.c"
1288 RUBY_OBJ="objects/if_ruby.o"
1289 RUBY_PRO="if_ruby.pro"
1290 AC_DEFINE(FEAT_RUBY)
1291 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001292 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001293 fi
1294 else
1295 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1296 fi
1297 fi
1298fi
1299AC_SUBST(RUBY_SRC)
1300AC_SUBST(RUBY_OBJ)
1301AC_SUBST(RUBY_PRO)
1302AC_SUBST(RUBY_CFLAGS)
1303AC_SUBST(RUBY_LIBS)
1304
1305AC_MSG_CHECKING(--enable-cscope argument)
1306AC_ARG_ENABLE(cscope,
1307 [ --enable-cscope Include cscope interface.], ,
1308 [enable_cscope="no"])
1309AC_MSG_RESULT($enable_cscope)
1310if test "$enable_cscope" = "yes"; then
1311 AC_DEFINE(FEAT_CSCOPE)
1312fi
1313
1314AC_MSG_CHECKING(--enable-workshop argument)
1315AC_ARG_ENABLE(workshop,
1316 [ --enable-workshop Include Sun Visual Workshop support.], ,
1317 [enable_workshop="no"])
1318AC_MSG_RESULT($enable_workshop)
1319if test "$enable_workshop" = "yes"; then
1320 AC_DEFINE(FEAT_SUN_WORKSHOP)
1321 WORKSHOP_SRC="workshop.c integration.c"
1322 AC_SUBST(WORKSHOP_SRC)
1323 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1324 AC_SUBST(WORKSHOP_OBJ)
1325 if test "${enable_gui-xxx}" = xxx; then
1326 enable_gui=motif
1327 fi
1328fi
1329
1330AC_MSG_CHECKING(--disable-netbeans argument)
1331AC_ARG_ENABLE(netbeans,
1332 [ --disable-netbeans Disable NetBeans integration support.],
1333 , [enable_netbeans="yes"])
1334if test "$enable_netbeans" = "yes"; then
1335 AC_MSG_RESULT(no)
1336 dnl On Solaris we need the socket and nsl library.
1337 AC_CHECK_LIB(socket, socket)
1338 AC_CHECK_LIB(nsl, gethostbyname)
1339 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1340 AC_TRY_LINK([
1341#include <stdio.h>
1342#include <stdlib.h>
1343#include <stdarg.h>
1344#include <fcntl.h>
1345#include <netdb.h>
1346#include <netinet/in.h>
1347#include <errno.h>
1348#include <sys/types.h>
1349#include <sys/socket.h>
1350 /* Check bitfields */
1351 struct nbbuf {
1352 unsigned int initDone:1;
1353 ushort signmaplen;
1354 };
1355 ], [
1356 /* Check creating a socket. */
1357 struct sockaddr_in server;
1358 (void)socket(AF_INET, SOCK_STREAM, 0);
1359 (void)htons(100);
1360 (void)gethostbyname("microsoft.com");
1361 if (errno == ECONNREFUSED)
1362 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1363 ],
1364 AC_MSG_RESULT(yes),
1365 AC_MSG_RESULT(no); enable_netbeans="no")
1366else
1367 AC_MSG_RESULT(yes)
1368fi
1369if test "$enable_netbeans" = "yes"; then
1370 AC_DEFINE(FEAT_NETBEANS_INTG)
1371 NETBEANS_SRC="netbeans.c"
1372 AC_SUBST(NETBEANS_SRC)
1373 NETBEANS_OBJ="objects/netbeans.o"
1374 AC_SUBST(NETBEANS_OBJ)
1375fi
1376
1377AC_MSG_CHECKING(--enable-sniff argument)
1378AC_ARG_ENABLE(sniff,
1379 [ --enable-sniff Include Sniff interface.], ,
1380 [enable_sniff="no"])
1381AC_MSG_RESULT($enable_sniff)
1382if test "$enable_sniff" = "yes"; then
1383 AC_DEFINE(FEAT_SNIFF)
1384 SNIFF_SRC="if_sniff.c"
1385 AC_SUBST(SNIFF_SRC)
1386 SNIFF_OBJ="objects/if_sniff.o"
1387 AC_SUBST(SNIFF_OBJ)
1388fi
1389
1390AC_MSG_CHECKING(--enable-multibyte argument)
1391AC_ARG_ENABLE(multibyte,
1392 [ --enable-multibyte Include multibyte editing support.], ,
1393 [enable_multibyte="no"])
1394AC_MSG_RESULT($enable_multibyte)
1395if test "$enable_multibyte" = "yes"; then
1396 AC_DEFINE(FEAT_MBYTE)
1397fi
1398
1399AC_MSG_CHECKING(--enable-hangulinput argument)
1400AC_ARG_ENABLE(hangulinput,
1401 [ --enable-hangulinput Include Hangul input support.], ,
1402 [enable_hangulinput="no"])
1403AC_MSG_RESULT($enable_hangulinput)
1404
1405AC_MSG_CHECKING(--enable-xim argument)
1406AC_ARG_ENABLE(xim,
1407 [ --enable-xim Include XIM input support.],
1408 AC_MSG_RESULT($enable_xim),
1409 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001410
1411AC_MSG_CHECKING(--enable-fontset argument)
1412AC_ARG_ENABLE(fontset,
1413 [ --enable-fontset Include X fontset output support.], ,
1414 [enable_fontset="no"])
1415AC_MSG_RESULT($enable_fontset)
1416dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1417
1418test -z "$with_x" && with_x=yes
1419test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1420if test "$with_x" = no; then
1421 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1422else
1423 dnl Do this check early, so that its failure can override user requests.
1424
1425 AC_PATH_PROG(xmkmfpath, xmkmf)
1426
1427 AC_PATH_XTRA
1428
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001429 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001430 dnl be compiled with a special option.
1431 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001432 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001433 CFLAGS="$CFLAGS -W c,dll"
1434 LDFLAGS="$LDFLAGS -W l,dll"
1435 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1436 fi
1437
1438 dnl On my HPUX system the X include dir is found, but the lib dir not.
1439 dnl This is a desparate try to fix this.
1440
1441 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1442 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1443 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1444 X_LIBS="$X_LIBS -L$x_libraries"
1445 if test "`(uname) 2>/dev/null`" = SunOS &&
1446 uname -r | grep '^5' >/dev/null; then
1447 X_LIBS="$X_LIBS -R $x_libraries"
1448 fi
1449 fi
1450
1451 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1452 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1453 AC_MSG_RESULT(Corrected X includes to $x_includes)
1454 X_CFLAGS="$X_CFLAGS -I$x_includes"
1455 fi
1456
1457 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1458 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1459 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1460 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1461 dnl Same for "-R/usr/lib ".
1462 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1463
1464
1465 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001466 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1467 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001468 AC_MSG_CHECKING(if X11 header files can be found)
1469 cflags_save=$CFLAGS
1470 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001471 AC_TRY_COMPILE([#include <X11/Xlib.h>
1472#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001473 AC_MSG_RESULT(yes),
1474 AC_MSG_RESULT(no); no_x=yes)
1475 CFLAGS=$cflags_save
1476
1477 if test "${no_x-no}" = yes; then
1478 with_x=no
1479 else
1480 AC_DEFINE(HAVE_X11)
1481 X_LIB="-lXt -lX11";
1482 AC_SUBST(X_LIB)
1483
1484 ac_save_LDFLAGS="$LDFLAGS"
1485 LDFLAGS="-L$x_libraries $LDFLAGS"
1486
1487 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1488 dnl For HP-UX 10.20 it must be before -lSM -lICE
1489 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1490 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1491
1492 dnl Some systems need -lnsl -lsocket when testing for ICE.
1493 dnl The check above doesn't do this, try here (again). Also needed to get
1494 dnl them after Xdmcp. link.sh will remove them when not needed.
1495 dnl Check for other function than above to avoid the cached value
1496 AC_CHECK_LIB(ICE, IceOpenConnection,
1497 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1498
1499 dnl Check for -lXpm (needed for some versions of Motif)
1500 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1501 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1502 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1503
1504 dnl Check that the X11 header files don't use implicit declarations
1505 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1506 cflags_save=$CFLAGS
1507 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1508 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1509 AC_MSG_RESULT(no),
1510 CFLAGS="$CFLAGS -Wno-implicit-int"
1511 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1512 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1513 AC_MSG_RESULT(test failed)
1514 )
1515 )
1516 CFLAGS=$cflags_save
1517
1518 LDFLAGS="$ac_save_LDFLAGS"
1519
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001520 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1521 AC_CACHE_VAL(ac_cv_small_wchar_t,
1522 [AC_TRY_RUN([
1523#include <X11/Xlib.h>
1524#if STDC_HEADERS
1525# include <stdlib.h>
1526# include <stddef.h>
1527#endif
1528 main()
1529 {
1530 if (sizeof(wchar_t) <= 2)
1531 exit(1);
1532 exit(0);
1533 }],
1534 ac_cv_small_wchar_t="no",
1535 ac_cv_small_wchar_t="yes",
1536 AC_MSG_ERROR(failed to compile test program))])
1537 AC_MSG_RESULT($ac_cv_small_wchar_t)
1538 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1539 AC_DEFINE(SMALL_WCHAR_T)
1540 fi
1541
Bram Moolenaar071d4272004-06-13 20:20:40 +00001542 fi
1543fi
1544
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001545test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001546
1547AC_MSG_CHECKING(--enable-gui argument)
1548AC_ARG_ENABLE(gui,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001549 [ --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 +00001550
1551dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1552dnl Do not use character classes for portability with old tools.
1553enable_gui_canon=`echo "_$enable_gui" | \
1554 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1555
1556dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001557SKIP_GTK2=YES
1558SKIP_GNOME=YES
1559SKIP_MOTIF=YES
1560SKIP_ATHENA=YES
1561SKIP_NEXTAW=YES
1562SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001563SKIP_CARBON=YES
1564GUITYPE=NONE
1565
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001566if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001567 SKIP_PHOTON=
1568 case "$enable_gui_canon" in
1569 no) AC_MSG_RESULT(no GUI support)
1570 SKIP_PHOTON=YES ;;
1571 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1572 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1573 photon) AC_MSG_RESULT(Photon GUI support) ;;
1574 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1575 SKIP_PHOTON=YES ;;
1576 esac
1577
1578elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1579 SKIP_CARBON=
1580 case "$enable_gui_canon" in
1581 no) AC_MSG_RESULT(no GUI support)
1582 SKIP_CARBON=YES ;;
1583 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
Bram Moolenaar164fca32010-07-14 13:58:07 +02001584 auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
1585 SKIP_CARBON=YES ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001586 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1587 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1588 SKIP_CARBON=YES ;;
1589 esac
1590
1591else
1592
Bram Moolenaar071d4272004-06-13 20:20:40 +00001593 case "$enable_gui_canon" in
1594 no|none) AC_MSG_RESULT(no GUI support) ;;
1595 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001596 SKIP_GTK2=
1597 SKIP_GNOME=
1598 SKIP_MOTIF=
1599 SKIP_ATHENA=
1600 SKIP_NEXTAW=
1601 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001602 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001603 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001604 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1605 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001606 SKIP_GTK2=;;
1607 motif) AC_MSG_RESULT(Motif GUI support)
1608 SKIP_MOTIF=;;
1609 athena) AC_MSG_RESULT(Athena GUI support)
1610 SKIP_ATHENA=;;
1611 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1612 SKIP_NEXTAW=;;
1613 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1614 esac
1615
1616fi
1617
Bram Moolenaar071d4272004-06-13 20:20:40 +00001618if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1619 -a "$enable_gui_canon" != "gnome2"; then
1620 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1621 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001622 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001623 , enable_gtk2_check="yes")
1624 AC_MSG_RESULT($enable_gtk2_check)
1625 if test "x$enable_gtk2_check" = "xno"; then
1626 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001627 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001628 fi
1629fi
1630
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001631if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001632 AC_MSG_CHECKING(whether or not to look for GNOME)
1633 AC_ARG_ENABLE(gnome-check,
1634 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1635 , enable_gnome_check="no")
1636 AC_MSG_RESULT($enable_gnome_check)
1637 if test "x$enable_gnome_check" = "xno"; then
1638 SKIP_GNOME=YES
1639 fi
1640fi
1641
1642if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1643 AC_MSG_CHECKING(whether or not to look for Motif)
1644 AC_ARG_ENABLE(motif-check,
1645 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1646 , enable_motif_check="yes")
1647 AC_MSG_RESULT($enable_motif_check)
1648 if test "x$enable_motif_check" = "xno"; then
1649 SKIP_MOTIF=YES
1650 fi
1651fi
1652
1653if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1654 AC_MSG_CHECKING(whether or not to look for Athena)
1655 AC_ARG_ENABLE(athena-check,
1656 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1657 , enable_athena_check="yes")
1658 AC_MSG_RESULT($enable_athena_check)
1659 if test "x$enable_athena_check" = "xno"; then
1660 SKIP_ATHENA=YES
1661 fi
1662fi
1663
1664if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1665 AC_MSG_CHECKING(whether or not to look for neXtaw)
1666 AC_ARG_ENABLE(nextaw-check,
1667 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1668 , enable_nextaw_check="yes")
1669 AC_MSG_RESULT($enable_nextaw_check);
1670 if test "x$enable_nextaw_check" = "xno"; then
1671 SKIP_NEXTAW=YES
1672 fi
1673fi
1674
1675if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1676 AC_MSG_CHECKING(whether or not to look for Carbon)
1677 AC_ARG_ENABLE(carbon-check,
1678 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1679 , enable_carbon_check="yes")
1680 AC_MSG_RESULT($enable_carbon_check);
1681 if test "x$enable_carbon_check" = "xno"; then
1682 SKIP_CARBON=YES
1683 fi
1684fi
1685
Bram Moolenaar843ee412004-06-30 16:16:41 +00001686
Bram Moolenaar071d4272004-06-13 20:20:40 +00001687if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1688 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001689 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001690 AC_MSG_RESULT(yes);
1691 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001692 if test "$VIMNAME" = "vim"; then
1693 VIMNAME=Vim
1694 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001695
Bram Moolenaar164fca32010-07-14 13:58:07 +02001696 if test "x$MACARCH" = "xboth"; then
1697 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
1698 else
1699 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
1700 fi
1701
Bram Moolenaar14716812006-05-04 21:54:08 +00001702 dnl Default install directory is not /usr/local
1703 if test x$prefix = xNONE; then
1704 prefix=/Applications
1705 fi
1706
1707 dnl Sorry for the hard coded default
1708 datadir='${prefix}/Vim.app/Contents/Resources'
1709
Bram Moolenaar071d4272004-06-13 20:20:40 +00001710 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001711 SKIP_GTK2=YES;
1712 SKIP_GNOME=YES;
1713 SKIP_MOTIF=YES;
1714 SKIP_ATHENA=YES;
1715 SKIP_NEXTAW=YES;
1716 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001717 SKIP_CARBON=YES
1718fi
1719
Bram Moolenaar071d4272004-06-13 20:20:40 +00001720dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001721dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001722dnl
1723dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001724dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001725dnl
1726AC_DEFUN(AM_PATH_GTK,
1727[
1728 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1729 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001730 min_gtk_version=ifelse([$1], ,2.2.0,$1)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001731 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1732 no_gtk=""
1733 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1734 && $PKG_CONFIG --exists gtk+-2.0; then
1735 {
1736 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1737 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1738 dnl something like that.
1739 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001740 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001741 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1742 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1743 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1744 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1745 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1746 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1747 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1748 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001749 else
1750 no_gtk=yes
1751 fi
1752
1753 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1754 {
1755 ac_save_CFLAGS="$CFLAGS"
1756 ac_save_LIBS="$LIBS"
1757 CFLAGS="$CFLAGS $GTK_CFLAGS"
1758 LIBS="$LIBS $GTK_LIBS"
1759
1760 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001761 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001762 dnl
1763 rm -f conf.gtktest
1764 AC_TRY_RUN([
1765#include <gtk/gtk.h>
1766#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001767#if STDC_HEADERS
1768# include <stdlib.h>
1769# include <stddef.h>
1770#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001771
1772int
1773main ()
1774{
1775int major, minor, micro;
1776char *tmp_version;
1777
1778system ("touch conf.gtktest");
1779
1780/* HP/UX 9 (%@#!) writes to sscanf strings */
1781tmp_version = g_strdup("$min_gtk_version");
1782if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1783 printf("%s, bad version string\n", "$min_gtk_version");
1784 exit(1);
1785 }
1786
1787if ((gtk_major_version > major) ||
1788 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1789 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1790 (gtk_micro_version >= micro)))
1791{
1792 return 0;
1793}
1794return 1;
1795}
1796],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1797 CFLAGS="$ac_save_CFLAGS"
1798 LIBS="$ac_save_LIBS"
1799 }
1800 fi
1801 if test "x$no_gtk" = x ; then
1802 if test "x$enable_gtktest" = "xyes"; then
1803 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1804 else
1805 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1806 fi
1807 ifelse([$2], , :, [$2])
1808 else
1809 {
1810 AC_MSG_RESULT(no)
1811 GTK_CFLAGS=""
1812 GTK_LIBS=""
1813 ifelse([$3], , :, [$3])
1814 }
1815 fi
1816 }
1817 else
1818 GTK_CFLAGS=""
1819 GTK_LIBS=""
1820 ifelse([$3], , :, [$3])
1821 fi
1822 AC_SUBST(GTK_CFLAGS)
1823 AC_SUBST(GTK_LIBS)
1824 rm -f conf.gtktest
1825])
1826
1827dnl ---------------------------------------------------------------------------
1828dnl gnome
1829dnl ---------------------------------------------------------------------------
1830AC_DEFUN([GNOME_INIT_HOOK],
1831[
1832 AC_SUBST(GNOME_LIBS)
1833 AC_SUBST(GNOME_LIBDIR)
1834 AC_SUBST(GNOME_INCLUDEDIR)
1835
1836 AC_ARG_WITH(gnome-includes,
1837 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1838 [CFLAGS="$CFLAGS -I$withval"]
1839 )
1840
1841 AC_ARG_WITH(gnome-libs,
1842 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1843 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1844 )
1845
1846 AC_ARG_WITH(gnome,
1847 [ --with-gnome Specify prefix for GNOME files],
1848 if test x$withval = xyes; then
1849 want_gnome=yes
1850 ifelse([$1], [], :, [$1])
1851 else
1852 if test "x$withval" = xno; then
1853 want_gnome=no
1854 else
1855 want_gnome=yes
1856 LDFLAGS="$LDFLAGS -L$withval/lib"
1857 CFLAGS="$CFLAGS -I$withval/include"
1858 gnome_prefix=$withval/lib
1859 fi
1860 fi,
1861 want_gnome=yes)
1862
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001863 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001864 {
1865 AC_MSG_CHECKING(for libgnomeui-2.0)
1866 if $PKG_CONFIG --exists libgnomeui-2.0; then
1867 AC_MSG_RESULT(yes)
1868 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1869 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1870 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001871
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001872 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1873 dnl This might not be the right way but it works for me...
1874 AC_MSG_CHECKING(for FreeBSD)
1875 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1876 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001877 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001878 GNOME_LIBS="$GNOME_LIBS -pthread"
1879 else
1880 AC_MSG_RESULT(no)
1881 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001882 $1
1883 else
1884 AC_MSG_RESULT(not found)
1885 if test "x$2" = xfail; then
1886 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1887 fi
1888 fi
1889 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001890 fi
1891])
1892
1893AC_DEFUN([GNOME_INIT],[
1894 GNOME_INIT_HOOK([],fail)
1895])
1896
1897
1898dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001899dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001900dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001901if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001902
1903 AC_MSG_CHECKING(--disable-gtktest argument)
1904 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1905 , enable_gtktest=yes)
1906 if test "x$enable_gtktest" = "xyes" ; then
1907 AC_MSG_RESULT(gtk test enabled)
1908 else
1909 AC_MSG_RESULT(gtk test disabled)
1910 fi
1911
Bram Moolenaar071d4272004-06-13 20:20:40 +00001912 if test "X$PKG_CONFIG" = "X"; then
1913 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1914 fi
1915
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001916 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001917 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1918 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001919 AM_PATH_GTK(2.2.0,
1920 [GUI_LIB_LOC="$GTK_LIBDIR"
1921 GTK_LIBNAME="$GTK_LIBS"
1922 GUI_INC_LOC="$GTK_CFLAGS"], )
1923 if test "x$GTK_CFLAGS" != "x"; then
1924 SKIP_ATHENA=YES
1925 SKIP_NEXTAW=YES
1926 SKIP_MOTIF=YES
1927 GUITYPE=GTK
1928 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001929 fi
1930 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001931 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001932 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1933 || test "0$gtk_minor_version" -ge 2; then
1934 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1935 fi
1936 dnl
1937 dnl if GTK exists, then check for GNOME.
1938 dnl
1939 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001940 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001941 GNOME_INIT_HOOK([have_gnome=yes])
1942 if test "x$have_gnome" = xyes ; then
1943 AC_DEFINE(FEAT_GUI_GNOME)
1944 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1945 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001946 fi
1947 }
1948 fi
1949 fi
1950fi
1951
1952dnl Check for Motif include files location.
1953dnl The LAST one found is used, this makes the highest version to be used,
1954dnl e.g. when Motif1.2 and Motif2.0 are both present.
1955
1956if test -z "$SKIP_MOTIF"; then
1957 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"
1958 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1959 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1960
1961 AC_MSG_CHECKING(for location of Motif GUI includes)
1962 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1963 GUI_INC_LOC=
1964 for try in $gui_includes; do
1965 if test -f "$try/Xm/Xm.h"; then
1966 GUI_INC_LOC=$try
1967 fi
1968 done
1969 if test -n "$GUI_INC_LOC"; then
1970 if test "$GUI_INC_LOC" = /usr/include; then
1971 GUI_INC_LOC=
1972 AC_MSG_RESULT(in default path)
1973 else
1974 AC_MSG_RESULT($GUI_INC_LOC)
1975 fi
1976 else
1977 AC_MSG_RESULT(<not found>)
1978 SKIP_MOTIF=YES
1979 fi
1980fi
1981
1982dnl Check for Motif library files location. In the same order as the include
1983dnl files, to avoid a mixup if several versions are present
1984
1985if test -z "$SKIP_MOTIF"; then
1986 AC_MSG_CHECKING(--with-motif-lib argument)
1987 AC_ARG_WITH(motif-lib,
1988 [ --with-motif-lib=STRING Library for Motif ],
1989 [ MOTIF_LIBNAME="${withval}" ] )
1990
1991 if test -n "$MOTIF_LIBNAME"; then
1992 AC_MSG_RESULT($MOTIF_LIBNAME)
1993 GUI_LIB_LOC=
1994 else
1995 AC_MSG_RESULT(no)
1996
1997 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1998 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1999
2000 AC_MSG_CHECKING(for location of Motif GUI libs)
2001 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"
2002 GUI_LIB_LOC=
2003 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00002004 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00002005 if test -f "$libtry"; then
2006 GUI_LIB_LOC=$try
2007 fi
2008 done
2009 done
2010 if test -n "$GUI_LIB_LOC"; then
2011 dnl Remove /usr/lib, it causes trouble on some systems
2012 if test "$GUI_LIB_LOC" = /usr/lib; then
2013 GUI_LIB_LOC=
2014 AC_MSG_RESULT(in default path)
2015 else
2016 if test -n "$GUI_LIB_LOC"; then
2017 AC_MSG_RESULT($GUI_LIB_LOC)
2018 if test "`(uname) 2>/dev/null`" = SunOS &&
2019 uname -r | grep '^5' >/dev/null; then
2020 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
2021 fi
2022 fi
2023 fi
2024 MOTIF_LIBNAME=-lXm
2025 else
2026 AC_MSG_RESULT(<not found>)
2027 SKIP_MOTIF=YES
2028 fi
2029 fi
2030fi
2031
2032if test -z "$SKIP_MOTIF"; then
2033 SKIP_ATHENA=YES
2034 SKIP_NEXTAW=YES
2035 GUITYPE=MOTIF
2036 AC_SUBST(MOTIF_LIBNAME)
2037fi
2038
2039dnl Check if the Athena files can be found
2040
2041GUI_X_LIBS=
2042
2043if test -z "$SKIP_ATHENA"; then
2044 AC_MSG_CHECKING(if Athena header files can be found)
2045 cflags_save=$CFLAGS
2046 CFLAGS="$CFLAGS $X_CFLAGS"
2047 AC_TRY_COMPILE([
2048#include <X11/Intrinsic.h>
2049#include <X11/Xaw/Paned.h>], ,
2050 AC_MSG_RESULT(yes),
2051 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
2052 CFLAGS=$cflags_save
2053fi
2054
2055if test -z "$SKIP_ATHENA"; then
2056 GUITYPE=ATHENA
2057fi
2058
2059if test -z "$SKIP_NEXTAW"; then
2060 AC_MSG_CHECKING(if neXtaw header files can be found)
2061 cflags_save=$CFLAGS
2062 CFLAGS="$CFLAGS $X_CFLAGS"
2063 AC_TRY_COMPILE([
2064#include <X11/Intrinsic.h>
2065#include <X11/neXtaw/Paned.h>], ,
2066 AC_MSG_RESULT(yes),
2067 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
2068 CFLAGS=$cflags_save
2069fi
2070
2071if test -z "$SKIP_NEXTAW"; then
2072 GUITYPE=NEXTAW
2073fi
2074
2075if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2076 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
2077 dnl Avoid adding it when it twice
2078 if test -n "$GUI_INC_LOC"; then
2079 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
2080 fi
2081 if test -n "$GUI_LIB_LOC"; then
2082 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
2083 fi
2084
2085 dnl Check for -lXext and then for -lXmu
2086 ldflags_save=$LDFLAGS
2087 LDFLAGS="$X_LIBS $LDFLAGS"
2088 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
2089 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2090 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
2091 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
2092 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2093 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
2094 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2095 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
2096 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2097 if test -z "$SKIP_MOTIF"; then
2098 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
2099 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2100 fi
2101 LDFLAGS=$ldflags_save
2102
2103 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
2104 AC_MSG_CHECKING(for extra X11 defines)
2105 NARROW_PROTO=
2106 rm -fr conftestdir
2107 if mkdir conftestdir; then
2108 cd conftestdir
2109 cat > Imakefile <<'EOF'
2110acfindx:
2111 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
2112EOF
2113 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2114 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
2115 fi
2116 cd ..
2117 rm -fr conftestdir
2118 fi
2119 if test -z "$NARROW_PROTO"; then
2120 AC_MSG_RESULT(no)
2121 else
2122 AC_MSG_RESULT($NARROW_PROTO)
2123 fi
2124 AC_SUBST(NARROW_PROTO)
2125fi
2126
2127dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
2128dnl use the X11 include path
2129if test "$enable_xsmp" = "yes"; then
2130 cppflags_save=$CPPFLAGS
2131 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2132 AC_CHECK_HEADERS(X11/SM/SMlib.h)
2133 CPPFLAGS=$cppflags_save
2134fi
2135
2136
Bram Moolenaare667c952010-07-05 22:57:59 +02002137if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002138 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
2139 cppflags_save=$CPPFLAGS
2140 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2141 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
2142
2143 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
2144 if test ! "$enable_xim" = "no"; then
2145 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
2146 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
2147 AC_MSG_RESULT(yes),
2148 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
2149 fi
2150 CPPFLAGS=$cppflags_save
2151
2152 dnl automatically enable XIM when hangul input isn't enabled
2153 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
2154 -a "x$GUITYPE" != "xNONE" ; then
2155 AC_MSG_RESULT(X GUI selected; xim has been enabled)
2156 enable_xim="yes"
2157 fi
2158fi
2159
2160if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2161 cppflags_save=$CPPFLAGS
2162 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002163dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
2164 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
2165 AC_TRY_COMPILE([
2166#include <X11/Intrinsic.h>
2167#include <X11/Xmu/Editres.h>],
2168 [int i; i = 0;],
2169 AC_MSG_RESULT(yes)
2170 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
2171 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00002172 CPPFLAGS=$cppflags_save
2173fi
2174
2175dnl Only use the Xm directory when compiling Motif, don't use it for Athena
2176if test -z "$SKIP_MOTIF"; then
2177 cppflags_save=$CPPFLAGS
2178 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002179 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 +00002180 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002181
2182 if test $ac_cv_header_Xm_XpmP_h = yes; then
2183 dnl Solaris uses XpmAttributes_21, very annoying.
2184 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
2185 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
2186 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
2187 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2188 )
2189 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00002190 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002191 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002192 CPPFLAGS=$cppflags_save
2193fi
2194
2195if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
2196 AC_MSG_RESULT(no GUI selected; xim has been disabled)
2197 enable_xim="no"
2198fi
2199if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
2200 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
2201 enable_fontset="no"
2202fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002203if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002204 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
2205 enable_fontset="no"
2206fi
2207
Bram Moolenaar071d4272004-06-13 20:20:40 +00002208if test -z "$SKIP_PHOTON"; then
2209 GUITYPE=PHOTONGUI
2210fi
2211
2212AC_SUBST(GUI_INC_LOC)
2213AC_SUBST(GUI_LIB_LOC)
2214AC_SUBST(GUITYPE)
2215AC_SUBST(GUI_X_LIBS)
2216
2217if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2218 AC_MSG_ERROR([cannot use workshop without Motif])
2219fi
2220
2221dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2222if test "$enable_xim" = "yes"; then
2223 AC_DEFINE(FEAT_XIM)
2224fi
2225if test "$enable_fontset" = "yes"; then
2226 AC_DEFINE(FEAT_XFONTSET)
2227fi
2228
2229
2230dnl ---------------------------------------------------------------------------
2231dnl end of GUI-checking
2232dnl ---------------------------------------------------------------------------
2233
2234
2235dnl Only really enable hangul input when GUI and XFONTSET are available
2236if test "$enable_hangulinput" = "yes"; then
2237 if test "x$GUITYPE" = "xNONE"; then
2238 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2239 enable_hangulinput=no
2240 else
2241 AC_DEFINE(FEAT_HANGULIN)
2242 HANGULIN_SRC=hangulin.c
2243 AC_SUBST(HANGULIN_SRC)
2244 HANGULIN_OBJ=objects/hangulin.o
2245 AC_SUBST(HANGULIN_OBJ)
2246 fi
2247fi
2248
2249dnl Checks for libraries and include files.
2250
Bram Moolenaar446cb832008-06-24 21:56:24 +00002251AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
2252 [
2253 AC_RUN_IFELSE([[
2254#include "confdefs.h"
2255#include <ctype.h>
2256#if STDC_HEADERS
2257# include <stdlib.h>
2258# include <stddef.h>
2259#endif
2260main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2261 ]],[
2262 vim_cv_toupper_broken=yes
2263 ],[
2264 vim_cv_toupper_broken=no
2265 ],[
2266 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2267 ])])
2268
2269if test "x$vim_cv_toupper_broken" = "xyes" ; then
2270 AC_DEFINE(BROKEN_TOUPPER)
2271fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002272
2273AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002274AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002275 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2276 AC_MSG_RESULT(no))
2277
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002278AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2279AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2280 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2281 AC_MSG_RESULT(no))
2282
Bram Moolenaar071d4272004-06-13 20:20:40 +00002283dnl Checks for header files.
2284AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2285dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2286if test "$HAS_ELF" = 1; then
2287 AC_CHECK_LIB(elf, main)
2288fi
2289
2290AC_HEADER_DIRENT
2291
Bram Moolenaar071d4272004-06-13 20:20:40 +00002292dnl If sys/wait.h is not found it might still exist but not be POSIX
2293dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2294if test $ac_cv_header_sys_wait_h = no; then
2295 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2296 AC_TRY_COMPILE([#include <sys/wait.h>],
2297 [union wait xx, yy; xx = yy],
2298 AC_MSG_RESULT(yes)
2299 AC_DEFINE(HAVE_SYS_WAIT_H)
2300 AC_DEFINE(HAVE_UNION_WAIT),
2301 AC_MSG_RESULT(no))
2302fi
2303
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002304AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2305 sys/select.h sys/utsname.h termcap.h fcntl.h \
2306 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2307 termio.h iconv.h inttypes.h langinfo.h math.h \
2308 unistd.h stropts.h errno.h sys/resource.h \
2309 sys/systeminfo.h locale.h sys/stream.h termios.h \
2310 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2311 utime.h sys/param.h libintl.h libgen.h \
2312 util/debug.h util/msg18n.h frame.h sys/acl.h \
2313 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002314
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002315dnl sys/ptem.h depends on sys/stream.h on Solaris
2316AC_CHECK_HEADERS(sys/ptem.h, [], [],
2317[#if defined HAVE_SYS_STREAM_H
2318# include <sys/stream.h>
2319#endif])
2320
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002321dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2322AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2323[#if defined HAVE_SYS_PARAM_H
2324# include <sys/param.h>
2325#endif])
2326
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002327
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002328dnl pthread_np.h may exist but can only be used after including pthread.h
2329AC_MSG_CHECKING([for pthread_np.h])
2330AC_TRY_COMPILE([
2331#include <pthread.h>
2332#include <pthread_np.h>],
2333 [int i; i = 0;],
2334 AC_MSG_RESULT(yes)
2335 AC_DEFINE(HAVE_PTHREAD_NP_H),
2336 AC_MSG_RESULT(no))
2337
Bram Moolenaare344bea2005-09-01 20:46:49 +00002338AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002339if test "x$MACOSX" = "xyes"; then
2340 dnl The strings.h file on OS/X contains a warning and nothing useful.
2341 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2342else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002343
2344dnl Check if strings.h and string.h can both be included when defined.
2345AC_MSG_CHECKING([if strings.h can be included after string.h])
2346cppflags_save=$CPPFLAGS
2347CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2348AC_TRY_COMPILE([
2349#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2350# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2351 /* but don't do it on AIX 5.1 (Uribarri) */
2352#endif
2353#ifdef HAVE_XM_XM_H
2354# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2355#endif
2356#ifdef HAVE_STRING_H
2357# include <string.h>
2358#endif
2359#if defined(HAVE_STRINGS_H)
2360# include <strings.h>
2361#endif
2362 ], [int i; i = 0;],
2363 AC_MSG_RESULT(yes),
2364 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2365 AC_MSG_RESULT(no))
2366CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002367fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002368
2369dnl Checks for typedefs, structures, and compiler characteristics.
2370AC_PROG_GCC_TRADITIONAL
2371AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002372AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002373AC_TYPE_MODE_T
2374AC_TYPE_OFF_T
2375AC_TYPE_PID_T
2376AC_TYPE_SIZE_T
2377AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002378AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002379
Bram Moolenaar071d4272004-06-13 20:20:40 +00002380AC_HEADER_TIME
2381AC_CHECK_TYPE(ino_t, long)
2382AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002383AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002384
2385AC_MSG_CHECKING(for rlim_t)
2386if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2387 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2388else
2389 AC_EGREP_CPP(dnl
2390changequote(<<,>>)dnl
2391<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2392changequote([,]),
2393 [
2394#include <sys/types.h>
2395#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002396# include <stdlib.h>
2397# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002398#endif
2399#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002400# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002401#endif
2402 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2403 AC_MSG_RESULT($ac_cv_type_rlim_t)
2404fi
2405if test $ac_cv_type_rlim_t = no; then
2406 cat >> confdefs.h <<\EOF
2407#define rlim_t unsigned long
2408EOF
2409fi
2410
2411AC_MSG_CHECKING(for stack_t)
2412if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2413 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2414else
2415 AC_EGREP_CPP(stack_t,
2416 [
2417#include <sys/types.h>
2418#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002419# include <stdlib.h>
2420# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002421#endif
2422#include <signal.h>
2423 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2424 AC_MSG_RESULT($ac_cv_type_stack_t)
2425fi
2426if test $ac_cv_type_stack_t = no; then
2427 cat >> confdefs.h <<\EOF
2428#define stack_t struct sigaltstack
2429EOF
2430fi
2431
2432dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2433AC_MSG_CHECKING(whether stack_t has an ss_base field)
2434AC_TRY_COMPILE([
2435#include <sys/types.h>
2436#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002437# include <stdlib.h>
2438# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002439#endif
2440#include <signal.h>
2441#include "confdefs.h"
2442 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2443 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2444 AC_MSG_RESULT(no))
2445
2446olibs="$LIBS"
2447AC_MSG_CHECKING(--with-tlib argument)
2448AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2449if test -n "$with_tlib"; then
2450 AC_MSG_RESULT($with_tlib)
2451 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002452 AC_MSG_CHECKING(for linking with $with_tlib library)
2453 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2454 dnl Need to check for tgetent() below.
2455 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002456else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002457 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002458 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2459 dnl curses, because curses is much slower.
2460 dnl Newer versions of ncurses are preferred over anything.
2461 dnl Older versions of ncurses have bugs, get a new one!
2462 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002463 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002464 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002465 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002466 *) tlibs="ncurses termlib termcap curses";;
2467 esac
2468 for libname in $tlibs; do
2469 AC_CHECK_LIB(${libname}, tgetent,,)
2470 if test "x$olibs" != "x$LIBS"; then
2471 dnl It's possible that a library is found but it doesn't work
2472 dnl e.g., shared library that cannot be found
2473 dnl compile and run a test program to be sure
2474 AC_TRY_RUN([
2475#ifdef HAVE_TERMCAP_H
2476# include <termcap.h>
2477#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002478#if STDC_HEADERS
2479# include <stdlib.h>
2480# include <stddef.h>
2481#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002482main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2483 res="OK", res="FAIL", res="FAIL")
2484 if test "$res" = "OK"; then
2485 break
2486 fi
2487 AC_MSG_RESULT($libname library is not usable)
2488 LIBS="$olibs"
2489 fi
2490 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002491 if test "x$olibs" = "x$LIBS"; then
2492 AC_MSG_RESULT(no terminal library found)
2493 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002494fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002495
2496if test "x$olibs" = "x$LIBS"; then
2497 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002498 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002499 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2500 AC_MSG_RESULT(yes),
2501 AC_MSG_ERROR([NOT FOUND!
2502 You need to install a terminal library; for example ncurses.
2503 Or specify the name of the library with --with-tlib.]))
2504fi
2505
Bram Moolenaar446cb832008-06-24 21:56:24 +00002506AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2507 [
2508 AC_RUN_IFELSE([[
2509#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002510#ifdef HAVE_TERMCAP_H
2511# include <termcap.h>
2512#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002513#ifdef HAVE_STRING_H
2514# include <string.h>
2515#endif
2516#if STDC_HEADERS
2517# include <stdlib.h>
2518# include <stddef.h>
2519#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002520main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002521{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2522 ]],[
2523 vim_cv_terminfo=no
2524 ],[
2525 vim_cv_terminfo=yes
2526 ],[
2527 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2528 ])
2529 ])
2530
2531if test "x$vim_cv_terminfo" = "xyes" ; then
2532 AC_DEFINE(TERMINFO)
2533fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002534
2535if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002536 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2537 [
2538 AC_RUN_IFELSE([[
2539#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002540#ifdef HAVE_TERMCAP_H
2541# include <termcap.h>
2542#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002543#if STDC_HEADERS
2544# include <stdlib.h>
2545# include <stddef.h>
2546#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002547main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002548{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2549 ]],[
2550 vim_cv_tgent=zero
2551 ],[
2552 vim_cv_tgent=non-zero
2553 ],[
2554 AC_MSG_ERROR(failed to compile test program.)
2555 ])
2556 ])
2557
2558 if test "x$vim_cv_tgent" = "xzero" ; then
2559 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2560 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002561fi
2562
2563AC_MSG_CHECKING(whether termcap.h contains ospeed)
2564AC_TRY_LINK([
2565#ifdef HAVE_TERMCAP_H
2566# include <termcap.h>
2567#endif
2568 ], [ospeed = 20000],
2569 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2570 [AC_MSG_RESULT(no)
2571 AC_MSG_CHECKING(whether ospeed can be extern)
2572 AC_TRY_LINK([
2573#ifdef HAVE_TERMCAP_H
2574# include <termcap.h>
2575#endif
2576extern short ospeed;
2577 ], [ospeed = 20000],
2578 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2579 AC_MSG_RESULT(no))]
2580 )
2581
2582AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2583AC_TRY_LINK([
2584#ifdef HAVE_TERMCAP_H
2585# include <termcap.h>
2586#endif
2587 ], [if (UP == 0 && BC == 0) PC = 1],
2588 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2589 [AC_MSG_RESULT(no)
2590 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2591 AC_TRY_LINK([
2592#ifdef HAVE_TERMCAP_H
2593# include <termcap.h>
2594#endif
2595extern char *UP, *BC, PC;
2596 ], [if (UP == 0 && BC == 0) PC = 1],
2597 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2598 AC_MSG_RESULT(no))]
2599 )
2600
2601AC_MSG_CHECKING(whether tputs() uses outfuntype)
2602AC_TRY_COMPILE([
2603#ifdef HAVE_TERMCAP_H
2604# include <termcap.h>
2605#endif
2606 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2607 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2608 AC_MSG_RESULT(no))
2609
2610dnl On some SCO machines sys/select redefines struct timeval
2611AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2612AC_TRY_COMPILE([
2613#include <sys/types.h>
2614#include <sys/time.h>
2615#include <sys/select.h>], ,
2616 AC_MSG_RESULT(yes)
2617 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2618 AC_MSG_RESULT(no))
2619
2620dnl AC_DECL_SYS_SIGLIST
2621
2622dnl Checks for pty.c (copied from screen) ==========================
2623AC_MSG_CHECKING(for /dev/ptc)
2624if test -r /dev/ptc; then
2625 AC_DEFINE(HAVE_DEV_PTC)
2626 AC_MSG_RESULT(yes)
2627else
2628 AC_MSG_RESULT(no)
2629fi
2630
2631AC_MSG_CHECKING(for SVR4 ptys)
2632if test -c /dev/ptmx ; then
2633 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2634 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2635 AC_MSG_RESULT(no))
2636else
2637 AC_MSG_RESULT(no)
2638fi
2639
2640AC_MSG_CHECKING(for ptyranges)
2641if test -d /dev/ptym ; then
2642 pdir='/dev/ptym'
2643else
2644 pdir='/dev'
2645fi
2646dnl SCO uses ptyp%d
2647AC_EGREP_CPP(yes,
2648[#ifdef M_UNIX
2649 yes;
2650#endif
2651 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2652dnl if test -c /dev/ptyp19; then
2653dnl ptys=`echo /dev/ptyp??`
2654dnl else
2655dnl ptys=`echo $pdir/pty??`
2656dnl fi
2657if test "$ptys" != "$pdir/pty??" ; then
2658 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2659 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2660 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2661 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2662 AC_MSG_RESULT([$p0 / $p1])
2663else
2664 AC_MSG_RESULT([don't know])
2665fi
2666
2667dnl **** pty mode/group handling ****
2668dnl
2669dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002670rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002671AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2672 [
2673 AC_RUN_IFELSE([[
2674#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002675#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002676#if STDC_HEADERS
2677# include <stdlib.h>
2678# include <stddef.h>
2679#endif
2680#ifdef HAVE_UNISTD_H
2681#include <unistd.h>
2682#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002683#include <sys/stat.h>
2684#include <stdio.h>
2685main()
2686{
2687 struct stat sb;
2688 char *x,*ttyname();
2689 int om, m;
2690 FILE *fp;
2691
2692 if (!(x = ttyname(0))) exit(1);
2693 if (stat(x, &sb)) exit(1);
2694 om = sb.st_mode;
2695 if (om & 002) exit(0);
2696 m = system("mesg y");
2697 if (m == -1 || m == 127) exit(1);
2698 if (stat(x, &sb)) exit(1);
2699 m = sb.st_mode;
2700 if (chmod(x, om)) exit(1);
2701 if (m & 002) exit(0);
2702 if (sb.st_gid == getgid()) exit(1);
2703 if (!(fp=fopen("conftest_grp", "w")))
2704 exit(1);
2705 fprintf(fp, "%d\n", sb.st_gid);
2706 fclose(fp);
2707 exit(0);
2708}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002709 ]],[
2710 if test -f conftest_grp; then
2711 vim_cv_tty_group=`cat conftest_grp`
2712 if test "x$vim_cv_tty_mode" = "x" ; then
2713 vim_cv_tty_mode=0620
2714 fi
2715 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2716 else
2717 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002718 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002719 fi
2720 ],[
2721 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002722 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002723 ],[
2724 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2725 ])
2726 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002727rm -f conftest_grp
2728
Bram Moolenaar446cb832008-06-24 21:56:24 +00002729if test "x$vim_cv_tty_group" != "xworld" ; then
2730 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2731 if test "x$vim_cv_tty_mode" = "x" ; then
2732 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)])
2733 else
2734 AC_DEFINE(PTYMODE, 0620)
2735 fi
2736fi
2737
Bram Moolenaar071d4272004-06-13 20:20:40 +00002738dnl Checks for library functions. ===================================
2739
2740AC_TYPE_SIGNAL
2741
2742dnl find out what to use at the end of a signal function
2743if test $ac_cv_type_signal = void; then
2744 AC_DEFINE(SIGRETURN, [return])
2745else
2746 AC_DEFINE(SIGRETURN, [return 0])
2747fi
2748
2749dnl check if struct sigcontext is defined (used for SGI only)
2750AC_MSG_CHECKING(for struct sigcontext)
2751AC_TRY_COMPILE([
2752#include <signal.h>
2753test_sig()
2754{
2755 struct sigcontext *scont;
2756 scont = (struct sigcontext *)0;
2757 return 1;
2758} ], ,
2759 AC_MSG_RESULT(yes)
2760 AC_DEFINE(HAVE_SIGCONTEXT),
2761 AC_MSG_RESULT(no))
2762
2763dnl tricky stuff: try to find out if getcwd() is implemented with
2764dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002765AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2766 [
2767 AC_RUN_IFELSE([[
2768#include "confdefs.h"
2769#ifdef HAVE_UNISTD_H
2770#include <unistd.h>
2771#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002772char *dagger[] = { "IFS=pwd", 0 };
2773main()
2774{
2775 char buffer[500];
2776 extern char **environ;
2777 environ = dagger;
2778 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002779}
2780 ]],[
2781 vim_cv_getcwd_broken=no
2782 ],[
2783 vim_cv_getcwd_broken=yes
2784 ],[
2785 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2786 ])
2787 ])
2788
2789if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2790 AC_DEFINE(BAD_GETCWD)
2791fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002792
Bram Moolenaar25153e12010-02-24 14:47:08 +01002793dnl Check for functions in one big call, to reduce the size of configure.
2794dnl Can only be used for functions that do not require any include.
2795AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002796 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002797 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002798 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002799 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002800 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2801 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002802AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002803
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002804dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2805dnl appropriate, so that off_t is 64 bits when needed.
2806AC_SYS_LARGEFILE
2807
Bram Moolenaar071d4272004-06-13 20:20:40 +00002808dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2809AC_MSG_CHECKING(for st_blksize)
2810AC_TRY_COMPILE(
2811[#include <sys/types.h>
2812#include <sys/stat.h>],
2813[ struct stat st;
2814 int n;
2815
2816 stat("/", &st);
2817 n = (int)st.st_blksize;],
2818 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2819 AC_MSG_RESULT(no))
2820
Bram Moolenaar446cb832008-06-24 21:56:24 +00002821AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2822 [
2823 AC_RUN_IFELSE([[
2824#include "confdefs.h"
2825#if STDC_HEADERS
2826# include <stdlib.h>
2827# include <stddef.h>
2828#endif
2829#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002830#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002831main() {struct stat st; exit(stat("configure/", &st) != 0); }
2832 ]],[
2833 vim_cv_stat_ignores_slash=yes
2834 ],[
2835 vim_cv_stat_ignores_slash=no
2836 ],[
2837 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2838 ])
2839 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002840
Bram Moolenaar446cb832008-06-24 21:56:24 +00002841if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2842 AC_DEFINE(STAT_IGNORES_SLASH)
2843fi
2844
Bram Moolenaar071d4272004-06-13 20:20:40 +00002845dnl Link with iconv for charset translation, if not found without library.
2846dnl check for iconv() requires including iconv.h
2847dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2848dnl has been installed.
2849AC_MSG_CHECKING(for iconv_open())
2850save_LIBS="$LIBS"
2851LIBS="$LIBS -liconv"
2852AC_TRY_LINK([
2853#ifdef HAVE_ICONV_H
2854# include <iconv.h>
2855#endif
2856 ], [iconv_open("fr", "to");],
2857 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2858 LIBS="$save_LIBS"
2859 AC_TRY_LINK([
2860#ifdef HAVE_ICONV_H
2861# include <iconv.h>
2862#endif
2863 ], [iconv_open("fr", "to");],
2864 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2865 AC_MSG_RESULT(no)))
2866
2867
2868AC_MSG_CHECKING(for nl_langinfo(CODESET))
2869AC_TRY_LINK([
2870#ifdef HAVE_LANGINFO_H
2871# include <langinfo.h>
2872#endif
2873], [char *cs = nl_langinfo(CODESET);],
2874 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2875 AC_MSG_RESULT(no))
2876
Bram Moolenaar446cb832008-06-24 21:56:24 +00002877dnl Need various functions for floating point support. Only enable
2878dnl floating point when they are all present.
2879AC_CHECK_LIB(m, strtod)
2880AC_MSG_CHECKING([for strtod() and other floating point functions])
2881AC_TRY_LINK([
2882#ifdef HAVE_MATH_H
2883# include <math.h>
2884#endif
2885#if STDC_HEADERS
2886# include <stdlib.h>
2887# include <stddef.h>
2888#endif
2889], [char *s; double d;
2890 d = strtod("1.1", &s);
2891 d = fabs(1.11);
2892 d = ceil(1.11);
2893 d = floor(1.11);
2894 d = log10(1.11);
2895 d = pow(1.11, 2.22);
2896 d = sqrt(1.11);
2897 d = sin(1.11);
2898 d = cos(1.11);
2899 d = atan(1.11);
2900 ],
2901 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2902 AC_MSG_RESULT(no))
2903
Bram Moolenaar071d4272004-06-13 20:20:40 +00002904dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2905dnl when -lacl works, also try to use -lattr (required for Debian).
2906AC_MSG_CHECKING(--disable-acl argument)
2907AC_ARG_ENABLE(acl,
2908 [ --disable-acl Don't check for ACL support.],
2909 , [enable_acl="yes"])
2910if test "$enable_acl" = "yes"; then
2911AC_MSG_RESULT(no)
2912AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2913 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2914 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2915
2916AC_MSG_CHECKING(for POSIX ACL support)
2917AC_TRY_LINK([
2918#include <sys/types.h>
2919#ifdef HAVE_SYS_ACL_H
2920# include <sys/acl.h>
2921#endif
2922acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2923 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2924 acl_free(acl);],
2925 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2926 AC_MSG_RESULT(no))
2927
2928AC_MSG_CHECKING(for Solaris ACL support)
2929AC_TRY_LINK([
2930#ifdef HAVE_SYS_ACL_H
2931# include <sys/acl.h>
2932#endif], [acl("foo", GETACLCNT, 0, NULL);
2933 ],
2934 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2935 AC_MSG_RESULT(no))
2936
2937AC_MSG_CHECKING(for AIX ACL support)
2938AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002939#if STDC_HEADERS
2940# include <stdlib.h>
2941# include <stddef.h>
2942#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002943#ifdef HAVE_SYS_ACL_H
2944# include <sys/acl.h>
2945#endif
2946#ifdef HAVE_SYS_ACCESS_H
2947# include <sys/access.h>
2948#endif
2949#define _ALL_SOURCE
2950
2951#include <sys/stat.h>
2952
2953int aclsize;
2954struct acl *aclent;], [aclsize = sizeof(struct acl);
2955 aclent = (void *)malloc(aclsize);
2956 statacl("foo", STX_NORMAL, aclent, aclsize);
2957 ],
2958 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2959 AC_MSG_RESULT(no))
2960else
2961 AC_MSG_RESULT(yes)
2962fi
2963
2964AC_MSG_CHECKING(--disable-gpm argument)
2965AC_ARG_ENABLE(gpm,
2966 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2967 [enable_gpm="yes"])
2968
2969if test "$enable_gpm" = "yes"; then
2970 AC_MSG_RESULT(no)
2971 dnl Checking if gpm support can be compiled
2972 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2973 [olibs="$LIBS" ; LIBS="-lgpm"]
2974 AC_TRY_LINK(
2975 [#include <gpm.h>
2976 #include <linux/keyboard.h>],
2977 [Gpm_GetLibVersion(NULL);],
2978 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2979 dnl FEAT_MOUSE_GPM if mouse support is included
2980 [vi_cv_have_gpm=yes],
2981 [vi_cv_have_gpm=no])
2982 [LIBS="$olibs"]
2983 )
2984 if test $vi_cv_have_gpm = yes; then
2985 LIBS="$LIBS -lgpm"
2986 AC_DEFINE(HAVE_GPM)
2987 fi
2988else
2989 AC_MSG_RESULT(yes)
2990fi
2991
Bram Moolenaar446cb832008-06-24 21:56:24 +00002992AC_MSG_CHECKING(--disable-sysmouse argument)
2993AC_ARG_ENABLE(sysmouse,
2994 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2995 [enable_sysmouse="yes"])
2996
2997if test "$enable_sysmouse" = "yes"; then
2998 AC_MSG_RESULT(no)
2999 dnl Checking if sysmouse support can be compiled
3000 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
3001 dnl defines FEAT_SYSMOUSE if mouse support is included
3002 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
3003 AC_TRY_LINK(
3004 [#include <sys/consio.h>
3005 #include <signal.h>
3006 #include <sys/fbio.h>],
3007 [struct mouse_info mouse;
3008 mouse.operation = MOUSE_MODE;
3009 mouse.operation = MOUSE_SHOW;
3010 mouse.u.mode.mode = 0;
3011 mouse.u.mode.signal = SIGUSR2;],
3012 [vi_cv_have_sysmouse=yes],
3013 [vi_cv_have_sysmouse=no])
3014 )
3015 if test $vi_cv_have_sysmouse = yes; then
3016 AC_DEFINE(HAVE_SYSMOUSE)
3017 fi
3018else
3019 AC_MSG_RESULT(yes)
3020fi
3021
Bram Moolenaarf05da212009-11-17 16:13:15 +00003022dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
3023AC_MSG_CHECKING(for FD_CLOEXEC)
3024AC_TRY_COMPILE(
3025[#if HAVE_FCNTL_H
3026# include <fcntl.h>
3027#endif],
3028[ int flag = FD_CLOEXEC;],
3029 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
3030 AC_MSG_RESULT(not usable))
3031
Bram Moolenaar071d4272004-06-13 20:20:40 +00003032dnl rename needs to be checked separately to work on Nextstep with cc
3033AC_MSG_CHECKING(for rename)
3034AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
3035 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
3036 AC_MSG_RESULT(no))
3037
3038dnl sysctl() may exist but not the arguments we use
3039AC_MSG_CHECKING(for sysctl)
3040AC_TRY_COMPILE(
3041[#include <sys/types.h>
3042#include <sys/sysctl.h>],
3043[ int mib[2], r;
3044 size_t len;
3045
3046 mib[0] = CTL_HW;
3047 mib[1] = HW_USERMEM;
3048 len = sizeof(r);
3049 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
3050 ],
3051 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
3052 AC_MSG_RESULT(not usable))
3053
3054dnl sysinfo() may exist but not be Linux compatible
3055AC_MSG_CHECKING(for sysinfo)
3056AC_TRY_COMPILE(
3057[#include <sys/types.h>
3058#include <sys/sysinfo.h>],
3059[ struct sysinfo sinfo;
3060 int t;
3061
3062 (void)sysinfo(&sinfo);
3063 t = sinfo.totalram;
3064 ],
3065 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
3066 AC_MSG_RESULT(not usable))
3067
Bram Moolenaar914572a2007-05-01 11:37:47 +00003068dnl struct sysinfo may have the mem_unit field or not
3069AC_MSG_CHECKING(for sysinfo.mem_unit)
3070AC_TRY_COMPILE(
3071[#include <sys/types.h>
3072#include <sys/sysinfo.h>],
3073[ struct sysinfo sinfo;
3074 sinfo.mem_unit = 1;
3075 ],
3076 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
3077 AC_MSG_RESULT(no))
3078
Bram Moolenaar071d4272004-06-13 20:20:40 +00003079dnl sysconf() may exist but not support what we want to use
3080AC_MSG_CHECKING(for sysconf)
3081AC_TRY_COMPILE(
3082[#include <unistd.h>],
3083[ (void)sysconf(_SC_PAGESIZE);
3084 (void)sysconf(_SC_PHYS_PAGES);
3085 ],
3086 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
3087 AC_MSG_RESULT(not usable))
3088
Bram Moolenaar914703b2010-05-31 21:59:46 +02003089AC_CHECK_SIZEOF([int])
3090AC_CHECK_SIZEOF([long])
3091AC_CHECK_SIZEOF([time_t])
3092AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02003093
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003094dnl Make sure that uint32_t is really 32 bits unsigned.
3095AC_MSG_CHECKING([uint32_t is 32 bits])
3096AC_TRY_RUN([
3097#ifdef HAVE_STDINT_H
3098# include <stdint.h>
3099#endif
3100#ifdef HAVE_INTTYPES_H
3101# include <inttypes.h>
3102#endif
3103main() {
3104 uint32_t nr1 = (uint32_t)-1;
3105 uint32_t nr2 = (uint32_t)0xffffffffUL;
3106 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
3107 exit(0);
3108}],
3109AC_MSG_RESULT(ok),
3110AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
3111AC_MSG_ERROR([could not compile program using uint32_t.]))
3112
Bram Moolenaar446cb832008-06-24 21:56:24 +00003113dnl Check for memmove() before bcopy(), makes memmove() be used when both are
3114dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
3115
Bram Moolenaar071d4272004-06-13 20:20:40 +00003116[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00003117#include "confdefs.h"
3118#ifdef HAVE_STRING_H
3119# include <string.h>
3120#endif
3121#if STDC_HEADERS
3122# include <stdlib.h>
3123# include <stddef.h>
3124#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003125main() {
3126 char buf[10];
3127 strcpy(buf, "abcdefghi");
3128 mch_memmove(buf, buf + 2, 3);
3129 if (strncmp(buf, "ababcf", 6))
3130 exit(1);
3131 strcpy(buf, "abcdefghi");
3132 mch_memmove(buf + 2, buf, 3);
3133 if (strncmp(buf, "cdedef", 6))
3134 exit(1);
3135 exit(0); /* libc version works properly. */
3136}']
3137
Bram Moolenaar446cb832008-06-24 21:56:24 +00003138AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
3139 [
3140 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
3141 [
3142 vim_cv_memmove_handles_overlap=yes
3143 ],[
3144 vim_cv_memmove_handles_overlap=no
3145 ],[
3146 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
3147 ])
3148 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003149
Bram Moolenaar446cb832008-06-24 21:56:24 +00003150if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
3151 AC_DEFINE(USEMEMMOVE)
3152else
3153 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
3154 [
3155 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
3156 [
3157 vim_cv_bcopy_handles_overlap=yes
3158 ],[
3159 vim_cv_bcopy_handles_overlap=no
3160 ],[
3161 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
3162 ])
3163 ])
3164
3165 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
3166 AC_DEFINE(USEBCOPY)
3167 else
3168 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
3169 [
3170 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
3171 [
3172 vim_cv_memcpy_handles_overlap=yes
3173 ],[
3174 vim_cv_memcpy_handles_overlap=no
3175 ],[
3176 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
3177 ])
3178 ])
3179
3180 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
3181 AC_DEFINE(USEMEMCPY)
3182 fi
3183 fi
3184fi
3185
Bram Moolenaar071d4272004-06-13 20:20:40 +00003186
3187dnl Check for multibyte locale functions
3188dnl Find out if _Xsetlocale() is supported by libX11.
3189dnl Check if X_LOCALE should be defined.
3190
3191if test "$enable_multibyte" = "yes"; then
3192 cflags_save=$CFLAGS
3193 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00003194 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003195 CFLAGS="$CFLAGS -I$x_includes"
3196 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
3197 AC_MSG_CHECKING(whether X_LOCALE needed)
3198 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
3199 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
3200 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
3201 AC_MSG_RESULT(no))
3202 fi
3203 CFLAGS=$cflags_save
3204 LDFLAGS=$ldflags_save
3205fi
3206
3207dnl Link with xpg4, it is said to make Korean locale working
3208AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
3209
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003210dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003211dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003212dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003213dnl -t for typedefs (many ctags have this)
3214dnl -s for static functions (Elvis ctags only?)
3215dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
3216dnl -i+m to test for older Exuberant ctags
3217AC_MSG_CHECKING(how to create tags)
3218test -f tags && mv tags tags.save
3219if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003220 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003221else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003222 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003223 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
3224 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
3225 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
3226 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
3227 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
3228 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
3229 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
3230fi
3231test -f tags.save && mv tags.save tags
3232AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
3233
3234dnl Check how we can run man with a section number
3235AC_MSG_CHECKING(how to run man with a section nr)
3236MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00003237(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 +00003238AC_MSG_RESULT($MANDEF)
3239if test "$MANDEF" = "man -s"; then
3240 AC_DEFINE(USEMAN_S)
3241fi
3242
3243dnl Check if gettext() is working and if it needs -lintl
3244AC_MSG_CHECKING(--disable-nls argument)
3245AC_ARG_ENABLE(nls,
3246 [ --disable-nls Don't support NLS (gettext()).], ,
3247 [enable_nls="yes"])
3248
3249if test "$enable_nls" = "yes"; then
3250 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00003251
3252 INSTALL_LANGS=install-languages
3253 AC_SUBST(INSTALL_LANGS)
3254 INSTALL_TOOL_LANGS=install-tool-languages
3255 AC_SUBST(INSTALL_TOOL_LANGS)
3256
Bram Moolenaar071d4272004-06-13 20:20:40 +00003257 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
3258 AC_MSG_CHECKING([for NLS])
3259 if test -f po/Makefile; then
3260 have_gettext="no"
3261 if test -n "$MSGFMT"; then
3262 AC_TRY_LINK(
3263 [#include <libintl.h>],
3264 [gettext("Test");],
3265 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3266 olibs=$LIBS
3267 LIBS="$LIBS -lintl"
3268 AC_TRY_LINK(
3269 [#include <libintl.h>],
3270 [gettext("Test");],
3271 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3272 AC_MSG_RESULT([gettext() doesn't work]);
3273 LIBS=$olibs))
3274 else
3275 AC_MSG_RESULT([msgfmt not found - disabled]);
3276 fi
3277 if test $have_gettext = "yes"; then
3278 AC_DEFINE(HAVE_GETTEXT)
3279 MAKEMO=yes
3280 AC_SUBST(MAKEMO)
3281 dnl this was added in GNU gettext 0.10.36
3282 AC_CHECK_FUNCS(bind_textdomain_codeset)
3283 dnl _nl_msg_cat_cntr is required for GNU gettext
3284 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3285 AC_TRY_LINK(
3286 [#include <libintl.h>
3287 extern int _nl_msg_cat_cntr;],
3288 [++_nl_msg_cat_cntr;],
3289 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3290 AC_MSG_RESULT([no]))
3291 fi
3292 else
3293 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3294 fi
3295else
3296 AC_MSG_RESULT(yes)
3297fi
3298
3299dnl Check for dynamic linking loader
3300AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3301if test x${DLL} = xdlfcn.h; then
3302 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3303 AC_MSG_CHECKING([for dlopen()])
3304 AC_TRY_LINK(,[
3305 extern void* dlopen();
3306 dlopen();
3307 ],
3308 AC_MSG_RESULT(yes);
3309 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3310 AC_MSG_RESULT(no);
3311 AC_MSG_CHECKING([for dlopen() in -ldl])
3312 olibs=$LIBS
3313 LIBS="$LIBS -ldl"
3314 AC_TRY_LINK(,[
3315 extern void* dlopen();
3316 dlopen();
3317 ],
3318 AC_MSG_RESULT(yes);
3319 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3320 AC_MSG_RESULT(no);
3321 LIBS=$olibs))
3322 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3323 dnl ick :-)
3324 AC_MSG_CHECKING([for dlsym()])
3325 AC_TRY_LINK(,[
3326 extern void* dlsym();
3327 dlsym();
3328 ],
3329 AC_MSG_RESULT(yes);
3330 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3331 AC_MSG_RESULT(no);
3332 AC_MSG_CHECKING([for dlsym() in -ldl])
3333 olibs=$LIBS
3334 LIBS="$LIBS -ldl"
3335 AC_TRY_LINK(,[
3336 extern void* dlsym();
3337 dlsym();
3338 ],
3339 AC_MSG_RESULT(yes);
3340 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3341 AC_MSG_RESULT(no);
3342 LIBS=$olibs))
3343elif test x${DLL} = xdl.h; then
3344 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3345 AC_MSG_CHECKING([for shl_load()])
3346 AC_TRY_LINK(,[
3347 extern void* shl_load();
3348 shl_load();
3349 ],
3350 AC_MSG_RESULT(yes);
3351 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3352 AC_MSG_RESULT(no);
3353 AC_MSG_CHECKING([for shl_load() in -ldld])
3354 olibs=$LIBS
3355 LIBS="$LIBS -ldld"
3356 AC_TRY_LINK(,[
3357 extern void* shl_load();
3358 shl_load();
3359 ],
3360 AC_MSG_RESULT(yes);
3361 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3362 AC_MSG_RESULT(no);
3363 LIBS=$olibs))
3364fi
3365AC_CHECK_HEADERS(setjmp.h)
3366
3367if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3368 dnl -ldl must come after DynaLoader.a
3369 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3370 LIBS=`echo $LIBS | sed s/-ldl//`
3371 PERL_LIBS="$PERL_LIBS -ldl"
3372 fi
3373fi
3374
Bram Moolenaar164fca32010-07-14 13:58:07 +02003375if test "x$MACOSX" = "xyes"; then
3376 AC_MSG_CHECKING(whether we need -framework Cocoa)
3377 dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
3378 dnl disabled during tiny build)
3379 if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
3380 LIBS=$"$LIBS -framework Cocoa"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003381 AC_MSG_RESULT(yes)
3382 else
3383 AC_MSG_RESULT(no)
3384 fi
3385fi
Bram Moolenaar164fca32010-07-14 13:58:07 +02003386if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003387 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003388fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003389
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003390dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3391dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3392dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003393dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3394dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003395DEPEND_CFLAGS_FILTER=
3396if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003397 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003398 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003399 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003400 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003401 AC_MSG_RESULT(yes)
3402 else
3403 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003404 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003405 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3406 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003407 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003408 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3409 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003410 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 +00003411 AC_MSG_RESULT(yes)
3412 else
3413 AC_MSG_RESULT(no)
3414 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003415fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003416AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003417
3418dnl write output files
3419AC_OUTPUT(auto/config.mk:config.mk.in)
3420
3421dnl vim: set sw=2 tw=78 fo+=l: