blob: f44cf0f765aa1d048dc26f8667bbaee2171cf952 [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 Moolenaarab79bcb2004-07-18 21:34:53 +0000186 if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk -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)])
1159dnl defining FEAT_XIM is delayed, so that it can be disabled for older GTK
1160
1161AC_MSG_CHECKING(--enable-fontset argument)
1162AC_ARG_ENABLE(fontset,
1163 [ --enable-fontset Include X fontset output support.], ,
1164 [enable_fontset="no"])
1165AC_MSG_RESULT($enable_fontset)
1166dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1167
1168test -z "$with_x" && with_x=yes
1169test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1170if test "$with_x" = no; then
1171 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1172else
1173 dnl Do this check early, so that its failure can override user requests.
1174
1175 AC_PATH_PROG(xmkmfpath, xmkmf)
1176
1177 AC_PATH_XTRA
1178
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001179 dnl On z/OS Unix the X libraries are DLLs. To use them the code must
Bram Moolenaar071d4272004-06-13 20:20:40 +00001180 dnl be compiled with a special option.
1181 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
Bram Moolenaar2c704a72010-06-03 21:17:25 +02001182 if test "$zOSUnix" = "yes"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001183 CFLAGS="$CFLAGS -W c,dll"
1184 LDFLAGS="$LDFLAGS -W l,dll"
1185 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1186 fi
1187
1188 dnl On my HPUX system the X include dir is found, but the lib dir not.
1189 dnl This is a desparate try to fix this.
1190
1191 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1192 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1193 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1194 X_LIBS="$X_LIBS -L$x_libraries"
1195 if test "`(uname) 2>/dev/null`" = SunOS &&
1196 uname -r | grep '^5' >/dev/null; then
1197 X_LIBS="$X_LIBS -R $x_libraries"
1198 fi
1199 fi
1200
1201 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1202 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1203 AC_MSG_RESULT(Corrected X includes to $x_includes)
1204 X_CFLAGS="$X_CFLAGS -I$x_includes"
1205 fi
1206
1207 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1208 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1209 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1210 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1211 dnl Same for "-R/usr/lib ".
1212 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1213
1214
1215 dnl Check if the X11 header files are correctly installed. On some systems
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001216 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1217 dnl is missing.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001218 AC_MSG_CHECKING(if X11 header files can be found)
1219 cflags_save=$CFLAGS
1220 CFLAGS="$CFLAGS $X_CFLAGS"
Bram Moolenaar00ca2842008-06-26 20:14:00 +00001221 AC_TRY_COMPILE([#include <X11/Xlib.h>
1222#include <X11/Intrinsic.h>], ,
Bram Moolenaar071d4272004-06-13 20:20:40 +00001223 AC_MSG_RESULT(yes),
1224 AC_MSG_RESULT(no); no_x=yes)
1225 CFLAGS=$cflags_save
1226
1227 if test "${no_x-no}" = yes; then
1228 with_x=no
1229 else
1230 AC_DEFINE(HAVE_X11)
1231 X_LIB="-lXt -lX11";
1232 AC_SUBST(X_LIB)
1233
1234 ac_save_LDFLAGS="$LDFLAGS"
1235 LDFLAGS="-L$x_libraries $LDFLAGS"
1236
1237 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1238 dnl For HP-UX 10.20 it must be before -lSM -lICE
1239 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1240 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1241
1242 dnl Some systems need -lnsl -lsocket when testing for ICE.
1243 dnl The check above doesn't do this, try here (again). Also needed to get
1244 dnl them after Xdmcp. link.sh will remove them when not needed.
1245 dnl Check for other function than above to avoid the cached value
1246 AC_CHECK_LIB(ICE, IceOpenConnection,
1247 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1248
1249 dnl Check for -lXpm (needed for some versions of Motif)
1250 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1251 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1252 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1253
1254 dnl Check that the X11 header files don't use implicit declarations
1255 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1256 cflags_save=$CFLAGS
1257 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1258 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1259 AC_MSG_RESULT(no),
1260 CFLAGS="$CFLAGS -Wno-implicit-int"
1261 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1262 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1263 AC_MSG_RESULT(test failed)
1264 )
1265 )
1266 CFLAGS=$cflags_save
1267
1268 LDFLAGS="$ac_save_LDFLAGS"
1269
Bram Moolenaar4bdbbf72009-05-21 21:27:43 +00001270 AC_MSG_CHECKING(size of wchar_t is 2 bytes)
1271 AC_CACHE_VAL(ac_cv_small_wchar_t,
1272 [AC_TRY_RUN([
1273#include <X11/Xlib.h>
1274#if STDC_HEADERS
1275# include <stdlib.h>
1276# include <stddef.h>
1277#endif
1278 main()
1279 {
1280 if (sizeof(wchar_t) <= 2)
1281 exit(1);
1282 exit(0);
1283 }],
1284 ac_cv_small_wchar_t="no",
1285 ac_cv_small_wchar_t="yes",
1286 AC_MSG_ERROR(failed to compile test program))])
1287 AC_MSG_RESULT($ac_cv_small_wchar_t)
1288 if test "x$ac_cv_small_wchar_t" = "xyes" ; then
1289 AC_DEFINE(SMALL_WCHAR_T)
1290 fi
1291
Bram Moolenaar071d4272004-06-13 20:20:40 +00001292 fi
1293fi
1294
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001295test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001296
1297AC_MSG_CHECKING(--enable-gui argument)
1298AC_ARG_ENABLE(gui,
Bram Moolenaar9372a112005-12-06 19:59:18 +00001299 [ --enable-gui[=OPTS] X11 GUI [default=auto] [OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto")
Bram Moolenaar071d4272004-06-13 20:20:40 +00001300
1301dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1302dnl Do not use character classes for portability with old tools.
1303enable_gui_canon=`echo "_$enable_gui" | \
1304 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1305
1306dnl Skip everything by default.
1307SKIP_GTK=YES
1308SKIP_GTK2=YES
1309SKIP_GNOME=YES
1310SKIP_MOTIF=YES
1311SKIP_ATHENA=YES
1312SKIP_NEXTAW=YES
1313SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001314SKIP_CARBON=YES
1315GUITYPE=NONE
1316
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001317if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001318 SKIP_PHOTON=
1319 case "$enable_gui_canon" in
1320 no) AC_MSG_RESULT(no GUI support)
1321 SKIP_PHOTON=YES ;;
1322 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1323 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1324 photon) AC_MSG_RESULT(Photon GUI support) ;;
1325 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1326 SKIP_PHOTON=YES ;;
1327 esac
1328
1329elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1330 SKIP_CARBON=
1331 case "$enable_gui_canon" in
1332 no) AC_MSG_RESULT(no GUI support)
1333 SKIP_CARBON=YES ;;
1334 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1335 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1336 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1337 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1338 SKIP_CARBON=YES ;;
1339 esac
1340
1341else
1342
Bram Moolenaar071d4272004-06-13 20:20:40 +00001343 case "$enable_gui_canon" in
1344 no|none) AC_MSG_RESULT(no GUI support) ;;
1345 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
1346 SKIP_GTK=
1347 SKIP_GTK2=
1348 SKIP_GNOME=
1349 SKIP_MOTIF=
1350 SKIP_ATHENA=
1351 SKIP_NEXTAW=
1352 SKIP_CARBON=;;
1353 gtk) AC_MSG_RESULT(GTK+ 1.x GUI support)
1354 SKIP_GTK=;;
1355 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
1356 SKIP_GTK=
1357 SKIP_GTK2=;;
1358 gnome) AC_MSG_RESULT(GNOME 1.x GUI support)
1359 SKIP_GNOME=
1360 SKIP_GTK=;;
1361 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1362 SKIP_GNOME=
1363 SKIP_GTK=
1364 SKIP_GTK2=;;
1365 motif) AC_MSG_RESULT(Motif GUI support)
1366 SKIP_MOTIF=;;
1367 athena) AC_MSG_RESULT(Athena GUI support)
1368 SKIP_ATHENA=;;
1369 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1370 SKIP_NEXTAW=;;
1371 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1372 esac
1373
1374fi
1375
1376if test "x$SKIP_GTK" != "xYES" -a "$enable_gui_canon" != "gtk" -a "$enable_gui_canon" != "gtk2"; then
1377 AC_MSG_CHECKING(whether or not to look for GTK)
1378 AC_ARG_ENABLE(gtk-check,
1379 [ --enable-gtk-check If auto-select GUI, check for GTK [default=yes]],
1380 , enable_gtk_check="yes")
1381 AC_MSG_RESULT($enable_gtk_check)
1382 if test "x$enable_gtk_check" = "xno"; then
1383 SKIP_GTK=YES
1384 SKIP_GNOME=YES
1385 fi
1386fi
1387
1388if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1389 -a "$enable_gui_canon" != "gnome2"; then
1390 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1391 AC_ARG_ENABLE(gtk2-check,
1392 [ --enable-gtk2-check If GTK GUI, check for GTK+ 2 [default=yes]],
1393 , enable_gtk2_check="yes")
1394 AC_MSG_RESULT($enable_gtk2_check)
1395 if test "x$enable_gtk2_check" = "xno"; then
1396 SKIP_GTK2=YES
1397 fi
1398fi
1399
1400if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome" \
1401 -a "$enable_gui_canon" != "gnome2"; then
1402 AC_MSG_CHECKING(whether or not to look for GNOME)
1403 AC_ARG_ENABLE(gnome-check,
1404 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1405 , enable_gnome_check="no")
1406 AC_MSG_RESULT($enable_gnome_check)
1407 if test "x$enable_gnome_check" = "xno"; then
1408 SKIP_GNOME=YES
1409 fi
1410fi
1411
1412if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1413 AC_MSG_CHECKING(whether or not to look for Motif)
1414 AC_ARG_ENABLE(motif-check,
1415 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1416 , enable_motif_check="yes")
1417 AC_MSG_RESULT($enable_motif_check)
1418 if test "x$enable_motif_check" = "xno"; then
1419 SKIP_MOTIF=YES
1420 fi
1421fi
1422
1423if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1424 AC_MSG_CHECKING(whether or not to look for Athena)
1425 AC_ARG_ENABLE(athena-check,
1426 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1427 , enable_athena_check="yes")
1428 AC_MSG_RESULT($enable_athena_check)
1429 if test "x$enable_athena_check" = "xno"; then
1430 SKIP_ATHENA=YES
1431 fi
1432fi
1433
1434if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1435 AC_MSG_CHECKING(whether or not to look for neXtaw)
1436 AC_ARG_ENABLE(nextaw-check,
1437 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1438 , enable_nextaw_check="yes")
1439 AC_MSG_RESULT($enable_nextaw_check);
1440 if test "x$enable_nextaw_check" = "xno"; then
1441 SKIP_NEXTAW=YES
1442 fi
1443fi
1444
1445if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1446 AC_MSG_CHECKING(whether or not to look for Carbon)
1447 AC_ARG_ENABLE(carbon-check,
1448 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1449 , enable_carbon_check="yes")
1450 AC_MSG_RESULT($enable_carbon_check);
1451 if test "x$enable_carbon_check" = "xno"; then
1452 SKIP_CARBON=YES
1453 fi
1454fi
1455
Bram Moolenaar843ee412004-06-30 16:16:41 +00001456
Bram Moolenaar071d4272004-06-13 20:20:40 +00001457if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1458 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001459 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001460 AC_MSG_RESULT(yes);
1461 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001462 if test "$VIMNAME" = "vim"; then
1463 VIMNAME=Vim
1464 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001465
1466 dnl Default install directory is not /usr/local
1467 if test x$prefix = xNONE; then
1468 prefix=/Applications
1469 fi
1470
1471 dnl Sorry for the hard coded default
1472 datadir='${prefix}/Vim.app/Contents/Resources'
1473
Bram Moolenaar071d4272004-06-13 20:20:40 +00001474 dnl skip everything else
1475 SKIP_GTK=YES;
1476 SKIP_GTK2=YES;
1477 SKIP_GNOME=YES;
1478 SKIP_MOTIF=YES;
1479 SKIP_ATHENA=YES;
1480 SKIP_NEXTAW=YES;
1481 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001482 SKIP_CARBON=YES
1483fi
1484
Bram Moolenaar071d4272004-06-13 20:20:40 +00001485dnl
1486dnl Get the cflags and libraries from the gtk-config script
1487dnl
1488
1489dnl define an autoconf function to check for a specified version of GTK, and
1490dnl try to compile/link a GTK program. this gets used once for GTK 1.1.16.
1491dnl
1492dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001493dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001494dnl
1495AC_DEFUN(AM_PATH_GTK,
1496[
1497 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1498 {
1499 min_gtk_version=ifelse([$1], ,0.99.7,$1)
1500 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1501 no_gtk=""
1502 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1503 && $PKG_CONFIG --exists gtk+-2.0; then
1504 {
1505 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1506 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1507 dnl something like that.
1508 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001509 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001510 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1511 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1512 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1513 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1514 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1515 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1516 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1517 }
1518 elif test "X$GTK_CONFIG" != "Xno"; then
1519 {
1520 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001521 GTK_LIBDIR=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001522 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
1523 gtk_major_version=`$GTK_CONFIG $gtk_config_args --version | \
1524 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1525 gtk_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
1526 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1527 gtk_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
1528 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1529 }
1530 else
1531 no_gtk=yes
1532 fi
1533
1534 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1535 {
1536 ac_save_CFLAGS="$CFLAGS"
1537 ac_save_LIBS="$LIBS"
1538 CFLAGS="$CFLAGS $GTK_CFLAGS"
1539 LIBS="$LIBS $GTK_LIBS"
1540
1541 dnl
1542 dnl Now check if the installed GTK is sufficiently new. (Also sanity
1543 dnl checks the results of gtk-config to some extent
1544 dnl
1545 rm -f conf.gtktest
1546 AC_TRY_RUN([
1547#include <gtk/gtk.h>
1548#include <stdio.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001549#if STDC_HEADERS
1550# include <stdlib.h>
1551# include <stddef.h>
1552#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001553
1554int
1555main ()
1556{
1557int major, minor, micro;
1558char *tmp_version;
1559
1560system ("touch conf.gtktest");
1561
1562/* HP/UX 9 (%@#!) writes to sscanf strings */
1563tmp_version = g_strdup("$min_gtk_version");
1564if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1565 printf("%s, bad version string\n", "$min_gtk_version");
1566 exit(1);
1567 }
1568
1569if ((gtk_major_version > major) ||
1570 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1571 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1572 (gtk_micro_version >= micro)))
1573{
1574 return 0;
1575}
1576return 1;
1577}
1578],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1579 CFLAGS="$ac_save_CFLAGS"
1580 LIBS="$ac_save_LIBS"
1581 }
1582 fi
1583 if test "x$no_gtk" = x ; then
1584 if test "x$enable_gtktest" = "xyes"; then
1585 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1586 else
1587 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1588 fi
1589 ifelse([$2], , :, [$2])
1590 else
1591 {
1592 AC_MSG_RESULT(no)
1593 GTK_CFLAGS=""
1594 GTK_LIBS=""
1595 ifelse([$3], , :, [$3])
1596 }
1597 fi
1598 }
1599 else
1600 GTK_CFLAGS=""
1601 GTK_LIBS=""
1602 ifelse([$3], , :, [$3])
1603 fi
1604 AC_SUBST(GTK_CFLAGS)
1605 AC_SUBST(GTK_LIBS)
1606 rm -f conf.gtktest
1607])
1608
1609dnl ---------------------------------------------------------------------------
1610dnl gnome
1611dnl ---------------------------------------------------------------------------
1612AC_DEFUN([GNOME_INIT_HOOK],
1613[
1614 AC_SUBST(GNOME_LIBS)
1615 AC_SUBST(GNOME_LIBDIR)
1616 AC_SUBST(GNOME_INCLUDEDIR)
1617
1618 AC_ARG_WITH(gnome-includes,
1619 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1620 [CFLAGS="$CFLAGS -I$withval"]
1621 )
1622
1623 AC_ARG_WITH(gnome-libs,
1624 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1625 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1626 )
1627
1628 AC_ARG_WITH(gnome,
1629 [ --with-gnome Specify prefix for GNOME files],
1630 if test x$withval = xyes; then
1631 want_gnome=yes
1632 ifelse([$1], [], :, [$1])
1633 else
1634 if test "x$withval" = xno; then
1635 want_gnome=no
1636 else
1637 want_gnome=yes
1638 LDFLAGS="$LDFLAGS -L$withval/lib"
1639 CFLAGS="$CFLAGS -I$withval/include"
1640 gnome_prefix=$withval/lib
1641 fi
1642 fi,
1643 want_gnome=yes)
1644
1645 if test "x$want_gnome" = xyes -a "0$gtk_major_version" -ge 2; then
1646 {
1647 AC_MSG_CHECKING(for libgnomeui-2.0)
1648 if $PKG_CONFIG --exists libgnomeui-2.0; then
1649 AC_MSG_RESULT(yes)
1650 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1651 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1652 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001653
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001654 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1655 dnl This might not be the right way but it works for me...
1656 AC_MSG_CHECKING(for FreeBSD)
1657 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1658 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001659 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001660 GNOME_LIBS="$GNOME_LIBS -pthread"
1661 else
1662 AC_MSG_RESULT(no)
1663 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001664 $1
1665 else
1666 AC_MSG_RESULT(not found)
1667 if test "x$2" = xfail; then
1668 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1669 fi
1670 fi
1671 }
1672 elif test "x$want_gnome" = xyes; then
1673 {
1674 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
1675 if test "$GNOME_CONFIG" = "no"; then
1676 no_gnome_config="yes"
1677 else
1678 AC_MSG_CHECKING(if $GNOME_CONFIG works)
1679 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
1680 AC_MSG_RESULT(yes)
1681 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome gnomeui`"
1682 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
1683 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
1684 $1
1685 else
1686 AC_MSG_RESULT(no)
1687 no_gnome_config="yes"
1688 fi
1689 fi
1690
1691 if test x$exec_prefix = xNONE; then
1692 if test x$prefix = xNONE; then
1693 gnome_prefix=$ac_default_prefix/lib
1694 else
1695 gnome_prefix=$prefix/lib
1696 fi
1697 else
1698 gnome_prefix=`eval echo \`echo $libdir\``
1699 fi
1700
1701 if test "$no_gnome_config" = "yes"; then
1702 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
1703 if test -f $gnome_prefix/gnomeConf.sh; then
1704 AC_MSG_RESULT(found)
1705 echo "loading gnome configuration from" \
1706 "$gnome_prefix/gnomeConf.sh"
1707 . $gnome_prefix/gnomeConf.sh
1708 $1
1709 else
1710 AC_MSG_RESULT(not found)
1711 if test x$2 = xfail; then
1712 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
1713 fi
1714 fi
1715 fi
1716 }
1717 fi
1718])
1719
1720AC_DEFUN([GNOME_INIT],[
1721 GNOME_INIT_HOOK([],fail)
1722])
1723
1724
1725dnl ---------------------------------------------------------------------------
1726dnl Check for GTK. First checks for gtk-config, cause it needs that to get the
1727dnl correct compiler flags. Then checks for GTK 1.1.16. If that fails, then
1728dnl it checks for 1.0.6. If both fail, then continue on for Motif as before...
1729dnl ---------------------------------------------------------------------------
1730if test -z "$SKIP_GTK"; then
1731
1732 AC_MSG_CHECKING(--with-gtk-prefix argument)
1733 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
1734 gtk_config_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1735 gtk_config_prefix=""; AC_MSG_RESULT(no))
1736
1737 AC_MSG_CHECKING(--with-gtk-exec-prefix argument)
1738 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
1739 gtk_config_exec_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1740 gtk_config_exec_prefix=""; AC_MSG_RESULT(no))
1741
1742 AC_MSG_CHECKING(--disable-gtktest argument)
1743 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1744 , enable_gtktest=yes)
1745 if test "x$enable_gtktest" = "xyes" ; then
1746 AC_MSG_RESULT(gtk test enabled)
1747 else
1748 AC_MSG_RESULT(gtk test disabled)
1749 fi
1750
1751 if test "x$gtk_config_prefix" != "x" ; then
1752 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
1753 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
1754 fi
1755 if test "x$gtk_config_exec_prefix" != "x" ; then
1756 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
1757 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
1758 fi
1759 if test "X$GTK_CONFIG" = "X"; then
1760 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
1761 if test "X$GTK_CONFIG" = "Xno"; then
1762 dnl Some distributions call it gtk12-config, annoying!
1763 AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no)
1764 GTK_CONFIG="$GTK12_CONFIG"
1765 fi
1766 else
1767 AC_MSG_RESULT(Using GTK configuration program $GTK_CONFIG)
1768 fi
1769 if test "X$PKG_CONFIG" = "X"; then
1770 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1771 fi
1772
1773 if test "x$GTK_CONFIG:$PKG_CONFIG" != "xno:no"; then
1774 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1775 dnl problems (bold fonts, --remote doesn't work).
1776 if test "X$SKIP_GTK2" != "XYES"; then
1777 AM_PATH_GTK(2.2.0,
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001778 [GUI_LIB_LOC="$GTK_LIBDIR"
1779 GTK_LIBNAME="$GTK_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001780 GUI_INC_LOC="$GTK_CFLAGS"], )
1781 if test "x$GTK_CFLAGS" != "x"; then
1782 SKIP_ATHENA=YES
1783 SKIP_NEXTAW=YES
1784 SKIP_MOTIF=YES
1785 GUITYPE=GTK
1786 AC_SUBST(GTK_LIBNAME)
1787 fi
1788 fi
1789
1790 dnl If there is no 2.2.0 or later try the 1.x.x series. We require at
1791 dnl least GTK 1.1.16. 1.0.6 doesn't work. 1.1.1 to 1.1.15
1792 dnl were test versions.
1793 if test "x$GUITYPE" != "xGTK"; then
1794 SKIP_GTK2=YES
1795 AM_PATH_GTK(1.1.16,
1796 [GTK_LIBNAME="$GTK_LIBS"
1797 GUI_INC_LOC="$GTK_CFLAGS"], )
1798 if test "x$GTK_CFLAGS" != "x"; then
1799 SKIP_ATHENA=YES
1800 SKIP_NEXTAW=YES
1801 SKIP_MOTIF=YES
1802 GUITYPE=GTK
1803 AC_SUBST(GTK_LIBNAME)
1804 fi
1805 fi
1806 fi
1807 dnl Give a warning if GTK is older than 1.2.3
1808 if test "x$GUITYPE" = "xGTK"; then
1809 if test "$gtk_major_version" = 1 -a "0$gtk_minor_version" -lt 2 \
1810 -o "$gtk_major_version" = 1 -a "$gtk_minor_version" = 2 -a "0$gtk_micro_version" -lt 3; then
1811 AC_MSG_RESULT(this GTK version is old; version 1.2.3 or later is recommended)
1812 else
1813 {
1814 if test "0$gtk_major_version" -ge 2; then
1815 AC_DEFINE(HAVE_GTK2)
1816 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1817 || test "0$gtk_minor_version" -ge 2 \
1818 || test "0$gtk_major_version" -gt 2; then
1819 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1820 fi
1821 fi
1822 dnl
1823 dnl if GTK exists, and it's not the 1.0.x series, then check for GNOME.
1824 dnl
1825 if test -z "$SKIP_GNOME"; then
1826 {
1827 GNOME_INIT_HOOK([have_gnome=yes])
1828 if test x$have_gnome = xyes ; then
1829 AC_DEFINE(FEAT_GUI_GNOME)
1830 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1831 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
1832 fi
1833 }
1834 fi
1835 }
1836 fi
1837 fi
1838fi
1839
1840dnl Check for Motif include files location.
1841dnl The LAST one found is used, this makes the highest version to be used,
1842dnl e.g. when Motif1.2 and Motif2.0 are both present.
1843
1844if test -z "$SKIP_MOTIF"; then
1845 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"
1846 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1847 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1848
1849 AC_MSG_CHECKING(for location of Motif GUI includes)
1850 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1851 GUI_INC_LOC=
1852 for try in $gui_includes; do
1853 if test -f "$try/Xm/Xm.h"; then
1854 GUI_INC_LOC=$try
1855 fi
1856 done
1857 if test -n "$GUI_INC_LOC"; then
1858 if test "$GUI_INC_LOC" = /usr/include; then
1859 GUI_INC_LOC=
1860 AC_MSG_RESULT(in default path)
1861 else
1862 AC_MSG_RESULT($GUI_INC_LOC)
1863 fi
1864 else
1865 AC_MSG_RESULT(<not found>)
1866 SKIP_MOTIF=YES
1867 fi
1868fi
1869
1870dnl Check for Motif library files location. In the same order as the include
1871dnl files, to avoid a mixup if several versions are present
1872
1873if test -z "$SKIP_MOTIF"; then
1874 AC_MSG_CHECKING(--with-motif-lib argument)
1875 AC_ARG_WITH(motif-lib,
1876 [ --with-motif-lib=STRING Library for Motif ],
1877 [ MOTIF_LIBNAME="${withval}" ] )
1878
1879 if test -n "$MOTIF_LIBNAME"; then
1880 AC_MSG_RESULT($MOTIF_LIBNAME)
1881 GUI_LIB_LOC=
1882 else
1883 AC_MSG_RESULT(no)
1884
1885 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1886 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1887
1888 AC_MSG_CHECKING(for location of Motif GUI libs)
1889 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"
1890 GUI_LIB_LOC=
1891 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001892 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00001893 if test -f "$libtry"; then
1894 GUI_LIB_LOC=$try
1895 fi
1896 done
1897 done
1898 if test -n "$GUI_LIB_LOC"; then
1899 dnl Remove /usr/lib, it causes trouble on some systems
1900 if test "$GUI_LIB_LOC" = /usr/lib; then
1901 GUI_LIB_LOC=
1902 AC_MSG_RESULT(in default path)
1903 else
1904 if test -n "$GUI_LIB_LOC"; then
1905 AC_MSG_RESULT($GUI_LIB_LOC)
1906 if test "`(uname) 2>/dev/null`" = SunOS &&
1907 uname -r | grep '^5' >/dev/null; then
1908 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1909 fi
1910 fi
1911 fi
1912 MOTIF_LIBNAME=-lXm
1913 else
1914 AC_MSG_RESULT(<not found>)
1915 SKIP_MOTIF=YES
1916 fi
1917 fi
1918fi
1919
1920if test -z "$SKIP_MOTIF"; then
1921 SKIP_ATHENA=YES
1922 SKIP_NEXTAW=YES
1923 GUITYPE=MOTIF
1924 AC_SUBST(MOTIF_LIBNAME)
1925fi
1926
1927dnl Check if the Athena files can be found
1928
1929GUI_X_LIBS=
1930
1931if test -z "$SKIP_ATHENA"; then
1932 AC_MSG_CHECKING(if Athena header files can be found)
1933 cflags_save=$CFLAGS
1934 CFLAGS="$CFLAGS $X_CFLAGS"
1935 AC_TRY_COMPILE([
1936#include <X11/Intrinsic.h>
1937#include <X11/Xaw/Paned.h>], ,
1938 AC_MSG_RESULT(yes),
1939 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1940 CFLAGS=$cflags_save
1941fi
1942
1943if test -z "$SKIP_ATHENA"; then
1944 GUITYPE=ATHENA
1945fi
1946
1947if test -z "$SKIP_NEXTAW"; then
1948 AC_MSG_CHECKING(if neXtaw header files can be found)
1949 cflags_save=$CFLAGS
1950 CFLAGS="$CFLAGS $X_CFLAGS"
1951 AC_TRY_COMPILE([
1952#include <X11/Intrinsic.h>
1953#include <X11/neXtaw/Paned.h>], ,
1954 AC_MSG_RESULT(yes),
1955 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1956 CFLAGS=$cflags_save
1957fi
1958
1959if test -z "$SKIP_NEXTAW"; then
1960 GUITYPE=NEXTAW
1961fi
1962
1963if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1964 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1965 dnl Avoid adding it when it twice
1966 if test -n "$GUI_INC_LOC"; then
1967 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1968 fi
1969 if test -n "$GUI_LIB_LOC"; then
1970 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1971 fi
1972
1973 dnl Check for -lXext and then for -lXmu
1974 ldflags_save=$LDFLAGS
1975 LDFLAGS="$X_LIBS $LDFLAGS"
1976 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1977 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1978 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1979 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1980 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1981 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1982 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1983 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1984 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1985 if test -z "$SKIP_MOTIF"; then
1986 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1987 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1988 fi
1989 LDFLAGS=$ldflags_save
1990
1991 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1992 AC_MSG_CHECKING(for extra X11 defines)
1993 NARROW_PROTO=
1994 rm -fr conftestdir
1995 if mkdir conftestdir; then
1996 cd conftestdir
1997 cat > Imakefile <<'EOF'
1998acfindx:
1999 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
2000EOF
2001 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2002 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
2003 fi
2004 cd ..
2005 rm -fr conftestdir
2006 fi
2007 if test -z "$NARROW_PROTO"; then
2008 AC_MSG_RESULT(no)
2009 else
2010 AC_MSG_RESULT($NARROW_PROTO)
2011 fi
2012 AC_SUBST(NARROW_PROTO)
2013fi
2014
2015dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
2016dnl use the X11 include path
2017if test "$enable_xsmp" = "yes"; then
2018 cppflags_save=$CPPFLAGS
2019 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2020 AC_CHECK_HEADERS(X11/SM/SMlib.h)
2021 CPPFLAGS=$cppflags_save
2022fi
2023
2024
2025if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK"; then
2026 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
2027 cppflags_save=$CPPFLAGS
2028 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2029 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
2030
2031 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
2032 if test ! "$enable_xim" = "no"; then
2033 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
2034 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
2035 AC_MSG_RESULT(yes),
2036 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
2037 fi
2038 CPPFLAGS=$cppflags_save
2039
2040 dnl automatically enable XIM when hangul input isn't enabled
2041 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
2042 -a "x$GUITYPE" != "xNONE" ; then
2043 AC_MSG_RESULT(X GUI selected; xim has been enabled)
2044 enable_xim="yes"
2045 fi
2046fi
2047
2048if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2049 cppflags_save=$CPPFLAGS
2050 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002051dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
2052 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
2053 AC_TRY_COMPILE([
2054#include <X11/Intrinsic.h>
2055#include <X11/Xmu/Editres.h>],
2056 [int i; i = 0;],
2057 AC_MSG_RESULT(yes)
2058 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
2059 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00002060 CPPFLAGS=$cppflags_save
2061fi
2062
2063dnl Only use the Xm directory when compiling Motif, don't use it for Athena
2064if test -z "$SKIP_MOTIF"; then
2065 cppflags_save=$CPPFLAGS
2066 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00002067 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 +00002068 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002069
2070 if test $ac_cv_header_Xm_XpmP_h = yes; then
2071 dnl Solaris uses XpmAttributes_21, very annoying.
2072 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
2073 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
2074 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
2075 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2076 )
2077 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00002078 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00002079 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002080 CPPFLAGS=$cppflags_save
2081fi
2082
2083if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
2084 AC_MSG_RESULT(no GUI selected; xim has been disabled)
2085 enable_xim="no"
2086fi
2087if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
2088 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
2089 enable_fontset="no"
2090fi
2091if test "x$GUITYPE:$enable_fontset" = "xGTK:yes" -a "0$gtk_major_version" -ge 2; then
2092 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
2093 enable_fontset="no"
2094fi
2095
Bram Moolenaar071d4272004-06-13 20:20:40 +00002096if test -z "$SKIP_PHOTON"; then
2097 GUITYPE=PHOTONGUI
2098fi
2099
2100AC_SUBST(GUI_INC_LOC)
2101AC_SUBST(GUI_LIB_LOC)
2102AC_SUBST(GUITYPE)
2103AC_SUBST(GUI_X_LIBS)
2104
2105if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2106 AC_MSG_ERROR([cannot use workshop without Motif])
2107fi
2108
2109dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2110if test "$enable_xim" = "yes"; then
2111 AC_DEFINE(FEAT_XIM)
2112fi
2113if test "$enable_fontset" = "yes"; then
2114 AC_DEFINE(FEAT_XFONTSET)
2115fi
2116
2117
2118dnl ---------------------------------------------------------------------------
2119dnl end of GUI-checking
2120dnl ---------------------------------------------------------------------------
2121
2122
2123dnl Only really enable hangul input when GUI and XFONTSET are available
2124if test "$enable_hangulinput" = "yes"; then
2125 if test "x$GUITYPE" = "xNONE"; then
2126 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2127 enable_hangulinput=no
2128 else
2129 AC_DEFINE(FEAT_HANGULIN)
2130 HANGULIN_SRC=hangulin.c
2131 AC_SUBST(HANGULIN_SRC)
2132 HANGULIN_OBJ=objects/hangulin.o
2133 AC_SUBST(HANGULIN_OBJ)
2134 fi
2135fi
2136
2137dnl Checks for libraries and include files.
2138
Bram Moolenaar446cb832008-06-24 21:56:24 +00002139AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
2140 [
2141 AC_RUN_IFELSE([[
2142#include "confdefs.h"
2143#include <ctype.h>
2144#if STDC_HEADERS
2145# include <stdlib.h>
2146# include <stddef.h>
2147#endif
2148main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2149 ]],[
2150 vim_cv_toupper_broken=yes
2151 ],[
2152 vim_cv_toupper_broken=no
2153 ],[
2154 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2155 ])])
2156
2157if test "x$vim_cv_toupper_broken" = "xyes" ; then
2158 AC_DEFINE(BROKEN_TOUPPER)
2159fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002160
2161AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002162AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
Bram Moolenaar071d4272004-06-13 20:20:40 +00002163 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2164 AC_MSG_RESULT(no))
2165
Bram Moolenaar0c094b92009-05-14 20:20:33 +00002166AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
2167AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
2168 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
2169 AC_MSG_RESULT(no))
2170
Bram Moolenaar071d4272004-06-13 20:20:40 +00002171dnl Checks for header files.
2172AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2173dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2174if test "$HAS_ELF" = 1; then
2175 AC_CHECK_LIB(elf, main)
2176fi
2177
2178AC_HEADER_DIRENT
2179
Bram Moolenaar071d4272004-06-13 20:20:40 +00002180dnl If sys/wait.h is not found it might still exist but not be POSIX
2181dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2182if test $ac_cv_header_sys_wait_h = no; then
2183 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2184 AC_TRY_COMPILE([#include <sys/wait.h>],
2185 [union wait xx, yy; xx = yy],
2186 AC_MSG_RESULT(yes)
2187 AC_DEFINE(HAVE_SYS_WAIT_H)
2188 AC_DEFINE(HAVE_UNION_WAIT),
2189 AC_MSG_RESULT(no))
2190fi
2191
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002192AC_CHECK_HEADERS(stdarg.h stdint.h stdlib.h string.h \
2193 sys/select.h sys/utsname.h termcap.h fcntl.h \
2194 sgtty.h sys/ioctl.h sys/time.h sys/types.h \
2195 termio.h iconv.h inttypes.h langinfo.h math.h \
2196 unistd.h stropts.h errno.h sys/resource.h \
2197 sys/systeminfo.h locale.h sys/stream.h termios.h \
2198 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
2199 utime.h sys/param.h libintl.h libgen.h \
2200 util/debug.h util/msg18n.h frame.h sys/acl.h \
2201 sys/access.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002202
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002203dnl sys/ptem.h depends on sys/stream.h on Solaris
2204AC_CHECK_HEADERS(sys/ptem.h, [], [],
2205[#if defined HAVE_SYS_STREAM_H
2206# include <sys/stream.h>
2207#endif])
2208
Bram Moolenaar32f31b12009-05-21 13:20:59 +00002209dnl sys/sysctl.h depends on sys/param.h on OpenBSD
2210AC_CHECK_HEADERS(sys/sysctl.h, [], [],
2211[#if defined HAVE_SYS_PARAM_H
2212# include <sys/param.h>
2213#endif])
2214
Bram Moolenaar00ca2842008-06-26 20:14:00 +00002215
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002216dnl pthread_np.h may exist but can only be used after including pthread.h
2217AC_MSG_CHECKING([for pthread_np.h])
2218AC_TRY_COMPILE([
2219#include <pthread.h>
2220#include <pthread_np.h>],
2221 [int i; i = 0;],
2222 AC_MSG_RESULT(yes)
2223 AC_DEFINE(HAVE_PTHREAD_NP_H),
2224 AC_MSG_RESULT(no))
2225
Bram Moolenaare344bea2005-09-01 20:46:49 +00002226AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002227if test "x$MACOSX" = "xyes"; then
2228 dnl The strings.h file on OS/X contains a warning and nothing useful.
2229 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2230else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002231
2232dnl Check if strings.h and string.h can both be included when defined.
2233AC_MSG_CHECKING([if strings.h can be included after string.h])
2234cppflags_save=$CPPFLAGS
2235CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2236AC_TRY_COMPILE([
2237#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2238# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2239 /* but don't do it on AIX 5.1 (Uribarri) */
2240#endif
2241#ifdef HAVE_XM_XM_H
2242# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2243#endif
2244#ifdef HAVE_STRING_H
2245# include <string.h>
2246#endif
2247#if defined(HAVE_STRINGS_H)
2248# include <strings.h>
2249#endif
2250 ], [int i; i = 0;],
2251 AC_MSG_RESULT(yes),
2252 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2253 AC_MSG_RESULT(no))
2254CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002255fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002256
2257dnl Checks for typedefs, structures, and compiler characteristics.
2258AC_PROG_GCC_TRADITIONAL
2259AC_C_CONST
Bram Moolenaar76243bd2009-03-02 01:47:02 +00002260AC_C_VOLATILE
Bram Moolenaar071d4272004-06-13 20:20:40 +00002261AC_TYPE_MODE_T
2262AC_TYPE_OFF_T
2263AC_TYPE_PID_T
2264AC_TYPE_SIZE_T
2265AC_TYPE_UID_T
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002266AC_TYPE_UINT32_T
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002267
Bram Moolenaar071d4272004-06-13 20:20:40 +00002268AC_HEADER_TIME
2269AC_CHECK_TYPE(ino_t, long)
2270AC_CHECK_TYPE(dev_t, unsigned)
Bram Moolenaar0bbabe82010-05-17 20:32:55 +02002271AC_C_BIGENDIAN(,,,)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002272
2273AC_MSG_CHECKING(for rlim_t)
2274if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2275 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2276else
2277 AC_EGREP_CPP(dnl
2278changequote(<<,>>)dnl
2279<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2280changequote([,]),
2281 [
2282#include <sys/types.h>
2283#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002284# include <stdlib.h>
2285# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002286#endif
2287#ifdef HAVE_SYS_RESOURCE_H
Bram Moolenaar446cb832008-06-24 21:56:24 +00002288# include <sys/resource.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002289#endif
2290 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2291 AC_MSG_RESULT($ac_cv_type_rlim_t)
2292fi
2293if test $ac_cv_type_rlim_t = no; then
2294 cat >> confdefs.h <<\EOF
2295#define rlim_t unsigned long
2296EOF
2297fi
2298
2299AC_MSG_CHECKING(for stack_t)
2300if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2301 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2302else
2303 AC_EGREP_CPP(stack_t,
2304 [
2305#include <sys/types.h>
2306#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002307# include <stdlib.h>
2308# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002309#endif
2310#include <signal.h>
2311 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2312 AC_MSG_RESULT($ac_cv_type_stack_t)
2313fi
2314if test $ac_cv_type_stack_t = no; then
2315 cat >> confdefs.h <<\EOF
2316#define stack_t struct sigaltstack
2317EOF
2318fi
2319
2320dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2321AC_MSG_CHECKING(whether stack_t has an ss_base field)
2322AC_TRY_COMPILE([
2323#include <sys/types.h>
2324#if STDC_HEADERS
Bram Moolenaar446cb832008-06-24 21:56:24 +00002325# include <stdlib.h>
2326# include <stddef.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002327#endif
2328#include <signal.h>
2329#include "confdefs.h"
2330 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2331 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2332 AC_MSG_RESULT(no))
2333
2334olibs="$LIBS"
2335AC_MSG_CHECKING(--with-tlib argument)
2336AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2337if test -n "$with_tlib"; then
2338 AC_MSG_RESULT($with_tlib)
2339 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002340 AC_MSG_CHECKING(for linking with $with_tlib library)
2341 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2342 dnl Need to check for tgetent() below.
2343 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002344else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002345 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002346 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2347 dnl curses, because curses is much slower.
2348 dnl Newer versions of ncurses are preferred over anything.
2349 dnl Older versions of ncurses have bugs, get a new one!
2350 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002351 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002352 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002353 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002354 *) tlibs="ncurses termlib termcap curses";;
2355 esac
2356 for libname in $tlibs; do
2357 AC_CHECK_LIB(${libname}, tgetent,,)
2358 if test "x$olibs" != "x$LIBS"; then
2359 dnl It's possible that a library is found but it doesn't work
2360 dnl e.g., shared library that cannot be found
2361 dnl compile and run a test program to be sure
2362 AC_TRY_RUN([
2363#ifdef HAVE_TERMCAP_H
2364# include <termcap.h>
2365#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002366#if STDC_HEADERS
2367# include <stdlib.h>
2368# include <stddef.h>
2369#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002370main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2371 res="OK", res="FAIL", res="FAIL")
2372 if test "$res" = "OK"; then
2373 break
2374 fi
2375 AC_MSG_RESULT($libname library is not usable)
2376 LIBS="$olibs"
2377 fi
2378 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002379 if test "x$olibs" = "x$LIBS"; then
2380 AC_MSG_RESULT(no terminal library found)
2381 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002382fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002383
2384if test "x$olibs" = "x$LIBS"; then
2385 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002386 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002387 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2388 AC_MSG_RESULT(yes),
2389 AC_MSG_ERROR([NOT FOUND!
2390 You need to install a terminal library; for example ncurses.
2391 Or specify the name of the library with --with-tlib.]))
2392fi
2393
Bram Moolenaar446cb832008-06-24 21:56:24 +00002394AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2395 [
2396 AC_RUN_IFELSE([[
2397#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002398#ifdef HAVE_TERMCAP_H
2399# include <termcap.h>
2400#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002401#ifdef HAVE_STRING_H
2402# include <string.h>
2403#endif
2404#if STDC_HEADERS
2405# include <stdlib.h>
2406# include <stddef.h>
2407#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002408main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002409{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2410 ]],[
2411 vim_cv_terminfo=no
2412 ],[
2413 vim_cv_terminfo=yes
2414 ],[
2415 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2416 ])
2417 ])
2418
2419if test "x$vim_cv_terminfo" = "xyes" ; then
2420 AC_DEFINE(TERMINFO)
2421fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002422
2423if test "x$olibs" != "x$LIBS"; then
Bram Moolenaar446cb832008-06-24 21:56:24 +00002424 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2425 [
2426 AC_RUN_IFELSE([[
2427#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002428#ifdef HAVE_TERMCAP_H
2429# include <termcap.h>
2430#endif
Bram Moolenaar446cb832008-06-24 21:56:24 +00002431#if STDC_HEADERS
2432# include <stdlib.h>
2433# include <stddef.h>
2434#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002435main()
Bram Moolenaar446cb832008-06-24 21:56:24 +00002436{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2437 ]],[
2438 vim_cv_tgent=zero
2439 ],[
2440 vim_cv_tgent=non-zero
2441 ],[
2442 AC_MSG_ERROR(failed to compile test program.)
2443 ])
2444 ])
2445
2446 if test "x$vim_cv_tgent" = "xzero" ; then
2447 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2448 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002449fi
2450
2451AC_MSG_CHECKING(whether termcap.h contains ospeed)
2452AC_TRY_LINK([
2453#ifdef HAVE_TERMCAP_H
2454# include <termcap.h>
2455#endif
2456 ], [ospeed = 20000],
2457 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2458 [AC_MSG_RESULT(no)
2459 AC_MSG_CHECKING(whether ospeed can be extern)
2460 AC_TRY_LINK([
2461#ifdef HAVE_TERMCAP_H
2462# include <termcap.h>
2463#endif
2464extern short ospeed;
2465 ], [ospeed = 20000],
2466 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2467 AC_MSG_RESULT(no))]
2468 )
2469
2470AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2471AC_TRY_LINK([
2472#ifdef HAVE_TERMCAP_H
2473# include <termcap.h>
2474#endif
2475 ], [if (UP == 0 && BC == 0) PC = 1],
2476 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2477 [AC_MSG_RESULT(no)
2478 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2479 AC_TRY_LINK([
2480#ifdef HAVE_TERMCAP_H
2481# include <termcap.h>
2482#endif
2483extern char *UP, *BC, PC;
2484 ], [if (UP == 0 && BC == 0) PC = 1],
2485 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2486 AC_MSG_RESULT(no))]
2487 )
2488
2489AC_MSG_CHECKING(whether tputs() uses outfuntype)
2490AC_TRY_COMPILE([
2491#ifdef HAVE_TERMCAP_H
2492# include <termcap.h>
2493#endif
2494 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2495 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2496 AC_MSG_RESULT(no))
2497
2498dnl On some SCO machines sys/select redefines struct timeval
2499AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2500AC_TRY_COMPILE([
2501#include <sys/types.h>
2502#include <sys/time.h>
2503#include <sys/select.h>], ,
2504 AC_MSG_RESULT(yes)
2505 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2506 AC_MSG_RESULT(no))
2507
2508dnl AC_DECL_SYS_SIGLIST
2509
2510dnl Checks for pty.c (copied from screen) ==========================
2511AC_MSG_CHECKING(for /dev/ptc)
2512if test -r /dev/ptc; then
2513 AC_DEFINE(HAVE_DEV_PTC)
2514 AC_MSG_RESULT(yes)
2515else
2516 AC_MSG_RESULT(no)
2517fi
2518
2519AC_MSG_CHECKING(for SVR4 ptys)
2520if test -c /dev/ptmx ; then
2521 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2522 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2523 AC_MSG_RESULT(no))
2524else
2525 AC_MSG_RESULT(no)
2526fi
2527
2528AC_MSG_CHECKING(for ptyranges)
2529if test -d /dev/ptym ; then
2530 pdir='/dev/ptym'
2531else
2532 pdir='/dev'
2533fi
2534dnl SCO uses ptyp%d
2535AC_EGREP_CPP(yes,
2536[#ifdef M_UNIX
2537 yes;
2538#endif
2539 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2540dnl if test -c /dev/ptyp19; then
2541dnl ptys=`echo /dev/ptyp??`
2542dnl else
2543dnl ptys=`echo $pdir/pty??`
2544dnl fi
2545if test "$ptys" != "$pdir/pty??" ; then
2546 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2547 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2548 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2549 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2550 AC_MSG_RESULT([$p0 / $p1])
2551else
2552 AC_MSG_RESULT([don't know])
2553fi
2554
2555dnl **** pty mode/group handling ****
2556dnl
2557dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
Bram Moolenaar071d4272004-06-13 20:20:40 +00002558rm -f conftest_grp
Bram Moolenaar446cb832008-06-24 21:56:24 +00002559AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2560 [
2561 AC_RUN_IFELSE([[
2562#include "confdefs.h"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002563#include <sys/types.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002564#if STDC_HEADERS
2565# include <stdlib.h>
2566# include <stddef.h>
2567#endif
2568#ifdef HAVE_UNISTD_H
2569#include <unistd.h>
2570#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002571#include <sys/stat.h>
2572#include <stdio.h>
2573main()
2574{
2575 struct stat sb;
2576 char *x,*ttyname();
2577 int om, m;
2578 FILE *fp;
2579
2580 if (!(x = ttyname(0))) exit(1);
2581 if (stat(x, &sb)) exit(1);
2582 om = sb.st_mode;
2583 if (om & 002) exit(0);
2584 m = system("mesg y");
2585 if (m == -1 || m == 127) exit(1);
2586 if (stat(x, &sb)) exit(1);
2587 m = sb.st_mode;
2588 if (chmod(x, om)) exit(1);
2589 if (m & 002) exit(0);
2590 if (sb.st_gid == getgid()) exit(1);
2591 if (!(fp=fopen("conftest_grp", "w")))
2592 exit(1);
2593 fprintf(fp, "%d\n", sb.st_gid);
2594 fclose(fp);
2595 exit(0);
2596}
Bram Moolenaar446cb832008-06-24 21:56:24 +00002597 ]],[
2598 if test -f conftest_grp; then
2599 vim_cv_tty_group=`cat conftest_grp`
2600 if test "x$vim_cv_tty_mode" = "x" ; then
2601 vim_cv_tty_mode=0620
2602 fi
2603 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2604 else
2605 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002606 AC_MSG_RESULT([ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002607 fi
2608 ],[
2609 vim_cv_tty_group=world
Bram Moolenaar72951072009-12-02 16:58:33 +00002610 AC_MSG_RESULT([can't determine - assume ptys are world accessible])
Bram Moolenaar446cb832008-06-24 21:56:24 +00002611 ],[
2612 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2613 ])
2614 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002615rm -f conftest_grp
2616
Bram Moolenaar446cb832008-06-24 21:56:24 +00002617if test "x$vim_cv_tty_group" != "xworld" ; then
2618 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2619 if test "x$vim_cv_tty_mode" = "x" ; then
2620 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)])
2621 else
2622 AC_DEFINE(PTYMODE, 0620)
2623 fi
2624fi
2625
Bram Moolenaar071d4272004-06-13 20:20:40 +00002626dnl Checks for library functions. ===================================
2627
2628AC_TYPE_SIGNAL
2629
2630dnl find out what to use at the end of a signal function
2631if test $ac_cv_type_signal = void; then
2632 AC_DEFINE(SIGRETURN, [return])
2633else
2634 AC_DEFINE(SIGRETURN, [return 0])
2635fi
2636
2637dnl check if struct sigcontext is defined (used for SGI only)
2638AC_MSG_CHECKING(for struct sigcontext)
2639AC_TRY_COMPILE([
2640#include <signal.h>
2641test_sig()
2642{
2643 struct sigcontext *scont;
2644 scont = (struct sigcontext *)0;
2645 return 1;
2646} ], ,
2647 AC_MSG_RESULT(yes)
2648 AC_DEFINE(HAVE_SIGCONTEXT),
2649 AC_MSG_RESULT(no))
2650
2651dnl tricky stuff: try to find out if getcwd() is implemented with
2652dnl system("sh -c pwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +00002653AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2654 [
2655 AC_RUN_IFELSE([[
2656#include "confdefs.h"
2657#ifdef HAVE_UNISTD_H
2658#include <unistd.h>
2659#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002660char *dagger[] = { "IFS=pwd", 0 };
2661main()
2662{
2663 char buffer[500];
2664 extern char **environ;
2665 environ = dagger;
2666 return getcwd(buffer, 500) ? 0 : 1;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002667}
2668 ]],[
2669 vim_cv_getcwd_broken=no
2670 ],[
2671 vim_cv_getcwd_broken=yes
2672 ],[
2673 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2674 ])
2675 ])
2676
2677if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2678 AC_DEFINE(BAD_GETCWD)
2679fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002680
Bram Moolenaar25153e12010-02-24 14:47:08 +01002681dnl Check for functions in one big call, to reduce the size of configure.
2682dnl Can only be used for functions that do not require any include.
2683AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002684 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
Bram Moolenaareaf03392009-11-17 11:08:52 +00002685 memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002686 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002687 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002688 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2689 usleep utime utimes)
Bram Moolenaar25153e12010-02-24 14:47:08 +01002690AC_FUNC_FSEEKO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002691
Bram Moolenaar317fd3a2010-05-07 16:05:55 +02002692dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
2693dnl appropriate, so that off_t is 64 bits when needed.
2694AC_SYS_LARGEFILE
2695
Bram Moolenaar071d4272004-06-13 20:20:40 +00002696dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2697AC_MSG_CHECKING(for st_blksize)
2698AC_TRY_COMPILE(
2699[#include <sys/types.h>
2700#include <sys/stat.h>],
2701[ struct stat st;
2702 int n;
2703
2704 stat("/", &st);
2705 n = (int)st.st_blksize;],
2706 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2707 AC_MSG_RESULT(no))
2708
Bram Moolenaar446cb832008-06-24 21:56:24 +00002709AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2710 [
2711 AC_RUN_IFELSE([[
2712#include "confdefs.h"
2713#if STDC_HEADERS
2714# include <stdlib.h>
2715# include <stddef.h>
2716#endif
2717#include <sys/types.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002718#include <sys/stat.h>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002719main() {struct stat st; exit(stat("configure/", &st) != 0); }
2720 ]],[
2721 vim_cv_stat_ignores_slash=yes
2722 ],[
2723 vim_cv_stat_ignores_slash=no
2724 ],[
2725 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2726 ])
2727 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002728
Bram Moolenaar446cb832008-06-24 21:56:24 +00002729if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2730 AC_DEFINE(STAT_IGNORES_SLASH)
2731fi
2732
Bram Moolenaar071d4272004-06-13 20:20:40 +00002733dnl Link with iconv for charset translation, if not found without library.
2734dnl check for iconv() requires including iconv.h
2735dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2736dnl has been installed.
2737AC_MSG_CHECKING(for iconv_open())
2738save_LIBS="$LIBS"
2739LIBS="$LIBS -liconv"
2740AC_TRY_LINK([
2741#ifdef HAVE_ICONV_H
2742# include <iconv.h>
2743#endif
2744 ], [iconv_open("fr", "to");],
2745 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2746 LIBS="$save_LIBS"
2747 AC_TRY_LINK([
2748#ifdef HAVE_ICONV_H
2749# include <iconv.h>
2750#endif
2751 ], [iconv_open("fr", "to");],
2752 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2753 AC_MSG_RESULT(no)))
2754
2755
2756AC_MSG_CHECKING(for nl_langinfo(CODESET))
2757AC_TRY_LINK([
2758#ifdef HAVE_LANGINFO_H
2759# include <langinfo.h>
2760#endif
2761], [char *cs = nl_langinfo(CODESET);],
2762 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2763 AC_MSG_RESULT(no))
2764
Bram Moolenaar446cb832008-06-24 21:56:24 +00002765dnl Need various functions for floating point support. Only enable
2766dnl floating point when they are all present.
2767AC_CHECK_LIB(m, strtod)
2768AC_MSG_CHECKING([for strtod() and other floating point functions])
2769AC_TRY_LINK([
2770#ifdef HAVE_MATH_H
2771# include <math.h>
2772#endif
2773#if STDC_HEADERS
2774# include <stdlib.h>
2775# include <stddef.h>
2776#endif
2777], [char *s; double d;
2778 d = strtod("1.1", &s);
2779 d = fabs(1.11);
2780 d = ceil(1.11);
2781 d = floor(1.11);
2782 d = log10(1.11);
2783 d = pow(1.11, 2.22);
2784 d = sqrt(1.11);
2785 d = sin(1.11);
2786 d = cos(1.11);
2787 d = atan(1.11);
2788 ],
2789 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2790 AC_MSG_RESULT(no))
2791
Bram Moolenaar071d4272004-06-13 20:20:40 +00002792dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2793dnl when -lacl works, also try to use -lattr (required for Debian).
2794AC_MSG_CHECKING(--disable-acl argument)
2795AC_ARG_ENABLE(acl,
2796 [ --disable-acl Don't check for ACL support.],
2797 , [enable_acl="yes"])
2798if test "$enable_acl" = "yes"; then
2799AC_MSG_RESULT(no)
2800AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2801 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2802 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2803
2804AC_MSG_CHECKING(for POSIX ACL support)
2805AC_TRY_LINK([
2806#include <sys/types.h>
2807#ifdef HAVE_SYS_ACL_H
2808# include <sys/acl.h>
2809#endif
2810acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2811 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2812 acl_free(acl);],
2813 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2814 AC_MSG_RESULT(no))
2815
2816AC_MSG_CHECKING(for Solaris ACL support)
2817AC_TRY_LINK([
2818#ifdef HAVE_SYS_ACL_H
2819# include <sys/acl.h>
2820#endif], [acl("foo", GETACLCNT, 0, NULL);
2821 ],
2822 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2823 AC_MSG_RESULT(no))
2824
2825AC_MSG_CHECKING(for AIX ACL support)
2826AC_TRY_LINK([
Bram Moolenaar446cb832008-06-24 21:56:24 +00002827#if STDC_HEADERS
2828# include <stdlib.h>
2829# include <stddef.h>
2830#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002831#ifdef HAVE_SYS_ACL_H
2832# include <sys/acl.h>
2833#endif
2834#ifdef HAVE_SYS_ACCESS_H
2835# include <sys/access.h>
2836#endif
2837#define _ALL_SOURCE
2838
2839#include <sys/stat.h>
2840
2841int aclsize;
2842struct acl *aclent;], [aclsize = sizeof(struct acl);
2843 aclent = (void *)malloc(aclsize);
2844 statacl("foo", STX_NORMAL, aclent, aclsize);
2845 ],
2846 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2847 AC_MSG_RESULT(no))
2848else
2849 AC_MSG_RESULT(yes)
2850fi
2851
2852AC_MSG_CHECKING(--disable-gpm argument)
2853AC_ARG_ENABLE(gpm,
2854 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2855 [enable_gpm="yes"])
2856
2857if test "$enable_gpm" = "yes"; then
2858 AC_MSG_RESULT(no)
2859 dnl Checking if gpm support can be compiled
2860 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2861 [olibs="$LIBS" ; LIBS="-lgpm"]
2862 AC_TRY_LINK(
2863 [#include <gpm.h>
2864 #include <linux/keyboard.h>],
2865 [Gpm_GetLibVersion(NULL);],
2866 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2867 dnl FEAT_MOUSE_GPM if mouse support is included
2868 [vi_cv_have_gpm=yes],
2869 [vi_cv_have_gpm=no])
2870 [LIBS="$olibs"]
2871 )
2872 if test $vi_cv_have_gpm = yes; then
2873 LIBS="$LIBS -lgpm"
2874 AC_DEFINE(HAVE_GPM)
2875 fi
2876else
2877 AC_MSG_RESULT(yes)
2878fi
2879
Bram Moolenaar446cb832008-06-24 21:56:24 +00002880AC_MSG_CHECKING(--disable-sysmouse argument)
2881AC_ARG_ENABLE(sysmouse,
2882 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2883 [enable_sysmouse="yes"])
2884
2885if test "$enable_sysmouse" = "yes"; then
2886 AC_MSG_RESULT(no)
2887 dnl Checking if sysmouse support can be compiled
2888 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
2889 dnl defines FEAT_SYSMOUSE if mouse support is included
2890 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
2891 AC_TRY_LINK(
2892 [#include <sys/consio.h>
2893 #include <signal.h>
2894 #include <sys/fbio.h>],
2895 [struct mouse_info mouse;
2896 mouse.operation = MOUSE_MODE;
2897 mouse.operation = MOUSE_SHOW;
2898 mouse.u.mode.mode = 0;
2899 mouse.u.mode.signal = SIGUSR2;],
2900 [vi_cv_have_sysmouse=yes],
2901 [vi_cv_have_sysmouse=no])
2902 )
2903 if test $vi_cv_have_sysmouse = yes; then
2904 AC_DEFINE(HAVE_SYSMOUSE)
2905 fi
2906else
2907 AC_MSG_RESULT(yes)
2908fi
2909
Bram Moolenaarf05da212009-11-17 16:13:15 +00002910dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
2911AC_MSG_CHECKING(for FD_CLOEXEC)
2912AC_TRY_COMPILE(
2913[#if HAVE_FCNTL_H
2914# include <fcntl.h>
2915#endif],
2916[ int flag = FD_CLOEXEC;],
2917 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
2918 AC_MSG_RESULT(not usable))
2919
Bram Moolenaar071d4272004-06-13 20:20:40 +00002920dnl rename needs to be checked separately to work on Nextstep with cc
2921AC_MSG_CHECKING(for rename)
2922AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2923 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2924 AC_MSG_RESULT(no))
2925
2926dnl sysctl() may exist but not the arguments we use
2927AC_MSG_CHECKING(for sysctl)
2928AC_TRY_COMPILE(
2929[#include <sys/types.h>
2930#include <sys/sysctl.h>],
2931[ int mib[2], r;
2932 size_t len;
2933
2934 mib[0] = CTL_HW;
2935 mib[1] = HW_USERMEM;
2936 len = sizeof(r);
2937 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2938 ],
2939 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2940 AC_MSG_RESULT(not usable))
2941
2942dnl sysinfo() may exist but not be Linux compatible
2943AC_MSG_CHECKING(for sysinfo)
2944AC_TRY_COMPILE(
2945[#include <sys/types.h>
2946#include <sys/sysinfo.h>],
2947[ struct sysinfo sinfo;
2948 int t;
2949
2950 (void)sysinfo(&sinfo);
2951 t = sinfo.totalram;
2952 ],
2953 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2954 AC_MSG_RESULT(not usable))
2955
Bram Moolenaar914572a2007-05-01 11:37:47 +00002956dnl struct sysinfo may have the mem_unit field or not
2957AC_MSG_CHECKING(for sysinfo.mem_unit)
2958AC_TRY_COMPILE(
2959[#include <sys/types.h>
2960#include <sys/sysinfo.h>],
2961[ struct sysinfo sinfo;
2962 sinfo.mem_unit = 1;
2963 ],
2964 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
2965 AC_MSG_RESULT(no))
2966
Bram Moolenaar071d4272004-06-13 20:20:40 +00002967dnl sysconf() may exist but not support what we want to use
2968AC_MSG_CHECKING(for sysconf)
2969AC_TRY_COMPILE(
2970[#include <unistd.h>],
2971[ (void)sysconf(_SC_PAGESIZE);
2972 (void)sysconf(_SC_PHYS_PAGES);
2973 ],
2974 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2975 AC_MSG_RESULT(not usable))
2976
Bram Moolenaar914703b2010-05-31 21:59:46 +02002977AC_CHECK_SIZEOF([int])
2978AC_CHECK_SIZEOF([long])
2979AC_CHECK_SIZEOF([time_t])
2980AC_CHECK_SIZEOF([off_t])
Bram Moolenaar644fdff2010-05-30 13:26:21 +02002981
Bram Moolenaarfa7584c2010-05-19 21:57:45 +02002982dnl Make sure that uint32_t is really 32 bits unsigned.
2983AC_MSG_CHECKING([uint32_t is 32 bits])
2984AC_TRY_RUN([
2985#ifdef HAVE_STDINT_H
2986# include <stdint.h>
2987#endif
2988#ifdef HAVE_INTTYPES_H
2989# include <inttypes.h>
2990#endif
2991main() {
2992 uint32_t nr1 = (uint32_t)-1;
2993 uint32_t nr2 = (uint32_t)0xffffffffUL;
2994 if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
2995 exit(0);
2996}],
2997AC_MSG_RESULT(ok),
2998AC_MSG_ERROR([WRONG! uint32_t not defined correctly.]),
2999AC_MSG_ERROR([could not compile program using uint32_t.]))
3000
Bram Moolenaar446cb832008-06-24 21:56:24 +00003001dnl Check for memmove() before bcopy(), makes memmove() be used when both are
3002dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
3003
Bram Moolenaar071d4272004-06-13 20:20:40 +00003004[bcopy_test_prog='
Bram Moolenaar446cb832008-06-24 21:56:24 +00003005#include "confdefs.h"
3006#ifdef HAVE_STRING_H
3007# include <string.h>
3008#endif
3009#if STDC_HEADERS
3010# include <stdlib.h>
3011# include <stddef.h>
3012#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00003013main() {
3014 char buf[10];
3015 strcpy(buf, "abcdefghi");
3016 mch_memmove(buf, buf + 2, 3);
3017 if (strncmp(buf, "ababcf", 6))
3018 exit(1);
3019 strcpy(buf, "abcdefghi");
3020 mch_memmove(buf + 2, buf, 3);
3021 if (strncmp(buf, "cdedef", 6))
3022 exit(1);
3023 exit(0); /* libc version works properly. */
3024}']
3025
Bram Moolenaar446cb832008-06-24 21:56:24 +00003026AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
3027 [
3028 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
3029 [
3030 vim_cv_memmove_handles_overlap=yes
3031 ],[
3032 vim_cv_memmove_handles_overlap=no
3033 ],[
3034 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
3035 ])
3036 ])
Bram Moolenaar071d4272004-06-13 20:20:40 +00003037
Bram Moolenaar446cb832008-06-24 21:56:24 +00003038if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
3039 AC_DEFINE(USEMEMMOVE)
3040else
3041 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
3042 [
3043 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
3044 [
3045 vim_cv_bcopy_handles_overlap=yes
3046 ],[
3047 vim_cv_bcopy_handles_overlap=no
3048 ],[
3049 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
3050 ])
3051 ])
3052
3053 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
3054 AC_DEFINE(USEBCOPY)
3055 else
3056 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
3057 [
3058 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
3059 [
3060 vim_cv_memcpy_handles_overlap=yes
3061 ],[
3062 vim_cv_memcpy_handles_overlap=no
3063 ],[
3064 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
3065 ])
3066 ])
3067
3068 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
3069 AC_DEFINE(USEMEMCPY)
3070 fi
3071 fi
3072fi
3073
Bram Moolenaar071d4272004-06-13 20:20:40 +00003074
3075dnl Check for multibyte locale functions
3076dnl Find out if _Xsetlocale() is supported by libX11.
3077dnl Check if X_LOCALE should be defined.
3078
3079if test "$enable_multibyte" = "yes"; then
3080 cflags_save=$CFLAGS
3081 ldflags_save=$LDFLAGS
Bram Moolenaar94ba1ce2009-04-22 15:53:09 +00003082 if test "x$x_includes" != "xNONE" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00003083 CFLAGS="$CFLAGS -I$x_includes"
3084 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
3085 AC_MSG_CHECKING(whether X_LOCALE needed)
3086 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
3087 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
3088 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
3089 AC_MSG_RESULT(no))
3090 fi
3091 CFLAGS=$cflags_save
3092 LDFLAGS=$ldflags_save
3093fi
3094
3095dnl Link with xpg4, it is said to make Korean locale working
3096AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
3097
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003098dnl Check how we can run ctags. Default to "ctags" when nothing works.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003099dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003100dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003101dnl -t for typedefs (many ctags have this)
3102dnl -s for static functions (Elvis ctags only?)
3103dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
3104dnl -i+m to test for older Exuberant ctags
3105AC_MSG_CHECKING(how to create tags)
3106test -f tags && mv tags tags.save
3107if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00003108 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003109else
Bram Moolenaar0c7ce772009-05-13 12:49:39 +00003110 TAGPRG="ctags"
Bram Moolenaar071d4272004-06-13 20:20:40 +00003111 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
3112 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
3113 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
3114 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
3115 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
3116 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
3117 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
3118fi
3119test -f tags.save && mv tags.save tags
3120AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
3121
3122dnl Check how we can run man with a section number
3123AC_MSG_CHECKING(how to run man with a section nr)
3124MANDEF="man"
Bram Moolenaar8b131502008-02-13 09:28:19 +00003125(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 +00003126AC_MSG_RESULT($MANDEF)
3127if test "$MANDEF" = "man -s"; then
3128 AC_DEFINE(USEMAN_S)
3129fi
3130
3131dnl Check if gettext() is working and if it needs -lintl
3132AC_MSG_CHECKING(--disable-nls argument)
3133AC_ARG_ENABLE(nls,
3134 [ --disable-nls Don't support NLS (gettext()).], ,
3135 [enable_nls="yes"])
3136
3137if test "$enable_nls" = "yes"; then
3138 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00003139
3140 INSTALL_LANGS=install-languages
3141 AC_SUBST(INSTALL_LANGS)
3142 INSTALL_TOOL_LANGS=install-tool-languages
3143 AC_SUBST(INSTALL_TOOL_LANGS)
3144
Bram Moolenaar071d4272004-06-13 20:20:40 +00003145 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
3146 AC_MSG_CHECKING([for NLS])
3147 if test -f po/Makefile; then
3148 have_gettext="no"
3149 if test -n "$MSGFMT"; then
3150 AC_TRY_LINK(
3151 [#include <libintl.h>],
3152 [gettext("Test");],
3153 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3154 olibs=$LIBS
3155 LIBS="$LIBS -lintl"
3156 AC_TRY_LINK(
3157 [#include <libintl.h>],
3158 [gettext("Test");],
3159 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3160 AC_MSG_RESULT([gettext() doesn't work]);
3161 LIBS=$olibs))
3162 else
3163 AC_MSG_RESULT([msgfmt not found - disabled]);
3164 fi
3165 if test $have_gettext = "yes"; then
3166 AC_DEFINE(HAVE_GETTEXT)
3167 MAKEMO=yes
3168 AC_SUBST(MAKEMO)
3169 dnl this was added in GNU gettext 0.10.36
3170 AC_CHECK_FUNCS(bind_textdomain_codeset)
3171 dnl _nl_msg_cat_cntr is required for GNU gettext
3172 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3173 AC_TRY_LINK(
3174 [#include <libintl.h>
3175 extern int _nl_msg_cat_cntr;],
3176 [++_nl_msg_cat_cntr;],
3177 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3178 AC_MSG_RESULT([no]))
3179 fi
3180 else
3181 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3182 fi
3183else
3184 AC_MSG_RESULT(yes)
3185fi
3186
3187dnl Check for dynamic linking loader
3188AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3189if test x${DLL} = xdlfcn.h; then
3190 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3191 AC_MSG_CHECKING([for dlopen()])
3192 AC_TRY_LINK(,[
3193 extern void* dlopen();
3194 dlopen();
3195 ],
3196 AC_MSG_RESULT(yes);
3197 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3198 AC_MSG_RESULT(no);
3199 AC_MSG_CHECKING([for dlopen() in -ldl])
3200 olibs=$LIBS
3201 LIBS="$LIBS -ldl"
3202 AC_TRY_LINK(,[
3203 extern void* dlopen();
3204 dlopen();
3205 ],
3206 AC_MSG_RESULT(yes);
3207 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3208 AC_MSG_RESULT(no);
3209 LIBS=$olibs))
3210 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3211 dnl ick :-)
3212 AC_MSG_CHECKING([for dlsym()])
3213 AC_TRY_LINK(,[
3214 extern void* dlsym();
3215 dlsym();
3216 ],
3217 AC_MSG_RESULT(yes);
3218 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3219 AC_MSG_RESULT(no);
3220 AC_MSG_CHECKING([for dlsym() in -ldl])
3221 olibs=$LIBS
3222 LIBS="$LIBS -ldl"
3223 AC_TRY_LINK(,[
3224 extern void* dlsym();
3225 dlsym();
3226 ],
3227 AC_MSG_RESULT(yes);
3228 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3229 AC_MSG_RESULT(no);
3230 LIBS=$olibs))
3231elif test x${DLL} = xdl.h; then
3232 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3233 AC_MSG_CHECKING([for shl_load()])
3234 AC_TRY_LINK(,[
3235 extern void* shl_load();
3236 shl_load();
3237 ],
3238 AC_MSG_RESULT(yes);
3239 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3240 AC_MSG_RESULT(no);
3241 AC_MSG_CHECKING([for shl_load() in -ldld])
3242 olibs=$LIBS
3243 LIBS="$LIBS -ldld"
3244 AC_TRY_LINK(,[
3245 extern void* shl_load();
3246 shl_load();
3247 ],
3248 AC_MSG_RESULT(yes);
3249 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3250 AC_MSG_RESULT(no);
3251 LIBS=$olibs))
3252fi
3253AC_CHECK_HEADERS(setjmp.h)
3254
3255if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3256 dnl -ldl must come after DynaLoader.a
3257 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3258 LIBS=`echo $LIBS | sed s/-ldl//`
3259 PERL_LIBS="$PERL_LIBS -ldl"
3260 fi
3261fi
3262
3263if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
3264 && test "x$GUITYPE" != "xCARBONGUI"; then
3265 AC_MSG_CHECKING(whether we need -framework Carbon)
3266 dnl check for MACOSX without Carbon GUI, but with FEAT_MBYTE
Bram Moolenaarb90daee2006-10-17 09:49:09 +00003267 if test "x$enable_multibyte" = "xyes" || test "x$features" = "xbig" \
Bram Moolenaar071d4272004-06-13 20:20:40 +00003268 || test "x$features" = "xhuge"; then
3269 LIBS="$LIBS -framework Carbon"
3270 AC_MSG_RESULT(yes)
3271 else
3272 AC_MSG_RESULT(no)
3273 fi
3274fi
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003275if test "x$MACARCH" = "xboth"; then
Bram Moolenaar595a7be2010-03-10 16:28:12 +01003276 LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +00003277fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00003278
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003279dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3280dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3281dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00003282dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3283dnl the number before the version number.
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003284DEPEND_CFLAGS_FILTER=
3285if test "$GCC" = yes; then
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003286 AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaar2217cae2006-03-25 21:55:52 +00003287 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00003288 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003289 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003290 AC_MSG_RESULT(yes)
3291 else
3292 AC_MSG_RESULT(no)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003293 fi
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003294 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3295 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003296 dnl Also remove duplicate _FORTIFY_SOURCE arguments.
Bram Moolenaar0cd49302008-11-20 09:37:01 +00003297 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3298 if test "$gccmajor" -gt "3"; then
Bram Moolenaar56d1db32009-12-16 16:14:51 +00003299 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 +00003300 AC_MSG_RESULT(yes)
3301 else
3302 AC_MSG_RESULT(no)
3303 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00003304fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00003305AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00003306
3307dnl write output files
3308AC_OUTPUT(auto/config.mk:config.mk.in)
3309
3310dnl vim: set sw=2 tw=78 fo+=l: