blob: 38fdea5909e52d92e7cd3b8d534a189ffebcf916 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001dnl configure.in: autoconf script for Vim
2
3dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
4dnl Should also work with autoconf 2.54 and later.
5
6AC_INIT(vim.h)
7AC_CONFIG_HEADER(auto/config.h:config.h.in)
8
9dnl Being able to run configure means the system is Unix (compatible).
10AC_DEFINE(UNIX)
11AC_PROG_MAKE_SET
12
13dnl Checks for programs.
14AC_PROG_CC dnl required by almost everything
15AC_PROG_CPP dnl required by header file checks
16AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
17AC_ISC_POSIX dnl required by AC_C_CROSS
18AC_PROG_AWK dnl required for "make html" in ../doc
19
20dnl Don't strip if we don't have it
21AC_CHECK_PROG(STRIP, strip, strip, :)
22
Bram Moolenaar325b7a22004-07-05 15:58:32 +000023dnl Check for extension of executables
Bram Moolenaar071d4272004-06-13 20:20:40 +000024AC_EXEEXT
25
Bram Moolenaar446cb832008-06-24 21:56:24 +000026dnl Check for standard headers. We don't use this in Vim but other stuff
27dnl in autoconf needs it, where it uses STDC_HEADERS.
28AC_HEADER_STDC
29AC_HEADER_SYS_WAIT
30
Bram Moolenaar071d4272004-06-13 20:20:40 +000031dnl Set default value for CFLAGS if none is defined or it's empty
32if test -z "$CFLAGS"; then
33 CFLAGS="-O"
34 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
35fi
36if test "$GCC" = yes; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +000037 dnl method that should work for nearly all versions
38 gccversion=`"$CC" -dumpversion`
39 if test "x$gccversion" = "x"; then
40 dnl old method; fall-back for when -dumpversion doesn't work
41 gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
42 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +000043 dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
44 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +000045 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +000046 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
47 else
48 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
49 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
50 CFLAGS="$CFLAGS -fno-strength-reduce"
51 fi
52 fi
53fi
54
Bram Moolenaar446cb832008-06-24 21:56:24 +000055dnl If configure thinks we are cross compiling, there might be something
56dnl wrong with the CC or CFLAGS settings, give a useful warning message
Bram Moolenaar071d4272004-06-13 20:20:40 +000057if test "$cross_compiling" = yes; then
Bram Moolenaar446cb832008-06-24 21:56:24 +000058 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
Bram Moolenaar071d4272004-06-13 20:20:40 +000059fi
60
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000061dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
62dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +000063test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
64
65if test -f ./toolcheck; then
66 AC_CHECKING(for buggy tools)
67 sh ./toolcheck 1>&AC_FD_MSG
68fi
69
70OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
71
72dnl Check for BeOS, which needs an extra source file
73AC_MSG_CHECKING(for BeOS)
74case `uname` in
75 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
76 BEOS=yes; AC_MSG_RESULT(yes);;
77 *) BEOS=no; AC_MSG_RESULT(no);;
78esac
79
80dnl If QNX is found, assume we don't want to use Xphoton
81dnl unless it was specifically asked for (--with-x)
82AC_MSG_CHECKING(for QNX)
83case `uname` in
84 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
85 test -z "$with_x" && with_x=no
86 QNX=yes; AC_MSG_RESULT(yes);;
87 *) QNX=no; AC_MSG_RESULT(no);;
88esac
89
90dnl Check for Darwin and MacOS X
91dnl We do a check for MacOS X in the very beginning because there
92dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +000093AC_MSG_CHECKING([for Darwin (Mac OS X)])
94if test "`(uname) 2>/dev/null`" = Darwin; then
95 AC_MSG_RESULT(yes)
96
97 AC_MSG_CHECKING(--disable-darwin argument)
98 AC_ARG_ENABLE(darwin,
99 [ --disable-darwin Disable Darwin (Mac OS X) support.],
100 , [enable_darwin="yes"])
101 if test "$enable_darwin" = "yes"; then
102 AC_MSG_RESULT(no)
103 AC_MSG_CHECKING(if Darwin files are there)
Bram Moolenaar164fca32010-07-14 13:58:07 +0200104 if test -f os_macosx.m; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105 AC_MSG_RESULT(yes)
106 else
107 AC_MSG_RESULT([no, Darwin support disabled])
108 enable_darwin=no
109 fi
110 else
111 AC_MSG_RESULT([yes, Darwin support excluded])
112 fi
113
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000114 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000115 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000116 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000117 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000118
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100119 AC_MSG_CHECKING(--with-developer-dir argument)
120 AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
121 DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
122 DEVELOPER_DIR=""; AC_MSG_RESULT(not present))
123
124 if test "x$DEVELOPER_DIR" = "x"; then
125 AC_PATH_PROG(XCODE_SELECT, xcode-select)
126 if test "x$XCODE_SELECT" != "x"; then
127 AC_MSG_CHECKING(for developer dir using xcode-select)
128 DEVELOPER_DIR=`$XCODE_SELECT -print-path`
129 AC_MSG_RESULT([$DEVELOPER_DIR])
130 else
131 DEVELOPER_DIR=/Developer
132 fi
133 fi
134
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000135 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000136 AC_MSG_CHECKING(for 10.4 universal SDK)
137 dnl There is a terrible inconsistency (but we appear to get away with it):
138 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
139 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
140 dnl tests using the preprocessor are actually done with the wrong header
141 dnl files. $LDFLAGS is set at the end, because configure uses it together
142 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000143 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000144 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000145 save_ldflags="$LDFLAGS"
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100146 CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000147 AC_TRY_LINK([ ], [ ],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000148 AC_MSG_RESULT(found, will make universal binary),
149
150 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000151 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000152 AC_MSG_CHECKING(if Intel architecture is supported)
153 CPPFLAGS="$CPPFLAGS -arch i386"
154 LDFLAGS="$save_ldflags -arch i386"
155 AC_TRY_LINK([ ], [ ],
156 AC_MSG_RESULT(yes); MACARCH="intel",
157 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000158 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000159 CPPFLAGS="$save_cppflags -arch ppc"
160 LDFLAGS="$save_ldflags -arch ppc"))
161 elif test "x$MACARCH" = "xintel"; then
162 CPPFLAGS="$CPPFLAGS -arch intel"
163 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000164 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000165 CPPFLAGS="$CPPFLAGS -arch ppc"
166 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000167 fi
168
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169 if test "$enable_darwin" = "yes"; then
170 MACOSX=yes
Bram Moolenaar164fca32010-07-14 13:58:07 +0200171 OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000172 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000173 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000174 CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175
176 dnl If Carbon is found, assume we don't want X11
177 dnl unless it was specifically asked for (--with-x)
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000178 dnl or Motif, Athena or GTK GUI is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000179 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
180 if test "x$CARBON" = "xyes"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +0200181 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000182 with_x=no
Bram Moolenaar071d4272004-06-13 20:20:40 +0000183 fi
184 fi
185 fi
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000186
Bram Moolenaardb552d602006-03-23 22:59:57 +0000187 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000188 dnl free. This happens in expand_filename(), because the optimizer swaps
Bram Moolenaardb552d602006-03-23 22:59:57 +0000189 dnl two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000190 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
191 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
192 fi
193
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194else
195 AC_MSG_RESULT(no)
196fi
197
198AC_SUBST(OS_EXTRA_SRC)
199AC_SUBST(OS_EXTRA_OBJ)
200
201dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
202dnl Only when the directory exists and it wasn't there yet.
203dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000204dnl Skip all of this when cross-compiling.
205if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000206 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000207 have_local_include=''
208 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000209 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
210 --without-local-dir do not search /usr/local for local libraries.], [
211 local_dir="$withval"
212 case "$withval" in
213 */*) ;;
214 no)
215 # avoid adding local dir to LDFLAGS and CPPFLAGS
Bram Moolenaare06c1882010-07-21 22:05:20 +0200216 have_local_include=yes
Bram Moolenaarc236c162008-07-13 17:41:49 +0000217 have_local_lib=yes
218 ;;
219 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
220 esac
221 AC_MSG_RESULT($local_dir)
222 ], [
223 local_dir=/usr/local
224 AC_MSG_RESULT(Defaulting to $local_dir)
225 ])
226 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000227 echo 'void f(){}' > conftest.c
228 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
Bram Moolenaarc236c162008-07-13 17:41:49 +0000229 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
230 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000231 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000233 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
234 tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000235 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000236 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000237 fi
238 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000239 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
240 tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000241 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000242 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000243 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244 fi
245fi
246
247AC_MSG_CHECKING(--with-vim-name argument)
248AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
249 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000250 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251AC_SUBST(VIMNAME)
252AC_MSG_CHECKING(--with-ex-name argument)
253AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
254 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
255 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
256AC_SUBST(EXNAME)
257AC_MSG_CHECKING(--with-view-name argument)
258AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
259 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
260 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
261AC_SUBST(VIEWNAME)
262
263AC_MSG_CHECKING(--with-global-runtime argument)
264AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
265 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
266 AC_MSG_RESULT(no))
267
268AC_MSG_CHECKING(--with-modified-by argument)
269AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
270 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
271 AC_MSG_RESULT(no))
272
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200273dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000274AC_MSG_CHECKING(if character set is EBCDIC)
275AC_TRY_COMPILE([ ],
276[ /* TryCompile function for CharSet.
277 Treat any failure as ASCII for compatibility with existing art.
278 Use compile-time rather than run-time tests for cross-compiler
279 tolerance. */
280#if '0'!=240
281make an error "Character set is not EBCDIC"
282#endif ],
283[ # TryCompile action if true
284cf_cv_ebcdic=yes ],
285[ # TryCompile action if false
286cf_cv_ebcdic=no])
287# end of TryCompile ])
288# end of CacheVal CvEbcdic
289AC_MSG_RESULT($cf_cv_ebcdic)
290case "$cf_cv_ebcdic" in #(vi
291 yes) AC_DEFINE(EBCDIC)
292 line_break='"\\n"'
293 ;;
294 *) line_break='"\\012"';;
295esac
296AC_SUBST(line_break)
297
298if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200299dnl If we have EBCDIC we most likley have z/OS Unix, let's test it!
300AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000301case `uname` in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200302 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303 dnl If using cc the environment variable _CC_CCMODE must be
304 dnl set to "1", so that some compiler extensions are enabled.
305 dnl If using c89 the environment variable is named _CC_C89MODE.
306 dnl Note: compile with c89 never tested.
307 if test "$CC" = "cc"; then
308 ccm="$_CC_CCMODE"
309 ccn="CC"
310 else
311 if test "$CC" = "c89"; then
312 ccm="$_CC_C89MODE"
313 ccn="C89"
314 else
315 ccm=1
316 fi
317 fi
318 if test "$ccm" != "1"; then
319 echo ""
320 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200321 echo " On z/OS Unix, the environment variable"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000322 echo " __CC_${ccn}MODE must be set to \"1\"!"
323 echo " Do:"
324 echo " export _CC_${ccn}MODE=1"
325 echo " and then call configure again."
326 echo "------------------------------------------"
327 exit 1
328 fi
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200329 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
330 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331 AC_MSG_RESULT(yes)
332 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200333 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334 AC_MSG_RESULT(no)
335 ;;
336esac
337fi
338
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200339dnl Set QUOTESED. Needs additional backslashes on zOS
340if test "$zOSUnix" = "yes"; then
341 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
342else
343 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
344fi
345AC_SUBST(QUOTESED)
346
347
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000348dnl Link with -lselinux for SELinux stuff; if not found
349AC_MSG_CHECKING(--disable-selinux argument)
350AC_ARG_ENABLE(selinux,
351 [ --disable-selinux Don't check for SELinux support.],
352 , enable_selinux="yes")
353if test "$enable_selinux" = "yes"; then
354 AC_MSG_RESULT(no)
355 AC_CHECK_LIB(selinux, is_selinux_enabled,
356 [LIBS="$LIBS -lselinux"
357 AC_DEFINE(HAVE_SELINUX)])
358else
359 AC_MSG_RESULT(yes)
360fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000361
362dnl Check user requested features.
363
364AC_MSG_CHECKING(--with-features argument)
365AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
366 features="$withval"; AC_MSG_RESULT($features),
367 features="normal"; AC_MSG_RESULT(Defaulting to normal))
368
369dovimdiff=""
370dogvimdiff=""
371case "$features" in
372 tiny) AC_DEFINE(FEAT_TINY) ;;
373 small) AC_DEFINE(FEAT_SMALL) ;;
374 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
375 dogvimdiff="installgvimdiff" ;;
376 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
377 dogvimdiff="installgvimdiff" ;;
378 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
379 dogvimdiff="installgvimdiff" ;;
380 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
381esac
382
383AC_SUBST(dovimdiff)
384AC_SUBST(dogvimdiff)
385
386AC_MSG_CHECKING(--with-compiledby argument)
387AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
388 compiledby="$withval"; AC_MSG_RESULT($withval),
389 compiledby=""; AC_MSG_RESULT(no))
390AC_SUBST(compiledby)
391
392AC_MSG_CHECKING(--disable-xsmp argument)
393AC_ARG_ENABLE(xsmp,
394 [ --disable-xsmp Disable XSMP session management],
395 , enable_xsmp="yes")
396
397if test "$enable_xsmp" = "yes"; then
398 AC_MSG_RESULT(no)
399 AC_MSG_CHECKING(--disable-xsmp-interact argument)
400 AC_ARG_ENABLE(xsmp-interact,
401 [ --disable-xsmp-interact Disable XSMP interaction],
402 , enable_xsmp_interact="yes")
403 if test "$enable_xsmp_interact" = "yes"; then
404 AC_MSG_RESULT(no)
405 AC_DEFINE(USE_XSMP_INTERACT)
406 else
407 AC_MSG_RESULT(yes)
408 fi
409else
410 AC_MSG_RESULT(yes)
411fi
412
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200413dnl Check for Lua feature.
414AC_MSG_CHECKING(--enable-luainterp argument)
415AC_ARG_ENABLE(luainterp,
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200416 [ --enable-luainterp[=OPTS] Include Lua interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200417 [enable_luainterp="no"])
418AC_MSG_RESULT($enable_luainterp)
419
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200420if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200421 dnl -- find the lua executable
422 AC_SUBST(vi_cv_path_lua)
423
424 AC_MSG_CHECKING(--with-lua-prefix argument)
425 AC_ARG_WITH(lua_prefix,
426 [ --with-lua-prefix=PFX Prefix where Lua is installed.],
427 with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200428 with_lua_prefix="";AC_MSG_RESULT(no))
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200429
430 if test "X$with_lua_prefix" != "X"; then
431 vi_cv_path_lua_pfx="$with_lua_prefix"
432 else
433 AC_MSG_CHECKING(LUA_PREFIX environment var)
434 if test "X$LUA_PREFIX" != "X"; then
435 AC_MSG_RESULT("$LUA_PREFIX")
436 vi_cv_path_lua_pfx="$LUA_PREFIX"
437 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200438 AC_MSG_RESULT([not set, default to /usr])
439 vi_cv_path_lua_pfx="/usr"
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200440 fi
441 fi
442
443 LUA_INC=
444 if test "X$vi_cv_path_lua_pfx" != "X"; then
445 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
446 if test -f $vi_cv_path_lua_pfx/include/lua.h; then
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200447 AC_MSG_RESULT(yes)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200448 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200449 AC_MSG_RESULT(no)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200450 dnl -- try to find Lua executable
451 AC_PATH_PROG(vi_cv_path_lua, lua)
452 if test "X$vi_cv_path_lua" != "X"; then
453 dnl -- find Lua version
454 AC_CACHE_CHECK(Lua version, vi_cv_version_lua,
Bram Moolenaar8220a682010-07-25 13:12:49 +0200455 [ vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200456 AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
457 if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200458 AC_MSG_RESULT(yes)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200459 LUA_INC=/lua$vi_cv_version_lua
460 else
Bram Moolenaar0d2e4fc2010-07-18 12:35:47 +0200461 AC_MSG_RESULT(no)
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200462 vi_cv_path_lua_pfx=
463 fi
464 fi
465 fi
466 fi
467
468 if test "X$vi_cv_path_lua_pfx" != "X"; then
469 if test "X$vi_cv_version_lua" != "X"; then
470 dnl Test alternate location using version
471 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
472 else
473 LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
474 fi
475 LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
476 LUA_SRC="if_lua.c"
477 LUA_OBJ="objects/if_lua.o"
478 LUA_PRO="if_lua.pro"
479 AC_DEFINE(FEAT_LUA)
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200480 if test "$enable_luainterp" = "dynamic"; then
Bram Moolenaar8220a682010-07-25 13:12:49 +0200481 dnl Determine the SONAME for the current version, but fallback to
482 dnl liblua${vi_cv_version_lua}.so if no SONAME-versioned file is found.
483 for i in 0 1 2 3 4 5 6 7 8 9; do
484 if test -f "${vi_cv_path_lua_pfx}/lib/liblua${vi_cv_version_lua}.so.$i"; then
485 LUA_SONAME=".$i"
486 break
487 fi
488 done
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200489 AC_DEFINE(DYNAMIC_LUA)
490 LUA_LIBS=""
Bram Moolenaar8220a682010-07-25 13:12:49 +0200491 LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"liblua${vi_cv_version_lua}.so$LUA_SONAME\\\" $LUA_CFLAGS"
Bram Moolenaar2334b6d2010-07-22 21:32:16 +0200492 fi
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200493 fi
494 AC_SUBST(LUA_SRC)
495 AC_SUBST(LUA_OBJ)
496 AC_SUBST(LUA_PRO)
497 AC_SUBST(LUA_LIBS)
498 AC_SUBST(LUA_CFLAGS)
499fi
500
501
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000502dnl Check for MzScheme feature.
503AC_MSG_CHECKING(--enable-mzschemeinterp argument)
504AC_ARG_ENABLE(mzschemeinterp,
505 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
506 [enable_mzschemeinterp="no"])
507AC_MSG_RESULT($enable_mzschemeinterp)
508
509if test "$enable_mzschemeinterp" = "yes"; then
510 dnl -- find the mzscheme executable
511 AC_SUBST(vi_cv_path_mzscheme)
512
513 AC_MSG_CHECKING(--with-plthome argument)
514 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000515 [ --with-plthome=PLTHOME Use PLTHOME.],
516 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000517 with_plthome="";AC_MSG_RESULT("no"))
518
519 if test "X$with_plthome" != "X"; then
520 vi_cv_path_mzscheme_pfx="$with_plthome"
521 else
522 AC_MSG_CHECKING(PLTHOME environment var)
523 if test "X$PLTHOME" != "X"; then
524 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000525 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000526 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000527 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000528 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000529 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000530
531 dnl resolve symbolic link, the executable is often elsewhere and there
532 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000533 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000534 lsout=`ls -l $vi_cv_path_mzscheme`
535 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
536 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
537 fi
538 fi
539
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000540 if test "X$vi_cv_path_mzscheme" != "X"; then
541 dnl -- find where MzScheme thinks it was installed
542 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000543 dnl different versions of MzScheme differ in command line processing
544 dnl use universal approach
545 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000546 (build-path (call-with-values \
547 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000548 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
549 dnl Remove a trailing slash
550 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
551 sed -e 's+/$++'` ])
552 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000553 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000554 fi
555 fi
556
Bram Moolenaard7afed32007-05-06 13:26:41 +0000557 SCHEME_INC=
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000558 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
559 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
560 if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000561 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
562 AC_MSG_RESULT(yes)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000563 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000564 AC_MSG_RESULT(no)
565 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000566 if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000567 AC_MSG_RESULT(yes)
568 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaard7afed32007-05-06 13:26:41 +0000569 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000570 AC_MSG_RESULT(no)
571 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
572 if test -f /usr/include/plt/scheme.h; then
573 AC_MSG_RESULT(yes)
574 SCHEME_INC=/usr/include/plt
575 else
576 AC_MSG_RESULT(no)
577 vi_cv_path_mzscheme_pfx=
578 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000579 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000580 fi
581 fi
582
583 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000584 if test "x$MACOSX" = "xyes"; then
585 MZSCHEME_LIBS="-framework PLT_MzScheme"
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000586 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
587 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
588 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000589 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
Bram Moolenaar9048f942007-05-12 14:32:25 +0000590 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 +0000591 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000592 dnl Using shared objects
593 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
594 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
595 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
596 else
597 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
598 fi
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000599 if test "$GCC" = yes; then
600 dnl Make Vim remember the path to the library. For when it's not in
601 dnl $LD_LIBRARY_PATH.
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000602 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000603 elif test "`(uname) 2>/dev/null`" = SunOS &&
604 uname -r | grep '^5' >/dev/null; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000605 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000606 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000607 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000608 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
609 SCHEME_COLLECTS=lib/plt/
610 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000611 if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
612 dnl need to generate bytecode for MzScheme base
613 MZSCHEME_EXTRA="mzscheme_base.c"
614 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
615 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
616 fi
617 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaard7afed32007-05-06 13:26:41 +0000618 -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000619 MZSCHEME_SRC="if_mzsch.c"
620 MZSCHEME_OBJ="objects/if_mzsch.o"
621 MZSCHEME_PRO="if_mzsch.pro"
622 AC_DEFINE(FEAT_MZSCHEME)
623 fi
624 AC_SUBST(MZSCHEME_SRC)
625 AC_SUBST(MZSCHEME_OBJ)
626 AC_SUBST(MZSCHEME_PRO)
627 AC_SUBST(MZSCHEME_LIBS)
628 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000629 AC_SUBST(MZSCHEME_EXTRA)
630 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000631fi
632
633
Bram Moolenaar071d4272004-06-13 20:20:40 +0000634AC_MSG_CHECKING(--enable-perlinterp argument)
635AC_ARG_ENABLE(perlinterp,
Bram Moolenaare06c1882010-07-21 22:05:20 +0200636 [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000637 [enable_perlinterp="no"])
638AC_MSG_RESULT($enable_perlinterp)
Bram Moolenaare06c1882010-07-21 22:05:20 +0200639if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000640 AC_SUBST(vi_cv_path_perl)
641 AC_PATH_PROG(vi_cv_path_perl, perl)
642 if test "X$vi_cv_path_perl" != "X"; then
643 AC_MSG_CHECKING(Perl version)
644 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
645 eval `$vi_cv_path_perl -V:usethreads`
Bram Moolenaare06c1882010-07-21 22:05:20 +0200646 eval `$vi_cv_path_perl -V:libperl`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000647 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
648 badthreads=no
649 else
650 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
651 eval `$vi_cv_path_perl -V:use5005threads`
652 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
653 badthreads=no
654 else
655 badthreads=yes
656 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
657 fi
658 else
659 badthreads=yes
660 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
661 fi
662 fi
663 if test $badthreads = no; then
664 AC_MSG_RESULT(OK)
665 eval `$vi_cv_path_perl -V:shrpenv`
666 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
667 shrpenv=""
668 fi
669 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
670 AC_SUBST(vi_cv_perllib)
671 dnl Remove "-fno-something", it breaks using cproto.
672 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
673 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
674 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
675 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
676 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
677 -e 's/-bE:perl.exp//' -e 's/-lc //'`
678 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
679 dnl a test in configure may fail because of that.
680 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
681 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
682
683 dnl check that compiling a simple program still works with the flags
684 dnl added for Perl.
685 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
686 cflags_save=$CFLAGS
687 libs_save=$LIBS
688 ldflags_save=$LDFLAGS
689 CFLAGS="$CFLAGS $perlcppflags"
690 LIBS="$LIBS $perllibs"
691 LDFLAGS="$perlldflags $LDFLAGS"
692 AC_TRY_LINK(,[ ],
693 AC_MSG_RESULT(yes); perl_ok=yes,
694 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
695 CFLAGS=$cflags_save
696 LIBS=$libs_save
697 LDFLAGS=$ldflags_save
698 if test $perl_ok = yes; then
699 if test "X$perlcppflags" != "X"; then
Bram Moolenaard7afed32007-05-06 13:26:41 +0000700 dnl remove -pipe and -Wxxx, it confuses cproto
701 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000702 fi
703 if test "X$perlldflags" != "X"; then
704 LDFLAGS="$perlldflags $LDFLAGS"
705 fi
706 PERL_LIBS=$perllibs
707 PERL_SRC="auto/if_perl.c if_perlsfio.c"
708 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
709 PERL_PRO="if_perl.pro if_perlsfio.pro"
710 AC_DEFINE(FEAT_PERL)
711 fi
712 fi
713 else
714 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
715 fi
716 fi
717
718 if test "x$MACOSX" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +0000719 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000720 dir=/System/Library/Perl
721 darwindir=$dir/darwin
722 if test -d $darwindir; then
723 PERL=/usr/bin/perl
724 else
725 dnl Mac OS X 10.3
726 dir=/System/Library/Perl/5.8.1
727 darwindir=$dir/darwin-thread-multi-2level
728 if test -d $darwindir; then
729 PERL=/usr/bin/perl
730 fi
731 fi
732 if test -n "$PERL"; then
733 PERL_DIR="$dir"
734 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
735 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
736 PERL_LIBS="-L$darwindir/CORE -lperl"
737 fi
Bram Moolenaar5dff57d2010-07-24 16:19:44 +0200738 dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only
739 dnl be included if requested by passing --with-mac-arch to
740 dnl configure, so strip these flags first (if present)
741 PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
742 PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000743 fi
Bram Moolenaare06c1882010-07-21 22:05:20 +0200744 if test "$enable_perlinterp" = "dynamic"; then
745 if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
746 AC_DEFINE(DYNAMIC_PERL)
747 PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
748 fi
749 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000750fi
751AC_SUBST(shrpenv)
752AC_SUBST(PERL_SRC)
753AC_SUBST(PERL_OBJ)
754AC_SUBST(PERL_PRO)
755AC_SUBST(PERL_CFLAGS)
756AC_SUBST(PERL_LIBS)
757
758AC_MSG_CHECKING(--enable-pythoninterp argument)
759AC_ARG_ENABLE(pythoninterp,
760 [ --enable-pythoninterp Include Python interpreter.], ,
761 [enable_pythoninterp="no"])
762AC_MSG_RESULT($enable_pythoninterp)
763if test "$enable_pythoninterp" = "yes"; then
764 dnl -- find the python executable
765 AC_PATH_PROG(vi_cv_path_python, python)
766 if test "X$vi_cv_path_python" != "X"; then
767
768 dnl -- get its version number
769 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
770 [[vi_cv_var_python_version=`
771 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
772 ]])
773
774 dnl -- it must be at least version 1.4
775 AC_MSG_CHECKING(Python is 1.4 or better)
776 if ${vi_cv_path_python} -c \
777 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
778 then
779 AC_MSG_RESULT(yep)
780
781 dnl -- find where python thinks it was installed
782 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
783 [ vi_cv_path_python_pfx=`
784 ${vi_cv_path_python} -c \
785 "import sys; print sys.prefix"` ])
786
787 dnl -- and where it thinks it runs
788 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
789 [ vi_cv_path_python_epfx=`
790 ${vi_cv_path_python} -c \
791 "import sys; print sys.exec_prefix"` ])
792
793 dnl -- python's internal library path
794
795 AC_CACHE_VAL(vi_cv_path_pythonpath,
796 [ vi_cv_path_pythonpath=`
797 unset PYTHONPATH;
798 ${vi_cv_path_python} -c \
799 "import sys, string; print string.join(sys.path,':')"` ])
800
801 dnl -- where the Python implementation library archives are
802
803 AC_ARG_WITH(python-config-dir,
804 [ --with-python-config-dir=PATH Python's config directory],
805 [ vi_cv_path_python_conf="${withval}" ] )
806
807 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
808 [
809 vi_cv_path_python_conf=
810 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
Bram Moolenaar72951072009-12-02 16:58:33 +0000811 for subdir in lib64 lib share; do
Bram Moolenaar071d4272004-06-13 20:20:40 +0000812 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
813 if test -d "$d" && test -f "$d/config.c"; then
814 vi_cv_path_python_conf="$d"
815 fi
816 done
817 done
818 ])
819
820 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
821
822 if test "X$PYTHON_CONFDIR" = "X"; then
823 AC_MSG_RESULT([can't find it!])
824 else
825
826 dnl -- we need to examine Python's config/Makefile too
827 dnl see what the interpreter is built from
828 AC_CACHE_VAL(vi_cv_path_python_plibs,
829 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000830 pwd=`pwd`
831 tmp_mkf="$pwd/config-PyMake$$"
832 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000833__:
Bram Moolenaar218116c2010-05-20 21:46:00 +0200834 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000835 @echo "python_LIBS='$(LIBS)'"
836 @echo "python_SYSLIBS='$(SYSLIBS)'"
837 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +0200838 @echo "python_INSTSONAME='$(INSTSONAME)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000839eof
840 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000841 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
842 rm -f -- "${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000843 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
844 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
845 vi_cv_path_python_plibs="-framework Python"
846 else
847 if test "${vi_cv_var_python_version}" = "1.4"; then
848 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
849 else
850 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
851 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +0200852 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 +0000853 dnl remove -ltermcap, it can conflict with an earlier -lncurses
854 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
855 fi
856 ])
857
858 PYTHON_LIBS="${vi_cv_path_python_plibs}"
859 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
860 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
861 else
862 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}"
863 fi
864 PYTHON_SRC="if_python.c"
865 dnl For Mac OSX 10.2 config.o is included in the Python library.
866 if test "x$MACOSX" = "xyes"; then
867 PYTHON_OBJ="objects/if_python.o"
868 else
869 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
870 fi
871 if test "${vi_cv_var_python_version}" = "1.4"; then
872 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
873 fi
874 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
875
876 dnl On FreeBSD linking with "-pthread" is required to use threads.
877 dnl _THREAD_SAFE must be used for compiling then.
878 dnl The "-pthread" is added to $LIBS, so that the following check for
879 dnl sigaltstack() will look in libc_r (it's there in libc!).
880 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
881 dnl will then define target-specific defines, e.g., -D_REENTRANT.
882 dnl Don't do this for Mac OSX, -pthread will generate a warning.
883 AC_MSG_CHECKING([if -pthread should be used])
884 threadsafe_flag=
885 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000886 dnl if test "x$MACOSX" != "xyes"; then
887 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000888 test "$GCC" = yes && threadsafe_flag="-pthread"
889 if test "`(uname) 2>/dev/null`" = FreeBSD; then
890 threadsafe_flag="-D_THREAD_SAFE"
891 thread_lib="-pthread"
892 fi
893 fi
894 libs_save_old=$LIBS
895 if test -n "$threadsafe_flag"; then
896 cflags_save=$CFLAGS
897 CFLAGS="$CFLAGS $threadsafe_flag"
898 LIBS="$LIBS $thread_lib"
899 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200900 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000901 AC_MSG_RESULT(no); LIBS=$libs_save_old
902 )
903 CFLAGS=$cflags_save
904 else
905 AC_MSG_RESULT(no)
906 fi
907
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200908 dnl Check that compiling a simple program still works with the flags
Bram Moolenaar071d4272004-06-13 20:20:40 +0000909 dnl added for Python.
910 AC_MSG_CHECKING([if compile and link flags for Python are sane])
911 cflags_save=$CFLAGS
912 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200913 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000914 LIBS="$LIBS $PYTHON_LIBS"
915 AC_TRY_LINK(,[ ],
916 AC_MSG_RESULT(yes); python_ok=yes,
917 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
918 CFLAGS=$cflags_save
919 LIBS=$libs_save
920 if test $python_ok = yes; then
921 AC_DEFINE(FEAT_PYTHON)
922 else
923 LIBS=$libs_save_old
924 PYTHON_SRC=
925 PYTHON_OBJ=
926 PYTHON_LIBS=
927 PYTHON_CFLAGS=
928 fi
929
930 fi
931 else
932 AC_MSG_RESULT(too old)
933 fi
934 fi
935fi
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200936
Bram Moolenaar071d4272004-06-13 20:20:40 +0000937AC_SUBST(PYTHON_CONFDIR)
938AC_SUBST(PYTHON_LIBS)
939AC_SUBST(PYTHON_GETPATH_CFLAGS)
940AC_SUBST(PYTHON_CFLAGS)
941AC_SUBST(PYTHON_SRC)
942AC_SUBST(PYTHON_OBJ)
943
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200944
945AC_MSG_CHECKING(--enable-python3interp argument)
946AC_ARG_ENABLE(python3interp,
947 [ --enable-python3interp Include Python3 interpreter.], ,
948 [enable_python3interp="no"])
949AC_MSG_RESULT($enable_python3interp)
950if test "$enable_python3interp" = "yes"; then
951 dnl -- find the python3 executable
952 AC_PATH_PROG(vi_cv_path_python3, python3)
953 if test "X$vi_cv_path_python3" != "X"; then
954
955 dnl -- get its version number
956 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
957 [[vi_cv_var_python3_version=`
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200958 ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200959 ]])
960
961 dnl -- find where python3 thinks it was installed
962 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
963 [ vi_cv_path_python3_pfx=`
964 ${vi_cv_path_python3} -c \
965 "import sys; print(sys.prefix)"` ])
966
967 dnl -- and where it thinks it runs
968 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
969 [ vi_cv_path_python3_epfx=`
970 ${vi_cv_path_python3} -c \
971 "import sys; print(sys.exec_prefix)"` ])
972
973 dnl -- python3's internal library path
974
975 AC_CACHE_VAL(vi_cv_path_python3path,
976 [ vi_cv_path_python3path=`
977 unset PYTHONPATH;
978 ${vi_cv_path_python3} -c \
979 "import sys, string; print(':'.join(sys.path))"` ])
980
981 dnl -- where the Python implementation library archives are
982
983 AC_ARG_WITH(python3-config-dir,
984 [ --with-python3-config-dir=PATH Python's config directory],
985 [ vi_cv_path_python3_conf="${withval}" ] )
986
987 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
988 [
989 vi_cv_path_python3_conf=
990 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
Bram Moolenaar9f5e36b2010-07-24 16:11:21 +0200991 for subdir in lib64 lib share; do
Bram Moolenaar3804aeb2010-07-19 21:18:54 +0200992 d="${path}/${subdir}/python${vi_cv_var_python3_version}/config"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200993 if test -d "$d" && test -f "$d/config.c"; then
994 vi_cv_path_python3_conf="$d"
995 fi
996 done
997 done
998 ])
999
1000 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
1001
1002 if test "X$PYTHON3_CONFDIR" = "X"; then
1003 AC_MSG_RESULT([can't find it!])
1004 else
1005
1006 dnl -- we need to examine Python's config/Makefile too
1007 dnl see what the interpreter is built from
1008 AC_CACHE_VAL(vi_cv_path_python3_plibs,
1009 [
1010 pwd=`pwd`
1011 tmp_mkf="$pwd/config-PyMake$$"
1012 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
1013__:
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001014 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001015 @echo "python3_LIBS='$(LIBS)'"
1016 @echo "python3_SYSLIBS='$(SYSLIBS)'"
1017 @echo "python3_LINKFORSHARED='$(LINKFORSHARED)'"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001018 @echo "python3_INSTSONAME='$(INSTSONAME)'"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001019eof
1020 dnl -- delete the lines from make about Entering/Leaving directory
1021 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1022 rm -f -- "${tmp_mkf}"
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001023 vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}"
1024 vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS} ${python3_LINKFORSHARED}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001025 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1026 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1027 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1028 ])
1029
1030 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
1031 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001032 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001033 else
Bram Moolenaar3804aeb2010-07-19 21:18:54 +02001034 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}"
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001035 fi
1036 PYTHON3_SRC="if_python3.c"
1037 dnl For Mac OSX 10.2 config.o is included in the Python library.
1038 if test "x$MACOSX" = "xyes"; then
1039 PYTHON3_OBJ="objects/if_python3.o"
1040 else
1041 PYTHON3_OBJ="objects/if_python3.o objects/py3_config.o"
1042 fi
1043
1044 dnl On FreeBSD linking with "-pthread" is required to use threads.
1045 dnl _THREAD_SAFE must be used for compiling then.
1046 dnl The "-pthread" is added to $LIBS, so that the following check for
1047 dnl sigaltstack() will look in libc_r (it's there in libc!).
1048 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1049 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1050 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1051 AC_MSG_CHECKING([if -pthread should be used])
1052 threadsafe_flag=
1053 thread_lib=
1054 dnl if test "x$MACOSX" != "xyes"; then
1055 if test "`(uname) 2>/dev/null`" != Darwin; then
1056 test "$GCC" = yes && threadsafe_flag="-pthread"
1057 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1058 threadsafe_flag="-D_THREAD_SAFE"
1059 thread_lib="-pthread"
1060 fi
1061 fi
1062 libs_save_old=$LIBS
1063 if test -n "$threadsafe_flag"; then
1064 cflags_save=$CFLAGS
1065 CFLAGS="$CFLAGS $threadsafe_flag"
1066 LIBS="$LIBS $thread_lib"
1067 AC_TRY_LINK(,[ ],
1068 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1069 AC_MSG_RESULT(no); LIBS=$libs_save_old
1070 )
1071 CFLAGS=$cflags_save
1072 else
1073 AC_MSG_RESULT(no)
1074 fi
1075
1076 dnl check that compiling a simple program still works with the flags
1077 dnl added for Python.
1078 AC_MSG_CHECKING([if compile and link flags for Python are sane])
1079 cflags_save=$CFLAGS
1080 libs_save=$LIBS
1081 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1082 LIBS="$LIBS $PYTHON3_LIBS"
1083 AC_TRY_LINK(,[ ],
1084 AC_MSG_RESULT(yes); python3_ok=yes,
1085 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1086 CFLAGS=$cflags_save
1087 LIBS=$libs_save
1088 if test "$python3_ok" = yes; then
1089 AC_DEFINE(FEAT_PYTHON3)
1090 else
1091 LIBS=$libs_save_old
1092 PYTHON3_SRC=
1093 PYTHON3_OBJ=
1094 PYTHON3_LIBS=
1095 PYTHON3_CFLAGS=
1096 fi
1097 fi
1098 fi
1099fi
1100
1101AC_SUBST(PYTHON3_CONFDIR)
1102AC_SUBST(PYTHON3_LIBS)
1103AC_SUBST(PYTHON3_CFLAGS)
1104AC_SUBST(PYTHON3_SRC)
1105AC_SUBST(PYTHON3_OBJ)
1106
1107dnl if python2.x and python3.x are enabled one can only link in code
1108dnl with dlopen(), dlsym(), dlclose()
1109if test "$python_ok" = yes && test "$python3_ok" = yes; then
1110 AC_DEFINE(DYNAMIC_PYTHON)
1111 AC_DEFINE(DYNAMIC_PYTHON3)
1112 PYTHON_SRC="if_python.c"
1113 PYTHON_OBJ="objects/if_python.o"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001114 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001115 PYTHON_LIBS=
1116 PYTHON3_SRC="if_python3.c"
1117 PYTHON3_OBJ="objects/if_python3.o"
Bram Moolenaar2a7e2a62010-07-24 15:19:11 +02001118 PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${python3_INSTSONAME}\\\""
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +02001119 PYTHON3_LIBS=
1120fi
1121
Bram Moolenaar071d4272004-06-13 20:20:40 +00001122AC_MSG_CHECKING(--enable-tclinterp argument)
1123AC_ARG_ENABLE(tclinterp,
1124 [ --enable-tclinterp Include Tcl interpreter.], ,
1125 [enable_tclinterp="no"])
1126AC_MSG_RESULT($enable_tclinterp)
1127
1128if test "$enable_tclinterp" = "yes"; then
1129
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001130 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001131 AC_MSG_CHECKING(--with-tclsh argument)
1132 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
1133 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001134 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001135 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1136 AC_SUBST(vi_cv_path_tcl)
1137
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001138 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1139 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1140 tclsh_name="tclsh8.4"
1141 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1142 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001143 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001144 tclsh_name="tclsh8.2"
1145 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1146 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001147 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1148 tclsh_name="tclsh8.0"
1149 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1150 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001151 dnl still didn't find it, try without version number
1152 if test "X$vi_cv_path_tcl" = "X"; then
1153 tclsh_name="tclsh"
1154 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1155 fi
1156 if test "X$vi_cv_path_tcl" != "X"; then
1157 AC_MSG_CHECKING(Tcl version)
1158 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
1159 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1160 AC_MSG_RESULT($tclver - OK);
1161 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 -`
1162
1163 AC_MSG_CHECKING(for location of Tcl include)
1164 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001165 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 +00001166 else
1167 dnl For Mac OS X 10.3, use the OS-provided framework location
1168 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
1169 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +00001170 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001171 for try in $tclinc; do
1172 if test -f "$try/tcl.h"; then
1173 AC_MSG_RESULT($try/tcl.h)
1174 TCL_INC=$try
1175 break
1176 fi
1177 done
1178 if test -z "$TCL_INC"; then
1179 AC_MSG_RESULT(<not found>)
1180 SKIP_TCL=YES
1181 fi
1182 if test -z "$SKIP_TCL"; then
1183 AC_MSG_CHECKING(for location of tclConfig.sh script)
1184 if test "x$MACOSX" != "xyes"; then
1185 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001186 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001187 else
1188 dnl For Mac OS X 10.3, use the OS-provided framework location
1189 tclcnf="/System/Library/Frameworks/Tcl.framework"
1190 fi
1191 for try in $tclcnf; do
1192 if test -f $try/tclConfig.sh; then
1193 AC_MSG_RESULT($try/tclConfig.sh)
1194 . $try/tclConfig.sh
1195 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
1196 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1197 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +00001198 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +00001199 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 +00001200 break
1201 fi
1202 done
1203 if test -z "$TCL_LIBS"; then
1204 AC_MSG_RESULT(<not found>)
1205 AC_MSG_CHECKING(for Tcl library by myself)
1206 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +00001207 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001208 for ext in .so .a ; do
1209 for ver in "" $tclver ; do
1210 for try in $tcllib ; do
1211 trylib=tcl$ver$ext
1212 if test -f $try/lib$trylib ; then
1213 AC_MSG_RESULT($try/lib$trylib)
1214 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
1215 if test "`(uname) 2>/dev/null`" = SunOS &&
1216 uname -r | grep '^5' >/dev/null; then
1217 TCL_LIBS="$TCL_LIBS -R $try"
1218 fi
1219 break 3
1220 fi
1221 done
1222 done
1223 done
1224 if test -z "$TCL_LIBS"; then
1225 AC_MSG_RESULT(<not found>)
1226 SKIP_TCL=YES
1227 fi
1228 fi
1229 if test -z "$SKIP_TCL"; then
1230 AC_DEFINE(FEAT_TCL)
1231 TCL_SRC=if_tcl.c
1232 TCL_OBJ=objects/if_tcl.o
1233 TCL_PRO=if_tcl.pro
1234 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1235 fi
1236 fi
1237 else
1238 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
1239 fi
1240 fi
1241fi
1242AC_SUBST(TCL_SRC)
1243AC_SUBST(TCL_OBJ)
1244AC_SUBST(TCL_PRO)
1245AC_SUBST(TCL_CFLAGS)
1246AC_SUBST(TCL_LIBS)
1247
1248AC_MSG_CHECKING(--enable-rubyinterp argument)
1249AC_ARG_ENABLE(rubyinterp,
1250 [ --enable-rubyinterp Include Ruby interpreter.], ,
1251 [enable_rubyinterp="no"])
1252AC_MSG_RESULT($enable_rubyinterp)
1253if test "$enable_rubyinterp" = "yes"; then
Bram Moolenaar165641d2010-02-17 16:23:09 +01001254 AC_MSG_CHECKING(--with-ruby-command argument)
1255 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
1256 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
1257 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001258 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001259 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001260 if test "X$vi_cv_path_ruby" != "X"; then
1261 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +00001262 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 +00001263 AC_MSG_RESULT(OK)
1264 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar165641d2010-02-17 16:23:09 +01001265 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 +00001266 if test "X$rubyhdrdir" != "X"; then
1267 AC_MSG_RESULT($rubyhdrdir)
1268 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +01001269 rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
1270 if test -d "$rubyhdrdir/$rubyarch"; then
1271 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
1272 fi
1273 rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
1274 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001275 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
1276 if test "X$rubylibs" != "X"; then
1277 RUBY_LIBS="$rubylibs"
1278 fi
1279 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
1280 if test -f "$rubyhdrdir/$librubyarg"; then
1281 librubyarg="$rubyhdrdir/$librubyarg"
1282 else
1283 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
1284 if test -f "$rubylibdir/$librubyarg"; then
1285 librubyarg="$rubylibdir/$librubyarg"
1286 elif test "$librubyarg" = "libruby.a"; then
1287 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1288 librubyarg="-lruby"
1289 else
1290 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
1291 fi
1292 fi
1293
1294 if test "X$librubyarg" != "X"; then
1295 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1296 fi
1297 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
1298 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001299 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1300 dnl be included if requested by passing --with-mac-arch to
1301 dnl configure, so strip these flags first (if present)
Bram Moolenaar5dff57d2010-07-24 16:19:44 +02001302 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001303 if test "X$rubyldflags" != "X"; then
1304 LDFLAGS="$rubyldflags $LDFLAGS"
1305 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001306 fi
1307 RUBY_SRC="if_ruby.c"
1308 RUBY_OBJ="objects/if_ruby.o"
1309 RUBY_PRO="if_ruby.pro"
1310 AC_DEFINE(FEAT_RUBY)
1311 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001312 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001313 fi
1314 else
1315 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1316 fi
1317 fi
1318fi
1319AC_SUBST(RUBY_SRC)
1320AC_SUBST(RUBY_OBJ)
1321AC_SUBST(RUBY_PRO)
1322AC_SUBST(RUBY_CFLAGS)
1323AC_SUBST(RUBY_LIBS)
1324
1325AC_MSG_CHECKING(--enable-cscope argument)
1326AC_ARG_ENABLE(cscope,
1327 [ --enable-cscope Include cscope interface.], ,
1328 [enable_cscope="no"])
1329AC_MSG_RESULT($enable_cscope)
1330if test "$enable_cscope" = "yes"; then
1331 AC_DEFINE(FEAT_CSCOPE)
1332fi
1333
1334AC_MSG_CHECKING(--enable-workshop argument)
1335AC_ARG_ENABLE(workshop,
1336 [ --enable-workshop Include Sun Visual Workshop support.], ,
1337 [enable_workshop="no"])
1338AC_MSG_RESULT($enable_workshop)
1339if test "$enable_workshop" = "yes"; then
1340 AC_DEFINE(FEAT_SUN_WORKSHOP)
1341 WORKSHOP_SRC="workshop.c integration.c"
1342 AC_SUBST(WORKSHOP_SRC)
1343 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1344 AC_SUBST(WORKSHOP_OBJ)
1345 if test "${enable_gui-xxx}" = xxx; then
1346 enable_gui=motif
1347 fi
1348fi
1349
1350AC_MSG_CHECKING(--disable-netbeans argument)
1351AC_ARG_ENABLE(netbeans,
1352 [ --disable-netbeans Disable NetBeans integration support.],
1353 , [enable_netbeans="yes"])
1354if test "$enable_netbeans" = "yes"; then
1355 AC_MSG_RESULT(no)
1356 dnl On Solaris we need the socket and nsl library.
1357 AC_CHECK_LIB(socket, socket)
1358 AC_CHECK_LIB(nsl, gethostbyname)
1359 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1360 AC_TRY_LINK([
1361#include <stdio.h>
1362#include <stdlib.h>
1363#include <stdarg.h>
1364#include <fcntl.h>
1365#include <netdb.h>
1366#include <netinet/in.h>
1367#include <errno.h>
1368#include <sys/types.h>
1369#include <sys/socket.h>
1370 /* Check bitfields */
1371 struct nbbuf {
1372 unsigned int initDone:1;
1373 ushort signmaplen;
1374 };
1375 ], [
1376 /* Check creating a socket. */
1377 struct sockaddr_in server;
1378 (void)socket(AF_INET, SOCK_STREAM, 0);
1379 (void)htons(100);
1380 (void)gethostbyname("microsoft.com");
1381 if (errno == ECONNREFUSED)
1382 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1383 ],
1384 AC_MSG_RESULT(yes),
1385 AC_MSG_RESULT(no); enable_netbeans="no")
1386else
1387 AC_MSG_RESULT(yes)
1388fi
1389if test "$enable_netbeans" = "yes"; then
1390 AC_DEFINE(FEAT_NETBEANS_INTG)
1391 NETBEANS_SRC="netbeans.c"
1392 AC_SUBST(NETBEANS_SRC)
1393 NETBEANS_OBJ="objects/netbeans.o"
1394 AC_SUBST(NETBEANS_OBJ)
1395fi
1396
1397AC_MSG_CHECKING(--enable-sniff argument)
1398AC_ARG_ENABLE(sniff,
1399 [ --enable-sniff Include Sniff interface.], ,
1400 [enable_sniff="no"])
1401AC_MSG_RESULT($enable_sniff)
1402if test "$enable_sniff" = "yes"; then
1403 AC_DEFINE(FEAT_SNIFF)
1404 SNIFF_SRC="if_sniff.c"
1405 AC_SUBST(SNIFF_SRC)
1406 SNIFF_OBJ="objects/if_sniff.o"
1407 AC_SUBST(SNIFF_OBJ)
1408fi
1409
1410AC_MSG_CHECKING(--enable-multibyte argument)
1411AC_ARG_ENABLE(multibyte,
1412 [ --enable-multibyte Include multibyte editing support.], ,
1413 [enable_multibyte="no"])
1414AC_MSG_RESULT($enable_multibyte)
1415if test "$enable_multibyte" = "yes"; then
1416 AC_DEFINE(FEAT_MBYTE)
1417fi
1418
1419AC_MSG_CHECKING(--enable-hangulinput argument)
1420AC_ARG_ENABLE(hangulinput,
1421 [ --enable-hangulinput Include Hangul input support.], ,
1422 [enable_hangulinput="no"])
1423AC_MSG_RESULT($enable_hangulinput)
1424
1425AC_MSG_CHECKING(--enable-xim argument)
1426AC_ARG_ENABLE(xim,
1427 [ --enable-xim Include XIM input support.],
1428 AC_MSG_RESULT($enable_xim),
1429 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001430
1431AC_MSG_CHECKING(--enable-fontset argument)
1432AC_ARG_ENABLE(fontset,
1433 [ --enable-fontset Include X fontset output support.], ,
1434 [enable_fontset="no"])
1435AC_MSG_RESULT($enable_fontset)
1436dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1437
1438test -z "$with_x" && with_x=yes
1439test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1440if test "$with_x" = no; then
1441 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1442else
1443 dnl Do this check early, so that its failure can override user requests.
1444
1445 AC_PATH_PROG(xmkmfpath, xmkmf)
1446
1447 AC_PATH_XTRA
1448
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001449 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001450 dnl be compiled with a special option.
1451 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001452 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001453 CFLAGS="$CFLAGS -W c,dll"
1454 LDFLAGS="$LDFLAGS -W l,dll"
1455 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1456 fi
1457
1458 dnl On my HPUX system the X include dir is found, but the lib dir not.
1459 dnl This is a desparate try to fix this.
1460
1461 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1462 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1463 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1464 X_LIBS="$X_LIBS -L$x_libraries"
1465 if test "`(uname) 2>/dev/null`" = SunOS &&
1466 uname -r | grep '^5' >/dev/null; then
1467 X_LIBS="$X_LIBS -R $x_libraries"
1468 fi
1469 fi
1470
1471 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1472 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1473 AC_MSG_RESULT(Corrected X includes to $x_includes)
1474 X_CFLAGS="$X_CFLAGS -I$x_includes"
1475 fi
1476
1477 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1478 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1479 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1480 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1481 dnl Same for "-R/usr/lib ".
1482 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1483
1484
1485 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001486 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1487 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001488 AC_MSG_CHECKING(if X11 header files can be found)
1489 cflags_save=$CFLAGS
1490 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001491 AC_TRY_COMPILE([#include <X11/Xlib.h>
1492#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001493 AC_MSG_RESULT(yes),
1494 AC_MSG_RESULT(no); no_x=yes)
1495 CFLAGS=$cflags_save
1496
1497 if test "${no_x-no}" = yes; then
1498 with_x=no
1499 else
1500 AC_DEFINE(HAVE_X11)
1501 X_LIB="-lXt -lX11";
1502 AC_SUBST(X_LIB)
1503
1504 ac_save_LDFLAGS="$LDFLAGS"
1505 LDFLAGS="-L$x_libraries $LDFLAGS"
1506
1507 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1508 dnl For HP-UX 10.20 it must be before -lSM -lICE
1509 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1510 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1511
1512 dnl Some systems need -lnsl -lsocket when testing for ICE.
1513 dnl The check above doesn't do this, try here (again). Also needed to get
1514 dnl them after Xdmcp. link.sh will remove them when not needed.
1515 dnl Check for other function than above to avoid the cached value
1516 AC_CHECK_LIB(ICE, IceOpenConnection,
1517 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1518
1519 dnl Check for -lXpm (needed for some versions of Motif)
1520 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1521 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1522 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1523
1524 dnl Check that the X11 header files don't use implicit declarations
1525 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1526 cflags_save=$CFLAGS
1527 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1528 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1529 AC_MSG_RESULT(no),
1530 CFLAGS="$CFLAGS -Wno-implicit-int"
1531 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1532 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1533 AC_MSG_RESULT(test failed)
1534 )
1535 )
1536 CFLAGS=$cflags_save
1537
1538 LDFLAGS="$ac_save_LDFLAGS"
1539
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001540 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1541 AC_CACHE_VAL(ac_cv_small_wchar_t,
1542 [AC_TRY_RUN([
1543#include <X11/Xlib.h>
1544#if STDC_HEADERS
1545# include <stdlib.h>
1546# include <stddef.h>
1547#endif
1548 main()
1549 {
1550 if (sizeof(wchar_t) <= 2)
1551 exit(1);
1552 exit(0);
1553 }],
1554 ac_cv_small_wchar_t="no",
1555 ac_cv_small_wchar_t="yes",
1556 AC_MSG_ERROR(failed to compile test program))])
1557 AC_MSG_RESULT($ac_cv_small_wchar_t)
1558 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1559 AC_DEFINE(SMALL_WCHAR_T)
1560 fi
1561
Bram Moolenaar071d4272004-06-13 20:20:40 +00001562 fi
1563fi
1564
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001565test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001566
1567AC_MSG_CHECKING(--enable-gui argument)
1568AC_ARG_ENABLE(gui,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001569 [ --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 +00001570
1571dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1572dnl Do not use character classes for portability with old tools.
1573enable_gui_canon=`echo "_$enable_gui" | \
1574 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1575
1576dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001577SKIP_GTK2=YES
1578SKIP_GNOME=YES
1579SKIP_MOTIF=YES
1580SKIP_ATHENA=YES
1581SKIP_NEXTAW=YES
1582SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001583SKIP_CARBON=YES
1584GUITYPE=NONE
1585
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001586if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001587 SKIP_PHOTON=
1588 case "$enable_gui_canon" in
1589 no) AC_MSG_RESULT(no GUI support)
1590 SKIP_PHOTON=YES ;;
1591 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1592 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1593 photon) AC_MSG_RESULT(Photon GUI support) ;;
1594 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1595 SKIP_PHOTON=YES ;;
1596 esac
1597
1598elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1599 SKIP_CARBON=
1600 case "$enable_gui_canon" in
1601 no) AC_MSG_RESULT(no GUI support)
1602 SKIP_CARBON=YES ;;
1603 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
Bram Moolenaar164fca32010-07-14 13:58:07 +02001604 auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
1605 SKIP_CARBON=YES ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001606 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1607 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1608 SKIP_CARBON=YES ;;
1609 esac
1610
1611else
1612
Bram Moolenaar071d4272004-06-13 20:20:40 +00001613 case "$enable_gui_canon" in
1614 no|none) AC_MSG_RESULT(no GUI support) ;;
1615 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001616 SKIP_GTK2=
1617 SKIP_GNOME=
1618 SKIP_MOTIF=
1619 SKIP_ATHENA=
1620 SKIP_NEXTAW=
1621 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001622 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001623 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001624 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1625 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001626 SKIP_GTK2=;;
1627 motif) AC_MSG_RESULT(Motif GUI support)
1628 SKIP_MOTIF=;;
1629 athena) AC_MSG_RESULT(Athena GUI support)
1630 SKIP_ATHENA=;;
1631 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1632 SKIP_NEXTAW=;;
1633 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1634 esac
1635
1636fi
1637
Bram Moolenaar071d4272004-06-13 20:20:40 +00001638if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1639 -a "$enable_gui_canon" != "gnome2"; then
1640 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1641 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001642 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001643 , enable_gtk2_check="yes")
1644 AC_MSG_RESULT($enable_gtk2_check)
1645 if test "x$enable_gtk2_check" = "xno"; then
1646 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001647 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001648 fi
1649fi
1650
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001651if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001652 AC_MSG_CHECKING(whether or not to look for GNOME)
1653 AC_ARG_ENABLE(gnome-check,
1654 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1655 , enable_gnome_check="no")
1656 AC_MSG_RESULT($enable_gnome_check)
1657 if test "x$enable_gnome_check" = "xno"; then
1658 SKIP_GNOME=YES
1659 fi
1660fi
1661
1662if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1663 AC_MSG_CHECKING(whether or not to look for Motif)
1664 AC_ARG_ENABLE(motif-check,
1665 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1666 , enable_motif_check="yes")
1667 AC_MSG_RESULT($enable_motif_check)
1668 if test "x$enable_motif_check" = "xno"; then
1669 SKIP_MOTIF=YES
1670 fi
1671fi
1672
1673if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1674 AC_MSG_CHECKING(whether or not to look for Athena)
1675 AC_ARG_ENABLE(athena-check,
1676 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1677 , enable_athena_check="yes")
1678 AC_MSG_RESULT($enable_athena_check)
1679 if test "x$enable_athena_check" = "xno"; then
1680 SKIP_ATHENA=YES
1681 fi
1682fi
1683
1684if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1685 AC_MSG_CHECKING(whether or not to look for neXtaw)
1686 AC_ARG_ENABLE(nextaw-check,
1687 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1688 , enable_nextaw_check="yes")
1689 AC_MSG_RESULT($enable_nextaw_check);
1690 if test "x$enable_nextaw_check" = "xno"; then
1691 SKIP_NEXTAW=YES
1692 fi
1693fi
1694
1695if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1696 AC_MSG_CHECKING(whether or not to look for Carbon)
1697 AC_ARG_ENABLE(carbon-check,
1698 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1699 , enable_carbon_check="yes")
1700 AC_MSG_RESULT($enable_carbon_check);
1701 if test "x$enable_carbon_check" = "xno"; then
1702 SKIP_CARBON=YES
1703 fi
1704fi
1705
Bram Moolenaar843ee412004-06-30 16:16:41 +00001706
Bram Moolenaar071d4272004-06-13 20:20:40 +00001707if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1708 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001709 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001710 AC_MSG_RESULT(yes);
1711 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001712 if test "$VIMNAME" = "vim"; then
1713 VIMNAME=Vim
1714 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001715
Bram Moolenaar164fca32010-07-14 13:58:07 +02001716 if test "x$MACARCH" = "xboth"; then
1717 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
1718 else
1719 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
1720 fi
1721
Bram Moolenaar14716812006-05-04 21:54:08 +00001722 dnl Default install directory is not /usr/local
1723 if test x$prefix = xNONE; then
1724 prefix=/Applications
1725 fi
1726
1727 dnl Sorry for the hard coded default
1728 datadir='${prefix}/Vim.app/Contents/Resources'
1729
Bram Moolenaar071d4272004-06-13 20:20:40 +00001730 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001731 SKIP_GTK2=YES;
1732 SKIP_GNOME=YES;
1733 SKIP_MOTIF=YES;
1734 SKIP_ATHENA=YES;
1735 SKIP_NEXTAW=YES;
1736 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001737 SKIP_CARBON=YES
1738fi
1739
Bram Moolenaar071d4272004-06-13 20:20:40 +00001740dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001741dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001742dnl
1743dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001744dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001745dnl
1746AC_DEFUN(AM_PATH_GTK,
1747[
1748 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1749 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001750 min_gtk_version=ifelse([$1], ,2.2.0,$1)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001751 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1752 no_gtk=""
1753 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1754 && $PKG_CONFIG --exists gtk+-2.0; then
1755 {
1756 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1757 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1758 dnl something like that.
1759 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001760 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001761 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1762 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1763 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1764 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1765 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1766 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1767 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1768 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001769 else
1770 no_gtk=yes
1771 fi
1772
1773 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1774 {
1775 ac_save_CFLAGS="$CFLAGS"
1776 ac_save_LIBS="$LIBS"
1777 CFLAGS="$CFLAGS $GTK_CFLAGS"
1778 LIBS="$LIBS $GTK_LIBS"
1779
1780 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001781 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001782 dnl
1783 rm -f conf.gtktest
1784 AC_TRY_RUN([
1785#include <gtk/gtk.h>
1786#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001787#if STDC_HEADERS
1788# include <stdlib.h>
1789# include <stddef.h>
1790#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001791
1792int
1793main ()
1794{
1795int major, minor, micro;
1796char *tmp_version;
1797
1798system ("touch conf.gtktest");
1799
1800/* HP/UX 9 (%@#!) writes to sscanf strings */
1801tmp_version = g_strdup("$min_gtk_version");
1802if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1803 printf("%s, bad version string\n", "$min_gtk_version");
1804 exit(1);
1805 }
1806
1807if ((gtk_major_version > major) ||
1808 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1809 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1810 (gtk_micro_version >= micro)))
1811{
1812 return 0;
1813}
1814return 1;
1815}
1816],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1817 CFLAGS="$ac_save_CFLAGS"
1818 LIBS="$ac_save_LIBS"
1819 }
1820 fi
1821 if test "x$no_gtk" = x ; then
1822 if test "x$enable_gtktest" = "xyes"; then
1823 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1824 else
1825 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1826 fi
1827 ifelse([$2], , :, [$2])
1828 else
1829 {
1830 AC_MSG_RESULT(no)
1831 GTK_CFLAGS=""
1832 GTK_LIBS=""
1833 ifelse([$3], , :, [$3])
1834 }
1835 fi
1836 }
1837 else
1838 GTK_CFLAGS=""
1839 GTK_LIBS=""
1840 ifelse([$3], , :, [$3])
1841 fi
1842 AC_SUBST(GTK_CFLAGS)
1843 AC_SUBST(GTK_LIBS)
1844 rm -f conf.gtktest
1845])
1846
1847dnl ---------------------------------------------------------------------------
1848dnl gnome
1849dnl ---------------------------------------------------------------------------
1850AC_DEFUN([GNOME_INIT_HOOK],
1851[
1852 AC_SUBST(GNOME_LIBS)
1853 AC_SUBST(GNOME_LIBDIR)
1854 AC_SUBST(GNOME_INCLUDEDIR)
1855
1856 AC_ARG_WITH(gnome-includes,
1857 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1858 [CFLAGS="$CFLAGS -I$withval"]
1859 )
1860
1861 AC_ARG_WITH(gnome-libs,
1862 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1863 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1864 )
1865
1866 AC_ARG_WITH(gnome,
1867 [ --with-gnome Specify prefix for GNOME files],
1868 if test x$withval = xyes; then
1869 want_gnome=yes
1870 ifelse([$1], [], :, [$1])
1871 else
1872 if test "x$withval" = xno; then
1873 want_gnome=no
1874 else
1875 want_gnome=yes
1876 LDFLAGS="$LDFLAGS -L$withval/lib"
1877 CFLAGS="$CFLAGS -I$withval/include"
1878 gnome_prefix=$withval/lib
1879 fi
1880 fi,
1881 want_gnome=yes)
1882
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001883 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001884 {
1885 AC_MSG_CHECKING(for libgnomeui-2.0)
1886 if $PKG_CONFIG --exists libgnomeui-2.0; then
1887 AC_MSG_RESULT(yes)
1888 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1889 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1890 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001891
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001892 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1893 dnl This might not be the right way but it works for me...
1894 AC_MSG_CHECKING(for FreeBSD)
1895 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1896 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001897 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001898 GNOME_LIBS="$GNOME_LIBS -pthread"
1899 else
1900 AC_MSG_RESULT(no)
1901 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001902 $1
1903 else
1904 AC_MSG_RESULT(not found)
1905 if test "x$2" = xfail; then
1906 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1907 fi
1908 fi
1909 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001910 fi
1911])
1912
1913AC_DEFUN([GNOME_INIT],[
1914 GNOME_INIT_HOOK([],fail)
1915])
1916
1917
1918dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001919dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001920dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001921if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001922
1923 AC_MSG_CHECKING(--disable-gtktest argument)
1924 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1925 , enable_gtktest=yes)
1926 if test "x$enable_gtktest" = "xyes" ; then
1927 AC_MSG_RESULT(gtk test enabled)
1928 else
1929 AC_MSG_RESULT(gtk test disabled)
1930 fi
1931
Bram Moolenaar071d4272004-06-13 20:20:40 +00001932 if test "X$PKG_CONFIG" = "X"; then
1933 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1934 fi
1935
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001936 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001937 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1938 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001939 AM_PATH_GTK(2.2.0,
1940 [GUI_LIB_LOC="$GTK_LIBDIR"
1941 GTK_LIBNAME="$GTK_LIBS"
1942 GUI_INC_LOC="$GTK_CFLAGS"], )
1943 if test "x$GTK_CFLAGS" != "x"; then
1944 SKIP_ATHENA=YES
1945 SKIP_NEXTAW=YES
1946 SKIP_MOTIF=YES
1947 GUITYPE=GTK
1948 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001949 fi
1950 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001951 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001952 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1953 || test "0$gtk_minor_version" -ge 2; then
1954 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1955 fi
1956 dnl
1957 dnl if GTK exists, then check for GNOME.
1958 dnl
1959 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001960 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001961 GNOME_INIT_HOOK([have_gnome=yes])
1962 if test "x$have_gnome" = xyes ; then
1963 AC_DEFINE(FEAT_GUI_GNOME)
1964 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1965 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001966 fi
1967 }
1968 fi
1969 fi
1970fi
1971
1972dnl Check for Motif include files location.
1973dnl The LAST one found is used, this makes the highest version to be used,
1974dnl e.g. when Motif1.2 and Motif2.0 are both present.
1975
1976if test -z "$SKIP_MOTIF"; then
1977 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"
1978 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1979 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1980
1981 AC_MSG_CHECKING(for location of Motif GUI includes)
1982 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1983 GUI_INC_LOC=
1984 for try in $gui_includes; do
1985 if test -f "$try/Xm/Xm.h"; then
1986 GUI_INC_LOC=$try
1987 fi
1988 done
1989 if test -n "$GUI_INC_LOC"; then
1990 if test "$GUI_INC_LOC" = /usr/include; then
1991 GUI_INC_LOC=
1992 AC_MSG_RESULT(in default path)
1993 else
1994 AC_MSG_RESULT($GUI_INC_LOC)
1995 fi
1996 else
1997 AC_MSG_RESULT(<not found>)
1998 SKIP_MOTIF=YES
1999 fi
2000fi
2001
2002dnl Check for Motif library files location. In the same order as the include
2003dnl files, to avoid a mixup if several versions are present
2004
2005if test -z "$SKIP_MOTIF"; then
2006 AC_MSG_CHECKING(--with-motif-lib argument)
2007 AC_ARG_WITH(motif-lib,
2008 [ --with-motif-lib=STRING Library for Motif ],
2009 [ MOTIF_LIBNAME="${withval}" ] )
2010
2011 if test -n "$MOTIF_LIBNAME"; then
2012 AC_MSG_RESULT($MOTIF_LIBNAME)
2013 GUI_LIB_LOC=
2014 else
2015 AC_MSG_RESULT(no)
2016
2017 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
2018 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
2019
2020 AC_MSG_CHECKING(for location of Motif GUI libs)
2021 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"
2022 GUI_LIB_LOC=
2023 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00002024 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00002025 if test -f "$libtry"; then
2026 GUI_LIB_LOC=$try
2027 fi
2028 done
2029 done
2030 if test -n "$GUI_LIB_LOC"; then
2031 dnl Remove /usr/lib, it causes trouble on some systems
2032 if test "$GUI_LIB_LOC" = /usr/lib; then
2033 GUI_LIB_LOC=
2034 AC_MSG_RESULT(in default path)
2035 else
2036 if test -n "$GUI_LIB_LOC"; then
2037 AC_MSG_RESULT($GUI_LIB_LOC)
2038 if test "`(uname) 2>/dev/null`" = SunOS &&
2039 uname -r | grep '^5' >/dev/null; then
2040 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
2041 fi
2042 fi
2043 fi
2044 MOTIF_LIBNAME=-lXm
2045 else
2046 AC_MSG_RESULT(<not found>)
2047 SKIP_MOTIF=YES
2048 fi
2049 fi
2050fi
2051
2052if test -z "$SKIP_MOTIF"; then
2053 SKIP_ATHENA=YES
2054 SKIP_NEXTAW=YES
2055 GUITYPE=MOTIF
2056 AC_SUBST(MOTIF_LIBNAME)
2057fi
2058
2059dnl Check if the Athena files can be found
2060
2061GUI_X_LIBS=
2062
2063if test -z "$SKIP_ATHENA"; then
2064 AC_MSG_CHECKING(if Athena header files can be found)
2065 cflags_save=$CFLAGS
2066 CFLAGS="$CFLAGS $X_CFLAGS"
2067 AC_TRY_COMPILE([
2068#include <X11/Intrinsic.h>
2069#include <X11/Xaw/Paned.h>], ,
2070 AC_MSG_RESULT(yes),
2071 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
2072 CFLAGS=$cflags_save
2073fi
2074
2075if test -z "$SKIP_ATHENA"; then
2076 GUITYPE=ATHENA
2077fi
2078
2079if test -z "$SKIP_NEXTAW"; then
2080 AC_MSG_CHECKING(if neXtaw header files can be found)
2081 cflags_save=$CFLAGS
2082 CFLAGS="$CFLAGS $X_CFLAGS"
2083 AC_TRY_COMPILE([
2084#include <X11/Intrinsic.h>
2085#include <X11/neXtaw/Paned.h>], ,
2086 AC_MSG_RESULT(yes),
2087 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
2088 CFLAGS=$cflags_save
2089fi
2090
2091if test -z "$SKIP_NEXTAW"; then
2092 GUITYPE=NEXTAW
2093fi
2094
2095if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2096 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
2097 dnl Avoid adding it when it twice
2098 if test -n "$GUI_INC_LOC"; then
2099 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
2100 fi
2101 if test -n "$GUI_LIB_LOC"; then
2102 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
2103 fi
2104
2105 dnl Check for -lXext and then for -lXmu
2106 ldflags_save=$LDFLAGS
2107 LDFLAGS="$X_LIBS $LDFLAGS"
2108 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
2109 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2110 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
2111 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
2112 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2113 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
2114 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2115 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
2116 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2117 if test -z "$SKIP_MOTIF"; then
2118 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
2119 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2120 fi
2121 LDFLAGS=$ldflags_save
2122
2123 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
2124 AC_MSG_CHECKING(for extra X11 defines)
2125 NARROW_PROTO=
2126 rm -fr conftestdir
2127 if mkdir conftestdir; then
2128 cd conftestdir
2129 cat > Imakefile <<'EOF'
2130acfindx:
2131 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
2132EOF
2133 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2134 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
2135 fi
2136 cd ..
2137 rm -fr conftestdir
2138 fi
2139 if test -z "$NARROW_PROTO"; then
2140 AC_MSG_RESULT(no)
2141 else
2142 AC_MSG_RESULT($NARROW_PROTO)
2143 fi
2144 AC_SUBST(NARROW_PROTO)
2145fi
2146
2147dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
2148dnl use the X11 include path
2149if test "$enable_xsmp" = "yes"; then
2150 cppflags_save=$CPPFLAGS
2151 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2152 AC_CHECK_HEADERS(X11/SM/SMlib.h)
2153 CPPFLAGS=$cppflags_save
2154fi
2155
2156
Bram Moolenaare667c952010-07-05 22:57:59 +02002157if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002158 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
2159 cppflags_save=$CPPFLAGS
2160 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2161 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
2162
2163 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
2164 if test ! "$enable_xim" = "no"; then
2165 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
2166 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
2167 AC_MSG_RESULT(yes),
2168 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
2169 fi
2170 CPPFLAGS=$cppflags_save
2171
2172 dnl automatically enable XIM when hangul input isn't enabled
2173 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
2174 -a "x$GUITYPE" != "xNONE" ; then
2175 AC_MSG_RESULT(X GUI selected; xim has been enabled)
2176 enable_xim="yes"
2177 fi
2178fi
2179
2180if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2181 cppflags_save=$CPPFLAGS
2182 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002183dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
2184 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
2185 AC_TRY_COMPILE([
2186#include <X11/Intrinsic.h>
2187#include <X11/Xmu/Editres.h>],
2188 [int i; i = 0;],
2189 AC_MSG_RESULT(yes)
2190 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
2191 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00002192 CPPFLAGS=$cppflags_save
2193fi
2194
2195dnl Only use the Xm directory when compiling Motif, don't use it for Athena
2196if test -z "$SKIP_MOTIF"; then
2197 cppflags_save=$CPPFLAGS
2198 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002199 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 +00002200 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002201
2202 if test $ac_cv_header_Xm_XpmP_h = yes; then
2203 dnl Solaris uses XpmAttributes_21, very annoying.
2204 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
2205 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
2206 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
2207 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2208 )
2209 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00002210 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002211 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002212 CPPFLAGS=$cppflags_save
2213fi
2214
2215if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
2216 AC_MSG_RESULT(no GUI selected; xim has been disabled)
2217 enable_xim="no"
2218fi
2219if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
2220 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
2221 enable_fontset="no"
2222fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02002223if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002224 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
2225 enable_fontset="no"
2226fi
2227
Bram Moolenaar071d4272004-06-13 20:20:40 +00002228if test -z "$SKIP_PHOTON"; then
2229 GUITYPE=PHOTONGUI
2230fi
2231
2232AC_SUBST(GUI_INC_LOC)
2233AC_SUBST(GUI_LIB_LOC)
2234AC_SUBST(GUITYPE)
2235AC_SUBST(GUI_X_LIBS)
2236
2237if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2238 AC_MSG_ERROR([cannot use workshop without Motif])
2239fi
2240
2241dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2242if test "$enable_xim" = "yes"; then
2243 AC_DEFINE(FEAT_XIM)
2244fi
2245if test "$enable_fontset" = "yes"; then
2246 AC_DEFINE(FEAT_XFONTSET)
2247fi
2248
2249
2250dnl ---------------------------------------------------------------------------
2251dnl end of GUI-checking
2252dnl ---------------------------------------------------------------------------
2253
2254
2255dnl Only really enable hangul input when GUI and XFONTSET are available
2256if test "$enable_hangulinput" = "yes"; then
2257 if test "x$GUITYPE" = "xNONE"; then
2258 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2259 enable_hangulinput=no
2260 else
2261 AC_DEFINE(FEAT_HANGULIN)
2262 HANGULIN_SRC=hangulin.c
2263 AC_SUBST(HANGULIN_SRC)
2264 HANGULIN_OBJ=objects/hangulin.o
2265 AC_SUBST(HANGULIN_OBJ)
2266 fi
2267fi
2268
2269dnl Checks for libraries and include files.
2270
Bram Moolenaar446cb832008-06-24 21:56:24 +00002271AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
2272 [
2273 AC_RUN_IFELSE([[
2274#include "confdefs.h"
2275#include <ctype.h>
2276#if STDC_HEADERS
2277# include <stdlib.h>
2278# include <stddef.h>
2279#endif
2280main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2281 ]],[
2282 vim_cv_toupper_broken=yes
2283 ],[
2284 vim_cv_toupper_broken=no
2285 ],[
2286 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2287 ])])
2288
2289if test "x$vim_cv_toupper_broken" = "xyes" ; then
2290 AC_DEFINE(BROKEN_TOUPPER)
2291fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002292
2293AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002294AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002295 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2296 AC_MSG_RESULT(no))
2297
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002298AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2299AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2300 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2301 AC_MSG_RESULT(no))
2302
Bram Moolenaar071d4272004-06-13 20:20:40 +00002303dnl Checks for header files.
2304AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2305dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2306if test "$HAS_ELF" = 1; then
2307 AC_CHECK_LIB(elf, main)
2308fi
2309
2310AC_HEADER_DIRENT
2311
Bram Moolenaar071d4272004-06-13 20:20:40 +00002312dnl If sys/wait.h is not found it might still exist but not be POSIX
2313dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2314if test $ac_cv_header_sys_wait_h = no; then
2315 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2316 AC_TRY_COMPILE([#include <sys/wait.h>],
2317 [union wait xx, yy; xx = yy],
2318 AC_MSG_RESULT(yes)
2319 AC_DEFINE(HAVE_SYS_WAIT_H)
2320 AC_DEFINE(HAVE_UNION_WAIT),
2321 AC_MSG_RESULT(no))
2322fi
2323
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002324AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2325 sys/select.h sys/utsname.h termcap.h fcntl.h \
2326 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2327 termio.h iconv.h inttypes.h langinfo.h math.h \
2328 unistd.h stropts.h errno.h sys/resource.h \
2329 sys/systeminfo.h locale.h sys/stream.h termios.h \
2330 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2331 utime.h sys/param.h libintl.h libgen.h \
2332 util/debug.h util/msg18n.h frame.h sys/acl.h \
2333 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002334
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002335dnl sys/ptem.h depends on sys/stream.h on Solaris
2336AC_CHECK_HEADERS(sys/ptem.h, [], [],
2337[#if defined HAVE_SYS_STREAM_H
2338# include <sys/stream.h>
2339#endif])
2340
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002341dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2342AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2343[#if defined HAVE_SYS_PARAM_H
2344# include <sys/param.h>
2345#endif])
2346
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002347
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002348dnl pthread_np.h may exist but can only be used after including pthread.h
2349AC_MSG_CHECKING([for pthread_np.h])
2350AC_TRY_COMPILE([
2351#include <pthread.h>
2352#include <pthread_np.h>],
2353 [int i; i = 0;],
2354 AC_MSG_RESULT(yes)
2355 AC_DEFINE(HAVE_PTHREAD_NP_H),
2356 AC_MSG_RESULT(no))
2357
Bram Moolenaare344bea2005-09-01 20:46:49 +00002358AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002359if test "x$MACOSX" = "xyes"; then
2360 dnl The strings.h file on OS/X contains a warning and nothing useful.
2361 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2362else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002363
2364dnl Check if strings.h and string.h can both be included when defined.
2365AC_MSG_CHECKING([if strings.h can be included after string.h])
2366cppflags_save=$CPPFLAGS
2367CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2368AC_TRY_COMPILE([
2369#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2370# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2371 /* but don't do it on AIX 5.1 (Uribarri) */
2372#endif
2373#ifdef HAVE_XM_XM_H
2374# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2375#endif
2376#ifdef HAVE_STRING_H
2377# include <string.h>
2378#endif
2379#if defined(HAVE_STRINGS_H)
2380# include <strings.h>
2381#endif
2382 ], [int i; i = 0;],
2383 AC_MSG_RESULT(yes),
2384 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2385 AC_MSG_RESULT(no))
2386CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002387fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002388
2389dnl Checks for typedefs, structures, and compiler characteristics.
2390AC_PROG_GCC_TRADITIONAL
2391AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002392AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002393AC_TYPE_MODE_T
2394AC_TYPE_OFF_T
2395AC_TYPE_PID_T
2396AC_TYPE_SIZE_T
2397AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002398AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002399
Bram Moolenaar071d4272004-06-13 20:20:40 +00002400AC_HEADER_TIME
2401AC_CHECK_TYPE(ino_t, long)
2402AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002403AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002404
2405AC_MSG_CHECKING(for rlim_t)
2406if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2407 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2408else
2409 AC_EGREP_CPP(dnl
2410changequote(<<,>>)dnl
2411<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2412changequote([,]),
2413 [
2414#include <sys/types.h>
2415#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002416# include <stdlib.h>
2417# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002418#endif
2419#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002420# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002421#endif
2422 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2423 AC_MSG_RESULT($ac_cv_type_rlim_t)
2424fi
2425if test $ac_cv_type_rlim_t = no; then
2426 cat >> confdefs.h <<\EOF
2427#define rlim_t unsigned long
2428EOF
2429fi
2430
2431AC_MSG_CHECKING(for stack_t)
2432if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2433 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2434else
2435 AC_EGREP_CPP(stack_t,
2436 [
2437#include <sys/types.h>
2438#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002439# include <stdlib.h>
2440# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002441#endif
2442#include <signal.h>
2443 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2444 AC_MSG_RESULT($ac_cv_type_stack_t)
2445fi
2446if test $ac_cv_type_stack_t = no; then
2447 cat >> confdefs.h <<\EOF
2448#define stack_t struct sigaltstack
2449EOF
2450fi
2451
2452dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2453AC_MSG_CHECKING(whether stack_t has an ss_base field)
2454AC_TRY_COMPILE([
2455#include <sys/types.h>
2456#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002457# include <stdlib.h>
2458# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002459#endif
2460#include <signal.h>
2461#include "confdefs.h"
2462 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2463 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2464 AC_MSG_RESULT(no))
2465
2466olibs="$LIBS"
2467AC_MSG_CHECKING(--with-tlib argument)
2468AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2469if test -n "$with_tlib"; then
2470 AC_MSG_RESULT($with_tlib)
2471 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002472 AC_MSG_CHECKING(for linking with $with_tlib library)
2473 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2474 dnl Need to check for tgetent() below.
2475 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002476else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002477 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002478 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2479 dnl curses, because curses is much slower.
2480 dnl Newer versions of ncurses are preferred over anything.
2481 dnl Older versions of ncurses have bugs, get a new one!
2482 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002483 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002484 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002485 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002486 *) tlibs="ncurses termlib termcap curses";;
2487 esac
2488 for libname in $tlibs; do
2489 AC_CHECK_LIB(${libname}, tgetent,,)
2490 if test "x$olibs" != "x$LIBS"; then
2491 dnl It's possible that a library is found but it doesn't work
2492 dnl e.g., shared library that cannot be found
2493 dnl compile and run a test program to be sure
2494 AC_TRY_RUN([
2495#ifdef HAVE_TERMCAP_H
2496# include <termcap.h>
2497#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002498#if STDC_HEADERS
2499# include <stdlib.h>
2500# include <stddef.h>
2501#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002502main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2503 res="OK", res="FAIL", res="FAIL")
2504 if test "$res" = "OK"; then
2505 break
2506 fi
2507 AC_MSG_RESULT($libname library is not usable)
2508 LIBS="$olibs"
2509 fi
2510 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002511 if test "x$olibs" = "x$LIBS"; then
2512 AC_MSG_RESULT(no terminal library found)
2513 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002514fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002515
2516if test "x$olibs" = "x$LIBS"; then
2517 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002518 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002519 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2520 AC_MSG_RESULT(yes),
2521 AC_MSG_ERROR([NOT FOUND!
2522 You need to install a terminal library; for example ncurses.
2523 Or specify the name of the library with --with-tlib.]))
2524fi
2525
Bram Moolenaar446cb832008-06-24 21:56:24 +00002526AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2527 [
2528 AC_RUN_IFELSE([[
2529#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002530#ifdef HAVE_TERMCAP_H
2531# include <termcap.h>
2532#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002533#ifdef HAVE_STRING_H
2534# include <string.h>
2535#endif
2536#if STDC_HEADERS
2537# include <stdlib.h>
2538# include <stddef.h>
2539#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002540main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002541{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2542 ]],[
2543 vim_cv_terminfo=no
2544 ],[
2545 vim_cv_terminfo=yes
2546 ],[
2547 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2548 ])
2549 ])
2550
2551if test "x$vim_cv_terminfo" = "xyes" ; then
2552 AC_DEFINE(TERMINFO)
2553fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002554
2555if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002556 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2557 [
2558 AC_RUN_IFELSE([[
2559#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002560#ifdef HAVE_TERMCAP_H
2561# include <termcap.h>
2562#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002563#if STDC_HEADERS
2564# include <stdlib.h>
2565# include <stddef.h>
2566#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002567main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002568{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2569 ]],[
2570 vim_cv_tgent=zero
2571 ],[
2572 vim_cv_tgent=non-zero
2573 ],[
2574 AC_MSG_ERROR(failed to compile test program.)
2575 ])
2576 ])
2577
2578 if test "x$vim_cv_tgent" = "xzero" ; then
2579 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2580 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002581fi
2582
2583AC_MSG_CHECKING(whether termcap.h contains ospeed)
2584AC_TRY_LINK([
2585#ifdef HAVE_TERMCAP_H
2586# include <termcap.h>
2587#endif
2588 ], [ospeed = 20000],
2589 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2590 [AC_MSG_RESULT(no)
2591 AC_MSG_CHECKING(whether ospeed can be extern)
2592 AC_TRY_LINK([
2593#ifdef HAVE_TERMCAP_H
2594# include <termcap.h>
2595#endif
2596extern short ospeed;
2597 ], [ospeed = 20000],
2598 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2599 AC_MSG_RESULT(no))]
2600 )
2601
2602AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2603AC_TRY_LINK([
2604#ifdef HAVE_TERMCAP_H
2605# include <termcap.h>
2606#endif
2607 ], [if (UP == 0 && BC == 0) PC = 1],
2608 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2609 [AC_MSG_RESULT(no)
2610 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2611 AC_TRY_LINK([
2612#ifdef HAVE_TERMCAP_H
2613# include <termcap.h>
2614#endif
2615extern char *UP, *BC, PC;
2616 ], [if (UP == 0 && BC == 0) PC = 1],
2617 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2618 AC_MSG_RESULT(no))]
2619 )
2620
2621AC_MSG_CHECKING(whether tputs() uses outfuntype)
2622AC_TRY_COMPILE([
2623#ifdef HAVE_TERMCAP_H
2624# include <termcap.h>
2625#endif
2626 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2627 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2628 AC_MSG_RESULT(no))
2629
2630dnl On some SCO machines sys/select redefines struct timeval
2631AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2632AC_TRY_COMPILE([
2633#include <sys/types.h>
2634#include <sys/time.h>
2635#include <sys/select.h>], ,
2636 AC_MSG_RESULT(yes)
2637 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2638 AC_MSG_RESULT(no))
2639
2640dnl AC_DECL_SYS_SIGLIST
2641
2642dnl Checks for pty.c (copied from screen) ==========================
2643AC_MSG_CHECKING(for /dev/ptc)
2644if test -r /dev/ptc; then
2645 AC_DEFINE(HAVE_DEV_PTC)
2646 AC_MSG_RESULT(yes)
2647else
2648 AC_MSG_RESULT(no)
2649fi
2650
2651AC_MSG_CHECKING(for SVR4 ptys)
2652if test -c /dev/ptmx ; then
2653 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2654 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2655 AC_MSG_RESULT(no))
2656else
2657 AC_MSG_RESULT(no)
2658fi
2659
2660AC_MSG_CHECKING(for ptyranges)
2661if test -d /dev/ptym ; then
2662 pdir='/dev/ptym'
2663else
2664 pdir='/dev'
2665fi
2666dnl SCO uses ptyp%d
2667AC_EGREP_CPP(yes,
2668[#ifdef M_UNIX
2669 yes;
2670#endif
2671 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2672dnl if test -c /dev/ptyp19; then
2673dnl ptys=`echo /dev/ptyp??`
2674dnl else
2675dnl ptys=`echo $pdir/pty??`
2676dnl fi
2677if test "$ptys" != "$pdir/pty??" ; then
2678 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2679 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2680 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2681 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2682 AC_MSG_RESULT([$p0 / $p1])
2683else
2684 AC_MSG_RESULT([don't know])
2685fi
2686
2687dnl **** pty mode/group handling ****
2688dnl
2689dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002690rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002691AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2692 [
2693 AC_RUN_IFELSE([[
2694#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002695#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002696#if STDC_HEADERS
2697# include <stdlib.h>
2698# include <stddef.h>
2699#endif
2700#ifdef HAVE_UNISTD_H
2701#include <unistd.h>
2702#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002703#include <sys/stat.h>
2704#include <stdio.h>
2705main()
2706{
2707 struct stat sb;
2708 char *x,*ttyname();
2709 int om, m;
2710 FILE *fp;
2711
2712 if (!(x = ttyname(0))) exit(1);
2713 if (stat(x, &sb)) exit(1);
2714 om = sb.st_mode;
2715 if (om & 002) exit(0);
2716 m = system("mesg y");
2717 if (m == -1 || m == 127) exit(1);
2718 if (stat(x, &sb)) exit(1);
2719 m = sb.st_mode;
2720 if (chmod(x, om)) exit(1);
2721 if (m & 002) exit(0);
2722 if (sb.st_gid == getgid()) exit(1);
2723 if (!(fp=fopen("conftest_grp", "w")))
2724 exit(1);
2725 fprintf(fp, "%d\n", sb.st_gid);
2726 fclose(fp);
2727 exit(0);
2728}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002729 ]],[
2730 if test -f conftest_grp; then
2731 vim_cv_tty_group=`cat conftest_grp`
2732 if test "x$vim_cv_tty_mode" = "x" ; then
2733 vim_cv_tty_mode=0620
2734 fi
2735 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2736 else
2737 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002738 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002739 fi
2740 ],[
2741 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002742 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002743 ],[
2744 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2745 ])
2746 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002747rm -f conftest_grp
2748
Bram Moolenaar446cb832008-06-24 21:56:24 +00002749if test "x$vim_cv_tty_group" != "xworld" ; then
2750 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2751 if test "x$vim_cv_tty_mode" = "x" ; then
2752 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)])
2753 else
2754 AC_DEFINE(PTYMODE, 0620)
2755 fi
2756fi
2757
Bram Moolenaar071d4272004-06-13 20:20:40 +00002758dnl Checks for library functions. ===================================
2759
2760AC_TYPE_SIGNAL
2761
2762dnl find out what to use at the end of a signal function
2763if test $ac_cv_type_signal = void; then
2764 AC_DEFINE(SIGRETURN, [return])
2765else
2766 AC_DEFINE(SIGRETURN, [return 0])
2767fi
2768
2769dnl check if struct sigcontext is defined (used for SGI only)
2770AC_MSG_CHECKING(for struct sigcontext)
2771AC_TRY_COMPILE([
2772#include <signal.h>
2773test_sig()
2774{
2775 struct sigcontext *scont;
2776 scont = (struct sigcontext *)0;
2777 return 1;
2778} ], ,
2779 AC_MSG_RESULT(yes)
2780 AC_DEFINE(HAVE_SIGCONTEXT),
2781 AC_MSG_RESULT(no))
2782
2783dnl tricky stuff: try to find out if getcwd() is implemented with
2784dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002785AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2786 [
2787 AC_RUN_IFELSE([[
2788#include "confdefs.h"
2789#ifdef HAVE_UNISTD_H
2790#include <unistd.h>
2791#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002792char *dagger[] = { "IFS=pwd", 0 };
2793main()
2794{
2795 char buffer[500];
2796 extern char **environ;
2797 environ = dagger;
2798 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002799}
2800 ]],[
2801 vim_cv_getcwd_broken=no
2802 ],[
2803 vim_cv_getcwd_broken=yes
2804 ],[
2805 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2806 ])
2807 ])
2808
2809if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2810 AC_DEFINE(BAD_GETCWD)
2811fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002812
Bram Moolenaar25153e12010-02-24 14:47:08 +01002813dnl Check for functions in one big call, to reduce the size of configure.
2814dnl Can only be used for functions that do not require any include.
2815AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002816 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002817 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002818 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002819 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002820 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2821 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002822AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002823
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002824dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2825dnl appropriate, so that off_t is 64 bits when needed.
2826AC_SYS_LARGEFILE
2827
Bram Moolenaar071d4272004-06-13 20:20:40 +00002828dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2829AC_MSG_CHECKING(for st_blksize)
2830AC_TRY_COMPILE(
2831[#include <sys/types.h>
2832#include <sys/stat.h>],
2833[ struct stat st;
2834 int n;
2835
2836 stat("/", &st);
2837 n = (int)st.st_blksize;],
2838 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2839 AC_MSG_RESULT(no))
2840
Bram Moolenaar446cb832008-06-24 21:56:24 +00002841AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2842 [
2843 AC_RUN_IFELSE([[
2844#include "confdefs.h"
2845#if STDC_HEADERS
2846# include <stdlib.h>
2847# include <stddef.h>
2848#endif
2849#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002850#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002851main() {struct stat st; exit(stat("configure/", &st) != 0); }
2852 ]],[
2853 vim_cv_stat_ignores_slash=yes
2854 ],[
2855 vim_cv_stat_ignores_slash=no
2856 ],[
2857 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2858 ])
2859 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002860
Bram Moolenaar446cb832008-06-24 21:56:24 +00002861if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2862 AC_DEFINE(STAT_IGNORES_SLASH)
2863fi
2864
Bram Moolenaar071d4272004-06-13 20:20:40 +00002865dnl Link with iconv for charset translation, if not found without library.
2866dnl check for iconv() requires including iconv.h
2867dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2868dnl has been installed.
2869AC_MSG_CHECKING(for iconv_open())
2870save_LIBS="$LIBS"
2871LIBS="$LIBS -liconv"
2872AC_TRY_LINK([
2873#ifdef HAVE_ICONV_H
2874# include <iconv.h>
2875#endif
2876 ], [iconv_open("fr", "to");],
2877 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2878 LIBS="$save_LIBS"
2879 AC_TRY_LINK([
2880#ifdef HAVE_ICONV_H
2881# include <iconv.h>
2882#endif
2883 ], [iconv_open("fr", "to");],
2884 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2885 AC_MSG_RESULT(no)))
2886
2887
2888AC_MSG_CHECKING(for nl_langinfo(CODESET))
2889AC_TRY_LINK([
2890#ifdef HAVE_LANGINFO_H
2891# include <langinfo.h>
2892#endif
2893], [char *cs = nl_langinfo(CODESET);],
2894 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2895 AC_MSG_RESULT(no))
2896
Bram Moolenaar446cb832008-06-24 21:56:24 +00002897dnl Need various functions for floating point support. Only enable
2898dnl floating point when they are all present.
2899AC_CHECK_LIB(m, strtod)
2900AC_MSG_CHECKING([for strtod() and other floating point functions])
2901AC_TRY_LINK([
2902#ifdef HAVE_MATH_H
2903# include <math.h>
2904#endif
2905#if STDC_HEADERS
2906# include <stdlib.h>
2907# include <stddef.h>
2908#endif
2909], [char *s; double d;
2910 d = strtod("1.1", &s);
2911 d = fabs(1.11);
2912 d = ceil(1.11);
2913 d = floor(1.11);
2914 d = log10(1.11);
2915 d = pow(1.11, 2.22);
2916 d = sqrt(1.11);
2917 d = sin(1.11);
2918 d = cos(1.11);
2919 d = atan(1.11);
2920 ],
2921 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2922 AC_MSG_RESULT(no))
2923
Bram Moolenaar071d4272004-06-13 20:20:40 +00002924dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2925dnl when -lacl works, also try to use -lattr (required for Debian).
2926AC_MSG_CHECKING(--disable-acl argument)
2927AC_ARG_ENABLE(acl,
2928 [ --disable-acl Don't check for ACL support.],
2929 , [enable_acl="yes"])
2930if test "$enable_acl" = "yes"; then
2931AC_MSG_RESULT(no)
2932AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2933 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2934 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2935
2936AC_MSG_CHECKING(for POSIX ACL support)
2937AC_TRY_LINK([
2938#include <sys/types.h>
2939#ifdef HAVE_SYS_ACL_H
2940# include <sys/acl.h>
2941#endif
2942acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2943 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2944 acl_free(acl);],
2945 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2946 AC_MSG_RESULT(no))
2947
2948AC_MSG_CHECKING(for Solaris ACL support)
2949AC_TRY_LINK([
2950#ifdef HAVE_SYS_ACL_H
2951# include <sys/acl.h>
2952#endif], [acl("foo", GETACLCNT, 0, NULL);
2953 ],
2954 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2955 AC_MSG_RESULT(no))
2956
2957AC_MSG_CHECKING(for AIX ACL support)
2958AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002959#if STDC_HEADERS
2960# include <stdlib.h>
2961# include <stddef.h>
2962#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002963#ifdef HAVE_SYS_ACL_H
2964# include <sys/acl.h>
2965#endif
2966#ifdef HAVE_SYS_ACCESS_H
2967# include <sys/access.h>
2968#endif
2969#define _ALL_SOURCE
2970
2971#include <sys/stat.h>
2972
2973int aclsize;
2974struct acl *aclent;], [aclsize = sizeof(struct acl);
2975 aclent = (void *)malloc(aclsize);
2976 statacl("foo", STX_NORMAL, aclent, aclsize);
2977 ],
2978 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2979 AC_MSG_RESULT(no))
2980else
2981 AC_MSG_RESULT(yes)
2982fi
2983
2984AC_MSG_CHECKING(--disable-gpm argument)
2985AC_ARG_ENABLE(gpm,
2986 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2987 [enable_gpm="yes"])
2988
2989if test "$enable_gpm" = "yes"; then
2990 AC_MSG_RESULT(no)
2991 dnl Checking if gpm support can be compiled
2992 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2993 [olibs="$LIBS" ; LIBS="-lgpm"]
2994 AC_TRY_LINK(
2995 [#include <gpm.h>
2996 #include <linux/keyboard.h>],
2997 [Gpm_GetLibVersion(NULL);],
2998 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2999 dnl FEAT_MOUSE_GPM if mouse support is included
3000 [vi_cv_have_gpm=yes],
3001 [vi_cv_have_gpm=no])
3002 [LIBS="$olibs"]
3003 )
3004 if test $vi_cv_have_gpm = yes; then
3005 LIBS="$LIBS -lgpm"
3006 AC_DEFINE(HAVE_GPM)
3007 fi
3008else
3009 AC_MSG_RESULT(yes)
3010fi
3011
Bram Moolenaar446cb832008-06-24 21:56:24 +00003012AC_MSG_CHECKING(--disable-sysmouse argument)
3013AC_ARG_ENABLE(sysmouse,
3014 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
3015 [enable_sysmouse="yes"])
3016
3017if test "$enable_sysmouse" = "yes"; then
3018 AC_MSG_RESULT(no)
3019 dnl Checking if sysmouse support can be compiled
3020 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
3021 dnl defines FEAT_SYSMOUSE if mouse support is included
3022 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
3023 AC_TRY_LINK(
3024 [#include <sys/consio.h>
3025 #include <signal.h>
3026 #include <sys/fbio.h>],
3027 [struct mouse_info mouse;
3028 mouse.operation = MOUSE_MODE;
3029 mouse.operation = MOUSE_SHOW;
3030 mouse.u.mode.mode = 0;
3031 mouse.u.mode.signal = SIGUSR2;],
3032 [vi_cv_have_sysmouse=yes],
3033 [vi_cv_have_sysmouse=no])
3034 )
3035 if test $vi_cv_have_sysmouse = yes; then
3036 AC_DEFINE(HAVE_SYSMOUSE)
3037 fi
3038else
3039 AC_MSG_RESULT(yes)
3040fi
3041
Bram Moolenaarf05da212009-11-17 16:13:15 +00003042dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
3043AC_MSG_CHECKING(for FD_CLOEXEC)
3044AC_TRY_COMPILE(
3045[#if HAVE_FCNTL_H
3046# include <fcntl.h>
3047#endif],
3048[ int flag = FD_CLOEXEC;],
3049 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
3050 AC_MSG_RESULT(not usable))
3051
Bram Moolenaar071d4272004-06-13 20:20:40 +00003052dnl rename needs to be checked separately to work on Nextstep with cc
3053AC_MSG_CHECKING(for rename)
3054AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
3055 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
3056 AC_MSG_RESULT(no))
3057
3058dnl sysctl() may exist but not the arguments we use
3059AC_MSG_CHECKING(for sysctl)
3060AC_TRY_COMPILE(
3061[#include <sys/types.h>
3062#include <sys/sysctl.h>],
3063[ int mib[2], r;
3064 size_t len;
3065
3066 mib[0] = CTL_HW;
3067 mib[1] = HW_USERMEM;
3068 len = sizeof(r);
3069 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
3070 ],
3071 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
3072 AC_MSG_RESULT(not usable))
3073
3074dnl sysinfo() may exist but not be Linux compatible
3075AC_MSG_CHECKING(for sysinfo)
3076AC_TRY_COMPILE(
3077[#include <sys/types.h>
3078#include <sys/sysinfo.h>],
3079[ struct sysinfo sinfo;
3080 int t;
3081
3082 (void)sysinfo(&sinfo);
3083 t = sinfo.totalram;
3084 ],
3085 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
3086 AC_MSG_RESULT(not usable))
3087
Bram Moolenaar914572a2007-05-01 11:37:47 +00003088dnl struct sysinfo may have the mem_unit field or not
3089AC_MSG_CHECKING(for sysinfo.mem_unit)
3090AC_TRY_COMPILE(
3091[#include <sys/types.h>
3092#include <sys/sysinfo.h>],
3093[ struct sysinfo sinfo;
3094 sinfo.mem_unit = 1;
3095 ],
3096 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
3097 AC_MSG_RESULT(no))
3098
Bram Moolenaar071d4272004-06-13 20:20:40 +00003099dnl sysconf() may exist but not support what we want to use
3100AC_MSG_CHECKING(for sysconf)
3101AC_TRY_COMPILE(
3102[#include <unistd.h>],
3103[ (void)sysconf(_SC_PAGESIZE);
3104 (void)sysconf(_SC_PHYS_PAGES);
3105 ],
3106 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
3107 AC_MSG_RESULT(not usable))
3108
Bram Moolenaar914703b2010-05-31 21:59:46 +02003109AC_CHECK_SIZEOF([int])
3110AC_CHECK_SIZEOF([long])
3111AC_CHECK_SIZEOF([time_t])
3112AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02003113
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02003114dnl Make sure that uint32_t is really 32 bits unsigned.
3115AC_MSG_CHECKING([uint32_t is 32 bits])
3116AC_TRY_RUN([
3117#ifdef HAVE_STDINT_H
3118# include <stdint.h>
3119#endif
3120#ifdef HAVE_INTTYPES_H
3121# include <inttypes.h>
3122#endif
3123main() {
3124 uint32_t nr1 = (uint32_t)-1;
3125 uint32_t nr2 = (uint32_t)0xffffffffUL;
3126 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
3127 exit(0);
3128}],
3129AC_MSG_RESULT(ok),
3130AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
3131AC_MSG_ERROR([could not compile program using uint32_t.]))
3132
Bram Moolenaar446cb832008-06-24 21:56:24 +00003133dnl Check for memmove() before bcopy(), makes memmove() be used when both are
3134dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
3135
Bram Moolenaar071d4272004-06-13 20:20:40 +00003136[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00003137#include "confdefs.h"
3138#ifdef HAVE_STRING_H
3139# include <string.h>
3140#endif
3141#if STDC_HEADERS
3142# include <stdlib.h>
3143# include <stddef.h>
3144#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003145main() {
3146 char buf[10];
3147 strcpy(buf, "abcdefghi");
3148 mch_memmove(buf, buf + 2, 3);
3149 if (strncmp(buf, "ababcf", 6))
3150 exit(1);
3151 strcpy(buf, "abcdefghi");
3152 mch_memmove(buf + 2, buf, 3);
3153 if (strncmp(buf, "cdedef", 6))
3154 exit(1);
3155 exit(0); /* libc version works properly. */
3156}']
3157
Bram Moolenaar446cb832008-06-24 21:56:24 +00003158AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
3159 [
3160 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
3161 [
3162 vim_cv_memmove_handles_overlap=yes
3163 ],[
3164 vim_cv_memmove_handles_overlap=no
3165 ],[
3166 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
3167 ])
3168 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003169
Bram Moolenaar446cb832008-06-24 21:56:24 +00003170if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
3171 AC_DEFINE(USEMEMMOVE)
3172else
3173 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
3174 [
3175 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
3176 [
3177 vim_cv_bcopy_handles_overlap=yes
3178 ],[
3179 vim_cv_bcopy_handles_overlap=no
3180 ],[
3181 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
3182 ])
3183 ])
3184
3185 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
3186 AC_DEFINE(USEBCOPY)
3187 else
3188 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
3189 [
3190 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
3191 [
3192 vim_cv_memcpy_handles_overlap=yes
3193 ],[
3194 vim_cv_memcpy_handles_overlap=no
3195 ],[
3196 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
3197 ])
3198 ])
3199
3200 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
3201 AC_DEFINE(USEMEMCPY)
3202 fi
3203 fi
3204fi
3205
Bram Moolenaar071d4272004-06-13 20:20:40 +00003206
3207dnl Check for multibyte locale functions
3208dnl Find out if _Xsetlocale() is supported by libX11.
3209dnl Check if X_LOCALE should be defined.
3210
3211if test "$enable_multibyte" = "yes"; then
3212 cflags_save=$CFLAGS
3213 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00003214 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003215 CFLAGS="$CFLAGS -I$x_includes"
3216 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
3217 AC_MSG_CHECKING(whether X_LOCALE needed)
3218 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
3219 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
3220 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
3221 AC_MSG_RESULT(no))
3222 fi
3223 CFLAGS=$cflags_save
3224 LDFLAGS=$ldflags_save
3225fi
3226
3227dnl Link with xpg4, it is said to make Korean locale working
3228AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
3229
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003230dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003231dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003232dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003233dnl -t for typedefs (many ctags have this)
3234dnl -s for static functions (Elvis ctags only?)
3235dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
3236dnl -i+m to test for older Exuberant ctags
3237AC_MSG_CHECKING(how to create tags)
3238test -f tags && mv tags tags.save
3239if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003240 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003241else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003242 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003243 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
3244 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
3245 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
3246 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
3247 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
3248 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
3249 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
3250fi
3251test -f tags.save && mv tags.save tags
3252AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
3253
3254dnl Check how we can run man with a section number
3255AC_MSG_CHECKING(how to run man with a section nr)
3256MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00003257(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 +00003258AC_MSG_RESULT($MANDEF)
3259if test "$MANDEF" = "man -s"; then
3260 AC_DEFINE(USEMAN_S)
3261fi
3262
3263dnl Check if gettext() is working and if it needs -lintl
3264AC_MSG_CHECKING(--disable-nls argument)
3265AC_ARG_ENABLE(nls,
3266 [ --disable-nls Don't support NLS (gettext()).], ,
3267 [enable_nls="yes"])
3268
3269if test "$enable_nls" = "yes"; then
3270 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00003271
3272 INSTALL_LANGS=install-languages
3273 AC_SUBST(INSTALL_LANGS)
3274 INSTALL_TOOL_LANGS=install-tool-languages
3275 AC_SUBST(INSTALL_TOOL_LANGS)
3276
Bram Moolenaar071d4272004-06-13 20:20:40 +00003277 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
3278 AC_MSG_CHECKING([for NLS])
3279 if test -f po/Makefile; then
3280 have_gettext="no"
3281 if test -n "$MSGFMT"; then
3282 AC_TRY_LINK(
3283 [#include <libintl.h>],
3284 [gettext("Test");],
3285 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3286 olibs=$LIBS
3287 LIBS="$LIBS -lintl"
3288 AC_TRY_LINK(
3289 [#include <libintl.h>],
3290 [gettext("Test");],
3291 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3292 AC_MSG_RESULT([gettext() doesn't work]);
3293 LIBS=$olibs))
3294 else
3295 AC_MSG_RESULT([msgfmt not found - disabled]);
3296 fi
3297 if test $have_gettext = "yes"; then
3298 AC_DEFINE(HAVE_GETTEXT)
3299 MAKEMO=yes
3300 AC_SUBST(MAKEMO)
3301 dnl this was added in GNU gettext 0.10.36
3302 AC_CHECK_FUNCS(bind_textdomain_codeset)
3303 dnl _nl_msg_cat_cntr is required for GNU gettext
3304 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3305 AC_TRY_LINK(
3306 [#include <libintl.h>
3307 extern int _nl_msg_cat_cntr;],
3308 [++_nl_msg_cat_cntr;],
3309 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3310 AC_MSG_RESULT([no]))
3311 fi
3312 else
3313 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3314 fi
3315else
3316 AC_MSG_RESULT(yes)
3317fi
3318
3319dnl Check for dynamic linking loader
3320AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3321if test x${DLL} = xdlfcn.h; then
3322 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3323 AC_MSG_CHECKING([for dlopen()])
3324 AC_TRY_LINK(,[
3325 extern void* dlopen();
3326 dlopen();
3327 ],
3328 AC_MSG_RESULT(yes);
3329 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3330 AC_MSG_RESULT(no);
3331 AC_MSG_CHECKING([for dlopen() in -ldl])
3332 olibs=$LIBS
3333 LIBS="$LIBS -ldl"
3334 AC_TRY_LINK(,[
3335 extern void* dlopen();
3336 dlopen();
3337 ],
3338 AC_MSG_RESULT(yes);
3339 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3340 AC_MSG_RESULT(no);
3341 LIBS=$olibs))
3342 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3343 dnl ick :-)
3344 AC_MSG_CHECKING([for dlsym()])
3345 AC_TRY_LINK(,[
3346 extern void* dlsym();
3347 dlsym();
3348 ],
3349 AC_MSG_RESULT(yes);
3350 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3351 AC_MSG_RESULT(no);
3352 AC_MSG_CHECKING([for dlsym() in -ldl])
3353 olibs=$LIBS
3354 LIBS="$LIBS -ldl"
3355 AC_TRY_LINK(,[
3356 extern void* dlsym();
3357 dlsym();
3358 ],
3359 AC_MSG_RESULT(yes);
3360 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3361 AC_MSG_RESULT(no);
3362 LIBS=$olibs))
3363elif test x${DLL} = xdl.h; then
3364 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3365 AC_MSG_CHECKING([for shl_load()])
3366 AC_TRY_LINK(,[
3367 extern void* shl_load();
3368 shl_load();
3369 ],
3370 AC_MSG_RESULT(yes);
3371 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3372 AC_MSG_RESULT(no);
3373 AC_MSG_CHECKING([for shl_load() in -ldld])
3374 olibs=$LIBS
3375 LIBS="$LIBS -ldld"
3376 AC_TRY_LINK(,[
3377 extern void* shl_load();
3378 shl_load();
3379 ],
3380 AC_MSG_RESULT(yes);
3381 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3382 AC_MSG_RESULT(no);
3383 LIBS=$olibs))
3384fi
3385AC_CHECK_HEADERS(setjmp.h)
3386
3387if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3388 dnl -ldl must come after DynaLoader.a
3389 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3390 LIBS=`echo $LIBS | sed s/-ldl//`
3391 PERL_LIBS="$PERL_LIBS -ldl"
3392 fi
3393fi
3394
Bram Moolenaar164fca32010-07-14 13:58:07 +02003395if test "x$MACOSX" = "xyes"; then
3396 AC_MSG_CHECKING(whether we need -framework Cocoa)
3397 dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
3398 dnl disabled during tiny build)
3399 if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
3400 LIBS=$"$LIBS -framework Cocoa"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003401 AC_MSG_RESULT(yes)
3402 else
3403 AC_MSG_RESULT(no)
3404 fi
3405fi
Bram Moolenaar164fca32010-07-14 13:58:07 +02003406if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003407 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003408fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003409
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003410dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3411dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3412dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003413dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3414dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003415DEPEND_CFLAGS_FILTER=
3416if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003417 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003418 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003419 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003420 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003421 AC_MSG_RESULT(yes)
3422 else
3423 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003424 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003425 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3426 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003427 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003428 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3429 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003430 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 +00003431 AC_MSG_RESULT(yes)
3432 else
3433 AC_MSG_RESULT(no)
3434 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003435fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003436AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003437
3438dnl write output files
3439AC_OUTPUT(auto/config.mk:config.mk.in)
3440
3441dnl vim: set sw=2 tw=78 fo+=l: