blob: a18c68317b6cd6f749e02c9897f2403ec5c3c52f [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)
104 if test -f os_macosx.c; then
105 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 Moolenaar3a025402008-07-24 15:20:50 +0000171 OS_EXTRA_SRC="os_macosx.c 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"
175 if test "x$MACARCH" = "xboth"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100176 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000177 else
Bram Moolenaar595a7be2010-03-10 16:28:12 +0100178 CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000179 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000180
181 dnl If Carbon is found, assume we don't want X11
182 dnl unless it was specifically asked for (--with-x)
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000183 dnl or Motif, Athena or GTK GUI is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000184 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
185 if test "x$CARBON" = "xyes"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +0200186 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 +0000187 with_x=no
Bram Moolenaar071d4272004-06-13 20:20:40 +0000188 fi
189 fi
190 fi
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000191
Bram Moolenaardb552d602006-03-23 22:59:57 +0000192 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000193 dnl free. This happens in expand_filename(), because the optimizer swaps
Bram Moolenaardb552d602006-03-23 22:59:57 +0000194 dnl two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000195 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
196 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
197 fi
198
Bram Moolenaar071d4272004-06-13 20:20:40 +0000199else
200 AC_MSG_RESULT(no)
201fi
202
203AC_SUBST(OS_EXTRA_SRC)
204AC_SUBST(OS_EXTRA_OBJ)
205
206dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
207dnl Only when the directory exists and it wasn't there yet.
208dnl For gcc don't do this when it is already in the default search path.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000209dnl Skip all of this when cross-compiling.
210if test "$cross_compiling" = no; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000211 AC_MSG_CHECKING(--with-local-dir argument)
Bram Moolenaar446cb832008-06-24 21:56:24 +0000212 have_local_include=''
213 have_local_lib=''
Bram Moolenaarc236c162008-07-13 17:41:49 +0000214 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
215 --without-local-dir do not search /usr/local for local libraries.], [
216 local_dir="$withval"
217 case "$withval" in
218 */*) ;;
219 no)
220 # avoid adding local dir to LDFLAGS and CPPFLAGS
221 have_local_dir=yes
222 have_local_lib=yes
223 ;;
224 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
225 esac
226 AC_MSG_RESULT($local_dir)
227 ], [
228 local_dir=/usr/local
229 AC_MSG_RESULT(Defaulting to $local_dir)
230 ])
231 if test "$GCC" = yes -a "$local_dir" != no; then
Bram Moolenaar446cb832008-06-24 21:56:24 +0000232 echo 'void f(){}' > conftest.c
233 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
Bram Moolenaarc236c162008-07-13 17:41:49 +0000234 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
235 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
Bram Moolenaar446cb832008-06-24 21:56:24 +0000236 rm -f conftest.c conftest.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000237 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000238 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
239 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 +0000240 if test "$tt" = "$LDFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000241 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000242 fi
243 fi
Bram Moolenaarc236c162008-07-13 17:41:49 +0000244 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
245 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 +0000246 if test "$tt" = "$CPPFLAGS"; then
Bram Moolenaarc236c162008-07-13 17:41:49 +0000247 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
Bram Moolenaar446cb832008-06-24 21:56:24 +0000248 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000249 fi
250fi
251
252AC_MSG_CHECKING(--with-vim-name argument)
253AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
254 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000255 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000256AC_SUBST(VIMNAME)
257AC_MSG_CHECKING(--with-ex-name argument)
258AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
259 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
260 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
261AC_SUBST(EXNAME)
262AC_MSG_CHECKING(--with-view-name argument)
263AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
264 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
265 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
266AC_SUBST(VIEWNAME)
267
268AC_MSG_CHECKING(--with-global-runtime argument)
269AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
270 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
271 AC_MSG_RESULT(no))
272
273AC_MSG_CHECKING(--with-modified-by argument)
274AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
275 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
276 AC_MSG_RESULT(no))
277
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200278dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
Bram Moolenaar071d4272004-06-13 20:20:40 +0000279AC_MSG_CHECKING(if character set is EBCDIC)
280AC_TRY_COMPILE([ ],
281[ /* TryCompile function for CharSet.
282 Treat any failure as ASCII for compatibility with existing art.
283 Use compile-time rather than run-time tests for cross-compiler
284 tolerance. */
285#if '0'!=240
286make an error "Character set is not EBCDIC"
287#endif ],
288[ # TryCompile action if true
289cf_cv_ebcdic=yes ],
290[ # TryCompile action if false
291cf_cv_ebcdic=no])
292# end of TryCompile ])
293# end of CacheVal CvEbcdic
294AC_MSG_RESULT($cf_cv_ebcdic)
295case "$cf_cv_ebcdic" in #(vi
296 yes) AC_DEFINE(EBCDIC)
297 line_break='"\\n"'
298 ;;
299 *) line_break='"\\012"';;
300esac
301AC_SUBST(line_break)
302
303if test "$cf_cv_ebcdic" = "yes"; then
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200304dnl If we have EBCDIC we most likley have z/OS Unix, let's test it!
305AC_MSG_CHECKING(for z/OS Unix)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000306case `uname` in
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200307 OS/390) zOSUnix="yes";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000308 dnl If using cc the environment variable _CC_CCMODE must be
309 dnl set to "1", so that some compiler extensions are enabled.
310 dnl If using c89 the environment variable is named _CC_C89MODE.
311 dnl Note: compile with c89 never tested.
312 if test "$CC" = "cc"; then
313 ccm="$_CC_CCMODE"
314 ccn="CC"
315 else
316 if test "$CC" = "c89"; then
317 ccm="$_CC_C89MODE"
318 ccn="C89"
319 else
320 ccm=1
321 fi
322 fi
323 if test "$ccm" != "1"; then
324 echo ""
325 echo "------------------------------------------"
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200326 echo " On z/OS Unix, the environment variable"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000327 echo " __CC_${ccn}MODE must be set to \"1\"!"
328 echo " Do:"
329 echo " export _CC_${ccn}MODE=1"
330 echo " and then call configure again."
331 echo "------------------------------------------"
332 exit 1
333 fi
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200334 CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
335 LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000336 AC_MSG_RESULT(yes)
337 ;;
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200338 *) zOSUnix="no";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000339 AC_MSG_RESULT(no)
340 ;;
341esac
342fi
343
Bram Moolenaar2c704a72010-06-03 21:17:25 +0200344dnl Set QUOTESED. Needs additional backslashes on zOS
345if test "$zOSUnix" = "yes"; then
346 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
347else
348 QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
349fi
350AC_SUBST(QUOTESED)
351
352
Bram Moolenaar588ebeb2008-05-07 17:09:24 +0000353dnl Link with -lselinux for SELinux stuff; if not found
354AC_MSG_CHECKING(--disable-selinux argument)
355AC_ARG_ENABLE(selinux,
356 [ --disable-selinux Don't check for SELinux support.],
357 , enable_selinux="yes")
358if test "$enable_selinux" = "yes"; then
359 AC_MSG_RESULT(no)
360 AC_CHECK_LIB(selinux, is_selinux_enabled,
361 [LIBS="$LIBS -lselinux"
362 AC_DEFINE(HAVE_SELINUX)])
363else
364 AC_MSG_RESULT(yes)
365fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000366
367dnl Check user requested features.
368
369AC_MSG_CHECKING(--with-features argument)
370AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
371 features="$withval"; AC_MSG_RESULT($features),
372 features="normal"; AC_MSG_RESULT(Defaulting to normal))
373
374dovimdiff=""
375dogvimdiff=""
376case "$features" in
377 tiny) AC_DEFINE(FEAT_TINY) ;;
378 small) AC_DEFINE(FEAT_SMALL) ;;
379 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
380 dogvimdiff="installgvimdiff" ;;
381 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
382 dogvimdiff="installgvimdiff" ;;
383 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
384 dogvimdiff="installgvimdiff" ;;
385 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
386esac
387
388AC_SUBST(dovimdiff)
389AC_SUBST(dogvimdiff)
390
391AC_MSG_CHECKING(--with-compiledby argument)
392AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
393 compiledby="$withval"; AC_MSG_RESULT($withval),
394 compiledby=""; AC_MSG_RESULT(no))
395AC_SUBST(compiledby)
396
397AC_MSG_CHECKING(--disable-xsmp argument)
398AC_ARG_ENABLE(xsmp,
399 [ --disable-xsmp Disable XSMP session management],
400 , enable_xsmp="yes")
401
402if test "$enable_xsmp" = "yes"; then
403 AC_MSG_RESULT(no)
404 AC_MSG_CHECKING(--disable-xsmp-interact argument)
405 AC_ARG_ENABLE(xsmp-interact,
406 [ --disable-xsmp-interact Disable XSMP interaction],
407 , enable_xsmp_interact="yes")
408 if test "$enable_xsmp_interact" = "yes"; then
409 AC_MSG_RESULT(no)
410 AC_DEFINE(USE_XSMP_INTERACT)
411 else
412 AC_MSG_RESULT(yes)
413 fi
414else
415 AC_MSG_RESULT(yes)
416fi
417
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000418dnl Check for MzScheme feature.
419AC_MSG_CHECKING(--enable-mzschemeinterp argument)
420AC_ARG_ENABLE(mzschemeinterp,
421 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
422 [enable_mzschemeinterp="no"])
423AC_MSG_RESULT($enable_mzschemeinterp)
424
425if test "$enable_mzschemeinterp" = "yes"; then
426 dnl -- find the mzscheme executable
427 AC_SUBST(vi_cv_path_mzscheme)
428
429 AC_MSG_CHECKING(--with-plthome argument)
430 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000431 [ --with-plthome=PLTHOME Use PLTHOME.],
432 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000433 with_plthome="";AC_MSG_RESULT("no"))
434
435 if test "X$with_plthome" != "X"; then
436 vi_cv_path_mzscheme_pfx="$with_plthome"
437 else
438 AC_MSG_CHECKING(PLTHOME environment var)
439 if test "X$PLTHOME" != "X"; then
440 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000441 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000442 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000443 AC_MSG_RESULT(not set)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000444 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000445 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000446
447 dnl resolve symbolic link, the executable is often elsewhere and there
448 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000449 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000450 lsout=`ls -l $vi_cv_path_mzscheme`
451 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
452 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
453 fi
454 fi
455
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000456 if test "X$vi_cv_path_mzscheme" != "X"; then
457 dnl -- find where MzScheme thinks it was installed
458 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000459 dnl different versions of MzScheme differ in command line processing
460 dnl use universal approach
461 echo "(display (simplify-path \
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000462 (build-path (call-with-values \
463 (lambda () (split-path (find-system-path (quote exec-file)))) \
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000464 (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
465 dnl Remove a trailing slash
466 [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
467 sed -e 's+/$++'` ])
468 rm -f mzdirs.scm
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000469 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000470 fi
471 fi
472
Bram Moolenaard7afed32007-05-06 13:26:41 +0000473 SCHEME_INC=
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000474 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
475 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
476 if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000477 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
478 AC_MSG_RESULT(yes)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000479 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000480 AC_MSG_RESULT(no)
481 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
Bram Moolenaard7afed32007-05-06 13:26:41 +0000482 if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000483 AC_MSG_RESULT(yes)
484 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
Bram Moolenaard7afed32007-05-06 13:26:41 +0000485 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000486 AC_MSG_RESULT(no)
487 AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
488 if test -f /usr/include/plt/scheme.h; then
489 AC_MSG_RESULT(yes)
490 SCHEME_INC=/usr/include/plt
491 else
492 AC_MSG_RESULT(no)
493 vi_cv_path_mzscheme_pfx=
494 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000495 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000496 fi
497 fi
498
499 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000500 if test "x$MACOSX" = "xyes"; then
501 MZSCHEME_LIBS="-framework PLT_MzScheme"
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000502 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
503 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
504 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
Bram Moolenaarf15f9432007-06-28 11:07:21 +0000505 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
Bram Moolenaar9048f942007-05-12 14:32:25 +0000506 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 +0000507 else
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000508 dnl Using shared objects
509 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
510 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
511 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
512 else
513 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
514 fi
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000515 if test "$GCC" = yes; then
516 dnl Make Vim remember the path to the library. For when it's not in
517 dnl $LD_LIBRARY_PATH.
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000518 MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000519 elif test "`(uname) 2>/dev/null`" = SunOS &&
520 uname -r | grep '^5' >/dev/null; then
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000521 MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000522 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000523 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000524 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
525 SCHEME_COLLECTS=lib/plt/
526 fi
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000527 if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
528 dnl need to generate bytecode for MzScheme base
529 MZSCHEME_EXTRA="mzscheme_base.c"
530 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
531 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
532 fi
533 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
Bram Moolenaard7afed32007-05-06 13:26:41 +0000534 -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000535 MZSCHEME_SRC="if_mzsch.c"
536 MZSCHEME_OBJ="objects/if_mzsch.o"
537 MZSCHEME_PRO="if_mzsch.pro"
538 AC_DEFINE(FEAT_MZSCHEME)
539 fi
540 AC_SUBST(MZSCHEME_SRC)
541 AC_SUBST(MZSCHEME_OBJ)
542 AC_SUBST(MZSCHEME_PRO)
543 AC_SUBST(MZSCHEME_LIBS)
544 AC_SUBST(MZSCHEME_CFLAGS)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000545 AC_SUBST(MZSCHEME_EXTRA)
546 AC_SUBST(MZSCHEME_MZC)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000547fi
548
549
Bram Moolenaar071d4272004-06-13 20:20:40 +0000550AC_MSG_CHECKING(--enable-perlinterp argument)
551AC_ARG_ENABLE(perlinterp,
552 [ --enable-perlinterp Include Perl interpreter.], ,
553 [enable_perlinterp="no"])
554AC_MSG_RESULT($enable_perlinterp)
555if test "$enable_perlinterp" = "yes"; then
556 AC_SUBST(vi_cv_path_perl)
557 AC_PATH_PROG(vi_cv_path_perl, perl)
558 if test "X$vi_cv_path_perl" != "X"; then
559 AC_MSG_CHECKING(Perl version)
560 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
561 eval `$vi_cv_path_perl -V:usethreads`
562 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
563 badthreads=no
564 else
565 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
566 eval `$vi_cv_path_perl -V:use5005threads`
567 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
568 badthreads=no
569 else
570 badthreads=yes
571 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
572 fi
573 else
574 badthreads=yes
575 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
576 fi
577 fi
578 if test $badthreads = no; then
579 AC_MSG_RESULT(OK)
580 eval `$vi_cv_path_perl -V:shrpenv`
581 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
582 shrpenv=""
583 fi
584 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
585 AC_SUBST(vi_cv_perllib)
586 dnl Remove "-fno-something", it breaks using cproto.
587 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
588 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
589 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
590 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
591 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
592 -e 's/-bE:perl.exp//' -e 's/-lc //'`
593 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
594 dnl a test in configure may fail because of that.
595 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
596 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
597
598 dnl check that compiling a simple program still works with the flags
599 dnl added for Perl.
600 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
601 cflags_save=$CFLAGS
602 libs_save=$LIBS
603 ldflags_save=$LDFLAGS
604 CFLAGS="$CFLAGS $perlcppflags"
605 LIBS="$LIBS $perllibs"
606 LDFLAGS="$perlldflags $LDFLAGS"
607 AC_TRY_LINK(,[ ],
608 AC_MSG_RESULT(yes); perl_ok=yes,
609 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
610 CFLAGS=$cflags_save
611 LIBS=$libs_save
612 LDFLAGS=$ldflags_save
613 if test $perl_ok = yes; then
614 if test "X$perlcppflags" != "X"; then
Bram Moolenaard7afed32007-05-06 13:26:41 +0000615 dnl remove -pipe and -Wxxx, it confuses cproto
616 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000617 fi
618 if test "X$perlldflags" != "X"; then
619 LDFLAGS="$perlldflags $LDFLAGS"
620 fi
621 PERL_LIBS=$perllibs
622 PERL_SRC="auto/if_perl.c if_perlsfio.c"
623 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
624 PERL_PRO="if_perl.pro if_perlsfio.pro"
625 AC_DEFINE(FEAT_PERL)
626 fi
627 fi
628 else
629 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
630 fi
631 fi
632
633 if test "x$MACOSX" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +0000634 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000635 dir=/System/Library/Perl
636 darwindir=$dir/darwin
637 if test -d $darwindir; then
638 PERL=/usr/bin/perl
639 else
640 dnl Mac OS X 10.3
641 dir=/System/Library/Perl/5.8.1
642 darwindir=$dir/darwin-thread-multi-2level
643 if test -d $darwindir; then
644 PERL=/usr/bin/perl
645 fi
646 fi
647 if test -n "$PERL"; then
648 PERL_DIR="$dir"
649 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
650 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
651 PERL_LIBS="-L$darwindir/CORE -lperl"
652 fi
653 fi
654fi
655AC_SUBST(shrpenv)
656AC_SUBST(PERL_SRC)
657AC_SUBST(PERL_OBJ)
658AC_SUBST(PERL_PRO)
659AC_SUBST(PERL_CFLAGS)
660AC_SUBST(PERL_LIBS)
661
662AC_MSG_CHECKING(--enable-pythoninterp argument)
663AC_ARG_ENABLE(pythoninterp,
664 [ --enable-pythoninterp Include Python interpreter.], ,
665 [enable_pythoninterp="no"])
666AC_MSG_RESULT($enable_pythoninterp)
667if test "$enable_pythoninterp" = "yes"; then
668 dnl -- find the python executable
669 AC_PATH_PROG(vi_cv_path_python, python)
670 if test "X$vi_cv_path_python" != "X"; then
671
672 dnl -- get its version number
673 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
674 [[vi_cv_var_python_version=`
675 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
676 ]])
677
678 dnl -- it must be at least version 1.4
679 AC_MSG_CHECKING(Python is 1.4 or better)
680 if ${vi_cv_path_python} -c \
681 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
682 then
683 AC_MSG_RESULT(yep)
684
685 dnl -- find where python thinks it was installed
686 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
687 [ vi_cv_path_python_pfx=`
688 ${vi_cv_path_python} -c \
689 "import sys; print sys.prefix"` ])
690
691 dnl -- and where it thinks it runs
692 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
693 [ vi_cv_path_python_epfx=`
694 ${vi_cv_path_python} -c \
695 "import sys; print sys.exec_prefix"` ])
696
697 dnl -- python's internal library path
698
699 AC_CACHE_VAL(vi_cv_path_pythonpath,
700 [ vi_cv_path_pythonpath=`
701 unset PYTHONPATH;
702 ${vi_cv_path_python} -c \
703 "import sys, string; print string.join(sys.path,':')"` ])
704
705 dnl -- where the Python implementation library archives are
706
707 AC_ARG_WITH(python-config-dir,
708 [ --with-python-config-dir=PATH Python's config directory],
709 [ vi_cv_path_python_conf="${withval}" ] )
710
711 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
712 [
713 vi_cv_path_python_conf=
714 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
Bram Moolenaar72951072009-12-02 16:58:33 +0000715 for subdir in lib64 lib share; do
Bram Moolenaar071d4272004-06-13 20:20:40 +0000716 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
717 if test -d "$d" && test -f "$d/config.c"; then
718 vi_cv_path_python_conf="$d"
719 fi
720 done
721 done
722 ])
723
724 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
725
726 if test "X$PYTHON_CONFDIR" = "X"; then
727 AC_MSG_RESULT([can't find it!])
728 else
729
730 dnl -- we need to examine Python's config/Makefile too
731 dnl see what the interpreter is built from
732 AC_CACHE_VAL(vi_cv_path_python_plibs,
733 [
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000734 pwd=`pwd`
735 tmp_mkf="$pwd/config-PyMake$$"
736 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000737__:
Bram Moolenaar218116c2010-05-20 21:46:00 +0200738 @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000739 @echo "python_LIBS='$(LIBS)'"
740 @echo "python_SYSLIBS='$(SYSLIBS)'"
741 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
742eof
743 dnl -- delete the lines from make about Entering/Leaving directory
Bram Moolenaar01dd60c2008-07-24 14:24:48 +0000744 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
745 rm -f -- "${tmp_mkf}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000746 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
747 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
748 vi_cv_path_python_plibs="-framework Python"
749 else
750 if test "${vi_cv_var_python_version}" = "1.4"; then
751 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
752 else
753 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
754 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +0200755 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 +0000756 dnl remove -ltermcap, it can conflict with an earlier -lncurses
757 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
758 fi
759 ])
760
761 PYTHON_LIBS="${vi_cv_path_python_plibs}"
762 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
763 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
764 else
765 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}"
766 fi
Bram Moolenaar218116c2010-05-20 21:46:00 +0200767 PYTHON_NOPROTO=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000768 PYTHON_SRC="if_python.c"
769 dnl For Mac OSX 10.2 config.o is included in the Python library.
770 if test "x$MACOSX" = "xyes"; then
771 PYTHON_OBJ="objects/if_python.o"
772 else
773 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
774 fi
775 if test "${vi_cv_var_python_version}" = "1.4"; then
776 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
777 fi
778 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
779
780 dnl On FreeBSD linking with "-pthread" is required to use threads.
781 dnl _THREAD_SAFE must be used for compiling then.
782 dnl The "-pthread" is added to $LIBS, so that the following check for
783 dnl sigaltstack() will look in libc_r (it's there in libc!).
784 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
785 dnl will then define target-specific defines, e.g., -D_REENTRANT.
786 dnl Don't do this for Mac OSX, -pthread will generate a warning.
Bram Moolenaar218116c2010-05-20 21:46:00 +0200787 dnl Need to put -pthread in PYTHON_NOPROTO, because it cannot be used
788 dnl for cproto.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000789 AC_MSG_CHECKING([if -pthread should be used])
790 threadsafe_flag=
791 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000792 dnl if test "x$MACOSX" != "xyes"; then
793 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000794 test "$GCC" = yes && threadsafe_flag="-pthread"
795 if test "`(uname) 2>/dev/null`" = FreeBSD; then
796 threadsafe_flag="-D_THREAD_SAFE"
797 thread_lib="-pthread"
798 fi
799 fi
800 libs_save_old=$LIBS
801 if test -n "$threadsafe_flag"; then
802 cflags_save=$CFLAGS
803 CFLAGS="$CFLAGS $threadsafe_flag"
804 LIBS="$LIBS $thread_lib"
805 AC_TRY_LINK(,[ ],
Bram Moolenaar218116c2010-05-20 21:46:00 +0200806 AC_MSG_RESULT(yes); PYTHON_NOPROTO="$threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000807 AC_MSG_RESULT(no); LIBS=$libs_save_old
808 )
809 CFLAGS=$cflags_save
810 else
811 AC_MSG_RESULT(no)
812 fi
813
814 dnl check that compiling a simple program still works with the flags
815 dnl added for Python.
816 AC_MSG_CHECKING([if compile and link flags for Python are sane])
817 cflags_save=$CFLAGS
818 libs_save=$LIBS
Bram Moolenaar218116c2010-05-20 21:46:00 +0200819 CFLAGS="$CFLAGS $PYTHON_CFLAGS $PYTHON_NOPROTO"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000820 LIBS="$LIBS $PYTHON_LIBS"
821 AC_TRY_LINK(,[ ],
822 AC_MSG_RESULT(yes); python_ok=yes,
823 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
824 CFLAGS=$cflags_save
825 LIBS=$libs_save
826 if test $python_ok = yes; then
827 AC_DEFINE(FEAT_PYTHON)
828 else
829 LIBS=$libs_save_old
830 PYTHON_SRC=
831 PYTHON_OBJ=
832 PYTHON_LIBS=
833 PYTHON_CFLAGS=
Bram Moolenaar218116c2010-05-20 21:46:00 +0200834 PYTHON_NOPROTO=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000835 fi
836
837 fi
838 else
839 AC_MSG_RESULT(too old)
840 fi
841 fi
842fi
843AC_SUBST(PYTHON_CONFDIR)
844AC_SUBST(PYTHON_LIBS)
845AC_SUBST(PYTHON_GETPATH_CFLAGS)
846AC_SUBST(PYTHON_CFLAGS)
Bram Moolenaar218116c2010-05-20 21:46:00 +0200847AC_SUBST(PYTHON_NOPROTO)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000848AC_SUBST(PYTHON_SRC)
849AC_SUBST(PYTHON_OBJ)
850
851AC_MSG_CHECKING(--enable-tclinterp argument)
852AC_ARG_ENABLE(tclinterp,
853 [ --enable-tclinterp Include Tcl interpreter.], ,
854 [enable_tclinterp="no"])
855AC_MSG_RESULT($enable_tclinterp)
856
857if test "$enable_tclinterp" = "yes"; then
858
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000859 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +0000860 AC_MSG_CHECKING(--with-tclsh argument)
861 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
862 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000863 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000864 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
865 AC_SUBST(vi_cv_path_tcl)
866
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000867 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
868 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
869 tclsh_name="tclsh8.4"
870 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
871 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000872 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000873 tclsh_name="tclsh8.2"
874 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
875 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000876 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
877 tclsh_name="tclsh8.0"
878 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
879 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000880 dnl still didn't find it, try without version number
881 if test "X$vi_cv_path_tcl" = "X"; then
882 tclsh_name="tclsh"
883 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
884 fi
885 if test "X$vi_cv_path_tcl" != "X"; then
886 AC_MSG_CHECKING(Tcl version)
887 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
888 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
889 AC_MSG_RESULT($tclver - OK);
890 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 -`
891
892 AC_MSG_CHECKING(for location of Tcl include)
893 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +0000894 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 +0000895 else
896 dnl For Mac OS X 10.3, use the OS-provided framework location
897 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
898 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +0000899 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000900 for try in $tclinc; do
901 if test -f "$try/tcl.h"; then
902 AC_MSG_RESULT($try/tcl.h)
903 TCL_INC=$try
904 break
905 fi
906 done
907 if test -z "$TCL_INC"; then
908 AC_MSG_RESULT(<not found>)
909 SKIP_TCL=YES
910 fi
911 if test -z "$SKIP_TCL"; then
912 AC_MSG_CHECKING(for location of tclConfig.sh script)
913 if test "x$MACOSX" != "xyes"; then
914 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000915 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000916 else
917 dnl For Mac OS X 10.3, use the OS-provided framework location
918 tclcnf="/System/Library/Frameworks/Tcl.framework"
919 fi
920 for try in $tclcnf; do
921 if test -f $try/tclConfig.sh; then
922 AC_MSG_RESULT($try/tclConfig.sh)
923 . $try/tclConfig.sh
924 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
925 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
926 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000927 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +0000928 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 +0000929 break
930 fi
931 done
932 if test -z "$TCL_LIBS"; then
933 AC_MSG_RESULT(<not found>)
934 AC_MSG_CHECKING(for Tcl library by myself)
935 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000936 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000937 for ext in .so .a ; do
938 for ver in "" $tclver ; do
939 for try in $tcllib ; do
940 trylib=tcl$ver$ext
941 if test -f $try/lib$trylib ; then
942 AC_MSG_RESULT($try/lib$trylib)
943 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
944 if test "`(uname) 2>/dev/null`" = SunOS &&
945 uname -r | grep '^5' >/dev/null; then
946 TCL_LIBS="$TCL_LIBS -R $try"
947 fi
948 break 3
949 fi
950 done
951 done
952 done
953 if test -z "$TCL_LIBS"; then
954 AC_MSG_RESULT(<not found>)
955 SKIP_TCL=YES
956 fi
957 fi
958 if test -z "$SKIP_TCL"; then
959 AC_DEFINE(FEAT_TCL)
960 TCL_SRC=if_tcl.c
961 TCL_OBJ=objects/if_tcl.o
962 TCL_PRO=if_tcl.pro
963 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
964 fi
965 fi
966 else
967 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
968 fi
969 fi
970fi
971AC_SUBST(TCL_SRC)
972AC_SUBST(TCL_OBJ)
973AC_SUBST(TCL_PRO)
974AC_SUBST(TCL_CFLAGS)
975AC_SUBST(TCL_LIBS)
976
977AC_MSG_CHECKING(--enable-rubyinterp argument)
978AC_ARG_ENABLE(rubyinterp,
979 [ --enable-rubyinterp Include Ruby interpreter.], ,
980 [enable_rubyinterp="no"])
981AC_MSG_RESULT($enable_rubyinterp)
982if test "$enable_rubyinterp" = "yes"; then
Bram Moolenaar165641d2010-02-17 16:23:09 +0100983 AC_MSG_CHECKING(--with-ruby-command argument)
984 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
985 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
986 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000987 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar165641d2010-02-17 16:23:09 +0100988 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000989 if test "X$vi_cv_path_ruby" != "X"; then
990 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +0000991 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 +0000992 AC_MSG_RESULT(OK)
993 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar165641d2010-02-17 16:23:09 +0100994 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 +0000995 if test "X$rubyhdrdir" != "X"; then
996 AC_MSG_RESULT($rubyhdrdir)
997 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +0100998 rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
999 if test -d "$rubyhdrdir/$rubyarch"; then
1000 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
1001 fi
1002 rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
1003 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001004 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
1005 if test "X$rubylibs" != "X"; then
1006 RUBY_LIBS="$rubylibs"
1007 fi
1008 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
1009 if test -f "$rubyhdrdir/$librubyarg"; then
1010 librubyarg="$rubyhdrdir/$librubyarg"
1011 else
1012 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
1013 if test -f "$rubylibdir/$librubyarg"; then
1014 librubyarg="$rubylibdir/$librubyarg"
1015 elif test "$librubyarg" = "libruby.a"; then
1016 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1017 librubyarg="-lruby"
1018 else
1019 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
1020 fi
1021 fi
1022
1023 if test "X$librubyarg" != "X"; then
1024 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1025 fi
1026 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
1027 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001028 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1029 dnl be included if requested by passing --with-mac-arch to
1030 dnl configure, so strip these flags first (if present)
1031 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//'`
1032 if test "X$rubyldflags" != "X"; then
1033 LDFLAGS="$rubyldflags $LDFLAGS"
1034 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001035 fi
1036 RUBY_SRC="if_ruby.c"
1037 RUBY_OBJ="objects/if_ruby.o"
1038 RUBY_PRO="if_ruby.pro"
1039 AC_DEFINE(FEAT_RUBY)
1040 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001041 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001042 fi
1043 else
1044 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1045 fi
1046 fi
1047fi
1048AC_SUBST(RUBY_SRC)
1049AC_SUBST(RUBY_OBJ)
1050AC_SUBST(RUBY_PRO)
1051AC_SUBST(RUBY_CFLAGS)
1052AC_SUBST(RUBY_LIBS)
1053
1054AC_MSG_CHECKING(--enable-cscope argument)
1055AC_ARG_ENABLE(cscope,
1056 [ --enable-cscope Include cscope interface.], ,
1057 [enable_cscope="no"])
1058AC_MSG_RESULT($enable_cscope)
1059if test "$enable_cscope" = "yes"; then
1060 AC_DEFINE(FEAT_CSCOPE)
1061fi
1062
1063AC_MSG_CHECKING(--enable-workshop argument)
1064AC_ARG_ENABLE(workshop,
1065 [ --enable-workshop Include Sun Visual Workshop support.], ,
1066 [enable_workshop="no"])
1067AC_MSG_RESULT($enable_workshop)
1068if test "$enable_workshop" = "yes"; then
1069 AC_DEFINE(FEAT_SUN_WORKSHOP)
1070 WORKSHOP_SRC="workshop.c integration.c"
1071 AC_SUBST(WORKSHOP_SRC)
1072 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1073 AC_SUBST(WORKSHOP_OBJ)
1074 if test "${enable_gui-xxx}" = xxx; then
1075 enable_gui=motif
1076 fi
1077fi
1078
1079AC_MSG_CHECKING(--disable-netbeans argument)
1080AC_ARG_ENABLE(netbeans,
1081 [ --disable-netbeans Disable NetBeans integration support.],
1082 , [enable_netbeans="yes"])
1083if test "$enable_netbeans" = "yes"; then
1084 AC_MSG_RESULT(no)
1085 dnl On Solaris we need the socket and nsl library.
1086 AC_CHECK_LIB(socket, socket)
1087 AC_CHECK_LIB(nsl, gethostbyname)
1088 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1089 AC_TRY_LINK([
1090#include <stdio.h>
1091#include <stdlib.h>
1092#include <stdarg.h>
1093#include <fcntl.h>
1094#include <netdb.h>
1095#include <netinet/in.h>
1096#include <errno.h>
1097#include <sys/types.h>
1098#include <sys/socket.h>
1099 /* Check bitfields */
1100 struct nbbuf {
1101 unsigned int initDone:1;
1102 ushort signmaplen;
1103 };
1104 ], [
1105 /* Check creating a socket. */
1106 struct sockaddr_in server;
1107 (void)socket(AF_INET, SOCK_STREAM, 0);
1108 (void)htons(100);
1109 (void)gethostbyname("microsoft.com");
1110 if (errno == ECONNREFUSED)
1111 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1112 ],
1113 AC_MSG_RESULT(yes),
1114 AC_MSG_RESULT(no); enable_netbeans="no")
1115else
1116 AC_MSG_RESULT(yes)
1117fi
1118if test "$enable_netbeans" = "yes"; then
1119 AC_DEFINE(FEAT_NETBEANS_INTG)
1120 NETBEANS_SRC="netbeans.c"
1121 AC_SUBST(NETBEANS_SRC)
1122 NETBEANS_OBJ="objects/netbeans.o"
1123 AC_SUBST(NETBEANS_OBJ)
1124fi
1125
1126AC_MSG_CHECKING(--enable-sniff argument)
1127AC_ARG_ENABLE(sniff,
1128 [ --enable-sniff Include Sniff interface.], ,
1129 [enable_sniff="no"])
1130AC_MSG_RESULT($enable_sniff)
1131if test "$enable_sniff" = "yes"; then
1132 AC_DEFINE(FEAT_SNIFF)
1133 SNIFF_SRC="if_sniff.c"
1134 AC_SUBST(SNIFF_SRC)
1135 SNIFF_OBJ="objects/if_sniff.o"
1136 AC_SUBST(SNIFF_OBJ)
1137fi
1138
1139AC_MSG_CHECKING(--enable-multibyte argument)
1140AC_ARG_ENABLE(multibyte,
1141 [ --enable-multibyte Include multibyte editing support.], ,
1142 [enable_multibyte="no"])
1143AC_MSG_RESULT($enable_multibyte)
1144if test "$enable_multibyte" = "yes"; then
1145 AC_DEFINE(FEAT_MBYTE)
1146fi
1147
1148AC_MSG_CHECKING(--enable-hangulinput argument)
1149AC_ARG_ENABLE(hangulinput,
1150 [ --enable-hangulinput Include Hangul input support.], ,
1151 [enable_hangulinput="no"])
1152AC_MSG_RESULT($enable_hangulinput)
1153
1154AC_MSG_CHECKING(--enable-xim argument)
1155AC_ARG_ENABLE(xim,
1156 [ --enable-xim Include XIM input support.],
1157 AC_MSG_RESULT($enable_xim),
1158 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001159
1160AC_MSG_CHECKING(--enable-fontset argument)
1161AC_ARG_ENABLE(fontset,
1162 [ --enable-fontset Include X fontset output support.], ,
1163 [enable_fontset="no"])
1164AC_MSG_RESULT($enable_fontset)
1165dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1166
1167test -z "$with_x" && with_x=yes
1168test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1169if test "$with_x" = no; then
1170 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1171else
1172 dnl Do this check early, so that its failure can override user requests.
1173
1174 AC_PATH_PROG(xmkmfpath, xmkmf)
1175
1176 AC_PATH_XTRA
1177
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001178 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001179 dnl be compiled with a special option.
1180 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001181 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001182 CFLAGS="$CFLAGS -W c,dll"
1183 LDFLAGS="$LDFLAGS -W l,dll"
1184 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1185 fi
1186
1187 dnl On my HPUX system the X include dir is found, but the lib dir not.
1188 dnl This is a desparate try to fix this.
1189
1190 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1191 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1192 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1193 X_LIBS="$X_LIBS -L$x_libraries"
1194 if test "`(uname) 2>/dev/null`" = SunOS &&
1195 uname -r | grep '^5' >/dev/null; then
1196 X_LIBS="$X_LIBS -R $x_libraries"
1197 fi
1198 fi
1199
1200 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1201 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1202 AC_MSG_RESULT(Corrected X includes to $x_includes)
1203 X_CFLAGS="$X_CFLAGS -I$x_includes"
1204 fi
1205
1206 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1207 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1208 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1209 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1210 dnl Same for "-R/usr/lib ".
1211 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1212
1213
1214 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001215 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1216 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001217 AC_MSG_CHECKING(if X11 header files can be found)
1218 cflags_save=$CFLAGS
1219 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001220 AC_TRY_COMPILE([#include <X11/Xlib.h>
1221#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001222 AC_MSG_RESULT(yes),
1223 AC_MSG_RESULT(no); no_x=yes)
1224 CFLAGS=$cflags_save
1225
1226 if test "${no_x-no}" = yes; then
1227 with_x=no
1228 else
1229 AC_DEFINE(HAVE_X11)
1230 X_LIB="-lXt -lX11";
1231 AC_SUBST(X_LIB)
1232
1233 ac_save_LDFLAGS="$LDFLAGS"
1234 LDFLAGS="-L$x_libraries $LDFLAGS"
1235
1236 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1237 dnl For HP-UX 10.20 it must be before -lSM -lICE
1238 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1239 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1240
1241 dnl Some systems need -lnsl -lsocket when testing for ICE.
1242 dnl The check above doesn't do this, try here (again). Also needed to get
1243 dnl them after Xdmcp. link.sh will remove them when not needed.
1244 dnl Check for other function than above to avoid the cached value
1245 AC_CHECK_LIB(ICE, IceOpenConnection,
1246 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1247
1248 dnl Check for -lXpm (needed for some versions of Motif)
1249 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1250 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1251 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1252
1253 dnl Check that the X11 header files don't use implicit declarations
1254 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1255 cflags_save=$CFLAGS
1256 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1257 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1258 AC_MSG_RESULT(no),
1259 CFLAGS="$CFLAGS -Wno-implicit-int"
1260 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1261 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1262 AC_MSG_RESULT(test failed)
1263 )
1264 )
1265 CFLAGS=$cflags_save
1266
1267 LDFLAGS="$ac_save_LDFLAGS"
1268
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001269 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1270 AC_CACHE_VAL(ac_cv_small_wchar_t,
1271 [AC_TRY_RUN([
1272#include <X11/Xlib.h>
1273#if STDC_HEADERS
1274# include <stdlib.h>
1275# include <stddef.h>
1276#endif
1277 main()
1278 {
1279 if (sizeof(wchar_t) <= 2)
1280 exit(1);
1281 exit(0);
1282 }],
1283 ac_cv_small_wchar_t="no",
1284 ac_cv_small_wchar_t="yes",
1285 AC_MSG_ERROR(failed to compile test program))])
1286 AC_MSG_RESULT($ac_cv_small_wchar_t)
1287 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1288 AC_DEFINE(SMALL_WCHAR_T)
1289 fi
1290
Bram Moolenaar071d4272004-06-13 20:20:40 +00001291 fi
1292fi
1293
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001294test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001295
1296AC_MSG_CHECKING(--enable-gui argument)
1297AC_ARG_ENABLE(gui,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001298 [ --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 +00001299
1300dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1301dnl Do not use character classes for portability with old tools.
1302enable_gui_canon=`echo "_$enable_gui" | \
1303 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1304
1305dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001306SKIP_GTK2=YES
1307SKIP_GNOME=YES
1308SKIP_MOTIF=YES
1309SKIP_ATHENA=YES
1310SKIP_NEXTAW=YES
1311SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001312SKIP_CARBON=YES
1313GUITYPE=NONE
1314
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001315if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001316 SKIP_PHOTON=
1317 case "$enable_gui_canon" in
1318 no) AC_MSG_RESULT(no GUI support)
1319 SKIP_PHOTON=YES ;;
1320 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1321 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1322 photon) AC_MSG_RESULT(Photon GUI support) ;;
1323 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1324 SKIP_PHOTON=YES ;;
1325 esac
1326
1327elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1328 SKIP_CARBON=
1329 case "$enable_gui_canon" in
1330 no) AC_MSG_RESULT(no GUI support)
1331 SKIP_CARBON=YES ;;
1332 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1333 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1334 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1335 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1336 SKIP_CARBON=YES ;;
1337 esac
1338
1339else
1340
Bram Moolenaar071d4272004-06-13 20:20:40 +00001341 case "$enable_gui_canon" in
1342 no|none) AC_MSG_RESULT(no GUI support) ;;
1343 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001344 SKIP_GTK2=
1345 SKIP_GNOME=
1346 SKIP_MOTIF=
1347 SKIP_ATHENA=
1348 SKIP_NEXTAW=
1349 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001350 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001351 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001352 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1353 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001354 SKIP_GTK2=;;
1355 motif) AC_MSG_RESULT(Motif GUI support)
1356 SKIP_MOTIF=;;
1357 athena) AC_MSG_RESULT(Athena GUI support)
1358 SKIP_ATHENA=;;
1359 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1360 SKIP_NEXTAW=;;
1361 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1362 esac
1363
1364fi
1365
Bram Moolenaar071d4272004-06-13 20:20:40 +00001366if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1367 -a "$enable_gui_canon" != "gnome2"; then
1368 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1369 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001370 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001371 , enable_gtk2_check="yes")
1372 AC_MSG_RESULT($enable_gtk2_check)
1373 if test "x$enable_gtk2_check" = "xno"; then
1374 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001375 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001376 fi
1377fi
1378
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001379if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001380 AC_MSG_CHECKING(whether or not to look for GNOME)
1381 AC_ARG_ENABLE(gnome-check,
1382 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1383 , enable_gnome_check="no")
1384 AC_MSG_RESULT($enable_gnome_check)
1385 if test "x$enable_gnome_check" = "xno"; then
1386 SKIP_GNOME=YES
1387 fi
1388fi
1389
1390if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1391 AC_MSG_CHECKING(whether or not to look for Motif)
1392 AC_ARG_ENABLE(motif-check,
1393 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1394 , enable_motif_check="yes")
1395 AC_MSG_RESULT($enable_motif_check)
1396 if test "x$enable_motif_check" = "xno"; then
1397 SKIP_MOTIF=YES
1398 fi
1399fi
1400
1401if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1402 AC_MSG_CHECKING(whether or not to look for Athena)
1403 AC_ARG_ENABLE(athena-check,
1404 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1405 , enable_athena_check="yes")
1406 AC_MSG_RESULT($enable_athena_check)
1407 if test "x$enable_athena_check" = "xno"; then
1408 SKIP_ATHENA=YES
1409 fi
1410fi
1411
1412if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1413 AC_MSG_CHECKING(whether or not to look for neXtaw)
1414 AC_ARG_ENABLE(nextaw-check,
1415 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1416 , enable_nextaw_check="yes")
1417 AC_MSG_RESULT($enable_nextaw_check);
1418 if test "x$enable_nextaw_check" = "xno"; then
1419 SKIP_NEXTAW=YES
1420 fi
1421fi
1422
1423if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1424 AC_MSG_CHECKING(whether or not to look for Carbon)
1425 AC_ARG_ENABLE(carbon-check,
1426 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1427 , enable_carbon_check="yes")
1428 AC_MSG_RESULT($enable_carbon_check);
1429 if test "x$enable_carbon_check" = "xno"; then
1430 SKIP_CARBON=YES
1431 fi
1432fi
1433
Bram Moolenaar843ee412004-06-30 16:16:41 +00001434
Bram Moolenaar071d4272004-06-13 20:20:40 +00001435if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1436 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001437 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001438 AC_MSG_RESULT(yes);
1439 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001440 if test "$VIMNAME" = "vim"; then
1441 VIMNAME=Vim
1442 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001443
1444 dnl Default install directory is not /usr/local
1445 if test x$prefix = xNONE; then
1446 prefix=/Applications
1447 fi
1448
1449 dnl Sorry for the hard coded default
1450 datadir='${prefix}/Vim.app/Contents/Resources'
1451
Bram Moolenaar071d4272004-06-13 20:20:40 +00001452 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001453 SKIP_GTK2=YES;
1454 SKIP_GNOME=YES;
1455 SKIP_MOTIF=YES;
1456 SKIP_ATHENA=YES;
1457 SKIP_NEXTAW=YES;
1458 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001459 SKIP_CARBON=YES
1460fi
1461
Bram Moolenaar071d4272004-06-13 20:20:40 +00001462dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001463dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001464dnl
1465dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001466dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001467dnl
1468AC_DEFUN(AM_PATH_GTK,
1469[
1470 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1471 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001472 min_gtk_version=ifelse([$1], ,2.2.0,$1)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001473 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1474 no_gtk=""
1475 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1476 && $PKG_CONFIG --exists gtk+-2.0; then
1477 {
1478 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1479 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1480 dnl something like that.
1481 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001482 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001483 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1484 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1485 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1486 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1487 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1488 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1489 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1490 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001491 else
1492 no_gtk=yes
1493 fi
1494
1495 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1496 {
1497 ac_save_CFLAGS="$CFLAGS"
1498 ac_save_LIBS="$LIBS"
1499 CFLAGS="$CFLAGS $GTK_CFLAGS"
1500 LIBS="$LIBS $GTK_LIBS"
1501
1502 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001503 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001504 dnl
1505 rm -f conf.gtktest
1506 AC_TRY_RUN([
1507#include <gtk/gtk.h>
1508#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001509#if STDC_HEADERS
1510# include <stdlib.h>
1511# include <stddef.h>
1512#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001513
1514int
1515main ()
1516{
1517int major, minor, micro;
1518char *tmp_version;
1519
1520system ("touch conf.gtktest");
1521
1522/* HP/UX 9 (%@#!) writes to sscanf strings */
1523tmp_version = g_strdup("$min_gtk_version");
1524if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1525 printf("%s, bad version string\n", "$min_gtk_version");
1526 exit(1);
1527 }
1528
1529if ((gtk_major_version > major) ||
1530 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1531 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1532 (gtk_micro_version >= micro)))
1533{
1534 return 0;
1535}
1536return 1;
1537}
1538],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1539 CFLAGS="$ac_save_CFLAGS"
1540 LIBS="$ac_save_LIBS"
1541 }
1542 fi
1543 if test "x$no_gtk" = x ; then
1544 if test "x$enable_gtktest" = "xyes"; then
1545 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1546 else
1547 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1548 fi
1549 ifelse([$2], , :, [$2])
1550 else
1551 {
1552 AC_MSG_RESULT(no)
1553 GTK_CFLAGS=""
1554 GTK_LIBS=""
1555 ifelse([$3], , :, [$3])
1556 }
1557 fi
1558 }
1559 else
1560 GTK_CFLAGS=""
1561 GTK_LIBS=""
1562 ifelse([$3], , :, [$3])
1563 fi
1564 AC_SUBST(GTK_CFLAGS)
1565 AC_SUBST(GTK_LIBS)
1566 rm -f conf.gtktest
1567])
1568
1569dnl ---------------------------------------------------------------------------
1570dnl gnome
1571dnl ---------------------------------------------------------------------------
1572AC_DEFUN([GNOME_INIT_HOOK],
1573[
1574 AC_SUBST(GNOME_LIBS)
1575 AC_SUBST(GNOME_LIBDIR)
1576 AC_SUBST(GNOME_INCLUDEDIR)
1577
1578 AC_ARG_WITH(gnome-includes,
1579 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1580 [CFLAGS="$CFLAGS -I$withval"]
1581 )
1582
1583 AC_ARG_WITH(gnome-libs,
1584 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1585 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1586 )
1587
1588 AC_ARG_WITH(gnome,
1589 [ --with-gnome Specify prefix for GNOME files],
1590 if test x$withval = xyes; then
1591 want_gnome=yes
1592 ifelse([$1], [], :, [$1])
1593 else
1594 if test "x$withval" = xno; then
1595 want_gnome=no
1596 else
1597 want_gnome=yes
1598 LDFLAGS="$LDFLAGS -L$withval/lib"
1599 CFLAGS="$CFLAGS -I$withval/include"
1600 gnome_prefix=$withval/lib
1601 fi
1602 fi,
1603 want_gnome=yes)
1604
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001605 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001606 {
1607 AC_MSG_CHECKING(for libgnomeui-2.0)
1608 if $PKG_CONFIG --exists libgnomeui-2.0; then
1609 AC_MSG_RESULT(yes)
1610 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1611 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1612 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001613
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001614 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1615 dnl This might not be the right way but it works for me...
1616 AC_MSG_CHECKING(for FreeBSD)
1617 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1618 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001619 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001620 GNOME_LIBS="$GNOME_LIBS -pthread"
1621 else
1622 AC_MSG_RESULT(no)
1623 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001624 $1
1625 else
1626 AC_MSG_RESULT(not found)
1627 if test "x$2" = xfail; then
1628 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1629 fi
1630 fi
1631 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001632 fi
1633])
1634
1635AC_DEFUN([GNOME_INIT],[
1636 GNOME_INIT_HOOK([],fail)
1637])
1638
1639
1640dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001641dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001642dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001643if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001644
1645 AC_MSG_CHECKING(--disable-gtktest argument)
1646 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1647 , enable_gtktest=yes)
1648 if test "x$enable_gtktest" = "xyes" ; then
1649 AC_MSG_RESULT(gtk test enabled)
1650 else
1651 AC_MSG_RESULT(gtk test disabled)
1652 fi
1653
Bram Moolenaar071d4272004-06-13 20:20:40 +00001654 if test "X$PKG_CONFIG" = "X"; then
1655 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1656 fi
1657
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001658 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001659 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1660 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001661 AM_PATH_GTK(2.2.0,
1662 [GUI_LIB_LOC="$GTK_LIBDIR"
1663 GTK_LIBNAME="$GTK_LIBS"
1664 GUI_INC_LOC="$GTK_CFLAGS"], )
1665 if test "x$GTK_CFLAGS" != "x"; then
1666 SKIP_ATHENA=YES
1667 SKIP_NEXTAW=YES
1668 SKIP_MOTIF=YES
1669 GUITYPE=GTK
1670 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001671 fi
1672 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001673 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001674 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1675 || test "0$gtk_minor_version" -ge 2; then
1676 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1677 fi
1678 dnl
1679 dnl if GTK exists, then check for GNOME.
1680 dnl
1681 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001682 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001683 GNOME_INIT_HOOK([have_gnome=yes])
1684 if test "x$have_gnome" = xyes ; then
1685 AC_DEFINE(FEAT_GUI_GNOME)
1686 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1687 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001688 fi
1689 }
1690 fi
1691 fi
1692fi
1693
1694dnl Check for Motif include files location.
1695dnl The LAST one found is used, this makes the highest version to be used,
1696dnl e.g. when Motif1.2 and Motif2.0 are both present.
1697
1698if test -z "$SKIP_MOTIF"; then
1699 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"
1700 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1701 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1702
1703 AC_MSG_CHECKING(for location of Motif GUI includes)
1704 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1705 GUI_INC_LOC=
1706 for try in $gui_includes; do
1707 if test -f "$try/Xm/Xm.h"; then
1708 GUI_INC_LOC=$try
1709 fi
1710 done
1711 if test -n "$GUI_INC_LOC"; then
1712 if test "$GUI_INC_LOC" = /usr/include; then
1713 GUI_INC_LOC=
1714 AC_MSG_RESULT(in default path)
1715 else
1716 AC_MSG_RESULT($GUI_INC_LOC)
1717 fi
1718 else
1719 AC_MSG_RESULT(<not found>)
1720 SKIP_MOTIF=YES
1721 fi
1722fi
1723
1724dnl Check for Motif library files location. In the same order as the include
1725dnl files, to avoid a mixup if several versions are present
1726
1727if test -z "$SKIP_MOTIF"; then
1728 AC_MSG_CHECKING(--with-motif-lib argument)
1729 AC_ARG_WITH(motif-lib,
1730 [ --with-motif-lib=STRING Library for Motif ],
1731 [ MOTIF_LIBNAME="${withval}" ] )
1732
1733 if test -n "$MOTIF_LIBNAME"; then
1734 AC_MSG_RESULT($MOTIF_LIBNAME)
1735 GUI_LIB_LOC=
1736 else
1737 AC_MSG_RESULT(no)
1738
1739 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1740 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1741
1742 AC_MSG_CHECKING(for location of Motif GUI libs)
1743 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"
1744 GUI_LIB_LOC=
1745 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001746 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00001747 if test -f "$libtry"; then
1748 GUI_LIB_LOC=$try
1749 fi
1750 done
1751 done
1752 if test -n "$GUI_LIB_LOC"; then
1753 dnl Remove /usr/lib, it causes trouble on some systems
1754 if test "$GUI_LIB_LOC" = /usr/lib; then
1755 GUI_LIB_LOC=
1756 AC_MSG_RESULT(in default path)
1757 else
1758 if test -n "$GUI_LIB_LOC"; then
1759 AC_MSG_RESULT($GUI_LIB_LOC)
1760 if test "`(uname) 2>/dev/null`" = SunOS &&
1761 uname -r | grep '^5' >/dev/null; then
1762 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1763 fi
1764 fi
1765 fi
1766 MOTIF_LIBNAME=-lXm
1767 else
1768 AC_MSG_RESULT(<not found>)
1769 SKIP_MOTIF=YES
1770 fi
1771 fi
1772fi
1773
1774if test -z "$SKIP_MOTIF"; then
1775 SKIP_ATHENA=YES
1776 SKIP_NEXTAW=YES
1777 GUITYPE=MOTIF
1778 AC_SUBST(MOTIF_LIBNAME)
1779fi
1780
1781dnl Check if the Athena files can be found
1782
1783GUI_X_LIBS=
1784
1785if test -z "$SKIP_ATHENA"; then
1786 AC_MSG_CHECKING(if Athena header files can be found)
1787 cflags_save=$CFLAGS
1788 CFLAGS="$CFLAGS $X_CFLAGS"
1789 AC_TRY_COMPILE([
1790#include <X11/Intrinsic.h>
1791#include <X11/Xaw/Paned.h>], ,
1792 AC_MSG_RESULT(yes),
1793 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1794 CFLAGS=$cflags_save
1795fi
1796
1797if test -z "$SKIP_ATHENA"; then
1798 GUITYPE=ATHENA
1799fi
1800
1801if test -z "$SKIP_NEXTAW"; then
1802 AC_MSG_CHECKING(if neXtaw header files can be found)
1803 cflags_save=$CFLAGS
1804 CFLAGS="$CFLAGS $X_CFLAGS"
1805 AC_TRY_COMPILE([
1806#include <X11/Intrinsic.h>
1807#include <X11/neXtaw/Paned.h>], ,
1808 AC_MSG_RESULT(yes),
1809 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1810 CFLAGS=$cflags_save
1811fi
1812
1813if test -z "$SKIP_NEXTAW"; then
1814 GUITYPE=NEXTAW
1815fi
1816
1817if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1818 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1819 dnl Avoid adding it when it twice
1820 if test -n "$GUI_INC_LOC"; then
1821 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1822 fi
1823 if test -n "$GUI_LIB_LOC"; then
1824 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1825 fi
1826
1827 dnl Check for -lXext and then for -lXmu
1828 ldflags_save=$LDFLAGS
1829 LDFLAGS="$X_LIBS $LDFLAGS"
1830 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1831 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1832 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1833 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1834 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1835 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1836 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1837 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1838 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1839 if test -z "$SKIP_MOTIF"; then
1840 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1841 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1842 fi
1843 LDFLAGS=$ldflags_save
1844
1845 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1846 AC_MSG_CHECKING(for extra X11 defines)
1847 NARROW_PROTO=
1848 rm -fr conftestdir
1849 if mkdir conftestdir; then
1850 cd conftestdir
1851 cat > Imakefile <<'EOF'
1852acfindx:
1853 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
1854EOF
1855 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1856 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
1857 fi
1858 cd ..
1859 rm -fr conftestdir
1860 fi
1861 if test -z "$NARROW_PROTO"; then
1862 AC_MSG_RESULT(no)
1863 else
1864 AC_MSG_RESULT($NARROW_PROTO)
1865 fi
1866 AC_SUBST(NARROW_PROTO)
1867fi
1868
1869dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
1870dnl use the X11 include path
1871if test "$enable_xsmp" = "yes"; then
1872 cppflags_save=$CPPFLAGS
1873 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1874 AC_CHECK_HEADERS(X11/SM/SMlib.h)
1875 CPPFLAGS=$cppflags_save
1876fi
1877
1878
Bram Moolenaare667c952010-07-05 22:57:59 +02001879if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001880 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
1881 cppflags_save=$CPPFLAGS
1882 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1883 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
1884
1885 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
1886 if test ! "$enable_xim" = "no"; then
1887 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
1888 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
1889 AC_MSG_RESULT(yes),
1890 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
1891 fi
1892 CPPFLAGS=$cppflags_save
1893
1894 dnl automatically enable XIM when hangul input isn't enabled
1895 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
1896 -a "x$GUITYPE" != "xNONE" ; then
1897 AC_MSG_RESULT(X GUI selected; xim has been enabled)
1898 enable_xim="yes"
1899 fi
1900fi
1901
1902if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1903 cppflags_save=$CPPFLAGS
1904 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001905dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
1906 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
1907 AC_TRY_COMPILE([
1908#include <X11/Intrinsic.h>
1909#include <X11/Xmu/Editres.h>],
1910 [int i; i = 0;],
1911 AC_MSG_RESULT(yes)
1912 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
1913 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001914 CPPFLAGS=$cppflags_save
1915fi
1916
1917dnl Only use the Xm directory when compiling Motif, don't use it for Athena
1918if test -z "$SKIP_MOTIF"; then
1919 cppflags_save=$CPPFLAGS
1920 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001921 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 +00001922 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001923
1924 if test $ac_cv_header_Xm_XpmP_h = yes; then
1925 dnl Solaris uses XpmAttributes_21, very annoying.
1926 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
1927 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
1928 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
1929 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
1930 )
1931 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00001932 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001933 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001934 CPPFLAGS=$cppflags_save
1935fi
1936
1937if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
1938 AC_MSG_RESULT(no GUI selected; xim has been disabled)
1939 enable_xim="no"
1940fi
1941if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
1942 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
1943 enable_fontset="no"
1944fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001945if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001946 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
1947 enable_fontset="no"
1948fi
1949
Bram Moolenaar071d4272004-06-13 20:20:40 +00001950if test -z "$SKIP_PHOTON"; then
1951 GUITYPE=PHOTONGUI
1952fi
1953
1954AC_SUBST(GUI_INC_LOC)
1955AC_SUBST(GUI_LIB_LOC)
1956AC_SUBST(GUITYPE)
1957AC_SUBST(GUI_X_LIBS)
1958
1959if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
1960 AC_MSG_ERROR([cannot use workshop without Motif])
1961fi
1962
1963dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
1964if test "$enable_xim" = "yes"; then
1965 AC_DEFINE(FEAT_XIM)
1966fi
1967if test "$enable_fontset" = "yes"; then
1968 AC_DEFINE(FEAT_XFONTSET)
1969fi
1970
1971
1972dnl ---------------------------------------------------------------------------
1973dnl end of GUI-checking
1974dnl ---------------------------------------------------------------------------
1975
1976
1977dnl Only really enable hangul input when GUI and XFONTSET are available
1978if test "$enable_hangulinput" = "yes"; then
1979 if test "x$GUITYPE" = "xNONE"; then
1980 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
1981 enable_hangulinput=no
1982 else
1983 AC_DEFINE(FEAT_HANGULIN)
1984 HANGULIN_SRC=hangulin.c
1985 AC_SUBST(HANGULIN_SRC)
1986 HANGULIN_OBJ=objects/hangulin.o
1987 AC_SUBST(HANGULIN_OBJ)
1988 fi
1989fi
1990
1991dnl Checks for libraries and include files.
1992
Bram Moolenaar446cb832008-06-24 21:56:24 +00001993AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
1994 [
1995 AC_RUN_IFELSE([[
1996#include "confdefs.h"
1997#include <ctype.h>
1998#if STDC_HEADERS
1999# include <stdlib.h>
2000# include <stddef.h>
2001#endif
2002main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2003 ]],[
2004 vim_cv_toupper_broken=yes
2005 ],[
2006 vim_cv_toupper_broken=no
2007 ],[
2008 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2009 ])])
2010
2011if test "x$vim_cv_toupper_broken" = "xyes" ; then
2012 AC_DEFINE(BROKEN_TOUPPER)
2013fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002014
2015AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002016AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002017 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2018 AC_MSG_RESULT(no))
2019
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002020AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2021AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2022 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2023 AC_MSG_RESULT(no))
2024
Bram Moolenaar071d4272004-06-13 20:20:40 +00002025dnl Checks for header files.
2026AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2027dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2028if test "$HAS_ELF" = 1; then
2029 AC_CHECK_LIB(elf, main)
2030fi
2031
2032AC_HEADER_DIRENT
2033
Bram Moolenaar071d4272004-06-13 20:20:40 +00002034dnl If sys/wait.h is not found it might still exist but not be POSIX
2035dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2036if test $ac_cv_header_sys_wait_h = no; then
2037 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2038 AC_TRY_COMPILE([#include <sys/wait.h>],
2039 [union wait xx, yy; xx = yy],
2040 AC_MSG_RESULT(yes)
2041 AC_DEFINE(HAVE_SYS_WAIT_H)
2042 AC_DEFINE(HAVE_UNION_WAIT),
2043 AC_MSG_RESULT(no))
2044fi
2045
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002046AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2047 sys/select.h sys/utsname.h termcap.h fcntl.h \
2048 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2049 termio.h iconv.h inttypes.h langinfo.h math.h \
2050 unistd.h stropts.h errno.h sys/resource.h \
2051 sys/systeminfo.h locale.h sys/stream.h termios.h \
2052 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2053 utime.h sys/param.h libintl.h libgen.h \
2054 util/debug.h util/msg18n.h frame.h sys/acl.h \
2055 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002056
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002057dnl sys/ptem.h depends on sys/stream.h on Solaris
2058AC_CHECK_HEADERS(sys/ptem.h, [], [],
2059[#if defined HAVE_SYS_STREAM_H
2060# include <sys/stream.h>
2061#endif])
2062
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002063dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2064AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2065[#if defined HAVE_SYS_PARAM_H
2066# include <sys/param.h>
2067#endif])
2068
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002069
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002070dnl pthread_np.h may exist but can only be used after including pthread.h
2071AC_MSG_CHECKING([for pthread_np.h])
2072AC_TRY_COMPILE([
2073#include <pthread.h>
2074#include <pthread_np.h>],
2075 [int i; i = 0;],
2076 AC_MSG_RESULT(yes)
2077 AC_DEFINE(HAVE_PTHREAD_NP_H),
2078 AC_MSG_RESULT(no))
2079
Bram Moolenaare344bea2005-09-01 20:46:49 +00002080AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002081if test "x$MACOSX" = "xyes"; then
2082 dnl The strings.h file on OS/X contains a warning and nothing useful.
2083 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2084else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002085
2086dnl Check if strings.h and string.h can both be included when defined.
2087AC_MSG_CHECKING([if strings.h can be included after string.h])
2088cppflags_save=$CPPFLAGS
2089CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2090AC_TRY_COMPILE([
2091#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2092# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2093 /* but don't do it on AIX 5.1 (Uribarri) */
2094#endif
2095#ifdef HAVE_XM_XM_H
2096# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2097#endif
2098#ifdef HAVE_STRING_H
2099# include <string.h>
2100#endif
2101#if defined(HAVE_STRINGS_H)
2102# include <strings.h>
2103#endif
2104 ], [int i; i = 0;],
2105 AC_MSG_RESULT(yes),
2106 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2107 AC_MSG_RESULT(no))
2108CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002109fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002110
2111dnl Checks for typedefs, structures, and compiler characteristics.
2112AC_PROG_GCC_TRADITIONAL
2113AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002114AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002115AC_TYPE_MODE_T
2116AC_TYPE_OFF_T
2117AC_TYPE_PID_T
2118AC_TYPE_SIZE_T
2119AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002120AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002121
Bram Moolenaar071d4272004-06-13 20:20:40 +00002122AC_HEADER_TIME
2123AC_CHECK_TYPE(ino_t, long)
2124AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002125AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002126
2127AC_MSG_CHECKING(for rlim_t)
2128if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2129 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2130else
2131 AC_EGREP_CPP(dnl
2132changequote(<<,>>)dnl
2133<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2134changequote([,]),
2135 [
2136#include <sys/types.h>
2137#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002138# include <stdlib.h>
2139# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002140#endif
2141#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002142# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002143#endif
2144 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2145 AC_MSG_RESULT($ac_cv_type_rlim_t)
2146fi
2147if test $ac_cv_type_rlim_t = no; then
2148 cat >> confdefs.h <<\EOF
2149#define rlim_t unsigned long
2150EOF
2151fi
2152
2153AC_MSG_CHECKING(for stack_t)
2154if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2155 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2156else
2157 AC_EGREP_CPP(stack_t,
2158 [
2159#include <sys/types.h>
2160#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002161# include <stdlib.h>
2162# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002163#endif
2164#include <signal.h>
2165 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2166 AC_MSG_RESULT($ac_cv_type_stack_t)
2167fi
2168if test $ac_cv_type_stack_t = no; then
2169 cat >> confdefs.h <<\EOF
2170#define stack_t struct sigaltstack
2171EOF
2172fi
2173
2174dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2175AC_MSG_CHECKING(whether stack_t has an ss_base field)
2176AC_TRY_COMPILE([
2177#include <sys/types.h>
2178#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002179# include <stdlib.h>
2180# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002181#endif
2182#include <signal.h>
2183#include "confdefs.h"
2184 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2185 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2186 AC_MSG_RESULT(no))
2187
2188olibs="$LIBS"
2189AC_MSG_CHECKING(--with-tlib argument)
2190AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2191if test -n "$with_tlib"; then
2192 AC_MSG_RESULT($with_tlib)
2193 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002194 AC_MSG_CHECKING(for linking with $with_tlib library)
2195 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2196 dnl Need to check for tgetent() below.
2197 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002198else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002199 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002200 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2201 dnl curses, because curses is much slower.
2202 dnl Newer versions of ncurses are preferred over anything.
2203 dnl Older versions of ncurses have bugs, get a new one!
2204 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002205 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002206 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002207 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002208 *) tlibs="ncurses termlib termcap curses";;
2209 esac
2210 for libname in $tlibs; do
2211 AC_CHECK_LIB(${libname}, tgetent,,)
2212 if test "x$olibs" != "x$LIBS"; then
2213 dnl It's possible that a library is found but it doesn't work
2214 dnl e.g., shared library that cannot be found
2215 dnl compile and run a test program to be sure
2216 AC_TRY_RUN([
2217#ifdef HAVE_TERMCAP_H
2218# include <termcap.h>
2219#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002220#if STDC_HEADERS
2221# include <stdlib.h>
2222# include <stddef.h>
2223#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002224main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2225 res="OK", res="FAIL", res="FAIL")
2226 if test "$res" = "OK"; then
2227 break
2228 fi
2229 AC_MSG_RESULT($libname library is not usable)
2230 LIBS="$olibs"
2231 fi
2232 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002233 if test "x$olibs" = "x$LIBS"; then
2234 AC_MSG_RESULT(no terminal library found)
2235 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002236fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002237
2238if test "x$olibs" = "x$LIBS"; then
2239 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002240 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002241 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2242 AC_MSG_RESULT(yes),
2243 AC_MSG_ERROR([NOT FOUND!
2244 You need to install a terminal library; for example ncurses.
2245 Or specify the name of the library with --with-tlib.]))
2246fi
2247
Bram Moolenaar446cb832008-06-24 21:56:24 +00002248AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2249 [
2250 AC_RUN_IFELSE([[
2251#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002252#ifdef HAVE_TERMCAP_H
2253# include <termcap.h>
2254#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002255#ifdef HAVE_STRING_H
2256# include <string.h>
2257#endif
2258#if STDC_HEADERS
2259# include <stdlib.h>
2260# include <stddef.h>
2261#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002262main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002263{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2264 ]],[
2265 vim_cv_terminfo=no
2266 ],[
2267 vim_cv_terminfo=yes
2268 ],[
2269 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2270 ])
2271 ])
2272
2273if test "x$vim_cv_terminfo" = "xyes" ; then
2274 AC_DEFINE(TERMINFO)
2275fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002276
2277if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002278 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2279 [
2280 AC_RUN_IFELSE([[
2281#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002282#ifdef HAVE_TERMCAP_H
2283# include <termcap.h>
2284#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002285#if STDC_HEADERS
2286# include <stdlib.h>
2287# include <stddef.h>
2288#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002289main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002290{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2291 ]],[
2292 vim_cv_tgent=zero
2293 ],[
2294 vim_cv_tgent=non-zero
2295 ],[
2296 AC_MSG_ERROR(failed to compile test program.)
2297 ])
2298 ])
2299
2300 if test "x$vim_cv_tgent" = "xzero" ; then
2301 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2302 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002303fi
2304
2305AC_MSG_CHECKING(whether termcap.h contains ospeed)
2306AC_TRY_LINK([
2307#ifdef HAVE_TERMCAP_H
2308# include <termcap.h>
2309#endif
2310 ], [ospeed = 20000],
2311 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2312 [AC_MSG_RESULT(no)
2313 AC_MSG_CHECKING(whether ospeed can be extern)
2314 AC_TRY_LINK([
2315#ifdef HAVE_TERMCAP_H
2316# include <termcap.h>
2317#endif
2318extern short ospeed;
2319 ], [ospeed = 20000],
2320 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2321 AC_MSG_RESULT(no))]
2322 )
2323
2324AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2325AC_TRY_LINK([
2326#ifdef HAVE_TERMCAP_H
2327# include <termcap.h>
2328#endif
2329 ], [if (UP == 0 && BC == 0) PC = 1],
2330 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2331 [AC_MSG_RESULT(no)
2332 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2333 AC_TRY_LINK([
2334#ifdef HAVE_TERMCAP_H
2335# include <termcap.h>
2336#endif
2337extern char *UP, *BC, PC;
2338 ], [if (UP == 0 && BC == 0) PC = 1],
2339 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2340 AC_MSG_RESULT(no))]
2341 )
2342
2343AC_MSG_CHECKING(whether tputs() uses outfuntype)
2344AC_TRY_COMPILE([
2345#ifdef HAVE_TERMCAP_H
2346# include <termcap.h>
2347#endif
2348 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2349 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2350 AC_MSG_RESULT(no))
2351
2352dnl On some SCO machines sys/select redefines struct timeval
2353AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2354AC_TRY_COMPILE([
2355#include <sys/types.h>
2356#include <sys/time.h>
2357#include <sys/select.h>], ,
2358 AC_MSG_RESULT(yes)
2359 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2360 AC_MSG_RESULT(no))
2361
2362dnl AC_DECL_SYS_SIGLIST
2363
2364dnl Checks for pty.c (copied from screen) ==========================
2365AC_MSG_CHECKING(for /dev/ptc)
2366if test -r /dev/ptc; then
2367 AC_DEFINE(HAVE_DEV_PTC)
2368 AC_MSG_RESULT(yes)
2369else
2370 AC_MSG_RESULT(no)
2371fi
2372
2373AC_MSG_CHECKING(for SVR4 ptys)
2374if test -c /dev/ptmx ; then
2375 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2376 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2377 AC_MSG_RESULT(no))
2378else
2379 AC_MSG_RESULT(no)
2380fi
2381
2382AC_MSG_CHECKING(for ptyranges)
2383if test -d /dev/ptym ; then
2384 pdir='/dev/ptym'
2385else
2386 pdir='/dev'
2387fi
2388dnl SCO uses ptyp%d
2389AC_EGREP_CPP(yes,
2390[#ifdef M_UNIX
2391 yes;
2392#endif
2393 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2394dnl if test -c /dev/ptyp19; then
2395dnl ptys=`echo /dev/ptyp??`
2396dnl else
2397dnl ptys=`echo $pdir/pty??`
2398dnl fi
2399if test "$ptys" != "$pdir/pty??" ; then
2400 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2401 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2402 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2403 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2404 AC_MSG_RESULT([$p0 / $p1])
2405else
2406 AC_MSG_RESULT([don't know])
2407fi
2408
2409dnl **** pty mode/group handling ****
2410dnl
2411dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002412rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002413AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2414 [
2415 AC_RUN_IFELSE([[
2416#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002417#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002418#if STDC_HEADERS
2419# include <stdlib.h>
2420# include <stddef.h>
2421#endif
2422#ifdef HAVE_UNISTD_H
2423#include <unistd.h>
2424#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002425#include <sys/stat.h>
2426#include <stdio.h>
2427main()
2428{
2429 struct stat sb;
2430 char *x,*ttyname();
2431 int om, m;
2432 FILE *fp;
2433
2434 if (!(x = ttyname(0))) exit(1);
2435 if (stat(x, &sb)) exit(1);
2436 om = sb.st_mode;
2437 if (om & 002) exit(0);
2438 m = system("mesg y");
2439 if (m == -1 || m == 127) exit(1);
2440 if (stat(x, &sb)) exit(1);
2441 m = sb.st_mode;
2442 if (chmod(x, om)) exit(1);
2443 if (m & 002) exit(0);
2444 if (sb.st_gid == getgid()) exit(1);
2445 if (!(fp=fopen("conftest_grp", "w")))
2446 exit(1);
2447 fprintf(fp, "%d\n", sb.st_gid);
2448 fclose(fp);
2449 exit(0);
2450}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002451 ]],[
2452 if test -f conftest_grp; then
2453 vim_cv_tty_group=`cat conftest_grp`
2454 if test "x$vim_cv_tty_mode" = "x" ; then
2455 vim_cv_tty_mode=0620
2456 fi
2457 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2458 else
2459 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002460 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002461 fi
2462 ],[
2463 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002464 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002465 ],[
2466 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2467 ])
2468 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002469rm -f conftest_grp
2470
Bram Moolenaar446cb832008-06-24 21:56:24 +00002471if test "x$vim_cv_tty_group" != "xworld" ; then
2472 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2473 if test "x$vim_cv_tty_mode" = "x" ; then
2474 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)])
2475 else
2476 AC_DEFINE(PTYMODE, 0620)
2477 fi
2478fi
2479
Bram Moolenaar071d4272004-06-13 20:20:40 +00002480dnl Checks for library functions. ===================================
2481
2482AC_TYPE_SIGNAL
2483
2484dnl find out what to use at the end of a signal function
2485if test $ac_cv_type_signal = void; then
2486 AC_DEFINE(SIGRETURN, [return])
2487else
2488 AC_DEFINE(SIGRETURN, [return 0])
2489fi
2490
2491dnl check if struct sigcontext is defined (used for SGI only)
2492AC_MSG_CHECKING(for struct sigcontext)
2493AC_TRY_COMPILE([
2494#include <signal.h>
2495test_sig()
2496{
2497 struct sigcontext *scont;
2498 scont = (struct sigcontext *)0;
2499 return 1;
2500} ], ,
2501 AC_MSG_RESULT(yes)
2502 AC_DEFINE(HAVE_SIGCONTEXT),
2503 AC_MSG_RESULT(no))
2504
2505dnl tricky stuff: try to find out if getcwd() is implemented with
2506dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002507AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2508 [
2509 AC_RUN_IFELSE([[
2510#include "confdefs.h"
2511#ifdef HAVE_UNISTD_H
2512#include <unistd.h>
2513#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002514char *dagger[] = { "IFS=pwd", 0 };
2515main()
2516{
2517 char buffer[500];
2518 extern char **environ;
2519 environ = dagger;
2520 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002521}
2522 ]],[
2523 vim_cv_getcwd_broken=no
2524 ],[
2525 vim_cv_getcwd_broken=yes
2526 ],[
2527 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2528 ])
2529 ])
2530
2531if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2532 AC_DEFINE(BAD_GETCWD)
2533fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002534
Bram Moolenaar25153e12010-02-24 14:47:08 +01002535dnl Check for functions in one big call, to reduce the size of configure.
2536dnl Can only be used for functions that do not require any include.
2537AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002538 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002539 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002540 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002541 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002542 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2543 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002544AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002545
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002546dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2547dnl appropriate, so that off_t is 64 bits when needed.
2548AC_SYS_LARGEFILE
2549
Bram Moolenaar071d4272004-06-13 20:20:40 +00002550dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2551AC_MSG_CHECKING(for st_blksize)
2552AC_TRY_COMPILE(
2553[#include <sys/types.h>
2554#include <sys/stat.h>],
2555[ struct stat st;
2556 int n;
2557
2558 stat("/", &st);
2559 n = (int)st.st_blksize;],
2560 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2561 AC_MSG_RESULT(no))
2562
Bram Moolenaar446cb832008-06-24 21:56:24 +00002563AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2564 [
2565 AC_RUN_IFELSE([[
2566#include "confdefs.h"
2567#if STDC_HEADERS
2568# include <stdlib.h>
2569# include <stddef.h>
2570#endif
2571#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002572#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002573main() {struct stat st; exit(stat("configure/", &st) != 0); }
2574 ]],[
2575 vim_cv_stat_ignores_slash=yes
2576 ],[
2577 vim_cv_stat_ignores_slash=no
2578 ],[
2579 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2580 ])
2581 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002582
Bram Moolenaar446cb832008-06-24 21:56:24 +00002583if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2584 AC_DEFINE(STAT_IGNORES_SLASH)
2585fi
2586
Bram Moolenaar071d4272004-06-13 20:20:40 +00002587dnl Link with iconv for charset translation, if not found without library.
2588dnl check for iconv() requires including iconv.h
2589dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2590dnl has been installed.
2591AC_MSG_CHECKING(for iconv_open())
2592save_LIBS="$LIBS"
2593LIBS="$LIBS -liconv"
2594AC_TRY_LINK([
2595#ifdef HAVE_ICONV_H
2596# include <iconv.h>
2597#endif
2598 ], [iconv_open("fr", "to");],
2599 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2600 LIBS="$save_LIBS"
2601 AC_TRY_LINK([
2602#ifdef HAVE_ICONV_H
2603# include <iconv.h>
2604#endif
2605 ], [iconv_open("fr", "to");],
2606 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2607 AC_MSG_RESULT(no)))
2608
2609
2610AC_MSG_CHECKING(for nl_langinfo(CODESET))
2611AC_TRY_LINK([
2612#ifdef HAVE_LANGINFO_H
2613# include <langinfo.h>
2614#endif
2615], [char *cs = nl_langinfo(CODESET);],
2616 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2617 AC_MSG_RESULT(no))
2618
Bram Moolenaar446cb832008-06-24 21:56:24 +00002619dnl Need various functions for floating point support. Only enable
2620dnl floating point when they are all present.
2621AC_CHECK_LIB(m, strtod)
2622AC_MSG_CHECKING([for strtod() and other floating point functions])
2623AC_TRY_LINK([
2624#ifdef HAVE_MATH_H
2625# include <math.h>
2626#endif
2627#if STDC_HEADERS
2628# include <stdlib.h>
2629# include <stddef.h>
2630#endif
2631], [char *s; double d;
2632 d = strtod("1.1", &s);
2633 d = fabs(1.11);
2634 d = ceil(1.11);
2635 d = floor(1.11);
2636 d = log10(1.11);
2637 d = pow(1.11, 2.22);
2638 d = sqrt(1.11);
2639 d = sin(1.11);
2640 d = cos(1.11);
2641 d = atan(1.11);
2642 ],
2643 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2644 AC_MSG_RESULT(no))
2645
Bram Moolenaar071d4272004-06-13 20:20:40 +00002646dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2647dnl when -lacl works, also try to use -lattr (required for Debian).
2648AC_MSG_CHECKING(--disable-acl argument)
2649AC_ARG_ENABLE(acl,
2650 [ --disable-acl Don't check for ACL support.],
2651 , [enable_acl="yes"])
2652if test "$enable_acl" = "yes"; then
2653AC_MSG_RESULT(no)
2654AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2655 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2656 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2657
2658AC_MSG_CHECKING(for POSIX ACL support)
2659AC_TRY_LINK([
2660#include <sys/types.h>
2661#ifdef HAVE_SYS_ACL_H
2662# include <sys/acl.h>
2663#endif
2664acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2665 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2666 acl_free(acl);],
2667 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2668 AC_MSG_RESULT(no))
2669
2670AC_MSG_CHECKING(for Solaris ACL support)
2671AC_TRY_LINK([
2672#ifdef HAVE_SYS_ACL_H
2673# include <sys/acl.h>
2674#endif], [acl("foo", GETACLCNT, 0, NULL);
2675 ],
2676 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2677 AC_MSG_RESULT(no))
2678
2679AC_MSG_CHECKING(for AIX ACL support)
2680AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002681#if STDC_HEADERS
2682# include <stdlib.h>
2683# include <stddef.h>
2684#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002685#ifdef HAVE_SYS_ACL_H
2686# include <sys/acl.h>
2687#endif
2688#ifdef HAVE_SYS_ACCESS_H
2689# include <sys/access.h>
2690#endif
2691#define _ALL_SOURCE
2692
2693#include <sys/stat.h>
2694
2695int aclsize;
2696struct acl *aclent;], [aclsize = sizeof(struct acl);
2697 aclent = (void *)malloc(aclsize);
2698 statacl("foo", STX_NORMAL, aclent, aclsize);
2699 ],
2700 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2701 AC_MSG_RESULT(no))
2702else
2703 AC_MSG_RESULT(yes)
2704fi
2705
2706AC_MSG_CHECKING(--disable-gpm argument)
2707AC_ARG_ENABLE(gpm,
2708 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2709 [enable_gpm="yes"])
2710
2711if test "$enable_gpm" = "yes"; then
2712 AC_MSG_RESULT(no)
2713 dnl Checking if gpm support can be compiled
2714 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2715 [olibs="$LIBS" ; LIBS="-lgpm"]
2716 AC_TRY_LINK(
2717 [#include <gpm.h>
2718 #include <linux/keyboard.h>],
2719 [Gpm_GetLibVersion(NULL);],
2720 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2721 dnl FEAT_MOUSE_GPM if mouse support is included
2722 [vi_cv_have_gpm=yes],
2723 [vi_cv_have_gpm=no])
2724 [LIBS="$olibs"]
2725 )
2726 if test $vi_cv_have_gpm = yes; then
2727 LIBS="$LIBS -lgpm"
2728 AC_DEFINE(HAVE_GPM)
2729 fi
2730else
2731 AC_MSG_RESULT(yes)
2732fi
2733
Bram Moolenaar446cb832008-06-24 21:56:24 +00002734AC_MSG_CHECKING(--disable-sysmouse argument)
2735AC_ARG_ENABLE(sysmouse,
2736 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2737 [enable_sysmouse="yes"])
2738
2739if test "$enable_sysmouse" = "yes"; then
2740 AC_MSG_RESULT(no)
2741 dnl Checking if sysmouse support can be compiled
2742 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
2743 dnl defines FEAT_SYSMOUSE if mouse support is included
2744 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
2745 AC_TRY_LINK(
2746 [#include <sys/consio.h>
2747 #include <signal.h>
2748 #include <sys/fbio.h>],
2749 [struct mouse_info mouse;
2750 mouse.operation = MOUSE_MODE;
2751 mouse.operation = MOUSE_SHOW;
2752 mouse.u.mode.mode = 0;
2753 mouse.u.mode.signal = SIGUSR2;],
2754 [vi_cv_have_sysmouse=yes],
2755 [vi_cv_have_sysmouse=no])
2756 )
2757 if test $vi_cv_have_sysmouse = yes; then
2758 AC_DEFINE(HAVE_SYSMOUSE)
2759 fi
2760else
2761 AC_MSG_RESULT(yes)
2762fi
2763
Bram Moolenaarf05da212009-11-17 16:13:15 +00002764dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
2765AC_MSG_CHECKING(for FD_CLOEXEC)
2766AC_TRY_COMPILE(
2767[#if HAVE_FCNTL_H
2768# include <fcntl.h>
2769#endif],
2770[ int flag = FD_CLOEXEC;],
2771 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
2772 AC_MSG_RESULT(not usable))
2773
Bram Moolenaar071d4272004-06-13 20:20:40 +00002774dnl rename needs to be checked separately to work on Nextstep with cc
2775AC_MSG_CHECKING(for rename)
2776AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2777 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2778 AC_MSG_RESULT(no))
2779
2780dnl sysctl() may exist but not the arguments we use
2781AC_MSG_CHECKING(for sysctl)
2782AC_TRY_COMPILE(
2783[#include <sys/types.h>
2784#include <sys/sysctl.h>],
2785[ int mib[2], r;
2786 size_t len;
2787
2788 mib[0] = CTL_HW;
2789 mib[1] = HW_USERMEM;
2790 len = sizeof(r);
2791 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2792 ],
2793 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2794 AC_MSG_RESULT(not usable))
2795
2796dnl sysinfo() may exist but not be Linux compatible
2797AC_MSG_CHECKING(for sysinfo)
2798AC_TRY_COMPILE(
2799[#include <sys/types.h>
2800#include <sys/sysinfo.h>],
2801[ struct sysinfo sinfo;
2802 int t;
2803
2804 (void)sysinfo(&sinfo);
2805 t = sinfo.totalram;
2806 ],
2807 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2808 AC_MSG_RESULT(not usable))
2809
Bram Moolenaar914572a2007-05-01 11:37:47 +00002810dnl struct sysinfo may have the mem_unit field or not
2811AC_MSG_CHECKING(for sysinfo.mem_unit)
2812AC_TRY_COMPILE(
2813[#include <sys/types.h>
2814#include <sys/sysinfo.h>],
2815[ struct sysinfo sinfo;
2816 sinfo.mem_unit = 1;
2817 ],
2818 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
2819 AC_MSG_RESULT(no))
2820
Bram Moolenaar071d4272004-06-13 20:20:40 +00002821dnl sysconf() may exist but not support what we want to use
2822AC_MSG_CHECKING(for sysconf)
2823AC_TRY_COMPILE(
2824[#include <unistd.h>],
2825[ (void)sysconf(_SC_PAGESIZE);
2826 (void)sysconf(_SC_PHYS_PAGES);
2827 ],
2828 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2829 AC_MSG_RESULT(not usable))
2830
Bram Moolenaar914703b2010-05-31 21:59:46 +02002831AC_CHECK_SIZEOF([int])
2832AC_CHECK_SIZEOF([long])
2833AC_CHECK_SIZEOF([time_t])
2834AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02002835
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002836dnl Make sure that uint32_t is really 32 bits unsigned.
2837AC_MSG_CHECKING([uint32_t is 32 bits])
2838AC_TRY_RUN([
2839#ifdef HAVE_STDINT_H
2840# include <stdint.h>
2841#endif
2842#ifdef HAVE_INTTYPES_H
2843# include <inttypes.h>
2844#endif
2845main() {
2846 uint32_t nr1 = (uint32_t)-1;
2847 uint32_t nr2 = (uint32_t)0xffffffffUL;
2848 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
2849 exit(0);
2850}],
2851AC_MSG_RESULT(ok),
2852AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
2853AC_MSG_ERROR([could not compile program using uint32_t.]))
2854
Bram Moolenaar446cb832008-06-24 21:56:24 +00002855dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2856dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2857
Bram Moolenaar071d4272004-06-13 20:20:40 +00002858[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00002859#include "confdefs.h"
2860#ifdef HAVE_STRING_H
2861# include <string.h>
2862#endif
2863#if STDC_HEADERS
2864# include <stdlib.h>
2865# include <stddef.h>
2866#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002867main() {
2868 char buf[10];
2869 strcpy(buf, "abcdefghi");
2870 mch_memmove(buf, buf + 2, 3);
2871 if (strncmp(buf, "ababcf", 6))
2872 exit(1);
2873 strcpy(buf, "abcdefghi");
2874 mch_memmove(buf + 2, buf, 3);
2875 if (strncmp(buf, "cdedef", 6))
2876 exit(1);
2877 exit(0); /* libc version works properly. */
2878}']
2879
Bram Moolenaar446cb832008-06-24 21:56:24 +00002880AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
2881 [
2882 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
2883 [
2884 vim_cv_memmove_handles_overlap=yes
2885 ],[
2886 vim_cv_memmove_handles_overlap=no
2887 ],[
2888 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
2889 ])
2890 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002891
Bram Moolenaar446cb832008-06-24 21:56:24 +00002892if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
2893 AC_DEFINE(USEMEMMOVE)
2894else
2895 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
2896 [
2897 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
2898 [
2899 vim_cv_bcopy_handles_overlap=yes
2900 ],[
2901 vim_cv_bcopy_handles_overlap=no
2902 ],[
2903 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
2904 ])
2905 ])
2906
2907 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
2908 AC_DEFINE(USEBCOPY)
2909 else
2910 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
2911 [
2912 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
2913 [
2914 vim_cv_memcpy_handles_overlap=yes
2915 ],[
2916 vim_cv_memcpy_handles_overlap=no
2917 ],[
2918 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
2919 ])
2920 ])
2921
2922 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
2923 AC_DEFINE(USEMEMCPY)
2924 fi
2925 fi
2926fi
2927
Bram Moolenaar071d4272004-06-13 20:20:40 +00002928
2929dnl Check for multibyte locale functions
2930dnl Find out if _Xsetlocale() is supported by libX11.
2931dnl Check if X_LOCALE should be defined.
2932
2933if test "$enable_multibyte" = "yes"; then
2934 cflags_save=$CFLAGS
2935 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00002936 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002937 CFLAGS="$CFLAGS -I$x_includes"
2938 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
2939 AC_MSG_CHECKING(whether X_LOCALE needed)
2940 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
2941 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
2942 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
2943 AC_MSG_RESULT(no))
2944 fi
2945 CFLAGS=$cflags_save
2946 LDFLAGS=$ldflags_save
2947fi
2948
2949dnl Link with xpg4, it is said to make Korean locale working
2950AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
2951
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00002952dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002953dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002954dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002955dnl -t for typedefs (many ctags have this)
2956dnl -s for static functions (Elvis ctags only?)
2957dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
2958dnl -i+m to test for older Exuberant ctags
2959AC_MSG_CHECKING(how to create tags)
2960test -f tags && mv tags tags.save
2961if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002962 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002963else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00002964 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002965 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
2966 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
2967 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
2968 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
2969 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
2970 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
2971 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
2972fi
2973test -f tags.save && mv tags.save tags
2974AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
2975
2976dnl Check how we can run man with a section number
2977AC_MSG_CHECKING(how to run man with a section nr)
2978MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00002979(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 +00002980AC_MSG_RESULT($MANDEF)
2981if test "$MANDEF" = "man -s"; then
2982 AC_DEFINE(USEMAN_S)
2983fi
2984
2985dnl Check if gettext() is working and if it needs -lintl
2986AC_MSG_CHECKING(--disable-nls argument)
2987AC_ARG_ENABLE(nls,
2988 [ --disable-nls Don't support NLS (gettext()).], ,
2989 [enable_nls="yes"])
2990
2991if test "$enable_nls" = "yes"; then
2992 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002993
2994 INSTALL_LANGS=install-languages
2995 AC_SUBST(INSTALL_LANGS)
2996 INSTALL_TOOL_LANGS=install-tool-languages
2997 AC_SUBST(INSTALL_TOOL_LANGS)
2998
Bram Moolenaar071d4272004-06-13 20:20:40 +00002999 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
3000 AC_MSG_CHECKING([for NLS])
3001 if test -f po/Makefile; then
3002 have_gettext="no"
3003 if test -n "$MSGFMT"; then
3004 AC_TRY_LINK(
3005 [#include <libintl.h>],
3006 [gettext("Test");],
3007 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3008 olibs=$LIBS
3009 LIBS="$LIBS -lintl"
3010 AC_TRY_LINK(
3011 [#include <libintl.h>],
3012 [gettext("Test");],
3013 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3014 AC_MSG_RESULT([gettext() doesn't work]);
3015 LIBS=$olibs))
3016 else
3017 AC_MSG_RESULT([msgfmt not found - disabled]);
3018 fi
3019 if test $have_gettext = "yes"; then
3020 AC_DEFINE(HAVE_GETTEXT)
3021 MAKEMO=yes
3022 AC_SUBST(MAKEMO)
3023 dnl this was added in GNU gettext 0.10.36
3024 AC_CHECK_FUNCS(bind_textdomain_codeset)
3025 dnl _nl_msg_cat_cntr is required for GNU gettext
3026 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3027 AC_TRY_LINK(
3028 [#include <libintl.h>
3029 extern int _nl_msg_cat_cntr;],
3030 [++_nl_msg_cat_cntr;],
3031 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3032 AC_MSG_RESULT([no]))
3033 fi
3034 else
3035 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3036 fi
3037else
3038 AC_MSG_RESULT(yes)
3039fi
3040
3041dnl Check for dynamic linking loader
3042AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3043if test x${DLL} = xdlfcn.h; then
3044 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3045 AC_MSG_CHECKING([for dlopen()])
3046 AC_TRY_LINK(,[
3047 extern void* dlopen();
3048 dlopen();
3049 ],
3050 AC_MSG_RESULT(yes);
3051 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3052 AC_MSG_RESULT(no);
3053 AC_MSG_CHECKING([for dlopen() in -ldl])
3054 olibs=$LIBS
3055 LIBS="$LIBS -ldl"
3056 AC_TRY_LINK(,[
3057 extern void* dlopen();
3058 dlopen();
3059 ],
3060 AC_MSG_RESULT(yes);
3061 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3062 AC_MSG_RESULT(no);
3063 LIBS=$olibs))
3064 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3065 dnl ick :-)
3066 AC_MSG_CHECKING([for dlsym()])
3067 AC_TRY_LINK(,[
3068 extern void* dlsym();
3069 dlsym();
3070 ],
3071 AC_MSG_RESULT(yes);
3072 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3073 AC_MSG_RESULT(no);
3074 AC_MSG_CHECKING([for dlsym() in -ldl])
3075 olibs=$LIBS
3076 LIBS="$LIBS -ldl"
3077 AC_TRY_LINK(,[
3078 extern void* dlsym();
3079 dlsym();
3080 ],
3081 AC_MSG_RESULT(yes);
3082 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3083 AC_MSG_RESULT(no);
3084 LIBS=$olibs))
3085elif test x${DLL} = xdl.h; then
3086 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3087 AC_MSG_CHECKING([for shl_load()])
3088 AC_TRY_LINK(,[
3089 extern void* shl_load();
3090 shl_load();
3091 ],
3092 AC_MSG_RESULT(yes);
3093 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3094 AC_MSG_RESULT(no);
3095 AC_MSG_CHECKING([for shl_load() in -ldld])
3096 olibs=$LIBS
3097 LIBS="$LIBS -ldld"
3098 AC_TRY_LINK(,[
3099 extern void* shl_load();
3100 shl_load();
3101 ],
3102 AC_MSG_RESULT(yes);
3103 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3104 AC_MSG_RESULT(no);
3105 LIBS=$olibs))
3106fi
3107AC_CHECK_HEADERS(setjmp.h)
3108
3109if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3110 dnl -ldl must come after DynaLoader.a
3111 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3112 LIBS=`echo $LIBS | sed s/-ldl//`
3113 PERL_LIBS="$PERL_LIBS -ldl"
3114 fi
3115fi
3116
3117if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
3118 && test "x$GUITYPE" != "xCARBONGUI"; then
3119 AC_MSG_CHECKING(whether we need -framework Carbon)
3120 dnl check for MACOSX without Carbon GUI, but with FEAT_MBYTE
Bram Moolenaarb90daee2006-10-17 09:49:09 +00003121 if test "x$enable_multibyte" = "xyes" || test "x$features" = "xbig" \
Bram Moolenaar071d4272004-06-13 20:20:40 +00003122 || test "x$features" = "xhuge"; then
3123 LIBS="$LIBS -framework Carbon"
3124 AC_MSG_RESULT(yes)
3125 else
3126 AC_MSG_RESULT(no)
3127 fi
3128fi
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003129if test "x$MACARCH" = "xboth"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003130 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003131fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003132
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003133dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3134dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3135dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003136dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3137dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003138DEPEND_CFLAGS_FILTER=
3139if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003140 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003141 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003142 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003143 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003144 AC_MSG_RESULT(yes)
3145 else
3146 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003147 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003148 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3149 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003150 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003151 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3152 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003153 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 +00003154 AC_MSG_RESULT(yes)
3155 else
3156 AC_MSG_RESULT(no)
3157 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003158fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003159AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003160
3161dnl write output files
3162AC_OUTPUT(auto/config.mk:config.mk.in)
3163
3164dnl vim: set sw=2 tw=78 fo+=l: