blob: 567c7a2185bd4bbb0d6ba24ceaefbef25c38b3ff [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
767 PYTHON_SRC="if_python.c"
768 dnl For Mac OSX 10.2 config.o is included in the Python library.
769 if test "x$MACOSX" = "xyes"; then
770 PYTHON_OBJ="objects/if_python.o"
771 else
772 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
773 fi
774 if test "${vi_cv_var_python_version}" = "1.4"; then
775 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
776 fi
777 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
778
779 dnl On FreeBSD linking with "-pthread" is required to use threads.
780 dnl _THREAD_SAFE must be used for compiling then.
781 dnl The "-pthread" is added to $LIBS, so that the following check for
782 dnl sigaltstack() will look in libc_r (it's there in libc!).
783 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
784 dnl will then define target-specific defines, e.g., -D_REENTRANT.
785 dnl Don't do this for Mac OSX, -pthread will generate a warning.
786 AC_MSG_CHECKING([if -pthread should be used])
787 threadsafe_flag=
788 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000789 dnl if test "x$MACOSX" != "xyes"; then
790 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000791 test "$GCC" = yes && threadsafe_flag="-pthread"
792 if test "`(uname) 2>/dev/null`" = FreeBSD; then
793 threadsafe_flag="-D_THREAD_SAFE"
794 thread_lib="-pthread"
795 fi
796 fi
797 libs_save_old=$LIBS
798 if test -n "$threadsafe_flag"; then
799 cflags_save=$CFLAGS
800 CFLAGS="$CFLAGS $threadsafe_flag"
801 LIBS="$LIBS $thread_lib"
802 AC_TRY_LINK(,[ ],
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200803 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
Bram Moolenaar071d4272004-06-13 20:20:40 +0000804 AC_MSG_RESULT(no); LIBS=$libs_save_old
805 )
806 CFLAGS=$cflags_save
807 else
808 AC_MSG_RESULT(no)
809 fi
810
811 dnl check that compiling a simple program still works with the flags
812 dnl added for Python.
813 AC_MSG_CHECKING([if compile and link flags for Python are sane])
814 cflags_save=$CFLAGS
815 libs_save=$LIBS
Bram Moolenaar69f787a2010-07-11 20:52:58 +0200816 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000817 LIBS="$LIBS $PYTHON_LIBS"
818 AC_TRY_LINK(,[ ],
819 AC_MSG_RESULT(yes); python_ok=yes,
820 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
821 CFLAGS=$cflags_save
822 LIBS=$libs_save
823 if test $python_ok = yes; then
824 AC_DEFINE(FEAT_PYTHON)
825 else
826 LIBS=$libs_save_old
827 PYTHON_SRC=
828 PYTHON_OBJ=
829 PYTHON_LIBS=
830 PYTHON_CFLAGS=
831 fi
832
833 fi
834 else
835 AC_MSG_RESULT(too old)
836 fi
837 fi
838fi
839AC_SUBST(PYTHON_CONFDIR)
840AC_SUBST(PYTHON_LIBS)
841AC_SUBST(PYTHON_GETPATH_CFLAGS)
842AC_SUBST(PYTHON_CFLAGS)
843AC_SUBST(PYTHON_SRC)
844AC_SUBST(PYTHON_OBJ)
845
846AC_MSG_CHECKING(--enable-tclinterp argument)
847AC_ARG_ENABLE(tclinterp,
848 [ --enable-tclinterp Include Tcl interpreter.], ,
849 [enable_tclinterp="no"])
850AC_MSG_RESULT($enable_tclinterp)
851
852if test "$enable_tclinterp" = "yes"; then
853
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000854 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
Bram Moolenaar071d4272004-06-13 20:20:40 +0000855 AC_MSG_CHECKING(--with-tclsh argument)
856 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
857 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000858 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000859 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
860 AC_SUBST(vi_cv_path_tcl)
861
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000862 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
863 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
864 tclsh_name="tclsh8.4"
865 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
866 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000867 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000868 tclsh_name="tclsh8.2"
869 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
870 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000871 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
872 tclsh_name="tclsh8.0"
873 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
874 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000875 dnl still didn't find it, try without version number
876 if test "X$vi_cv_path_tcl" = "X"; then
877 tclsh_name="tclsh"
878 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
879 fi
880 if test "X$vi_cv_path_tcl" != "X"; then
881 AC_MSG_CHECKING(Tcl version)
882 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
883 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
884 AC_MSG_RESULT($tclver - OK);
885 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 -`
886
887 AC_MSG_CHECKING(for location of Tcl include)
888 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar0ff8f602008-02-20 11:44:03 +0000889 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 +0000890 else
891 dnl For Mac OS X 10.3, use the OS-provided framework location
892 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
893 fi
Bram Moolenaar0ff8f602008-02-20 11:44:03 +0000894 TCL_INC=
Bram Moolenaar071d4272004-06-13 20:20:40 +0000895 for try in $tclinc; do
896 if test -f "$try/tcl.h"; then
897 AC_MSG_RESULT($try/tcl.h)
898 TCL_INC=$try
899 break
900 fi
901 done
902 if test -z "$TCL_INC"; then
903 AC_MSG_RESULT(<not found>)
904 SKIP_TCL=YES
905 fi
906 if test -z "$SKIP_TCL"; then
907 AC_MSG_CHECKING(for location of tclConfig.sh script)
908 if test "x$MACOSX" != "xyes"; then
909 tclcnf=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000910 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000911 else
912 dnl For Mac OS X 10.3, use the OS-provided framework location
913 tclcnf="/System/Library/Frameworks/Tcl.framework"
914 fi
915 for try in $tclcnf; do
916 if test -f $try/tclConfig.sh; then
917 AC_MSG_RESULT($try/tclConfig.sh)
918 . $try/tclConfig.sh
919 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
920 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
921 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000922 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar4394bff2008-07-24 11:21:31 +0000923 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 +0000924 break
925 fi
926 done
927 if test -z "$TCL_LIBS"; then
928 AC_MSG_RESULT(<not found>)
929 AC_MSG_CHECKING(for Tcl library by myself)
930 tcllib=`echo $tclinc | sed s/include/lib/g`
Bram Moolenaar9b5d4dd2008-01-01 15:26:45 +0000931 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000932 for ext in .so .a ; do
933 for ver in "" $tclver ; do
934 for try in $tcllib ; do
935 trylib=tcl$ver$ext
936 if test -f $try/lib$trylib ; then
937 AC_MSG_RESULT($try/lib$trylib)
938 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
939 if test "`(uname) 2>/dev/null`" = SunOS &&
940 uname -r | grep '^5' >/dev/null; then
941 TCL_LIBS="$TCL_LIBS -R $try"
942 fi
943 break 3
944 fi
945 done
946 done
947 done
948 if test -z "$TCL_LIBS"; then
949 AC_MSG_RESULT(<not found>)
950 SKIP_TCL=YES
951 fi
952 fi
953 if test -z "$SKIP_TCL"; then
954 AC_DEFINE(FEAT_TCL)
955 TCL_SRC=if_tcl.c
956 TCL_OBJ=objects/if_tcl.o
957 TCL_PRO=if_tcl.pro
958 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
959 fi
960 fi
961 else
962 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
963 fi
964 fi
965fi
966AC_SUBST(TCL_SRC)
967AC_SUBST(TCL_OBJ)
968AC_SUBST(TCL_PRO)
969AC_SUBST(TCL_CFLAGS)
970AC_SUBST(TCL_LIBS)
971
972AC_MSG_CHECKING(--enable-rubyinterp argument)
973AC_ARG_ENABLE(rubyinterp,
974 [ --enable-rubyinterp Include Ruby interpreter.], ,
975 [enable_rubyinterp="no"])
976AC_MSG_RESULT($enable_rubyinterp)
977if test "$enable_rubyinterp" = "yes"; then
Bram Moolenaar165641d2010-02-17 16:23:09 +0100978 AC_MSG_CHECKING(--with-ruby-command argument)
979 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
980 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
981 RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000982 AC_SUBST(vi_cv_path_ruby)
Bram Moolenaar165641d2010-02-17 16:23:09 +0100983 AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000984 if test "X$vi_cv_path_ruby" != "X"; then
985 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +0000986 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 +0000987 AC_MSG_RESULT(OK)
988 AC_MSG_CHECKING(Ruby header files)
Bram Moolenaar165641d2010-02-17 16:23:09 +0100989 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 +0000990 if test "X$rubyhdrdir" != "X"; then
991 AC_MSG_RESULT($rubyhdrdir)
992 RUBY_CFLAGS="-I$rubyhdrdir"
Bram Moolenaar165641d2010-02-17 16:23:09 +0100993 rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
994 if test -d "$rubyhdrdir/$rubyarch"; then
995 RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
996 fi
997 rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
998 RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000999 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
1000 if test "X$rubylibs" != "X"; then
1001 RUBY_LIBS="$rubylibs"
1002 fi
1003 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
1004 if test -f "$rubyhdrdir/$librubyarg"; then
1005 librubyarg="$rubyhdrdir/$librubyarg"
1006 else
1007 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
1008 if test -f "$rubylibdir/$librubyarg"; then
1009 librubyarg="$rubylibdir/$librubyarg"
1010 elif test "$librubyarg" = "libruby.a"; then
1011 dnl required on Mac OS 10.3 where libruby.a doesn't exist
1012 librubyarg="-lruby"
1013 else
1014 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
1015 fi
1016 fi
1017
1018 if test "X$librubyarg" != "X"; then
1019 RUBY_LIBS="$librubyarg $RUBY_LIBS"
1020 fi
1021 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
1022 if test "X$rubyldflags" != "X"; then
Bram Moolenaar996b6d82009-07-22 09:17:23 +00001023 dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1024 dnl be included if requested by passing --with-mac-arch to
1025 dnl configure, so strip these flags first (if present)
1026 rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//'`
1027 if test "X$rubyldflags" != "X"; then
1028 LDFLAGS="$rubyldflags $LDFLAGS"
1029 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001030 fi
1031 RUBY_SRC="if_ruby.c"
1032 RUBY_OBJ="objects/if_ruby.o"
1033 RUBY_PRO="if_ruby.pro"
1034 AC_DEFINE(FEAT_RUBY)
1035 else
Bram Moolenaar165641d2010-02-17 16:23:09 +01001036 AC_MSG_RESULT(not found; disabling Ruby)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001037 fi
1038 else
1039 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1040 fi
1041 fi
1042fi
1043AC_SUBST(RUBY_SRC)
1044AC_SUBST(RUBY_OBJ)
1045AC_SUBST(RUBY_PRO)
1046AC_SUBST(RUBY_CFLAGS)
1047AC_SUBST(RUBY_LIBS)
1048
1049AC_MSG_CHECKING(--enable-cscope argument)
1050AC_ARG_ENABLE(cscope,
1051 [ --enable-cscope Include cscope interface.], ,
1052 [enable_cscope="no"])
1053AC_MSG_RESULT($enable_cscope)
1054if test "$enable_cscope" = "yes"; then
1055 AC_DEFINE(FEAT_CSCOPE)
1056fi
1057
1058AC_MSG_CHECKING(--enable-workshop argument)
1059AC_ARG_ENABLE(workshop,
1060 [ --enable-workshop Include Sun Visual Workshop support.], ,
1061 [enable_workshop="no"])
1062AC_MSG_RESULT($enable_workshop)
1063if test "$enable_workshop" = "yes"; then
1064 AC_DEFINE(FEAT_SUN_WORKSHOP)
1065 WORKSHOP_SRC="workshop.c integration.c"
1066 AC_SUBST(WORKSHOP_SRC)
1067 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1068 AC_SUBST(WORKSHOP_OBJ)
1069 if test "${enable_gui-xxx}" = xxx; then
1070 enable_gui=motif
1071 fi
1072fi
1073
1074AC_MSG_CHECKING(--disable-netbeans argument)
1075AC_ARG_ENABLE(netbeans,
1076 [ --disable-netbeans Disable NetBeans integration support.],
1077 , [enable_netbeans="yes"])
1078if test "$enable_netbeans" = "yes"; then
1079 AC_MSG_RESULT(no)
1080 dnl On Solaris we need the socket and nsl library.
1081 AC_CHECK_LIB(socket, socket)
1082 AC_CHECK_LIB(nsl, gethostbyname)
1083 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1084 AC_TRY_LINK([
1085#include <stdio.h>
1086#include <stdlib.h>
1087#include <stdarg.h>
1088#include <fcntl.h>
1089#include <netdb.h>
1090#include <netinet/in.h>
1091#include <errno.h>
1092#include <sys/types.h>
1093#include <sys/socket.h>
1094 /* Check bitfields */
1095 struct nbbuf {
1096 unsigned int initDone:1;
1097 ushort signmaplen;
1098 };
1099 ], [
1100 /* Check creating a socket. */
1101 struct sockaddr_in server;
1102 (void)socket(AF_INET, SOCK_STREAM, 0);
1103 (void)htons(100);
1104 (void)gethostbyname("microsoft.com");
1105 if (errno == ECONNREFUSED)
1106 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1107 ],
1108 AC_MSG_RESULT(yes),
1109 AC_MSG_RESULT(no); enable_netbeans="no")
1110else
1111 AC_MSG_RESULT(yes)
1112fi
1113if test "$enable_netbeans" = "yes"; then
1114 AC_DEFINE(FEAT_NETBEANS_INTG)
1115 NETBEANS_SRC="netbeans.c"
1116 AC_SUBST(NETBEANS_SRC)
1117 NETBEANS_OBJ="objects/netbeans.o"
1118 AC_SUBST(NETBEANS_OBJ)
1119fi
1120
1121AC_MSG_CHECKING(--enable-sniff argument)
1122AC_ARG_ENABLE(sniff,
1123 [ --enable-sniff Include Sniff interface.], ,
1124 [enable_sniff="no"])
1125AC_MSG_RESULT($enable_sniff)
1126if test "$enable_sniff" = "yes"; then
1127 AC_DEFINE(FEAT_SNIFF)
1128 SNIFF_SRC="if_sniff.c"
1129 AC_SUBST(SNIFF_SRC)
1130 SNIFF_OBJ="objects/if_sniff.o"
1131 AC_SUBST(SNIFF_OBJ)
1132fi
1133
1134AC_MSG_CHECKING(--enable-multibyte argument)
1135AC_ARG_ENABLE(multibyte,
1136 [ --enable-multibyte Include multibyte editing support.], ,
1137 [enable_multibyte="no"])
1138AC_MSG_RESULT($enable_multibyte)
1139if test "$enable_multibyte" = "yes"; then
1140 AC_DEFINE(FEAT_MBYTE)
1141fi
1142
1143AC_MSG_CHECKING(--enable-hangulinput argument)
1144AC_ARG_ENABLE(hangulinput,
1145 [ --enable-hangulinput Include Hangul input support.], ,
1146 [enable_hangulinput="no"])
1147AC_MSG_RESULT($enable_hangulinput)
1148
1149AC_MSG_CHECKING(--enable-xim argument)
1150AC_ARG_ENABLE(xim,
1151 [ --enable-xim Include XIM input support.],
1152 AC_MSG_RESULT($enable_xim),
1153 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
Bram Moolenaar071d4272004-06-13 20:20:40 +00001154
1155AC_MSG_CHECKING(--enable-fontset argument)
1156AC_ARG_ENABLE(fontset,
1157 [ --enable-fontset Include X fontset output support.], ,
1158 [enable_fontset="no"])
1159AC_MSG_RESULT($enable_fontset)
1160dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1161
1162test -z "$with_x" && with_x=yes
1163test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1164if test "$with_x" = no; then
1165 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1166else
1167 dnl Do this check early, so that its failure can override user requests.
1168
1169 AC_PATH_PROG(xmkmfpath, xmkmf)
1170
1171 AC_PATH_XTRA
1172
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001173 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001174 dnl be compiled with a special option.
1175 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001176 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001177 CFLAGS="$CFLAGS -W c,dll"
1178 LDFLAGS="$LDFLAGS -W l,dll"
1179 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1180 fi
1181
1182 dnl On my HPUX system the X include dir is found, but the lib dir not.
1183 dnl This is a desparate try to fix this.
1184
1185 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1186 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1187 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1188 X_LIBS="$X_LIBS -L$x_libraries"
1189 if test "`(uname) 2>/dev/null`" = SunOS &&
1190 uname -r | grep '^5' >/dev/null; then
1191 X_LIBS="$X_LIBS -R $x_libraries"
1192 fi
1193 fi
1194
1195 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1196 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1197 AC_MSG_RESULT(Corrected X includes to $x_includes)
1198 X_CFLAGS="$X_CFLAGS -I$x_includes"
1199 fi
1200
1201 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1202 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1203 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1204 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1205 dnl Same for "-R/usr/lib ".
1206 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1207
1208
1209 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001210 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1211 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001212 AC_MSG_CHECKING(if X11 header files can be found)
1213 cflags_save=$CFLAGS
1214 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001215 AC_TRY_COMPILE([#include <X11/Xlib.h>
1216#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001217 AC_MSG_RESULT(yes),
1218 AC_MSG_RESULT(no); no_x=yes)
1219 CFLAGS=$cflags_save
1220
1221 if test "${no_x-no}" = yes; then
1222 with_x=no
1223 else
1224 AC_DEFINE(HAVE_X11)
1225 X_LIB="-lXt -lX11";
1226 AC_SUBST(X_LIB)
1227
1228 ac_save_LDFLAGS="$LDFLAGS"
1229 LDFLAGS="-L$x_libraries $LDFLAGS"
1230
1231 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1232 dnl For HP-UX 10.20 it must be before -lSM -lICE
1233 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1234 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1235
1236 dnl Some systems need -lnsl -lsocket when testing for ICE.
1237 dnl The check above doesn't do this, try here (again). Also needed to get
1238 dnl them after Xdmcp. link.sh will remove them when not needed.
1239 dnl Check for other function than above to avoid the cached value
1240 AC_CHECK_LIB(ICE, IceOpenConnection,
1241 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1242
1243 dnl Check for -lXpm (needed for some versions of Motif)
1244 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1245 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1246 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1247
1248 dnl Check that the X11 header files don't use implicit declarations
1249 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1250 cflags_save=$CFLAGS
1251 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1252 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1253 AC_MSG_RESULT(no),
1254 CFLAGS="$CFLAGS -Wno-implicit-int"
1255 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1256 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1257 AC_MSG_RESULT(test failed)
1258 )
1259 )
1260 CFLAGS=$cflags_save
1261
1262 LDFLAGS="$ac_save_LDFLAGS"
1263
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001264 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1265 AC_CACHE_VAL(ac_cv_small_wchar_t,
1266 [AC_TRY_RUN([
1267#include <X11/Xlib.h>
1268#if STDC_HEADERS
1269# include <stdlib.h>
1270# include <stddef.h>
1271#endif
1272 main()
1273 {
1274 if (sizeof(wchar_t) <= 2)
1275 exit(1);
1276 exit(0);
1277 }],
1278 ac_cv_small_wchar_t="no",
1279 ac_cv_small_wchar_t="yes",
1280 AC_MSG_ERROR(failed to compile test program))])
1281 AC_MSG_RESULT($ac_cv_small_wchar_t)
1282 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1283 AC_DEFINE(SMALL_WCHAR_T)
1284 fi
1285
Bram Moolenaar071d4272004-06-13 20:20:40 +00001286 fi
1287fi
1288
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001289test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001290
1291AC_MSG_CHECKING(--enable-gui argument)
1292AC_ARG_ENABLE(gui,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001293 [ --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 +00001294
1295dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1296dnl Do not use character classes for portability with old tools.
1297enable_gui_canon=`echo "_$enable_gui" | \
1298 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1299
1300dnl Skip everything by default.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001301SKIP_GTK2=YES
1302SKIP_GNOME=YES
1303SKIP_MOTIF=YES
1304SKIP_ATHENA=YES
1305SKIP_NEXTAW=YES
1306SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001307SKIP_CARBON=YES
1308GUITYPE=NONE
1309
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001310if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001311 SKIP_PHOTON=
1312 case "$enable_gui_canon" in
1313 no) AC_MSG_RESULT(no GUI support)
1314 SKIP_PHOTON=YES ;;
1315 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1316 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1317 photon) AC_MSG_RESULT(Photon GUI support) ;;
1318 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1319 SKIP_PHOTON=YES ;;
1320 esac
1321
1322elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1323 SKIP_CARBON=
1324 case "$enable_gui_canon" in
1325 no) AC_MSG_RESULT(no GUI support)
1326 SKIP_CARBON=YES ;;
1327 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1328 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1329 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1330 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1331 SKIP_CARBON=YES ;;
1332 esac
1333
1334else
1335
Bram Moolenaar071d4272004-06-13 20:20:40 +00001336 case "$enable_gui_canon" in
1337 no|none) AC_MSG_RESULT(no GUI support) ;;
1338 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001339 SKIP_GTK2=
1340 SKIP_GNOME=
1341 SKIP_MOTIF=
1342 SKIP_ATHENA=
1343 SKIP_NEXTAW=
1344 SKIP_CARBON=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001345 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001346 SKIP_GTK2=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001347 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1348 SKIP_GNOME=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001349 SKIP_GTK2=;;
1350 motif) AC_MSG_RESULT(Motif GUI support)
1351 SKIP_MOTIF=;;
1352 athena) AC_MSG_RESULT(Athena GUI support)
1353 SKIP_ATHENA=;;
1354 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1355 SKIP_NEXTAW=;;
1356 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1357 esac
1358
1359fi
1360
Bram Moolenaar071d4272004-06-13 20:20:40 +00001361if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1362 -a "$enable_gui_canon" != "gnome2"; then
1363 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1364 AC_ARG_ENABLE(gtk2-check,
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001365 [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
Bram Moolenaar071d4272004-06-13 20:20:40 +00001366 , enable_gtk2_check="yes")
1367 AC_MSG_RESULT($enable_gtk2_check)
1368 if test "x$enable_gtk2_check" = "xno"; then
1369 SKIP_GTK2=YES
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001370 SKIP_GNOME=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001371 fi
1372fi
1373
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001374if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001375 AC_MSG_CHECKING(whether or not to look for GNOME)
1376 AC_ARG_ENABLE(gnome-check,
1377 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1378 , enable_gnome_check="no")
1379 AC_MSG_RESULT($enable_gnome_check)
1380 if test "x$enable_gnome_check" = "xno"; then
1381 SKIP_GNOME=YES
1382 fi
1383fi
1384
1385if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1386 AC_MSG_CHECKING(whether or not to look for Motif)
1387 AC_ARG_ENABLE(motif-check,
1388 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1389 , enable_motif_check="yes")
1390 AC_MSG_RESULT($enable_motif_check)
1391 if test "x$enable_motif_check" = "xno"; then
1392 SKIP_MOTIF=YES
1393 fi
1394fi
1395
1396if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1397 AC_MSG_CHECKING(whether or not to look for Athena)
1398 AC_ARG_ENABLE(athena-check,
1399 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1400 , enable_athena_check="yes")
1401 AC_MSG_RESULT($enable_athena_check)
1402 if test "x$enable_athena_check" = "xno"; then
1403 SKIP_ATHENA=YES
1404 fi
1405fi
1406
1407if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1408 AC_MSG_CHECKING(whether or not to look for neXtaw)
1409 AC_ARG_ENABLE(nextaw-check,
1410 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1411 , enable_nextaw_check="yes")
1412 AC_MSG_RESULT($enable_nextaw_check);
1413 if test "x$enable_nextaw_check" = "xno"; then
1414 SKIP_NEXTAW=YES
1415 fi
1416fi
1417
1418if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1419 AC_MSG_CHECKING(whether or not to look for Carbon)
1420 AC_ARG_ENABLE(carbon-check,
1421 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1422 , enable_carbon_check="yes")
1423 AC_MSG_RESULT($enable_carbon_check);
1424 if test "x$enable_carbon_check" = "xno"; then
1425 SKIP_CARBON=YES
1426 fi
1427fi
1428
Bram Moolenaar843ee412004-06-30 16:16:41 +00001429
Bram Moolenaar071d4272004-06-13 20:20:40 +00001430if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1431 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001432 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001433 AC_MSG_RESULT(yes);
1434 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001435 if test "$VIMNAME" = "vim"; then
1436 VIMNAME=Vim
1437 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001438
1439 dnl Default install directory is not /usr/local
1440 if test x$prefix = xNONE; then
1441 prefix=/Applications
1442 fi
1443
1444 dnl Sorry for the hard coded default
1445 datadir='${prefix}/Vim.app/Contents/Resources'
1446
Bram Moolenaar071d4272004-06-13 20:20:40 +00001447 dnl skip everything else
Bram Moolenaar071d4272004-06-13 20:20:40 +00001448 SKIP_GTK2=YES;
1449 SKIP_GNOME=YES;
1450 SKIP_MOTIF=YES;
1451 SKIP_ATHENA=YES;
1452 SKIP_NEXTAW=YES;
1453 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001454 SKIP_CARBON=YES
1455fi
1456
Bram Moolenaar071d4272004-06-13 20:20:40 +00001457dnl define an autoconf function to check for a specified version of GTK, and
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001458dnl try to compile/link a GTK program.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001459dnl
1460dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001461dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001462dnl
1463AC_DEFUN(AM_PATH_GTK,
1464[
1465 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1466 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001467 min_gtk_version=ifelse([$1], ,2.2.0,$1)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001468 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1469 no_gtk=""
1470 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1471 && $PKG_CONFIG --exists gtk+-2.0; then
1472 {
1473 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1474 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1475 dnl something like that.
1476 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001477 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001478 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1479 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1480 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1481 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1482 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1483 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1484 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1485 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001486 else
1487 no_gtk=yes
1488 fi
1489
1490 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1491 {
1492 ac_save_CFLAGS="$CFLAGS"
1493 ac_save_LIBS="$LIBS"
1494 CFLAGS="$CFLAGS $GTK_CFLAGS"
1495 LIBS="$LIBS $GTK_LIBS"
1496
1497 dnl
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001498 dnl Now check if the installed GTK is sufficiently new.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001499 dnl
1500 rm -f conf.gtktest
1501 AC_TRY_RUN([
1502#include <gtk/gtk.h>
1503#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001504#if STDC_HEADERS
1505# include <stdlib.h>
1506# include <stddef.h>
1507#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001508
1509int
1510main ()
1511{
1512int major, minor, micro;
1513char *tmp_version;
1514
1515system ("touch conf.gtktest");
1516
1517/* HP/UX 9 (%@#!) writes to sscanf strings */
1518tmp_version = g_strdup("$min_gtk_version");
1519if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1520 printf("%s, bad version string\n", "$min_gtk_version");
1521 exit(1);
1522 }
1523
1524if ((gtk_major_version > major) ||
1525 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1526 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1527 (gtk_micro_version >= micro)))
1528{
1529 return 0;
1530}
1531return 1;
1532}
1533],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1534 CFLAGS="$ac_save_CFLAGS"
1535 LIBS="$ac_save_LIBS"
1536 }
1537 fi
1538 if test "x$no_gtk" = x ; then
1539 if test "x$enable_gtktest" = "xyes"; then
1540 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1541 else
1542 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1543 fi
1544 ifelse([$2], , :, [$2])
1545 else
1546 {
1547 AC_MSG_RESULT(no)
1548 GTK_CFLAGS=""
1549 GTK_LIBS=""
1550 ifelse([$3], , :, [$3])
1551 }
1552 fi
1553 }
1554 else
1555 GTK_CFLAGS=""
1556 GTK_LIBS=""
1557 ifelse([$3], , :, [$3])
1558 fi
1559 AC_SUBST(GTK_CFLAGS)
1560 AC_SUBST(GTK_LIBS)
1561 rm -f conf.gtktest
1562])
1563
1564dnl ---------------------------------------------------------------------------
1565dnl gnome
1566dnl ---------------------------------------------------------------------------
1567AC_DEFUN([GNOME_INIT_HOOK],
1568[
1569 AC_SUBST(GNOME_LIBS)
1570 AC_SUBST(GNOME_LIBDIR)
1571 AC_SUBST(GNOME_INCLUDEDIR)
1572
1573 AC_ARG_WITH(gnome-includes,
1574 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1575 [CFLAGS="$CFLAGS -I$withval"]
1576 )
1577
1578 AC_ARG_WITH(gnome-libs,
1579 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1580 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1581 )
1582
1583 AC_ARG_WITH(gnome,
1584 [ --with-gnome Specify prefix for GNOME files],
1585 if test x$withval = xyes; then
1586 want_gnome=yes
1587 ifelse([$1], [], :, [$1])
1588 else
1589 if test "x$withval" = xno; then
1590 want_gnome=no
1591 else
1592 want_gnome=yes
1593 LDFLAGS="$LDFLAGS -L$withval/lib"
1594 CFLAGS="$CFLAGS -I$withval/include"
1595 gnome_prefix=$withval/lib
1596 fi
1597 fi,
1598 want_gnome=yes)
1599
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001600 if test "x$want_gnome" = xyes; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001601 {
1602 AC_MSG_CHECKING(for libgnomeui-2.0)
1603 if $PKG_CONFIG --exists libgnomeui-2.0; then
1604 AC_MSG_RESULT(yes)
1605 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1606 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1607 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001608
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001609 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1610 dnl This might not be the right way but it works for me...
1611 AC_MSG_CHECKING(for FreeBSD)
1612 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1613 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001614 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001615 GNOME_LIBS="$GNOME_LIBS -pthread"
1616 else
1617 AC_MSG_RESULT(no)
1618 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001619 $1
1620 else
1621 AC_MSG_RESULT(not found)
1622 if test "x$2" = xfail; then
1623 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1624 fi
1625 fi
1626 }
Bram Moolenaar071d4272004-06-13 20:20:40 +00001627 fi
1628])
1629
1630AC_DEFUN([GNOME_INIT],[
1631 GNOME_INIT_HOOK([],fail)
1632])
1633
1634
1635dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001636dnl Check for GTK2. If it fails, then continue on for Motif as before...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001637dnl ---------------------------------------------------------------------------
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001638if test -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001639
1640 AC_MSG_CHECKING(--disable-gtktest argument)
1641 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1642 , enable_gtktest=yes)
1643 if test "x$enable_gtktest" = "xyes" ; then
1644 AC_MSG_RESULT(gtk test enabled)
1645 else
1646 AC_MSG_RESULT(gtk test disabled)
1647 fi
1648
Bram Moolenaar071d4272004-06-13 20:20:40 +00001649 if test "X$PKG_CONFIG" = "X"; then
1650 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1651 fi
1652
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001653 if test "x$PKG_CONFIG" != "xno"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001654 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1655 dnl problems (bold fonts, --remote doesn't work).
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001656 AM_PATH_GTK(2.2.0,
1657 [GUI_LIB_LOC="$GTK_LIBDIR"
1658 GTK_LIBNAME="$GTK_LIBS"
1659 GUI_INC_LOC="$GTK_CFLAGS"], )
1660 if test "x$GTK_CFLAGS" != "x"; then
1661 SKIP_ATHENA=YES
1662 SKIP_NEXTAW=YES
1663 SKIP_MOTIF=YES
1664 GUITYPE=GTK
1665 AC_SUBST(GTK_LIBNAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001666 fi
1667 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001668 if test "x$GUITYPE" = "xGTK"; then
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001669 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1670 || test "0$gtk_minor_version" -ge 2; then
1671 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1672 fi
1673 dnl
1674 dnl if GTK exists, then check for GNOME.
1675 dnl
1676 if test -z "$SKIP_GNOME"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001677 {
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001678 GNOME_INIT_HOOK([have_gnome=yes])
1679 if test "x$have_gnome" = xyes ; then
1680 AC_DEFINE(FEAT_GUI_GNOME)
1681 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1682 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001683 fi
1684 }
1685 fi
1686 fi
1687fi
1688
1689dnl Check for Motif include files location.
1690dnl The LAST one found is used, this makes the highest version to be used,
1691dnl e.g. when Motif1.2 and Motif2.0 are both present.
1692
1693if test -z "$SKIP_MOTIF"; then
1694 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"
1695 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1696 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1697
1698 AC_MSG_CHECKING(for location of Motif GUI includes)
1699 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1700 GUI_INC_LOC=
1701 for try in $gui_includes; do
1702 if test -f "$try/Xm/Xm.h"; then
1703 GUI_INC_LOC=$try
1704 fi
1705 done
1706 if test -n "$GUI_INC_LOC"; then
1707 if test "$GUI_INC_LOC" = /usr/include; then
1708 GUI_INC_LOC=
1709 AC_MSG_RESULT(in default path)
1710 else
1711 AC_MSG_RESULT($GUI_INC_LOC)
1712 fi
1713 else
1714 AC_MSG_RESULT(<not found>)
1715 SKIP_MOTIF=YES
1716 fi
1717fi
1718
1719dnl Check for Motif library files location. In the same order as the include
1720dnl files, to avoid a mixup if several versions are present
1721
1722if test -z "$SKIP_MOTIF"; then
1723 AC_MSG_CHECKING(--with-motif-lib argument)
1724 AC_ARG_WITH(motif-lib,
1725 [ --with-motif-lib=STRING Library for Motif ],
1726 [ MOTIF_LIBNAME="${withval}" ] )
1727
1728 if test -n "$MOTIF_LIBNAME"; then
1729 AC_MSG_RESULT($MOTIF_LIBNAME)
1730 GUI_LIB_LOC=
1731 else
1732 AC_MSG_RESULT(no)
1733
1734 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1735 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1736
1737 AC_MSG_CHECKING(for location of Motif GUI libs)
1738 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"
1739 GUI_LIB_LOC=
1740 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001741 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00001742 if test -f "$libtry"; then
1743 GUI_LIB_LOC=$try
1744 fi
1745 done
1746 done
1747 if test -n "$GUI_LIB_LOC"; then
1748 dnl Remove /usr/lib, it causes trouble on some systems
1749 if test "$GUI_LIB_LOC" = /usr/lib; then
1750 GUI_LIB_LOC=
1751 AC_MSG_RESULT(in default path)
1752 else
1753 if test -n "$GUI_LIB_LOC"; then
1754 AC_MSG_RESULT($GUI_LIB_LOC)
1755 if test "`(uname) 2>/dev/null`" = SunOS &&
1756 uname -r | grep '^5' >/dev/null; then
1757 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1758 fi
1759 fi
1760 fi
1761 MOTIF_LIBNAME=-lXm
1762 else
1763 AC_MSG_RESULT(<not found>)
1764 SKIP_MOTIF=YES
1765 fi
1766 fi
1767fi
1768
1769if test -z "$SKIP_MOTIF"; then
1770 SKIP_ATHENA=YES
1771 SKIP_NEXTAW=YES
1772 GUITYPE=MOTIF
1773 AC_SUBST(MOTIF_LIBNAME)
1774fi
1775
1776dnl Check if the Athena files can be found
1777
1778GUI_X_LIBS=
1779
1780if test -z "$SKIP_ATHENA"; then
1781 AC_MSG_CHECKING(if Athena header files can be found)
1782 cflags_save=$CFLAGS
1783 CFLAGS="$CFLAGS $X_CFLAGS"
1784 AC_TRY_COMPILE([
1785#include <X11/Intrinsic.h>
1786#include <X11/Xaw/Paned.h>], ,
1787 AC_MSG_RESULT(yes),
1788 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1789 CFLAGS=$cflags_save
1790fi
1791
1792if test -z "$SKIP_ATHENA"; then
1793 GUITYPE=ATHENA
1794fi
1795
1796if test -z "$SKIP_NEXTAW"; then
1797 AC_MSG_CHECKING(if neXtaw header files can be found)
1798 cflags_save=$CFLAGS
1799 CFLAGS="$CFLAGS $X_CFLAGS"
1800 AC_TRY_COMPILE([
1801#include <X11/Intrinsic.h>
1802#include <X11/neXtaw/Paned.h>], ,
1803 AC_MSG_RESULT(yes),
1804 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1805 CFLAGS=$cflags_save
1806fi
1807
1808if test -z "$SKIP_NEXTAW"; then
1809 GUITYPE=NEXTAW
1810fi
1811
1812if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1813 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1814 dnl Avoid adding it when it twice
1815 if test -n "$GUI_INC_LOC"; then
1816 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1817 fi
1818 if test -n "$GUI_LIB_LOC"; then
1819 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1820 fi
1821
1822 dnl Check for -lXext and then for -lXmu
1823 ldflags_save=$LDFLAGS
1824 LDFLAGS="$X_LIBS $LDFLAGS"
1825 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1826 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1827 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1828 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1829 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1830 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1831 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1832 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1833 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1834 if test -z "$SKIP_MOTIF"; then
1835 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1836 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1837 fi
1838 LDFLAGS=$ldflags_save
1839
1840 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1841 AC_MSG_CHECKING(for extra X11 defines)
1842 NARROW_PROTO=
1843 rm -fr conftestdir
1844 if mkdir conftestdir; then
1845 cd conftestdir
1846 cat > Imakefile <<'EOF'
1847acfindx:
1848 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
1849EOF
1850 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1851 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
1852 fi
1853 cd ..
1854 rm -fr conftestdir
1855 fi
1856 if test -z "$NARROW_PROTO"; then
1857 AC_MSG_RESULT(no)
1858 else
1859 AC_MSG_RESULT($NARROW_PROTO)
1860 fi
1861 AC_SUBST(NARROW_PROTO)
1862fi
1863
1864dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
1865dnl use the X11 include path
1866if test "$enable_xsmp" = "yes"; then
1867 cppflags_save=$CPPFLAGS
1868 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1869 AC_CHECK_HEADERS(X11/SM/SMlib.h)
1870 CPPFLAGS=$cppflags_save
1871fi
1872
1873
Bram Moolenaare667c952010-07-05 22:57:59 +02001874if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001875 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
1876 cppflags_save=$CPPFLAGS
1877 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1878 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
1879
1880 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
1881 if test ! "$enable_xim" = "no"; then
1882 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
1883 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
1884 AC_MSG_RESULT(yes),
1885 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
1886 fi
1887 CPPFLAGS=$cppflags_save
1888
1889 dnl automatically enable XIM when hangul input isn't enabled
1890 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
1891 -a "x$GUITYPE" != "xNONE" ; then
1892 AC_MSG_RESULT(X GUI selected; xim has been enabled)
1893 enable_xim="yes"
1894 fi
1895fi
1896
1897if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1898 cppflags_save=$CPPFLAGS
1899 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001900dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
1901 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
1902 AC_TRY_COMPILE([
1903#include <X11/Intrinsic.h>
1904#include <X11/Xmu/Editres.h>],
1905 [int i; i = 0;],
1906 AC_MSG_RESULT(yes)
1907 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
1908 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001909 CPPFLAGS=$cppflags_save
1910fi
1911
1912dnl Only use the Xm directory when compiling Motif, don't use it for Athena
1913if test -z "$SKIP_MOTIF"; then
1914 cppflags_save=$CPPFLAGS
1915 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001916 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 +00001917 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001918
1919 if test $ac_cv_header_Xm_XpmP_h = yes; then
1920 dnl Solaris uses XpmAttributes_21, very annoying.
1921 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
1922 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
1923 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
1924 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
1925 )
1926 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00001927 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001928 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001929 CPPFLAGS=$cppflags_save
1930fi
1931
1932if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
1933 AC_MSG_RESULT(no GUI selected; xim has been disabled)
1934 enable_xim="no"
1935fi
1936if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
1937 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
1938 enable_fontset="no"
1939fi
Bram Moolenaar182c5be2010-06-25 05:37:59 +02001940if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001941 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
1942 enable_fontset="no"
1943fi
1944
Bram Moolenaar071d4272004-06-13 20:20:40 +00001945if test -z "$SKIP_PHOTON"; then
1946 GUITYPE=PHOTONGUI
1947fi
1948
1949AC_SUBST(GUI_INC_LOC)
1950AC_SUBST(GUI_LIB_LOC)
1951AC_SUBST(GUITYPE)
1952AC_SUBST(GUI_X_LIBS)
1953
1954if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
1955 AC_MSG_ERROR([cannot use workshop without Motif])
1956fi
1957
1958dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
1959if test "$enable_xim" = "yes"; then
1960 AC_DEFINE(FEAT_XIM)
1961fi
1962if test "$enable_fontset" = "yes"; then
1963 AC_DEFINE(FEAT_XFONTSET)
1964fi
1965
1966
1967dnl ---------------------------------------------------------------------------
1968dnl end of GUI-checking
1969dnl ---------------------------------------------------------------------------
1970
1971
1972dnl Only really enable hangul input when GUI and XFONTSET are available
1973if test "$enable_hangulinput" = "yes"; then
1974 if test "x$GUITYPE" = "xNONE"; then
1975 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
1976 enable_hangulinput=no
1977 else
1978 AC_DEFINE(FEAT_HANGULIN)
1979 HANGULIN_SRC=hangulin.c
1980 AC_SUBST(HANGULIN_SRC)
1981 HANGULIN_OBJ=objects/hangulin.o
1982 AC_SUBST(HANGULIN_OBJ)
1983 fi
1984fi
1985
1986dnl Checks for libraries and include files.
1987
Bram Moolenaar446cb832008-06-24 21:56:24 +00001988AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
1989 [
1990 AC_RUN_IFELSE([[
1991#include "confdefs.h"
1992#include <ctype.h>
1993#if STDC_HEADERS
1994# include <stdlib.h>
1995# include <stddef.h>
1996#endif
1997main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
1998 ]],[
1999 vim_cv_toupper_broken=yes
2000 ],[
2001 vim_cv_toupper_broken=no
2002 ],[
2003 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2004 ])])
2005
2006if test "x$vim_cv_toupper_broken" = "xyes" ; then
2007 AC_DEFINE(BROKEN_TOUPPER)
2008fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002009
2010AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002011AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002012 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2013 AC_MSG_RESULT(no))
2014
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002015AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2016AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2017 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2018 AC_MSG_RESULT(no))
2019
Bram Moolenaar071d4272004-06-13 20:20:40 +00002020dnl Checks for header files.
2021AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2022dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2023if test "$HAS_ELF" = 1; then
2024 AC_CHECK_LIB(elf, main)
2025fi
2026
2027AC_HEADER_DIRENT
2028
Bram Moolenaar071d4272004-06-13 20:20:40 +00002029dnl If sys/wait.h is not found it might still exist but not be POSIX
2030dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2031if test $ac_cv_header_sys_wait_h = no; then
2032 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2033 AC_TRY_COMPILE([#include <sys/wait.h>],
2034 [union wait xx, yy; xx = yy],
2035 AC_MSG_RESULT(yes)
2036 AC_DEFINE(HAVE_SYS_WAIT_H)
2037 AC_DEFINE(HAVE_UNION_WAIT),
2038 AC_MSG_RESULT(no))
2039fi
2040
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002041AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2042 sys/select.h sys/utsname.h termcap.h fcntl.h \
2043 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2044 termio.h iconv.h inttypes.h langinfo.h math.h \
2045 unistd.h stropts.h errno.h sys/resource.h \
2046 sys/systeminfo.h locale.h sys/stream.h termios.h \
2047 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2048 utime.h sys/param.h libintl.h libgen.h \
2049 util/debug.h util/msg18n.h frame.h sys/acl.h \
2050 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002051
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002052dnl sys/ptem.h depends on sys/stream.h on Solaris
2053AC_CHECK_HEADERS(sys/ptem.h, [], [],
2054[#if defined HAVE_SYS_STREAM_H
2055# include <sys/stream.h>
2056#endif])
2057
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002058dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2059AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2060[#if defined HAVE_SYS_PARAM_H
2061# include <sys/param.h>
2062#endif])
2063
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002064
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002065dnl pthread_np.h may exist but can only be used after including pthread.h
2066AC_MSG_CHECKING([for pthread_np.h])
2067AC_TRY_COMPILE([
2068#include <pthread.h>
2069#include <pthread_np.h>],
2070 [int i; i = 0;],
2071 AC_MSG_RESULT(yes)
2072 AC_DEFINE(HAVE_PTHREAD_NP_H),
2073 AC_MSG_RESULT(no))
2074
Bram Moolenaare344bea2005-09-01 20:46:49 +00002075AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002076if test "x$MACOSX" = "xyes"; then
2077 dnl The strings.h file on OS/X contains a warning and nothing useful.
2078 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2079else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002080
2081dnl Check if strings.h and string.h can both be included when defined.
2082AC_MSG_CHECKING([if strings.h can be included after string.h])
2083cppflags_save=$CPPFLAGS
2084CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2085AC_TRY_COMPILE([
2086#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2087# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2088 /* but don't do it on AIX 5.1 (Uribarri) */
2089#endif
2090#ifdef HAVE_XM_XM_H
2091# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2092#endif
2093#ifdef HAVE_STRING_H
2094# include <string.h>
2095#endif
2096#if defined(HAVE_STRINGS_H)
2097# include <strings.h>
2098#endif
2099 ], [int i; i = 0;],
2100 AC_MSG_RESULT(yes),
2101 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2102 AC_MSG_RESULT(no))
2103CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002104fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002105
2106dnl Checks for typedefs, structures, and compiler characteristics.
2107AC_PROG_GCC_TRADITIONAL
2108AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002109AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002110AC_TYPE_MODE_T
2111AC_TYPE_OFF_T
2112AC_TYPE_PID_T
2113AC_TYPE_SIZE_T
2114AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002115AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002116
Bram Moolenaar071d4272004-06-13 20:20:40 +00002117AC_HEADER_TIME
2118AC_CHECK_TYPE(ino_t, long)
2119AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002120AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002121
2122AC_MSG_CHECKING(for rlim_t)
2123if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2124 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2125else
2126 AC_EGREP_CPP(dnl
2127changequote(<<,>>)dnl
2128<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2129changequote([,]),
2130 [
2131#include <sys/types.h>
2132#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002133# include <stdlib.h>
2134# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002135#endif
2136#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002137# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002138#endif
2139 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2140 AC_MSG_RESULT($ac_cv_type_rlim_t)
2141fi
2142if test $ac_cv_type_rlim_t = no; then
2143 cat >> confdefs.h <<\EOF
2144#define rlim_t unsigned long
2145EOF
2146fi
2147
2148AC_MSG_CHECKING(for stack_t)
2149if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2150 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2151else
2152 AC_EGREP_CPP(stack_t,
2153 [
2154#include <sys/types.h>
2155#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002156# include <stdlib.h>
2157# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002158#endif
2159#include <signal.h>
2160 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2161 AC_MSG_RESULT($ac_cv_type_stack_t)
2162fi
2163if test $ac_cv_type_stack_t = no; then
2164 cat >> confdefs.h <<\EOF
2165#define stack_t struct sigaltstack
2166EOF
2167fi
2168
2169dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2170AC_MSG_CHECKING(whether stack_t has an ss_base field)
2171AC_TRY_COMPILE([
2172#include <sys/types.h>
2173#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002174# include <stdlib.h>
2175# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002176#endif
2177#include <signal.h>
2178#include "confdefs.h"
2179 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2180 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2181 AC_MSG_RESULT(no))
2182
2183olibs="$LIBS"
2184AC_MSG_CHECKING(--with-tlib argument)
2185AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2186if test -n "$with_tlib"; then
2187 AC_MSG_RESULT($with_tlib)
2188 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002189 AC_MSG_CHECKING(for linking with $with_tlib library)
2190 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2191 dnl Need to check for tgetent() below.
2192 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002193else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002194 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002195 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2196 dnl curses, because curses is much slower.
2197 dnl Newer versions of ncurses are preferred over anything.
2198 dnl Older versions of ncurses have bugs, get a new one!
2199 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002200 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002201 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002202 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002203 *) tlibs="ncurses termlib termcap curses";;
2204 esac
2205 for libname in $tlibs; do
2206 AC_CHECK_LIB(${libname}, tgetent,,)
2207 if test "x$olibs" != "x$LIBS"; then
2208 dnl It's possible that a library is found but it doesn't work
2209 dnl e.g., shared library that cannot be found
2210 dnl compile and run a test program to be sure
2211 AC_TRY_RUN([
2212#ifdef HAVE_TERMCAP_H
2213# include <termcap.h>
2214#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002215#if STDC_HEADERS
2216# include <stdlib.h>
2217# include <stddef.h>
2218#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002219main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2220 res="OK", res="FAIL", res="FAIL")
2221 if test "$res" = "OK"; then
2222 break
2223 fi
2224 AC_MSG_RESULT($libname library is not usable)
2225 LIBS="$olibs"
2226 fi
2227 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002228 if test "x$olibs" = "x$LIBS"; then
2229 AC_MSG_RESULT(no terminal library found)
2230 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002231fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002232
2233if test "x$olibs" = "x$LIBS"; then
2234 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002235 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002236 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2237 AC_MSG_RESULT(yes),
2238 AC_MSG_ERROR([NOT FOUND!
2239 You need to install a terminal library; for example ncurses.
2240 Or specify the name of the library with --with-tlib.]))
2241fi
2242
Bram Moolenaar446cb832008-06-24 21:56:24 +00002243AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2244 [
2245 AC_RUN_IFELSE([[
2246#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002247#ifdef HAVE_TERMCAP_H
2248# include <termcap.h>
2249#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002250#ifdef HAVE_STRING_H
2251# include <string.h>
2252#endif
2253#if STDC_HEADERS
2254# include <stdlib.h>
2255# include <stddef.h>
2256#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002257main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002258{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2259 ]],[
2260 vim_cv_terminfo=no
2261 ],[
2262 vim_cv_terminfo=yes
2263 ],[
2264 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2265 ])
2266 ])
2267
2268if test "x$vim_cv_terminfo" = "xyes" ; then
2269 AC_DEFINE(TERMINFO)
2270fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002271
2272if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002273 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2274 [
2275 AC_RUN_IFELSE([[
2276#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002277#ifdef HAVE_TERMCAP_H
2278# include <termcap.h>
2279#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002280#if STDC_HEADERS
2281# include <stdlib.h>
2282# include <stddef.h>
2283#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002284main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002285{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2286 ]],[
2287 vim_cv_tgent=zero
2288 ],[
2289 vim_cv_tgent=non-zero
2290 ],[
2291 AC_MSG_ERROR(failed to compile test program.)
2292 ])
2293 ])
2294
2295 if test "x$vim_cv_tgent" = "xzero" ; then
2296 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2297 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002298fi
2299
2300AC_MSG_CHECKING(whether termcap.h contains ospeed)
2301AC_TRY_LINK([
2302#ifdef HAVE_TERMCAP_H
2303# include <termcap.h>
2304#endif
2305 ], [ospeed = 20000],
2306 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2307 [AC_MSG_RESULT(no)
2308 AC_MSG_CHECKING(whether ospeed can be extern)
2309 AC_TRY_LINK([
2310#ifdef HAVE_TERMCAP_H
2311# include <termcap.h>
2312#endif
2313extern short ospeed;
2314 ], [ospeed = 20000],
2315 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2316 AC_MSG_RESULT(no))]
2317 )
2318
2319AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2320AC_TRY_LINK([
2321#ifdef HAVE_TERMCAP_H
2322# include <termcap.h>
2323#endif
2324 ], [if (UP == 0 && BC == 0) PC = 1],
2325 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2326 [AC_MSG_RESULT(no)
2327 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2328 AC_TRY_LINK([
2329#ifdef HAVE_TERMCAP_H
2330# include <termcap.h>
2331#endif
2332extern char *UP, *BC, PC;
2333 ], [if (UP == 0 && BC == 0) PC = 1],
2334 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2335 AC_MSG_RESULT(no))]
2336 )
2337
2338AC_MSG_CHECKING(whether tputs() uses outfuntype)
2339AC_TRY_COMPILE([
2340#ifdef HAVE_TERMCAP_H
2341# include <termcap.h>
2342#endif
2343 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2344 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2345 AC_MSG_RESULT(no))
2346
2347dnl On some SCO machines sys/select redefines struct timeval
2348AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2349AC_TRY_COMPILE([
2350#include <sys/types.h>
2351#include <sys/time.h>
2352#include <sys/select.h>], ,
2353 AC_MSG_RESULT(yes)
2354 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2355 AC_MSG_RESULT(no))
2356
2357dnl AC_DECL_SYS_SIGLIST
2358
2359dnl Checks for pty.c (copied from screen) ==========================
2360AC_MSG_CHECKING(for /dev/ptc)
2361if test -r /dev/ptc; then
2362 AC_DEFINE(HAVE_DEV_PTC)
2363 AC_MSG_RESULT(yes)
2364else
2365 AC_MSG_RESULT(no)
2366fi
2367
2368AC_MSG_CHECKING(for SVR4 ptys)
2369if test -c /dev/ptmx ; then
2370 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2371 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2372 AC_MSG_RESULT(no))
2373else
2374 AC_MSG_RESULT(no)
2375fi
2376
2377AC_MSG_CHECKING(for ptyranges)
2378if test -d /dev/ptym ; then
2379 pdir='/dev/ptym'
2380else
2381 pdir='/dev'
2382fi
2383dnl SCO uses ptyp%d
2384AC_EGREP_CPP(yes,
2385[#ifdef M_UNIX
2386 yes;
2387#endif
2388 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2389dnl if test -c /dev/ptyp19; then
2390dnl ptys=`echo /dev/ptyp??`
2391dnl else
2392dnl ptys=`echo $pdir/pty??`
2393dnl fi
2394if test "$ptys" != "$pdir/pty??" ; then
2395 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2396 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2397 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2398 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2399 AC_MSG_RESULT([$p0 / $p1])
2400else
2401 AC_MSG_RESULT([don't know])
2402fi
2403
2404dnl **** pty mode/group handling ****
2405dnl
2406dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002407rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002408AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2409 [
2410 AC_RUN_IFELSE([[
2411#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002412#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002413#if STDC_HEADERS
2414# include <stdlib.h>
2415# include <stddef.h>
2416#endif
2417#ifdef HAVE_UNISTD_H
2418#include <unistd.h>
2419#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002420#include <sys/stat.h>
2421#include <stdio.h>
2422main()
2423{
2424 struct stat sb;
2425 char *x,*ttyname();
2426 int om, m;
2427 FILE *fp;
2428
2429 if (!(x = ttyname(0))) exit(1);
2430 if (stat(x, &sb)) exit(1);
2431 om = sb.st_mode;
2432 if (om & 002) exit(0);
2433 m = system("mesg y");
2434 if (m == -1 || m == 127) exit(1);
2435 if (stat(x, &sb)) exit(1);
2436 m = sb.st_mode;
2437 if (chmod(x, om)) exit(1);
2438 if (m & 002) exit(0);
2439 if (sb.st_gid == getgid()) exit(1);
2440 if (!(fp=fopen("conftest_grp", "w")))
2441 exit(1);
2442 fprintf(fp, "%d\n", sb.st_gid);
2443 fclose(fp);
2444 exit(0);
2445}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002446 ]],[
2447 if test -f conftest_grp; then
2448 vim_cv_tty_group=`cat conftest_grp`
2449 if test "x$vim_cv_tty_mode" = "x" ; then
2450 vim_cv_tty_mode=0620
2451 fi
2452 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2453 else
2454 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002455 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002456 fi
2457 ],[
2458 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002459 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002460 ],[
2461 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2462 ])
2463 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002464rm -f conftest_grp
2465
Bram Moolenaar446cb832008-06-24 21:56:24 +00002466if test "x$vim_cv_tty_group" != "xworld" ; then
2467 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2468 if test "x$vim_cv_tty_mode" = "x" ; then
2469 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)])
2470 else
2471 AC_DEFINE(PTYMODE, 0620)
2472 fi
2473fi
2474
Bram Moolenaar071d4272004-06-13 20:20:40 +00002475dnl Checks for library functions. ===================================
2476
2477AC_TYPE_SIGNAL
2478
2479dnl find out what to use at the end of a signal function
2480if test $ac_cv_type_signal = void; then
2481 AC_DEFINE(SIGRETURN, [return])
2482else
2483 AC_DEFINE(SIGRETURN, [return 0])
2484fi
2485
2486dnl check if struct sigcontext is defined (used for SGI only)
2487AC_MSG_CHECKING(for struct sigcontext)
2488AC_TRY_COMPILE([
2489#include <signal.h>
2490test_sig()
2491{
2492 struct sigcontext *scont;
2493 scont = (struct sigcontext *)0;
2494 return 1;
2495} ], ,
2496 AC_MSG_RESULT(yes)
2497 AC_DEFINE(HAVE_SIGCONTEXT),
2498 AC_MSG_RESULT(no))
2499
2500dnl tricky stuff: try to find out if getcwd() is implemented with
2501dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002502AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2503 [
2504 AC_RUN_IFELSE([[
2505#include "confdefs.h"
2506#ifdef HAVE_UNISTD_H
2507#include <unistd.h>
2508#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002509char *dagger[] = { "IFS=pwd", 0 };
2510main()
2511{
2512 char buffer[500];
2513 extern char **environ;
2514 environ = dagger;
2515 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002516}
2517 ]],[
2518 vim_cv_getcwd_broken=no
2519 ],[
2520 vim_cv_getcwd_broken=yes
2521 ],[
2522 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2523 ])
2524 ])
2525
2526if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2527 AC_DEFINE(BAD_GETCWD)
2528fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002529
Bram Moolenaar25153e12010-02-24 14:47:08 +01002530dnl Check for functions in one big call, to reduce the size of configure.
2531dnl Can only be used for functions that do not require any include.
2532AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002533 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002534 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002535 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002536 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002537 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2538 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002539AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002540
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002541dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2542dnl appropriate, so that off_t is 64 bits when needed.
2543AC_SYS_LARGEFILE
2544
Bram Moolenaar071d4272004-06-13 20:20:40 +00002545dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2546AC_MSG_CHECKING(for st_blksize)
2547AC_TRY_COMPILE(
2548[#include <sys/types.h>
2549#include <sys/stat.h>],
2550[ struct stat st;
2551 int n;
2552
2553 stat("/", &st);
2554 n = (int)st.st_blksize;],
2555 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2556 AC_MSG_RESULT(no))
2557
Bram Moolenaar446cb832008-06-24 21:56:24 +00002558AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2559 [
2560 AC_RUN_IFELSE([[
2561#include "confdefs.h"
2562#if STDC_HEADERS
2563# include <stdlib.h>
2564# include <stddef.h>
2565#endif
2566#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002567#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002568main() {struct stat st; exit(stat("configure/", &st) != 0); }
2569 ]],[
2570 vim_cv_stat_ignores_slash=yes
2571 ],[
2572 vim_cv_stat_ignores_slash=no
2573 ],[
2574 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2575 ])
2576 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002577
Bram Moolenaar446cb832008-06-24 21:56:24 +00002578if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2579 AC_DEFINE(STAT_IGNORES_SLASH)
2580fi
2581
Bram Moolenaar071d4272004-06-13 20:20:40 +00002582dnl Link with iconv for charset translation, if not found without library.
2583dnl check for iconv() requires including iconv.h
2584dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2585dnl has been installed.
2586AC_MSG_CHECKING(for iconv_open())
2587save_LIBS="$LIBS"
2588LIBS="$LIBS -liconv"
2589AC_TRY_LINK([
2590#ifdef HAVE_ICONV_H
2591# include <iconv.h>
2592#endif
2593 ], [iconv_open("fr", "to");],
2594 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2595 LIBS="$save_LIBS"
2596 AC_TRY_LINK([
2597#ifdef HAVE_ICONV_H
2598# include <iconv.h>
2599#endif
2600 ], [iconv_open("fr", "to");],
2601 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2602 AC_MSG_RESULT(no)))
2603
2604
2605AC_MSG_CHECKING(for nl_langinfo(CODESET))
2606AC_TRY_LINK([
2607#ifdef HAVE_LANGINFO_H
2608# include <langinfo.h>
2609#endif
2610], [char *cs = nl_langinfo(CODESET);],
2611 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2612 AC_MSG_RESULT(no))
2613
Bram Moolenaar446cb832008-06-24 21:56:24 +00002614dnl Need various functions for floating point support. Only enable
2615dnl floating point when they are all present.
2616AC_CHECK_LIB(m, strtod)
2617AC_MSG_CHECKING([for strtod() and other floating point functions])
2618AC_TRY_LINK([
2619#ifdef HAVE_MATH_H
2620# include <math.h>
2621#endif
2622#if STDC_HEADERS
2623# include <stdlib.h>
2624# include <stddef.h>
2625#endif
2626], [char *s; double d;
2627 d = strtod("1.1", &s);
2628 d = fabs(1.11);
2629 d = ceil(1.11);
2630 d = floor(1.11);
2631 d = log10(1.11);
2632 d = pow(1.11, 2.22);
2633 d = sqrt(1.11);
2634 d = sin(1.11);
2635 d = cos(1.11);
2636 d = atan(1.11);
2637 ],
2638 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2639 AC_MSG_RESULT(no))
2640
Bram Moolenaar071d4272004-06-13 20:20:40 +00002641dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2642dnl when -lacl works, also try to use -lattr (required for Debian).
2643AC_MSG_CHECKING(--disable-acl argument)
2644AC_ARG_ENABLE(acl,
2645 [ --disable-acl Don't check for ACL support.],
2646 , [enable_acl="yes"])
2647if test "$enable_acl" = "yes"; then
2648AC_MSG_RESULT(no)
2649AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2650 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2651 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2652
2653AC_MSG_CHECKING(for POSIX ACL support)
2654AC_TRY_LINK([
2655#include <sys/types.h>
2656#ifdef HAVE_SYS_ACL_H
2657# include <sys/acl.h>
2658#endif
2659acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2660 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2661 acl_free(acl);],
2662 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2663 AC_MSG_RESULT(no))
2664
2665AC_MSG_CHECKING(for Solaris ACL support)
2666AC_TRY_LINK([
2667#ifdef HAVE_SYS_ACL_H
2668# include <sys/acl.h>
2669#endif], [acl("foo", GETACLCNT, 0, NULL);
2670 ],
2671 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2672 AC_MSG_RESULT(no))
2673
2674AC_MSG_CHECKING(for AIX ACL support)
2675AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002676#if STDC_HEADERS
2677# include <stdlib.h>
2678# include <stddef.h>
2679#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002680#ifdef HAVE_SYS_ACL_H
2681# include <sys/acl.h>
2682#endif
2683#ifdef HAVE_SYS_ACCESS_H
2684# include <sys/access.h>
2685#endif
2686#define _ALL_SOURCE
2687
2688#include <sys/stat.h>
2689
2690int aclsize;
2691struct acl *aclent;], [aclsize = sizeof(struct acl);
2692 aclent = (void *)malloc(aclsize);
2693 statacl("foo", STX_NORMAL, aclent, aclsize);
2694 ],
2695 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2696 AC_MSG_RESULT(no))
2697else
2698 AC_MSG_RESULT(yes)
2699fi
2700
2701AC_MSG_CHECKING(--disable-gpm argument)
2702AC_ARG_ENABLE(gpm,
2703 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2704 [enable_gpm="yes"])
2705
2706if test "$enable_gpm" = "yes"; then
2707 AC_MSG_RESULT(no)
2708 dnl Checking if gpm support can be compiled
2709 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2710 [olibs="$LIBS" ; LIBS="-lgpm"]
2711 AC_TRY_LINK(
2712 [#include <gpm.h>
2713 #include <linux/keyboard.h>],
2714 [Gpm_GetLibVersion(NULL);],
2715 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2716 dnl FEAT_MOUSE_GPM if mouse support is included
2717 [vi_cv_have_gpm=yes],
2718 [vi_cv_have_gpm=no])
2719 [LIBS="$olibs"]
2720 )
2721 if test $vi_cv_have_gpm = yes; then
2722 LIBS="$LIBS -lgpm"
2723 AC_DEFINE(HAVE_GPM)
2724 fi
2725else
2726 AC_MSG_RESULT(yes)
2727fi
2728
Bram Moolenaar446cb832008-06-24 21:56:24 +00002729AC_MSG_CHECKING(--disable-sysmouse argument)
2730AC_ARG_ENABLE(sysmouse,
2731 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2732 [enable_sysmouse="yes"])
2733
2734if test "$enable_sysmouse" = "yes"; then
2735 AC_MSG_RESULT(no)
2736 dnl Checking if sysmouse support can be compiled
2737 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
2738 dnl defines FEAT_SYSMOUSE if mouse support is included
2739 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
2740 AC_TRY_LINK(
2741 [#include <sys/consio.h>
2742 #include <signal.h>
2743 #include <sys/fbio.h>],
2744 [struct mouse_info mouse;
2745 mouse.operation = MOUSE_MODE;
2746 mouse.operation = MOUSE_SHOW;
2747 mouse.u.mode.mode = 0;
2748 mouse.u.mode.signal = SIGUSR2;],
2749 [vi_cv_have_sysmouse=yes],
2750 [vi_cv_have_sysmouse=no])
2751 )
2752 if test $vi_cv_have_sysmouse = yes; then
2753 AC_DEFINE(HAVE_SYSMOUSE)
2754 fi
2755else
2756 AC_MSG_RESULT(yes)
2757fi
2758
Bram Moolenaarf05da212009-11-17 16:13:15 +00002759dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
2760AC_MSG_CHECKING(for FD_CLOEXEC)
2761AC_TRY_COMPILE(
2762[#if HAVE_FCNTL_H
2763# include <fcntl.h>
2764#endif],
2765[ int flag = FD_CLOEXEC;],
2766 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
2767 AC_MSG_RESULT(not usable))
2768
Bram Moolenaar071d4272004-06-13 20:20:40 +00002769dnl rename needs to be checked separately to work on Nextstep with cc
2770AC_MSG_CHECKING(for rename)
2771AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2772 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2773 AC_MSG_RESULT(no))
2774
2775dnl sysctl() may exist but not the arguments we use
2776AC_MSG_CHECKING(for sysctl)
2777AC_TRY_COMPILE(
2778[#include <sys/types.h>
2779#include <sys/sysctl.h>],
2780[ int mib[2], r;
2781 size_t len;
2782
2783 mib[0] = CTL_HW;
2784 mib[1] = HW_USERMEM;
2785 len = sizeof(r);
2786 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2787 ],
2788 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2789 AC_MSG_RESULT(not usable))
2790
2791dnl sysinfo() may exist but not be Linux compatible
2792AC_MSG_CHECKING(for sysinfo)
2793AC_TRY_COMPILE(
2794[#include <sys/types.h>
2795#include <sys/sysinfo.h>],
2796[ struct sysinfo sinfo;
2797 int t;
2798
2799 (void)sysinfo(&sinfo);
2800 t = sinfo.totalram;
2801 ],
2802 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2803 AC_MSG_RESULT(not usable))
2804
Bram Moolenaar914572a2007-05-01 11:37:47 +00002805dnl struct sysinfo may have the mem_unit field or not
2806AC_MSG_CHECKING(for sysinfo.mem_unit)
2807AC_TRY_COMPILE(
2808[#include <sys/types.h>
2809#include <sys/sysinfo.h>],
2810[ struct sysinfo sinfo;
2811 sinfo.mem_unit = 1;
2812 ],
2813 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
2814 AC_MSG_RESULT(no))
2815
Bram Moolenaar071d4272004-06-13 20:20:40 +00002816dnl sysconf() may exist but not support what we want to use
2817AC_MSG_CHECKING(for sysconf)
2818AC_TRY_COMPILE(
2819[#include <unistd.h>],
2820[ (void)sysconf(_SC_PAGESIZE);
2821 (void)sysconf(_SC_PHYS_PAGES);
2822 ],
2823 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2824 AC_MSG_RESULT(not usable))
2825
Bram Moolenaar914703b2010-05-31 21:59:46 +02002826AC_CHECK_SIZEOF([int])
2827AC_CHECK_SIZEOF([long])
2828AC_CHECK_SIZEOF([time_t])
2829AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02002830
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002831dnl Make sure that uint32_t is really 32 bits unsigned.
2832AC_MSG_CHECKING([uint32_t is 32 bits])
2833AC_TRY_RUN([
2834#ifdef HAVE_STDINT_H
2835# include <stdint.h>
2836#endif
2837#ifdef HAVE_INTTYPES_H
2838# include <inttypes.h>
2839#endif
2840main() {
2841 uint32_t nr1 = (uint32_t)-1;
2842 uint32_t nr2 = (uint32_t)0xffffffffUL;
2843 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
2844 exit(0);
2845}],
2846AC_MSG_RESULT(ok),
2847AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
2848AC_MSG_ERROR([could not compile program using uint32_t.]))
2849
Bram Moolenaar446cb832008-06-24 21:56:24 +00002850dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2851dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2852
Bram Moolenaar071d4272004-06-13 20:20:40 +00002853[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00002854#include "confdefs.h"
2855#ifdef HAVE_STRING_H
2856# include <string.h>
2857#endif
2858#if STDC_HEADERS
2859# include <stdlib.h>
2860# include <stddef.h>
2861#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002862main() {
2863 char buf[10];
2864 strcpy(buf, "abcdefghi");
2865 mch_memmove(buf, buf + 2, 3);
2866 if (strncmp(buf, "ababcf", 6))
2867 exit(1);
2868 strcpy(buf, "abcdefghi");
2869 mch_memmove(buf + 2, buf, 3);
2870 if (strncmp(buf, "cdedef", 6))
2871 exit(1);
2872 exit(0); /* libc version works properly. */
2873}']
2874
Bram Moolenaar446cb832008-06-24 21:56:24 +00002875AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
2876 [
2877 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
2878 [
2879 vim_cv_memmove_handles_overlap=yes
2880 ],[
2881 vim_cv_memmove_handles_overlap=no
2882 ],[
2883 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
2884 ])
2885 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002886
Bram Moolenaar446cb832008-06-24 21:56:24 +00002887if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
2888 AC_DEFINE(USEMEMMOVE)
2889else
2890 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
2891 [
2892 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
2893 [
2894 vim_cv_bcopy_handles_overlap=yes
2895 ],[
2896 vim_cv_bcopy_handles_overlap=no
2897 ],[
2898 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
2899 ])
2900 ])
2901
2902 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
2903 AC_DEFINE(USEBCOPY)
2904 else
2905 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
2906 [
2907 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
2908 [
2909 vim_cv_memcpy_handles_overlap=yes
2910 ],[
2911 vim_cv_memcpy_handles_overlap=no
2912 ],[
2913 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
2914 ])
2915 ])
2916
2917 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
2918 AC_DEFINE(USEMEMCPY)
2919 fi
2920 fi
2921fi
2922
Bram Moolenaar071d4272004-06-13 20:20:40 +00002923
2924dnl Check for multibyte locale functions
2925dnl Find out if _Xsetlocale() is supported by libX11.
2926dnl Check if X_LOCALE should be defined.
2927
2928if test "$enable_multibyte" = "yes"; then
2929 cflags_save=$CFLAGS
2930 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00002931 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00002932 CFLAGS="$CFLAGS -I$x_includes"
2933 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
2934 AC_MSG_CHECKING(whether X_LOCALE needed)
2935 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
2936 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
2937 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
2938 AC_MSG_RESULT(no))
2939 fi
2940 CFLAGS=$cflags_save
2941 LDFLAGS=$ldflags_save
2942fi
2943
2944dnl Link with xpg4, it is said to make Korean locale working
2945AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
2946
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00002947dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002948dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002949dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002950dnl -t for typedefs (many ctags have this)
2951dnl -s for static functions (Elvis ctags only?)
2952dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
2953dnl -i+m to test for older Exuberant ctags
2954AC_MSG_CHECKING(how to create tags)
2955test -f tags && mv tags tags.save
2956if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002957 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002958else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00002959 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002960 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
2961 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
2962 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
2963 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
2964 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
2965 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
2966 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
2967fi
2968test -f tags.save && mv tags.save tags
2969AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
2970
2971dnl Check how we can run man with a section number
2972AC_MSG_CHECKING(how to run man with a section nr)
2973MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00002974(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 +00002975AC_MSG_RESULT($MANDEF)
2976if test "$MANDEF" = "man -s"; then
2977 AC_DEFINE(USEMAN_S)
2978fi
2979
2980dnl Check if gettext() is working and if it needs -lintl
2981AC_MSG_CHECKING(--disable-nls argument)
2982AC_ARG_ENABLE(nls,
2983 [ --disable-nls Don't support NLS (gettext()).], ,
2984 [enable_nls="yes"])
2985
2986if test "$enable_nls" = "yes"; then
2987 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002988
2989 INSTALL_LANGS=install-languages
2990 AC_SUBST(INSTALL_LANGS)
2991 INSTALL_TOOL_LANGS=install-tool-languages
2992 AC_SUBST(INSTALL_TOOL_LANGS)
2993
Bram Moolenaar071d4272004-06-13 20:20:40 +00002994 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
2995 AC_MSG_CHECKING([for NLS])
2996 if test -f po/Makefile; then
2997 have_gettext="no"
2998 if test -n "$MSGFMT"; then
2999 AC_TRY_LINK(
3000 [#include <libintl.h>],
3001 [gettext("Test");],
3002 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3003 olibs=$LIBS
3004 LIBS="$LIBS -lintl"
3005 AC_TRY_LINK(
3006 [#include <libintl.h>],
3007 [gettext("Test");],
3008 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3009 AC_MSG_RESULT([gettext() doesn't work]);
3010 LIBS=$olibs))
3011 else
3012 AC_MSG_RESULT([msgfmt not found - disabled]);
3013 fi
3014 if test $have_gettext = "yes"; then
3015 AC_DEFINE(HAVE_GETTEXT)
3016 MAKEMO=yes
3017 AC_SUBST(MAKEMO)
3018 dnl this was added in GNU gettext 0.10.36
3019 AC_CHECK_FUNCS(bind_textdomain_codeset)
3020 dnl _nl_msg_cat_cntr is required for GNU gettext
3021 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3022 AC_TRY_LINK(
3023 [#include <libintl.h>
3024 extern int _nl_msg_cat_cntr;],
3025 [++_nl_msg_cat_cntr;],
3026 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3027 AC_MSG_RESULT([no]))
3028 fi
3029 else
3030 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3031 fi
3032else
3033 AC_MSG_RESULT(yes)
3034fi
3035
3036dnl Check for dynamic linking loader
3037AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3038if test x${DLL} = xdlfcn.h; then
3039 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3040 AC_MSG_CHECKING([for dlopen()])
3041 AC_TRY_LINK(,[
3042 extern void* dlopen();
3043 dlopen();
3044 ],
3045 AC_MSG_RESULT(yes);
3046 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3047 AC_MSG_RESULT(no);
3048 AC_MSG_CHECKING([for dlopen() in -ldl])
3049 olibs=$LIBS
3050 LIBS="$LIBS -ldl"
3051 AC_TRY_LINK(,[
3052 extern void* dlopen();
3053 dlopen();
3054 ],
3055 AC_MSG_RESULT(yes);
3056 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3057 AC_MSG_RESULT(no);
3058 LIBS=$olibs))
3059 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3060 dnl ick :-)
3061 AC_MSG_CHECKING([for dlsym()])
3062 AC_TRY_LINK(,[
3063 extern void* dlsym();
3064 dlsym();
3065 ],
3066 AC_MSG_RESULT(yes);
3067 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3068 AC_MSG_RESULT(no);
3069 AC_MSG_CHECKING([for dlsym() in -ldl])
3070 olibs=$LIBS
3071 LIBS="$LIBS -ldl"
3072 AC_TRY_LINK(,[
3073 extern void* dlsym();
3074 dlsym();
3075 ],
3076 AC_MSG_RESULT(yes);
3077 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3078 AC_MSG_RESULT(no);
3079 LIBS=$olibs))
3080elif test x${DLL} = xdl.h; then
3081 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3082 AC_MSG_CHECKING([for shl_load()])
3083 AC_TRY_LINK(,[
3084 extern void* shl_load();
3085 shl_load();
3086 ],
3087 AC_MSG_RESULT(yes);
3088 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3089 AC_MSG_RESULT(no);
3090 AC_MSG_CHECKING([for shl_load() in -ldld])
3091 olibs=$LIBS
3092 LIBS="$LIBS -ldld"
3093 AC_TRY_LINK(,[
3094 extern void* shl_load();
3095 shl_load();
3096 ],
3097 AC_MSG_RESULT(yes);
3098 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3099 AC_MSG_RESULT(no);
3100 LIBS=$olibs))
3101fi
3102AC_CHECK_HEADERS(setjmp.h)
3103
3104if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3105 dnl -ldl must come after DynaLoader.a
3106 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3107 LIBS=`echo $LIBS | sed s/-ldl//`
3108 PERL_LIBS="$PERL_LIBS -ldl"
3109 fi
3110fi
3111
3112if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
3113 && test "x$GUITYPE" != "xCARBONGUI"; then
3114 AC_MSG_CHECKING(whether we need -framework Carbon)
3115 dnl check for MACOSX without Carbon GUI, but with FEAT_MBYTE
Bram Moolenaarb90daee2006-10-17 09:49:09 +00003116 if test "x$enable_multibyte" = "xyes" || test "x$features" = "xbig" \
Bram Moolenaar071d4272004-06-13 20:20:40 +00003117 || test "x$features" = "xhuge"; then
3118 LIBS="$LIBS -framework Carbon"
3119 AC_MSG_RESULT(yes)
3120 else
3121 AC_MSG_RESULT(no)
3122 fi
3123fi
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003124if test "x$MACARCH" = "xboth"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003125 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003126fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003127
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003128dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3129dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3130dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003131dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3132dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003133DEPEND_CFLAGS_FILTER=
3134if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003135 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003136 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003137 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003138 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003139 AC_MSG_RESULT(yes)
3140 else
3141 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003142 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003143 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3144 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003145 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003146 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3147 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003148 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 +00003149 AC_MSG_RESULT(yes)
3150 else
3151 AC_MSG_RESULT(no)
3152 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003153fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003154AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003155
3156dnl write output files
3157AC_OUTPUT(auto/config.mk:config.mk.in)
3158
3159dnl vim: set sw=2 tw=78 fo+=l: