blob: 254ca0da6c6e4a3fbceb44363ce050aa039e61e2 [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
26dnl Set default value for CFLAGS if none is defined or it's empty
27if test -z "$CFLAGS"; then
28 CFLAGS="-O"
29 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
30fi
31if test "$GCC" = yes; then
Bram Moolenaar910f66f2006-04-05 20:41:53 +000032 dnl method that should work for nearly all versions
33 gccversion=`"$CC" -dumpversion`
34 if test "x$gccversion" = "x"; then
35 dnl old method; fall-back for when -dumpversion doesn't work
36 gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
37 fi
Bram Moolenaara5792f52005-11-23 21:25:05 +000038 dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
39 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +000040 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
Bram Moolenaar071d4272004-06-13 20:20:40 +000041 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
42 else
43 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
44 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
45 CFLAGS="$CFLAGS -fno-strength-reduce"
46 fi
47 fi
48fi
49
50dnl If configure thinks we are cross compiling, there is probably something
51dnl wrong with the CC or CFLAGS settings, give an understandable error message
52if test "$cross_compiling" = yes; then
53 AC_MSG_ERROR([cannot compile a simple program, check CC and CFLAGS
54 (cross compiling doesn't work)])
55fi
56
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000057dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
58dnl But gcc 3.1 changed the meaning! See near the end.
Bram Moolenaar071d4272004-06-13 20:20:40 +000059test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
60
61if test -f ./toolcheck; then
62 AC_CHECKING(for buggy tools)
63 sh ./toolcheck 1>&AC_FD_MSG
64fi
65
66OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
67
68dnl Check for BeOS, which needs an extra source file
69AC_MSG_CHECKING(for BeOS)
70case `uname` in
71 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
72 BEOS=yes; AC_MSG_RESULT(yes);;
73 *) BEOS=no; AC_MSG_RESULT(no);;
74esac
75
76dnl If QNX is found, assume we don't want to use Xphoton
77dnl unless it was specifically asked for (--with-x)
78AC_MSG_CHECKING(for QNX)
79case `uname` in
80 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
81 test -z "$with_x" && with_x=no
82 QNX=yes; AC_MSG_RESULT(yes);;
83 *) QNX=no; AC_MSG_RESULT(no);;
84esac
85
86dnl Check for Darwin and MacOS X
87dnl We do a check for MacOS X in the very beginning because there
88dnl are a lot of other things we need to change besides GUI stuff
Bram Moolenaar071d4272004-06-13 20:20:40 +000089AC_MSG_CHECKING([for Darwin (Mac OS X)])
90if test "`(uname) 2>/dev/null`" = Darwin; then
91 AC_MSG_RESULT(yes)
92
93 AC_MSG_CHECKING(--disable-darwin argument)
94 AC_ARG_ENABLE(darwin,
95 [ --disable-darwin Disable Darwin (Mac OS X) support.],
96 , [enable_darwin="yes"])
97 if test "$enable_darwin" = "yes"; then
98 AC_MSG_RESULT(no)
99 AC_MSG_CHECKING(if Darwin files are there)
100 if test -f os_macosx.c; then
101 AC_MSG_RESULT(yes)
102 else
103 AC_MSG_RESULT([no, Darwin support disabled])
104 enable_darwin=no
105 fi
106 else
107 AC_MSG_RESULT([yes, Darwin support excluded])
108 fi
109
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000110 AC_MSG_CHECKING(--with-mac-arch argument)
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000111 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000112 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
Bram Moolenaar899dddf2006-03-26 21:06:50 +0000113 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000114
115 if test "x$MACARCH" = "xboth"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000116 AC_MSG_CHECKING(for 10.4 universal SDK)
117 dnl There is a terrible inconsistency (but we appear to get away with it):
118 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
119 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
120 dnl tests using the preprocessor are actually done with the wrong header
121 dnl files. $LDFLAGS is set at the end, because configure uses it together
122 dnl with $CFLAGS and we can only have one -sysroot argument.
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000123 save_cppflags="$CPPFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000124 save_cflags="$CFLAGS"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000125 save_ldflags="$LDFLAGS"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000126 CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000127 AC_TRY_LINK([ ], [ ],
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000128 AC_MSG_RESULT(found, will make universal binary),
129
130 AC_MSG_RESULT(not found)
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000131 CFLAGS="$save_cflags"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000132 AC_MSG_CHECKING(if Intel architecture is supported)
133 CPPFLAGS="$CPPFLAGS -arch i386"
134 LDFLAGS="$save_ldflags -arch i386"
135 AC_TRY_LINK([ ], [ ],
136 AC_MSG_RESULT(yes); MACARCH="intel",
137 AC_MSG_RESULT(no, using PowerPC)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000138 MACARCH="ppc"
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000139 CPPFLAGS="$save_cppflags -arch ppc"
140 LDFLAGS="$save_ldflags -arch ppc"))
141 elif test "x$MACARCH" = "xintel"; then
142 CPPFLAGS="$CPPFLAGS -arch intel"
143 LDFLAGS="$LDFLAGS -arch intel"
Bram Moolenaare2f98b92006-03-29 21:18:24 +0000144 elif test "x$MACARCH" = "xppc"; then
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000145 CPPFLAGS="$CPPFLAGS -arch ppc"
146 LDFLAGS="$LDFLAGS -arch ppc"
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000147 fi
148
Bram Moolenaar071d4272004-06-13 20:20:40 +0000149 if test "$enable_darwin" = "yes"; then
150 MACOSX=yes
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000151 OS_EXTRA_SCR="os_macosx.c os_mac_conv.c";
152 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
Bram Moolenaar32466aa2006-02-24 23:53:04 +0000153 dnl TODO: use -arch i386 on Intel machines
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000154 CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
155 if test "x$MACARCH" = "xboth"; then
156 CPPFLAGS="$CPPFLAGS -I/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
157 else
158 CPPFLAGS="$CPPFLAGS -I/Developer/Headers/FlatCarbon"
159 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000160
161 dnl If Carbon is found, assume we don't want X11
162 dnl unless it was specifically asked for (--with-x)
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000163 dnl or Motif, Athena or GTK GUI is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000164 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
165 if test "x$CARBON" = "xyes"; then
Bram Moolenaarab79bcb2004-07-18 21:34:53 +0000166 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 +0000167 with_x=no
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168 fi
169 fi
170 fi
Bram Moolenaara23ccb82006-02-27 00:08:02 +0000171
Bram Moolenaardb552d602006-03-23 22:59:57 +0000172 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000173 dnl free. This happens in expand_filename(), because the optimizer swaps
Bram Moolenaardb552d602006-03-23 22:59:57 +0000174 dnl two blocks of code, both using "repl", that can't be swapped.
Bram Moolenaare224ffa2006-03-01 00:01:28 +0000175 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
176 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
177 fi
178
Bram Moolenaar071d4272004-06-13 20:20:40 +0000179else
180 AC_MSG_RESULT(no)
181fi
182
183AC_SUBST(OS_EXTRA_SRC)
184AC_SUBST(OS_EXTRA_OBJ)
185
186dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
187dnl Only when the directory exists and it wasn't there yet.
188dnl For gcc don't do this when it is already in the default search path.
189have_local_include=''
190have_local_lib=''
191if test "$GCC" = yes; then
192 echo 'void f(){}' > conftest.c
193 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
194 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep '/usr/local/include'`
195 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep '/usr/local/lib'`
196 rm -f conftest.c conftest.o
197fi
198if test -z "$have_local_lib" -a -d /usr/local/lib; then
199 tt=`echo "$LDFLAGS" | sed -e 's+-L/usr/local/lib ++g' -e 's+-L/usr/local/lib$++g'`
200 if test "$tt" = "$LDFLAGS"; then
201 LDFLAGS="$LDFLAGS -L/usr/local/lib"
202 fi
203fi
204if test -z "$have_local_include" -a -d /usr/local/include; then
205 tt=`echo "$CPPFLAGS" | sed -e 's+-I/usr/local/include ++g' -e 's+-I/usr/local/include$++g'`
206 if test "$tt" = "$CPPFLAGS"; then
207 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
208 fi
209fi
210
211AC_MSG_CHECKING(--with-vim-name argument)
212AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
213 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
Bram Moolenaare344bea2005-09-01 20:46:49 +0000214 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215AC_SUBST(VIMNAME)
216AC_MSG_CHECKING(--with-ex-name argument)
217AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
218 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
219 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
220AC_SUBST(EXNAME)
221AC_MSG_CHECKING(--with-view-name argument)
222AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
223 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
224 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
225AC_SUBST(VIEWNAME)
226
227AC_MSG_CHECKING(--with-global-runtime argument)
228AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
229 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
230 AC_MSG_RESULT(no))
231
232AC_MSG_CHECKING(--with-modified-by argument)
233AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
234 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
235 AC_MSG_RESULT(no))
236
237dnl Check for EBCDIC stolen from the LYNX port to OS390 Unix
238AC_MSG_CHECKING(if character set is EBCDIC)
239AC_TRY_COMPILE([ ],
240[ /* TryCompile function for CharSet.
241 Treat any failure as ASCII for compatibility with existing art.
242 Use compile-time rather than run-time tests for cross-compiler
243 tolerance. */
244#if '0'!=240
245make an error "Character set is not EBCDIC"
246#endif ],
247[ # TryCompile action if true
248cf_cv_ebcdic=yes ],
249[ # TryCompile action if false
250cf_cv_ebcdic=no])
251# end of TryCompile ])
252# end of CacheVal CvEbcdic
253AC_MSG_RESULT($cf_cv_ebcdic)
254case "$cf_cv_ebcdic" in #(vi
255 yes) AC_DEFINE(EBCDIC)
256 line_break='"\\n"'
257 ;;
258 *) line_break='"\\012"';;
259esac
260AC_SUBST(line_break)
261
262if test "$cf_cv_ebcdic" = "yes"; then
263dnl If we have EBCDIC we most likley have OS390 Unix, let's test it!
264AC_MSG_CHECKING(for OS/390 Unix)
265case `uname` in
266 OS/390) OS390Unix="yes";
267 dnl If using cc the environment variable _CC_CCMODE must be
268 dnl set to "1", so that some compiler extensions are enabled.
269 dnl If using c89 the environment variable is named _CC_C89MODE.
270 dnl Note: compile with c89 never tested.
271 if test "$CC" = "cc"; then
272 ccm="$_CC_CCMODE"
273 ccn="CC"
274 else
275 if test "$CC" = "c89"; then
276 ccm="$_CC_C89MODE"
277 ccn="C89"
278 else
279 ccm=1
280 fi
281 fi
282 if test "$ccm" != "1"; then
283 echo ""
284 echo "------------------------------------------"
285 echo " On OS/390 Unix, the environment variable"
286 echo " __CC_${ccn}MODE must be set to \"1\"!"
287 echo " Do:"
288 echo " export _CC_${ccn}MODE=1"
289 echo " and then call configure again."
290 echo "------------------------------------------"
291 exit 1
292 fi
293 CFLAGS="$CFLAGS -D_ALL_SOURCE"; LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
294 AC_MSG_RESULT(yes)
295 ;;
296 *) OS390Unix="no";
297 AC_MSG_RESULT(no)
298 ;;
299esac
300fi
301
302
303dnl Check user requested features.
304
305AC_MSG_CHECKING(--with-features argument)
306AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
307 features="$withval"; AC_MSG_RESULT($features),
308 features="normal"; AC_MSG_RESULT(Defaulting to normal))
309
310dovimdiff=""
311dogvimdiff=""
312case "$features" in
313 tiny) AC_DEFINE(FEAT_TINY) ;;
314 small) AC_DEFINE(FEAT_SMALL) ;;
315 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
316 dogvimdiff="installgvimdiff" ;;
317 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
318 dogvimdiff="installgvimdiff" ;;
319 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
320 dogvimdiff="installgvimdiff" ;;
321 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
322esac
323
324AC_SUBST(dovimdiff)
325AC_SUBST(dogvimdiff)
326
327AC_MSG_CHECKING(--with-compiledby argument)
328AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
329 compiledby="$withval"; AC_MSG_RESULT($withval),
330 compiledby=""; AC_MSG_RESULT(no))
331AC_SUBST(compiledby)
332
333AC_MSG_CHECKING(--disable-xsmp argument)
334AC_ARG_ENABLE(xsmp,
335 [ --disable-xsmp Disable XSMP session management],
336 , enable_xsmp="yes")
337
338if test "$enable_xsmp" = "yes"; then
339 AC_MSG_RESULT(no)
340 AC_MSG_CHECKING(--disable-xsmp-interact argument)
341 AC_ARG_ENABLE(xsmp-interact,
342 [ --disable-xsmp-interact Disable XSMP interaction],
343 , enable_xsmp_interact="yes")
344 if test "$enable_xsmp_interact" = "yes"; then
345 AC_MSG_RESULT(no)
346 AC_DEFINE(USE_XSMP_INTERACT)
347 else
348 AC_MSG_RESULT(yes)
349 fi
350else
351 AC_MSG_RESULT(yes)
352fi
353
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000354dnl Check for MzScheme feature.
355AC_MSG_CHECKING(--enable-mzschemeinterp argument)
356AC_ARG_ENABLE(mzschemeinterp,
357 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
358 [enable_mzschemeinterp="no"])
359AC_MSG_RESULT($enable_mzschemeinterp)
360
361if test "$enable_mzschemeinterp" = "yes"; then
362 dnl -- find the mzscheme executable
363 AC_SUBST(vi_cv_path_mzscheme)
364
365 AC_MSG_CHECKING(--with-plthome argument)
366 AC_ARG_WITH(plthome,
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000367 [ --with-plthome=PLTHOME Use PLTHOME.],
368 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000369 with_plthome="";AC_MSG_RESULT("no"))
370
371 if test "X$with_plthome" != "X"; then
372 vi_cv_path_mzscheme_pfx="$with_plthome"
373 else
374 AC_MSG_CHECKING(PLTHOME environment var)
375 if test "X$PLTHOME" != "X"; then
376 AC_MSG_RESULT("$PLTHOME")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000377 vi_cv_path_mzscheme_pfx="$PLTHOME"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000378 else
379 AC_MSG_RESULT("not set")
380 dnl -- try to find MzScheme executable
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000381 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000382
383 dnl resolve symbolic link, the executable is often elsewhere and there
384 dnl are no links for the include files.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000385 if test "X$vi_cv_path_mzscheme" != "X"; then
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000386 lsout=`ls -l $vi_cv_path_mzscheme`
387 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
388 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
389 fi
390 fi
391
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000392 if test "X$vi_cv_path_mzscheme" != "X"; then
393 dnl -- find where MzScheme thinks it was installed
394 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
395 [ vi_cv_path_mzscheme_pfx=`
396 ${vi_cv_path_mzscheme} -evm \
397 "(display (simplify-path \
398 (build-path (call-with-values \
399 (lambda () (split-path (find-system-path (quote exec-file)))) \
400 (lambda (base name must-be-dir?) base)) (quote up))))"` ])
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000401 dnl Remove a trailing slash.
402 vi_cv_path_mzscheme_pfx=`echo "$vi_cv_path_mzscheme_pfx" | sed 's+/$++'`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000403 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000404 fi
405 fi
406
Bram Moolenaard7afed32007-05-06 13:26:41 +0000407 SCHEME_INC=
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000408 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
409 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
410 if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
411 AC_MSG_RESULT("yes")
412 else
413 AC_MSG_RESULT("no")
Bram Moolenaard7afed32007-05-06 13:26:41 +0000414 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/plt/include)
415 if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
416 AC_MSG_RESULT("yes")
417 SCHEME_INC=/plt
418 else
419 AC_MSG_RESULT("no")
420 vi_cv_path_mzscheme_pfx=
421 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000422 fi
423 fi
424
425 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
426 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
Bram Moolenaar9048f942007-05-12 14:32:25 +0000427 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 +0000428 else
Bram Moolenaar9048f942007-05-12 14:32:25 +0000429 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000430 if test "$GCC" = yes; then
431 dnl Make Vim remember the path to the library. For when it's not in
432 dnl $LD_LIBRARY_PATH.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000433 MZSCHEME_LIBS="$MZSCHEME_LIBS -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000434 elif test "`(uname) 2>/dev/null`" = SunOS &&
435 uname -r | grep '^5' >/dev/null; then
436 MZSCHEME_LIBS="$MZSCHEME_LIBS -R ${vi_cv_path_mzscheme_pfx}/lib"
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000437 fi
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000438 fi
Bram Moolenaard7afed32007-05-06 13:26:41 +0000439 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
440 SCHEME_COLLECTS=lib/plt/
441 fi
442 MZSCHEME_CFLAGS="-I${vi_cv_path_mzscheme_pfx}/include${SCHEME_INC} \
443 -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000444 MZSCHEME_SRC="if_mzsch.c"
445 MZSCHEME_OBJ="objects/if_mzsch.o"
446 MZSCHEME_PRO="if_mzsch.pro"
447 AC_DEFINE(FEAT_MZSCHEME)
448 fi
449 AC_SUBST(MZSCHEME_SRC)
450 AC_SUBST(MZSCHEME_OBJ)
451 AC_SUBST(MZSCHEME_PRO)
452 AC_SUBST(MZSCHEME_LIBS)
453 AC_SUBST(MZSCHEME_CFLAGS)
454fi
455
456
Bram Moolenaar071d4272004-06-13 20:20:40 +0000457AC_MSG_CHECKING(--enable-perlinterp argument)
458AC_ARG_ENABLE(perlinterp,
459 [ --enable-perlinterp Include Perl interpreter.], ,
460 [enable_perlinterp="no"])
461AC_MSG_RESULT($enable_perlinterp)
462if test "$enable_perlinterp" = "yes"; then
463 AC_SUBST(vi_cv_path_perl)
464 AC_PATH_PROG(vi_cv_path_perl, perl)
465 if test "X$vi_cv_path_perl" != "X"; then
466 AC_MSG_CHECKING(Perl version)
467 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
468 eval `$vi_cv_path_perl -V:usethreads`
469 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
470 badthreads=no
471 else
472 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
473 eval `$vi_cv_path_perl -V:use5005threads`
474 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
475 badthreads=no
476 else
477 badthreads=yes
478 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
479 fi
480 else
481 badthreads=yes
482 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
483 fi
484 fi
485 if test $badthreads = no; then
486 AC_MSG_RESULT(OK)
487 eval `$vi_cv_path_perl -V:shrpenv`
488 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
489 shrpenv=""
490 fi
491 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
492 AC_SUBST(vi_cv_perllib)
493 dnl Remove "-fno-something", it breaks using cproto.
494 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
495 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
496 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
497 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
498 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
499 -e 's/-bE:perl.exp//' -e 's/-lc //'`
500 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
501 dnl a test in configure may fail because of that.
502 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
503 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
504
505 dnl check that compiling a simple program still works with the flags
506 dnl added for Perl.
507 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
508 cflags_save=$CFLAGS
509 libs_save=$LIBS
510 ldflags_save=$LDFLAGS
511 CFLAGS="$CFLAGS $perlcppflags"
512 LIBS="$LIBS $perllibs"
513 LDFLAGS="$perlldflags $LDFLAGS"
514 AC_TRY_LINK(,[ ],
515 AC_MSG_RESULT(yes); perl_ok=yes,
516 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
517 CFLAGS=$cflags_save
518 LIBS=$libs_save
519 LDFLAGS=$ldflags_save
520 if test $perl_ok = yes; then
521 if test "X$perlcppflags" != "X"; then
Bram Moolenaard7afed32007-05-06 13:26:41 +0000522 dnl remove -pipe and -Wxxx, it confuses cproto
523 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000524 fi
525 if test "X$perlldflags" != "X"; then
526 LDFLAGS="$perlldflags $LDFLAGS"
527 fi
528 PERL_LIBS=$perllibs
529 PERL_SRC="auto/if_perl.c if_perlsfio.c"
530 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
531 PERL_PRO="if_perl.pro if_perlsfio.pro"
532 AC_DEFINE(FEAT_PERL)
533 fi
534 fi
535 else
536 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
537 fi
538 fi
539
540 if test "x$MACOSX" = "xyes"; then
Bram Moolenaar9372a112005-12-06 19:59:18 +0000541 dnl Mac OS X 10.2 or later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000542 dir=/System/Library/Perl
543 darwindir=$dir/darwin
544 if test -d $darwindir; then
545 PERL=/usr/bin/perl
546 else
547 dnl Mac OS X 10.3
548 dir=/System/Library/Perl/5.8.1
549 darwindir=$dir/darwin-thread-multi-2level
550 if test -d $darwindir; then
551 PERL=/usr/bin/perl
552 fi
553 fi
554 if test -n "$PERL"; then
555 PERL_DIR="$dir"
556 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
557 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
558 PERL_LIBS="-L$darwindir/CORE -lperl"
559 fi
560 fi
561fi
562AC_SUBST(shrpenv)
563AC_SUBST(PERL_SRC)
564AC_SUBST(PERL_OBJ)
565AC_SUBST(PERL_PRO)
566AC_SUBST(PERL_CFLAGS)
567AC_SUBST(PERL_LIBS)
568
569AC_MSG_CHECKING(--enable-pythoninterp argument)
570AC_ARG_ENABLE(pythoninterp,
571 [ --enable-pythoninterp Include Python interpreter.], ,
572 [enable_pythoninterp="no"])
573AC_MSG_RESULT($enable_pythoninterp)
574if test "$enable_pythoninterp" = "yes"; then
575 dnl -- find the python executable
576 AC_PATH_PROG(vi_cv_path_python, python)
577 if test "X$vi_cv_path_python" != "X"; then
578
579 dnl -- get its version number
580 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
581 [[vi_cv_var_python_version=`
582 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
583 ]])
584
585 dnl -- it must be at least version 1.4
586 AC_MSG_CHECKING(Python is 1.4 or better)
587 if ${vi_cv_path_python} -c \
588 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
589 then
590 AC_MSG_RESULT(yep)
591
592 dnl -- find where python thinks it was installed
593 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
594 [ vi_cv_path_python_pfx=`
595 ${vi_cv_path_python} -c \
596 "import sys; print sys.prefix"` ])
597
598 dnl -- and where it thinks it runs
599 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
600 [ vi_cv_path_python_epfx=`
601 ${vi_cv_path_python} -c \
602 "import sys; print sys.exec_prefix"` ])
603
604 dnl -- python's internal library path
605
606 AC_CACHE_VAL(vi_cv_path_pythonpath,
607 [ vi_cv_path_pythonpath=`
608 unset PYTHONPATH;
609 ${vi_cv_path_python} -c \
610 "import sys, string; print string.join(sys.path,':')"` ])
611
612 dnl -- where the Python implementation library archives are
613
614 AC_ARG_WITH(python-config-dir,
615 [ --with-python-config-dir=PATH Python's config directory],
616 [ vi_cv_path_python_conf="${withval}" ] )
617
618 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
619 [
620 vi_cv_path_python_conf=
621 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
622 for subdir in lib share; do
623 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
624 if test -d "$d" && test -f "$d/config.c"; then
625 vi_cv_path_python_conf="$d"
626 fi
627 done
628 done
629 ])
630
631 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
632
633 if test "X$PYTHON_CONFDIR" = "X"; then
634 AC_MSG_RESULT([can't find it!])
635 else
636
637 dnl -- we need to examine Python's config/Makefile too
638 dnl see what the interpreter is built from
639 AC_CACHE_VAL(vi_cv_path_python_plibs,
640 [
641 tmp_mkf="/tmp/Makefile-conf$$"
642 cat ${PYTHON_CONFDIR}/Makefile - <<'eof' >${tmp_mkf}
643__:
644 @echo "python_MODLIBS='$(MODLIBS)'"
645 @echo "python_LIBS='$(LIBS)'"
646 @echo "python_SYSLIBS='$(SYSLIBS)'"
647 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
648eof
649 dnl -- delete the lines from make about Entering/Leaving directory
650 eval "`cd ${PYTHON_CONFDIR} && make -f ${tmp_mkf} __ | sed '/ directory /d'`"
651 rm -f ${tmp_mkf}
652 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
653 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
654 vi_cv_path_python_plibs="-framework Python"
655 else
656 if test "${vi_cv_var_python_version}" = "1.4"; then
657 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
658 else
659 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
660 fi
661 vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_MODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
662 dnl remove -ltermcap, it can conflict with an earlier -lncurses
663 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
664 fi
665 ])
666
667 PYTHON_LIBS="${vi_cv_path_python_plibs}"
668 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
669 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
670 else
671 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}"
672 fi
673 PYTHON_SRC="if_python.c"
674 dnl For Mac OSX 10.2 config.o is included in the Python library.
675 if test "x$MACOSX" = "xyes"; then
676 PYTHON_OBJ="objects/if_python.o"
677 else
678 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
679 fi
680 if test "${vi_cv_var_python_version}" = "1.4"; then
681 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
682 fi
683 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
684
685 dnl On FreeBSD linking with "-pthread" is required to use threads.
686 dnl _THREAD_SAFE must be used for compiling then.
687 dnl The "-pthread" is added to $LIBS, so that the following check for
688 dnl sigaltstack() will look in libc_r (it's there in libc!).
689 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
690 dnl will then define target-specific defines, e.g., -D_REENTRANT.
691 dnl Don't do this for Mac OSX, -pthread will generate a warning.
692 AC_MSG_CHECKING([if -pthread should be used])
693 threadsafe_flag=
694 thread_lib=
Bram Moolenaara1b5aa52006-10-10 09:41:28 +0000695 dnl if test "x$MACOSX" != "xyes"; then
696 if test "`(uname) 2>/dev/null`" != Darwin; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000697 test "$GCC" = yes && threadsafe_flag="-pthread"
698 if test "`(uname) 2>/dev/null`" = FreeBSD; then
699 threadsafe_flag="-D_THREAD_SAFE"
700 thread_lib="-pthread"
701 fi
702 fi
703 libs_save_old=$LIBS
704 if test -n "$threadsafe_flag"; then
705 cflags_save=$CFLAGS
706 CFLAGS="$CFLAGS $threadsafe_flag"
707 LIBS="$LIBS $thread_lib"
708 AC_TRY_LINK(,[ ],
709 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
710 AC_MSG_RESULT(no); LIBS=$libs_save_old
711 )
712 CFLAGS=$cflags_save
713 else
714 AC_MSG_RESULT(no)
715 fi
716
717 dnl check that compiling a simple program still works with the flags
718 dnl added for Python.
719 AC_MSG_CHECKING([if compile and link flags for Python are sane])
720 cflags_save=$CFLAGS
721 libs_save=$LIBS
722 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
723 LIBS="$LIBS $PYTHON_LIBS"
724 AC_TRY_LINK(,[ ],
725 AC_MSG_RESULT(yes); python_ok=yes,
726 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
727 CFLAGS=$cflags_save
728 LIBS=$libs_save
729 if test $python_ok = yes; then
730 AC_DEFINE(FEAT_PYTHON)
731 else
732 LIBS=$libs_save_old
733 PYTHON_SRC=
734 PYTHON_OBJ=
735 PYTHON_LIBS=
736 PYTHON_CFLAGS=
737 fi
738
739 fi
740 else
741 AC_MSG_RESULT(too old)
742 fi
743 fi
744fi
745AC_SUBST(PYTHON_CONFDIR)
746AC_SUBST(PYTHON_LIBS)
747AC_SUBST(PYTHON_GETPATH_CFLAGS)
748AC_SUBST(PYTHON_CFLAGS)
749AC_SUBST(PYTHON_SRC)
750AC_SUBST(PYTHON_OBJ)
751
752AC_MSG_CHECKING(--enable-tclinterp argument)
753AC_ARG_ENABLE(tclinterp,
754 [ --enable-tclinterp Include Tcl interpreter.], ,
755 [enable_tclinterp="no"])
756AC_MSG_RESULT($enable_tclinterp)
757
758if test "$enable_tclinterp" = "yes"; then
759
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000760 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[420]
Bram Moolenaar071d4272004-06-13 20:20:40 +0000761 AC_MSG_CHECKING(--with-tclsh argument)
762 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
763 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000764 tclsh_name="tclsh8.4"; AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000765 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
766 AC_SUBST(vi_cv_path_tcl)
767
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000768 dnl when no specific version specified, also try 8.2 and 8.0
769 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
Bram Moolenaar071d4272004-06-13 20:20:40 +0000770 tclsh_name="tclsh8.2"
771 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
772 fi
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000773 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
774 tclsh_name="tclsh8.0"
775 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
776 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000777 dnl still didn't find it, try without version number
778 if test "X$vi_cv_path_tcl" = "X"; then
779 tclsh_name="tclsh"
780 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
781 fi
782 if test "X$vi_cv_path_tcl" != "X"; then
783 AC_MSG_CHECKING(Tcl version)
784 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
785 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
786 AC_MSG_RESULT($tclver - OK);
787 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 -`
788
789 AC_MSG_CHECKING(for location of Tcl include)
790 if test "x$MACOSX" != "xyes"; then
Bram Moolenaar47136d72004-10-12 20:02:24 +0000791 tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/include"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000792 else
793 dnl For Mac OS X 10.3, use the OS-provided framework location
794 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
795 fi
796 for try in $tclinc; do
797 if test -f "$try/tcl.h"; then
798 AC_MSG_RESULT($try/tcl.h)
799 TCL_INC=$try
800 break
801 fi
802 done
803 if test -z "$TCL_INC"; then
804 AC_MSG_RESULT(<not found>)
805 SKIP_TCL=YES
806 fi
807 if test -z "$SKIP_TCL"; then
808 AC_MSG_CHECKING(for location of tclConfig.sh script)
809 if test "x$MACOSX" != "xyes"; then
810 tclcnf=`echo $tclinc | sed s/include/lib/g`
811 else
812 dnl For Mac OS X 10.3, use the OS-provided framework location
813 tclcnf="/System/Library/Frameworks/Tcl.framework"
814 fi
815 for try in $tclcnf; do
816 if test -f $try/tclConfig.sh; then
817 AC_MSG_RESULT($try/tclConfig.sh)
818 . $try/tclConfig.sh
819 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
820 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
821 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
Bram Moolenaardf3267e2005-01-25 22:07:05 +0000822 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
Bram Moolenaar9372a112005-12-06 19:59:18 +0000823 TCL_DEFS=`echo $TCL_DEFS | sed -e 's/\\\\ /\\\\X/g' | tr ' ' '\012' | sed -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr '\012' ' ' | sed -e 's/\\\\X/\\\\ /g'`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000824 break
825 fi
826 done
827 if test -z "$TCL_LIBS"; then
828 AC_MSG_RESULT(<not found>)
829 AC_MSG_CHECKING(for Tcl library by myself)
830 tcllib=`echo $tclinc | sed s/include/lib/g`
831 for ext in .so .a ; do
832 for ver in "" $tclver ; do
833 for try in $tcllib ; do
834 trylib=tcl$ver$ext
835 if test -f $try/lib$trylib ; then
836 AC_MSG_RESULT($try/lib$trylib)
837 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
838 if test "`(uname) 2>/dev/null`" = SunOS &&
839 uname -r | grep '^5' >/dev/null; then
840 TCL_LIBS="$TCL_LIBS -R $try"
841 fi
842 break 3
843 fi
844 done
845 done
846 done
847 if test -z "$TCL_LIBS"; then
848 AC_MSG_RESULT(<not found>)
849 SKIP_TCL=YES
850 fi
851 fi
852 if test -z "$SKIP_TCL"; then
853 AC_DEFINE(FEAT_TCL)
854 TCL_SRC=if_tcl.c
855 TCL_OBJ=objects/if_tcl.o
856 TCL_PRO=if_tcl.pro
857 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
858 fi
859 fi
860 else
861 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
862 fi
863 fi
864fi
865AC_SUBST(TCL_SRC)
866AC_SUBST(TCL_OBJ)
867AC_SUBST(TCL_PRO)
868AC_SUBST(TCL_CFLAGS)
869AC_SUBST(TCL_LIBS)
870
871AC_MSG_CHECKING(--enable-rubyinterp argument)
872AC_ARG_ENABLE(rubyinterp,
873 [ --enable-rubyinterp Include Ruby interpreter.], ,
874 [enable_rubyinterp="no"])
875AC_MSG_RESULT($enable_rubyinterp)
876if test "$enable_rubyinterp" = "yes"; then
877 AC_SUBST(vi_cv_path_ruby)
878 AC_PATH_PROG(vi_cv_path_ruby, ruby)
879 if test "X$vi_cv_path_ruby" != "X"; then
880 AC_MSG_CHECKING(Ruby version)
Bram Moolenaare4efc3b2005-03-07 23:16:51 +0000881 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 +0000882 AC_MSG_RESULT(OK)
883 AC_MSG_CHECKING(Ruby header files)
884 rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
885 if test "X$rubyhdrdir" != "X"; then
886 AC_MSG_RESULT($rubyhdrdir)
887 RUBY_CFLAGS="-I$rubyhdrdir"
888 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
889 if test "X$rubylibs" != "X"; then
890 RUBY_LIBS="$rubylibs"
891 fi
892 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
893 if test -f "$rubyhdrdir/$librubyarg"; then
894 librubyarg="$rubyhdrdir/$librubyarg"
895 else
896 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
897 if test -f "$rubylibdir/$librubyarg"; then
898 librubyarg="$rubylibdir/$librubyarg"
899 elif test "$librubyarg" = "libruby.a"; then
900 dnl required on Mac OS 10.3 where libruby.a doesn't exist
901 librubyarg="-lruby"
902 else
903 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
904 fi
905 fi
906
907 if test "X$librubyarg" != "X"; then
908 RUBY_LIBS="$librubyarg $RUBY_LIBS"
909 fi
910 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
911 if test "X$rubyldflags" != "X"; then
912 LDFLAGS="$rubyldflags $LDFLAGS"
913 fi
914 RUBY_SRC="if_ruby.c"
915 RUBY_OBJ="objects/if_ruby.o"
916 RUBY_PRO="if_ruby.pro"
917 AC_DEFINE(FEAT_RUBY)
918 else
919 AC_MSG_RESULT(not found, disabling Ruby)
920 fi
921 else
922 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
923 fi
924 fi
925fi
926AC_SUBST(RUBY_SRC)
927AC_SUBST(RUBY_OBJ)
928AC_SUBST(RUBY_PRO)
929AC_SUBST(RUBY_CFLAGS)
930AC_SUBST(RUBY_LIBS)
931
932AC_MSG_CHECKING(--enable-cscope argument)
933AC_ARG_ENABLE(cscope,
934 [ --enable-cscope Include cscope interface.], ,
935 [enable_cscope="no"])
936AC_MSG_RESULT($enable_cscope)
937if test "$enable_cscope" = "yes"; then
938 AC_DEFINE(FEAT_CSCOPE)
939fi
940
941AC_MSG_CHECKING(--enable-workshop argument)
942AC_ARG_ENABLE(workshop,
943 [ --enable-workshop Include Sun Visual Workshop support.], ,
944 [enable_workshop="no"])
945AC_MSG_RESULT($enable_workshop)
946if test "$enable_workshop" = "yes"; then
947 AC_DEFINE(FEAT_SUN_WORKSHOP)
948 WORKSHOP_SRC="workshop.c integration.c"
949 AC_SUBST(WORKSHOP_SRC)
950 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
951 AC_SUBST(WORKSHOP_OBJ)
952 if test "${enable_gui-xxx}" = xxx; then
953 enable_gui=motif
954 fi
955fi
956
957AC_MSG_CHECKING(--disable-netbeans argument)
958AC_ARG_ENABLE(netbeans,
959 [ --disable-netbeans Disable NetBeans integration support.],
960 , [enable_netbeans="yes"])
961if test "$enable_netbeans" = "yes"; then
962 AC_MSG_RESULT(no)
963 dnl On Solaris we need the socket and nsl library.
964 AC_CHECK_LIB(socket, socket)
965 AC_CHECK_LIB(nsl, gethostbyname)
966 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
967 AC_TRY_LINK([
968#include <stdio.h>
969#include <stdlib.h>
970#include <stdarg.h>
971#include <fcntl.h>
972#include <netdb.h>
973#include <netinet/in.h>
974#include <errno.h>
975#include <sys/types.h>
976#include <sys/socket.h>
977 /* Check bitfields */
978 struct nbbuf {
979 unsigned int initDone:1;
980 ushort signmaplen;
981 };
982 ], [
983 /* Check creating a socket. */
984 struct sockaddr_in server;
985 (void)socket(AF_INET, SOCK_STREAM, 0);
986 (void)htons(100);
987 (void)gethostbyname("microsoft.com");
988 if (errno == ECONNREFUSED)
989 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
990 ],
991 AC_MSG_RESULT(yes),
992 AC_MSG_RESULT(no); enable_netbeans="no")
993else
994 AC_MSG_RESULT(yes)
995fi
996if test "$enable_netbeans" = "yes"; then
997 AC_DEFINE(FEAT_NETBEANS_INTG)
998 NETBEANS_SRC="netbeans.c"
999 AC_SUBST(NETBEANS_SRC)
1000 NETBEANS_OBJ="objects/netbeans.o"
1001 AC_SUBST(NETBEANS_OBJ)
1002fi
1003
1004AC_MSG_CHECKING(--enable-sniff argument)
1005AC_ARG_ENABLE(sniff,
1006 [ --enable-sniff Include Sniff interface.], ,
1007 [enable_sniff="no"])
1008AC_MSG_RESULT($enable_sniff)
1009if test "$enable_sniff" = "yes"; then
1010 AC_DEFINE(FEAT_SNIFF)
1011 SNIFF_SRC="if_sniff.c"
1012 AC_SUBST(SNIFF_SRC)
1013 SNIFF_OBJ="objects/if_sniff.o"
1014 AC_SUBST(SNIFF_OBJ)
1015fi
1016
1017AC_MSG_CHECKING(--enable-multibyte argument)
1018AC_ARG_ENABLE(multibyte,
1019 [ --enable-multibyte Include multibyte editing support.], ,
1020 [enable_multibyte="no"])
1021AC_MSG_RESULT($enable_multibyte)
1022if test "$enable_multibyte" = "yes"; then
1023 AC_DEFINE(FEAT_MBYTE)
1024fi
1025
1026AC_MSG_CHECKING(--enable-hangulinput argument)
1027AC_ARG_ENABLE(hangulinput,
1028 [ --enable-hangulinput Include Hangul input support.], ,
1029 [enable_hangulinput="no"])
1030AC_MSG_RESULT($enable_hangulinput)
1031
1032AC_MSG_CHECKING(--enable-xim argument)
1033AC_ARG_ENABLE(xim,
1034 [ --enable-xim Include XIM input support.],
1035 AC_MSG_RESULT($enable_xim),
1036 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
1037dnl defining FEAT_XIM is delayed, so that it can be disabled for older GTK
1038
1039AC_MSG_CHECKING(--enable-fontset argument)
1040AC_ARG_ENABLE(fontset,
1041 [ --enable-fontset Include X fontset output support.], ,
1042 [enable_fontset="no"])
1043AC_MSG_RESULT($enable_fontset)
1044dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1045
1046test -z "$with_x" && with_x=yes
1047test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1048if test "$with_x" = no; then
1049 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1050else
1051 dnl Do this check early, so that its failure can override user requests.
1052
1053 AC_PATH_PROG(xmkmfpath, xmkmf)
1054
1055 AC_PATH_XTRA
1056
1057 dnl On OS390Unix the X libraries are DLLs. To use them the code must
1058 dnl be compiled with a special option.
1059 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
1060 if test "$OS390Unix" = "yes"; then
1061 CFLAGS="$CFLAGS -W c,dll"
1062 LDFLAGS="$LDFLAGS -W l,dll"
1063 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1064 fi
1065
1066 dnl On my HPUX system the X include dir is found, but the lib dir not.
1067 dnl This is a desparate try to fix this.
1068
1069 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1070 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1071 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1072 X_LIBS="$X_LIBS -L$x_libraries"
1073 if test "`(uname) 2>/dev/null`" = SunOS &&
1074 uname -r | grep '^5' >/dev/null; then
1075 X_LIBS="$X_LIBS -R $x_libraries"
1076 fi
1077 fi
1078
1079 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1080 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1081 AC_MSG_RESULT(Corrected X includes to $x_includes)
1082 X_CFLAGS="$X_CFLAGS -I$x_includes"
1083 fi
1084
1085 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1086 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1087 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1088 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1089 dnl Same for "-R/usr/lib ".
1090 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1091
1092
1093 dnl Check if the X11 header files are correctly installed. On some systems
1094 dnl Xlib.h includes files that don't exist
1095 AC_MSG_CHECKING(if X11 header files can be found)
1096 cflags_save=$CFLAGS
1097 CFLAGS="$CFLAGS $X_CFLAGS"
1098 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1099 AC_MSG_RESULT(yes),
1100 AC_MSG_RESULT(no); no_x=yes)
1101 CFLAGS=$cflags_save
1102
1103 if test "${no_x-no}" = yes; then
1104 with_x=no
1105 else
1106 AC_DEFINE(HAVE_X11)
1107 X_LIB="-lXt -lX11";
1108 AC_SUBST(X_LIB)
1109
1110 ac_save_LDFLAGS="$LDFLAGS"
1111 LDFLAGS="-L$x_libraries $LDFLAGS"
1112
1113 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1114 dnl For HP-UX 10.20 it must be before -lSM -lICE
1115 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1116 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1117
1118 dnl Some systems need -lnsl -lsocket when testing for ICE.
1119 dnl The check above doesn't do this, try here (again). Also needed to get
1120 dnl them after Xdmcp. link.sh will remove them when not needed.
1121 dnl Check for other function than above to avoid the cached value
1122 AC_CHECK_LIB(ICE, IceOpenConnection,
1123 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1124
1125 dnl Check for -lXpm (needed for some versions of Motif)
1126 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1127 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1128 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1129
1130 dnl Check that the X11 header files don't use implicit declarations
1131 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1132 cflags_save=$CFLAGS
1133 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1134 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1135 AC_MSG_RESULT(no),
1136 CFLAGS="$CFLAGS -Wno-implicit-int"
1137 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1138 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1139 AC_MSG_RESULT(test failed)
1140 )
1141 )
1142 CFLAGS=$cflags_save
1143
1144 LDFLAGS="$ac_save_LDFLAGS"
1145
1146 fi
1147fi
1148
Bram Moolenaara7fc0102005-05-18 22:17:12 +00001149test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
Bram Moolenaar071d4272004-06-13 20:20:40 +00001150
1151AC_MSG_CHECKING(--enable-gui argument)
1152AC_ARG_ENABLE(gui,
Bram Moolenaar9372a112005-12-06 19:59:18 +00001153 [ --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 +00001154
1155dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1156dnl Do not use character classes for portability with old tools.
1157enable_gui_canon=`echo "_$enable_gui" | \
1158 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1159
1160dnl Skip everything by default.
1161SKIP_GTK=YES
1162SKIP_GTK2=YES
1163SKIP_GNOME=YES
1164SKIP_MOTIF=YES
1165SKIP_ATHENA=YES
1166SKIP_NEXTAW=YES
1167SKIP_PHOTON=YES
Bram Moolenaar071d4272004-06-13 20:20:40 +00001168SKIP_CARBON=YES
1169GUITYPE=NONE
1170
Bram Moolenaarb11160e2005-01-04 21:31:43 +00001171if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
Bram Moolenaar071d4272004-06-13 20:20:40 +00001172 SKIP_PHOTON=
1173 case "$enable_gui_canon" in
1174 no) AC_MSG_RESULT(no GUI support)
1175 SKIP_PHOTON=YES ;;
1176 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1177 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1178 photon) AC_MSG_RESULT(Photon GUI support) ;;
1179 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1180 SKIP_PHOTON=YES ;;
1181 esac
1182
1183elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1184 SKIP_CARBON=
1185 case "$enable_gui_canon" in
1186 no) AC_MSG_RESULT(no GUI support)
1187 SKIP_CARBON=YES ;;
1188 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1189 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1190 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1191 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1192 SKIP_CARBON=YES ;;
1193 esac
1194
1195else
1196
Bram Moolenaar071d4272004-06-13 20:20:40 +00001197 case "$enable_gui_canon" in
1198 no|none) AC_MSG_RESULT(no GUI support) ;;
1199 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
1200 SKIP_GTK=
1201 SKIP_GTK2=
1202 SKIP_GNOME=
1203 SKIP_MOTIF=
1204 SKIP_ATHENA=
1205 SKIP_NEXTAW=
1206 SKIP_CARBON=;;
1207 gtk) AC_MSG_RESULT(GTK+ 1.x GUI support)
1208 SKIP_GTK=;;
1209 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
1210 SKIP_GTK=
1211 SKIP_GTK2=;;
1212 gnome) AC_MSG_RESULT(GNOME 1.x GUI support)
1213 SKIP_GNOME=
1214 SKIP_GTK=;;
1215 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1216 SKIP_GNOME=
1217 SKIP_GTK=
1218 SKIP_GTK2=;;
1219 motif) AC_MSG_RESULT(Motif GUI support)
1220 SKIP_MOTIF=;;
1221 athena) AC_MSG_RESULT(Athena GUI support)
1222 SKIP_ATHENA=;;
1223 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1224 SKIP_NEXTAW=;;
1225 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1226 esac
1227
1228fi
1229
1230if test "x$SKIP_GTK" != "xYES" -a "$enable_gui_canon" != "gtk" -a "$enable_gui_canon" != "gtk2"; then
1231 AC_MSG_CHECKING(whether or not to look for GTK)
1232 AC_ARG_ENABLE(gtk-check,
1233 [ --enable-gtk-check If auto-select GUI, check for GTK [default=yes]],
1234 , enable_gtk_check="yes")
1235 AC_MSG_RESULT($enable_gtk_check)
1236 if test "x$enable_gtk_check" = "xno"; then
1237 SKIP_GTK=YES
1238 SKIP_GNOME=YES
1239 fi
1240fi
1241
1242if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1243 -a "$enable_gui_canon" != "gnome2"; then
1244 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1245 AC_ARG_ENABLE(gtk2-check,
1246 [ --enable-gtk2-check If GTK GUI, check for GTK+ 2 [default=yes]],
1247 , enable_gtk2_check="yes")
1248 AC_MSG_RESULT($enable_gtk2_check)
1249 if test "x$enable_gtk2_check" = "xno"; then
1250 SKIP_GTK2=YES
1251 fi
1252fi
1253
1254if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome" \
1255 -a "$enable_gui_canon" != "gnome2"; then
1256 AC_MSG_CHECKING(whether or not to look for GNOME)
1257 AC_ARG_ENABLE(gnome-check,
1258 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1259 , enable_gnome_check="no")
1260 AC_MSG_RESULT($enable_gnome_check)
1261 if test "x$enable_gnome_check" = "xno"; then
1262 SKIP_GNOME=YES
1263 fi
1264fi
1265
1266if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1267 AC_MSG_CHECKING(whether or not to look for Motif)
1268 AC_ARG_ENABLE(motif-check,
1269 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1270 , enable_motif_check="yes")
1271 AC_MSG_RESULT($enable_motif_check)
1272 if test "x$enable_motif_check" = "xno"; then
1273 SKIP_MOTIF=YES
1274 fi
1275fi
1276
1277if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1278 AC_MSG_CHECKING(whether or not to look for Athena)
1279 AC_ARG_ENABLE(athena-check,
1280 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1281 , enable_athena_check="yes")
1282 AC_MSG_RESULT($enable_athena_check)
1283 if test "x$enable_athena_check" = "xno"; then
1284 SKIP_ATHENA=YES
1285 fi
1286fi
1287
1288if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1289 AC_MSG_CHECKING(whether or not to look for neXtaw)
1290 AC_ARG_ENABLE(nextaw-check,
1291 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1292 , enable_nextaw_check="yes")
1293 AC_MSG_RESULT($enable_nextaw_check);
1294 if test "x$enable_nextaw_check" = "xno"; then
1295 SKIP_NEXTAW=YES
1296 fi
1297fi
1298
1299if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1300 AC_MSG_CHECKING(whether or not to look for Carbon)
1301 AC_ARG_ENABLE(carbon-check,
1302 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1303 , enable_carbon_check="yes")
1304 AC_MSG_RESULT($enable_carbon_check);
1305 if test "x$enable_carbon_check" = "xno"; then
1306 SKIP_CARBON=YES
1307 fi
1308fi
1309
Bram Moolenaar843ee412004-06-30 16:16:41 +00001310
Bram Moolenaar071d4272004-06-13 20:20:40 +00001311if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1312 AC_MSG_CHECKING(for Carbon GUI)
Bram Moolenaar14716812006-05-04 21:54:08 +00001313 dnl already did the check, just give the message
Bram Moolenaar071d4272004-06-13 20:20:40 +00001314 AC_MSG_RESULT(yes);
1315 GUITYPE=CARBONGUI
Bram Moolenaare344bea2005-09-01 20:46:49 +00001316 if test "$VIMNAME" = "vim"; then
1317 VIMNAME=Vim
1318 fi
Bram Moolenaar14716812006-05-04 21:54:08 +00001319
1320 dnl Default install directory is not /usr/local
1321 if test x$prefix = xNONE; then
1322 prefix=/Applications
1323 fi
1324
1325 dnl Sorry for the hard coded default
1326 datadir='${prefix}/Vim.app/Contents/Resources'
1327
Bram Moolenaar071d4272004-06-13 20:20:40 +00001328 dnl skip everything else
1329 SKIP_GTK=YES;
1330 SKIP_GTK2=YES;
1331 SKIP_GNOME=YES;
1332 SKIP_MOTIF=YES;
1333 SKIP_ATHENA=YES;
1334 SKIP_NEXTAW=YES;
1335 SKIP_PHOTON=YES;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001336 SKIP_CARBON=YES
1337fi
1338
Bram Moolenaar071d4272004-06-13 20:20:40 +00001339dnl
1340dnl Get the cflags and libraries from the gtk-config script
1341dnl
1342
1343dnl define an autoconf function to check for a specified version of GTK, and
1344dnl try to compile/link a GTK program. this gets used once for GTK 1.1.16.
1345dnl
1346dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001347dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
Bram Moolenaar071d4272004-06-13 20:20:40 +00001348dnl
1349AC_DEFUN(AM_PATH_GTK,
1350[
1351 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1352 {
1353 min_gtk_version=ifelse([$1], ,0.99.7,$1)
1354 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1355 no_gtk=""
1356 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1357 && $PKG_CONFIG --exists gtk+-2.0; then
1358 {
1359 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1360 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1361 dnl something like that.
1362 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001363 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
Bram Moolenaar071d4272004-06-13 20:20:40 +00001364 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1365 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1366 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1367 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1368 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1369 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1370 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1371 }
1372 elif test "X$GTK_CONFIG" != "Xno"; then
1373 {
1374 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001375 GTK_LIBDIR=
Bram Moolenaar071d4272004-06-13 20:20:40 +00001376 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
1377 gtk_major_version=`$GTK_CONFIG $gtk_config_args --version | \
1378 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1379 gtk_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
1380 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1381 gtk_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
1382 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1383 }
1384 else
1385 no_gtk=yes
1386 fi
1387
1388 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1389 {
1390 ac_save_CFLAGS="$CFLAGS"
1391 ac_save_LIBS="$LIBS"
1392 CFLAGS="$CFLAGS $GTK_CFLAGS"
1393 LIBS="$LIBS $GTK_LIBS"
1394
1395 dnl
1396 dnl Now check if the installed GTK is sufficiently new. (Also sanity
1397 dnl checks the results of gtk-config to some extent
1398 dnl
1399 rm -f conf.gtktest
1400 AC_TRY_RUN([
1401#include <gtk/gtk.h>
1402#include <stdio.h>
1403
1404int
1405main ()
1406{
1407int major, minor, micro;
1408char *tmp_version;
1409
1410system ("touch conf.gtktest");
1411
1412/* HP/UX 9 (%@#!) writes to sscanf strings */
1413tmp_version = g_strdup("$min_gtk_version");
1414if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1415 printf("%s, bad version string\n", "$min_gtk_version");
1416 exit(1);
1417 }
1418
1419if ((gtk_major_version > major) ||
1420 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1421 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1422 (gtk_micro_version >= micro)))
1423{
1424 return 0;
1425}
1426return 1;
1427}
1428],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1429 CFLAGS="$ac_save_CFLAGS"
1430 LIBS="$ac_save_LIBS"
1431 }
1432 fi
1433 if test "x$no_gtk" = x ; then
1434 if test "x$enable_gtktest" = "xyes"; then
1435 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1436 else
1437 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1438 fi
1439 ifelse([$2], , :, [$2])
1440 else
1441 {
1442 AC_MSG_RESULT(no)
1443 GTK_CFLAGS=""
1444 GTK_LIBS=""
1445 ifelse([$3], , :, [$3])
1446 }
1447 fi
1448 }
1449 else
1450 GTK_CFLAGS=""
1451 GTK_LIBS=""
1452 ifelse([$3], , :, [$3])
1453 fi
1454 AC_SUBST(GTK_CFLAGS)
1455 AC_SUBST(GTK_LIBS)
1456 rm -f conf.gtktest
1457])
1458
1459dnl ---------------------------------------------------------------------------
1460dnl gnome
1461dnl ---------------------------------------------------------------------------
1462AC_DEFUN([GNOME_INIT_HOOK],
1463[
1464 AC_SUBST(GNOME_LIBS)
1465 AC_SUBST(GNOME_LIBDIR)
1466 AC_SUBST(GNOME_INCLUDEDIR)
1467
1468 AC_ARG_WITH(gnome-includes,
1469 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1470 [CFLAGS="$CFLAGS -I$withval"]
1471 )
1472
1473 AC_ARG_WITH(gnome-libs,
1474 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1475 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1476 )
1477
1478 AC_ARG_WITH(gnome,
1479 [ --with-gnome Specify prefix for GNOME files],
1480 if test x$withval = xyes; then
1481 want_gnome=yes
1482 ifelse([$1], [], :, [$1])
1483 else
1484 if test "x$withval" = xno; then
1485 want_gnome=no
1486 else
1487 want_gnome=yes
1488 LDFLAGS="$LDFLAGS -L$withval/lib"
1489 CFLAGS="$CFLAGS -I$withval/include"
1490 gnome_prefix=$withval/lib
1491 fi
1492 fi,
1493 want_gnome=yes)
1494
1495 if test "x$want_gnome" = xyes -a "0$gtk_major_version" -ge 2; then
1496 {
1497 AC_MSG_CHECKING(for libgnomeui-2.0)
1498 if $PKG_CONFIG --exists libgnomeui-2.0; then
1499 AC_MSG_RESULT(yes)
1500 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1501 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1502 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001503
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001504 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1505 dnl This might not be the right way but it works for me...
1506 AC_MSG_CHECKING(for FreeBSD)
1507 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1508 AC_MSG_RESULT(yes, adding -pthread)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00001509 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
Bram Moolenaar97b2ad32006-03-18 21:40:56 +00001510 GNOME_LIBS="$GNOME_LIBS -pthread"
1511 else
1512 AC_MSG_RESULT(no)
1513 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001514 $1
1515 else
1516 AC_MSG_RESULT(not found)
1517 if test "x$2" = xfail; then
1518 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1519 fi
1520 fi
1521 }
1522 elif test "x$want_gnome" = xyes; then
1523 {
1524 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
1525 if test "$GNOME_CONFIG" = "no"; then
1526 no_gnome_config="yes"
1527 else
1528 AC_MSG_CHECKING(if $GNOME_CONFIG works)
1529 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
1530 AC_MSG_RESULT(yes)
1531 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome gnomeui`"
1532 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
1533 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
1534 $1
1535 else
1536 AC_MSG_RESULT(no)
1537 no_gnome_config="yes"
1538 fi
1539 fi
1540
1541 if test x$exec_prefix = xNONE; then
1542 if test x$prefix = xNONE; then
1543 gnome_prefix=$ac_default_prefix/lib
1544 else
1545 gnome_prefix=$prefix/lib
1546 fi
1547 else
1548 gnome_prefix=`eval echo \`echo $libdir\``
1549 fi
1550
1551 if test "$no_gnome_config" = "yes"; then
1552 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
1553 if test -f $gnome_prefix/gnomeConf.sh; then
1554 AC_MSG_RESULT(found)
1555 echo "loading gnome configuration from" \
1556 "$gnome_prefix/gnomeConf.sh"
1557 . $gnome_prefix/gnomeConf.sh
1558 $1
1559 else
1560 AC_MSG_RESULT(not found)
1561 if test x$2 = xfail; then
1562 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
1563 fi
1564 fi
1565 fi
1566 }
1567 fi
1568])
1569
1570AC_DEFUN([GNOME_INIT],[
1571 GNOME_INIT_HOOK([],fail)
1572])
1573
1574
1575dnl ---------------------------------------------------------------------------
1576dnl Check for GTK. First checks for gtk-config, cause it needs that to get the
1577dnl correct compiler flags. Then checks for GTK 1.1.16. If that fails, then
1578dnl it checks for 1.0.6. If both fail, then continue on for Motif as before...
1579dnl ---------------------------------------------------------------------------
1580if test -z "$SKIP_GTK"; then
1581
1582 AC_MSG_CHECKING(--with-gtk-prefix argument)
1583 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
1584 gtk_config_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1585 gtk_config_prefix=""; AC_MSG_RESULT(no))
1586
1587 AC_MSG_CHECKING(--with-gtk-exec-prefix argument)
1588 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
1589 gtk_config_exec_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1590 gtk_config_exec_prefix=""; AC_MSG_RESULT(no))
1591
1592 AC_MSG_CHECKING(--disable-gtktest argument)
1593 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1594 , enable_gtktest=yes)
1595 if test "x$enable_gtktest" = "xyes" ; then
1596 AC_MSG_RESULT(gtk test enabled)
1597 else
1598 AC_MSG_RESULT(gtk test disabled)
1599 fi
1600
1601 if test "x$gtk_config_prefix" != "x" ; then
1602 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
1603 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
1604 fi
1605 if test "x$gtk_config_exec_prefix" != "x" ; then
1606 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
1607 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
1608 fi
1609 if test "X$GTK_CONFIG" = "X"; then
1610 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
1611 if test "X$GTK_CONFIG" = "Xno"; then
1612 dnl Some distributions call it gtk12-config, annoying!
1613 AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no)
1614 GTK_CONFIG="$GTK12_CONFIG"
1615 fi
1616 else
1617 AC_MSG_RESULT(Using GTK configuration program $GTK_CONFIG)
1618 fi
1619 if test "X$PKG_CONFIG" = "X"; then
1620 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1621 fi
1622
1623 if test "x$GTK_CONFIG:$PKG_CONFIG" != "xno:no"; then
1624 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1625 dnl problems (bold fonts, --remote doesn't work).
1626 if test "X$SKIP_GTK2" != "XYES"; then
1627 AM_PATH_GTK(2.2.0,
Bram Moolenaar7b0294c2004-10-11 10:16:09 +00001628 [GUI_LIB_LOC="$GTK_LIBDIR"
1629 GTK_LIBNAME="$GTK_LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001630 GUI_INC_LOC="$GTK_CFLAGS"], )
1631 if test "x$GTK_CFLAGS" != "x"; then
1632 SKIP_ATHENA=YES
1633 SKIP_NEXTAW=YES
1634 SKIP_MOTIF=YES
1635 GUITYPE=GTK
1636 AC_SUBST(GTK_LIBNAME)
1637 fi
1638 fi
1639
1640 dnl If there is no 2.2.0 or later try the 1.x.x series. We require at
1641 dnl least GTK 1.1.16. 1.0.6 doesn't work. 1.1.1 to 1.1.15
1642 dnl were test versions.
1643 if test "x$GUITYPE" != "xGTK"; then
1644 SKIP_GTK2=YES
1645 AM_PATH_GTK(1.1.16,
1646 [GTK_LIBNAME="$GTK_LIBS"
1647 GUI_INC_LOC="$GTK_CFLAGS"], )
1648 if test "x$GTK_CFLAGS" != "x"; then
1649 SKIP_ATHENA=YES
1650 SKIP_NEXTAW=YES
1651 SKIP_MOTIF=YES
1652 GUITYPE=GTK
1653 AC_SUBST(GTK_LIBNAME)
1654 fi
1655 fi
1656 fi
1657 dnl Give a warning if GTK is older than 1.2.3
1658 if test "x$GUITYPE" = "xGTK"; then
1659 if test "$gtk_major_version" = 1 -a "0$gtk_minor_version" -lt 2 \
1660 -o "$gtk_major_version" = 1 -a "$gtk_minor_version" = 2 -a "0$gtk_micro_version" -lt 3; then
1661 AC_MSG_RESULT(this GTK version is old; version 1.2.3 or later is recommended)
1662 else
1663 {
1664 if test "0$gtk_major_version" -ge 2; then
1665 AC_DEFINE(HAVE_GTK2)
1666 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1667 || test "0$gtk_minor_version" -ge 2 \
1668 || test "0$gtk_major_version" -gt 2; then
1669 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1670 fi
1671 fi
1672 dnl
1673 dnl if GTK exists, and it's not the 1.0.x series, then check for GNOME.
1674 dnl
1675 if test -z "$SKIP_GNOME"; then
1676 {
1677 GNOME_INIT_HOOK([have_gnome=yes])
1678 if test x$have_gnome = xyes ; then
1679 AC_DEFINE(FEAT_GUI_GNOME)
1680 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1681 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
1682 fi
1683 }
1684 fi
1685 }
1686 fi
1687 fi
1688fi
1689
1690dnl Check for Motif include files location.
1691dnl The LAST one found is used, this makes the highest version to be used,
1692dnl e.g. when Motif1.2 and Motif2.0 are both present.
1693
1694if test -z "$SKIP_MOTIF"; then
1695 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"
1696 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1697 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1698
1699 AC_MSG_CHECKING(for location of Motif GUI includes)
1700 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1701 GUI_INC_LOC=
1702 for try in $gui_includes; do
1703 if test -f "$try/Xm/Xm.h"; then
1704 GUI_INC_LOC=$try
1705 fi
1706 done
1707 if test -n "$GUI_INC_LOC"; then
1708 if test "$GUI_INC_LOC" = /usr/include; then
1709 GUI_INC_LOC=
1710 AC_MSG_RESULT(in default path)
1711 else
1712 AC_MSG_RESULT($GUI_INC_LOC)
1713 fi
1714 else
1715 AC_MSG_RESULT(<not found>)
1716 SKIP_MOTIF=YES
1717 fi
1718fi
1719
1720dnl Check for Motif library files location. In the same order as the include
1721dnl files, to avoid a mixup if several versions are present
1722
1723if test -z "$SKIP_MOTIF"; then
1724 AC_MSG_CHECKING(--with-motif-lib argument)
1725 AC_ARG_WITH(motif-lib,
1726 [ --with-motif-lib=STRING Library for Motif ],
1727 [ MOTIF_LIBNAME="${withval}" ] )
1728
1729 if test -n "$MOTIF_LIBNAME"; then
1730 AC_MSG_RESULT($MOTIF_LIBNAME)
1731 GUI_LIB_LOC=
1732 else
1733 AC_MSG_RESULT(no)
1734
1735 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1736 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1737
1738 AC_MSG_CHECKING(for location of Motif GUI libs)
1739 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"
1740 GUI_LIB_LOC=
1741 for try in $gui_libs; do
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001742 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
Bram Moolenaar071d4272004-06-13 20:20:40 +00001743 if test -f "$libtry"; then
1744 GUI_LIB_LOC=$try
1745 fi
1746 done
1747 done
1748 if test -n "$GUI_LIB_LOC"; then
1749 dnl Remove /usr/lib, it causes trouble on some systems
1750 if test "$GUI_LIB_LOC" = /usr/lib; then
1751 GUI_LIB_LOC=
1752 AC_MSG_RESULT(in default path)
1753 else
1754 if test -n "$GUI_LIB_LOC"; then
1755 AC_MSG_RESULT($GUI_LIB_LOC)
1756 if test "`(uname) 2>/dev/null`" = SunOS &&
1757 uname -r | grep '^5' >/dev/null; then
1758 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1759 fi
1760 fi
1761 fi
1762 MOTIF_LIBNAME=-lXm
1763 else
1764 AC_MSG_RESULT(<not found>)
1765 SKIP_MOTIF=YES
1766 fi
1767 fi
1768fi
1769
1770if test -z "$SKIP_MOTIF"; then
1771 SKIP_ATHENA=YES
1772 SKIP_NEXTAW=YES
1773 GUITYPE=MOTIF
1774 AC_SUBST(MOTIF_LIBNAME)
1775fi
1776
1777dnl Check if the Athena files can be found
1778
1779GUI_X_LIBS=
1780
1781if test -z "$SKIP_ATHENA"; then
1782 AC_MSG_CHECKING(if Athena header files can be found)
1783 cflags_save=$CFLAGS
1784 CFLAGS="$CFLAGS $X_CFLAGS"
1785 AC_TRY_COMPILE([
1786#include <X11/Intrinsic.h>
1787#include <X11/Xaw/Paned.h>], ,
1788 AC_MSG_RESULT(yes),
1789 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1790 CFLAGS=$cflags_save
1791fi
1792
1793if test -z "$SKIP_ATHENA"; then
1794 GUITYPE=ATHENA
1795fi
1796
1797if test -z "$SKIP_NEXTAW"; then
1798 AC_MSG_CHECKING(if neXtaw header files can be found)
1799 cflags_save=$CFLAGS
1800 CFLAGS="$CFLAGS $X_CFLAGS"
1801 AC_TRY_COMPILE([
1802#include <X11/Intrinsic.h>
1803#include <X11/neXtaw/Paned.h>], ,
1804 AC_MSG_RESULT(yes),
1805 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1806 CFLAGS=$cflags_save
1807fi
1808
1809if test -z "$SKIP_NEXTAW"; then
1810 GUITYPE=NEXTAW
1811fi
1812
1813if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1814 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1815 dnl Avoid adding it when it twice
1816 if test -n "$GUI_INC_LOC"; then
1817 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1818 fi
1819 if test -n "$GUI_LIB_LOC"; then
1820 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1821 fi
1822
1823 dnl Check for -lXext and then for -lXmu
1824 ldflags_save=$LDFLAGS
1825 LDFLAGS="$X_LIBS $LDFLAGS"
1826 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1827 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1828 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1829 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1830 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1831 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1832 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1833 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1834 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1835 if test -z "$SKIP_MOTIF"; then
1836 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1837 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1838 fi
1839 LDFLAGS=$ldflags_save
1840
1841 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1842 AC_MSG_CHECKING(for extra X11 defines)
1843 NARROW_PROTO=
1844 rm -fr conftestdir
1845 if mkdir conftestdir; then
1846 cd conftestdir
1847 cat > Imakefile <<'EOF'
1848acfindx:
1849 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
1850EOF
1851 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1852 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
1853 fi
1854 cd ..
1855 rm -fr conftestdir
1856 fi
1857 if test -z "$NARROW_PROTO"; then
1858 AC_MSG_RESULT(no)
1859 else
1860 AC_MSG_RESULT($NARROW_PROTO)
1861 fi
1862 AC_SUBST(NARROW_PROTO)
1863fi
1864
1865dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
1866dnl use the X11 include path
1867if test "$enable_xsmp" = "yes"; then
1868 cppflags_save=$CPPFLAGS
1869 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1870 AC_CHECK_HEADERS(X11/SM/SMlib.h)
1871 CPPFLAGS=$cppflags_save
1872fi
1873
1874
1875if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK"; then
1876 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
1877 cppflags_save=$CPPFLAGS
1878 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1879 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
1880
1881 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
1882 if test ! "$enable_xim" = "no"; then
1883 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
1884 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
1885 AC_MSG_RESULT(yes),
1886 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
1887 fi
1888 CPPFLAGS=$cppflags_save
1889
1890 dnl automatically enable XIM when hangul input isn't enabled
1891 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
1892 -a "x$GUITYPE" != "xNONE" ; then
1893 AC_MSG_RESULT(X GUI selected; xim has been enabled)
1894 enable_xim="yes"
1895 fi
1896fi
1897
1898if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1899 cppflags_save=$CPPFLAGS
1900 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001901dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
1902 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
1903 AC_TRY_COMPILE([
1904#include <X11/Intrinsic.h>
1905#include <X11/Xmu/Editres.h>],
1906 [int i; i = 0;],
1907 AC_MSG_RESULT(yes)
1908 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
1909 AC_MSG_RESULT(no))
Bram Moolenaar071d4272004-06-13 20:20:40 +00001910 CPPFLAGS=$cppflags_save
1911fi
1912
1913dnl Only use the Xm directory when compiling Motif, don't use it for Athena
1914if test -z "$SKIP_MOTIF"; then
1915 cppflags_save=$CPPFLAGS
1916 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00001917 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 +00001918 Xm/UnhighlightT.h Xm/Notebook.h)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001919
1920 if test $ac_cv_header_Xm_XpmP_h = yes; then
1921 dnl Solaris uses XpmAttributes_21, very annoying.
1922 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
1923 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
1924 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
1925 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
1926 )
1927 else
Bram Moolenaar57657d82006-04-21 22:12:41 +00001928 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
Bram Moolenaar910f66f2006-04-05 20:41:53 +00001929 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00001930 CPPFLAGS=$cppflags_save
1931fi
1932
1933if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
1934 AC_MSG_RESULT(no GUI selected; xim has been disabled)
1935 enable_xim="no"
1936fi
1937if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
1938 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
1939 enable_fontset="no"
1940fi
1941if test "x$GUITYPE:$enable_fontset" = "xGTK:yes" -a "0$gtk_major_version" -ge 2; then
1942 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
1943 enable_fontset="no"
1944fi
1945
Bram Moolenaar071d4272004-06-13 20:20:40 +00001946if test -z "$SKIP_PHOTON"; then
1947 GUITYPE=PHOTONGUI
1948fi
1949
1950AC_SUBST(GUI_INC_LOC)
1951AC_SUBST(GUI_LIB_LOC)
1952AC_SUBST(GUITYPE)
1953AC_SUBST(GUI_X_LIBS)
1954
1955if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
1956 AC_MSG_ERROR([cannot use workshop without Motif])
1957fi
1958
1959dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
1960if test "$enable_xim" = "yes"; then
1961 AC_DEFINE(FEAT_XIM)
1962fi
1963if test "$enable_fontset" = "yes"; then
1964 AC_DEFINE(FEAT_XFONTSET)
1965fi
1966
1967
1968dnl ---------------------------------------------------------------------------
1969dnl end of GUI-checking
1970dnl ---------------------------------------------------------------------------
1971
1972
1973dnl Only really enable hangul input when GUI and XFONTSET are available
1974if test "$enable_hangulinput" = "yes"; then
1975 if test "x$GUITYPE" = "xNONE"; then
1976 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
1977 enable_hangulinput=no
1978 else
1979 AC_DEFINE(FEAT_HANGULIN)
1980 HANGULIN_SRC=hangulin.c
1981 AC_SUBST(HANGULIN_SRC)
1982 HANGULIN_OBJ=objects/hangulin.o
1983 AC_SUBST(HANGULIN_OBJ)
1984 fi
1985fi
1986
1987dnl Checks for libraries and include files.
1988
1989AC_MSG_CHECKING(quality of toupper)
1990AC_TRY_RUN([#include <ctype.h>
1991main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }],
1992 AC_DEFINE(BROKEN_TOUPPER) AC_MSG_RESULT(bad),
1993 AC_MSG_RESULT(good), AC_MSG_ERROR(failed to compile test program))
1994
1995AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
1996AC_TRY_COMPILE(, [printf("(" __DATE__ " " __TIME__ ")");],
1997 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
1998 AC_MSG_RESULT(no))
1999
2000dnl Checks for header files.
2001AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2002dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2003if test "$HAS_ELF" = 1; then
2004 AC_CHECK_LIB(elf, main)
2005fi
2006
2007AC_HEADER_DIRENT
2008
2009dnl check for standard headers, we don't use this in Vim but other stuff
2010dnl in autoconf needs it
2011AC_HEADER_STDC
2012AC_HEADER_SYS_WAIT
2013
2014dnl If sys/wait.h is not found it might still exist but not be POSIX
2015dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2016if test $ac_cv_header_sys_wait_h = no; then
2017 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2018 AC_TRY_COMPILE([#include <sys/wait.h>],
2019 [union wait xx, yy; xx = yy],
2020 AC_MSG_RESULT(yes)
2021 AC_DEFINE(HAVE_SYS_WAIT_H)
2022 AC_DEFINE(HAVE_UNION_WAIT),
2023 AC_MSG_RESULT(no))
2024fi
2025
2026AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
2027 termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h \
2028 iconv.h langinfo.h unistd.h stropts.h errno.h \
2029 sys/resource.h sys/systeminfo.h locale.h \
2030 sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \
2031 poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002032 libgen.h util/debug.h util/msg18n.h frame.h \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002033 sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h wctype.h)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002034
Bram Moolenaardf3267e2005-01-25 22:07:05 +00002035dnl pthread_np.h may exist but can only be used after including pthread.h
2036AC_MSG_CHECKING([for pthread_np.h])
2037AC_TRY_COMPILE([
2038#include <pthread.h>
2039#include <pthread_np.h>],
2040 [int i; i = 0;],
2041 AC_MSG_RESULT(yes)
2042 AC_DEFINE(HAVE_PTHREAD_NP_H),
2043 AC_MSG_RESULT(no))
2044
Bram Moolenaare344bea2005-09-01 20:46:49 +00002045AC_CHECK_HEADERS(strings.h)
Bram Moolenaar9372a112005-12-06 19:59:18 +00002046if test "x$MACOSX" = "xyes"; then
2047 dnl The strings.h file on OS/X contains a warning and nothing useful.
2048 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2049else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002050
2051dnl Check if strings.h and string.h can both be included when defined.
2052AC_MSG_CHECKING([if strings.h can be included after string.h])
2053cppflags_save=$CPPFLAGS
2054CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2055AC_TRY_COMPILE([
2056#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2057# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2058 /* but don't do it on AIX 5.1 (Uribarri) */
2059#endif
2060#ifdef HAVE_XM_XM_H
2061# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2062#endif
2063#ifdef HAVE_STRING_H
2064# include <string.h>
2065#endif
2066#if defined(HAVE_STRINGS_H)
2067# include <strings.h>
2068#endif
2069 ], [int i; i = 0;],
2070 AC_MSG_RESULT(yes),
2071 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2072 AC_MSG_RESULT(no))
2073CPPFLAGS=$cppflags_save
Bram Moolenaar9372a112005-12-06 19:59:18 +00002074fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002075
2076dnl Checks for typedefs, structures, and compiler characteristics.
2077AC_PROG_GCC_TRADITIONAL
2078AC_C_CONST
2079AC_TYPE_MODE_T
2080AC_TYPE_OFF_T
2081AC_TYPE_PID_T
2082AC_TYPE_SIZE_T
2083AC_TYPE_UID_T
2084AC_HEADER_TIME
2085AC_CHECK_TYPE(ino_t, long)
2086AC_CHECK_TYPE(dev_t, unsigned)
2087
2088AC_MSG_CHECKING(for rlim_t)
2089if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2090 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2091else
2092 AC_EGREP_CPP(dnl
2093changequote(<<,>>)dnl
2094<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2095changequote([,]),
2096 [
2097#include <sys/types.h>
2098#if STDC_HEADERS
2099#include <stdlib.h>
2100#include <stddef.h>
2101#endif
2102#ifdef HAVE_SYS_RESOURCE_H
2103#include <sys/resource.h>
2104#endif
2105 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2106 AC_MSG_RESULT($ac_cv_type_rlim_t)
2107fi
2108if test $ac_cv_type_rlim_t = no; then
2109 cat >> confdefs.h <<\EOF
2110#define rlim_t unsigned long
2111EOF
2112fi
2113
2114AC_MSG_CHECKING(for stack_t)
2115if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2116 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2117else
2118 AC_EGREP_CPP(stack_t,
2119 [
2120#include <sys/types.h>
2121#if STDC_HEADERS
2122#include <stdlib.h>
2123#include <stddef.h>
2124#endif
2125#include <signal.h>
2126 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2127 AC_MSG_RESULT($ac_cv_type_stack_t)
2128fi
2129if test $ac_cv_type_stack_t = no; then
2130 cat >> confdefs.h <<\EOF
2131#define stack_t struct sigaltstack
2132EOF
2133fi
2134
2135dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2136AC_MSG_CHECKING(whether stack_t has an ss_base field)
2137AC_TRY_COMPILE([
2138#include <sys/types.h>
2139#if STDC_HEADERS
2140#include <stdlib.h>
2141#include <stddef.h>
2142#endif
2143#include <signal.h>
2144#include "confdefs.h"
2145 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2146 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2147 AC_MSG_RESULT(no))
2148
2149olibs="$LIBS"
2150AC_MSG_CHECKING(--with-tlib argument)
2151AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2152if test -n "$with_tlib"; then
2153 AC_MSG_RESULT($with_tlib)
2154 LIBS="$LIBS -l$with_tlib"
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002155 AC_MSG_CHECKING(for linking with $with_tlib library)
2156 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2157 dnl Need to check for tgetent() below.
2158 olibs="$LIBS"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002159else
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002160 AC_MSG_RESULT([empty: automatic terminal library selection])
Bram Moolenaar071d4272004-06-13 20:20:40 +00002161 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2162 dnl curses, because curses is much slower.
2163 dnl Newer versions of ncurses are preferred over anything.
2164 dnl Older versions of ncurses have bugs, get a new one!
2165 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002166 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002167 case "`uname -s 2>/dev/null`" in
Bram Moolenaara1b5aa52006-10-10 09:41:28 +00002168 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002169 *) tlibs="ncurses termlib termcap curses";;
2170 esac
2171 for libname in $tlibs; do
2172 AC_CHECK_LIB(${libname}, tgetent,,)
2173 if test "x$olibs" != "x$LIBS"; then
2174 dnl It's possible that a library is found but it doesn't work
2175 dnl e.g., shared library that cannot be found
2176 dnl compile and run a test program to be sure
2177 AC_TRY_RUN([
2178#ifdef HAVE_TERMCAP_H
2179# include <termcap.h>
2180#endif
2181main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2182 res="OK", res="FAIL", res="FAIL")
2183 if test "$res" = "OK"; then
2184 break
2185 fi
2186 AC_MSG_RESULT($libname library is not usable)
2187 LIBS="$olibs"
2188 fi
2189 done
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002190 if test "x$olibs" = "x$LIBS"; then
2191 AC_MSG_RESULT(no terminal library found)
2192 fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002193fi
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002194
2195if test "x$olibs" = "x$LIBS"; then
2196 AC_MSG_CHECKING([for tgetent()])
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002197 AC_TRY_LINK([],
Bram Moolenaar1cd871b2004-12-19 22:46:22 +00002198 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2199 AC_MSG_RESULT(yes),
2200 AC_MSG_ERROR([NOT FOUND!
2201 You need to install a terminal library; for example ncurses.
2202 Or specify the name of the library with --with-tlib.]))
2203fi
2204
2205AC_MSG_CHECKING(whether we talk terminfo)
2206AC_TRY_RUN([
Bram Moolenaar071d4272004-06-13 20:20:40 +00002207#ifdef HAVE_TERMCAP_H
2208# include <termcap.h>
2209#endif
2210main()
2211{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }],
2212 AC_MSG_RESULT([no -- we are in termcap land]),
2213 AC_MSG_RESULT([yes -- terminfo spoken here]); AC_DEFINE(TERMINFO),
2214 AC_MSG_ERROR(failed to compile test program.))
Bram Moolenaar071d4272004-06-13 20:20:40 +00002215
2216if test "x$olibs" != "x$LIBS"; then
2217 AC_MSG_CHECKING(what tgetent() returns for an unknown terminal)
2218 AC_TRY_RUN([
2219#ifdef HAVE_TERMCAP_H
2220# include <termcap.h>
2221#endif
2222main()
2223{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }],
2224 AC_MSG_RESULT(zero); AC_DEFINE(TGETENT_ZERO_ERR, 0),
2225 AC_MSG_RESULT(non-zero),
2226 AC_MSG_ERROR(failed to compile test program.))
2227fi
2228
2229AC_MSG_CHECKING(whether termcap.h contains ospeed)
2230AC_TRY_LINK([
2231#ifdef HAVE_TERMCAP_H
2232# include <termcap.h>
2233#endif
2234 ], [ospeed = 20000],
2235 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2236 [AC_MSG_RESULT(no)
2237 AC_MSG_CHECKING(whether ospeed can be extern)
2238 AC_TRY_LINK([
2239#ifdef HAVE_TERMCAP_H
2240# include <termcap.h>
2241#endif
2242extern short ospeed;
2243 ], [ospeed = 20000],
2244 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2245 AC_MSG_RESULT(no))]
2246 )
2247
2248AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2249AC_TRY_LINK([
2250#ifdef HAVE_TERMCAP_H
2251# include <termcap.h>
2252#endif
2253 ], [if (UP == 0 && BC == 0) PC = 1],
2254 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2255 [AC_MSG_RESULT(no)
2256 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2257 AC_TRY_LINK([
2258#ifdef HAVE_TERMCAP_H
2259# include <termcap.h>
2260#endif
2261extern char *UP, *BC, PC;
2262 ], [if (UP == 0 && BC == 0) PC = 1],
2263 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2264 AC_MSG_RESULT(no))]
2265 )
2266
2267AC_MSG_CHECKING(whether tputs() uses outfuntype)
2268AC_TRY_COMPILE([
2269#ifdef HAVE_TERMCAP_H
2270# include <termcap.h>
2271#endif
2272 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2273 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2274 AC_MSG_RESULT(no))
2275
2276dnl On some SCO machines sys/select redefines struct timeval
2277AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2278AC_TRY_COMPILE([
2279#include <sys/types.h>
2280#include <sys/time.h>
2281#include <sys/select.h>], ,
2282 AC_MSG_RESULT(yes)
2283 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2284 AC_MSG_RESULT(no))
2285
2286dnl AC_DECL_SYS_SIGLIST
2287
2288dnl Checks for pty.c (copied from screen) ==========================
2289AC_MSG_CHECKING(for /dev/ptc)
2290if test -r /dev/ptc; then
2291 AC_DEFINE(HAVE_DEV_PTC)
2292 AC_MSG_RESULT(yes)
2293else
2294 AC_MSG_RESULT(no)
2295fi
2296
2297AC_MSG_CHECKING(for SVR4 ptys)
2298if test -c /dev/ptmx ; then
2299 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2300 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2301 AC_MSG_RESULT(no))
2302else
2303 AC_MSG_RESULT(no)
2304fi
2305
2306AC_MSG_CHECKING(for ptyranges)
2307if test -d /dev/ptym ; then
2308 pdir='/dev/ptym'
2309else
2310 pdir='/dev'
2311fi
2312dnl SCO uses ptyp%d
2313AC_EGREP_CPP(yes,
2314[#ifdef M_UNIX
2315 yes;
2316#endif
2317 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2318dnl if test -c /dev/ptyp19; then
2319dnl ptys=`echo /dev/ptyp??`
2320dnl else
2321dnl ptys=`echo $pdir/pty??`
2322dnl fi
2323if test "$ptys" != "$pdir/pty??" ; then
2324 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2325 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2326 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2327 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2328 AC_MSG_RESULT([$p0 / $p1])
2329else
2330 AC_MSG_RESULT([don't know])
2331fi
2332
2333dnl **** pty mode/group handling ****
2334dnl
2335dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
2336AC_MSG_CHECKING(default tty permissions/group)
2337rm -f conftest_grp
2338AC_TRY_RUN([
2339#include <sys/types.h>
2340#include <sys/stat.h>
2341#include <stdio.h>
2342main()
2343{
2344 struct stat sb;
2345 char *x,*ttyname();
2346 int om, m;
2347 FILE *fp;
2348
2349 if (!(x = ttyname(0))) exit(1);
2350 if (stat(x, &sb)) exit(1);
2351 om = sb.st_mode;
2352 if (om & 002) exit(0);
2353 m = system("mesg y");
2354 if (m == -1 || m == 127) exit(1);
2355 if (stat(x, &sb)) exit(1);
2356 m = sb.st_mode;
2357 if (chmod(x, om)) exit(1);
2358 if (m & 002) exit(0);
2359 if (sb.st_gid == getgid()) exit(1);
2360 if (!(fp=fopen("conftest_grp", "w")))
2361 exit(1);
2362 fprintf(fp, "%d\n", sb.st_gid);
2363 fclose(fp);
2364 exit(0);
2365}
2366],[
2367 if test -f conftest_grp; then
2368 ptygrp=`cat conftest_grp`
2369 AC_MSG_RESULT([pty mode: 0620, group: $ptygrp])
2370 AC_DEFINE(PTYMODE, 0620)
2371 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
2372 else
2373 AC_MSG_RESULT([ptys are world accessable])
2374 fi
2375],
2376 AC_MSG_RESULT([can't determine - assume ptys are world accessable]),
2377 AC_MSG_ERROR(failed to compile test program))
2378rm -f conftest_grp
2379
2380dnl Checks for library functions. ===================================
2381
2382AC_TYPE_SIGNAL
2383
2384dnl find out what to use at the end of a signal function
2385if test $ac_cv_type_signal = void; then
2386 AC_DEFINE(SIGRETURN, [return])
2387else
2388 AC_DEFINE(SIGRETURN, [return 0])
2389fi
2390
2391dnl check if struct sigcontext is defined (used for SGI only)
2392AC_MSG_CHECKING(for struct sigcontext)
2393AC_TRY_COMPILE([
2394#include <signal.h>
2395test_sig()
2396{
2397 struct sigcontext *scont;
2398 scont = (struct sigcontext *)0;
2399 return 1;
2400} ], ,
2401 AC_MSG_RESULT(yes)
2402 AC_DEFINE(HAVE_SIGCONTEXT),
2403 AC_MSG_RESULT(no))
2404
2405dnl tricky stuff: try to find out if getcwd() is implemented with
2406dnl system("sh -c pwd")
2407AC_MSG_CHECKING(getcwd implementation)
2408AC_TRY_RUN([
2409char *dagger[] = { "IFS=pwd", 0 };
2410main()
2411{
2412 char buffer[500];
2413 extern char **environ;
2414 environ = dagger;
2415 return getcwd(buffer, 500) ? 0 : 1;
2416}],
2417 AC_MSG_RESULT(it is usable),
2418 AC_MSG_RESULT(it stinks)
2419 AC_DEFINE(BAD_GETCWD),
2420 AC_MSG_ERROR(failed to compile test program))
2421
2422dnl Check for functions in one big call, to reduce the size of configure
2423AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
2424 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
2425 memset nanosleep opendir putenv qsort readlink select setenv \
2426 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
Bram Moolenaar051b7822005-05-19 21:00:46 +00002427 sigvec strcasecmp strerror strftime stricmp strncasecmp \
Bram Moolenaar0cb032e2005-04-23 20:52:00 +00002428 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2429 usleep utime utimes)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002430
2431dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2432AC_MSG_CHECKING(for st_blksize)
2433AC_TRY_COMPILE(
2434[#include <sys/types.h>
2435#include <sys/stat.h>],
2436[ struct stat st;
2437 int n;
2438
2439 stat("/", &st);
2440 n = (int)st.st_blksize;],
2441 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2442 AC_MSG_RESULT(no))
2443
2444AC_MSG_CHECKING(whether stat() ignores a trailing slash)
2445AC_TRY_RUN(
2446[#include <sys/types.h>
2447#include <sys/stat.h>
2448main() {struct stat st; exit(stat("configure/", &st) != 0); }],
2449 AC_MSG_RESULT(yes); AC_DEFINE(STAT_IGNORES_SLASH),
2450 AC_MSG_RESULT(no), AC_MSG_ERROR(failed to compile test program))
2451
2452dnl Link with iconv for charset translation, if not found without library.
2453dnl check for iconv() requires including iconv.h
2454dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2455dnl has been installed.
2456AC_MSG_CHECKING(for iconv_open())
2457save_LIBS="$LIBS"
2458LIBS="$LIBS -liconv"
2459AC_TRY_LINK([
2460#ifdef HAVE_ICONV_H
2461# include <iconv.h>
2462#endif
2463 ], [iconv_open("fr", "to");],
2464 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2465 LIBS="$save_LIBS"
2466 AC_TRY_LINK([
2467#ifdef HAVE_ICONV_H
2468# include <iconv.h>
2469#endif
2470 ], [iconv_open("fr", "to");],
2471 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2472 AC_MSG_RESULT(no)))
2473
2474
2475AC_MSG_CHECKING(for nl_langinfo(CODESET))
2476AC_TRY_LINK([
2477#ifdef HAVE_LANGINFO_H
2478# include <langinfo.h>
2479#endif
2480], [char *cs = nl_langinfo(CODESET);],
2481 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2482 AC_MSG_RESULT(no))
2483
2484dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2485dnl when -lacl works, also try to use -lattr (required for Debian).
2486AC_MSG_CHECKING(--disable-acl argument)
2487AC_ARG_ENABLE(acl,
2488 [ --disable-acl Don't check for ACL support.],
2489 , [enable_acl="yes"])
2490if test "$enable_acl" = "yes"; then
2491AC_MSG_RESULT(no)
2492AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2493 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2494 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2495
2496AC_MSG_CHECKING(for POSIX ACL support)
2497AC_TRY_LINK([
2498#include <sys/types.h>
2499#ifdef HAVE_SYS_ACL_H
2500# include <sys/acl.h>
2501#endif
2502acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2503 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2504 acl_free(acl);],
2505 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2506 AC_MSG_RESULT(no))
2507
2508AC_MSG_CHECKING(for Solaris ACL support)
2509AC_TRY_LINK([
2510#ifdef HAVE_SYS_ACL_H
2511# include <sys/acl.h>
2512#endif], [acl("foo", GETACLCNT, 0, NULL);
2513 ],
2514 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2515 AC_MSG_RESULT(no))
2516
2517AC_MSG_CHECKING(for AIX ACL support)
2518AC_TRY_LINK([
2519#ifdef HAVE_SYS_ACL_H
2520# include <sys/acl.h>
2521#endif
2522#ifdef HAVE_SYS_ACCESS_H
2523# include <sys/access.h>
2524#endif
2525#define _ALL_SOURCE
2526
2527#include <sys/stat.h>
2528
2529int aclsize;
2530struct acl *aclent;], [aclsize = sizeof(struct acl);
2531 aclent = (void *)malloc(aclsize);
2532 statacl("foo", STX_NORMAL, aclent, aclsize);
2533 ],
2534 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2535 AC_MSG_RESULT(no))
2536else
2537 AC_MSG_RESULT(yes)
2538fi
2539
2540AC_MSG_CHECKING(--disable-gpm argument)
2541AC_ARG_ENABLE(gpm,
2542 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2543 [enable_gpm="yes"])
2544
2545if test "$enable_gpm" = "yes"; then
2546 AC_MSG_RESULT(no)
2547 dnl Checking if gpm support can be compiled
2548 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2549 [olibs="$LIBS" ; LIBS="-lgpm"]
2550 AC_TRY_LINK(
2551 [#include <gpm.h>
2552 #include <linux/keyboard.h>],
2553 [Gpm_GetLibVersion(NULL);],
2554 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2555 dnl FEAT_MOUSE_GPM if mouse support is included
2556 [vi_cv_have_gpm=yes],
2557 [vi_cv_have_gpm=no])
2558 [LIBS="$olibs"]
2559 )
2560 if test $vi_cv_have_gpm = yes; then
2561 LIBS="$LIBS -lgpm"
2562 AC_DEFINE(HAVE_GPM)
2563 fi
2564else
2565 AC_MSG_RESULT(yes)
2566fi
2567
Bram Moolenaar071d4272004-06-13 20:20:40 +00002568dnl rename needs to be checked separately to work on Nextstep with cc
2569AC_MSG_CHECKING(for rename)
2570AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2571 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2572 AC_MSG_RESULT(no))
2573
2574dnl sysctl() may exist but not the arguments we use
2575AC_MSG_CHECKING(for sysctl)
2576AC_TRY_COMPILE(
2577[#include <sys/types.h>
2578#include <sys/sysctl.h>],
2579[ int mib[2], r;
2580 size_t len;
2581
2582 mib[0] = CTL_HW;
2583 mib[1] = HW_USERMEM;
2584 len = sizeof(r);
2585 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2586 ],
2587 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2588 AC_MSG_RESULT(not usable))
2589
2590dnl sysinfo() may exist but not be Linux compatible
2591AC_MSG_CHECKING(for sysinfo)
2592AC_TRY_COMPILE(
2593[#include <sys/types.h>
2594#include <sys/sysinfo.h>],
2595[ struct sysinfo sinfo;
2596 int t;
2597
2598 (void)sysinfo(&sinfo);
2599 t = sinfo.totalram;
2600 ],
2601 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2602 AC_MSG_RESULT(not usable))
2603
Bram Moolenaar914572a2007-05-01 11:37:47 +00002604dnl struct sysinfo may have the mem_unit field or not
2605AC_MSG_CHECKING(for sysinfo.mem_unit)
2606AC_TRY_COMPILE(
2607[#include <sys/types.h>
2608#include <sys/sysinfo.h>],
2609[ struct sysinfo sinfo;
2610 sinfo.mem_unit = 1;
2611 ],
2612 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
2613 AC_MSG_RESULT(no))
2614
Bram Moolenaar071d4272004-06-13 20:20:40 +00002615dnl sysconf() may exist but not support what we want to use
2616AC_MSG_CHECKING(for sysconf)
2617AC_TRY_COMPILE(
2618[#include <unistd.h>],
2619[ (void)sysconf(_SC_PAGESIZE);
2620 (void)sysconf(_SC_PHYS_PAGES);
2621 ],
2622 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2623 AC_MSG_RESULT(not usable))
2624
2625dnl Our own version of AC_CHECK_SIZEOF(int); fixes a bug when sizeof() can't
2626dnl be printed with "%d", and avoids a warning for cross-compiling.
2627
2628AC_MSG_CHECKING(size of int)
2629AC_CACHE_VAL(ac_cv_sizeof_int,
2630 [AC_TRY_RUN([#include <stdio.h>
2631 main()
2632 {
2633 FILE *f=fopen("conftestval", "w");
2634 if (!f) exit(1);
2635 fprintf(f, "%d\n", (int)sizeof(int));
2636 exit(0);
2637 }],
2638 ac_cv_sizeof_int=`cat conftestval`,
2639 ac_cv_sizeof_int=0,
2640 AC_MSG_ERROR(failed to compile test program))])
2641AC_MSG_RESULT($ac_cv_sizeof_int)
2642AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
2643
2644AC_MSG_CHECKING(whether memmove/bcopy/memcpy handle overlaps)
2645[bcopy_test_prog='
2646main() {
2647 char buf[10];
2648 strcpy(buf, "abcdefghi");
2649 mch_memmove(buf, buf + 2, 3);
2650 if (strncmp(buf, "ababcf", 6))
2651 exit(1);
2652 strcpy(buf, "abcdefghi");
2653 mch_memmove(buf + 2, buf, 3);
2654 if (strncmp(buf, "cdedef", 6))
2655 exit(1);
2656 exit(0); /* libc version works properly. */
2657}']
2658
2659dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2660dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2661
2662AC_TRY_RUN([#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog],
2663 AC_DEFINE(USEMEMMOVE) AC_MSG_RESULT(memmove does),
2664 AC_TRY_RUN([#define mch_memmove(s,d,l) bcopy(d,s,l) $bcopy_test_prog],
2665 AC_DEFINE(USEBCOPY) AC_MSG_RESULT(bcopy does),
2666 AC_TRY_RUN([#define mch_memmove(s,d,l) memcpy(d,s,l) $bcopy_test_prog],
2667 AC_DEFINE(USEMEMCPY) AC_MSG_RESULT(memcpy does), AC_MSG_RESULT(no),
2668 AC_MSG_ERROR(failed to compile test program)),
2669 AC_MSG_ERROR(failed to compile test program)),
2670 AC_MSG_ERROR(failed to compile test program))
2671
2672dnl Check for multibyte locale functions
2673dnl Find out if _Xsetlocale() is supported by libX11.
2674dnl Check if X_LOCALE should be defined.
2675
2676if test "$enable_multibyte" = "yes"; then
2677 cflags_save=$CFLAGS
2678 ldflags_save=$LDFLAGS
2679 if test -n "$x_includes" ; then
2680 CFLAGS="$CFLAGS -I$x_includes"
2681 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
2682 AC_MSG_CHECKING(whether X_LOCALE needed)
2683 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
2684 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
2685 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
2686 AC_MSG_RESULT(no))
2687 fi
2688 CFLAGS=$cflags_save
2689 LDFLAGS=$ldflags_save
2690fi
2691
2692dnl Link with xpg4, it is said to make Korean locale working
2693AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
2694
2695dnl Check how we can run ctags
2696dnl --version for Exuberant ctags (preferred)
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002697dnl Add --fields=+S to get function signatures for omni completion.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002698dnl -t for typedefs (many ctags have this)
2699dnl -s for static functions (Elvis ctags only?)
2700dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
2701dnl -i+m to test for older Exuberant ctags
2702AC_MSG_CHECKING(how to create tags)
2703test -f tags && mv tags tags.save
2704if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002705 TAGPRG="ctags -I INIT+ --fields=+S"
Bram Moolenaar071d4272004-06-13 20:20:40 +00002706else
2707 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
2708 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
2709 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
2710 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
2711 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
2712 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
2713 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
2714fi
2715test -f tags.save && mv tags.save tags
2716AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
2717
2718dnl Check how we can run man with a section number
2719AC_MSG_CHECKING(how to run man with a section nr)
2720MANDEF="man"
2721(eval man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
2722AC_MSG_RESULT($MANDEF)
2723if test "$MANDEF" = "man -s"; then
2724 AC_DEFINE(USEMAN_S)
2725fi
2726
2727dnl Check if gettext() is working and if it needs -lintl
2728AC_MSG_CHECKING(--disable-nls argument)
2729AC_ARG_ENABLE(nls,
2730 [ --disable-nls Don't support NLS (gettext()).], ,
2731 [enable_nls="yes"])
2732
2733if test "$enable_nls" = "yes"; then
2734 AC_MSG_RESULT(no)
Bram Moolenaar2389c3c2005-05-22 22:07:59 +00002735
2736 INSTALL_LANGS=install-languages
2737 AC_SUBST(INSTALL_LANGS)
2738 INSTALL_TOOL_LANGS=install-tool-languages
2739 AC_SUBST(INSTALL_TOOL_LANGS)
2740
Bram Moolenaar071d4272004-06-13 20:20:40 +00002741 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
2742 AC_MSG_CHECKING([for NLS])
2743 if test -f po/Makefile; then
2744 have_gettext="no"
2745 if test -n "$MSGFMT"; then
2746 AC_TRY_LINK(
2747 [#include <libintl.h>],
2748 [gettext("Test");],
2749 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
2750 olibs=$LIBS
2751 LIBS="$LIBS -lintl"
2752 AC_TRY_LINK(
2753 [#include <libintl.h>],
2754 [gettext("Test");],
2755 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
2756 AC_MSG_RESULT([gettext() doesn't work]);
2757 LIBS=$olibs))
2758 else
2759 AC_MSG_RESULT([msgfmt not found - disabled]);
2760 fi
2761 if test $have_gettext = "yes"; then
2762 AC_DEFINE(HAVE_GETTEXT)
2763 MAKEMO=yes
2764 AC_SUBST(MAKEMO)
2765 dnl this was added in GNU gettext 0.10.36
2766 AC_CHECK_FUNCS(bind_textdomain_codeset)
2767 dnl _nl_msg_cat_cntr is required for GNU gettext
2768 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
2769 AC_TRY_LINK(
2770 [#include <libintl.h>
2771 extern int _nl_msg_cat_cntr;],
2772 [++_nl_msg_cat_cntr;],
2773 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
2774 AC_MSG_RESULT([no]))
2775 fi
2776 else
2777 AC_MSG_RESULT([no "po/Makefile" - disabled]);
2778 fi
2779else
2780 AC_MSG_RESULT(yes)
2781fi
2782
2783dnl Check for dynamic linking loader
2784AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
2785if test x${DLL} = xdlfcn.h; then
2786 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
2787 AC_MSG_CHECKING([for dlopen()])
2788 AC_TRY_LINK(,[
2789 extern void* dlopen();
2790 dlopen();
2791 ],
2792 AC_MSG_RESULT(yes);
2793 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
2794 AC_MSG_RESULT(no);
2795 AC_MSG_CHECKING([for dlopen() in -ldl])
2796 olibs=$LIBS
2797 LIBS="$LIBS -ldl"
2798 AC_TRY_LINK(,[
2799 extern void* dlopen();
2800 dlopen();
2801 ],
2802 AC_MSG_RESULT(yes);
2803 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
2804 AC_MSG_RESULT(no);
2805 LIBS=$olibs))
2806 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
2807 dnl ick :-)
2808 AC_MSG_CHECKING([for dlsym()])
2809 AC_TRY_LINK(,[
2810 extern void* dlsym();
2811 dlsym();
2812 ],
2813 AC_MSG_RESULT(yes);
2814 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
2815 AC_MSG_RESULT(no);
2816 AC_MSG_CHECKING([for dlsym() in -ldl])
2817 olibs=$LIBS
2818 LIBS="$LIBS -ldl"
2819 AC_TRY_LINK(,[
2820 extern void* dlsym();
2821 dlsym();
2822 ],
2823 AC_MSG_RESULT(yes);
2824 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
2825 AC_MSG_RESULT(no);
2826 LIBS=$olibs))
2827elif test x${DLL} = xdl.h; then
2828 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
2829 AC_MSG_CHECKING([for shl_load()])
2830 AC_TRY_LINK(,[
2831 extern void* shl_load();
2832 shl_load();
2833 ],
2834 AC_MSG_RESULT(yes);
2835 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
2836 AC_MSG_RESULT(no);
2837 AC_MSG_CHECKING([for shl_load() in -ldld])
2838 olibs=$LIBS
2839 LIBS="$LIBS -ldld"
2840 AC_TRY_LINK(,[
2841 extern void* shl_load();
2842 shl_load();
2843 ],
2844 AC_MSG_RESULT(yes);
2845 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
2846 AC_MSG_RESULT(no);
2847 LIBS=$olibs))
2848fi
2849AC_CHECK_HEADERS(setjmp.h)
2850
2851if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
2852 dnl -ldl must come after DynaLoader.a
2853 if echo $LIBS | grep -e '-ldl' >/dev/null; then
2854 LIBS=`echo $LIBS | sed s/-ldl//`
2855 PERL_LIBS="$PERL_LIBS -ldl"
2856 fi
2857fi
2858
2859if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
2860 && test "x$GUITYPE" != "xCARBONGUI"; then
2861 AC_MSG_CHECKING(whether we need -framework Carbon)
2862 dnl check for MACOSX without Carbon GUI, but with FEAT_MBYTE
Bram Moolenaarb90daee2006-10-17 09:49:09 +00002863 if test "x$enable_multibyte" = "xyes" || test "x$features" = "xbig" \
Bram Moolenaar071d4272004-06-13 20:20:40 +00002864 || test "x$features" = "xhuge"; then
2865 LIBS="$LIBS -framework Carbon"
2866 AC_MSG_RESULT(yes)
2867 else
2868 AC_MSG_RESULT(no)
2869 fi
2870fi
Bram Moolenaare224ffa2006-03-01 00:01:28 +00002871if test "x$MACARCH" = "xboth"; then
2872 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
2873fi
Bram Moolenaar071d4272004-06-13 20:20:40 +00002874
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00002875dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
2876dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
2877dnl But only when making dependencies, cproto and lint don't take "-isystem".
Bram Moolenaar32466aa2006-02-24 23:53:04 +00002878dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
2879dnl the number before the version number.
Bram Moolenaara5792f52005-11-23 21:25:05 +00002880AC_MSG_CHECKING(for GCC 3 or later)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00002881DEPEND_CFLAGS_FILTER=
2882if test "$GCC" = yes; then
Bram Moolenaar2217cae2006-03-25 21:55:52 +00002883 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
Bram Moolenaarf740b292006-02-16 22:11:02 +00002884 if test "$gccmajor" -gt "2"; then
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00002885 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
2886 fi
2887fi
Bram Moolenaara5792f52005-11-23 21:25:05 +00002888if test "$DEPEND_CFLAGS_FILTER" = ""; then
2889 AC_MSG_RESULT(no)
2890else
2891 AC_MSG_RESULT(yes)
2892fi
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +00002893AC_SUBST(DEPEND_CFLAGS_FILTER)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002894
2895dnl write output files
2896AC_OUTPUT(auto/config.mk:config.mk.in)
2897
2898dnl vim: set sw=2 tw=78 fo+=l: