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