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