blob: 0e0e6469bcc70196f1a0f74c134f217117fe0aec [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001dnl configure.in: autoconf script for Vim
2
3dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
4dnl Should also work with autoconf 2.54 and later.
5
6AC_INIT(vim.h)
7AC_CONFIG_HEADER(auto/config.h:config.h.in)
8
9dnl Being able to run configure means the system is Unix (compatible).
10AC_DEFINE(UNIX)
11AC_PROG_MAKE_SET
12
13dnl Checks for programs.
14AC_PROG_CC dnl required by almost everything
15AC_PROG_CPP dnl required by header file checks
16AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
17AC_ISC_POSIX dnl required by AC_C_CROSS
18AC_PROG_AWK dnl required for "make html" in ../doc
19
20dnl Don't strip if we don't have it
21AC_CHECK_PROG(STRIP, strip, strip, :)
22
Bram Moolenaar325b7a22004-07-05 15:58:32 +000023dnl Check for extension of executables
Bram Moolenaar071d4272004-06-13 20:20:40 +000024AC_EXEEXT
25
Bram Moolenaar446cb832008-06-24 21:56:24 +000026dnl Check for standard headers. We don't use this in Vim but other stuff
27dnl in autoconf needs it, where it uses STDC_HEADERS.
28AC_HEADER_STDC
29AC_HEADER_SYS_WAIT
30
Bram Moolenaar071d4272004-06-13 20:20:40 +000031dnl Set default value for CFLAGS if none is defined or it's empty
32if test -z "$CFLAGS"; then
33 CFLAGS="-O"
34 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
35fi
36if test "$GCC" = yes; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +000037 dnl method that should work for nearly all versions
38 gccversion=`"$CC" -dumpversion`
39 if test "x$gccversion" = "x"; then
40 dnl old method; fall-back for when -dumpversion doesn't work
41 gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
42 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +000043 dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
44 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +000045 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +000046 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
47 else
48 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
49 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
50 CFLAGS="$CFLAGS -fno-strength-reduce"
51 fi
52 fi
53fi
54
Bram Moolenaar446cb832008-06-24 21:56:24 +000055dnl If configure thinks we are cross compiling, there might be something
56dnl wrong with the CC or CFLAGS settings, give a useful warning message
Bram Moolenaar071d4272004-06-13 20:20:40 +000057if test "$cross_compiling" = yes; then
Bram Moolenaar446cb832008-06-24 21:56:24 +000058 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
Bram Moolenaar071d4272004-06-13 20:20:40 +000059fi
60
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000061dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
62dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +000063test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
64
65if test -f ./toolcheck; then
66 AC_CHECKING(for buggy tools)
67 sh ./toolcheck 1>&AC_FD_MSG
68fi
69
70OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
71
72dnl Check for BeOS, which needs an extra source file
73AC_MSG_CHECKING(for BeOS)
74case `uname` in
75 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
76 BEOS=yes; AC_MSG_RESULT(yes);;
77 *) BEOS=no; AC_MSG_RESULT(no);;
78esac
79
80dnl If QNX is found, assume we don't want to use Xphoton
81dnl unless it was specifically asked for (--with-x)
82AC_MSG_CHECKING(for QNX)
83case `uname` in
84 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
85 test -z "$with_x" && with_x=no
86 QNX=yes; AC_MSG_RESULT(yes);;
87 *) QNX=no; AC_MSG_RESULT(no);;
88esac
89
90dnl Check for Darwin and MacOS X
91dnl We do a check for MacOS X in the very beginning because there
92dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +000093AC_MSG_CHECKING([for Darwin (Mac OS X)])
94if test "`(uname) 2>/dev/null`" = Darwin; then
95 AC_MSG_RESULT(yes)
96
97 AC_MSG_CHECKING(--disable-darwin argument)
98 AC_ARG_ENABLE(darwin,
99 [ --disable-darwin Disable Darwin (Mac OS X) support.],
100 , [enable_darwin="yes"])
101 if test "$enable_darwin" = "yes"; then
102 AC_MSG_RESULT(no)
103 AC_MSG_CHECKING(if Darwin files are there)
Bram Moolenaar164fca32010-07-14 13:58:07 +0200104 if test -f os_macosx.m; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105 AC_MSG_RESULT(yes)
106 else
107 AC_MSG_RESULT([no, Darwin support disabled])
108 enable_darwin=no
109 fi
110 else
111 AC_MSG_RESULT([yes, Darwin support excluded])
112 fi
113
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000114 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000115 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000116 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000117 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000118
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100119 AC_MSG_CHECKING(--with-developer-dir argument)
120 AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
121 DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
122 DEVELOPER_DIR=""; AC_MSG_RESULT(not present))
123
124 if test "x$DEVELOPER_DIR" = "x"; then
125 AC_PATH_PROG(XCODE_SELECT, xcode-select)
126 if test "x$XCODE_SELECT" != "x"; then
127 AC_MSG_CHECKING(for developer dir using xcode-select)
128 DEVELOPER_DIR=`$XCODE_SELECT -print-path`
129 AC_MSG_RESULT([$DEVELOPER_DIR])
130 else
131 DEVELOPER_DIR=/Developer
132 fi
133 fi
134
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000135 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000136 AC_MSG_CHECKING(for 10.4 universal SDK)
137 dnl There is a terrible inconsistency (but we appear to get away with it):
138 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
139 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
140 dnl tests using the preprocessor are actually done with the wrong header
141 dnl files. $LDFLAGS is set at the end, because configure uses it together
142 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000143 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000144 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000145 save_ldflags="$LDFLAGS"
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100146 CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000147 AC_TRY_LINK([ ], [ ],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000148 AC_MSG_RESULT(found, will make universal binary),
149
150 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000151 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000152 AC_MSG_CHECKING(if Intel architecture is supported)
153 CPPFLAGS="$CPPFLAGS -arch i386"
154 LDFLAGS="$save_ldflags -arch i386"
155 AC_TRY_LINK([ ], [ ],
156 AC_MSG_RESULT(yes); MACARCH="intel",
157 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000158 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000159 CPPFLAGS="$save_cppflags -arch ppc"
160 LDFLAGS="$save_ldflags -arch ppc"))
161 elif test "x$MACARCH" = "xintel"; then
162 CPPFLAGS="$CPPFLAGS -arch intel"
163 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000164 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000165 CPPFLAGS="$CPPFLAGS -arch ppc"
166 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000167 fi
168
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169 if test "$enable_darwin" = "yes"; then
170 MACOSX=yes
Bram Moolenaar164fca32010-07-14 13:58:07 +0200171 OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000172 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000173 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000174 CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175
176 dnl If Carbon is found, assume we don't want X11
177 dnl unless it was specifically asked for (--with-x)
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000178 dnl or Motif, Athena or GTK GUI is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000179 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
180 if test "x$CARBON" = "xyes"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +0200181 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000182 with_x=no
Bram Moolenaar071d4272004-06-13 20:20:40 +0000183 fi
184 fi
185 fi
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000186
Bram Moolenaardb552d602006-03-23 22:59:57 +0000187 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000188 dnl free. This happens in expand_filename(), because the optimizer swaps
Bram Moolenaardb552d602006-03-23 22:59:57 +0000189 dnl two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000190 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
191 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
192 fi
193
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194else
195 AC_MSG_RESULT(no)
196fi
197
198AC_SUBST(OS_EXTRA_SRC)
199AC_SUBST(OS_EXTRA_OBJ)
200
201dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
202dnl Only when the directory exists and it wasn't there yet.
203dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000204dnl Skip all of this when cross-compiling.
205if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000206 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000207 have_local_include=''
208 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000209 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
210 --without-local-dir do not search /usr/local for local libraries.], [
211 local_dir="$withval"
212 case "$withval" in
213 */*) ;;
214 no)
215 # avoid adding local dir to LDFLAGS and CPPFLAGS
216 have_local_dir=yes
217 have_local_lib=yes
218 ;;
219 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
220 esac
221 AC_MSG_RESULT($local_dir)
222 ], [
223 local_dir=/usr/local
224 AC_MSG_RESULT(Defaulting to $local_dir)
225 ])
226 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000227 echo 'void f(){}' > conftest.c
228 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
Bram Moolenaarc236c162008-07-13 17:41:49 +0000229 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
230 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000231 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000233 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
234 tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000235 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000236 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000237 fi
238 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000239 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
240 tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000241 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000242 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000243 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244 fi
245fi
246
247AC_MSG_CHECKING(--with-vim-name argument)
248AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
249 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000250 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251AC_SUBST(VIMNAME)
252AC_MSG_CHECKING(--with-ex-name argument)
253AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
254 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
255 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
256AC_SUBST(EXNAME)
257AC_MSG_CHECKING(--with-view-name argument)
258AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
259 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
260 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
261AC_SUBST(VIEWNAME)
262
263AC_MSG_CHECKING(--with-global-runtime argument)
264AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
265 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
266 AC_MSG_RESULT(no))
267
268AC_MSG_CHECKING(--with-modified-by argument)
269AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
270 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
271 AC_MSG_RESULT(no))
272
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200273dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000274AC_MSG_CHECKING(if character set is EBCDIC)
275AC_TRY_COMPILE([ ],
276[ /* TryCompile function for CharSet.
277 Treat any failure as ASCII for compatibility with existing art.
278 Use compile-time rather than run-time tests for cross-compiler
279 tolerance. */
280#if '0'!=240
281make an error "Character set is not EBCDIC"
282#endif ],
283[ # TryCompile action if true
284cf_cv_ebcdic=yes ],
285[ # TryCompile action if false
286cf_cv_ebcdic=no])
287# end of TryCompile ])
288# end of CacheVal CvEbcdic
289AC_MSG_RESULT($cf_cv_ebcdic)
290case "$cf_cv_ebcdic" in #(vi
291 yes) AC_DEFINE(EBCDIC)
292 line_break='"\\n"'
293 ;;
294 *) line_break='"\\012"';;
295esac
296AC_SUBST(line_break)
297
298if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200299dnl If we have EBCDIC we most likley have z/OS Unix, let's test it!
300AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000301case `uname` in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200302 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303 dnl If using cc the environment variable _CC_CCMODE must be
304 dnl set to "1", so that some compiler extensions are enabled.
305 dnl If using c89 the environment variable is named _CC_C89MODE.
306 dnl Note: compile with c89 never tested.
307 if test "$CC" = "cc"; then
308 ccm="$_CC_CCMODE"
309 ccn="CC"
310 else
311 if test "$CC" = "c89"; then
312 ccm="$_CC_C89MODE"
313 ccn="C89"
314 else
315 ccm=1
316 fi
317 fi
318 if test "$ccm" != "1"; then
319 echo ""
320 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200321 echo " On z/OS Unix, the environment variable"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000322 echo " __CC_${ccn}MODE must be set to \"1\"!"
323 echo " Do:"
324 echo " export _CC_${ccn}MODE=1"
325 echo " and then call configure again."
326 echo "------------------------------------------"
327 exit 1
328 fi
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200329 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
330 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331 AC_MSG_RESULT(yes)
332 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200333 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334 AC_MSG_RESULT(no)
335 ;;
336esac
337fi
338
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200339dnl Set QUOTESED. Needs additional backslashes on zOS
340if test "$zOSUnix" = "yes"; then
341 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
342else
343 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
344fi
345AC_SUBST(QUOTESED)
346
347
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000348dnl Link with -lselinux for SELinux stuff; if not found
349AC_MSG_CHECKING(--disable-selinux argument)
350AC_ARG_ENABLE(selinux,
351 [ --disable-selinux Don't check for SELinux support.],
352 , enable_selinux="yes")
353if test "$enable_selinux" = "yes"; then
354 AC_MSG_RESULT(no)
355 AC_CHECK_LIB(selinux, is_selinux_enabled,
356 [LIBS="$LIBS -lselinux"
357 AC_DEFINE(HAVE_SELINUX)])
358else
359 AC_MSG_RESULT(yes)
360fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000361
362dnl Check user requested features.
363
364AC_MSG_CHECKING(--with-features argument)
365AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
366 features="$withval"; AC_MSG_RESULT($features),
367 features="normal"; AC_MSG_RESULT(Defaulting to normal))
368
369dovimdiff=""
370dogvimdiff=""
371case "$features" in
372 tiny) AC_DEFINE(FEAT_TINY) ;;
373 small) AC_DEFINE(FEAT_SMALL) ;;
374 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
375 dogvimdiff="installgvimdiff" ;;
376 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
377 dogvimdiff="installgvimdiff" ;;
378 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
379 dogvimdiff="installgvimdiff" ;;
380 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
381esac
382
383AC_SUBST(dovimdiff)
384AC_SUBST(dogvimdiff)
385
386AC_MSG_CHECKING(--with-compiledby argument)
387AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
388 compiledby="$withval"; AC_MSG_RESULT($withval),
389 compiledby=""; AC_MSG_RESULT(no))
390AC_SUBST(compiledby)
391
392AC_MSG_CHECKING(--disable-xsmp argument)
393AC_ARG_ENABLE(xsmp,
394 [ --disable-xsmp Disable XSMP session management],
395 , enable_xsmp="yes")
396
397if test "$enable_xsmp" = "yes"; then
398 AC_MSG_RESULT(no)
399 AC_MSG_CHECKING(--disable-xsmp-interact argument)
400 AC_ARG_ENABLE(xsmp-interact,
401 [ --disable-xsmp-interact Disable XSMP interaction],
402 , enable_xsmp_interact="yes")
403 if test "$enable_xsmp_interact" = "yes"; then
404 AC_MSG_RESULT(no)
405 AC_DEFINE(USE_XSMP_INTERACT)
406 else
407 AC_MSG_RESULT(yes)
408 fi
409else
410 AC_MSG_RESULT(yes)
411fi
412
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000413dnl Check for MzScheme feature.
414AC_MSG_CHECKING(--enable-mzschemeinterp argument)
415AC_ARG_ENABLE(mzschemeinterp,
416 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
417 [enable_mzschemeinterp="no"])
418AC_MSG_RESULT($enable_mzschemeinterp)
419
420if test "$enable_mzschemeinterp" = "yes"; then
421 dnl -- find the mzscheme executable
422 AC_SUBST(vi_cv_path_mzscheme)
423
424 AC_MSG_CHECKING(--with-plthome argument)
425 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000426 [ --with-plthome=PLTHOME Use PLTHOME.],
427 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000428 with_plthome="";AC_MSG_RESULT("no"))
429
430 if test "X$with_plthome" != "X"; then
431 vi_cv_path_mzscheme_pfx="$with_plthome"
432 else
433 AC_MSG_CHECKING(PLTHOME environment var)
434 if test "X$PLTHOME" != "X"; then
435 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000436 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000437 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000438 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000439 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000440 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000441
442 dnl resolve symbolic link, the executable is often elsewhere and there
443 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000444 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000445 lsout=`ls -l $vi_cv_path_mzscheme`
446 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
447 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
448 fi
449 fi
450
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000451 if test "X$vi_cv_path_mzscheme" != "X"; then
452 dnl -- find where MzScheme thinks it was installed
453 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000454 dnl different versions of MzScheme differ in command line processing
455 dnl use universal approach
456 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000457 (build-path (call-with-values \
458 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000459 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
460 dnl Remove a trailing slash
461 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
462 sed -e 's+/$++'` ])
463 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000464 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000465 fi
466 fi
467
Bram Moolenaard7afed32007-05-06 13:26:41 +0000468 SCHEME_INC=
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000469 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
470 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
471 if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000472 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
473 AC_MSG_RESULT(yes)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000474 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000475 AC_MSG_RESULT(no)
476 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000477 if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000478 AC_MSG_RESULT(yes)
479 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaard7afed32007-05-06 13:26:41 +0000480 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000481 AC_MSG_RESULT(no)
482 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
483 if test -f /usr/include/plt/scheme.h; then
484 AC_MSG_RESULT(yes)
485 SCHEME_INC=/usr/include/plt
486 else
487 AC_MSG_RESULT(no)
488 vi_cv_path_mzscheme_pfx=
489 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000490 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000491 fi
492 fi
493
494 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000495 if test "x$MACOSX" = "xyes"; then
496 MZSCHEME_LIBS="-framework PLT_MzScheme"
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000497 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
498 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
499 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000500 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
Bram Moolenaar9048f942007-05-12 14:32:25 +0000501 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 +0000502 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000503 dnl Using shared objects
504 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
505 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
506 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
507 else
508 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
509 fi
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000510 if test "$GCC" = yes; then
511 dnl Make Vim remember the path to the library. For when it's not in
512 dnl $LD_LIBRARY_PATH.
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000513 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000514 elif test "`(uname) 2>/dev/null`" = SunOS &&
515 uname -r | grep '^5' >/dev/null; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000516 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000517 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000518 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000519 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
520 SCHEME_COLLECTS=lib/plt/
521 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000522 if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
523 dnl need to generate bytecode for MzScheme base
524 MZSCHEME_EXTRA="mzscheme_base.c"
525 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
526 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
527 fi
528 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaard7afed32007-05-06 13:26:41 +0000529 -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000530 MZSCHEME_SRC="if_mzsch.c"
531 MZSCHEME_OBJ="objects/if_mzsch.o"
532 MZSCHEME_PRO="if_mzsch.pro"
533 AC_DEFINE(FEAT_MZSCHEME)
534 fi
535 AC_SUBST(MZSCHEME_SRC)
536 AC_SUBST(MZSCHEME_OBJ)
537 AC_SUBST(MZSCHEME_PRO)
538 AC_SUBST(MZSCHEME_LIBS)
539 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000540 AC_SUBST(MZSCHEME_EXTRA)
541 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000542fi
543
544
Bram Moolenaar071d4272004-06-13 20:20:40 +0000545AC_MSG_CHECKING(--enable-perlinterp argument)
546AC_ARG_ENABLE(perlinterp,
547 [ --enable-perlinterp Include Perl interpreter.], ,
548 [enable_perlinterp="no"])
549AC_MSG_RESULT($enable_perlinterp)
550if test "$enable_perlinterp" = "yes"; then
551 AC_SUBST(vi_cv_path_perl)
552 AC_PATH_PROG(vi_cv_path_perl, perl)
553 if test "X$vi_cv_path_perl" != "X"; then
554 AC_MSG_CHECKING(Perl version)
555 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
556 eval `$vi_cv_path_perl -V:usethreads`
557 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
558 badthreads=no
559 else
560 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
561 eval `$vi_cv_path_perl -V:use5005threads`
562 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
563 badthreads=no
564 else
565 badthreads=yes
566 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
567 fi
568 else
569 badthreads=yes
570 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
571 fi
572 fi
573 if test $badthreads = no; then
574 AC_MSG_RESULT(OK)
575 eval `$vi_cv_path_perl -V:shrpenv`
576 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
577 shrpenv=""
578 fi
579 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
580 AC_SUBST(vi_cv_perllib)
581 dnl Remove "-fno-something", it breaks using cproto.
582 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
583 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
584 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
585 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
586 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
587 -e 's/-bE:perl.exp//' -e 's/-lc //'`
588 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
589 dnl a test in configure may fail because of that.
590 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
591 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
592
593 dnl check that compiling a simple program still works with the flags
594 dnl added for Perl.
595 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
596 cflags_save=$CFLAGS
597 libs_save=$LIBS
598 ldflags_save=$LDFLAGS
599 CFLAGS="$CFLAGS $perlcppflags"
600 LIBS="$LIBS $perllibs"
601 LDFLAGS="$perlldflags $LDFLAGS"
602 AC_TRY_LINK(,[ ],
603 AC_MSG_RESULT(yes); perl_ok=yes,
604 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
605 CFLAGS=$cflags_save
606 LIBS=$libs_save
607 LDFLAGS=$ldflags_save
608 if test $perl_ok = yes; then
609 if test "X$perlcppflags" != "X"; then
Bram Moolenaard7afed32007-05-06 13:26:41 +0000610 dnl remove -pipe and -Wxxx, it confuses cproto
611 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000612 fi
613 if test "X$perlldflags" != "X"; then
614 LDFLAGS="$perlldflags $LDFLAGS"
615 fi
616 PERL_LIBS=$perllibs
617 PERL_SRC="auto/if_perl.c if_perlsfio.c"
618 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
619 PERL_PRO="if_perl.pro if_perlsfio.pro"
620 AC_DEFINE(FEAT_PERL)
621 fi
622 fi
623 else
624 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
625 fi
626 fi
627
628 if test "x$MACOSX" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +0000629 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000630 dir=/System/Library/Perl
631 darwindir=$dir/darwin
632 if test -d $darwindir; then
633 PERL=/usr/bin/perl
634 else
635 dnl Mac OS X 10.3
636 dir=/System/Library/Perl/5.8.1
637 darwindir=$dir/darwin-thread-multi-2level
638 if test -d $darwindir; then
639 PERL=/usr/bin/perl
640 fi
641 fi
642 if test -n "$PERL"; then
643 PERL_DIR="$dir"
644 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
645 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
646 PERL_LIBS="-L$darwindir/CORE -lperl"
647 fi
648 fi
649fi
650AC_SUBST(shrpenv)
651AC_SUBST(PERL_SRC)
652AC_SUBST(PERL_OBJ)
653AC_SUBST(PERL_PRO)
654AC_SUBST(PERL_CFLAGS)
655AC_SUBST(PERL_LIBS)
656
657AC_MSG_CHECKING(--enable-pythoninterp argument)
658AC_ARG_ENABLE(pythoninterp,
659 [ --enable-pythoninterp Include Python interpreter.], ,
660 [enable_pythoninterp="no"])
661AC_MSG_RESULT($enable_pythoninterp)
662if test "$enable_pythoninterp" = "yes"; then
663 dnl -- find the python executable
664 AC_PATH_PROG(vi_cv_path_python, python)
665 if test "X$vi_cv_path_python" != "X"; then
666
667 dnl -- get its version number
668 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
669 [[vi_cv_var_python_version=`
670 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
671 ]])
672
673 dnl -- it must be at least version 1.4
674 AC_MSG_CHECKING(Python is 1.4 or better)
675 if ${vi_cv_path_python} -c \
676 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
677 then
678 AC_MSG_RESULT(yep)
679
680 dnl -- find where python thinks it was installed
681 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
682 [ vi_cv_path_python_pfx=`
683 ${vi_cv_path_python} -c \
684 "import sys; print sys.prefix"` ])
685
686 dnl -- and where it thinks it runs
687 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
688 [ vi_cv_path_python_epfx=`
689 ${vi_cv_path_python} -c \
690 "import sys; print sys.exec_prefix"` ])
691
692 dnl -- python's internal library path
693
694 AC_CACHE_VAL(vi_cv_path_pythonpath,
695 [ vi_cv_path_pythonpath=`
696 unset PYTHONPATH;
697 ${vi_cv_path_python} -c \
698 "import sys, string; print string.join(sys.path,':')"` ])
699
700 dnl -- where the Python implementation library archives are
701
702 AC_ARG_WITH(python-config-dir,
703 [ --with-python-config-dir=PATH Python's config directory],
704 [ vi_cv_path_python_conf="${withval}" ] )
705
706 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
707 [
708 vi_cv_path_python_conf=
709 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
Bram Moolenaar72951072009-12-02 16:58:33 +0000710 for subdir in lib64 lib share; do
Bram Moolenaar071d4272004-06-13 20:20:40 +0000711 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
712 if test -d "$d" && test -f "$d/config.c"; then
713 vi_cv_path_python_conf="$d"
714 fi
715 done
716 done
717 ])
718
719 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
720
721 if test "X$PYTHON_CONFDIR" = "X"; then
722 AC_MSG_RESULT([can't find it!])
723 else
724
725 dnl -- we need to examine Python's config/Makefile too
726 dnl see what the interpreter is built from
727 AC_CACHE_VAL(vi_cv_path_python_plibs,
728 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000729 pwd=`pwd`
730 tmp_mkf="$pwd/config-PyMake$$"
731 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000732__:
Bram Moolenaar218116c2010-05-20 21:46:00 +0200733 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000734 @echo "python_LIBS='$(LIBS)'"
735 @echo "python_SYSLIBS='$(SYSLIBS)'"
736 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
737eof
738 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000739 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
740 rm -f -- "${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000741 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
742 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
743 vi_cv_path_python_plibs="-framework Python"
744 else
745 if test "${vi_cv_var_python_version}" = "1.4"; then
746 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
747 else
748 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
749 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +0200750 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 +0000751 dnl remove -ltermcap, it can conflict with an earlier -lncurses
752 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
753 fi
754 ])
755
756 PYTHON_LIBS="${vi_cv_path_python_plibs}"
757 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
758 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
759 else
760 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}"
761 fi
762 PYTHON_SRC="if_python.c"
763 dnl For Mac OSX 10.2 config.o is included in the Python library.
764 if test "x$MACOSX" = "xyes"; then
765 PYTHON_OBJ="objects/if_python.o"
766 else
767 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
768 fi
769 if test "${vi_cv_var_python_version}" = "1.4"; then
770 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
771 fi
772 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
773
774 dnl On FreeBSD linking with "-pthread" is required to use threads.
775 dnl _THREAD_SAFE must be used for compiling then.
776 dnl The "-pthread" is added to $LIBS, so that the following check for
777 dnl sigaltstack() will look in libc_r (it's there in libc!).
778 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
779 dnl will then define target-specific defines, e.g., -D_REENTRANT.
780 dnl Don't do this for Mac OSX, -pthread will generate a warning.
781 AC_MSG_CHECKING([if -pthread should be used])
782 threadsafe_flag=
783 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000784 dnl if test "x$MACOSX" != "xyes"; then
785 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000786 test "$GCC" = yes && threadsafe_flag="-pthread"
787 if test "`(uname) 2>/dev/null`" = FreeBSD; then
788 threadsafe_flag="-D_THREAD_SAFE"
789 thread_lib="-pthread"
790 fi
791 fi
792 libs_save_old=$LIBS
793 if test -n "$threadsafe_flag"; then
794 cflags_save=$CFLAGS
795 CFLAGS="$CFLAGS $threadsafe_flag"
796 LIBS="$LIBS $thread_lib"
797 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200798 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000799 AC_MSG_RESULT(no); LIBS=$libs_save_old
800 )
801 CFLAGS=$cflags_save
802 else
803 AC_MSG_RESULT(no)
804 fi
805
806 dnl check that compiling a simple program still works with the flags
807 dnl added for Python.
808 AC_MSG_CHECKING([if compile and link flags for Python are sane])
809 cflags_save=$CFLAGS
810 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200811 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000812 LIBS="$LIBS $PYTHON_LIBS"
813 AC_TRY_LINK(,[ ],
814 AC_MSG_RESULT(yes); python_ok=yes,
815 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
816 CFLAGS=$cflags_save
817 LIBS=$libs_save
818 if test $python_ok = yes; then
819 AC_DEFINE(FEAT_PYTHON)
820 else
821 LIBS=$libs_save_old
822 PYTHON_SRC=
823 PYTHON_OBJ=
824 PYTHON_LIBS=
825 PYTHON_CFLAGS=
826 fi
827
828 fi
829 else
830 AC_MSG_RESULT(too old)
831 fi
832 fi
833fi
834AC_SUBST(PYTHON_CONFDIR)
835AC_SUBST(PYTHON_LIBS)
836AC_SUBST(PYTHON_GETPATH_CFLAGS)
837AC_SUBST(PYTHON_CFLAGS)
838AC_SUBST(PYTHON_SRC)
839AC_SUBST(PYTHON_OBJ)
840
841AC_MSG_CHECKING(--enable-tclinterp argument)
842AC_ARG_ENABLE(tclinterp,
843 [ --enable-tclinterp Include Tcl interpreter.], ,
844 [enable_tclinterp="no"])
845AC_MSG_RESULT($enable_tclinterp)
846
847if test "$enable_tclinterp" = "yes"; then
848
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000849 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +0000850 AC_MSG_CHECKING(--with-tclsh argument)
851 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
852 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000853 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000854 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
855 AC_SUBST(vi_cv_path_tcl)
856
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000857 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
858 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
859 tclsh_name="tclsh8.4"
860 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
861 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000862 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000863 tclsh_name="tclsh8.2"
864 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
865 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000866 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
867 tclsh_name="tclsh8.0"
868 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
869 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000870 dnl still didn't find it, try without version number
871 if test "X$vi_cv_path_tcl" = "X"; then
872 tclsh_name="tclsh"
873 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
874 fi
875 if test "X$vi_cv_path_tcl" != "X"; then
876 AC_MSG_CHECKING(Tcl version)
877 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
878 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
879 AC_MSG_RESULT($tclver - OK);
880 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 -`
881
882 AC_MSG_CHECKING(for location of Tcl include)
883 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +0000884 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 +0000885 else
886 dnl For Mac OS X 10.3, use the OS-provided framework location
887 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
888 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +0000889 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000890 for try in $tclinc; do
891 if test -f "$try/tcl.h"; then
892 AC_MSG_RESULT($try/tcl.h)
893 TCL_INC=$try
894 break
895 fi
896 done
897 if test -z "$TCL_INC"; then
898 AC_MSG_RESULT(<not found>)
899 SKIP_TCL=YES
900 fi
901 if test -z "$SKIP_TCL"; then
902 AC_MSG_CHECKING(for location of tclConfig.sh script)
903 if test "x$MACOSX" != "xyes"; then
904 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000905 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000906 else
907 dnl For Mac OS X 10.3, use the OS-provided framework location
908 tclcnf="/System/Library/Frameworks/Tcl.framework"
909 fi
910 for try in $tclcnf; do
911 if test -f $try/tclConfig.sh; then
912 AC_MSG_RESULT($try/tclConfig.sh)
913 . $try/tclConfig.sh
914 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
915 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
916 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000917 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +0000918 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 +0000919 break
920 fi
921 done
922 if test -z "$TCL_LIBS"; then
923 AC_MSG_RESULT(<not found>)
924 AC_MSG_CHECKING(for Tcl library by myself)
925 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000926 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000927 for ext in .so .a ; do
928 for ver in "" $tclver ; do
929 for try in $tcllib ; do
930 trylib=tcl$ver$ext
931 if test -f $try/lib$trylib ; then
932 AC_MSG_RESULT($try/lib$trylib)
933 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
934 if test "`(uname) 2>/dev/null`" = SunOS &&
935 uname -r | grep '^5' >/dev/null; then
936 TCL_LIBS="$TCL_LIBS -R $try"
937 fi
938 break 3
939 fi
940 done
941 done
942 done
943 if test -z "$TCL_LIBS"; then
944 AC_MSG_RESULT(<not found>)
945 SKIP_TCL=YES
946 fi
947 fi
948 if test -z "$SKIP_TCL"; then
949 AC_DEFINE(FEAT_TCL)
950 TCL_SRC=if_tcl.c
951 TCL_OBJ=objects/if_tcl.o
952 TCL_PRO=if_tcl.pro
953 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
954 fi
955 fi
956 else
957 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
958 fi
959 fi
960fi
961AC_SUBST(TCL_SRC)
962AC_SUBST(TCL_OBJ)
963AC_SUBST(TCL_PRO)
964AC_SUBST(TCL_CFLAGS)
965AC_SUBST(TCL_LIBS)
966
967AC_MSG_CHECKING(--enable-rubyinterp argument)
968AC_ARG_ENABLE(rubyinterp,
969 [ --enable-rubyinterp Include Ruby interpreter.], ,
970 [enable_rubyinterp="no"])
971AC_MSG_RESULT($enable_rubyinterp)
972if test "$enable_rubyinterp" = "yes"; then
Bram Moolenaar165641d2010-02-17 16:23:09 +0100973 AC_MSG_CHECKING(--with-ruby-command argument)
974 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
975 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
976 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000977 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar165641d2010-02-17 16:23:09 +0100978 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000979 if test "X$vi_cv_path_ruby" != "X"; then
980 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +0000981 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 +0000982 AC_MSG_RESULT(OK)
983 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar165641d2010-02-17 16:23:09 +0100984 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 +0000985 if test "X$rubyhdrdir" != "X"; then
986 AC_MSG_RESULT($rubyhdrdir)
987 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +0100988 rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
989 if test -d "$rubyhdrdir/$rubyarch"; then
990 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
991 fi
992 rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
993 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000994 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
995 if test "X$rubylibs" != "X"; then
996 RUBY_LIBS="$rubylibs"
997 fi
998 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
999 if test -f "$rubyhdrdir/$librubyarg"; then
1000 librubyarg="$rubyhdrdir/$librubyarg"
1001 else
1002 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
1003 if test -f "$rubylibdir/$librubyarg"; then
1004 librubyarg="$rubylibdir/$librubyarg"
1005 elif test "$librubyarg" = "libruby.a"; then
1006 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1007 librubyarg="-lruby"
1008 else
1009 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
1010 fi
1011 fi
1012
1013 if test "X$librubyarg" != "X"; then
1014 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1015 fi
1016 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
1017 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001018 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1019 dnl be included if requested by passing --with-mac-arch to
1020 dnl configure, so strip these flags first (if present)
1021 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//'`
1022 if test "X$rubyldflags" != "X"; then
1023 LDFLAGS="$rubyldflags $LDFLAGS"
1024 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001025 fi
1026 RUBY_SRC="if_ruby.c"
1027 RUBY_OBJ="objects/if_ruby.o"
1028 RUBY_PRO="if_ruby.pro"
1029 AC_DEFINE(FEAT_RUBY)
1030 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001031 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001032 fi
1033 else
1034 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1035 fi
1036 fi
1037fi
1038AC_SUBST(RUBY_SRC)
1039AC_SUBST(RUBY_OBJ)
1040AC_SUBST(RUBY_PRO)
1041AC_SUBST(RUBY_CFLAGS)
1042AC_SUBST(RUBY_LIBS)
1043
1044AC_MSG_CHECKING(--enable-cscope argument)
1045AC_ARG_ENABLE(cscope,
1046 [ --enable-cscope Include cscope interface.], ,
1047 [enable_cscope="no"])
1048AC_MSG_RESULT($enable_cscope)
1049if test "$enable_cscope" = "yes"; then
1050 AC_DEFINE(FEAT_CSCOPE)
1051fi
1052
1053AC_MSG_CHECKING(--enable-workshop argument)
1054AC_ARG_ENABLE(workshop,
1055 [ --enable-workshop Include Sun Visual Workshop support.], ,
1056 [enable_workshop="no"])
1057AC_MSG_RESULT($enable_workshop)
1058if test "$enable_workshop" = "yes"; then
1059 AC_DEFINE(FEAT_SUN_WORKSHOP)
1060 WORKSHOP_SRC="workshop.c integration.c"
1061 AC_SUBST(WORKSHOP_SRC)
1062 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1063 AC_SUBST(WORKSHOP_OBJ)
1064 if test "${enable_gui-xxx}" = xxx; then
1065 enable_gui=motif
1066 fi
1067fi
1068
1069AC_MSG_CHECKING(--disable-netbeans argument)
1070AC_ARG_ENABLE(netbeans,
1071 [ --disable-netbeans Disable NetBeans integration support.],
1072 , [enable_netbeans="yes"])
1073if test "$enable_netbeans" = "yes"; then
1074 AC_MSG_RESULT(no)
1075 dnl On Solaris we need the socket and nsl library.
1076 AC_CHECK_LIB(socket, socket)
1077 AC_CHECK_LIB(nsl, gethostbyname)
1078 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1079 AC_TRY_LINK([
1080#include <stdio.h>
1081#include <stdlib.h>
1082#include <stdarg.h>
1083#include <fcntl.h>
1084#include <netdb.h>
1085#include <netinet/in.h>
1086#include <errno.h>
1087#include <sys/types.h>
1088#include <sys/socket.h>
1089 /* Check bitfields */
1090 struct nbbuf {
1091 unsigned int initDone:1;
1092 ushort signmaplen;
1093 };
1094 ], [
1095 /* Check creating a socket. */
1096 struct sockaddr_in server;
1097 (void)socket(AF_INET, SOCK_STREAM, 0);
1098 (void)htons(100);
1099 (void)gethostbyname("microsoft.com");
1100 if (errno == ECONNREFUSED)
1101 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1102 ],
1103 AC_MSG_RESULT(yes),
1104 AC_MSG_RESULT(no); enable_netbeans="no")
1105else
1106 AC_MSG_RESULT(yes)
1107fi
1108if test "$enable_netbeans" = "yes"; then
1109 AC_DEFINE(FEAT_NETBEANS_INTG)
1110 NETBEANS_SRC="netbeans.c"
1111 AC_SUBST(NETBEANS_SRC)
1112 NETBEANS_OBJ="objects/netbeans.o"
1113 AC_SUBST(NETBEANS_OBJ)
1114fi
1115
1116AC_MSG_CHECKING(--enable-sniff argument)
1117AC_ARG_ENABLE(sniff,
1118 [ --enable-sniff Include Sniff interface.], ,
1119 [enable_sniff="no"])
1120AC_MSG_RESULT($enable_sniff)
1121if test "$enable_sniff" = "yes"; then
1122 AC_DEFINE(FEAT_SNIFF)
1123 SNIFF_SRC="if_sniff.c"
1124 AC_SUBST(SNIFF_SRC)
1125 SNIFF_OBJ="objects/if_sniff.o"
1126 AC_SUBST(SNIFF_OBJ)
1127fi
1128
1129AC_MSG_CHECKING(--enable-multibyte argument)
1130AC_ARG_ENABLE(multibyte,
1131 [ --enable-multibyte Include multibyte editing support.], ,
1132 [enable_multibyte="no"])
1133AC_MSG_RESULT($enable_multibyte)
1134if test "$enable_multibyte" = "yes"; then
1135 AC_DEFINE(FEAT_MBYTE)
1136fi
1137
1138AC_MSG_CHECKING(--enable-hangulinput argument)
1139AC_ARG_ENABLE(hangulinput,
1140 [ --enable-hangulinput Include Hangul input support.], ,
1141 [enable_hangulinput="no"])
1142AC_MSG_RESULT($enable_hangulinput)
1143
1144AC_MSG_CHECKING(--enable-xim argument)
1145AC_ARG_ENABLE(xim,
1146 [ --enable-xim Include XIM input support.],
1147 AC_MSG_RESULT($enable_xim),
1148 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001149
1150AC_MSG_CHECKING(--enable-fontset argument)
1151AC_ARG_ENABLE(fontset,
1152 [ --enable-fontset Include X fontset output support.], ,
1153 [enable_fontset="no"])
1154AC_MSG_RESULT($enable_fontset)
1155dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1156
1157test -z "$with_x" && with_x=yes
1158test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1159if test "$with_x" = no; then
1160 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1161else
1162 dnl Do this check early, so that its failure can override user requests.
1163
1164 AC_PATH_PROG(xmkmfpath, xmkmf)
1165
1166 AC_PATH_XTRA
1167
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001168 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001169 dnl be compiled with a special option.
1170 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001171 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001172 CFLAGS="$CFLAGS -W c,dll"
1173 LDFLAGS="$LDFLAGS -W l,dll"
1174 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1175 fi
1176
1177 dnl On my HPUX system the X include dir is found, but the lib dir not.
1178 dnl This is a desparate try to fix this.
1179
1180 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1181 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1182 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1183 X_LIBS="$X_LIBS -L$x_libraries"
1184 if test "`(uname) 2>/dev/null`" = SunOS &&
1185 uname -r | grep '^5' >/dev/null; then
1186 X_LIBS="$X_LIBS -R $x_libraries"
1187 fi
1188 fi
1189
1190 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1191 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1192 AC_MSG_RESULT(Corrected X includes to $x_includes)
1193 X_CFLAGS="$X_CFLAGS -I$x_includes"
1194 fi
1195
1196 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1197 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1198 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1199 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1200 dnl Same for "-R/usr/lib ".
1201 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1202
1203
1204 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001205 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1206 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001207 AC_MSG_CHECKING(if X11 header files can be found)
1208 cflags_save=$CFLAGS
1209 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001210 AC_TRY_COMPILE([#include <X11/Xlib.h>
1211#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001212 AC_MSG_RESULT(yes),
1213 AC_MSG_RESULT(no); no_x=yes)
1214 CFLAGS=$cflags_save
1215
1216 if test "${no_x-no}" = yes; then
1217 with_x=no
1218 else
1219 AC_DEFINE(HAVE_X11)
1220 X_LIB="-lXt -lX11";
1221 AC_SUBST(X_LIB)
1222
1223 ac_save_LDFLAGS="$LDFLAGS"
1224 LDFLAGS="-L$x_libraries $LDFLAGS"
1225
1226 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1227 dnl For HP-UX 10.20 it must be before -lSM -lICE
1228 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1229 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1230
1231 dnl Some systems need -lnsl -lsocket when testing for ICE.
1232 dnl The check above doesn't do this, try here (again). Also needed to get
1233 dnl them after Xdmcp. link.sh will remove them when not needed.
1234 dnl Check for other function than above to avoid the cached value
1235 AC_CHECK_LIB(ICE, IceOpenConnection,
1236 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1237
1238 dnl Check for -lXpm (needed for some versions of Motif)
1239 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1240 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1241 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1242
1243 dnl Check that the X11 header files don't use implicit declarations
1244 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1245 cflags_save=$CFLAGS
1246 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1247 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1248 AC_MSG_RESULT(no),
1249 CFLAGS="$CFLAGS -Wno-implicit-int"
1250 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1251 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1252 AC_MSG_RESULT(test failed)
1253 )
1254 )
1255 CFLAGS=$cflags_save
1256
1257 LDFLAGS="$ac_save_LDFLAGS"
1258
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001259 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1260 AC_CACHE_VAL(ac_cv_small_wchar_t,
1261 [AC_TRY_RUN([
1262#include <X11/Xlib.h>
1263#if STDC_HEADERS
1264# include <stdlib.h>
1265# include <stddef.h>
1266#endif
1267 main()
1268 {
1269 if (sizeof(wchar_t) <= 2)
1270 exit(1);
1271 exit(0);
1272 }],
1273 ac_cv_small_wchar_t="no",
1274 ac_cv_small_wchar_t="yes",
1275 AC_MSG_ERROR(failed to compile test program))])
1276 AC_MSG_RESULT($ac_cv_small_wchar_t)
1277 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1278 AC_DEFINE(SMALL_WCHAR_T)
1279 fi
1280
Bram Moolenaar071d4272004-06-13 20:20:40 +00001281 fi
1282fi
1283
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001284test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001285
1286AC_MSG_CHECKING(--enable-gui argument)
1287AC_ARG_ENABLE(gui,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001288 [ --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 +00001289
1290dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1291dnl Do not use character classes for portability with old tools.
1292enable_gui_canon=`echo "_$enable_gui" | \
1293 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1294
1295dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001296SKIP_GTK2=YES
1297SKIP_GNOME=YES
1298SKIP_MOTIF=YES
1299SKIP_ATHENA=YES
1300SKIP_NEXTAW=YES
1301SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001302SKIP_CARBON=YES
1303GUITYPE=NONE
1304
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001305if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001306 SKIP_PHOTON=
1307 case "$enable_gui_canon" in
1308 no) AC_MSG_RESULT(no GUI support)
1309 SKIP_PHOTON=YES ;;
1310 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1311 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1312 photon) AC_MSG_RESULT(Photon GUI support) ;;
1313 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1314 SKIP_PHOTON=YES ;;
1315 esac
1316
1317elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1318 SKIP_CARBON=
1319 case "$enable_gui_canon" in
1320 no) AC_MSG_RESULT(no GUI support)
1321 SKIP_CARBON=YES ;;
1322 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
Bram Moolenaar164fca32010-07-14 13:58:07 +02001323 auto) AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
1324 SKIP_CARBON=YES ;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001325 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1326 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1327 SKIP_CARBON=YES ;;
1328 esac
1329
1330else
1331
Bram Moolenaar071d4272004-06-13 20:20:40 +00001332 case "$enable_gui_canon" in
1333 no|none) AC_MSG_RESULT(no GUI support) ;;
1334 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001335 SKIP_GTK2=
1336 SKIP_GNOME=
1337 SKIP_MOTIF=
1338 SKIP_ATHENA=
1339 SKIP_NEXTAW=
1340 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001341 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001342 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001343 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1344 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001345 SKIP_GTK2=;;
1346 motif) AC_MSG_RESULT(Motif GUI support)
1347 SKIP_MOTIF=;;
1348 athena) AC_MSG_RESULT(Athena GUI support)
1349 SKIP_ATHENA=;;
1350 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1351 SKIP_NEXTAW=;;
1352 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1353 esac
1354
1355fi
1356
Bram Moolenaar071d4272004-06-13 20:20:40 +00001357if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1358 -a "$enable_gui_canon" != "gnome2"; then
1359 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1360 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001361 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001362 , enable_gtk2_check="yes")
1363 AC_MSG_RESULT($enable_gtk2_check)
1364 if test "x$enable_gtk2_check" = "xno"; then
1365 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001366 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001367 fi
1368fi
1369
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001370if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001371 AC_MSG_CHECKING(whether or not to look for GNOME)
1372 AC_ARG_ENABLE(gnome-check,
1373 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1374 , enable_gnome_check="no")
1375 AC_MSG_RESULT($enable_gnome_check)
1376 if test "x$enable_gnome_check" = "xno"; then
1377 SKIP_GNOME=YES
1378 fi
1379fi
1380
1381if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1382 AC_MSG_CHECKING(whether or not to look for Motif)
1383 AC_ARG_ENABLE(motif-check,
1384 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1385 , enable_motif_check="yes")
1386 AC_MSG_RESULT($enable_motif_check)
1387 if test "x$enable_motif_check" = "xno"; then
1388 SKIP_MOTIF=YES
1389 fi
1390fi
1391
1392if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1393 AC_MSG_CHECKING(whether or not to look for Athena)
1394 AC_ARG_ENABLE(athena-check,
1395 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1396 , enable_athena_check="yes")
1397 AC_MSG_RESULT($enable_athena_check)
1398 if test "x$enable_athena_check" = "xno"; then
1399 SKIP_ATHENA=YES
1400 fi
1401fi
1402
1403if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1404 AC_MSG_CHECKING(whether or not to look for neXtaw)
1405 AC_ARG_ENABLE(nextaw-check,
1406 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1407 , enable_nextaw_check="yes")
1408 AC_MSG_RESULT($enable_nextaw_check);
1409 if test "x$enable_nextaw_check" = "xno"; then
1410 SKIP_NEXTAW=YES
1411 fi
1412fi
1413
1414if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1415 AC_MSG_CHECKING(whether or not to look for Carbon)
1416 AC_ARG_ENABLE(carbon-check,
1417 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1418 , enable_carbon_check="yes")
1419 AC_MSG_RESULT($enable_carbon_check);
1420 if test "x$enable_carbon_check" = "xno"; then
1421 SKIP_CARBON=YES
1422 fi
1423fi
1424
Bram Moolenaar843ee412004-06-30 16:16:41 +00001425
Bram Moolenaar071d4272004-06-13 20:20:40 +00001426if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1427 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001428 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001429 AC_MSG_RESULT(yes);
1430 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001431 if test "$VIMNAME" = "vim"; then
1432 VIMNAME=Vim
1433 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001434
Bram Moolenaar164fca32010-07-14 13:58:07 +02001435 if test "x$MACARCH" = "xboth"; then
1436 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
1437 else
1438 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
1439 fi
1440
Bram Moolenaar14716812006-05-04 21:54:08 +00001441 dnl Default install directory is not /usr/local
1442 if test x$prefix = xNONE; then
1443 prefix=/Applications
1444 fi
1445
1446 dnl Sorry for the hard coded default
1447 datadir='${prefix}/Vim.app/Contents/Resources'
1448
Bram Moolenaar071d4272004-06-13 20:20:40 +00001449 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001450 SKIP_GTK2=YES;
1451 SKIP_GNOME=YES;
1452 SKIP_MOTIF=YES;
1453 SKIP_ATHENA=YES;
1454 SKIP_NEXTAW=YES;
1455 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001456 SKIP_CARBON=YES
1457fi
1458
Bram Moolenaar071d4272004-06-13 20:20:40 +00001459dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001460dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001461dnl
1462dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001463dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001464dnl
1465AC_DEFUN(AM_PATH_GTK,
1466[
1467 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1468 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001469 min_gtk_version=ifelse([$1], ,2.2.0,$1)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001470 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1471 no_gtk=""
1472 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1473 && $PKG_CONFIG --exists gtk+-2.0; then
1474 {
1475 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1476 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1477 dnl something like that.
1478 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001479 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001480 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1481 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1482 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1483 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1484 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1485 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1486 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1487 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001488 else
1489 no_gtk=yes
1490 fi
1491
1492 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1493 {
1494 ac_save_CFLAGS="$CFLAGS"
1495 ac_save_LIBS="$LIBS"
1496 CFLAGS="$CFLAGS $GTK_CFLAGS"
1497 LIBS="$LIBS $GTK_LIBS"
1498
1499 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001500 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001501 dnl
1502 rm -f conf.gtktest
1503 AC_TRY_RUN([
1504#include <gtk/gtk.h>
1505#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001506#if STDC_HEADERS
1507# include <stdlib.h>
1508# include <stddef.h>
1509#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001510
1511int
1512main ()
1513{
1514int major, minor, micro;
1515char *tmp_version;
1516
1517system ("touch conf.gtktest");
1518
1519/* HP/UX 9 (%@#!) writes to sscanf strings */
1520tmp_version = g_strdup("$min_gtk_version");
1521if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1522 printf("%s, bad version string\n", "$min_gtk_version");
1523 exit(1);
1524 }
1525
1526if ((gtk_major_version > major) ||
1527 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1528 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1529 (gtk_micro_version >= micro)))
1530{
1531 return 0;
1532}
1533return 1;
1534}
1535],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1536 CFLAGS="$ac_save_CFLAGS"
1537 LIBS="$ac_save_LIBS"
1538 }
1539 fi
1540 if test "x$no_gtk" = x ; then
1541 if test "x$enable_gtktest" = "xyes"; then
1542 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1543 else
1544 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1545 fi
1546 ifelse([$2], , :, [$2])
1547 else
1548 {
1549 AC_MSG_RESULT(no)
1550 GTK_CFLAGS=""
1551 GTK_LIBS=""
1552 ifelse([$3], , :, [$3])
1553 }
1554 fi
1555 }
1556 else
1557 GTK_CFLAGS=""
1558 GTK_LIBS=""
1559 ifelse([$3], , :, [$3])
1560 fi
1561 AC_SUBST(GTK_CFLAGS)
1562 AC_SUBST(GTK_LIBS)
1563 rm -f conf.gtktest
1564])
1565
1566dnl ---------------------------------------------------------------------------
1567dnl gnome
1568dnl ---------------------------------------------------------------------------
1569AC_DEFUN([GNOME_INIT_HOOK],
1570[
1571 AC_SUBST(GNOME_LIBS)
1572 AC_SUBST(GNOME_LIBDIR)
1573 AC_SUBST(GNOME_INCLUDEDIR)
1574
1575 AC_ARG_WITH(gnome-includes,
1576 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1577 [CFLAGS="$CFLAGS -I$withval"]
1578 )
1579
1580 AC_ARG_WITH(gnome-libs,
1581 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1582 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1583 )
1584
1585 AC_ARG_WITH(gnome,
1586 [ --with-gnome Specify prefix for GNOME files],
1587 if test x$withval = xyes; then
1588 want_gnome=yes
1589 ifelse([$1], [], :, [$1])
1590 else
1591 if test "x$withval" = xno; then
1592 want_gnome=no
1593 else
1594 want_gnome=yes
1595 LDFLAGS="$LDFLAGS -L$withval/lib"
1596 CFLAGS="$CFLAGS -I$withval/include"
1597 gnome_prefix=$withval/lib
1598 fi
1599 fi,
1600 want_gnome=yes)
1601
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001602 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001603 {
1604 AC_MSG_CHECKING(for libgnomeui-2.0)
1605 if $PKG_CONFIG --exists libgnomeui-2.0; then
1606 AC_MSG_RESULT(yes)
1607 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1608 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1609 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001610
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001611 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1612 dnl This might not be the right way but it works for me...
1613 AC_MSG_CHECKING(for FreeBSD)
1614 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1615 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001616 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001617 GNOME_LIBS="$GNOME_LIBS -pthread"
1618 else
1619 AC_MSG_RESULT(no)
1620 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001621 $1
1622 else
1623 AC_MSG_RESULT(not found)
1624 if test "x$2" = xfail; then
1625 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1626 fi
1627 fi
1628 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001629 fi
1630])
1631
1632AC_DEFUN([GNOME_INIT],[
1633 GNOME_INIT_HOOK([],fail)
1634])
1635
1636
1637dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001638dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001639dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001640if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001641
1642 AC_MSG_CHECKING(--disable-gtktest argument)
1643 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1644 , enable_gtktest=yes)
1645 if test "x$enable_gtktest" = "xyes" ; then
1646 AC_MSG_RESULT(gtk test enabled)
1647 else
1648 AC_MSG_RESULT(gtk test disabled)
1649 fi
1650
Bram Moolenaar071d4272004-06-13 20:20:40 +00001651 if test "X$PKG_CONFIG" = "X"; then
1652 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1653 fi
1654
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001655 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001656 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1657 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001658 AM_PATH_GTK(2.2.0,
1659 [GUI_LIB_LOC="$GTK_LIBDIR"
1660 GTK_LIBNAME="$GTK_LIBS"
1661 GUI_INC_LOC="$GTK_CFLAGS"], )
1662 if test "x$GTK_CFLAGS" != "x"; then
1663 SKIP_ATHENA=YES
1664 SKIP_NEXTAW=YES
1665 SKIP_MOTIF=YES
1666 GUITYPE=GTK
1667 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001668 fi
1669 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001670 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001671 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1672 || test "0$gtk_minor_version" -ge 2; then
1673 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1674 fi
1675 dnl
1676 dnl if GTK exists, then check for GNOME.
1677 dnl
1678 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001679 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001680 GNOME_INIT_HOOK([have_gnome=yes])
1681 if test "x$have_gnome" = xyes ; then
1682 AC_DEFINE(FEAT_GUI_GNOME)
1683 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1684 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001685 fi
1686 }
1687 fi
1688 fi
1689fi
1690
1691dnl Check for Motif include files location.
1692dnl The LAST one found is used, this makes the highest version to be used,
1693dnl e.g. when Motif1.2 and Motif2.0 are both present.
1694
1695if test -z "$SKIP_MOTIF"; then
1696 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"
1697 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1698 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1699
1700 AC_MSG_CHECKING(for location of Motif GUI includes)
1701 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1702 GUI_INC_LOC=
1703 for try in $gui_includes; do
1704 if test -f "$try/Xm/Xm.h"; then
1705 GUI_INC_LOC=$try
1706 fi
1707 done
1708 if test -n "$GUI_INC_LOC"; then
1709 if test "$GUI_INC_LOC" = /usr/include; then
1710 GUI_INC_LOC=
1711 AC_MSG_RESULT(in default path)
1712 else
1713 AC_MSG_RESULT($GUI_INC_LOC)
1714 fi
1715 else
1716 AC_MSG_RESULT(<not found>)
1717 SKIP_MOTIF=YES
1718 fi
1719fi
1720
1721dnl Check for Motif library files location. In the same order as the include
1722dnl files, to avoid a mixup if several versions are present
1723
1724if test -z "$SKIP_MOTIF"; then
1725 AC_MSG_CHECKING(--with-motif-lib argument)
1726 AC_ARG_WITH(motif-lib,
1727 [ --with-motif-lib=STRING Library for Motif ],
1728 [ MOTIF_LIBNAME="${withval}" ] )
1729
1730 if test -n "$MOTIF_LIBNAME"; then
1731 AC_MSG_RESULT($MOTIF_LIBNAME)
1732 GUI_LIB_LOC=
1733 else
1734 AC_MSG_RESULT(no)
1735
1736 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1737 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1738
1739 AC_MSG_CHECKING(for location of Motif GUI libs)
1740 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"
1741 GUI_LIB_LOC=
1742 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001743 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00001744 if test -f "$libtry"; then
1745 GUI_LIB_LOC=$try
1746 fi
1747 done
1748 done
1749 if test -n "$GUI_LIB_LOC"; then
1750 dnl Remove /usr/lib, it causes trouble on some systems
1751 if test "$GUI_LIB_LOC" = /usr/lib; then
1752 GUI_LIB_LOC=
1753 AC_MSG_RESULT(in default path)
1754 else
1755 if test -n "$GUI_LIB_LOC"; then
1756 AC_MSG_RESULT($GUI_LIB_LOC)
1757 if test "`(uname) 2>/dev/null`" = SunOS &&
1758 uname -r | grep '^5' >/dev/null; then
1759 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1760 fi
1761 fi
1762 fi
1763 MOTIF_LIBNAME=-lXm
1764 else
1765 AC_MSG_RESULT(<not found>)
1766 SKIP_MOTIF=YES
1767 fi
1768 fi
1769fi
1770
1771if test -z "$SKIP_MOTIF"; then
1772 SKIP_ATHENA=YES
1773 SKIP_NEXTAW=YES
1774 GUITYPE=MOTIF
1775 AC_SUBST(MOTIF_LIBNAME)
1776fi
1777
1778dnl Check if the Athena files can be found
1779
1780GUI_X_LIBS=
1781
1782if test -z "$SKIP_ATHENA"; then
1783 AC_MSG_CHECKING(if Athena header files can be found)
1784 cflags_save=$CFLAGS
1785 CFLAGS="$CFLAGS $X_CFLAGS"
1786 AC_TRY_COMPILE([
1787#include <X11/Intrinsic.h>
1788#include <X11/Xaw/Paned.h>], ,
1789 AC_MSG_RESULT(yes),
1790 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1791 CFLAGS=$cflags_save
1792fi
1793
1794if test -z "$SKIP_ATHENA"; then
1795 GUITYPE=ATHENA
1796fi
1797
1798if test -z "$SKIP_NEXTAW"; then
1799 AC_MSG_CHECKING(if neXtaw header files can be found)
1800 cflags_save=$CFLAGS
1801 CFLAGS="$CFLAGS $X_CFLAGS"
1802 AC_TRY_COMPILE([
1803#include <X11/Intrinsic.h>
1804#include <X11/neXtaw/Paned.h>], ,
1805 AC_MSG_RESULT(yes),
1806 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1807 CFLAGS=$cflags_save
1808fi
1809
1810if test -z "$SKIP_NEXTAW"; then
1811 GUITYPE=NEXTAW
1812fi
1813
1814if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1815 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1816 dnl Avoid adding it when it twice
1817 if test -n "$GUI_INC_LOC"; then
1818 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1819 fi
1820 if test -n "$GUI_LIB_LOC"; then
1821 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1822 fi
1823
1824 dnl Check for -lXext and then for -lXmu
1825 ldflags_save=$LDFLAGS
1826 LDFLAGS="$X_LIBS $LDFLAGS"
1827 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1828 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1829 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1830 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1831 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1832 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1833 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1834 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1835 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1836 if test -z "$SKIP_MOTIF"; then
1837 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1838 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1839 fi
1840 LDFLAGS=$ldflags_save
1841
1842 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1843 AC_MSG_CHECKING(for extra X11 defines)
1844 NARROW_PROTO=
1845 rm -fr conftestdir
1846 if mkdir conftestdir; then
1847 cd conftestdir
1848 cat > Imakefile <<'EOF'
1849acfindx:
1850 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
1851EOF
1852 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1853 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
1854 fi
1855 cd ..
1856 rm -fr conftestdir
1857 fi
1858 if test -z "$NARROW_PROTO"; then
1859 AC_MSG_RESULT(no)
1860 else
1861 AC_MSG_RESULT($NARROW_PROTO)
1862 fi
1863 AC_SUBST(NARROW_PROTO)
1864fi
1865
1866dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
1867dnl use the X11 include path
1868if test "$enable_xsmp" = "yes"; then
1869 cppflags_save=$CPPFLAGS
1870 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1871 AC_CHECK_HEADERS(X11/SM/SMlib.h)
1872 CPPFLAGS=$cppflags_save
1873fi
1874
1875
Bram Moolenaare667c952010-07-05 22:57:59 +02001876if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001877 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
1878 cppflags_save=$CPPFLAGS
1879 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1880 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
1881
1882 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
1883 if test ! "$enable_xim" = "no"; then
1884 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
1885 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
1886 AC_MSG_RESULT(yes),
1887 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
1888 fi
1889 CPPFLAGS=$cppflags_save
1890
1891 dnl automatically enable XIM when hangul input isn't enabled
1892 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
1893 -a "x$GUITYPE" != "xNONE" ; then
1894 AC_MSG_RESULT(X GUI selected; xim has been enabled)
1895 enable_xim="yes"
1896 fi
1897fi
1898
1899if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1900 cppflags_save=$CPPFLAGS
1901 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001902dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
1903 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
1904 AC_TRY_COMPILE([
1905#include <X11/Intrinsic.h>
1906#include <X11/Xmu/Editres.h>],
1907 [int i; i = 0;],
1908 AC_MSG_RESULT(yes)
1909 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
1910 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001911 CPPFLAGS=$cppflags_save
1912fi
1913
1914dnl Only use the Xm directory when compiling Motif, don't use it for Athena
1915if test -z "$SKIP_MOTIF"; then
1916 cppflags_save=$CPPFLAGS
1917 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001918 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 +00001919 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001920
1921 if test $ac_cv_header_Xm_XpmP_h = yes; then
1922 dnl Solaris uses XpmAttributes_21, very annoying.
1923 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
1924 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
1925 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
1926 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
1927 )
1928 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00001929 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001930 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001931 CPPFLAGS=$cppflags_save
1932fi
1933
1934if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
1935 AC_MSG_RESULT(no GUI selected; xim has been disabled)
1936 enable_xim="no"
1937fi
1938if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
1939 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
1940 enable_fontset="no"
1941fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001942if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001943 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
1944 enable_fontset="no"
1945fi
1946
Bram Moolenaar071d4272004-06-13 20:20:40 +00001947if test -z "$SKIP_PHOTON"; then
1948 GUITYPE=PHOTONGUI
1949fi
1950
1951AC_SUBST(GUI_INC_LOC)
1952AC_SUBST(GUI_LIB_LOC)
1953AC_SUBST(GUITYPE)
1954AC_SUBST(GUI_X_LIBS)
1955
1956if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
1957 AC_MSG_ERROR([cannot use workshop without Motif])
1958fi
1959
1960dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
1961if test "$enable_xim" = "yes"; then
1962 AC_DEFINE(FEAT_XIM)
1963fi
1964if test "$enable_fontset" = "yes"; then
1965 AC_DEFINE(FEAT_XFONTSET)
1966fi
1967
1968
1969dnl ---------------------------------------------------------------------------
1970dnl end of GUI-checking
1971dnl ---------------------------------------------------------------------------
1972
1973
1974dnl Only really enable hangul input when GUI and XFONTSET are available
1975if test "$enable_hangulinput" = "yes"; then
1976 if test "x$GUITYPE" = "xNONE"; then
1977 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
1978 enable_hangulinput=no
1979 else
1980 AC_DEFINE(FEAT_HANGULIN)
1981 HANGULIN_SRC=hangulin.c
1982 AC_SUBST(HANGULIN_SRC)
1983 HANGULIN_OBJ=objects/hangulin.o
1984 AC_SUBST(HANGULIN_OBJ)
1985 fi
1986fi
1987
1988dnl Checks for libraries and include files.
1989
Bram Moolenaar446cb832008-06-24 21:56:24 +00001990AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
1991 [
1992 AC_RUN_IFELSE([[
1993#include "confdefs.h"
1994#include <ctype.h>
1995#if STDC_HEADERS
1996# include <stdlib.h>
1997# include <stddef.h>
1998#endif
1999main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2000 ]],[
2001 vim_cv_toupper_broken=yes
2002 ],[
2003 vim_cv_toupper_broken=no
2004 ],[
2005 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2006 ])])
2007
2008if test "x$vim_cv_toupper_broken" = "xyes" ; then
2009 AC_DEFINE(BROKEN_TOUPPER)
2010fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002011
2012AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002013AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002014 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2015 AC_MSG_RESULT(no))
2016
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002017AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2018AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2019 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2020 AC_MSG_RESULT(no))
2021
Bram Moolenaar071d4272004-06-13 20:20:40 +00002022dnl Checks for header files.
2023AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2024dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2025if test "$HAS_ELF" = 1; then
2026 AC_CHECK_LIB(elf, main)
2027fi
2028
2029AC_HEADER_DIRENT
2030
Bram Moolenaar071d4272004-06-13 20:20:40 +00002031dnl If sys/wait.h is not found it might still exist but not be POSIX
2032dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2033if test $ac_cv_header_sys_wait_h = no; then
2034 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2035 AC_TRY_COMPILE([#include <sys/wait.h>],
2036 [union wait xx, yy; xx = yy],
2037 AC_MSG_RESULT(yes)
2038 AC_DEFINE(HAVE_SYS_WAIT_H)
2039 AC_DEFINE(HAVE_UNION_WAIT),
2040 AC_MSG_RESULT(no))
2041fi
2042
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002043AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2044 sys/select.h sys/utsname.h termcap.h fcntl.h \
2045 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2046 termio.h iconv.h inttypes.h langinfo.h math.h \
2047 unistd.h stropts.h errno.h sys/resource.h \
2048 sys/systeminfo.h locale.h sys/stream.h termios.h \
2049 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2050 utime.h sys/param.h libintl.h libgen.h \
2051 util/debug.h util/msg18n.h frame.h sys/acl.h \
2052 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002053
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002054dnl sys/ptem.h depends on sys/stream.h on Solaris
2055AC_CHECK_HEADERS(sys/ptem.h, [], [],
2056[#if defined HAVE_SYS_STREAM_H
2057# include <sys/stream.h>
2058#endif])
2059
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002060dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2061AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2062[#if defined HAVE_SYS_PARAM_H
2063# include <sys/param.h>
2064#endif])
2065
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002066
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002067dnl pthread_np.h may exist but can only be used after including pthread.h
2068AC_MSG_CHECKING([for pthread_np.h])
2069AC_TRY_COMPILE([
2070#include <pthread.h>
2071#include <pthread_np.h>],
2072 [int i; i = 0;],
2073 AC_MSG_RESULT(yes)
2074 AC_DEFINE(HAVE_PTHREAD_NP_H),
2075 AC_MSG_RESULT(no))
2076
Bram Moolenaare344bea2005-09-01 20:46:49 +00002077AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002078if test "x$MACOSX" = "xyes"; then
2079 dnl The strings.h file on OS/X contains a warning and nothing useful.
2080 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2081else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002082
2083dnl Check if strings.h and string.h can both be included when defined.
2084AC_MSG_CHECKING([if strings.h can be included after string.h])
2085cppflags_save=$CPPFLAGS
2086CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2087AC_TRY_COMPILE([
2088#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2089# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2090 /* but don't do it on AIX 5.1 (Uribarri) */
2091#endif
2092#ifdef HAVE_XM_XM_H
2093# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2094#endif
2095#ifdef HAVE_STRING_H
2096# include <string.h>
2097#endif
2098#if defined(HAVE_STRINGS_H)
2099# include <strings.h>
2100#endif
2101 ], [int i; i = 0;],
2102 AC_MSG_RESULT(yes),
2103 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2104 AC_MSG_RESULT(no))
2105CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002106fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002107
2108dnl Checks for typedefs, structures, and compiler characteristics.
2109AC_PROG_GCC_TRADITIONAL
2110AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002111AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002112AC_TYPE_MODE_T
2113AC_TYPE_OFF_T
2114AC_TYPE_PID_T
2115AC_TYPE_SIZE_T
2116AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002117AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002118
Bram Moolenaar071d4272004-06-13 20:20:40 +00002119AC_HEADER_TIME
2120AC_CHECK_TYPE(ino_t, long)
2121AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002122AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002123
2124AC_MSG_CHECKING(for rlim_t)
2125if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2126 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2127else
2128 AC_EGREP_CPP(dnl
2129changequote(<<,>>)dnl
2130<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2131changequote([,]),
2132 [
2133#include <sys/types.h>
2134#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002135# include <stdlib.h>
2136# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002137#endif
2138#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002139# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002140#endif
2141 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2142 AC_MSG_RESULT($ac_cv_type_rlim_t)
2143fi
2144if test $ac_cv_type_rlim_t = no; then
2145 cat >> confdefs.h <<\EOF
2146#define rlim_t unsigned long
2147EOF
2148fi
2149
2150AC_MSG_CHECKING(for stack_t)
2151if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2152 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2153else
2154 AC_EGREP_CPP(stack_t,
2155 [
2156#include <sys/types.h>
2157#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002158# include <stdlib.h>
2159# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002160#endif
2161#include <signal.h>
2162 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2163 AC_MSG_RESULT($ac_cv_type_stack_t)
2164fi
2165if test $ac_cv_type_stack_t = no; then
2166 cat >> confdefs.h <<\EOF
2167#define stack_t struct sigaltstack
2168EOF
2169fi
2170
2171dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2172AC_MSG_CHECKING(whether stack_t has an ss_base field)
2173AC_TRY_COMPILE([
2174#include <sys/types.h>
2175#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002176# include <stdlib.h>
2177# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002178#endif
2179#include <signal.h>
2180#include "confdefs.h"
2181 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2182 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2183 AC_MSG_RESULT(no))
2184
2185olibs="$LIBS"
2186AC_MSG_CHECKING(--with-tlib argument)
2187AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2188if test -n "$with_tlib"; then
2189 AC_MSG_RESULT($with_tlib)
2190 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002191 AC_MSG_CHECKING(for linking with $with_tlib library)
2192 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2193 dnl Need to check for tgetent() below.
2194 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002195else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002196 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002197 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2198 dnl curses, because curses is much slower.
2199 dnl Newer versions of ncurses are preferred over anything.
2200 dnl Older versions of ncurses have bugs, get a new one!
2201 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002202 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002203 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002204 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002205 *) tlibs="ncurses termlib termcap curses";;
2206 esac
2207 for libname in $tlibs; do
2208 AC_CHECK_LIB(${libname}, tgetent,,)
2209 if test "x$olibs" != "x$LIBS"; then
2210 dnl It's possible that a library is found but it doesn't work
2211 dnl e.g., shared library that cannot be found
2212 dnl compile and run a test program to be sure
2213 AC_TRY_RUN([
2214#ifdef HAVE_TERMCAP_H
2215# include <termcap.h>
2216#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002217#if STDC_HEADERS
2218# include <stdlib.h>
2219# include <stddef.h>
2220#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002221main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2222 res="OK", res="FAIL", res="FAIL")
2223 if test "$res" = "OK"; then
2224 break
2225 fi
2226 AC_MSG_RESULT($libname library is not usable)
2227 LIBS="$olibs"
2228 fi
2229 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002230 if test "x$olibs" = "x$LIBS"; then
2231 AC_MSG_RESULT(no terminal library found)
2232 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002233fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002234
2235if test "x$olibs" = "x$LIBS"; then
2236 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002237 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002238 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2239 AC_MSG_RESULT(yes),
2240 AC_MSG_ERROR([NOT FOUND!
2241 You need to install a terminal library; for example ncurses.
2242 Or specify the name of the library with --with-tlib.]))
2243fi
2244
Bram Moolenaar446cb832008-06-24 21:56:24 +00002245AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2246 [
2247 AC_RUN_IFELSE([[
2248#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002249#ifdef HAVE_TERMCAP_H
2250# include <termcap.h>
2251#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002252#ifdef HAVE_STRING_H
2253# include <string.h>
2254#endif
2255#if STDC_HEADERS
2256# include <stdlib.h>
2257# include <stddef.h>
2258#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002259main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002260{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2261 ]],[
2262 vim_cv_terminfo=no
2263 ],[
2264 vim_cv_terminfo=yes
2265 ],[
2266 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2267 ])
2268 ])
2269
2270if test "x$vim_cv_terminfo" = "xyes" ; then
2271 AC_DEFINE(TERMINFO)
2272fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002273
2274if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002275 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2276 [
2277 AC_RUN_IFELSE([[
2278#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002279#ifdef HAVE_TERMCAP_H
2280# include <termcap.h>
2281#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002282#if STDC_HEADERS
2283# include <stdlib.h>
2284# include <stddef.h>
2285#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002286main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002287{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2288 ]],[
2289 vim_cv_tgent=zero
2290 ],[
2291 vim_cv_tgent=non-zero
2292 ],[
2293 AC_MSG_ERROR(failed to compile test program.)
2294 ])
2295 ])
2296
2297 if test "x$vim_cv_tgent" = "xzero" ; then
2298 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2299 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002300fi
2301
2302AC_MSG_CHECKING(whether termcap.h contains ospeed)
2303AC_TRY_LINK([
2304#ifdef HAVE_TERMCAP_H
2305# include <termcap.h>
2306#endif
2307 ], [ospeed = 20000],
2308 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2309 [AC_MSG_RESULT(no)
2310 AC_MSG_CHECKING(whether ospeed can be extern)
2311 AC_TRY_LINK([
2312#ifdef HAVE_TERMCAP_H
2313# include <termcap.h>
2314#endif
2315extern short ospeed;
2316 ], [ospeed = 20000],
2317 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2318 AC_MSG_RESULT(no))]
2319 )
2320
2321AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2322AC_TRY_LINK([
2323#ifdef HAVE_TERMCAP_H
2324# include <termcap.h>
2325#endif
2326 ], [if (UP == 0 && BC == 0) PC = 1],
2327 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2328 [AC_MSG_RESULT(no)
2329 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2330 AC_TRY_LINK([
2331#ifdef HAVE_TERMCAP_H
2332# include <termcap.h>
2333#endif
2334extern char *UP, *BC, PC;
2335 ], [if (UP == 0 && BC == 0) PC = 1],
2336 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2337 AC_MSG_RESULT(no))]
2338 )
2339
2340AC_MSG_CHECKING(whether tputs() uses outfuntype)
2341AC_TRY_COMPILE([
2342#ifdef HAVE_TERMCAP_H
2343# include <termcap.h>
2344#endif
2345 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2346 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2347 AC_MSG_RESULT(no))
2348
2349dnl On some SCO machines sys/select redefines struct timeval
2350AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2351AC_TRY_COMPILE([
2352#include <sys/types.h>
2353#include <sys/time.h>
2354#include <sys/select.h>], ,
2355 AC_MSG_RESULT(yes)
2356 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2357 AC_MSG_RESULT(no))
2358
2359dnl AC_DECL_SYS_SIGLIST
2360
2361dnl Checks for pty.c (copied from screen) ==========================
2362AC_MSG_CHECKING(for /dev/ptc)
2363if test -r /dev/ptc; then
2364 AC_DEFINE(HAVE_DEV_PTC)
2365 AC_MSG_RESULT(yes)
2366else
2367 AC_MSG_RESULT(no)
2368fi
2369
2370AC_MSG_CHECKING(for SVR4 ptys)
2371if test -c /dev/ptmx ; then
2372 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2373 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2374 AC_MSG_RESULT(no))
2375else
2376 AC_MSG_RESULT(no)
2377fi
2378
2379AC_MSG_CHECKING(for ptyranges)
2380if test -d /dev/ptym ; then
2381 pdir='/dev/ptym'
2382else
2383 pdir='/dev'
2384fi
2385dnl SCO uses ptyp%d
2386AC_EGREP_CPP(yes,
2387[#ifdef M_UNIX
2388 yes;
2389#endif
2390 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2391dnl if test -c /dev/ptyp19; then
2392dnl ptys=`echo /dev/ptyp??`
2393dnl else
2394dnl ptys=`echo $pdir/pty??`
2395dnl fi
2396if test "$ptys" != "$pdir/pty??" ; then
2397 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2398 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2399 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2400 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2401 AC_MSG_RESULT([$p0 / $p1])
2402else
2403 AC_MSG_RESULT([don't know])
2404fi
2405
2406dnl **** pty mode/group handling ****
2407dnl
2408dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002409rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002410AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2411 [
2412 AC_RUN_IFELSE([[
2413#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002414#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002415#if STDC_HEADERS
2416# include <stdlib.h>
2417# include <stddef.h>
2418#endif
2419#ifdef HAVE_UNISTD_H
2420#include <unistd.h>
2421#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002422#include <sys/stat.h>
2423#include <stdio.h>
2424main()
2425{
2426 struct stat sb;
2427 char *x,*ttyname();
2428 int om, m;
2429 FILE *fp;
2430
2431 if (!(x = ttyname(0))) exit(1);
2432 if (stat(x, &sb)) exit(1);
2433 om = sb.st_mode;
2434 if (om & 002) exit(0);
2435 m = system("mesg y");
2436 if (m == -1 || m == 127) exit(1);
2437 if (stat(x, &sb)) exit(1);
2438 m = sb.st_mode;
2439 if (chmod(x, om)) exit(1);
2440 if (m & 002) exit(0);
2441 if (sb.st_gid == getgid()) exit(1);
2442 if (!(fp=fopen("conftest_grp", "w")))
2443 exit(1);
2444 fprintf(fp, "%d\n", sb.st_gid);
2445 fclose(fp);
2446 exit(0);
2447}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002448 ]],[
2449 if test -f conftest_grp; then
2450 vim_cv_tty_group=`cat conftest_grp`
2451 if test "x$vim_cv_tty_mode" = "x" ; then
2452 vim_cv_tty_mode=0620
2453 fi
2454 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2455 else
2456 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002457 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002458 fi
2459 ],[
2460 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002461 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002462 ],[
2463 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2464 ])
2465 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002466rm -f conftest_grp
2467
Bram Moolenaar446cb832008-06-24 21:56:24 +00002468if test "x$vim_cv_tty_group" != "xworld" ; then
2469 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2470 if test "x$vim_cv_tty_mode" = "x" ; then
2471 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)])
2472 else
2473 AC_DEFINE(PTYMODE, 0620)
2474 fi
2475fi
2476
Bram Moolenaar071d4272004-06-13 20:20:40 +00002477dnl Checks for library functions. ===================================
2478
2479AC_TYPE_SIGNAL
2480
2481dnl find out what to use at the end of a signal function
2482if test $ac_cv_type_signal = void; then
2483 AC_DEFINE(SIGRETURN, [return])
2484else
2485 AC_DEFINE(SIGRETURN, [return 0])
2486fi
2487
2488dnl check if struct sigcontext is defined (used for SGI only)
2489AC_MSG_CHECKING(for struct sigcontext)
2490AC_TRY_COMPILE([
2491#include <signal.h>
2492test_sig()
2493{
2494 struct sigcontext *scont;
2495 scont = (struct sigcontext *)0;
2496 return 1;
2497} ], ,
2498 AC_MSG_RESULT(yes)
2499 AC_DEFINE(HAVE_SIGCONTEXT),
2500 AC_MSG_RESULT(no))
2501
2502dnl tricky stuff: try to find out if getcwd() is implemented with
2503dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002504AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2505 [
2506 AC_RUN_IFELSE([[
2507#include "confdefs.h"
2508#ifdef HAVE_UNISTD_H
2509#include <unistd.h>
2510#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002511char *dagger[] = { "IFS=pwd", 0 };
2512main()
2513{
2514 char buffer[500];
2515 extern char **environ;
2516 environ = dagger;
2517 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002518}
2519 ]],[
2520 vim_cv_getcwd_broken=no
2521 ],[
2522 vim_cv_getcwd_broken=yes
2523 ],[
2524 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2525 ])
2526 ])
2527
2528if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2529 AC_DEFINE(BAD_GETCWD)
2530fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002531
Bram Moolenaar25153e12010-02-24 14:47:08 +01002532dnl Check for functions in one big call, to reduce the size of configure.
2533dnl Can only be used for functions that do not require any include.
2534AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002535 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002536 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002537 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002538 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002539 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2540 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002541AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002542
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002543dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2544dnl appropriate, so that off_t is 64 bits when needed.
2545AC_SYS_LARGEFILE
2546
Bram Moolenaar071d4272004-06-13 20:20:40 +00002547dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2548AC_MSG_CHECKING(for st_blksize)
2549AC_TRY_COMPILE(
2550[#include <sys/types.h>
2551#include <sys/stat.h>],
2552[ struct stat st;
2553 int n;
2554
2555 stat("/", &st);
2556 n = (int)st.st_blksize;],
2557 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2558 AC_MSG_RESULT(no))
2559
Bram Moolenaar446cb832008-06-24 21:56:24 +00002560AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2561 [
2562 AC_RUN_IFELSE([[
2563#include "confdefs.h"
2564#if STDC_HEADERS
2565# include <stdlib.h>
2566# include <stddef.h>
2567#endif
2568#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002569#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002570main() {struct stat st; exit(stat("configure/", &st) != 0); }
2571 ]],[
2572 vim_cv_stat_ignores_slash=yes
2573 ],[
2574 vim_cv_stat_ignores_slash=no
2575 ],[
2576 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2577 ])
2578 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002579
Bram Moolenaar446cb832008-06-24 21:56:24 +00002580if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2581 AC_DEFINE(STAT_IGNORES_SLASH)
2582fi
2583
Bram Moolenaar071d4272004-06-13 20:20:40 +00002584dnl Link with iconv for charset translation, if not found without library.
2585dnl check for iconv() requires including iconv.h
2586dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2587dnl has been installed.
2588AC_MSG_CHECKING(for iconv_open())
2589save_LIBS="$LIBS"
2590LIBS="$LIBS -liconv"
2591AC_TRY_LINK([
2592#ifdef HAVE_ICONV_H
2593# include <iconv.h>
2594#endif
2595 ], [iconv_open("fr", "to");],
2596 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2597 LIBS="$save_LIBS"
2598 AC_TRY_LINK([
2599#ifdef HAVE_ICONV_H
2600# include <iconv.h>
2601#endif
2602 ], [iconv_open("fr", "to");],
2603 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2604 AC_MSG_RESULT(no)))
2605
2606
2607AC_MSG_CHECKING(for nl_langinfo(CODESET))
2608AC_TRY_LINK([
2609#ifdef HAVE_LANGINFO_H
2610# include <langinfo.h>
2611#endif
2612], [char *cs = nl_langinfo(CODESET);],
2613 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2614 AC_MSG_RESULT(no))
2615
Bram Moolenaar446cb832008-06-24 21:56:24 +00002616dnl Need various functions for floating point support. Only enable
2617dnl floating point when they are all present.
2618AC_CHECK_LIB(m, strtod)
2619AC_MSG_CHECKING([for strtod() and other floating point functions])
2620AC_TRY_LINK([
2621#ifdef HAVE_MATH_H
2622# include <math.h>
2623#endif
2624#if STDC_HEADERS
2625# include <stdlib.h>
2626# include <stddef.h>
2627#endif
2628], [char *s; double d;
2629 d = strtod("1.1", &s);
2630 d = fabs(1.11);
2631 d = ceil(1.11);
2632 d = floor(1.11);
2633 d = log10(1.11);
2634 d = pow(1.11, 2.22);
2635 d = sqrt(1.11);
2636 d = sin(1.11);
2637 d = cos(1.11);
2638 d = atan(1.11);
2639 ],
2640 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2641 AC_MSG_RESULT(no))
2642
Bram Moolenaar071d4272004-06-13 20:20:40 +00002643dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2644dnl when -lacl works, also try to use -lattr (required for Debian).
2645AC_MSG_CHECKING(--disable-acl argument)
2646AC_ARG_ENABLE(acl,
2647 [ --disable-acl Don't check for ACL support.],
2648 , [enable_acl="yes"])
2649if test "$enable_acl" = "yes"; then
2650AC_MSG_RESULT(no)
2651AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2652 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2653 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2654
2655AC_MSG_CHECKING(for POSIX ACL support)
2656AC_TRY_LINK([
2657#include <sys/types.h>
2658#ifdef HAVE_SYS_ACL_H
2659# include <sys/acl.h>
2660#endif
2661acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2662 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2663 acl_free(acl);],
2664 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2665 AC_MSG_RESULT(no))
2666
2667AC_MSG_CHECKING(for Solaris ACL support)
2668AC_TRY_LINK([
2669#ifdef HAVE_SYS_ACL_H
2670# include <sys/acl.h>
2671#endif], [acl("foo", GETACLCNT, 0, NULL);
2672 ],
2673 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2674 AC_MSG_RESULT(no))
2675
2676AC_MSG_CHECKING(for AIX ACL support)
2677AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002678#if STDC_HEADERS
2679# include <stdlib.h>
2680# include <stddef.h>
2681#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002682#ifdef HAVE_SYS_ACL_H
2683# include <sys/acl.h>
2684#endif
2685#ifdef HAVE_SYS_ACCESS_H
2686# include <sys/access.h>
2687#endif
2688#define _ALL_SOURCE
2689
2690#include <sys/stat.h>
2691
2692int aclsize;
2693struct acl *aclent;], [aclsize = sizeof(struct acl);
2694 aclent = (void *)malloc(aclsize);
2695 statacl("foo", STX_NORMAL, aclent, aclsize);
2696 ],
2697 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2698 AC_MSG_RESULT(no))
2699else
2700 AC_MSG_RESULT(yes)
2701fi
2702
2703AC_MSG_CHECKING(--disable-gpm argument)
2704AC_ARG_ENABLE(gpm,
2705 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2706 [enable_gpm="yes"])
2707
2708if test "$enable_gpm" = "yes"; then
2709 AC_MSG_RESULT(no)
2710 dnl Checking if gpm support can be compiled
2711 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2712 [olibs="$LIBS" ; LIBS="-lgpm"]
2713 AC_TRY_LINK(
2714 [#include <gpm.h>
2715 #include <linux/keyboard.h>],
2716 [Gpm_GetLibVersion(NULL);],
2717 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2718 dnl FEAT_MOUSE_GPM if mouse support is included
2719 [vi_cv_have_gpm=yes],
2720 [vi_cv_have_gpm=no])
2721 [LIBS="$olibs"]
2722 )
2723 if test $vi_cv_have_gpm = yes; then
2724 LIBS="$LIBS -lgpm"
2725 AC_DEFINE(HAVE_GPM)
2726 fi
2727else
2728 AC_MSG_RESULT(yes)
2729fi
2730
Bram Moolenaar446cb832008-06-24 21:56:24 +00002731AC_MSG_CHECKING(--disable-sysmouse argument)
2732AC_ARG_ENABLE(sysmouse,
2733 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2734 [enable_sysmouse="yes"])
2735
2736if test "$enable_sysmouse" = "yes"; then
2737 AC_MSG_RESULT(no)
2738 dnl Checking if sysmouse support can be compiled
2739 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
2740 dnl defines FEAT_SYSMOUSE if mouse support is included
2741 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
2742 AC_TRY_LINK(
2743 [#include <sys/consio.h>
2744 #include <signal.h>
2745 #include <sys/fbio.h>],
2746 [struct mouse_info mouse;
2747 mouse.operation = MOUSE_MODE;
2748 mouse.operation = MOUSE_SHOW;
2749 mouse.u.mode.mode = 0;
2750 mouse.u.mode.signal = SIGUSR2;],
2751 [vi_cv_have_sysmouse=yes],
2752 [vi_cv_have_sysmouse=no])
2753 )
2754 if test $vi_cv_have_sysmouse = yes; then
2755 AC_DEFINE(HAVE_SYSMOUSE)
2756 fi
2757else
2758 AC_MSG_RESULT(yes)
2759fi
2760
Bram Moolenaarf05da212009-11-17 16:13:15 +00002761dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
2762AC_MSG_CHECKING(for FD_CLOEXEC)
2763AC_TRY_COMPILE(
2764[#if HAVE_FCNTL_H
2765# include <fcntl.h>
2766#endif],
2767[ int flag = FD_CLOEXEC;],
2768 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
2769 AC_MSG_RESULT(not usable))
2770
Bram Moolenaar071d4272004-06-13 20:20:40 +00002771dnl rename needs to be checked separately to work on Nextstep with cc
2772AC_MSG_CHECKING(for rename)
2773AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2774 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2775 AC_MSG_RESULT(no))
2776
2777dnl sysctl() may exist but not the arguments we use
2778AC_MSG_CHECKING(for sysctl)
2779AC_TRY_COMPILE(
2780[#include <sys/types.h>
2781#include <sys/sysctl.h>],
2782[ int mib[2], r;
2783 size_t len;
2784
2785 mib[0] = CTL_HW;
2786 mib[1] = HW_USERMEM;
2787 len = sizeof(r);
2788 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2789 ],
2790 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2791 AC_MSG_RESULT(not usable))
2792
2793dnl sysinfo() may exist but not be Linux compatible
2794AC_MSG_CHECKING(for sysinfo)
2795AC_TRY_COMPILE(
2796[#include <sys/types.h>
2797#include <sys/sysinfo.h>],
2798[ struct sysinfo sinfo;
2799 int t;
2800
2801 (void)sysinfo(&sinfo);
2802 t = sinfo.totalram;
2803 ],
2804 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2805 AC_MSG_RESULT(not usable))
2806
Bram Moolenaar914572a2007-05-01 11:37:47 +00002807dnl struct sysinfo may have the mem_unit field or not
2808AC_MSG_CHECKING(for sysinfo.mem_unit)
2809AC_TRY_COMPILE(
2810[#include <sys/types.h>
2811#include <sys/sysinfo.h>],
2812[ struct sysinfo sinfo;
2813 sinfo.mem_unit = 1;
2814 ],
2815 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
2816 AC_MSG_RESULT(no))
2817
Bram Moolenaar071d4272004-06-13 20:20:40 +00002818dnl sysconf() may exist but not support what we want to use
2819AC_MSG_CHECKING(for sysconf)
2820AC_TRY_COMPILE(
2821[#include <unistd.h>],
2822[ (void)sysconf(_SC_PAGESIZE);
2823 (void)sysconf(_SC_PHYS_PAGES);
2824 ],
2825 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2826 AC_MSG_RESULT(not usable))
2827
Bram Moolenaar914703b2010-05-31 21:59:46 +02002828AC_CHECK_SIZEOF([int])
2829AC_CHECK_SIZEOF([long])
2830AC_CHECK_SIZEOF([time_t])
2831AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02002832
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002833dnl Make sure that uint32_t is really 32 bits unsigned.
2834AC_MSG_CHECKING([uint32_t is 32 bits])
2835AC_TRY_RUN([
2836#ifdef HAVE_STDINT_H
2837# include <stdint.h>
2838#endif
2839#ifdef HAVE_INTTYPES_H
2840# include <inttypes.h>
2841#endif
2842main() {
2843 uint32_t nr1 = (uint32_t)-1;
2844 uint32_t nr2 = (uint32_t)0xffffffffUL;
2845 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
2846 exit(0);
2847}],
2848AC_MSG_RESULT(ok),
2849AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
2850AC_MSG_ERROR([could not compile program using uint32_t.]))
2851
Bram Moolenaar446cb832008-06-24 21:56:24 +00002852dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2853dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2854
Bram Moolenaar071d4272004-06-13 20:20:40 +00002855[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00002856#include "confdefs.h"
2857#ifdef HAVE_STRING_H
2858# include <string.h>
2859#endif
2860#if STDC_HEADERS
2861# include <stdlib.h>
2862# include <stddef.h>
2863#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002864main() {
2865 char buf[10];
2866 strcpy(buf, "abcdefghi");
2867 mch_memmove(buf, buf + 2, 3);
2868 if (strncmp(buf, "ababcf", 6))
2869 exit(1);
2870 strcpy(buf, "abcdefghi");
2871 mch_memmove(buf + 2, buf, 3);
2872 if (strncmp(buf, "cdedef", 6))
2873 exit(1);
2874 exit(0); /* libc version works properly. */
2875}']
2876
Bram Moolenaar446cb832008-06-24 21:56:24 +00002877AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
2878 [
2879 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
2880 [
2881 vim_cv_memmove_handles_overlap=yes
2882 ],[
2883 vim_cv_memmove_handles_overlap=no
2884 ],[
2885 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
2886 ])
2887 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002888
Bram Moolenaar446cb832008-06-24 21:56:24 +00002889if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
2890 AC_DEFINE(USEMEMMOVE)
2891else
2892 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
2893 [
2894 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
2895 [
2896 vim_cv_bcopy_handles_overlap=yes
2897 ],[
2898 vim_cv_bcopy_handles_overlap=no
2899 ],[
2900 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
2901 ])
2902 ])
2903
2904 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
2905 AC_DEFINE(USEBCOPY)
2906 else
2907 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
2908 [
2909 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
2910 [
2911 vim_cv_memcpy_handles_overlap=yes
2912 ],[
2913 vim_cv_memcpy_handles_overlap=no
2914 ],[
2915 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
2916 ])
2917 ])
2918
2919 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
2920 AC_DEFINE(USEMEMCPY)
2921 fi
2922 fi
2923fi
2924
Bram Moolenaar071d4272004-06-13 20:20:40 +00002925
2926dnl Check for multibyte locale functions
2927dnl Find out if _Xsetlocale() is supported by libX11.
2928dnl Check if X_LOCALE should be defined.
2929
2930if test "$enable_multibyte" = "yes"; then
2931 cflags_save=$CFLAGS
2932 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00002933 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002934 CFLAGS="$CFLAGS -I$x_includes"
2935 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
2936 AC_MSG_CHECKING(whether X_LOCALE needed)
2937 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
2938 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
2939 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
2940 AC_MSG_RESULT(no))
2941 fi
2942 CFLAGS=$cflags_save
2943 LDFLAGS=$ldflags_save
2944fi
2945
2946dnl Link with xpg4, it is said to make Korean locale working
2947AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
2948
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00002949dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002950dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002951dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002952dnl -t for typedefs (many ctags have this)
2953dnl -s for static functions (Elvis ctags only?)
2954dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
2955dnl -i+m to test for older Exuberant ctags
2956AC_MSG_CHECKING(how to create tags)
2957test -f tags && mv tags tags.save
2958if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002959 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002960else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00002961 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002962 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
2963 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
2964 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
2965 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
2966 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
2967 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
2968 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
2969fi
2970test -f tags.save && mv tags.save tags
2971AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
2972
2973dnl Check how we can run man with a section number
2974AC_MSG_CHECKING(how to run man with a section nr)
2975MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00002976(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 +00002977AC_MSG_RESULT($MANDEF)
2978if test "$MANDEF" = "man -s"; then
2979 AC_DEFINE(USEMAN_S)
2980fi
2981
2982dnl Check if gettext() is working and if it needs -lintl
2983AC_MSG_CHECKING(--disable-nls argument)
2984AC_ARG_ENABLE(nls,
2985 [ --disable-nls Don't support NLS (gettext()).], ,
2986 [enable_nls="yes"])
2987
2988if test "$enable_nls" = "yes"; then
2989 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002990
2991 INSTALL_LANGS=install-languages
2992 AC_SUBST(INSTALL_LANGS)
2993 INSTALL_TOOL_LANGS=install-tool-languages
2994 AC_SUBST(INSTALL_TOOL_LANGS)
2995
Bram Moolenaar071d4272004-06-13 20:20:40 +00002996 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
2997 AC_MSG_CHECKING([for NLS])
2998 if test -f po/Makefile; then
2999 have_gettext="no"
3000 if test -n "$MSGFMT"; then
3001 AC_TRY_LINK(
3002 [#include <libintl.h>],
3003 [gettext("Test");],
3004 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3005 olibs=$LIBS
3006 LIBS="$LIBS -lintl"
3007 AC_TRY_LINK(
3008 [#include <libintl.h>],
3009 [gettext("Test");],
3010 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3011 AC_MSG_RESULT([gettext() doesn't work]);
3012 LIBS=$olibs))
3013 else
3014 AC_MSG_RESULT([msgfmt not found - disabled]);
3015 fi
3016 if test $have_gettext = "yes"; then
3017 AC_DEFINE(HAVE_GETTEXT)
3018 MAKEMO=yes
3019 AC_SUBST(MAKEMO)
3020 dnl this was added in GNU gettext 0.10.36
3021 AC_CHECK_FUNCS(bind_textdomain_codeset)
3022 dnl _nl_msg_cat_cntr is required for GNU gettext
3023 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3024 AC_TRY_LINK(
3025 [#include <libintl.h>
3026 extern int _nl_msg_cat_cntr;],
3027 [++_nl_msg_cat_cntr;],
3028 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3029 AC_MSG_RESULT([no]))
3030 fi
3031 else
3032 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3033 fi
3034else
3035 AC_MSG_RESULT(yes)
3036fi
3037
3038dnl Check for dynamic linking loader
3039AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3040if test x${DLL} = xdlfcn.h; then
3041 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3042 AC_MSG_CHECKING([for dlopen()])
3043 AC_TRY_LINK(,[
3044 extern void* dlopen();
3045 dlopen();
3046 ],
3047 AC_MSG_RESULT(yes);
3048 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3049 AC_MSG_RESULT(no);
3050 AC_MSG_CHECKING([for dlopen() in -ldl])
3051 olibs=$LIBS
3052 LIBS="$LIBS -ldl"
3053 AC_TRY_LINK(,[
3054 extern void* dlopen();
3055 dlopen();
3056 ],
3057 AC_MSG_RESULT(yes);
3058 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3059 AC_MSG_RESULT(no);
3060 LIBS=$olibs))
3061 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3062 dnl ick :-)
3063 AC_MSG_CHECKING([for dlsym()])
3064 AC_TRY_LINK(,[
3065 extern void* dlsym();
3066 dlsym();
3067 ],
3068 AC_MSG_RESULT(yes);
3069 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3070 AC_MSG_RESULT(no);
3071 AC_MSG_CHECKING([for dlsym() in -ldl])
3072 olibs=$LIBS
3073 LIBS="$LIBS -ldl"
3074 AC_TRY_LINK(,[
3075 extern void* dlsym();
3076 dlsym();
3077 ],
3078 AC_MSG_RESULT(yes);
3079 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3080 AC_MSG_RESULT(no);
3081 LIBS=$olibs))
3082elif test x${DLL} = xdl.h; then
3083 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3084 AC_MSG_CHECKING([for shl_load()])
3085 AC_TRY_LINK(,[
3086 extern void* shl_load();
3087 shl_load();
3088 ],
3089 AC_MSG_RESULT(yes);
3090 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3091 AC_MSG_RESULT(no);
3092 AC_MSG_CHECKING([for shl_load() in -ldld])
3093 olibs=$LIBS
3094 LIBS="$LIBS -ldld"
3095 AC_TRY_LINK(,[
3096 extern void* shl_load();
3097 shl_load();
3098 ],
3099 AC_MSG_RESULT(yes);
3100 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3101 AC_MSG_RESULT(no);
3102 LIBS=$olibs))
3103fi
3104AC_CHECK_HEADERS(setjmp.h)
3105
3106if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3107 dnl -ldl must come after DynaLoader.a
3108 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3109 LIBS=`echo $LIBS | sed s/-ldl//`
3110 PERL_LIBS="$PERL_LIBS -ldl"
3111 fi
3112fi
3113
Bram Moolenaar164fca32010-07-14 13:58:07 +02003114if test "x$MACOSX" = "xyes"; then
3115 AC_MSG_CHECKING(whether we need -framework Cocoa)
3116 dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
3117 dnl disabled during tiny build)
3118 if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
3119 LIBS=$"$LIBS -framework Cocoa"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003120 AC_MSG_RESULT(yes)
3121 else
3122 AC_MSG_RESULT(no)
3123 fi
3124fi
Bram Moolenaar164fca32010-07-14 13:58:07 +02003125if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003126 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003127fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003128
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003129dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3130dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3131dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003132dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3133dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003134DEPEND_CFLAGS_FILTER=
3135if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003136 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003137 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003138 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003139 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003140 AC_MSG_RESULT(yes)
3141 else
3142 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003143 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003144 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3145 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003146 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003147 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3148 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003149 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 +00003150 AC_MSG_RESULT(yes)
3151 else
3152 AC_MSG_RESULT(no)
3153 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003154fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003155AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003156
3157dnl write output files
3158AC_OUTPUT(auto/config.mk:config.mk.in)
3159
3160dnl vim: set sw=2 tw=78 fo+=l: