blob: 5896189e9def92da90b6006de1479e8d047413e0 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001dnl configure.in: autoconf script for Vim
2
3dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
4dnl Should also work with autoconf 2.54 and later.
5
6AC_INIT(vim.h)
7AC_CONFIG_HEADER(auto/config.h:config.h.in)
8
9dnl Being able to run configure means the system is Unix (compatible).
10AC_DEFINE(UNIX)
11AC_PROG_MAKE_SET
12
13dnl Checks for programs.
14AC_PROG_CC dnl required by almost everything
15AC_PROG_CPP dnl required by header file checks
16AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
17AC_ISC_POSIX dnl required by AC_C_CROSS
18AC_PROG_AWK dnl required for "make html" in ../doc
19
20dnl Don't strip if we don't have it
21AC_CHECK_PROG(STRIP, strip, strip, :)
22
Bram Moolenaar325b7a22004-07-05 15:58:32 +000023dnl Check for extension of executables
Bram Moolenaar071d4272004-06-13 20:20:40 +000024AC_EXEEXT
25
Bram Moolenaar446cb832008-06-24 21:56:24 +000026dnl Check for standard headers. We don't use this in Vim but other stuff
27dnl in autoconf needs it, where it uses STDC_HEADERS.
28AC_HEADER_STDC
29AC_HEADER_SYS_WAIT
30
Bram Moolenaar071d4272004-06-13 20:20:40 +000031dnl Set default value for CFLAGS if none is defined or it's empty
32if test -z "$CFLAGS"; then
33 CFLAGS="-O"
34 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
35fi
36if test "$GCC" = yes; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +000037 dnl method that should work for nearly all versions
38 gccversion=`"$CC" -dumpversion`
39 if test "x$gccversion" = "x"; then
40 dnl old method; fall-back for when -dumpversion doesn't work
41 gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
42 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +000043 dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
44 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +000045 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +000046 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
47 else
48 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
49 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
50 CFLAGS="$CFLAGS -fno-strength-reduce"
51 fi
52 fi
53fi
54
Bram Moolenaar446cb832008-06-24 21:56:24 +000055dnl If configure thinks we are cross compiling, there might be something
56dnl wrong with the CC or CFLAGS settings, give a useful warning message
Bram Moolenaar071d4272004-06-13 20:20:40 +000057if test "$cross_compiling" = yes; then
Bram Moolenaar446cb832008-06-24 21:56:24 +000058 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
Bram Moolenaar071d4272004-06-13 20:20:40 +000059fi
60
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000061dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
62dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +000063test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
64
65if test -f ./toolcheck; then
66 AC_CHECKING(for buggy tools)
67 sh ./toolcheck 1>&AC_FD_MSG
68fi
69
70OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
71
72dnl Check for BeOS, which needs an extra source file
73AC_MSG_CHECKING(for BeOS)
74case `uname` in
75 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
76 BEOS=yes; AC_MSG_RESULT(yes);;
77 *) BEOS=no; AC_MSG_RESULT(no);;
78esac
79
80dnl If QNX is found, assume we don't want to use Xphoton
81dnl unless it was specifically asked for (--with-x)
82AC_MSG_CHECKING(for QNX)
83case `uname` in
84 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
85 test -z "$with_x" && with_x=no
86 QNX=yes; AC_MSG_RESULT(yes);;
87 *) QNX=no; AC_MSG_RESULT(no);;
88esac
89
90dnl Check for Darwin and MacOS X
91dnl We do a check for MacOS X in the very beginning because there
92dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +000093AC_MSG_CHECKING([for Darwin (Mac OS X)])
94if test "`(uname) 2>/dev/null`" = Darwin; then
95 AC_MSG_RESULT(yes)
96
97 AC_MSG_CHECKING(--disable-darwin argument)
98 AC_ARG_ENABLE(darwin,
99 [ --disable-darwin Disable Darwin (Mac OS X) support.],
100 , [enable_darwin="yes"])
101 if test "$enable_darwin" = "yes"; then
102 AC_MSG_RESULT(no)
103 AC_MSG_CHECKING(if Darwin files are there)
Bram Moolenaar164fca32010-07-14 13:58:07 +0200104 if test -f os_macosx.m; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105 AC_MSG_RESULT(yes)
106 else
107 AC_MSG_RESULT([no, Darwin support disabled])
108 enable_darwin=no
109 fi
110 else
111 AC_MSG_RESULT([yes, Darwin support excluded])
112 fi
113
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000114 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000115 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000116 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000117 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000118
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100119 AC_MSG_CHECKING(--with-developer-dir argument)
120 AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
121 DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
122 DEVELOPER_DIR=""; AC_MSG_RESULT(not present))
123
124 if test "x$DEVELOPER_DIR" = "x"; then
125 AC_PATH_PROG(XCODE_SELECT, xcode-select)
126 if test "x$XCODE_SELECT" != "x"; then
127 AC_MSG_CHECKING(for developer dir using xcode-select)
128 DEVELOPER_DIR=`$XCODE_SELECT -print-path`
129 AC_MSG_RESULT([$DEVELOPER_DIR])
130 else
131 DEVELOPER_DIR=/Developer
132 fi
133 fi
134
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000135 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000136 AC_MSG_CHECKING(for 10.4 universal SDK)
137 dnl There is a terrible inconsistency (but we appear to get away with it):
138 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
139 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
140 dnl tests using the preprocessor are actually done with the wrong header
141 dnl files. $LDFLAGS is set at the end, because configure uses it together
142 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000143 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000144 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000145 save_ldflags="$LDFLAGS"
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100146 CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000147 AC_TRY_LINK([ ], [ ],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000148 AC_MSG_RESULT(found, will make universal binary),
149
150 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000151 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000152 AC_MSG_CHECKING(if Intel architecture is supported)
153 CPPFLAGS="$CPPFLAGS -arch i386"
154 LDFLAGS="$save_ldflags -arch i386"
155 AC_TRY_LINK([ ], [ ],
156 AC_MSG_RESULT(yes); MACARCH="intel",
157 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000158 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000159 CPPFLAGS="$save_cppflags -arch ppc"
160 LDFLAGS="$save_ldflags -arch ppc"))
161 elif test "x$MACARCH" = "xintel"; then
162 CPPFLAGS="$CPPFLAGS -arch intel"
163 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000164 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000165 CPPFLAGS="$CPPFLAGS -arch ppc"
166 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000167 fi
168
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169 if test "$enable_darwin" = "yes"; then
170 MACOSX=yes
Bram Moolenaar164fca32010-07-14 13:58:07 +0200171 OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000172 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000173 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000174 CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175
176 dnl If Carbon is found, assume we don't want X11
177 dnl unless it was specifically asked for (--with-x)
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000178 dnl or Motif, Athena or GTK GUI is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000179 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
180 if test "x$CARBON" = "xyes"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +0200181 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000182 with_x=no
Bram Moolenaar071d4272004-06-13 20:20:40 +0000183 fi
184 fi
185 fi
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000186
Bram Moolenaardb552d602006-03-23 22:59:57 +0000187 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000188 dnl free. This happens in expand_filename(), because the optimizer swaps
Bram Moolenaardb552d602006-03-23 22:59:57 +0000189 dnl two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000190 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
191 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
192 fi
193
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194else
195 AC_MSG_RESULT(no)
196fi
197
198AC_SUBST(OS_EXTRA_SRC)
199AC_SUBST(OS_EXTRA_OBJ)
200
201dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
202dnl Only when the directory exists and it wasn't there yet.
203dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000204dnl Skip all of this when cross-compiling.
205if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000206 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000207 have_local_include=''
208 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000209 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
210 --without-local-dir do not search /usr/local for local libraries.], [
211 local_dir="$withval"
212 case "$withval" in
213 */*) ;;
214 no)
215 # avoid adding local dir to LDFLAGS and CPPFLAGS
216 have_local_dir=yes
217 have_local_lib=yes
218 ;;
219 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
220 esac
221 AC_MSG_RESULT($local_dir)
222 ], [
223 local_dir=/usr/local
224 AC_MSG_RESULT(Defaulting to $local_dir)
225 ])
226 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000227 echo 'void f(){}' > conftest.c
228 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
Bram Moolenaarc236c162008-07-13 17:41:49 +0000229 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
230 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000231 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000233 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
234 tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000235 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000236 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000237 fi
238 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000239 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
240 tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000241 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000242 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000243 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244 fi
245fi
246
247AC_MSG_CHECKING(--with-vim-name argument)
248AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
249 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000250 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251AC_SUBST(VIMNAME)
252AC_MSG_CHECKING(--with-ex-name argument)
253AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
254 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
255 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
256AC_SUBST(EXNAME)
257AC_MSG_CHECKING(--with-view-name argument)
258AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
259 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
260 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
261AC_SUBST(VIEWNAME)
262
263AC_MSG_CHECKING(--with-global-runtime argument)
264AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
265 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
266 AC_MSG_RESULT(no))
267
268AC_MSG_CHECKING(--with-modified-by argument)
269AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
270 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
271 AC_MSG_RESULT(no))
272
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200273dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000274AC_MSG_CHECKING(if character set is EBCDIC)
275AC_TRY_COMPILE([ ],
276[ /* TryCompile function for CharSet.
277 Treat any failure as ASCII for compatibility with existing art.
278 Use compile-time rather than run-time tests for cross-compiler
279 tolerance. */
280#if '0'!=240
281make an error "Character set is not EBCDIC"
282#endif ],
283[ # TryCompile action if true
284cf_cv_ebcdic=yes ],
285[ # TryCompile action if false
286cf_cv_ebcdic=no])
287# end of TryCompile ])
288# end of CacheVal CvEbcdic
289AC_MSG_RESULT($cf_cv_ebcdic)
290case "$cf_cv_ebcdic" in #(vi
291 yes) AC_DEFINE(EBCDIC)
292 line_break='"\\n"'
293 ;;
294 *) line_break='"\\012"';;
295esac
296AC_SUBST(line_break)
297
298if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200299dnl If we have EBCDIC we most likley have z/OS Unix, let's test it!
300AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000301case `uname` in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200302 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303 dnl If using cc the environment variable _CC_CCMODE must be
304 dnl set to "1", so that some compiler extensions are enabled.
305 dnl If using c89 the environment variable is named _CC_C89MODE.
306 dnl Note: compile with c89 never tested.
307 if test "$CC" = "cc"; then
308 ccm="$_CC_CCMODE"
309 ccn="CC"
310 else
311 if test "$CC" = "c89"; then
312 ccm="$_CC_C89MODE"
313 ccn="C89"
314 else
315 ccm=1
316 fi
317 fi
318 if test "$ccm" != "1"; then
319 echo ""
320 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200321 echo " On z/OS Unix, the environment variable"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000322 echo " __CC_${ccn}MODE must be set to \"1\"!"
323 echo " Do:"
324 echo " export _CC_${ccn}MODE=1"
325 echo " and then call configure again."
326 echo "------------------------------------------"
327 exit 1
328 fi
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200329 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
330 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331 AC_MSG_RESULT(yes)
332 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200333 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334 AC_MSG_RESULT(no)
335 ;;
336esac
337fi
338
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200339dnl Set QUOTESED. Needs additional backslashes on zOS
340if test "$zOSUnix" = "yes"; then
341 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
342else
343 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
344fi
345AC_SUBST(QUOTESED)
346
347
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000348dnl Link with -lselinux for SELinux stuff; if not found
349AC_MSG_CHECKING(--disable-selinux argument)
350AC_ARG_ENABLE(selinux,
351 [ --disable-selinux Don't check for SELinux support.],
352 , enable_selinux="yes")
353if test "$enable_selinux" = "yes"; then
354 AC_MSG_RESULT(no)
355 AC_CHECK_LIB(selinux, is_selinux_enabled,
356 [LIBS="$LIBS -lselinux"
357 AC_DEFINE(HAVE_SELINUX)])
358else
359 AC_MSG_RESULT(yes)
360fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000361
362dnl Check user requested features.
363
364AC_MSG_CHECKING(--with-features argument)
365AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
366 features="$withval"; AC_MSG_RESULT($features),
367 features="normal"; AC_MSG_RESULT(Defaulting to normal))
368
369dovimdiff=""
370dogvimdiff=""
371case "$features" in
372 tiny) AC_DEFINE(FEAT_TINY) ;;
373 small) AC_DEFINE(FEAT_SMALL) ;;
374 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
375 dogvimdiff="installgvimdiff" ;;
376 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
377 dogvimdiff="installgvimdiff" ;;
378 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
379 dogvimdiff="installgvimdiff" ;;
380 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
381esac
382
383AC_SUBST(dovimdiff)
384AC_SUBST(dogvimdiff)
385
386AC_MSG_CHECKING(--with-compiledby argument)
387AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
388 compiledby="$withval"; AC_MSG_RESULT($withval),
389 compiledby=""; AC_MSG_RESULT(no))
390AC_SUBST(compiledby)
391
392AC_MSG_CHECKING(--disable-xsmp argument)
393AC_ARG_ENABLE(xsmp,
394 [ --disable-xsmp Disable XSMP session management],
395 , enable_xsmp="yes")
396
397if test "$enable_xsmp" = "yes"; then
398 AC_MSG_RESULT(no)
399 AC_MSG_CHECKING(--disable-xsmp-interact argument)
400 AC_ARG_ENABLE(xsmp-interact,
401 [ --disable-xsmp-interact Disable XSMP interaction],
402 , enable_xsmp_interact="yes")
403 if test "$enable_xsmp_interact" = "yes"; then
404 AC_MSG_RESULT(no)
405 AC_DEFINE(USE_XSMP_INTERACT)
406 else
407 AC_MSG_RESULT(yes)
408 fi
409else
410 AC_MSG_RESULT(yes)
411fi
412
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200413dnl Check for Lua feature.
414AC_MSG_CHECKING(--enable-luainterp argument)
415AC_ARG_ENABLE(luainterp,
416 [ --enable-luainterp Include Lua interpreter.], ,
417 [enable_luainterp="no"])
418AC_MSG_RESULT($enable_luainterp)
419
420if test "$enable_luainterp" = "yes"; then
421 dnl -- find the lua executable
422 AC_SUBST(vi_cv_path_lua)
423
424 AC_MSG_CHECKING(--with-lua-prefix argument)
425 AC_ARG_WITH(lua_prefix,
426 [ --with-lua-prefix=PFX Prefix where Lua is installed.],
427 with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
428 with_lua_prefix="";AC_MSG_RESULT("no"))
429
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
438 AC_MSG_RESULT("not set")
439 fi
440 fi
441
442 LUA_INC=
443 if test "X$vi_cv_path_lua_pfx" != "X"; then
444 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
445 if test -f $vi_cv_path_lua_pfx/include/lua.h; then
446 AC_MSG_RESULT("yes")
447 else
448 AC_MSG_RESULT("no")
449 dnl -- try to find Lua executable
450 AC_PATH_PROG(vi_cv_path_lua, lua)
451 if test "X$vi_cv_path_lua" != "X"; then
452 dnl -- find Lua version
453 AC_CACHE_CHECK(Lua version, vi_cv_version_lua,
454 [ vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION:sub(5,7))"` ])
455 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
456 if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then
457 AC_MSG_RESULT("yes")
458 LUA_INC=/lua$vi_cv_version_lua
459 else
460 AC_MSG_RESULT("no")
461 vi_cv_path_lua_pfx=
462 fi
463 fi
464 fi
465 fi
466
467 if test "X$vi_cv_path_lua_pfx" != "X"; then
468 if test "X$vi_cv_version_lua" != "X"; then
469 dnl Test alternate location using version
470 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
471 else
472 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
473 fi
474 LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
475 LUA_SRC="if_lua.c"
476 LUA_OBJ="objects/if_lua.o"
477 LUA_PRO="if_lua.pro"
478 AC_DEFINE(FEAT_LUA)
479 fi
480 AC_SUBST(LUA_SRC)
481 AC_SUBST(LUA_OBJ)
482 AC_SUBST(LUA_PRO)
483 AC_SUBST(LUA_LIBS)
484 AC_SUBST(LUA_CFLAGS)
485fi
486
487
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000488dnl Check for MzScheme feature.
489AC_MSG_CHECKING(--enable-mzschemeinterp argument)
490AC_ARG_ENABLE(mzschemeinterp,
491 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
492 [enable_mzschemeinterp="no"])
493AC_MSG_RESULT($enable_mzschemeinterp)
494
495if test "$enable_mzschemeinterp" = "yes"; then
496 dnl -- find the mzscheme executable
497 AC_SUBST(vi_cv_path_mzscheme)
498
499 AC_MSG_CHECKING(--with-plthome argument)
500 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000501 [ --with-plthome=PLTHOME Use PLTHOME.],
502 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000503 with_plthome="";AC_MSG_RESULT("no"))
504
505 if test "X$with_plthome" != "X"; then
506 vi_cv_path_mzscheme_pfx="$with_plthome"
507 else
508 AC_MSG_CHECKING(PLTHOME environment var)
509 if test "X$PLTHOME" != "X"; then
510 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000511 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000512 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000513 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000514 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000515 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000516
517 dnl resolve symbolic link, the executable is often elsewhere and there
518 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000519 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000520 lsout=`ls -l $vi_cv_path_mzscheme`
521 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
522 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
523 fi
524 fi
525
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000526 if test "X$vi_cv_path_mzscheme" != "X"; then
527 dnl -- find where MzScheme thinks it was installed
528 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000529 dnl different versions of MzScheme differ in command line processing
530 dnl use universal approach
531 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000532 (build-path (call-with-values \
533 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000534 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
535 dnl Remove a trailing slash
536 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
537 sed -e 's+/$++'` ])
538 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000539 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000540 fi
541 fi
542
Bram Moolenaard7afed32007-05-06 13:26:41 +0000543 SCHEME_INC=
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000544 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
545 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
546 if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000547 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
548 AC_MSG_RESULT(yes)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000549 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000550 AC_MSG_RESULT(no)
551 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000552 if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000553 AC_MSG_RESULT(yes)
554 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaard7afed32007-05-06 13:26:41 +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 /usr/include/plt/)
558 if test -f /usr/include/plt/scheme.h; then
559 AC_MSG_RESULT(yes)
560 SCHEME_INC=/usr/include/plt
561 else
562 AC_MSG_RESULT(no)
563 vi_cv_path_mzscheme_pfx=
564 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000565 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000566 fi
567 fi
568
569 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000570 if test "x$MACOSX" = "xyes"; then
571 MZSCHEME_LIBS="-framework PLT_MzScheme"
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000572 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
573 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
574 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000575 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
Bram Moolenaar9048f942007-05-12 14:32:25 +0000576 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 +0000577 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000578 dnl Using shared objects
579 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
580 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
581 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
582 else
583 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
584 fi
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000585 if test "$GCC" = yes; then
586 dnl Make Vim remember the path to the library. For when it's not in
587 dnl $LD_LIBRARY_PATH.
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000588 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000589 elif test "`(uname) 2>/dev/null`" = SunOS &&
590 uname -r | grep '^5' >/dev/null; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000591 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000592 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000593 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000594 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
595 SCHEME_COLLECTS=lib/plt/
596 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000597 if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
598 dnl need to generate bytecode for MzScheme base
599 MZSCHEME_EXTRA="mzscheme_base.c"
600 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
601 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
602 fi
603 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaard7afed32007-05-06 13:26:41 +0000604 -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000605 MZSCHEME_SRC="if_mzsch.c"
606 MZSCHEME_OBJ="objects/if_mzsch.o"
607 MZSCHEME_PRO="if_mzsch.pro"
608 AC_DEFINE(FEAT_MZSCHEME)
609 fi
610 AC_SUBST(MZSCHEME_SRC)
611 AC_SUBST(MZSCHEME_OBJ)
612 AC_SUBST(MZSCHEME_PRO)
613 AC_SUBST(MZSCHEME_LIBS)
614 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000615 AC_SUBST(MZSCHEME_EXTRA)
616 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000617fi
618
619
Bram Moolenaar071d4272004-06-13 20:20:40 +0000620AC_MSG_CHECKING(--enable-perlinterp argument)
621AC_ARG_ENABLE(perlinterp,
622 [ --enable-perlinterp Include Perl interpreter.], ,
623 [enable_perlinterp="no"])
624AC_MSG_RESULT($enable_perlinterp)
625if test "$enable_perlinterp" = "yes"; then
626 AC_SUBST(vi_cv_path_perl)
627 AC_PATH_PROG(vi_cv_path_perl, perl)
628 if test "X$vi_cv_path_perl" != "X"; then
629 AC_MSG_CHECKING(Perl version)
630 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
631 eval `$vi_cv_path_perl -V:usethreads`
632 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
633 badthreads=no
634 else
635 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
636 eval `$vi_cv_path_perl -V:use5005threads`
637 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
638 badthreads=no
639 else
640 badthreads=yes
641 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
642 fi
643 else
644 badthreads=yes
645 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
646 fi
647 fi
648 if test $badthreads = no; then
649 AC_MSG_RESULT(OK)
650 eval `$vi_cv_path_perl -V:shrpenv`
651 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
652 shrpenv=""
653 fi
654 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
655 AC_SUBST(vi_cv_perllib)
656 dnl Remove "-fno-something", it breaks using cproto.
657 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
658 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
659 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
660 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
661 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
662 -e 's/-bE:perl.exp//' -e 's/-lc //'`
663 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
664 dnl a test in configure may fail because of that.
665 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
666 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
667
668 dnl check that compiling a simple program still works with the flags
669 dnl added for Perl.
670 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
671 cflags_save=$CFLAGS
672 libs_save=$LIBS
673 ldflags_save=$LDFLAGS
674 CFLAGS="$CFLAGS $perlcppflags"
675 LIBS="$LIBS $perllibs"
676 LDFLAGS="$perlldflags $LDFLAGS"
677 AC_TRY_LINK(,[ ],
678 AC_MSG_RESULT(yes); perl_ok=yes,
679 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
680 CFLAGS=$cflags_save
681 LIBS=$libs_save
682 LDFLAGS=$ldflags_save
683 if test $perl_ok = yes; then
684 if test "X$perlcppflags" != "X"; then
Bram Moolenaard7afed32007-05-06 13:26:41 +0000685 dnl remove -pipe and -Wxxx, it confuses cproto
686 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000687 fi
688 if test "X$perlldflags" != "X"; then
689 LDFLAGS="$perlldflags $LDFLAGS"
690 fi
691 PERL_LIBS=$perllibs
692 PERL_SRC="auto/if_perl.c if_perlsfio.c"
693 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
694 PERL_PRO="if_perl.pro if_perlsfio.pro"
695 AC_DEFINE(FEAT_PERL)
696 fi
697 fi
698 else
699 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
700 fi
701 fi
702
703 if test "x$MACOSX" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +0000704 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000705 dir=/System/Library/Perl
706 darwindir=$dir/darwin
707 if test -d $darwindir; then
708 PERL=/usr/bin/perl
709 else
710 dnl Mac OS X 10.3
711 dir=/System/Library/Perl/5.8.1
712 darwindir=$dir/darwin-thread-multi-2level
713 if test -d $darwindir; then
714 PERL=/usr/bin/perl
715 fi
716 fi
717 if test -n "$PERL"; then
718 PERL_DIR="$dir"
719 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
720 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
721 PERL_LIBS="-L$darwindir/CORE -lperl"
722 fi
723 fi
724fi
725AC_SUBST(shrpenv)
726AC_SUBST(PERL_SRC)
727AC_SUBST(PERL_OBJ)
728AC_SUBST(PERL_PRO)
729AC_SUBST(PERL_CFLAGS)
730AC_SUBST(PERL_LIBS)
731
732AC_MSG_CHECKING(--enable-pythoninterp argument)
733AC_ARG_ENABLE(pythoninterp,
734 [ --enable-pythoninterp Include Python interpreter.], ,
735 [enable_pythoninterp="no"])
736AC_MSG_RESULT($enable_pythoninterp)
737if test "$enable_pythoninterp" = "yes"; then
738 dnl -- find the python executable
739 AC_PATH_PROG(vi_cv_path_python, python)
740 if test "X$vi_cv_path_python" != "X"; then
741
742 dnl -- get its version number
743 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
744 [[vi_cv_var_python_version=`
745 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
746 ]])
747
748 dnl -- it must be at least version 1.4
749 AC_MSG_CHECKING(Python is 1.4 or better)
750 if ${vi_cv_path_python} -c \
751 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
752 then
753 AC_MSG_RESULT(yep)
754
755 dnl -- find where python thinks it was installed
756 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
757 [ vi_cv_path_python_pfx=`
758 ${vi_cv_path_python} -c \
759 "import sys; print sys.prefix"` ])
760
761 dnl -- and where it thinks it runs
762 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
763 [ vi_cv_path_python_epfx=`
764 ${vi_cv_path_python} -c \
765 "import sys; print sys.exec_prefix"` ])
766
767 dnl -- python's internal library path
768
769 AC_CACHE_VAL(vi_cv_path_pythonpath,
770 [ vi_cv_path_pythonpath=`
771 unset PYTHONPATH;
772 ${vi_cv_path_python} -c \
773 "import sys, string; print string.join(sys.path,':')"` ])
774
775 dnl -- where the Python implementation library archives are
776
777 AC_ARG_WITH(python-config-dir,
778 [ --with-python-config-dir=PATH Python's config directory],
779 [ vi_cv_path_python_conf="${withval}" ] )
780
781 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
782 [
783 vi_cv_path_python_conf=
784 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
Bram Moolenaar72951072009-12-02 16:58:33 +0000785 for subdir in lib64 lib share; do
Bram Moolenaar071d4272004-06-13 20:20:40 +0000786 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
787 if test -d "$d" && test -f "$d/config.c"; then
788 vi_cv_path_python_conf="$d"
789 fi
790 done
791 done
792 ])
793
794 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
795
796 if test "X$PYTHON_CONFDIR" = "X"; then
797 AC_MSG_RESULT([can't find it!])
798 else
799
800 dnl -- we need to examine Python's config/Makefile too
801 dnl see what the interpreter is built from
802 AC_CACHE_VAL(vi_cv_path_python_plibs,
803 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000804 pwd=`pwd`
805 tmp_mkf="$pwd/config-PyMake$$"
806 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000807__:
Bram Moolenaar218116c2010-05-20 21:46:00 +0200808 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000809 @echo "python_LIBS='$(LIBS)'"
810 @echo "python_SYSLIBS='$(SYSLIBS)'"
811 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
812eof
813 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000814 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
815 rm -f -- "${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000816 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
817 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
818 vi_cv_path_python_plibs="-framework Python"
819 else
820 if test "${vi_cv_var_python_version}" = "1.4"; then
821 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
822 else
823 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
824 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +0200825 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 +0000826 dnl remove -ltermcap, it can conflict with an earlier -lncurses
827 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
828 fi
829 ])
830
831 PYTHON_LIBS="${vi_cv_path_python_plibs}"
832 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
833 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
834 else
835 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}"
836 fi
837 PYTHON_SRC="if_python.c"
838 dnl For Mac OSX 10.2 config.o is included in the Python library.
839 if test "x$MACOSX" = "xyes"; then
840 PYTHON_OBJ="objects/if_python.o"
841 else
842 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
843 fi
844 if test "${vi_cv_var_python_version}" = "1.4"; then
845 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
846 fi
847 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
848
849 dnl On FreeBSD linking with "-pthread" is required to use threads.
850 dnl _THREAD_SAFE must be used for compiling then.
851 dnl The "-pthread" is added to $LIBS, so that the following check for
852 dnl sigaltstack() will look in libc_r (it's there in libc!).
853 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
854 dnl will then define target-specific defines, e.g., -D_REENTRANT.
855 dnl Don't do this for Mac OSX, -pthread will generate a warning.
856 AC_MSG_CHECKING([if -pthread should be used])
857 threadsafe_flag=
858 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000859 dnl if test "x$MACOSX" != "xyes"; then
860 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000861 test "$GCC" = yes && threadsafe_flag="-pthread"
862 if test "`(uname) 2>/dev/null`" = FreeBSD; then
863 threadsafe_flag="-D_THREAD_SAFE"
864 thread_lib="-pthread"
865 fi
866 fi
867 libs_save_old=$LIBS
868 if test -n "$threadsafe_flag"; then
869 cflags_save=$CFLAGS
870 CFLAGS="$CFLAGS $threadsafe_flag"
871 LIBS="$LIBS $thread_lib"
872 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200873 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000874 AC_MSG_RESULT(no); LIBS=$libs_save_old
875 )
876 CFLAGS=$cflags_save
877 else
878 AC_MSG_RESULT(no)
879 fi
880
881 dnl check that compiling a simple program still works with the flags
882 dnl added for Python.
883 AC_MSG_CHECKING([if compile and link flags for Python are sane])
884 cflags_save=$CFLAGS
885 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200886 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000887 LIBS="$LIBS $PYTHON_LIBS"
888 AC_TRY_LINK(,[ ],
889 AC_MSG_RESULT(yes); python_ok=yes,
890 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
891 CFLAGS=$cflags_save
892 LIBS=$libs_save
893 if test $python_ok = yes; then
894 AC_DEFINE(FEAT_PYTHON)
895 else
896 LIBS=$libs_save_old
897 PYTHON_SRC=
898 PYTHON_OBJ=
899 PYTHON_LIBS=
900 PYTHON_CFLAGS=
901 fi
902
903 fi
904 else
905 AC_MSG_RESULT(too old)
906 fi
907 fi
908fi
909AC_SUBST(PYTHON_CONFDIR)
910AC_SUBST(PYTHON_LIBS)
911AC_SUBST(PYTHON_GETPATH_CFLAGS)
912AC_SUBST(PYTHON_CFLAGS)
913AC_SUBST(PYTHON_SRC)
914AC_SUBST(PYTHON_OBJ)
915
916AC_MSG_CHECKING(--enable-tclinterp argument)
917AC_ARG_ENABLE(tclinterp,
918 [ --enable-tclinterp Include Tcl interpreter.], ,
919 [enable_tclinterp="no"])
920AC_MSG_RESULT($enable_tclinterp)
921
922if test "$enable_tclinterp" = "yes"; then
923
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000924 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +0000925 AC_MSG_CHECKING(--with-tclsh argument)
926 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
927 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000928 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000929 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
930 AC_SUBST(vi_cv_path_tcl)
931
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000932 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
933 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
934 tclsh_name="tclsh8.4"
935 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
936 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000937 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000938 tclsh_name="tclsh8.2"
939 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
940 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000941 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
942 tclsh_name="tclsh8.0"
943 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
944 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000945 dnl still didn't find it, try without version number
946 if test "X$vi_cv_path_tcl" = "X"; then
947 tclsh_name="tclsh"
948 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
949 fi
950 if test "X$vi_cv_path_tcl" != "X"; then
951 AC_MSG_CHECKING(Tcl version)
952 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
953 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
954 AC_MSG_RESULT($tclver - OK);
955 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 -`
956
957 AC_MSG_CHECKING(for location of Tcl include)
958 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +0000959 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 +0000960 else
961 dnl For Mac OS X 10.3, use the OS-provided framework location
962 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
963 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +0000964 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000965 for try in $tclinc; do
966 if test -f "$try/tcl.h"; then
967 AC_MSG_RESULT($try/tcl.h)
968 TCL_INC=$try
969 break
970 fi
971 done
972 if test -z "$TCL_INC"; then
973 AC_MSG_RESULT(<not found>)
974 SKIP_TCL=YES
975 fi
976 if test -z "$SKIP_TCL"; then
977 AC_MSG_CHECKING(for location of tclConfig.sh script)
978 if test "x$MACOSX" != "xyes"; then
979 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000980 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000981 else
982 dnl For Mac OS X 10.3, use the OS-provided framework location
983 tclcnf="/System/Library/Frameworks/Tcl.framework"
984 fi
985 for try in $tclcnf; do
986 if test -f $try/tclConfig.sh; then
987 AC_MSG_RESULT($try/tclConfig.sh)
988 . $try/tclConfig.sh
989 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
990 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
991 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000992 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +0000993 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 +0000994 break
995 fi
996 done
997 if test -z "$TCL_LIBS"; then
998 AC_MSG_RESULT(<not found>)
999 AC_MSG_CHECKING(for Tcl library by myself)
1000 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001001 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001002 for ext in .so .a ; do
1003 for ver in "" $tclver ; do
1004 for try in $tcllib ; do
1005 trylib=tcl$ver$ext
1006 if test -f $try/lib$trylib ; then
1007 AC_MSG_RESULT($try/lib$trylib)
1008 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
1009 if test "`(uname) 2>/dev/null`" = SunOS &&
1010 uname -r | grep '^5' >/dev/null; then
1011 TCL_LIBS="$TCL_LIBS -R $try"
1012 fi
1013 break 3
1014 fi
1015 done
1016 done
1017 done
1018 if test -z "$TCL_LIBS"; then
1019 AC_MSG_RESULT(<not found>)
1020 SKIP_TCL=YES
1021 fi
1022 fi
1023 if test -z "$SKIP_TCL"; then
1024 AC_DEFINE(FEAT_TCL)
1025 TCL_SRC=if_tcl.c
1026 TCL_OBJ=objects/if_tcl.o
1027 TCL_PRO=if_tcl.pro
1028 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1029 fi
1030 fi
1031 else
1032 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
1033 fi
1034 fi
1035fi
1036AC_SUBST(TCL_SRC)
1037AC_SUBST(TCL_OBJ)
1038AC_SUBST(TCL_PRO)
1039AC_SUBST(TCL_CFLAGS)
1040AC_SUBST(TCL_LIBS)
1041
1042AC_MSG_CHECKING(--enable-rubyinterp argument)
1043AC_ARG_ENABLE(rubyinterp,
1044 [ --enable-rubyinterp Include Ruby interpreter.], ,
1045 [enable_rubyinterp="no"])
1046AC_MSG_RESULT($enable_rubyinterp)
1047if test "$enable_rubyinterp" = "yes"; then
Bram Moolenaar165641d2010-02-17 16:23:09 +01001048 AC_MSG_CHECKING(--with-ruby-command argument)
1049 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
1050 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
1051 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001052 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001053 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001054 if test "X$vi_cv_path_ruby" != "X"; then
1055 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +00001056 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 +00001057 AC_MSG_RESULT(OK)
1058 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001059 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 +00001060 if test "X$rubyhdrdir" != "X"; then
1061 AC_MSG_RESULT($rubyhdrdir)
1062 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01001063 rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
1064 if test -d "$rubyhdrdir/$rubyarch"; then
1065 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
1066 fi
1067 rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
1068 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001069 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
1070 if test "X$rubylibs" != "X"; then
1071 RUBY_LIBS="$rubylibs"
1072 fi
1073 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
1074 if test -f "$rubyhdrdir/$librubyarg"; then
1075 librubyarg="$rubyhdrdir/$librubyarg"
1076 else
1077 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
1078 if test -f "$rubylibdir/$librubyarg"; then
1079 librubyarg="$rubylibdir/$librubyarg"
1080 elif test "$librubyarg" = "libruby.a"; then
1081 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1082 librubyarg="-lruby"
1083 else
1084 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
1085 fi
1086 fi
1087
1088 if test "X$librubyarg" != "X"; then
1089 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1090 fi
1091 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
1092 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001093 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1094 dnl be included if requested by passing --with-mac-arch to
1095 dnl configure, so strip these flags first (if present)
1096 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//'`
1097 if test "X$rubyldflags" != "X"; then
1098 LDFLAGS="$rubyldflags $LDFLAGS"
1099 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001100 fi
1101 RUBY_SRC="if_ruby.c"
1102 RUBY_OBJ="objects/if_ruby.o"
1103 RUBY_PRO="if_ruby.pro"
1104 AC_DEFINE(FEAT_RUBY)
1105 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001106 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001107 fi
1108 else
1109 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1110 fi
1111 fi
1112fi
1113AC_SUBST(RUBY_SRC)
1114AC_SUBST(RUBY_OBJ)
1115AC_SUBST(RUBY_PRO)
1116AC_SUBST(RUBY_CFLAGS)
1117AC_SUBST(RUBY_LIBS)
1118
1119AC_MSG_CHECKING(--enable-cscope argument)
1120AC_ARG_ENABLE(cscope,
1121 [ --enable-cscope Include cscope interface.], ,
1122 [enable_cscope="no"])
1123AC_MSG_RESULT($enable_cscope)
1124if test "$enable_cscope" = "yes"; then
1125 AC_DEFINE(FEAT_CSCOPE)
1126fi
1127
1128AC_MSG_CHECKING(--enable-workshop argument)
1129AC_ARG_ENABLE(workshop,
1130 [ --enable-workshop Include Sun Visual Workshop support.], ,
1131 [enable_workshop="no"])
1132AC_MSG_RESULT($enable_workshop)
1133if test "$enable_workshop" = "yes"; then
1134 AC_DEFINE(FEAT_SUN_WORKSHOP)
1135 WORKSHOP_SRC="workshop.c integration.c"
1136 AC_SUBST(WORKSHOP_SRC)
1137 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1138 AC_SUBST(WORKSHOP_OBJ)
1139 if test "${enable_gui-xxx}" = xxx; then
1140 enable_gui=motif
1141 fi
1142fi
1143
1144AC_MSG_CHECKING(--disable-netbeans argument)
1145AC_ARG_ENABLE(netbeans,
1146 [ --disable-netbeans Disable NetBeans integration support.],
1147 , [enable_netbeans="yes"])
1148if test "$enable_netbeans" = "yes"; then
1149 AC_MSG_RESULT(no)
1150 dnl On Solaris we need the socket and nsl library.
1151 AC_CHECK_LIB(socket, socket)
1152 AC_CHECK_LIB(nsl, gethostbyname)
1153 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1154 AC_TRY_LINK([
1155#include <stdio.h>
1156#include <stdlib.h>
1157#include <stdarg.h>
1158#include <fcntl.h>
1159#include <netdb.h>
1160#include <netinet/in.h>
1161#include <errno.h>
1162#include <sys/types.h>
1163#include <sys/socket.h>
1164 /* Check bitfields */
1165 struct nbbuf {
1166 unsigned int initDone:1;
1167 ushort signmaplen;
1168 };
1169 ], [
1170 /* Check creating a socket. */
1171 struct sockaddr_in server;
1172 (void)socket(AF_INET, SOCK_STREAM, 0);
1173 (void)htons(100);
1174 (void)gethostbyname("microsoft.com");
1175 if (errno == ECONNREFUSED)
1176 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1177 ],
1178 AC_MSG_RESULT(yes),
1179 AC_MSG_RESULT(no); enable_netbeans="no")
1180else
1181 AC_MSG_RESULT(yes)
1182fi
1183if test "$enable_netbeans" = "yes"; then
1184 AC_DEFINE(FEAT_NETBEANS_INTG)
1185 NETBEANS_SRC="netbeans.c"
1186 AC_SUBST(NETBEANS_SRC)
1187 NETBEANS_OBJ="objects/netbeans.o"
1188 AC_SUBST(NETBEANS_OBJ)
1189fi
1190
1191AC_MSG_CHECKING(--enable-sniff argument)
1192AC_ARG_ENABLE(sniff,
1193 [ --enable-sniff Include Sniff interface.], ,
1194 [enable_sniff="no"])
1195AC_MSG_RESULT($enable_sniff)
1196if test "$enable_sniff" = "yes"; then
1197 AC_DEFINE(FEAT_SNIFF)
1198 SNIFF_SRC="if_sniff.c"
1199 AC_SUBST(SNIFF_SRC)
1200 SNIFF_OBJ="objects/if_sniff.o"
1201 AC_SUBST(SNIFF_OBJ)
1202fi
1203
1204AC_MSG_CHECKING(--enable-multibyte argument)
1205AC_ARG_ENABLE(multibyte,
1206 [ --enable-multibyte Include multibyte editing support.], ,
1207 [enable_multibyte="no"])
1208AC_MSG_RESULT($enable_multibyte)
1209if test "$enable_multibyte" = "yes"; then
1210 AC_DEFINE(FEAT_MBYTE)
1211fi
1212
1213AC_MSG_CHECKING(--enable-hangulinput argument)
1214AC_ARG_ENABLE(hangulinput,
1215 [ --enable-hangulinput Include Hangul input support.], ,
1216 [enable_hangulinput="no"])
1217AC_MSG_RESULT($enable_hangulinput)
1218
1219AC_MSG_CHECKING(--enable-xim argument)
1220AC_ARG_ENABLE(xim,
1221 [ --enable-xim Include XIM input support.],
1222 AC_MSG_RESULT($enable_xim),
1223 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001224
1225AC_MSG_CHECKING(--enable-fontset argument)
1226AC_ARG_ENABLE(fontset,
1227 [ --enable-fontset Include X fontset output support.], ,
1228 [enable_fontset="no"])
1229AC_MSG_RESULT($enable_fontset)
1230dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1231
1232test -z "$with_x" && with_x=yes
1233test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1234if test "$with_x" = no; then
1235 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1236else
1237 dnl Do this check early, so that its failure can override user requests.
1238
1239 AC_PATH_PROG(xmkmfpath, xmkmf)
1240
1241 AC_PATH_XTRA
1242
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001243 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001244 dnl be compiled with a special option.
1245 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001246 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001247 CFLAGS="$CFLAGS -W c,dll"
1248 LDFLAGS="$LDFLAGS -W l,dll"
1249 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1250 fi
1251
1252 dnl On my HPUX system the X include dir is found, but the lib dir not.
1253 dnl This is a desparate try to fix this.
1254
1255 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1256 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1257 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1258 X_LIBS="$X_LIBS -L$x_libraries"
1259 if test "`(uname) 2>/dev/null`" = SunOS &&
1260 uname -r | grep '^5' >/dev/null; then
1261 X_LIBS="$X_LIBS -R $x_libraries"
1262 fi
1263 fi
1264
1265 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1266 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1267 AC_MSG_RESULT(Corrected X includes to $x_includes)
1268 X_CFLAGS="$X_CFLAGS -I$x_includes"
1269 fi
1270
1271 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1272 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1273 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1274 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1275 dnl Same for "-R/usr/lib ".
1276 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1277
1278
1279 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001280 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1281 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001282 AC_MSG_CHECKING(if X11 header files can be found)
1283 cflags_save=$CFLAGS
1284 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001285 AC_TRY_COMPILE([#include <X11/Xlib.h>
1286#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001287 AC_MSG_RESULT(yes),
1288 AC_MSG_RESULT(no); no_x=yes)
1289 CFLAGS=$cflags_save
1290
1291 if test "${no_x-no}" = yes; then
1292 with_x=no
1293 else
1294 AC_DEFINE(HAVE_X11)
1295 X_LIB="-lXt -lX11";
1296 AC_SUBST(X_LIB)
1297
1298 ac_save_LDFLAGS="$LDFLAGS"
1299 LDFLAGS="-L$x_libraries $LDFLAGS"
1300
1301 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1302 dnl For HP-UX 10.20 it must be before -lSM -lICE
1303 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1304 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1305
1306 dnl Some systems need -lnsl -lsocket when testing for ICE.
1307 dnl The check above doesn't do this, try here (again). Also needed to get
1308 dnl them after Xdmcp. link.sh will remove them when not needed.
1309 dnl Check for other function than above to avoid the cached value
1310 AC_CHECK_LIB(ICE, IceOpenConnection,
1311 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1312
1313 dnl Check for -lXpm (needed for some versions of Motif)
1314 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1315 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1316 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1317
1318 dnl Check that the X11 header files don't use implicit declarations
1319 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1320 cflags_save=$CFLAGS
1321 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1322 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1323 AC_MSG_RESULT(no),
1324 CFLAGS="$CFLAGS -Wno-implicit-int"
1325 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1326 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1327 AC_MSG_RESULT(test failed)
1328 )
1329 )
1330 CFLAGS=$cflags_save
1331
1332 LDFLAGS="$ac_save_LDFLAGS"
1333
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001334 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1335 AC_CACHE_VAL(ac_cv_small_wchar_t,
1336 [AC_TRY_RUN([
1337#include <X11/Xlib.h>
1338#if STDC_HEADERS
1339# include <stdlib.h>
1340# include <stddef.h>
1341#endif
1342 main()
1343 {
1344 if (sizeof(wchar_t) <= 2)
1345 exit(1);
1346 exit(0);
1347 }],
1348 ac_cv_small_wchar_t="no",
1349 ac_cv_small_wchar_t="yes",
1350 AC_MSG_ERROR(failed to compile test program))])
1351 AC_MSG_RESULT($ac_cv_small_wchar_t)
1352 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1353 AC_DEFINE(SMALL_WCHAR_T)
1354 fi
1355
Bram Moolenaar071d4272004-06-13 20:20:40 +00001356 fi
1357fi
1358
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001359test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001360
1361AC_MSG_CHECKING(--enable-gui argument)
1362AC_ARG_ENABLE(gui,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001363 [ --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 +00001364
1365dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1366dnl Do not use character classes for portability with old tools.
1367enable_gui_canon=`echo "_$enable_gui" | \
1368 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1369
1370dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001371SKIP_GTK2=YES
1372SKIP_GNOME=YES
1373SKIP_MOTIF=YES
1374SKIP_ATHENA=YES
1375SKIP_NEXTAW=YES
1376SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001377SKIP_CARBON=YES
1378GUITYPE=NONE
1379
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001380if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001381 SKIP_PHOTON=
1382 case "$enable_gui_canon" in
1383 no) AC_MSG_RESULT(no GUI support)
1384 SKIP_PHOTON=YES ;;
1385 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1386 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1387 photon) AC_MSG_RESULT(Photon GUI support) ;;
1388 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1389 SKIP_PHOTON=YES ;;
1390 esac
1391
1392elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1393 SKIP_CARBON=
1394 case "$enable_gui_canon" in
1395 no) AC_MSG_RESULT(no GUI support)
1396 SKIP_CARBON=YES ;;
1397 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
Bram Moolenaar164fca32010-07-14 13:58:07 +02001398 auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
1399 SKIP_CARBON=YES ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001400 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1401 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1402 SKIP_CARBON=YES ;;
1403 esac
1404
1405else
1406
Bram Moolenaar071d4272004-06-13 20:20:40 +00001407 case "$enable_gui_canon" in
1408 no|none) AC_MSG_RESULT(no GUI support) ;;
1409 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001410 SKIP_GTK2=
1411 SKIP_GNOME=
1412 SKIP_MOTIF=
1413 SKIP_ATHENA=
1414 SKIP_NEXTAW=
1415 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001416 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001417 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001418 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1419 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001420 SKIP_GTK2=;;
1421 motif) AC_MSG_RESULT(Motif GUI support)
1422 SKIP_MOTIF=;;
1423 athena) AC_MSG_RESULT(Athena GUI support)
1424 SKIP_ATHENA=;;
1425 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1426 SKIP_NEXTAW=;;
1427 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1428 esac
1429
1430fi
1431
Bram Moolenaar071d4272004-06-13 20:20:40 +00001432if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1433 -a "$enable_gui_canon" != "gnome2"; then
1434 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1435 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001436 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001437 , enable_gtk2_check="yes")
1438 AC_MSG_RESULT($enable_gtk2_check)
1439 if test "x$enable_gtk2_check" = "xno"; then
1440 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001441 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001442 fi
1443fi
1444
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001445if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001446 AC_MSG_CHECKING(whether or not to look for GNOME)
1447 AC_ARG_ENABLE(gnome-check,
1448 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1449 , enable_gnome_check="no")
1450 AC_MSG_RESULT($enable_gnome_check)
1451 if test "x$enable_gnome_check" = "xno"; then
1452 SKIP_GNOME=YES
1453 fi
1454fi
1455
1456if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1457 AC_MSG_CHECKING(whether or not to look for Motif)
1458 AC_ARG_ENABLE(motif-check,
1459 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1460 , enable_motif_check="yes")
1461 AC_MSG_RESULT($enable_motif_check)
1462 if test "x$enable_motif_check" = "xno"; then
1463 SKIP_MOTIF=YES
1464 fi
1465fi
1466
1467if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1468 AC_MSG_CHECKING(whether or not to look for Athena)
1469 AC_ARG_ENABLE(athena-check,
1470 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1471 , enable_athena_check="yes")
1472 AC_MSG_RESULT($enable_athena_check)
1473 if test "x$enable_athena_check" = "xno"; then
1474 SKIP_ATHENA=YES
1475 fi
1476fi
1477
1478if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1479 AC_MSG_CHECKING(whether or not to look for neXtaw)
1480 AC_ARG_ENABLE(nextaw-check,
1481 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1482 , enable_nextaw_check="yes")
1483 AC_MSG_RESULT($enable_nextaw_check);
1484 if test "x$enable_nextaw_check" = "xno"; then
1485 SKIP_NEXTAW=YES
1486 fi
1487fi
1488
1489if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1490 AC_MSG_CHECKING(whether or not to look for Carbon)
1491 AC_ARG_ENABLE(carbon-check,
1492 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1493 , enable_carbon_check="yes")
1494 AC_MSG_RESULT($enable_carbon_check);
1495 if test "x$enable_carbon_check" = "xno"; then
1496 SKIP_CARBON=YES
1497 fi
1498fi
1499
Bram Moolenaar843ee412004-06-30 16:16:41 +00001500
Bram Moolenaar071d4272004-06-13 20:20:40 +00001501if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1502 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001503 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001504 AC_MSG_RESULT(yes);
1505 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001506 if test "$VIMNAME" = "vim"; then
1507 VIMNAME=Vim
1508 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001509
Bram Moolenaar164fca32010-07-14 13:58:07 +02001510 if test "x$MACARCH" = "xboth"; then
1511 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
1512 else
1513 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
1514 fi
1515
Bram Moolenaar14716812006-05-04 21:54:08 +00001516 dnl Default install directory is not /usr/local
1517 if test x$prefix = xNONE; then
1518 prefix=/Applications
1519 fi
1520
1521 dnl Sorry for the hard coded default
1522 datadir='${prefix}/Vim.app/Contents/Resources'
1523
Bram Moolenaar071d4272004-06-13 20:20:40 +00001524 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001525 SKIP_GTK2=YES;
1526 SKIP_GNOME=YES;
1527 SKIP_MOTIF=YES;
1528 SKIP_ATHENA=YES;
1529 SKIP_NEXTAW=YES;
1530 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001531 SKIP_CARBON=YES
1532fi
1533
Bram Moolenaar071d4272004-06-13 20:20:40 +00001534dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001535dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001536dnl
1537dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001538dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001539dnl
1540AC_DEFUN(AM_PATH_GTK,
1541[
1542 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1543 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001544 min_gtk_version=ifelse([$1], ,2.2.0,$1)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001545 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1546 no_gtk=""
1547 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1548 && $PKG_CONFIG --exists gtk+-2.0; then
1549 {
1550 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1551 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1552 dnl something like that.
1553 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001554 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001555 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1556 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1557 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1558 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1559 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1560 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1561 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1562 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001563 else
1564 no_gtk=yes
1565 fi
1566
1567 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1568 {
1569 ac_save_CFLAGS="$CFLAGS"
1570 ac_save_LIBS="$LIBS"
1571 CFLAGS="$CFLAGS $GTK_CFLAGS"
1572 LIBS="$LIBS $GTK_LIBS"
1573
1574 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001575 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001576 dnl
1577 rm -f conf.gtktest
1578 AC_TRY_RUN([
1579#include <gtk/gtk.h>
1580#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001581#if STDC_HEADERS
1582# include <stdlib.h>
1583# include <stddef.h>
1584#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001585
1586int
1587main ()
1588{
1589int major, minor, micro;
1590char *tmp_version;
1591
1592system ("touch conf.gtktest");
1593
1594/* HP/UX 9 (%@#!) writes to sscanf strings */
1595tmp_version = g_strdup("$min_gtk_version");
1596if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1597 printf("%s, bad version string\n", "$min_gtk_version");
1598 exit(1);
1599 }
1600
1601if ((gtk_major_version > major) ||
1602 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1603 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1604 (gtk_micro_version >= micro)))
1605{
1606 return 0;
1607}
1608return 1;
1609}
1610],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1611 CFLAGS="$ac_save_CFLAGS"
1612 LIBS="$ac_save_LIBS"
1613 }
1614 fi
1615 if test "x$no_gtk" = x ; then
1616 if test "x$enable_gtktest" = "xyes"; then
1617 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1618 else
1619 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1620 fi
1621 ifelse([$2], , :, [$2])
1622 else
1623 {
1624 AC_MSG_RESULT(no)
1625 GTK_CFLAGS=""
1626 GTK_LIBS=""
1627 ifelse([$3], , :, [$3])
1628 }
1629 fi
1630 }
1631 else
1632 GTK_CFLAGS=""
1633 GTK_LIBS=""
1634 ifelse([$3], , :, [$3])
1635 fi
1636 AC_SUBST(GTK_CFLAGS)
1637 AC_SUBST(GTK_LIBS)
1638 rm -f conf.gtktest
1639])
1640
1641dnl ---------------------------------------------------------------------------
1642dnl gnome
1643dnl ---------------------------------------------------------------------------
1644AC_DEFUN([GNOME_INIT_HOOK],
1645[
1646 AC_SUBST(GNOME_LIBS)
1647 AC_SUBST(GNOME_LIBDIR)
1648 AC_SUBST(GNOME_INCLUDEDIR)
1649
1650 AC_ARG_WITH(gnome-includes,
1651 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1652 [CFLAGS="$CFLAGS -I$withval"]
1653 )
1654
1655 AC_ARG_WITH(gnome-libs,
1656 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1657 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1658 )
1659
1660 AC_ARG_WITH(gnome,
1661 [ --with-gnome Specify prefix for GNOME files],
1662 if test x$withval = xyes; then
1663 want_gnome=yes
1664 ifelse([$1], [], :, [$1])
1665 else
1666 if test "x$withval" = xno; then
1667 want_gnome=no
1668 else
1669 want_gnome=yes
1670 LDFLAGS="$LDFLAGS -L$withval/lib"
1671 CFLAGS="$CFLAGS -I$withval/include"
1672 gnome_prefix=$withval/lib
1673 fi
1674 fi,
1675 want_gnome=yes)
1676
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001677 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001678 {
1679 AC_MSG_CHECKING(for libgnomeui-2.0)
1680 if $PKG_CONFIG --exists libgnomeui-2.0; then
1681 AC_MSG_RESULT(yes)
1682 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1683 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1684 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001685
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001686 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1687 dnl This might not be the right way but it works for me...
1688 AC_MSG_CHECKING(for FreeBSD)
1689 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1690 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001691 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001692 GNOME_LIBS="$GNOME_LIBS -pthread"
1693 else
1694 AC_MSG_RESULT(no)
1695 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001696 $1
1697 else
1698 AC_MSG_RESULT(not found)
1699 if test "x$2" = xfail; then
1700 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1701 fi
1702 fi
1703 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001704 fi
1705])
1706
1707AC_DEFUN([GNOME_INIT],[
1708 GNOME_INIT_HOOK([],fail)
1709])
1710
1711
1712dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001713dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001714dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001715if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001716
1717 AC_MSG_CHECKING(--disable-gtktest argument)
1718 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1719 , enable_gtktest=yes)
1720 if test "x$enable_gtktest" = "xyes" ; then
1721 AC_MSG_RESULT(gtk test enabled)
1722 else
1723 AC_MSG_RESULT(gtk test disabled)
1724 fi
1725
Bram Moolenaar071d4272004-06-13 20:20:40 +00001726 if test "X$PKG_CONFIG" = "X"; then
1727 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1728 fi
1729
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001730 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001731 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1732 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001733 AM_PATH_GTK(2.2.0,
1734 [GUI_LIB_LOC="$GTK_LIBDIR"
1735 GTK_LIBNAME="$GTK_LIBS"
1736 GUI_INC_LOC="$GTK_CFLAGS"], )
1737 if test "x$GTK_CFLAGS" != "x"; then
1738 SKIP_ATHENA=YES
1739 SKIP_NEXTAW=YES
1740 SKIP_MOTIF=YES
1741 GUITYPE=GTK
1742 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001743 fi
1744 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001745 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001746 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1747 || test "0$gtk_minor_version" -ge 2; then
1748 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1749 fi
1750 dnl
1751 dnl if GTK exists, then check for GNOME.
1752 dnl
1753 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001754 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001755 GNOME_INIT_HOOK([have_gnome=yes])
1756 if test "x$have_gnome" = xyes ; then
1757 AC_DEFINE(FEAT_GUI_GNOME)
1758 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1759 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001760 fi
1761 }
1762 fi
1763 fi
1764fi
1765
1766dnl Check for Motif include files location.
1767dnl The LAST one found is used, this makes the highest version to be used,
1768dnl e.g. when Motif1.2 and Motif2.0 are both present.
1769
1770if test -z "$SKIP_MOTIF"; then
1771 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"
1772 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1773 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1774
1775 AC_MSG_CHECKING(for location of Motif GUI includes)
1776 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1777 GUI_INC_LOC=
1778 for try in $gui_includes; do
1779 if test -f "$try/Xm/Xm.h"; then
1780 GUI_INC_LOC=$try
1781 fi
1782 done
1783 if test -n "$GUI_INC_LOC"; then
1784 if test "$GUI_INC_LOC" = /usr/include; then
1785 GUI_INC_LOC=
1786 AC_MSG_RESULT(in default path)
1787 else
1788 AC_MSG_RESULT($GUI_INC_LOC)
1789 fi
1790 else
1791 AC_MSG_RESULT(<not found>)
1792 SKIP_MOTIF=YES
1793 fi
1794fi
1795
1796dnl Check for Motif library files location. In the same order as the include
1797dnl files, to avoid a mixup if several versions are present
1798
1799if test -z "$SKIP_MOTIF"; then
1800 AC_MSG_CHECKING(--with-motif-lib argument)
1801 AC_ARG_WITH(motif-lib,
1802 [ --with-motif-lib=STRING Library for Motif ],
1803 [ MOTIF_LIBNAME="${withval}" ] )
1804
1805 if test -n "$MOTIF_LIBNAME"; then
1806 AC_MSG_RESULT($MOTIF_LIBNAME)
1807 GUI_LIB_LOC=
1808 else
1809 AC_MSG_RESULT(no)
1810
1811 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1812 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1813
1814 AC_MSG_CHECKING(for location of Motif GUI libs)
1815 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"
1816 GUI_LIB_LOC=
1817 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001818 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00001819 if test -f "$libtry"; then
1820 GUI_LIB_LOC=$try
1821 fi
1822 done
1823 done
1824 if test -n "$GUI_LIB_LOC"; then
1825 dnl Remove /usr/lib, it causes trouble on some systems
1826 if test "$GUI_LIB_LOC" = /usr/lib; then
1827 GUI_LIB_LOC=
1828 AC_MSG_RESULT(in default path)
1829 else
1830 if test -n "$GUI_LIB_LOC"; then
1831 AC_MSG_RESULT($GUI_LIB_LOC)
1832 if test "`(uname) 2>/dev/null`" = SunOS &&
1833 uname -r | grep '^5' >/dev/null; then
1834 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1835 fi
1836 fi
1837 fi
1838 MOTIF_LIBNAME=-lXm
1839 else
1840 AC_MSG_RESULT(<not found>)
1841 SKIP_MOTIF=YES
1842 fi
1843 fi
1844fi
1845
1846if test -z "$SKIP_MOTIF"; then
1847 SKIP_ATHENA=YES
1848 SKIP_NEXTAW=YES
1849 GUITYPE=MOTIF
1850 AC_SUBST(MOTIF_LIBNAME)
1851fi
1852
1853dnl Check if the Athena files can be found
1854
1855GUI_X_LIBS=
1856
1857if test -z "$SKIP_ATHENA"; then
1858 AC_MSG_CHECKING(if Athena header files can be found)
1859 cflags_save=$CFLAGS
1860 CFLAGS="$CFLAGS $X_CFLAGS"
1861 AC_TRY_COMPILE([
1862#include <X11/Intrinsic.h>
1863#include <X11/Xaw/Paned.h>], ,
1864 AC_MSG_RESULT(yes),
1865 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1866 CFLAGS=$cflags_save
1867fi
1868
1869if test -z "$SKIP_ATHENA"; then
1870 GUITYPE=ATHENA
1871fi
1872
1873if test -z "$SKIP_NEXTAW"; then
1874 AC_MSG_CHECKING(if neXtaw header files can be found)
1875 cflags_save=$CFLAGS
1876 CFLAGS="$CFLAGS $X_CFLAGS"
1877 AC_TRY_COMPILE([
1878#include <X11/Intrinsic.h>
1879#include <X11/neXtaw/Paned.h>], ,
1880 AC_MSG_RESULT(yes),
1881 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1882 CFLAGS=$cflags_save
1883fi
1884
1885if test -z "$SKIP_NEXTAW"; then
1886 GUITYPE=NEXTAW
1887fi
1888
1889if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1890 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1891 dnl Avoid adding it when it twice
1892 if test -n "$GUI_INC_LOC"; then
1893 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1894 fi
1895 if test -n "$GUI_LIB_LOC"; then
1896 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1897 fi
1898
1899 dnl Check for -lXext and then for -lXmu
1900 ldflags_save=$LDFLAGS
1901 LDFLAGS="$X_LIBS $LDFLAGS"
1902 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1903 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1904 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1905 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1906 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1907 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1908 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1909 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1910 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1911 if test -z "$SKIP_MOTIF"; then
1912 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1913 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1914 fi
1915 LDFLAGS=$ldflags_save
1916
1917 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1918 AC_MSG_CHECKING(for extra X11 defines)
1919 NARROW_PROTO=
1920 rm -fr conftestdir
1921 if mkdir conftestdir; then
1922 cd conftestdir
1923 cat > Imakefile <<'EOF'
1924acfindx:
1925 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
1926EOF
1927 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1928 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
1929 fi
1930 cd ..
1931 rm -fr conftestdir
1932 fi
1933 if test -z "$NARROW_PROTO"; then
1934 AC_MSG_RESULT(no)
1935 else
1936 AC_MSG_RESULT($NARROW_PROTO)
1937 fi
1938 AC_SUBST(NARROW_PROTO)
1939fi
1940
1941dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
1942dnl use the X11 include path
1943if test "$enable_xsmp" = "yes"; then
1944 cppflags_save=$CPPFLAGS
1945 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1946 AC_CHECK_HEADERS(X11/SM/SMlib.h)
1947 CPPFLAGS=$cppflags_save
1948fi
1949
1950
Bram Moolenaare667c952010-07-05 22:57:59 +02001951if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001952 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
1953 cppflags_save=$CPPFLAGS
1954 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1955 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
1956
1957 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
1958 if test ! "$enable_xim" = "no"; then
1959 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
1960 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
1961 AC_MSG_RESULT(yes),
1962 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
1963 fi
1964 CPPFLAGS=$cppflags_save
1965
1966 dnl automatically enable XIM when hangul input isn't enabled
1967 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
1968 -a "x$GUITYPE" != "xNONE" ; then
1969 AC_MSG_RESULT(X GUI selected; xim has been enabled)
1970 enable_xim="yes"
1971 fi
1972fi
1973
1974if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1975 cppflags_save=$CPPFLAGS
1976 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001977dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
1978 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
1979 AC_TRY_COMPILE([
1980#include <X11/Intrinsic.h>
1981#include <X11/Xmu/Editres.h>],
1982 [int i; i = 0;],
1983 AC_MSG_RESULT(yes)
1984 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
1985 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001986 CPPFLAGS=$cppflags_save
1987fi
1988
1989dnl Only use the Xm directory when compiling Motif, don't use it for Athena
1990if test -z "$SKIP_MOTIF"; then
1991 cppflags_save=$CPPFLAGS
1992 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001993 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 +00001994 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001995
1996 if test $ac_cv_header_Xm_XpmP_h = yes; then
1997 dnl Solaris uses XpmAttributes_21, very annoying.
1998 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
1999 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
2000 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
2001 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2002 )
2003 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00002004 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002005 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002006 CPPFLAGS=$cppflags_save
2007fi
2008
2009if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
2010 AC_MSG_RESULT(no GUI selected; xim has been disabled)
2011 enable_xim="no"
2012fi
2013if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
2014 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
2015 enable_fontset="no"
2016fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002017if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002018 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
2019 enable_fontset="no"
2020fi
2021
Bram Moolenaar071d4272004-06-13 20:20:40 +00002022if test -z "$SKIP_PHOTON"; then
2023 GUITYPE=PHOTONGUI
2024fi
2025
2026AC_SUBST(GUI_INC_LOC)
2027AC_SUBST(GUI_LIB_LOC)
2028AC_SUBST(GUITYPE)
2029AC_SUBST(GUI_X_LIBS)
2030
2031if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2032 AC_MSG_ERROR([cannot use workshop without Motif])
2033fi
2034
2035dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2036if test "$enable_xim" = "yes"; then
2037 AC_DEFINE(FEAT_XIM)
2038fi
2039if test "$enable_fontset" = "yes"; then
2040 AC_DEFINE(FEAT_XFONTSET)
2041fi
2042
2043
2044dnl ---------------------------------------------------------------------------
2045dnl end of GUI-checking
2046dnl ---------------------------------------------------------------------------
2047
2048
2049dnl Only really enable hangul input when GUI and XFONTSET are available
2050if test "$enable_hangulinput" = "yes"; then
2051 if test "x$GUITYPE" = "xNONE"; then
2052 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2053 enable_hangulinput=no
2054 else
2055 AC_DEFINE(FEAT_HANGULIN)
2056 HANGULIN_SRC=hangulin.c
2057 AC_SUBST(HANGULIN_SRC)
2058 HANGULIN_OBJ=objects/hangulin.o
2059 AC_SUBST(HANGULIN_OBJ)
2060 fi
2061fi
2062
2063dnl Checks for libraries and include files.
2064
Bram Moolenaar446cb832008-06-24 21:56:24 +00002065AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
2066 [
2067 AC_RUN_IFELSE([[
2068#include "confdefs.h"
2069#include <ctype.h>
2070#if STDC_HEADERS
2071# include <stdlib.h>
2072# include <stddef.h>
2073#endif
2074main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2075 ]],[
2076 vim_cv_toupper_broken=yes
2077 ],[
2078 vim_cv_toupper_broken=no
2079 ],[
2080 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2081 ])])
2082
2083if test "x$vim_cv_toupper_broken" = "xyes" ; then
2084 AC_DEFINE(BROKEN_TOUPPER)
2085fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002086
2087AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002088AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002089 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2090 AC_MSG_RESULT(no))
2091
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002092AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2093AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2094 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2095 AC_MSG_RESULT(no))
2096
Bram Moolenaar071d4272004-06-13 20:20:40 +00002097dnl Checks for header files.
2098AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2099dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2100if test "$HAS_ELF" = 1; then
2101 AC_CHECK_LIB(elf, main)
2102fi
2103
2104AC_HEADER_DIRENT
2105
Bram Moolenaar071d4272004-06-13 20:20:40 +00002106dnl If sys/wait.h is not found it might still exist but not be POSIX
2107dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2108if test $ac_cv_header_sys_wait_h = no; then
2109 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2110 AC_TRY_COMPILE([#include <sys/wait.h>],
2111 [union wait xx, yy; xx = yy],
2112 AC_MSG_RESULT(yes)
2113 AC_DEFINE(HAVE_SYS_WAIT_H)
2114 AC_DEFINE(HAVE_UNION_WAIT),
2115 AC_MSG_RESULT(no))
2116fi
2117
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002118AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2119 sys/select.h sys/utsname.h termcap.h fcntl.h \
2120 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2121 termio.h iconv.h inttypes.h langinfo.h math.h \
2122 unistd.h stropts.h errno.h sys/resource.h \
2123 sys/systeminfo.h locale.h sys/stream.h termios.h \
2124 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2125 utime.h sys/param.h libintl.h libgen.h \
2126 util/debug.h util/msg18n.h frame.h sys/acl.h \
2127 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002128
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002129dnl sys/ptem.h depends on sys/stream.h on Solaris
2130AC_CHECK_HEADERS(sys/ptem.h, [], [],
2131[#if defined HAVE_SYS_STREAM_H
2132# include <sys/stream.h>
2133#endif])
2134
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002135dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2136AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2137[#if defined HAVE_SYS_PARAM_H
2138# include <sys/param.h>
2139#endif])
2140
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002141
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002142dnl pthread_np.h may exist but can only be used after including pthread.h
2143AC_MSG_CHECKING([for pthread_np.h])
2144AC_TRY_COMPILE([
2145#include <pthread.h>
2146#include <pthread_np.h>],
2147 [int i; i = 0;],
2148 AC_MSG_RESULT(yes)
2149 AC_DEFINE(HAVE_PTHREAD_NP_H),
2150 AC_MSG_RESULT(no))
2151
Bram Moolenaare344bea2005-09-01 20:46:49 +00002152AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002153if test "x$MACOSX" = "xyes"; then
2154 dnl The strings.h file on OS/X contains a warning and nothing useful.
2155 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2156else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002157
2158dnl Check if strings.h and string.h can both be included when defined.
2159AC_MSG_CHECKING([if strings.h can be included after string.h])
2160cppflags_save=$CPPFLAGS
2161CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2162AC_TRY_COMPILE([
2163#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2164# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2165 /* but don't do it on AIX 5.1 (Uribarri) */
2166#endif
2167#ifdef HAVE_XM_XM_H
2168# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2169#endif
2170#ifdef HAVE_STRING_H
2171# include <string.h>
2172#endif
2173#if defined(HAVE_STRINGS_H)
2174# include <strings.h>
2175#endif
2176 ], [int i; i = 0;],
2177 AC_MSG_RESULT(yes),
2178 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2179 AC_MSG_RESULT(no))
2180CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002181fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002182
2183dnl Checks for typedefs, structures, and compiler characteristics.
2184AC_PROG_GCC_TRADITIONAL
2185AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002186AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002187AC_TYPE_MODE_T
2188AC_TYPE_OFF_T
2189AC_TYPE_PID_T
2190AC_TYPE_SIZE_T
2191AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002192AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002193
Bram Moolenaar071d4272004-06-13 20:20:40 +00002194AC_HEADER_TIME
2195AC_CHECK_TYPE(ino_t, long)
2196AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002197AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002198
2199AC_MSG_CHECKING(for rlim_t)
2200if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2201 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2202else
2203 AC_EGREP_CPP(dnl
2204changequote(<<,>>)dnl
2205<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2206changequote([,]),
2207 [
2208#include <sys/types.h>
2209#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002210# include <stdlib.h>
2211# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002212#endif
2213#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002214# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002215#endif
2216 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2217 AC_MSG_RESULT($ac_cv_type_rlim_t)
2218fi
2219if test $ac_cv_type_rlim_t = no; then
2220 cat >> confdefs.h <<\EOF
2221#define rlim_t unsigned long
2222EOF
2223fi
2224
2225AC_MSG_CHECKING(for stack_t)
2226if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2227 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2228else
2229 AC_EGREP_CPP(stack_t,
2230 [
2231#include <sys/types.h>
2232#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002233# include <stdlib.h>
2234# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002235#endif
2236#include <signal.h>
2237 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2238 AC_MSG_RESULT($ac_cv_type_stack_t)
2239fi
2240if test $ac_cv_type_stack_t = no; then
2241 cat >> confdefs.h <<\EOF
2242#define stack_t struct sigaltstack
2243EOF
2244fi
2245
2246dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2247AC_MSG_CHECKING(whether stack_t has an ss_base field)
2248AC_TRY_COMPILE([
2249#include <sys/types.h>
2250#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002251# include <stdlib.h>
2252# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002253#endif
2254#include <signal.h>
2255#include "confdefs.h"
2256 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2257 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2258 AC_MSG_RESULT(no))
2259
2260olibs="$LIBS"
2261AC_MSG_CHECKING(--with-tlib argument)
2262AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2263if test -n "$with_tlib"; then
2264 AC_MSG_RESULT($with_tlib)
2265 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002266 AC_MSG_CHECKING(for linking with $with_tlib library)
2267 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2268 dnl Need to check for tgetent() below.
2269 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002270else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002271 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002272 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2273 dnl curses, because curses is much slower.
2274 dnl Newer versions of ncurses are preferred over anything.
2275 dnl Older versions of ncurses have bugs, get a new one!
2276 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002277 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002278 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002279 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002280 *) tlibs="ncurses termlib termcap curses";;
2281 esac
2282 for libname in $tlibs; do
2283 AC_CHECK_LIB(${libname}, tgetent,,)
2284 if test "x$olibs" != "x$LIBS"; then
2285 dnl It's possible that a library is found but it doesn't work
2286 dnl e.g., shared library that cannot be found
2287 dnl compile and run a test program to be sure
2288 AC_TRY_RUN([
2289#ifdef HAVE_TERMCAP_H
2290# include <termcap.h>
2291#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002292#if STDC_HEADERS
2293# include <stdlib.h>
2294# include <stddef.h>
2295#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002296main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2297 res="OK", res="FAIL", res="FAIL")
2298 if test "$res" = "OK"; then
2299 break
2300 fi
2301 AC_MSG_RESULT($libname library is not usable)
2302 LIBS="$olibs"
2303 fi
2304 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002305 if test "x$olibs" = "x$LIBS"; then
2306 AC_MSG_RESULT(no terminal library found)
2307 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002308fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002309
2310if test "x$olibs" = "x$LIBS"; then
2311 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002312 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002313 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2314 AC_MSG_RESULT(yes),
2315 AC_MSG_ERROR([NOT FOUND!
2316 You need to install a terminal library; for example ncurses.
2317 Or specify the name of the library with --with-tlib.]))
2318fi
2319
Bram Moolenaar446cb832008-06-24 21:56:24 +00002320AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2321 [
2322 AC_RUN_IFELSE([[
2323#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002324#ifdef HAVE_TERMCAP_H
2325# include <termcap.h>
2326#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002327#ifdef HAVE_STRING_H
2328# include <string.h>
2329#endif
2330#if STDC_HEADERS
2331# include <stdlib.h>
2332# include <stddef.h>
2333#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002334main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002335{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2336 ]],[
2337 vim_cv_terminfo=no
2338 ],[
2339 vim_cv_terminfo=yes
2340 ],[
2341 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2342 ])
2343 ])
2344
2345if test "x$vim_cv_terminfo" = "xyes" ; then
2346 AC_DEFINE(TERMINFO)
2347fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002348
2349if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002350 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2351 [
2352 AC_RUN_IFELSE([[
2353#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002354#ifdef HAVE_TERMCAP_H
2355# include <termcap.h>
2356#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002357#if STDC_HEADERS
2358# include <stdlib.h>
2359# include <stddef.h>
2360#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002361main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002362{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2363 ]],[
2364 vim_cv_tgent=zero
2365 ],[
2366 vim_cv_tgent=non-zero
2367 ],[
2368 AC_MSG_ERROR(failed to compile test program.)
2369 ])
2370 ])
2371
2372 if test "x$vim_cv_tgent" = "xzero" ; then
2373 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2374 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002375fi
2376
2377AC_MSG_CHECKING(whether termcap.h contains ospeed)
2378AC_TRY_LINK([
2379#ifdef HAVE_TERMCAP_H
2380# include <termcap.h>
2381#endif
2382 ], [ospeed = 20000],
2383 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2384 [AC_MSG_RESULT(no)
2385 AC_MSG_CHECKING(whether ospeed can be extern)
2386 AC_TRY_LINK([
2387#ifdef HAVE_TERMCAP_H
2388# include <termcap.h>
2389#endif
2390extern short ospeed;
2391 ], [ospeed = 20000],
2392 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2393 AC_MSG_RESULT(no))]
2394 )
2395
2396AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2397AC_TRY_LINK([
2398#ifdef HAVE_TERMCAP_H
2399# include <termcap.h>
2400#endif
2401 ], [if (UP == 0 && BC == 0) PC = 1],
2402 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2403 [AC_MSG_RESULT(no)
2404 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2405 AC_TRY_LINK([
2406#ifdef HAVE_TERMCAP_H
2407# include <termcap.h>
2408#endif
2409extern char *UP, *BC, PC;
2410 ], [if (UP == 0 && BC == 0) PC = 1],
2411 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2412 AC_MSG_RESULT(no))]
2413 )
2414
2415AC_MSG_CHECKING(whether tputs() uses outfuntype)
2416AC_TRY_COMPILE([
2417#ifdef HAVE_TERMCAP_H
2418# include <termcap.h>
2419#endif
2420 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2421 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2422 AC_MSG_RESULT(no))
2423
2424dnl On some SCO machines sys/select redefines struct timeval
2425AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2426AC_TRY_COMPILE([
2427#include <sys/types.h>
2428#include <sys/time.h>
2429#include <sys/select.h>], ,
2430 AC_MSG_RESULT(yes)
2431 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2432 AC_MSG_RESULT(no))
2433
2434dnl AC_DECL_SYS_SIGLIST
2435
2436dnl Checks for pty.c (copied from screen) ==========================
2437AC_MSG_CHECKING(for /dev/ptc)
2438if test -r /dev/ptc; then
2439 AC_DEFINE(HAVE_DEV_PTC)
2440 AC_MSG_RESULT(yes)
2441else
2442 AC_MSG_RESULT(no)
2443fi
2444
2445AC_MSG_CHECKING(for SVR4 ptys)
2446if test -c /dev/ptmx ; then
2447 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2448 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2449 AC_MSG_RESULT(no))
2450else
2451 AC_MSG_RESULT(no)
2452fi
2453
2454AC_MSG_CHECKING(for ptyranges)
2455if test -d /dev/ptym ; then
2456 pdir='/dev/ptym'
2457else
2458 pdir='/dev'
2459fi
2460dnl SCO uses ptyp%d
2461AC_EGREP_CPP(yes,
2462[#ifdef M_UNIX
2463 yes;
2464#endif
2465 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2466dnl if test -c /dev/ptyp19; then
2467dnl ptys=`echo /dev/ptyp??`
2468dnl else
2469dnl ptys=`echo $pdir/pty??`
2470dnl fi
2471if test "$ptys" != "$pdir/pty??" ; then
2472 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2473 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2474 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2475 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2476 AC_MSG_RESULT([$p0 / $p1])
2477else
2478 AC_MSG_RESULT([don't know])
2479fi
2480
2481dnl **** pty mode/group handling ****
2482dnl
2483dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002484rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002485AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2486 [
2487 AC_RUN_IFELSE([[
2488#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002489#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002490#if STDC_HEADERS
2491# include <stdlib.h>
2492# include <stddef.h>
2493#endif
2494#ifdef HAVE_UNISTD_H
2495#include <unistd.h>
2496#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002497#include <sys/stat.h>
2498#include <stdio.h>
2499main()
2500{
2501 struct stat sb;
2502 char *x,*ttyname();
2503 int om, m;
2504 FILE *fp;
2505
2506 if (!(x = ttyname(0))) exit(1);
2507 if (stat(x, &sb)) exit(1);
2508 om = sb.st_mode;
2509 if (om & 002) exit(0);
2510 m = system("mesg y");
2511 if (m == -1 || m == 127) exit(1);
2512 if (stat(x, &sb)) exit(1);
2513 m = sb.st_mode;
2514 if (chmod(x, om)) exit(1);
2515 if (m & 002) exit(0);
2516 if (sb.st_gid == getgid()) exit(1);
2517 if (!(fp=fopen("conftest_grp", "w")))
2518 exit(1);
2519 fprintf(fp, "%d\n", sb.st_gid);
2520 fclose(fp);
2521 exit(0);
2522}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002523 ]],[
2524 if test -f conftest_grp; then
2525 vim_cv_tty_group=`cat conftest_grp`
2526 if test "x$vim_cv_tty_mode" = "x" ; then
2527 vim_cv_tty_mode=0620
2528 fi
2529 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2530 else
2531 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002532 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002533 fi
2534 ],[
2535 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002536 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002537 ],[
2538 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2539 ])
2540 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002541rm -f conftest_grp
2542
Bram Moolenaar446cb832008-06-24 21:56:24 +00002543if test "x$vim_cv_tty_group" != "xworld" ; then
2544 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2545 if test "x$vim_cv_tty_mode" = "x" ; then
2546 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)])
2547 else
2548 AC_DEFINE(PTYMODE, 0620)
2549 fi
2550fi
2551
Bram Moolenaar071d4272004-06-13 20:20:40 +00002552dnl Checks for library functions. ===================================
2553
2554AC_TYPE_SIGNAL
2555
2556dnl find out what to use at the end of a signal function
2557if test $ac_cv_type_signal = void; then
2558 AC_DEFINE(SIGRETURN, [return])
2559else
2560 AC_DEFINE(SIGRETURN, [return 0])
2561fi
2562
2563dnl check if struct sigcontext is defined (used for SGI only)
2564AC_MSG_CHECKING(for struct sigcontext)
2565AC_TRY_COMPILE([
2566#include <signal.h>
2567test_sig()
2568{
2569 struct sigcontext *scont;
2570 scont = (struct sigcontext *)0;
2571 return 1;
2572} ], ,
2573 AC_MSG_RESULT(yes)
2574 AC_DEFINE(HAVE_SIGCONTEXT),
2575 AC_MSG_RESULT(no))
2576
2577dnl tricky stuff: try to find out if getcwd() is implemented with
2578dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002579AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2580 [
2581 AC_RUN_IFELSE([[
2582#include "confdefs.h"
2583#ifdef HAVE_UNISTD_H
2584#include <unistd.h>
2585#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002586char *dagger[] = { "IFS=pwd", 0 };
2587main()
2588{
2589 char buffer[500];
2590 extern char **environ;
2591 environ = dagger;
2592 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002593}
2594 ]],[
2595 vim_cv_getcwd_broken=no
2596 ],[
2597 vim_cv_getcwd_broken=yes
2598 ],[
2599 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2600 ])
2601 ])
2602
2603if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2604 AC_DEFINE(BAD_GETCWD)
2605fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002606
Bram Moolenaar25153e12010-02-24 14:47:08 +01002607dnl Check for functions in one big call, to reduce the size of configure.
2608dnl Can only be used for functions that do not require any include.
2609AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002610 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002611 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002612 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002613 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002614 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2615 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002616AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002617
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002618dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2619dnl appropriate, so that off_t is 64 bits when needed.
2620AC_SYS_LARGEFILE
2621
Bram Moolenaar071d4272004-06-13 20:20:40 +00002622dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2623AC_MSG_CHECKING(for st_blksize)
2624AC_TRY_COMPILE(
2625[#include <sys/types.h>
2626#include <sys/stat.h>],
2627[ struct stat st;
2628 int n;
2629
2630 stat("/", &st);
2631 n = (int)st.st_blksize;],
2632 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2633 AC_MSG_RESULT(no))
2634
Bram Moolenaar446cb832008-06-24 21:56:24 +00002635AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2636 [
2637 AC_RUN_IFELSE([[
2638#include "confdefs.h"
2639#if STDC_HEADERS
2640# include <stdlib.h>
2641# include <stddef.h>
2642#endif
2643#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002644#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002645main() {struct stat st; exit(stat("configure/", &st) != 0); }
2646 ]],[
2647 vim_cv_stat_ignores_slash=yes
2648 ],[
2649 vim_cv_stat_ignores_slash=no
2650 ],[
2651 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2652 ])
2653 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002654
Bram Moolenaar446cb832008-06-24 21:56:24 +00002655if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2656 AC_DEFINE(STAT_IGNORES_SLASH)
2657fi
2658
Bram Moolenaar071d4272004-06-13 20:20:40 +00002659dnl Link with iconv for charset translation, if not found without library.
2660dnl check for iconv() requires including iconv.h
2661dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2662dnl has been installed.
2663AC_MSG_CHECKING(for iconv_open())
2664save_LIBS="$LIBS"
2665LIBS="$LIBS -liconv"
2666AC_TRY_LINK([
2667#ifdef HAVE_ICONV_H
2668# include <iconv.h>
2669#endif
2670 ], [iconv_open("fr", "to");],
2671 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2672 LIBS="$save_LIBS"
2673 AC_TRY_LINK([
2674#ifdef HAVE_ICONV_H
2675# include <iconv.h>
2676#endif
2677 ], [iconv_open("fr", "to");],
2678 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2679 AC_MSG_RESULT(no)))
2680
2681
2682AC_MSG_CHECKING(for nl_langinfo(CODESET))
2683AC_TRY_LINK([
2684#ifdef HAVE_LANGINFO_H
2685# include <langinfo.h>
2686#endif
2687], [char *cs = nl_langinfo(CODESET);],
2688 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2689 AC_MSG_RESULT(no))
2690
Bram Moolenaar446cb832008-06-24 21:56:24 +00002691dnl Need various functions for floating point support. Only enable
2692dnl floating point when they are all present.
2693AC_CHECK_LIB(m, strtod)
2694AC_MSG_CHECKING([for strtod() and other floating point functions])
2695AC_TRY_LINK([
2696#ifdef HAVE_MATH_H
2697# include <math.h>
2698#endif
2699#if STDC_HEADERS
2700# include <stdlib.h>
2701# include <stddef.h>
2702#endif
2703], [char *s; double d;
2704 d = strtod("1.1", &s);
2705 d = fabs(1.11);
2706 d = ceil(1.11);
2707 d = floor(1.11);
2708 d = log10(1.11);
2709 d = pow(1.11, 2.22);
2710 d = sqrt(1.11);
2711 d = sin(1.11);
2712 d = cos(1.11);
2713 d = atan(1.11);
2714 ],
2715 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2716 AC_MSG_RESULT(no))
2717
Bram Moolenaar071d4272004-06-13 20:20:40 +00002718dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2719dnl when -lacl works, also try to use -lattr (required for Debian).
2720AC_MSG_CHECKING(--disable-acl argument)
2721AC_ARG_ENABLE(acl,
2722 [ --disable-acl Don't check for ACL support.],
2723 , [enable_acl="yes"])
2724if test "$enable_acl" = "yes"; then
2725AC_MSG_RESULT(no)
2726AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2727 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2728 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2729
2730AC_MSG_CHECKING(for POSIX ACL support)
2731AC_TRY_LINK([
2732#include <sys/types.h>
2733#ifdef HAVE_SYS_ACL_H
2734# include <sys/acl.h>
2735#endif
2736acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2737 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2738 acl_free(acl);],
2739 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2740 AC_MSG_RESULT(no))
2741
2742AC_MSG_CHECKING(for Solaris ACL support)
2743AC_TRY_LINK([
2744#ifdef HAVE_SYS_ACL_H
2745# include <sys/acl.h>
2746#endif], [acl("foo", GETACLCNT, 0, NULL);
2747 ],
2748 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2749 AC_MSG_RESULT(no))
2750
2751AC_MSG_CHECKING(for AIX ACL support)
2752AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002753#if STDC_HEADERS
2754# include <stdlib.h>
2755# include <stddef.h>
2756#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002757#ifdef HAVE_SYS_ACL_H
2758# include <sys/acl.h>
2759#endif
2760#ifdef HAVE_SYS_ACCESS_H
2761# include <sys/access.h>
2762#endif
2763#define _ALL_SOURCE
2764
2765#include <sys/stat.h>
2766
2767int aclsize;
2768struct acl *aclent;], [aclsize = sizeof(struct acl);
2769 aclent = (void *)malloc(aclsize);
2770 statacl("foo", STX_NORMAL, aclent, aclsize);
2771 ],
2772 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2773 AC_MSG_RESULT(no))
2774else
2775 AC_MSG_RESULT(yes)
2776fi
2777
2778AC_MSG_CHECKING(--disable-gpm argument)
2779AC_ARG_ENABLE(gpm,
2780 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2781 [enable_gpm="yes"])
2782
2783if test "$enable_gpm" = "yes"; then
2784 AC_MSG_RESULT(no)
2785 dnl Checking if gpm support can be compiled
2786 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2787 [olibs="$LIBS" ; LIBS="-lgpm"]
2788 AC_TRY_LINK(
2789 [#include <gpm.h>
2790 #include <linux/keyboard.h>],
2791 [Gpm_GetLibVersion(NULL);],
2792 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2793 dnl FEAT_MOUSE_GPM if mouse support is included
2794 [vi_cv_have_gpm=yes],
2795 [vi_cv_have_gpm=no])
2796 [LIBS="$olibs"]
2797 )
2798 if test $vi_cv_have_gpm = yes; then
2799 LIBS="$LIBS -lgpm"
2800 AC_DEFINE(HAVE_GPM)
2801 fi
2802else
2803 AC_MSG_RESULT(yes)
2804fi
2805
Bram Moolenaar446cb832008-06-24 21:56:24 +00002806AC_MSG_CHECKING(--disable-sysmouse argument)
2807AC_ARG_ENABLE(sysmouse,
2808 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2809 [enable_sysmouse="yes"])
2810
2811if test "$enable_sysmouse" = "yes"; then
2812 AC_MSG_RESULT(no)
2813 dnl Checking if sysmouse support can be compiled
2814 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
2815 dnl defines FEAT_SYSMOUSE if mouse support is included
2816 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
2817 AC_TRY_LINK(
2818 [#include <sys/consio.h>
2819 #include <signal.h>
2820 #include <sys/fbio.h>],
2821 [struct mouse_info mouse;
2822 mouse.operation = MOUSE_MODE;
2823 mouse.operation = MOUSE_SHOW;
2824 mouse.u.mode.mode = 0;
2825 mouse.u.mode.signal = SIGUSR2;],
2826 [vi_cv_have_sysmouse=yes],
2827 [vi_cv_have_sysmouse=no])
2828 )
2829 if test $vi_cv_have_sysmouse = yes; then
2830 AC_DEFINE(HAVE_SYSMOUSE)
2831 fi
2832else
2833 AC_MSG_RESULT(yes)
2834fi
2835
Bram Moolenaarf05da212009-11-17 16:13:15 +00002836dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
2837AC_MSG_CHECKING(for FD_CLOEXEC)
2838AC_TRY_COMPILE(
2839[#if HAVE_FCNTL_H
2840# include <fcntl.h>
2841#endif],
2842[ int flag = FD_CLOEXEC;],
2843 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
2844 AC_MSG_RESULT(not usable))
2845
Bram Moolenaar071d4272004-06-13 20:20:40 +00002846dnl rename needs to be checked separately to work on Nextstep with cc
2847AC_MSG_CHECKING(for rename)
2848AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2849 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2850 AC_MSG_RESULT(no))
2851
2852dnl sysctl() may exist but not the arguments we use
2853AC_MSG_CHECKING(for sysctl)
2854AC_TRY_COMPILE(
2855[#include <sys/types.h>
2856#include <sys/sysctl.h>],
2857[ int mib[2], r;
2858 size_t len;
2859
2860 mib[0] = CTL_HW;
2861 mib[1] = HW_USERMEM;
2862 len = sizeof(r);
2863 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2864 ],
2865 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2866 AC_MSG_RESULT(not usable))
2867
2868dnl sysinfo() may exist but not be Linux compatible
2869AC_MSG_CHECKING(for sysinfo)
2870AC_TRY_COMPILE(
2871[#include <sys/types.h>
2872#include <sys/sysinfo.h>],
2873[ struct sysinfo sinfo;
2874 int t;
2875
2876 (void)sysinfo(&sinfo);
2877 t = sinfo.totalram;
2878 ],
2879 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2880 AC_MSG_RESULT(not usable))
2881
Bram Moolenaar914572a2007-05-01 11:37:47 +00002882dnl struct sysinfo may have the mem_unit field or not
2883AC_MSG_CHECKING(for sysinfo.mem_unit)
2884AC_TRY_COMPILE(
2885[#include <sys/types.h>
2886#include <sys/sysinfo.h>],
2887[ struct sysinfo sinfo;
2888 sinfo.mem_unit = 1;
2889 ],
2890 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
2891 AC_MSG_RESULT(no))
2892
Bram Moolenaar071d4272004-06-13 20:20:40 +00002893dnl sysconf() may exist but not support what we want to use
2894AC_MSG_CHECKING(for sysconf)
2895AC_TRY_COMPILE(
2896[#include <unistd.h>],
2897[ (void)sysconf(_SC_PAGESIZE);
2898 (void)sysconf(_SC_PHYS_PAGES);
2899 ],
2900 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2901 AC_MSG_RESULT(not usable))
2902
Bram Moolenaar914703b2010-05-31 21:59:46 +02002903AC_CHECK_SIZEOF([int])
2904AC_CHECK_SIZEOF([long])
2905AC_CHECK_SIZEOF([time_t])
2906AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02002907
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002908dnl Make sure that uint32_t is really 32 bits unsigned.
2909AC_MSG_CHECKING([uint32_t is 32 bits])
2910AC_TRY_RUN([
2911#ifdef HAVE_STDINT_H
2912# include <stdint.h>
2913#endif
2914#ifdef HAVE_INTTYPES_H
2915# include <inttypes.h>
2916#endif
2917main() {
2918 uint32_t nr1 = (uint32_t)-1;
2919 uint32_t nr2 = (uint32_t)0xffffffffUL;
2920 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
2921 exit(0);
2922}],
2923AC_MSG_RESULT(ok),
2924AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
2925AC_MSG_ERROR([could not compile program using uint32_t.]))
2926
Bram Moolenaar446cb832008-06-24 21:56:24 +00002927dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2928dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2929
Bram Moolenaar071d4272004-06-13 20:20:40 +00002930[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00002931#include "confdefs.h"
2932#ifdef HAVE_STRING_H
2933# include <string.h>
2934#endif
2935#if STDC_HEADERS
2936# include <stdlib.h>
2937# include <stddef.h>
2938#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002939main() {
2940 char buf[10];
2941 strcpy(buf, "abcdefghi");
2942 mch_memmove(buf, buf + 2, 3);
2943 if (strncmp(buf, "ababcf", 6))
2944 exit(1);
2945 strcpy(buf, "abcdefghi");
2946 mch_memmove(buf + 2, buf, 3);
2947 if (strncmp(buf, "cdedef", 6))
2948 exit(1);
2949 exit(0); /* libc version works properly. */
2950}']
2951
Bram Moolenaar446cb832008-06-24 21:56:24 +00002952AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
2953 [
2954 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
2955 [
2956 vim_cv_memmove_handles_overlap=yes
2957 ],[
2958 vim_cv_memmove_handles_overlap=no
2959 ],[
2960 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
2961 ])
2962 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002963
Bram Moolenaar446cb832008-06-24 21:56:24 +00002964if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
2965 AC_DEFINE(USEMEMMOVE)
2966else
2967 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
2968 [
2969 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
2970 [
2971 vim_cv_bcopy_handles_overlap=yes
2972 ],[
2973 vim_cv_bcopy_handles_overlap=no
2974 ],[
2975 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
2976 ])
2977 ])
2978
2979 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
2980 AC_DEFINE(USEBCOPY)
2981 else
2982 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
2983 [
2984 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
2985 [
2986 vim_cv_memcpy_handles_overlap=yes
2987 ],[
2988 vim_cv_memcpy_handles_overlap=no
2989 ],[
2990 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
2991 ])
2992 ])
2993
2994 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
2995 AC_DEFINE(USEMEMCPY)
2996 fi
2997 fi
2998fi
2999
Bram Moolenaar071d4272004-06-13 20:20:40 +00003000
3001dnl Check for multibyte locale functions
3002dnl Find out if _Xsetlocale() is supported by libX11.
3003dnl Check if X_LOCALE should be defined.
3004
3005if test "$enable_multibyte" = "yes"; then
3006 cflags_save=$CFLAGS
3007 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00003008 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003009 CFLAGS="$CFLAGS -I$x_includes"
3010 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
3011 AC_MSG_CHECKING(whether X_LOCALE needed)
3012 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
3013 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
3014 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
3015 AC_MSG_RESULT(no))
3016 fi
3017 CFLAGS=$cflags_save
3018 LDFLAGS=$ldflags_save
3019fi
3020
3021dnl Link with xpg4, it is said to make Korean locale working
3022AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
3023
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003024dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003025dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003026dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003027dnl -t for typedefs (many ctags have this)
3028dnl -s for static functions (Elvis ctags only?)
3029dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
3030dnl -i+m to test for older Exuberant ctags
3031AC_MSG_CHECKING(how to create tags)
3032test -f tags && mv tags tags.save
3033if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003034 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003035else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003036 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003037 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
3038 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
3039 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
3040 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
3041 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
3042 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
3043 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
3044fi
3045test -f tags.save && mv tags.save tags
3046AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
3047
3048dnl Check how we can run man with a section number
3049AC_MSG_CHECKING(how to run man with a section nr)
3050MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00003051(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 +00003052AC_MSG_RESULT($MANDEF)
3053if test "$MANDEF" = "man -s"; then
3054 AC_DEFINE(USEMAN_S)
3055fi
3056
3057dnl Check if gettext() is working and if it needs -lintl
3058AC_MSG_CHECKING(--disable-nls argument)
3059AC_ARG_ENABLE(nls,
3060 [ --disable-nls Don't support NLS (gettext()).], ,
3061 [enable_nls="yes"])
3062
3063if test "$enable_nls" = "yes"; then
3064 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00003065
3066 INSTALL_LANGS=install-languages
3067 AC_SUBST(INSTALL_LANGS)
3068 INSTALL_TOOL_LANGS=install-tool-languages
3069 AC_SUBST(INSTALL_TOOL_LANGS)
3070
Bram Moolenaar071d4272004-06-13 20:20:40 +00003071 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
3072 AC_MSG_CHECKING([for NLS])
3073 if test -f po/Makefile; then
3074 have_gettext="no"
3075 if test -n "$MSGFMT"; then
3076 AC_TRY_LINK(
3077 [#include <libintl.h>],
3078 [gettext("Test");],
3079 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3080 olibs=$LIBS
3081 LIBS="$LIBS -lintl"
3082 AC_TRY_LINK(
3083 [#include <libintl.h>],
3084 [gettext("Test");],
3085 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3086 AC_MSG_RESULT([gettext() doesn't work]);
3087 LIBS=$olibs))
3088 else
3089 AC_MSG_RESULT([msgfmt not found - disabled]);
3090 fi
3091 if test $have_gettext = "yes"; then
3092 AC_DEFINE(HAVE_GETTEXT)
3093 MAKEMO=yes
3094 AC_SUBST(MAKEMO)
3095 dnl this was added in GNU gettext 0.10.36
3096 AC_CHECK_FUNCS(bind_textdomain_codeset)
3097 dnl _nl_msg_cat_cntr is required for GNU gettext
3098 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3099 AC_TRY_LINK(
3100 [#include <libintl.h>
3101 extern int _nl_msg_cat_cntr;],
3102 [++_nl_msg_cat_cntr;],
3103 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3104 AC_MSG_RESULT([no]))
3105 fi
3106 else
3107 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3108 fi
3109else
3110 AC_MSG_RESULT(yes)
3111fi
3112
3113dnl Check for dynamic linking loader
3114AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3115if test x${DLL} = xdlfcn.h; then
3116 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3117 AC_MSG_CHECKING([for dlopen()])
3118 AC_TRY_LINK(,[
3119 extern void* dlopen();
3120 dlopen();
3121 ],
3122 AC_MSG_RESULT(yes);
3123 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3124 AC_MSG_RESULT(no);
3125 AC_MSG_CHECKING([for dlopen() in -ldl])
3126 olibs=$LIBS
3127 LIBS="$LIBS -ldl"
3128 AC_TRY_LINK(,[
3129 extern void* dlopen();
3130 dlopen();
3131 ],
3132 AC_MSG_RESULT(yes);
3133 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3134 AC_MSG_RESULT(no);
3135 LIBS=$olibs))
3136 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3137 dnl ick :-)
3138 AC_MSG_CHECKING([for dlsym()])
3139 AC_TRY_LINK(,[
3140 extern void* dlsym();
3141 dlsym();
3142 ],
3143 AC_MSG_RESULT(yes);
3144 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3145 AC_MSG_RESULT(no);
3146 AC_MSG_CHECKING([for dlsym() in -ldl])
3147 olibs=$LIBS
3148 LIBS="$LIBS -ldl"
3149 AC_TRY_LINK(,[
3150 extern void* dlsym();
3151 dlsym();
3152 ],
3153 AC_MSG_RESULT(yes);
3154 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3155 AC_MSG_RESULT(no);
3156 LIBS=$olibs))
3157elif test x${DLL} = xdl.h; then
3158 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3159 AC_MSG_CHECKING([for shl_load()])
3160 AC_TRY_LINK(,[
3161 extern void* shl_load();
3162 shl_load();
3163 ],
3164 AC_MSG_RESULT(yes);
3165 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3166 AC_MSG_RESULT(no);
3167 AC_MSG_CHECKING([for shl_load() in -ldld])
3168 olibs=$LIBS
3169 LIBS="$LIBS -ldld"
3170 AC_TRY_LINK(,[
3171 extern void* shl_load();
3172 shl_load();
3173 ],
3174 AC_MSG_RESULT(yes);
3175 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3176 AC_MSG_RESULT(no);
3177 LIBS=$olibs))
3178fi
3179AC_CHECK_HEADERS(setjmp.h)
3180
3181if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3182 dnl -ldl must come after DynaLoader.a
3183 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3184 LIBS=`echo $LIBS | sed s/-ldl//`
3185 PERL_LIBS="$PERL_LIBS -ldl"
3186 fi
3187fi
3188
Bram Moolenaar164fca32010-07-14 13:58:07 +02003189if test "x$MACOSX" = "xyes"; then
3190 AC_MSG_CHECKING(whether we need -framework Cocoa)
3191 dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
3192 dnl disabled during tiny build)
3193 if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
3194 LIBS=$"$LIBS -framework Cocoa"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003195 AC_MSG_RESULT(yes)
3196 else
3197 AC_MSG_RESULT(no)
3198 fi
3199fi
Bram Moolenaar164fca32010-07-14 13:58:07 +02003200if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003201 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003202fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003203
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003204dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3205dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3206dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003207dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3208dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003209DEPEND_CFLAGS_FILTER=
3210if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003211 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003212 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003213 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003214 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003215 AC_MSG_RESULT(yes)
3216 else
3217 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003218 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003219 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3220 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003221 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003222 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3223 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003224 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 +00003225 AC_MSG_RESULT(yes)
3226 else
3227 AC_MSG_RESULT(no)
3228 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003229fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003230AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003231
3232dnl write output files
3233AC_OUTPUT(auto/config.mk:config.mk.in)
3234
3235dnl vim: set sw=2 tw=78 fo+=l: