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