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