1 dnl configure.in: autoconf script for Vim
3 dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
4 dnl Should also work with autoconf 2.54 and later.
7 AC_CONFIG_HEADER(auto/config.h:config.h.in)
9 dnl Being able to run configure means the system is Unix (compatible).
13 dnl Checks for programs.
14 AC_PROG_CC dnl required by almost everything
15 AC_PROG_CPP dnl required by header file checks
16 AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
17 AC_ISC_POSIX dnl required by AC_C_CROSS
18 AC_PROG_AWK dnl required for "make html" in ../doc
20 dnl Don't strip if we don't have it
21 AC_CHECK_PROG(STRIP, strip, strip, :)
23 dnl Check for extension of executables
26 dnl Check for standard headers. We don't use this in Vim but other stuff
27 dnl in autoconf needs it, where it uses STDC_HEADERS.
31 dnl Set default value for CFLAGS if none is defined or it's empty
32 if test -z "$CFLAGS"; then
34 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
36 if test "$GCC" = yes; then
37 dnl method that should work for nearly all versions
38 gccversion=`"$CC" -dumpversion`
39 if test "x$gccversion" = "x"; then
40 dnl old method; fall-back for when -dumpversion doesn't work
41 gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
43 dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
44 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
45 echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
46 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
48 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
49 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
50 CFLAGS="$CFLAGS -fno-strength-reduce"
55 dnl If configure thinks we are cross compiling, there might be something
56 dnl wrong with the CC or CFLAGS settings, give a useful warning message
57 if test "$cross_compiling" = yes; then
58 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
61 dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
62 dnl But gcc 3.1 changed the meaning! See near the end.
63 test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
65 if test -f ./toolcheck; then
66 AC_CHECKING(for buggy tools)
67 sh ./toolcheck 1>&AC_FD_MSG
70 OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
72 dnl Check for BeOS, which needs an extra source file
73 AC_MSG_CHECKING(for BeOS)
75 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
76 BEOS=yes; AC_MSG_RESULT(yes);;
77 *) BEOS=no; AC_MSG_RESULT(no);;
80 dnl If QNX is found, assume we don't want to use Xphoton
81 dnl unless it was specifically asked for (--with-x)
82 AC_MSG_CHECKING(for QNX)
84 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
85 test -z "$with_x" && with_x=no
86 QNX=yes; AC_MSG_RESULT(yes);;
87 *) QNX=no; AC_MSG_RESULT(no);;
90 dnl Check for Darwin and MacOS X
91 dnl We do a check for MacOS X in the very beginning because there
92 dnl are a lot of other things we need to change besides GUI stuff
93 AC_MSG_CHECKING([for Darwin (Mac OS X)])
94 if test "`(uname) 2>/dev/null`" = Darwin; then
97 AC_MSG_CHECKING(--disable-darwin argument)
99 [ --disable-darwin Disable Darwin (Mac OS X) support.],
100 , [enable_darwin="yes"])
101 if test "$enable_darwin" = "yes"; then
103 AC_MSG_CHECKING(if Darwin files are there)
104 if test -f os_macosx.c; then
107 AC_MSG_RESULT([no, Darwin support disabled])
111 AC_MSG_RESULT([yes, Darwin support excluded])
114 AC_MSG_CHECKING(--with-mac-arch argument)
115 AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
116 MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
117 MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
119 if test "x$MACARCH" = "xboth"; then
120 AC_MSG_CHECKING(for 10.4 universal SDK)
121 dnl There is a terrible inconsistency (but we appear to get away with it):
122 dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
123 dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
124 dnl tests using the preprocessor are actually done with the wrong header
125 dnl files. $LDFLAGS is set at the end, because configure uses it together
126 dnl with $CFLAGS and we can only have one -sysroot argument.
127 save_cppflags="$CPPFLAGS"
128 save_cflags="$CFLAGS"
129 save_ldflags="$LDFLAGS"
130 CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
131 AC_TRY_LINK([ ], [ ],
132 AC_MSG_RESULT(found, will make universal binary),
134 AC_MSG_RESULT(not found)
135 CFLAGS="$save_cflags"
136 AC_MSG_CHECKING(if Intel architecture is supported)
137 CPPFLAGS="$CPPFLAGS -arch i386"
138 LDFLAGS="$save_ldflags -arch i386"
139 AC_TRY_LINK([ ], [ ],
140 AC_MSG_RESULT(yes); MACARCH="intel",
141 AC_MSG_RESULT(no, using PowerPC)
143 CPPFLAGS="$save_cppflags -arch ppc"
144 LDFLAGS="$save_ldflags -arch ppc"))
145 elif test "x$MACARCH" = "xintel"; then
146 CPPFLAGS="$CPPFLAGS -arch intel"
147 LDFLAGS="$LDFLAGS -arch intel"
148 elif test "x$MACARCH" = "xppc"; then
149 CPPFLAGS="$CPPFLAGS -arch ppc"
150 LDFLAGS="$LDFLAGS -arch ppc"
153 if test "$enable_darwin" = "yes"; then
155 OS_EXTRA_SRC="os_macosx.c os_mac_conv.c";
156 OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
157 dnl TODO: use -arch i386 on Intel machines
158 CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
159 if test "x$MACARCH" = "xboth"; then
160 CPPFLAGS="$CPPFLAGS -I/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
162 CPPFLAGS="$CPPFLAGS -I/Developer/Headers/FlatCarbon"
165 dnl If Carbon or Cocoa is found, assume we don't want
166 dnl X11 unless it was specifically asked for (--with-x)
167 dnl or Motif, Athena or GTK GUI is used.
168 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
170 SAVE_CPPFLAGS=$CPPFLAGS
172 CPPFLAGS="$CPPFLAGS -ObjC"
173 CFLAGS="$CFLAGS -ObjC"
174 AC_CHECK_HEADER(Cocoa/Cocoa.h, COCOA=yes)
175 CPPFLAGS=$SAVE_CPPFLAGS
178 if test "x$CARBON" = "xyes" -o "x$COCOA" = "xyes"; then
179 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
185 dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
186 dnl free. This happens in expand_filename(), because the optimizer swaps
187 dnl two blocks of code, both using "repl", that can't be swapped.
188 if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
189 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
196 AC_SUBST(OS_EXTRA_SRC)
197 AC_SUBST(OS_EXTRA_OBJ)
199 dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
200 dnl Only when the directory exists and it wasn't there yet.
201 dnl For gcc don't do this when it is already in the default search path.
202 dnl Skip all of this when cross-compiling.
203 if test "$cross_compiling" = no; then
204 AC_MSG_CHECKING(--with-local-dir argument)
205 have_local_include=''
207 AC_ARG_WITH([local-dir], [ --with-local-dir=PATH search PATH instead of /usr/local for local libraries.
208 --without-local-dir do not search /usr/local for local libraries.], [
213 # avoid adding local dir to LDFLAGS and CPPFLAGS
217 *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
219 AC_MSG_RESULT($local_dir)
222 AC_MSG_RESULT(Defaulting to $local_dir)
224 if test "$GCC" = yes -a "$local_dir" != no; then
225 echo 'void f(){}' > conftest.c
226 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
227 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
228 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
229 rm -f conftest.c conftest.o
231 if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
232 tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
233 if test "$tt" = "$LDFLAGS"; then
234 LDFLAGS="$LDFLAGS -L${local_dir}/lib"
237 if test -z "$have_local_include" -a -d "${local_dir}/include"; then
238 tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
239 if test "$tt" = "$CPPFLAGS"; then
240 CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
245 AC_MSG_CHECKING(--with-vim-name argument)
246 AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
247 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
248 VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
250 AC_MSG_CHECKING(--with-ex-name argument)
251 AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
252 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
253 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
255 AC_MSG_CHECKING(--with-view-name argument)
256 AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
257 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
258 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
261 AC_MSG_CHECKING(--with-global-runtime argument)
262 AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
263 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
266 AC_MSG_CHECKING(--with-modified-by argument)
267 AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
268 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
271 dnl Check for EBCDIC stolen from the LYNX port to OS390 Unix
272 AC_MSG_CHECKING(if character set is EBCDIC)
274 [ /* TryCompile function for CharSet.
275 Treat any failure as ASCII for compatibility with existing art.
276 Use compile-time rather than run-time tests for cross-compiler
279 make an error "Character set is not EBCDIC"
281 [ # TryCompile action if true
283 [ # TryCompile action if false
285 # end of TryCompile ])
286 # end of CacheVal CvEbcdic
287 AC_MSG_RESULT($cf_cv_ebcdic)
288 case "$cf_cv_ebcdic" in #(vi
289 yes) AC_DEFINE(EBCDIC)
292 *) line_break='"\\012"';;
296 if test "$cf_cv_ebcdic" = "yes"; then
297 dnl If we have EBCDIC we most likley have OS390 Unix, let's test it!
298 AC_MSG_CHECKING(for OS/390 Unix)
300 OS/390) OS390Unix="yes";
301 dnl If using cc the environment variable _CC_CCMODE must be
302 dnl set to "1", so that some compiler extensions are enabled.
303 dnl If using c89 the environment variable is named _CC_C89MODE.
304 dnl Note: compile with c89 never tested.
305 if test "$CC" = "cc"; then
309 if test "$CC" = "c89"; then
316 if test "$ccm" != "1"; then
318 echo "------------------------------------------"
319 echo " On OS/390 Unix, the environment variable"
320 echo " __CC_${ccn}MODE must be set to \"1\"!"
322 echo " export _CC_${ccn}MODE=1"
323 echo " and then call configure again."
324 echo "------------------------------------------"
327 CFLAGS="$CFLAGS -D_ALL_SOURCE"; LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
336 dnl Link with -lselinux for SELinux stuff; if not found
337 AC_MSG_CHECKING(--disable-selinux argument)
338 AC_ARG_ENABLE(selinux,
339 [ --disable-selinux Don't check for SELinux support.],
340 , enable_selinux="yes")
341 if test "$enable_selinux" = "yes"; then
343 AC_CHECK_LIB(selinux, is_selinux_enabled,
344 [LIBS="$LIBS -lselinux"
345 AC_DEFINE(HAVE_SELINUX)])
350 dnl Check user requested features.
352 AC_MSG_CHECKING(--with-features argument)
353 AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
354 features="$withval"; AC_MSG_RESULT($features),
355 features="normal"; AC_MSG_RESULT(Defaulting to normal))
360 tiny) AC_DEFINE(FEAT_TINY) ;;
361 small) AC_DEFINE(FEAT_SMALL) ;;
362 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
363 dogvimdiff="installgvimdiff" ;;
364 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
365 dogvimdiff="installgvimdiff" ;;
366 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
367 dogvimdiff="installgvimdiff" ;;
368 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
374 AC_MSG_CHECKING(--with-compiledby argument)
375 AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
376 compiledby="$withval"; AC_MSG_RESULT($withval),
377 compiledby=""; AC_MSG_RESULT(no))
380 AC_MSG_CHECKING(--disable-xsmp argument)
382 [ --disable-xsmp Disable XSMP session management],
385 if test "$enable_xsmp" = "yes"; then
387 AC_MSG_CHECKING(--disable-xsmp-interact argument)
388 AC_ARG_ENABLE(xsmp-interact,
389 [ --disable-xsmp-interact Disable XSMP interaction],
390 , enable_xsmp_interact="yes")
391 if test "$enable_xsmp_interact" = "yes"; then
393 AC_DEFINE(USE_XSMP_INTERACT)
401 dnl Check for MzScheme feature.
402 AC_MSG_CHECKING(--enable-mzschemeinterp argument)
403 AC_ARG_ENABLE(mzschemeinterp,
404 [ --enable-mzschemeinterp Include MzScheme interpreter.], ,
405 [enable_mzschemeinterp="no"])
406 AC_MSG_RESULT($enable_mzschemeinterp)
408 if test "$enable_mzschemeinterp" = "yes"; then
409 dnl -- find the mzscheme executable
410 AC_SUBST(vi_cv_path_mzscheme)
412 AC_MSG_CHECKING(--with-plthome argument)
414 [ --with-plthome=PLTHOME Use PLTHOME.],
415 with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
416 with_plthome="";AC_MSG_RESULT("no"))
418 if test "X$with_plthome" != "X"; then
419 vi_cv_path_mzscheme_pfx="$with_plthome"
421 AC_MSG_CHECKING(PLTHOME environment var)
422 if test "X$PLTHOME" != "X"; then
423 AC_MSG_RESULT("$PLTHOME")
424 vi_cv_path_mzscheme_pfx="$PLTHOME"
426 AC_MSG_RESULT("not set")
427 dnl -- try to find MzScheme executable
428 AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
430 dnl resolve symbolic link, the executable is often elsewhere and there
431 dnl are no links for the include files.
432 if test "X$vi_cv_path_mzscheme" != "X"; then
433 lsout=`ls -l $vi_cv_path_mzscheme`
434 if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
435 vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
439 if test "X$vi_cv_path_mzscheme" != "X"; then
440 dnl -- find where MzScheme thinks it was installed
441 AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
442 [ vi_cv_path_mzscheme_pfx=`
443 ${vi_cv_path_mzscheme} -evm \
444 "(display (simplify-path \
445 (build-path (call-with-values \
446 (lambda () (split-path (find-system-path (quote exec-file)))) \
447 (lambda (base name must-be-dir?) base)) (quote up))))"` ])
448 dnl Remove a trailing slash.
449 vi_cv_path_mzscheme_pfx=`echo "$vi_cv_path_mzscheme_pfx" | sed 's+/$++'`
455 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
456 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
457 if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
461 AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/plt/include)
462 if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
467 vi_cv_path_mzscheme_pfx=
472 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
473 if test "x$MACOSX" = "xyes"; then
474 MZSCHEME_LIBS="-framework PLT_MzScheme"
475 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
476 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
478 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
479 if test "$GCC" = yes; then
480 dnl Make Vim remember the path to the library. For when it's not in
481 dnl $LD_LIBRARY_PATH.
482 MZSCHEME_LIBS="$MZSCHEME_LIBS -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
483 elif test "`(uname) 2>/dev/null`" = SunOS &&
484 uname -r | grep '^5' >/dev/null; then
485 MZSCHEME_LIBS="$MZSCHEME_LIBS -R ${vi_cv_path_mzscheme_pfx}/lib"
488 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
489 SCHEME_COLLECTS=lib/plt/
491 MZSCHEME_CFLAGS="-I${vi_cv_path_mzscheme_pfx}/include${SCHEME_INC} \
492 -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
493 MZSCHEME_SRC="if_mzsch.c"
494 MZSCHEME_OBJ="objects/if_mzsch.o"
495 MZSCHEME_PRO="if_mzsch.pro"
496 AC_DEFINE(FEAT_MZSCHEME)
498 AC_SUBST(MZSCHEME_SRC)
499 AC_SUBST(MZSCHEME_OBJ)
500 AC_SUBST(MZSCHEME_PRO)
501 AC_SUBST(MZSCHEME_LIBS)
502 AC_SUBST(MZSCHEME_CFLAGS)
506 AC_MSG_CHECKING(--enable-perlinterp argument)
507 AC_ARG_ENABLE(perlinterp,
508 [ --enable-perlinterp Include Perl interpreter.], ,
509 [enable_perlinterp="no"])
510 AC_MSG_RESULT($enable_perlinterp)
511 if test "$enable_perlinterp" = "yes"; then
512 AC_SUBST(vi_cv_path_perl)
513 AC_PATH_PROG(vi_cv_path_perl, perl)
514 if test "X$vi_cv_path_perl" != "X"; then
515 AC_MSG_CHECKING(Perl version)
516 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
517 eval `$vi_cv_path_perl -V:usethreads`
518 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
521 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
522 eval `$vi_cv_path_perl -V:use5005threads`
523 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
527 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
531 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
534 if test $badthreads = no; then
536 eval `$vi_cv_path_perl -V:shrpenv`
537 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
540 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
541 AC_SUBST(vi_cv_perllib)
542 dnl Remove "-fno-something", it breaks using cproto.
543 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
544 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
545 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
546 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
547 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
548 -e 's/-bE:perl.exp//' -e 's/-lc //'`
549 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
550 dnl a test in configure may fail because of that.
551 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
552 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
554 dnl check that compiling a simple program still works with the flags
556 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
559 ldflags_save=$LDFLAGS
560 CFLAGS="$CFLAGS $perlcppflags"
561 LIBS="$LIBS $perllibs"
562 LDFLAGS="$perlldflags $LDFLAGS"
564 AC_MSG_RESULT(yes); perl_ok=yes,
565 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
568 LDFLAGS=$ldflags_save
569 if test $perl_ok = yes; then
570 if test "X$perlcppflags" != "X"; then
571 dnl remove -pipe and -Wxxx, it confuses cproto
572 PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
574 if test "X$perlldflags" != "X"; then
575 LDFLAGS="$perlldflags $LDFLAGS"
578 PERL_SRC="auto/if_perl.c if_perlsfio.c"
579 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
580 PERL_PRO="if_perl.pro if_perlsfio.pro"
585 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
589 if test "x$MACOSX" = "xyes"; then
590 dnl Mac OS X 10.2 or later
591 dir=/System/Library/Perl
592 darwindir=$dir/darwin
593 if test -d $darwindir; then
597 dir=/System/Library/Perl/5.8.1
598 darwindir=$dir/darwin-thread-multi-2level
599 if test -d $darwindir; then
603 if test -n "$PERL"; then
605 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
606 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
607 PERL_LIBS="-L$darwindir/CORE -lperl"
615 AC_SUBST(PERL_CFLAGS)
618 AC_MSG_CHECKING(--enable-pythoninterp argument)
619 AC_ARG_ENABLE(pythoninterp,
620 [ --enable-pythoninterp Include Python interpreter.], ,
621 [enable_pythoninterp="no"])
622 AC_MSG_RESULT($enable_pythoninterp)
623 if test "$enable_pythoninterp" = "yes"; then
624 dnl -- find the python executable
625 AC_PATH_PROG(vi_cv_path_python, python)
626 if test "X$vi_cv_path_python" != "X"; then
628 dnl -- get its version number
629 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
630 [[vi_cv_var_python_version=`
631 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
634 dnl -- it must be at least version 1.4
635 AC_MSG_CHECKING(Python is 1.4 or better)
636 if ${vi_cv_path_python} -c \
637 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
641 dnl -- find where python thinks it was installed
642 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
643 [ vi_cv_path_python_pfx=`
644 ${vi_cv_path_python} -c \
645 "import sys; print sys.prefix"` ])
647 dnl -- and where it thinks it runs
648 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
649 [ vi_cv_path_python_epfx=`
650 ${vi_cv_path_python} -c \
651 "import sys; print sys.exec_prefix"` ])
653 dnl -- python's internal library path
655 AC_CACHE_VAL(vi_cv_path_pythonpath,
656 [ vi_cv_path_pythonpath=`
658 ${vi_cv_path_python} -c \
659 "import sys, string; print string.join(sys.path,':')"` ])
661 dnl -- where the Python implementation library archives are
663 AC_ARG_WITH(python-config-dir,
664 [ --with-python-config-dir=PATH Python's config directory],
665 [ vi_cv_path_python_conf="${withval}" ] )
667 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
669 vi_cv_path_python_conf=
670 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
671 for subdir in lib share; do
672 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
673 if test -d "$d" && test -f "$d/config.c"; then
674 vi_cv_path_python_conf="$d"
680 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
682 if test "X$PYTHON_CONFDIR" = "X"; then
683 AC_MSG_RESULT([can't find it!])
686 dnl -- we need to examine Python's config/Makefile too
687 dnl see what the interpreter is built from
688 AC_CACHE_VAL(vi_cv_path_python_plibs,
691 tmp_mkf="$pwd/config-PyMake$$"
692 cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
694 @echo "python_MODLIBS='$(MODLIBS)'"
695 @echo "python_LIBS='$(LIBS)'"
696 @echo "python_SYSLIBS='$(SYSLIBS)'"
697 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
699 dnl -- delete the lines from make about Entering/Leaving directory
700 eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
701 rm -f -- "${tmp_mkf}"
702 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
703 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
704 vi_cv_path_python_plibs="-framework Python"
706 if test "${vi_cv_var_python_version}" = "1.4"; then
707 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
709 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
711 vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_MODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
712 dnl remove -ltermcap, it can conflict with an earlier -lncurses
713 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
717 PYTHON_LIBS="${vi_cv_path_python_plibs}"
718 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
719 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
721 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}"
723 PYTHON_SRC="if_python.c"
724 dnl For Mac OSX 10.2 config.o is included in the Python library.
725 if test "x$MACOSX" = "xyes"; then
726 PYTHON_OBJ="objects/if_python.o"
728 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
730 if test "${vi_cv_var_python_version}" = "1.4"; then
731 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
733 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
735 dnl On FreeBSD linking with "-pthread" is required to use threads.
736 dnl _THREAD_SAFE must be used for compiling then.
737 dnl The "-pthread" is added to $LIBS, so that the following check for
738 dnl sigaltstack() will look in libc_r (it's there in libc!).
739 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
740 dnl will then define target-specific defines, e.g., -D_REENTRANT.
741 dnl Don't do this for Mac OSX, -pthread will generate a warning.
742 AC_MSG_CHECKING([if -pthread should be used])
745 dnl if test "x$MACOSX" != "xyes"; then
746 if test "`(uname) 2>/dev/null`" != Darwin; then
747 test "$GCC" = yes && threadsafe_flag="-pthread"
748 if test "`(uname) 2>/dev/null`" = FreeBSD; then
749 threadsafe_flag="-D_THREAD_SAFE"
750 thread_lib="-pthread"
754 if test -n "$threadsafe_flag"; then
756 CFLAGS="$CFLAGS $threadsafe_flag"
757 LIBS="$LIBS $thread_lib"
759 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
760 AC_MSG_RESULT(no); LIBS=$libs_save_old
767 dnl check that compiling a simple program still works with the flags
768 dnl added for Python.
769 AC_MSG_CHECKING([if compile and link flags for Python are sane])
772 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
773 LIBS="$LIBS $PYTHON_LIBS"
775 AC_MSG_RESULT(yes); python_ok=yes,
776 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
779 if test $python_ok = yes; then
780 AC_DEFINE(FEAT_PYTHON)
791 AC_MSG_RESULT(too old)
795 AC_SUBST(PYTHON_CONFDIR)
796 AC_SUBST(PYTHON_LIBS)
797 AC_SUBST(PYTHON_GETPATH_CFLAGS)
798 AC_SUBST(PYTHON_CFLAGS)
802 AC_MSG_CHECKING(--enable-tclinterp argument)
803 AC_ARG_ENABLE(tclinterp,
804 [ --enable-tclinterp Include Tcl interpreter.], ,
805 [enable_tclinterp="no"])
806 AC_MSG_RESULT($enable_tclinterp)
808 if test "$enable_tclinterp" = "yes"; then
810 dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
811 AC_MSG_CHECKING(--with-tclsh argument)
812 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
813 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
814 tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
815 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
816 AC_SUBST(vi_cv_path_tcl)
818 dnl when no specific version specified, also try 8.4, 8.2 and 8.0
819 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
820 tclsh_name="tclsh8.4"
821 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
823 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
824 tclsh_name="tclsh8.2"
825 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
827 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
828 tclsh_name="tclsh8.0"
829 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
831 dnl still didn't find it, try without version number
832 if test "X$vi_cv_path_tcl" = "X"; then
834 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
836 if test "X$vi_cv_path_tcl" != "X"; then
837 AC_MSG_CHECKING(Tcl version)
838 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
839 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
840 AC_MSG_RESULT($tclver - OK);
841 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 -`
843 AC_MSG_CHECKING(for location of Tcl include)
844 if test "x$MACOSX" != "xyes"; then
845 tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver"
847 dnl For Mac OS X 10.3, use the OS-provided framework location
848 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
851 for try in $tclinc; do
852 if test -f "$try/tcl.h"; then
853 AC_MSG_RESULT($try/tcl.h)
858 if test -z "$TCL_INC"; then
859 AC_MSG_RESULT(<not found>)
862 if test -z "$SKIP_TCL"; then
863 AC_MSG_CHECKING(for location of tclConfig.sh script)
864 if test "x$MACOSX" != "xyes"; then
865 tclcnf=`echo $tclinc | sed s/include/lib/g`
866 tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
868 dnl For Mac OS X 10.3, use the OS-provided framework location
869 tclcnf="/System/Library/Frameworks/Tcl.framework"
871 for try in $tclcnf; do
872 if test -f $try/tclConfig.sh; then
873 AC_MSG_RESULT($try/tclConfig.sh)
875 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
876 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
877 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
878 dnl "-D_ABC" items. Watch out for -DFOO=long\ long.
879 TCL_DEFS=`echo $TCL_DEFS | sed -e 's/\\\\ /\\\\X/g' | tr ' ' '\012' | sed -e '/^[[^-]]/d' -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr '\012' ' ' | sed -e 's/\\\\X/\\\\ /g'`
883 if test -z "$TCL_LIBS"; then
884 AC_MSG_RESULT(<not found>)
885 AC_MSG_CHECKING(for Tcl library by myself)
886 tcllib=`echo $tclinc | sed s/include/lib/g`
887 tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
888 for ext in .so .a ; do
889 for ver in "" $tclver ; do
890 for try in $tcllib ; do
892 if test -f $try/lib$trylib ; then
893 AC_MSG_RESULT($try/lib$trylib)
894 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
895 if test "`(uname) 2>/dev/null`" = SunOS &&
896 uname -r | grep '^5' >/dev/null; then
897 TCL_LIBS="$TCL_LIBS -R $try"
904 if test -z "$TCL_LIBS"; then
905 AC_MSG_RESULT(<not found>)
909 if test -z "$SKIP_TCL"; then
912 TCL_OBJ=objects/if_tcl.o
914 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
918 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
928 AC_MSG_CHECKING(--enable-rubyinterp argument)
929 AC_ARG_ENABLE(rubyinterp,
930 [ --enable-rubyinterp Include Ruby interpreter.], ,
931 [enable_rubyinterp="no"])
932 AC_MSG_RESULT($enable_rubyinterp)
933 if test "$enable_rubyinterp" = "yes"; then
934 AC_SUBST(vi_cv_path_ruby)
935 AC_PATH_PROG(vi_cv_path_ruby, ruby)
936 if test "X$vi_cv_path_ruby" != "X"; then
937 AC_MSG_CHECKING(Ruby version)
938 if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
940 AC_MSG_CHECKING(Ruby header files)
941 rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
942 if test "X$rubyhdrdir" != "X"; then
943 AC_MSG_RESULT($rubyhdrdir)
944 RUBY_CFLAGS="-I$rubyhdrdir"
945 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
946 if test "X$rubylibs" != "X"; then
947 RUBY_LIBS="$rubylibs"
949 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
950 if test -f "$rubyhdrdir/$librubyarg"; then
951 librubyarg="$rubyhdrdir/$librubyarg"
953 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
954 if test -f "$rubylibdir/$librubyarg"; then
955 librubyarg="$rubylibdir/$librubyarg"
956 elif test "$librubyarg" = "libruby.a"; then
957 dnl required on Mac OS 10.3 where libruby.a doesn't exist
960 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
964 if test "X$librubyarg" != "X"; then
965 RUBY_LIBS="$librubyarg $RUBY_LIBS"
967 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
968 if test "X$rubyldflags" != "X"; then
969 LDFLAGS="$rubyldflags $LDFLAGS"
972 RUBY_OBJ="objects/if_ruby.o"
973 RUBY_PRO="if_ruby.pro"
976 AC_MSG_RESULT(not found, disabling Ruby)
979 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
986 AC_SUBST(RUBY_CFLAGS)
989 AC_MSG_CHECKING(--enable-cscope argument)
990 AC_ARG_ENABLE(cscope,
991 [ --enable-cscope Include cscope interface.], ,
992 [enable_cscope="no"])
993 AC_MSG_RESULT($enable_cscope)
994 if test "$enable_cscope" = "yes"; then
995 AC_DEFINE(FEAT_CSCOPE)
998 AC_MSG_CHECKING(--enable-workshop argument)
999 AC_ARG_ENABLE(workshop,
1000 [ --enable-workshop Include Sun Visual Workshop support.], ,
1001 [enable_workshop="no"])
1002 AC_MSG_RESULT($enable_workshop)
1003 if test "$enable_workshop" = "yes"; then
1004 AC_DEFINE(FEAT_SUN_WORKSHOP)
1005 WORKSHOP_SRC="workshop.c integration.c"
1006 AC_SUBST(WORKSHOP_SRC)
1007 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1008 AC_SUBST(WORKSHOP_OBJ)
1009 if test "${enable_gui-xxx}" = xxx; then
1014 AC_MSG_CHECKING(--disable-netbeans argument)
1015 AC_ARG_ENABLE(netbeans,
1016 [ --disable-netbeans Disable NetBeans integration support.],
1017 , [enable_netbeans="yes"])
1018 if test "$enable_netbeans" = "yes"; then
1020 dnl On Solaris we need the socket and nsl library.
1021 AC_CHECK_LIB(socket, socket)
1022 AC_CHECK_LIB(nsl, gethostbyname)
1023 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
1030 #include <netinet/in.h>
1032 #include <sys/types.h>
1033 #include <sys/socket.h>
1034 /* Check bitfields */
1036 unsigned int initDone:1;
1040 /* Check creating a socket. */
1041 struct sockaddr_in server;
1042 (void)socket(AF_INET, SOCK_STREAM, 0);
1044 (void)gethostbyname("microsoft.com");
1045 if (errno == ECONNREFUSED)
1046 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
1049 AC_MSG_RESULT(no); enable_netbeans="no")
1053 if test "$enable_netbeans" = "yes"; then
1054 AC_DEFINE(FEAT_NETBEANS_INTG)
1055 NETBEANS_SRC="netbeans.c"
1056 AC_SUBST(NETBEANS_SRC)
1057 NETBEANS_OBJ="objects/netbeans.o"
1058 AC_SUBST(NETBEANS_OBJ)
1061 AC_MSG_CHECKING(--enable-sniff argument)
1062 AC_ARG_ENABLE(sniff,
1063 [ --enable-sniff Include Sniff interface.], ,
1064 [enable_sniff="no"])
1065 AC_MSG_RESULT($enable_sniff)
1066 if test "$enable_sniff" = "yes"; then
1067 AC_DEFINE(FEAT_SNIFF)
1068 SNIFF_SRC="if_sniff.c"
1070 SNIFF_OBJ="objects/if_sniff.o"
1074 AC_MSG_CHECKING(--enable-multibyte argument)
1075 AC_ARG_ENABLE(multibyte,
1076 [ --enable-multibyte Include multibyte editing support.], ,
1077 [enable_multibyte="no"])
1078 AC_MSG_RESULT($enable_multibyte)
1079 if test "$enable_multibyte" = "yes"; then
1080 AC_DEFINE(FEAT_MBYTE)
1083 AC_MSG_CHECKING(--enable-hangulinput argument)
1084 AC_ARG_ENABLE(hangulinput,
1085 [ --enable-hangulinput Include Hangul input support.], ,
1086 [enable_hangulinput="no"])
1087 AC_MSG_RESULT($enable_hangulinput)
1089 AC_MSG_CHECKING(--enable-xim argument)
1091 [ --enable-xim Include XIM input support.],
1092 AC_MSG_RESULT($enable_xim),
1093 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
1094 dnl defining FEAT_XIM is delayed, so that it can be disabled for older GTK
1096 AC_MSG_CHECKING(--enable-fontset argument)
1097 AC_ARG_ENABLE(fontset,
1098 [ --enable-fontset Include X fontset output support.], ,
1099 [enable_fontset="no"])
1100 AC_MSG_RESULT($enable_fontset)
1101 dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
1103 test -z "$with_x" && with_x=yes
1104 test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
1105 if test "$with_x" = no; then
1106 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
1108 dnl Do this check early, so that its failure can override user requests.
1110 AC_PATH_PROG(xmkmfpath, xmkmf)
1114 dnl On OS390Unix the X libraries are DLLs. To use them the code must
1115 dnl be compiled with a special option.
1116 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
1117 if test "$OS390Unix" = "yes"; then
1118 CFLAGS="$CFLAGS -W c,dll"
1119 LDFLAGS="$LDFLAGS -W l,dll"
1120 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
1123 dnl On my HPUX system the X include dir is found, but the lib dir not.
1124 dnl This is a desparate try to fix this.
1126 if test -d "$x_includes" && test ! -d "$x_libraries"; then
1127 x_libraries=`echo "$x_includes" | sed s/include/lib/`
1128 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
1129 X_LIBS="$X_LIBS -L$x_libraries"
1130 if test "`(uname) 2>/dev/null`" = SunOS &&
1131 uname -r | grep '^5' >/dev/null; then
1132 X_LIBS="$X_LIBS -R $x_libraries"
1136 if test -d "$x_libraries" && test ! -d "$x_includes"; then
1137 x_includes=`echo "$x_libraries" | sed s/lib/include/`
1138 AC_MSG_RESULT(Corrected X includes to $x_includes)
1139 X_CFLAGS="$X_CFLAGS -I$x_includes"
1142 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
1143 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
1144 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
1145 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
1146 dnl Same for "-R/usr/lib ".
1147 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
1150 dnl Check if the X11 header files are correctly installed. On some systems
1151 dnl Xlib.h includes files that don't exist. On some systems X11/Intrinsic.h
1153 AC_MSG_CHECKING(if X11 header files can be found)
1155 CFLAGS="$CFLAGS $X_CFLAGS"
1156 AC_TRY_COMPILE([#include <X11/Xlib.h>
1157 #include <X11/Intrinsic.h>], ,
1159 AC_MSG_RESULT(no); no_x=yes)
1162 if test "${no_x-no}" = yes; then
1169 ac_save_LDFLAGS="$LDFLAGS"
1170 LDFLAGS="-L$x_libraries $LDFLAGS"
1172 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
1173 dnl For HP-UX 10.20 it must be before -lSM -lICE
1174 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
1175 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
1177 dnl Some systems need -lnsl -lsocket when testing for ICE.
1178 dnl The check above doesn't do this, try here (again). Also needed to get
1179 dnl them after Xdmcp. link.sh will remove them when not needed.
1180 dnl Check for other function than above to avoid the cached value
1181 AC_CHECK_LIB(ICE, IceOpenConnection,
1182 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
1184 dnl Check for -lXpm (needed for some versions of Motif)
1185 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
1186 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
1187 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
1189 dnl Check that the X11 header files don't use implicit declarations
1190 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
1192 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
1193 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1195 CFLAGS="$CFLAGS -Wno-implicit-int"
1196 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
1197 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
1198 AC_MSG_RESULT(test failed)
1203 LDFLAGS="$ac_save_LDFLAGS"
1208 test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
1210 AC_MSG_CHECKING(--enable-gui argument)
1212 [ --enable-gui[=OPTS] X11 GUI [default=auto] [OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon/macvim]], , enable_gui="auto")
1214 dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
1215 dnl Do not use character classes for portability with old tools.
1216 enable_gui_canon=`echo "_$enable_gui" | \
1217 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
1219 dnl Skip everything by default.
1231 if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
1233 case "$enable_gui_canon" in
1234 no) AC_MSG_RESULT(no GUI support)
1236 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1237 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1238 photon) AC_MSG_RESULT(Photon GUI support) ;;
1239 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1243 elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1246 case "$enable_gui_canon" in
1247 no) AC_MSG_RESULT(no GUI support)
1250 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1251 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1252 carbon) AC_MSG_RESULT(Carbon GUI support)
1254 macvim) AC_MSG_RESULT(MacVim GUI support)
1256 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1263 case "$enable_gui_canon" in
1264 no|none) AC_MSG_RESULT(no GUI support) ;;
1265 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
1274 gtk) AC_MSG_RESULT(GTK+ 1.x GUI support)
1276 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
1279 gnome) AC_MSG_RESULT(GNOME 1.x GUI support)
1282 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1286 motif) AC_MSG_RESULT(Motif GUI support)
1288 athena) AC_MSG_RESULT(Athena GUI support)
1290 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1292 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1297 if test "x$SKIP_GTK" != "xYES" -a "$enable_gui_canon" != "gtk" -a "$enable_gui_canon" != "gtk2"; then
1298 AC_MSG_CHECKING(whether or not to look for GTK)
1299 AC_ARG_ENABLE(gtk-check,
1300 [ --enable-gtk-check If auto-select GUI, check for GTK [default=yes]],
1301 , enable_gtk_check="yes")
1302 AC_MSG_RESULT($enable_gtk_check)
1303 if test "x$enable_gtk_check" = "xno"; then
1309 if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1310 -a "$enable_gui_canon" != "gnome2"; then
1311 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1312 AC_ARG_ENABLE(gtk2-check,
1313 [ --enable-gtk2-check If GTK GUI, check for GTK+ 2 [default=yes]],
1314 , enable_gtk2_check="yes")
1315 AC_MSG_RESULT($enable_gtk2_check)
1316 if test "x$enable_gtk2_check" = "xno"; then
1321 if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome" \
1322 -a "$enable_gui_canon" != "gnome2"; then
1323 AC_MSG_CHECKING(whether or not to look for GNOME)
1324 AC_ARG_ENABLE(gnome-check,
1325 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1326 , enable_gnome_check="no")
1327 AC_MSG_RESULT($enable_gnome_check)
1328 if test "x$enable_gnome_check" = "xno"; then
1333 if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1334 AC_MSG_CHECKING(whether or not to look for Motif)
1335 AC_ARG_ENABLE(motif-check,
1336 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1337 , enable_motif_check="yes")
1338 AC_MSG_RESULT($enable_motif_check)
1339 if test "x$enable_motif_check" = "xno"; then
1344 if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1345 AC_MSG_CHECKING(whether or not to look for Athena)
1346 AC_ARG_ENABLE(athena-check,
1347 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1348 , enable_athena_check="yes")
1349 AC_MSG_RESULT($enable_athena_check)
1350 if test "x$enable_athena_check" = "xno"; then
1355 if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1356 AC_MSG_CHECKING(whether or not to look for neXtaw)
1357 AC_ARG_ENABLE(nextaw-check,
1358 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1359 , enable_nextaw_check="yes")
1360 AC_MSG_RESULT($enable_nextaw_check);
1361 if test "x$enable_nextaw_check" = "xno"; then
1366 if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1367 AC_MSG_CHECKING(whether or not to look for Carbon)
1368 AC_ARG_ENABLE(carbon-check,
1369 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1370 , enable_carbon_check="yes")
1371 AC_MSG_RESULT($enable_carbon_check);
1372 if test "x$enable_carbon_check" = "xno"; then
1377 if test "x$SKIP_MACVIM" != "xYES" -a "$enable_gui_canon" != "macvim"; then
1378 AC_MSG_CHECKING(whether or not to look for MacVim)
1379 AC_ARG_ENABLE(macvim-check,
1380 [ --enable-macvim-check If auto-select GUI, check for MacVim [default=yes]],
1381 , enable_macvim_check="yes")
1382 AC_MSG_RESULT($enable_macvim_check);
1383 if test "x$enable_macvim_check" = "xno"; then
1388 if test "x$MACOSX" = "xyes"; then
1389 if test -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1390 AC_MSG_CHECKING(for Carbon GUI)
1391 dnl already did the check, just give the message
1394 elif test -z "$SKIP_MACVIM" -a "x$COCOA" = "xyes"; then
1395 AC_MSG_CHECKING(for MacVim GUI)
1396 dnl already did the check, just give the message
1401 if test "$VIMNAME" = "vim"; then
1405 dnl Default install directory is not /usr/local
1406 if test x$prefix = xNONE; then
1407 prefix=/Applications
1410 dnl Sorry for the hard coded default
1411 datadir='${prefix}/Vim.app/Contents/Resources'
1413 dnl skip everything else
1426 dnl Get the cflags and libraries from the gtk-config script
1429 dnl define an autoconf function to check for a specified version of GTK, and
1430 dnl try to compile/link a GTK program. this gets used once for GTK 1.1.16.
1432 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1433 dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
1435 AC_DEFUN(AM_PATH_GTK,
1437 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1439 min_gtk_version=ifelse([$1], ,0.99.7,$1)
1440 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1442 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1443 && $PKG_CONFIG --exists gtk+-2.0; then
1445 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1446 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1447 dnl something like that.
1448 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
1449 GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
1450 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1451 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1452 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1453 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1454 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1455 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1456 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1458 elif test "X$GTK_CONFIG" != "Xno"; then
1460 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
1462 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
1463 gtk_major_version=`$GTK_CONFIG $gtk_config_args --version | \
1464 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1465 gtk_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
1466 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1467 gtk_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
1468 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1474 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1476 ac_save_CFLAGS="$CFLAGS"
1477 ac_save_LIBS="$LIBS"
1478 CFLAGS="$CFLAGS $GTK_CFLAGS"
1479 LIBS="$LIBS $GTK_LIBS"
1482 dnl Now check if the installed GTK is sufficiently new. (Also sanity
1483 dnl checks the results of gtk-config to some extent
1487 #include <gtk/gtk.h>
1490 # include <stdlib.h>
1491 # include <stddef.h>
1497 int major, minor, micro;
1500 system ("touch conf.gtktest");
1502 /* HP/UX 9 (%@#!) writes to sscanf strings */
1503 tmp_version = g_strdup("$min_gtk_version");
1504 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
1505 printf("%s, bad version string\n", "$min_gtk_version");
1509 if ((gtk_major_version > major) ||
1510 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1511 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1512 (gtk_micro_version >= micro)))
1518 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1519 CFLAGS="$ac_save_CFLAGS"
1520 LIBS="$ac_save_LIBS"
1523 if test "x$no_gtk" = x ; then
1524 if test "x$enable_gtktest" = "xyes"; then
1525 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1527 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1529 ifelse([$2], , :, [$2])
1535 ifelse([$3], , :, [$3])
1542 ifelse([$3], , :, [$3])
1544 AC_SUBST(GTK_CFLAGS)
1549 dnl ---------------------------------------------------------------------------
1551 dnl ---------------------------------------------------------------------------
1552 AC_DEFUN([GNOME_INIT_HOOK],
1554 AC_SUBST(GNOME_LIBS)
1555 AC_SUBST(GNOME_LIBDIR)
1556 AC_SUBST(GNOME_INCLUDEDIR)
1558 AC_ARG_WITH(gnome-includes,
1559 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1560 [CFLAGS="$CFLAGS -I$withval"]
1563 AC_ARG_WITH(gnome-libs,
1564 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1565 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1569 [ --with-gnome Specify prefix for GNOME files],
1570 if test x$withval = xyes; then
1572 ifelse([$1], [], :, [$1])
1574 if test "x$withval" = xno; then
1578 LDFLAGS="$LDFLAGS -L$withval/lib"
1579 CFLAGS="$CFLAGS -I$withval/include"
1580 gnome_prefix=$withval/lib
1585 if test "x$want_gnome" = xyes -a "0$gtk_major_version" -ge 2; then
1587 AC_MSG_CHECKING(for libgnomeui-2.0)
1588 if $PKG_CONFIG --exists libgnomeui-2.0; then
1590 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1591 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1592 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
1594 dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
1595 dnl This might not be the right way but it works for me...
1596 AC_MSG_CHECKING(for FreeBSD)
1597 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1598 AC_MSG_RESULT(yes, adding -pthread)
1599 GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
1600 GNOME_LIBS="$GNOME_LIBS -pthread"
1606 AC_MSG_RESULT(not found)
1607 if test "x$2" = xfail; then
1608 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1612 elif test "x$want_gnome" = xyes; then
1614 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
1615 if test "$GNOME_CONFIG" = "no"; then
1616 no_gnome_config="yes"
1618 AC_MSG_CHECKING(if $GNOME_CONFIG works)
1619 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
1621 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome gnomeui`"
1622 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
1623 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
1627 no_gnome_config="yes"
1631 if test x$exec_prefix = xNONE; then
1632 if test x$prefix = xNONE; then
1633 gnome_prefix=$ac_default_prefix/lib
1635 gnome_prefix=$prefix/lib
1638 gnome_prefix=`eval echo \`echo $libdir\``
1641 if test "$no_gnome_config" = "yes"; then
1642 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
1643 if test -f $gnome_prefix/gnomeConf.sh; then
1644 AC_MSG_RESULT(found)
1645 echo "loading gnome configuration from" \
1646 "$gnome_prefix/gnomeConf.sh"
1647 . $gnome_prefix/gnomeConf.sh
1650 AC_MSG_RESULT(not found)
1651 if test x$2 = xfail; then
1652 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
1660 AC_DEFUN([GNOME_INIT],[
1661 GNOME_INIT_HOOK([],fail)
1665 dnl ---------------------------------------------------------------------------
1666 dnl Check for GTK. First checks for gtk-config, cause it needs that to get the
1667 dnl correct compiler flags. Then checks for GTK 1.1.16. If that fails, then
1668 dnl it checks for 1.0.6. If both fail, then continue on for Motif as before...
1669 dnl ---------------------------------------------------------------------------
1670 if test -z "$SKIP_GTK"; then
1672 AC_MSG_CHECKING(--with-gtk-prefix argument)
1673 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
1674 gtk_config_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1675 gtk_config_prefix=""; AC_MSG_RESULT(no))
1677 AC_MSG_CHECKING(--with-gtk-exec-prefix argument)
1678 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
1679 gtk_config_exec_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1680 gtk_config_exec_prefix=""; AC_MSG_RESULT(no))
1682 AC_MSG_CHECKING(--disable-gtktest argument)
1683 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1684 , enable_gtktest=yes)
1685 if test "x$enable_gtktest" = "xyes" ; then
1686 AC_MSG_RESULT(gtk test enabled)
1688 AC_MSG_RESULT(gtk test disabled)
1691 if test "x$gtk_config_prefix" != "x" ; then
1692 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
1693 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
1695 if test "x$gtk_config_exec_prefix" != "x" ; then
1696 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
1697 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
1699 if test "X$GTK_CONFIG" = "X"; then
1700 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
1701 if test "X$GTK_CONFIG" = "Xno"; then
1702 dnl Some distributions call it gtk12-config, annoying!
1703 AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no)
1704 GTK_CONFIG="$GTK12_CONFIG"
1707 AC_MSG_RESULT(Using GTK configuration program $GTK_CONFIG)
1709 if test "X$PKG_CONFIG" = "X"; then
1710 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1713 if test "x$GTK_CONFIG:$PKG_CONFIG" != "xno:no"; then
1714 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1715 dnl problems (bold fonts, --remote doesn't work).
1716 if test "X$SKIP_GTK2" != "XYES"; then
1718 [GUI_LIB_LOC="$GTK_LIBDIR"
1719 GTK_LIBNAME="$GTK_LIBS"
1720 GUI_INC_LOC="$GTK_CFLAGS"], )
1721 if test "x$GTK_CFLAGS" != "x"; then
1726 AC_SUBST(GTK_LIBNAME)
1730 dnl If there is no 2.2.0 or later try the 1.x.x series. We require at
1731 dnl least GTK 1.1.16. 1.0.6 doesn't work. 1.1.1 to 1.1.15
1732 dnl were test versions.
1733 if test "x$GUITYPE" != "xGTK"; then
1736 [GTK_LIBNAME="$GTK_LIBS"
1737 GUI_INC_LOC="$GTK_CFLAGS"], )
1738 if test "x$GTK_CFLAGS" != "x"; then
1743 AC_SUBST(GTK_LIBNAME)
1747 dnl Give a warning if GTK is older than 1.2.3
1748 if test "x$GUITYPE" = "xGTK"; then
1749 if test "$gtk_major_version" = 1 -a "0$gtk_minor_version" -lt 2 \
1750 -o "$gtk_major_version" = 1 -a "$gtk_minor_version" = 2 -a "0$gtk_micro_version" -lt 3; then
1751 AC_MSG_RESULT(this GTK version is old; version 1.2.3 or later is recommended)
1754 if test "0$gtk_major_version" -ge 2; then
1755 AC_DEFINE(HAVE_GTK2)
1756 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1757 || test "0$gtk_minor_version" -ge 2 \
1758 || test "0$gtk_major_version" -gt 2; then
1759 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1763 dnl if GTK exists, and it's not the 1.0.x series, then check for GNOME.
1765 if test -z "$SKIP_GNOME"; then
1767 GNOME_INIT_HOOK([have_gnome=yes])
1768 if test x$have_gnome = xyes ; then
1769 AC_DEFINE(FEAT_GUI_GNOME)
1770 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1771 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
1780 dnl Check for Motif include files location.
1781 dnl The LAST one found is used, this makes the highest version to be used,
1782 dnl e.g. when Motif1.2 and Motif2.0 are both present.
1784 if test -z "$SKIP_MOTIF"; then
1785 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"
1786 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1787 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1789 AC_MSG_CHECKING(for location of Motif GUI includes)
1790 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1792 for try in $gui_includes; do
1793 if test -f "$try/Xm/Xm.h"; then
1797 if test -n "$GUI_INC_LOC"; then
1798 if test "$GUI_INC_LOC" = /usr/include; then
1800 AC_MSG_RESULT(in default path)
1802 AC_MSG_RESULT($GUI_INC_LOC)
1805 AC_MSG_RESULT(<not found>)
1810 dnl Check for Motif library files location. In the same order as the include
1811 dnl files, to avoid a mixup if several versions are present
1813 if test -z "$SKIP_MOTIF"; then
1814 AC_MSG_CHECKING(--with-motif-lib argument)
1815 AC_ARG_WITH(motif-lib,
1816 [ --with-motif-lib=STRING Library for Motif ],
1817 [ MOTIF_LIBNAME="${withval}" ] )
1819 if test -n "$MOTIF_LIBNAME"; then
1820 AC_MSG_RESULT($MOTIF_LIBNAME)
1825 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1826 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1828 AC_MSG_CHECKING(for location of Motif GUI libs)
1829 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"
1831 for try in $gui_libs; do
1832 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
1833 if test -f "$libtry"; then
1838 if test -n "$GUI_LIB_LOC"; then
1839 dnl Remove /usr/lib, it causes trouble on some systems
1840 if test "$GUI_LIB_LOC" = /usr/lib; then
1842 AC_MSG_RESULT(in default path)
1844 if test -n "$GUI_LIB_LOC"; then
1845 AC_MSG_RESULT($GUI_LIB_LOC)
1846 if test "`(uname) 2>/dev/null`" = SunOS &&
1847 uname -r | grep '^5' >/dev/null; then
1848 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1854 AC_MSG_RESULT(<not found>)
1860 if test -z "$SKIP_MOTIF"; then
1864 AC_SUBST(MOTIF_LIBNAME)
1867 dnl Check if the Athena files can be found
1871 if test -z "$SKIP_ATHENA"; then
1872 AC_MSG_CHECKING(if Athena header files can be found)
1874 CFLAGS="$CFLAGS $X_CFLAGS"
1876 #include <X11/Intrinsic.h>
1877 #include <X11/Xaw/Paned.h>], ,
1879 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1883 if test -z "$SKIP_ATHENA"; then
1887 if test -z "$SKIP_NEXTAW"; then
1888 AC_MSG_CHECKING(if neXtaw header files can be found)
1890 CFLAGS="$CFLAGS $X_CFLAGS"
1892 #include <X11/Intrinsic.h>
1893 #include <X11/neXtaw/Paned.h>], ,
1895 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1899 if test -z "$SKIP_NEXTAW"; then
1903 if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1904 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1905 dnl Avoid adding it when it twice
1906 if test -n "$GUI_INC_LOC"; then
1907 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1909 if test -n "$GUI_LIB_LOC"; then
1910 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1913 dnl Check for -lXext and then for -lXmu
1914 ldflags_save=$LDFLAGS
1915 LDFLAGS="$X_LIBS $LDFLAGS"
1916 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1917 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1918 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1919 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1920 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1921 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1922 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1923 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1924 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1925 if test -z "$SKIP_MOTIF"; then
1926 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1927 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1929 LDFLAGS=$ldflags_save
1931 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1932 AC_MSG_CHECKING(for extra X11 defines)
1935 if mkdir conftestdir; then
1937 cat > Imakefile <<'EOF'
1939 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
1941 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1942 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
1947 if test -z "$NARROW_PROTO"; then
1950 AC_MSG_RESULT($NARROW_PROTO)
1952 AC_SUBST(NARROW_PROTO)
1955 dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
1956 dnl use the X11 include path
1957 if test "$enable_xsmp" = "yes"; then
1958 cppflags_save=$CPPFLAGS
1959 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1960 AC_CHECK_HEADERS(X11/SM/SMlib.h)
1961 CPPFLAGS=$cppflags_save
1965 if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK"; then
1966 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
1967 cppflags_save=$CPPFLAGS
1968 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1969 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
1971 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
1972 if test ! "$enable_xim" = "no"; then
1973 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
1974 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
1976 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
1978 CPPFLAGS=$cppflags_save
1980 dnl automatically enable XIM when hangul input isn't enabled
1981 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
1982 -a "x$GUITYPE" != "xNONE" ; then
1983 AC_MSG_RESULT(X GUI selected; xim has been enabled)
1988 if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1989 cppflags_save=$CPPFLAGS
1990 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1991 dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
1992 AC_MSG_CHECKING([for X11/Xmu/Editres.h])
1994 #include <X11/Intrinsic.h>
1995 #include <X11/Xmu/Editres.h>],
1998 AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
2000 CPPFLAGS=$cppflags_save
2003 dnl Only use the Xm directory when compiling Motif, don't use it for Athena
2004 if test -z "$SKIP_MOTIF"; then
2005 cppflags_save=$CPPFLAGS
2006 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2007 AC_CHECK_HEADERS(Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h \
2008 Xm/UnhighlightT.h Xm/Notebook.h)
2010 if test $ac_cv_header_Xm_XpmP_h = yes; then
2011 dnl Solaris uses XpmAttributes_21, very annoying.
2012 AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
2013 AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
2014 AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
2015 AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2018 AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2020 CPPFLAGS=$cppflags_save
2023 if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
2024 AC_MSG_RESULT(no GUI selected; xim has been disabled)
2027 if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
2028 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
2031 if test "x$GUITYPE:$enable_fontset" = "xGTK:yes" -a "0$gtk_major_version" -ge 2; then
2032 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
2036 if test -z "$SKIP_PHOTON"; then
2040 AC_SUBST(GUI_INC_LOC)
2041 AC_SUBST(GUI_LIB_LOC)
2043 AC_SUBST(GUI_X_LIBS)
2045 if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2046 AC_MSG_ERROR([cannot use workshop without Motif])
2049 dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2050 if test "$enable_xim" = "yes"; then
2053 if test "$enable_fontset" = "yes"; then
2054 AC_DEFINE(FEAT_XFONTSET)
2058 dnl ---------------------------------------------------------------------------
2059 dnl end of GUI-checking
2060 dnl ---------------------------------------------------------------------------
2063 dnl Only really enable hangul input when GUI and XFONTSET are available
2064 if test "$enable_hangulinput" = "yes"; then
2065 if test "x$GUITYPE" = "xNONE"; then
2066 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2067 enable_hangulinput=no
2069 AC_DEFINE(FEAT_HANGULIN)
2070 HANGULIN_SRC=hangulin.c
2071 AC_SUBST(HANGULIN_SRC)
2072 HANGULIN_OBJ=objects/hangulin.o
2073 AC_SUBST(HANGULIN_OBJ)
2077 dnl Checks for libraries and include files.
2079 AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
2082 #include "confdefs.h"
2085 # include <stdlib.h>
2086 # include <stddef.h>
2088 main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2090 vim_cv_toupper_broken=yes
2092 vim_cv_toupper_broken=no
2094 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2097 if test "x$vim_cv_toupper_broken" = "xyes" ; then
2098 AC_DEFINE(BROKEN_TOUPPER)
2101 AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
2102 AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
2103 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2106 dnl Checks for header files.
2107 AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2108 dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2109 if test "$HAS_ELF" = 1; then
2110 AC_CHECK_LIB(elf, main)
2115 dnl If sys/wait.h is not found it might still exist but not be POSIX
2116 dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2117 if test $ac_cv_header_sys_wait_h = no; then
2118 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2119 AC_TRY_COMPILE([#include <sys/wait.h>],
2120 [union wait xx, yy; xx = yy],
2122 AC_DEFINE(HAVE_SYS_WAIT_H)
2123 AC_DEFINE(HAVE_UNION_WAIT),
2127 AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
2128 termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h sys/types.h termio.h \
2129 iconv.h langinfo.h math.h unistd.h stropts.h errno.h \
2130 sys/resource.h sys/systeminfo.h locale.h \
2131 sys/stream.h termios.h libc.h sys/statfs.h \
2132 poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \
2133 libgen.h util/debug.h util/msg18n.h frame.h \
2134 sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h wctype.h)
2136 dnl sys/ptem.h depends on sys/stream.h on Solaris
2137 AC_CHECK_HEADERS(sys/ptem.h, [], [],
2138 [#if defined HAVE_SYS_STREAM_H
2139 # include <sys/stream.h>
2143 dnl pthread_np.h may exist but can only be used after including pthread.h
2144 AC_MSG_CHECKING([for pthread_np.h])
2146 #include <pthread.h>
2147 #include <pthread_np.h>],
2150 AC_DEFINE(HAVE_PTHREAD_NP_H),
2153 AC_CHECK_HEADERS(strings.h)
2154 if test "x$MACOSX" = "xyes"; then
2155 dnl The strings.h file on OS/X contains a warning and nothing useful.
2156 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2159 dnl Check if strings.h and string.h can both be included when defined.
2160 AC_MSG_CHECKING([if strings.h can be included after string.h])
2161 cppflags_save=$CPPFLAGS
2162 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2164 #if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2165 # define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2166 /* but don't do it on AIX 5.1 (Uribarri) */
2169 # include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2171 #ifdef HAVE_STRING_H
2172 # include <string.h>
2174 #if defined(HAVE_STRINGS_H)
2175 # include <strings.h>
2179 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2181 CPPFLAGS=$cppflags_save
2184 dnl Checks for typedefs, structures, and compiler characteristics.
2185 AC_PROG_GCC_TRADITIONAL
2194 AC_CHECK_TYPE(ino_t, long)
2195 AC_CHECK_TYPE(dev_t, unsigned)
2197 AC_MSG_CHECKING(for rlim_t)
2198 if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2199 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2202 changequote(<<,>>)dnl
2203 <<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2206 #include <sys/types.h>
2208 # include <stdlib.h>
2209 # include <stddef.h>
2211 #ifdef HAVE_SYS_RESOURCE_H
2212 # include <sys/resource.h>
2214 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2215 AC_MSG_RESULT($ac_cv_type_rlim_t)
2217 if test $ac_cv_type_rlim_t = no; then
2218 cat >> confdefs.h <<\EOF
2219 #define rlim_t unsigned long
2223 AC_MSG_CHECKING(for stack_t)
2224 if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2225 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2227 AC_EGREP_CPP(stack_t,
2229 #include <sys/types.h>
2231 # include <stdlib.h>
2232 # include <stddef.h>
2235 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2236 AC_MSG_RESULT($ac_cv_type_stack_t)
2238 if test $ac_cv_type_stack_t = no; then
2239 cat >> confdefs.h <<\EOF
2240 #define stack_t struct sigaltstack
2244 dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2245 AC_MSG_CHECKING(whether stack_t has an ss_base field)
2247 #include <sys/types.h>
2249 # include <stdlib.h>
2250 # include <stddef.h>
2253 #include "confdefs.h"
2254 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2255 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2259 AC_MSG_CHECKING(--with-tlib argument)
2260 AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2261 if test -n "$with_tlib"; then
2262 AC_MSG_RESULT($with_tlib)
2263 LIBS="$LIBS -l$with_tlib"
2264 AC_MSG_CHECKING(for linking with $with_tlib library)
2265 AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
2266 dnl Need to check for tgetent() below.
2269 AC_MSG_RESULT([empty: automatic terminal library selection])
2270 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2271 dnl curses, because curses is much slower.
2272 dnl Newer versions of ncurses are preferred over anything.
2273 dnl Older versions of ncurses have bugs, get a new one!
2274 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
2275 dnl On SCO Openserver should prefer termlib (Roger Cornelius).
2276 case "`uname -s 2>/dev/null`" in
2277 OSF1|SCO_SV) tlibs="ncurses curses termlib termcap";;
2278 *) tlibs="ncurses termlib termcap curses";;
2280 for libname in $tlibs; do
2281 AC_CHECK_LIB(${libname}, tgetent,,)
2282 if test "x$olibs" != "x$LIBS"; then
2283 dnl It's possible that a library is found but it doesn't work
2284 dnl e.g., shared library that cannot be found
2285 dnl compile and run a test program to be sure
2287 #ifdef HAVE_TERMCAP_H
2288 # include <termcap.h>
2291 # include <stdlib.h>
2292 # include <stddef.h>
2294 main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2295 res="OK", res="FAIL", res="FAIL")
2296 if test "$res" = "OK"; then
2299 AC_MSG_RESULT($libname library is not usable)
2303 if test "x$olibs" = "x$LIBS"; then
2304 AC_MSG_RESULT(no terminal library found)
2308 if test "x$olibs" = "x$LIBS"; then
2309 AC_MSG_CHECKING([for tgetent()])
2311 [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
2313 AC_MSG_ERROR([NOT FOUND!
2314 You need to install a terminal library; for example ncurses.
2315 Or specify the name of the library with --with-tlib.]))
2318 AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2321 #include "confdefs.h"
2322 #ifdef HAVE_TERMCAP_H
2323 # include <termcap.h>
2325 #ifdef HAVE_STRING_H
2326 # include <string.h>
2329 # include <stdlib.h>
2330 # include <stddef.h>
2333 {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2339 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2343 if test "x$vim_cv_terminfo" = "xyes" ; then
2347 if test "x$olibs" != "x$LIBS"; then
2348 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2351 #include "confdefs.h"
2352 #ifdef HAVE_TERMCAP_H
2353 # include <termcap.h>
2356 # include <stdlib.h>
2357 # include <stddef.h>
2360 {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2364 vim_cv_tgent=non-zero
2366 AC_MSG_ERROR(failed to compile test program.)
2370 if test "x$vim_cv_tgent" = "xzero" ; then
2371 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2375 AC_MSG_CHECKING(whether termcap.h contains ospeed)
2377 #ifdef HAVE_TERMCAP_H
2378 # include <termcap.h>
2380 ], [ospeed = 20000],
2381 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2383 AC_MSG_CHECKING(whether ospeed can be extern)
2385 #ifdef HAVE_TERMCAP_H
2386 # include <termcap.h>
2388 extern short ospeed;
2389 ], [ospeed = 20000],
2390 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2394 AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2396 #ifdef HAVE_TERMCAP_H
2397 # include <termcap.h>
2399 ], [if (UP == 0 && BC == 0) PC = 1],
2400 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2402 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2404 #ifdef HAVE_TERMCAP_H
2405 # include <termcap.h>
2407 extern char *UP, *BC, PC;
2408 ], [if (UP == 0 && BC == 0) PC = 1],
2409 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2413 AC_MSG_CHECKING(whether tputs() uses outfuntype)
2415 #ifdef HAVE_TERMCAP_H
2416 # include <termcap.h>
2418 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2419 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2422 dnl On some SCO machines sys/select redefines struct timeval
2423 AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2425 #include <sys/types.h>
2426 #include <sys/time.h>
2427 #include <sys/select.h>], ,
2429 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2432 dnl AC_DECL_SYS_SIGLIST
2434 dnl Checks for pty.c (copied from screen) ==========================
2435 AC_MSG_CHECKING(for /dev/ptc)
2436 if test -r /dev/ptc; then
2437 AC_DEFINE(HAVE_DEV_PTC)
2443 AC_MSG_CHECKING(for SVR4 ptys)
2444 if test -c /dev/ptmx ; then
2445 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2446 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2452 AC_MSG_CHECKING(for ptyranges)
2453 if test -d /dev/ptym ; then
2463 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2464 dnl if test -c /dev/ptyp19; then
2465 dnl ptys=`echo /dev/ptyp??`
2467 dnl ptys=`echo $pdir/pty??`
2469 if test "$ptys" != "$pdir/pty??" ; then
2470 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2471 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2472 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2473 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2474 AC_MSG_RESULT([$p0 / $p1])
2476 AC_MSG_RESULT([don't know])
2479 dnl **** pty mode/group handling ****
2481 dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
2483 AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2486 #include "confdefs.h"
2487 #include <sys/types.h>
2489 # include <stdlib.h>
2490 # include <stddef.h>
2492 #ifdef HAVE_UNISTD_H
2495 #include <sys/stat.h>
2504 if (!(x = ttyname(0))) exit(1);
2505 if (stat(x, &sb)) exit(1);
2507 if (om & 002) exit(0);
2508 m = system("mesg y");
2509 if (m == -1 || m == 127) exit(1);
2510 if (stat(x, &sb)) exit(1);
2512 if (chmod(x, om)) exit(1);
2513 if (m & 002) exit(0);
2514 if (sb.st_gid == getgid()) exit(1);
2515 if (!(fp=fopen("conftest_grp", "w")))
2517 fprintf(fp, "%d\n", sb.st_gid);
2522 if test -f conftest_grp; then
2523 vim_cv_tty_group=`cat conftest_grp`
2524 if test "x$vim_cv_tty_mode" = "x" ; then
2525 vim_cv_tty_mode=0620
2527 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2529 vim_cv_tty_group=world
2530 AC_MSG_RESULT([ptys are world accessable])
2533 vim_cv_tty_group=world
2534 AC_MSG_RESULT([can't determine - assume ptys are world accessable])
2536 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2541 if test "x$vim_cv_tty_group" != "xworld" ; then
2542 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2543 if test "x$vim_cv_tty_mode" = "x" ; then
2544 AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (propably 0620)])
2546 AC_DEFINE(PTYMODE, 0620)
2550 dnl Checks for library functions. ===================================
2554 dnl find out what to use at the end of a signal function
2555 if test $ac_cv_type_signal = void; then
2556 AC_DEFINE(SIGRETURN, [return])
2558 AC_DEFINE(SIGRETURN, [return 0])
2561 dnl check if struct sigcontext is defined (used for SGI only)
2562 AC_MSG_CHECKING(for struct sigcontext)
2567 struct sigcontext *scont;
2568 scont = (struct sigcontext *)0;
2572 AC_DEFINE(HAVE_SIGCONTEXT),
2575 dnl tricky stuff: try to find out if getcwd() is implemented with
2576 dnl system("sh -c pwd")
2577 AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2580 #include "confdefs.h"
2581 #ifdef HAVE_UNISTD_H
2584 char *dagger[] = { "IFS=pwd", 0 };
2588 extern char **environ;
2590 return getcwd(buffer, 500) ? 0 : 1;
2593 vim_cv_getcwd_broken=no
2595 vim_cv_getcwd_broken=yes
2597 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2601 if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2602 AC_DEFINE(BAD_GETCWD)
2605 dnl Check for functions in one big call, to reduce the size of configure
2606 AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
2607 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
2608 memset nanosleep opendir putenv qsort readlink select setenv \
2609 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
2610 sigvec strcasecmp strerror strftime stricmp strncasecmp \
2611 strnicmp strpbrk strtol tgetent towlower towupper iswupper \
2612 usleep utime utimes)
2614 dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2615 AC_MSG_CHECKING(for st_blksize)
2617 [#include <sys/types.h>
2618 #include <sys/stat.h>],
2623 n = (int)st.st_blksize;],
2624 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2627 AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2630 #include "confdefs.h"
2632 # include <stdlib.h>
2633 # include <stddef.h>
2635 #include <sys/types.h>
2636 #include <sys/stat.h>
2637 main() {struct stat st; exit(stat("configure/", &st) != 0); }
2639 vim_cv_stat_ignores_slash=yes
2641 vim_cv_stat_ignores_slash=no
2643 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2647 if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2648 AC_DEFINE(STAT_IGNORES_SLASH)
2651 dnl Link with iconv for charset translation, if not found without library.
2652 dnl check for iconv() requires including iconv.h
2653 dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2654 dnl has been installed.
2655 AC_MSG_CHECKING(for iconv_open())
2657 LIBS="$LIBS -liconv"
2662 ], [iconv_open("fr", "to");],
2663 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2669 ], [iconv_open("fr", "to");],
2670 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2674 AC_MSG_CHECKING(for nl_langinfo(CODESET))
2676 #ifdef HAVE_LANGINFO_H
2677 # include <langinfo.h>
2679 ], [char *cs = nl_langinfo(CODESET);],
2680 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2683 dnl Need various functions for floating point support. Only enable
2684 dnl floating point when they are all present.
2685 AC_CHECK_LIB(m, strtod)
2686 AC_MSG_CHECKING([for strtod() and other floating point functions])
2692 # include <stdlib.h>
2693 # include <stddef.h>
2695 ], [char *s; double d;
2696 d = strtod("1.1", &s);
2701 d = pow(1.11, 2.22);
2707 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2710 dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2711 dnl when -lacl works, also try to use -lattr (required for Debian).
2712 AC_MSG_CHECKING(--disable-acl argument)
2714 [ --disable-acl Don't check for ACL support.],
2715 , [enable_acl="yes"])
2716 if test "$enable_acl" = "yes"; then
2718 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2719 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2720 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2722 AC_MSG_CHECKING(for POSIX ACL support)
2724 #include <sys/types.h>
2725 #ifdef HAVE_SYS_ACL_H
2726 # include <sys/acl.h>
2728 acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2729 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2731 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2734 AC_MSG_CHECKING(for Solaris ACL support)
2736 #ifdef HAVE_SYS_ACL_H
2737 # include <sys/acl.h>
2738 #endif], [acl("foo", GETACLCNT, 0, NULL);
2740 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2743 AC_MSG_CHECKING(for AIX ACL support)
2746 # include <stdlib.h>
2747 # include <stddef.h>
2749 #ifdef HAVE_SYS_ACL_H
2750 # include <sys/acl.h>
2752 #ifdef HAVE_SYS_ACCESS_H
2753 # include <sys/access.h>
2757 #include <sys/stat.h>
2760 struct acl *aclent;], [aclsize = sizeof(struct acl);
2761 aclent = (void *)malloc(aclsize);
2762 statacl("foo", STX_NORMAL, aclent, aclsize);
2764 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2770 AC_MSG_CHECKING(--disable-gpm argument)
2772 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2775 if test "$enable_gpm" = "yes"; then
2777 dnl Checking if gpm support can be compiled
2778 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2779 [olibs="$LIBS" ; LIBS="-lgpm"]
2782 #include <linux/keyboard.h>],
2783 [Gpm_GetLibVersion(NULL);],
2784 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2785 dnl FEAT_MOUSE_GPM if mouse support is included
2786 [vi_cv_have_gpm=yes],
2787 [vi_cv_have_gpm=no])
2790 if test $vi_cv_have_gpm = yes; then
2798 AC_MSG_CHECKING(--disable-sysmouse argument)
2799 AC_ARG_ENABLE(sysmouse,
2800 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2801 [enable_sysmouse="yes"])
2803 if test "$enable_sysmouse" = "yes"; then
2805 dnl Checking if sysmouse support can be compiled
2806 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
2807 dnl defines FEAT_SYSMOUSE if mouse support is included
2808 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
2810 [#include <sys/consio.h>
2812 #include <sys/fbio.h>],
2813 [struct mouse_info mouse;
2814 mouse.operation = MOUSE_MODE;
2815 mouse.operation = MOUSE_SHOW;
2816 mouse.u.mode.mode = 0;
2817 mouse.u.mode.signal = SIGUSR2;],
2818 [vi_cv_have_sysmouse=yes],
2819 [vi_cv_have_sysmouse=no])
2821 if test $vi_cv_have_sysmouse = yes; then
2822 AC_DEFINE(HAVE_SYSMOUSE)
2828 dnl rename needs to be checked separately to work on Nextstep with cc
2829 AC_MSG_CHECKING(for rename)
2830 AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2831 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2834 dnl sysctl() may exist but not the arguments we use
2835 AC_MSG_CHECKING(for sysctl)
2837 [#include <sys/types.h>
2838 #include <sys/sysctl.h>],
2843 mib[1] = HW_USERMEM;
2845 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2847 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2848 AC_MSG_RESULT(not usable))
2850 dnl sysinfo() may exist but not be Linux compatible
2851 AC_MSG_CHECKING(for sysinfo)
2853 [#include <sys/types.h>
2854 #include <sys/sysinfo.h>],
2855 [ struct sysinfo sinfo;
2858 (void)sysinfo(&sinfo);
2861 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2862 AC_MSG_RESULT(not usable))
2864 dnl struct sysinfo may have the mem_unit field or not
2865 AC_MSG_CHECKING(for sysinfo.mem_unit)
2867 [#include <sys/types.h>
2868 #include <sys/sysinfo.h>],
2869 [ struct sysinfo sinfo;
2872 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
2875 dnl sysconf() may exist but not support what we want to use
2876 AC_MSG_CHECKING(for sysconf)
2878 [#include <unistd.h>],
2879 [ (void)sysconf(_SC_PAGESIZE);
2880 (void)sysconf(_SC_PHYS_PAGES);
2882 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2883 AC_MSG_RESULT(not usable))
2885 dnl Our own version of AC_CHECK_SIZEOF(int); fixes a bug when sizeof() can't
2886 dnl be printed with "%d", and avoids a warning for cross-compiling.
2888 AC_MSG_CHECKING(size of int)
2889 AC_CACHE_VAL(ac_cv_sizeof_int,
2893 # include <stdlib.h>
2894 # include <stddef.h>
2898 FILE *f=fopen("conftestval", "w");
2900 fprintf(f, "%d\n", (int)sizeof(int));
2903 ac_cv_sizeof_int=`cat conftestval`,
2905 AC_MSG_ERROR(failed to compile test program))])
2906 AC_MSG_RESULT($ac_cv_sizeof_int)
2907 AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
2910 dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2911 dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2914 #include "confdefs.h"
2915 #ifdef HAVE_STRING_H
2916 # include <string.h>
2919 # include <stdlib.h>
2920 # include <stddef.h>
2924 strcpy(buf, "abcdefghi");
2925 mch_memmove(buf, buf + 2, 3);
2926 if (strncmp(buf, "ababcf", 6))
2928 strcpy(buf, "abcdefghi");
2929 mch_memmove(buf + 2, buf, 3);
2930 if (strncmp(buf, "cdedef", 6))
2932 exit(0); /* libc version works properly. */
2935 AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
2937 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
2939 vim_cv_memmove_handles_overlap=yes
2941 vim_cv_memmove_handles_overlap=no
2943 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
2947 if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
2948 AC_DEFINE(USEMEMMOVE)
2950 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
2952 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
2954 vim_cv_bcopy_handles_overlap=yes
2956 vim_cv_bcopy_handles_overlap=no
2958 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
2962 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
2965 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
2967 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
2969 vim_cv_memcpy_handles_overlap=yes
2971 vim_cv_memcpy_handles_overlap=no
2973 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
2977 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
2978 AC_DEFINE(USEMEMCPY)
2984 dnl Check for multibyte locale functions
2985 dnl Find out if _Xsetlocale() is supported by libX11.
2986 dnl Check if X_LOCALE should be defined.
2988 if test "$enable_multibyte" = "yes"; then
2990 ldflags_save=$LDFLAGS
2991 if test -n "$x_includes" ; then
2992 CFLAGS="$CFLAGS -I$x_includes"
2993 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
2994 AC_MSG_CHECKING(whether X_LOCALE needed)
2995 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
2996 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
2997 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
3001 LDFLAGS=$ldflags_save
3004 dnl Link with xpg4, it is said to make Korean locale working
3005 AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
3007 dnl Check how we can run ctags
3008 dnl --version for Exuberant ctags (preferred)
3009 dnl Add --fields=+S to get function signatures for omni completion.
3010 dnl -t for typedefs (many ctags have this)
3011 dnl -s for static functions (Elvis ctags only?)
3012 dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
3013 dnl -i+m to test for older Exuberant ctags
3014 AC_MSG_CHECKING(how to create tags)
3015 test -f tags && mv tags tags.save
3016 if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
3017 TAGPRG="ctags -I INIT+ --fields=+S"
3019 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
3020 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
3021 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
3022 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
3023 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
3024 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
3025 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
3027 test -f tags.save && mv tags.save tags
3028 AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
3030 dnl Check how we can run man with a section number
3031 AC_MSG_CHECKING(how to run man with a section nr)
3033 (eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
3034 AC_MSG_RESULT($MANDEF)
3035 if test "$MANDEF" = "man -s"; then
3039 dnl Check if gettext() is working and if it needs -lintl
3040 AC_MSG_CHECKING(--disable-nls argument)
3042 [ --disable-nls Don't support NLS (gettext()).], ,
3045 if test "$enable_nls" = "yes"; then
3048 INSTALL_LANGS=install-languages
3049 AC_SUBST(INSTALL_LANGS)
3050 INSTALL_TOOL_LANGS=install-tool-languages
3051 AC_SUBST(INSTALL_TOOL_LANGS)
3053 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
3054 AC_MSG_CHECKING([for NLS])
3055 if test -f po/Makefile; then
3057 if test -n "$MSGFMT"; then
3059 [#include <libintl.h>],
3061 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
3065 [#include <libintl.h>],
3067 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
3068 AC_MSG_RESULT([gettext() doesn't work]);
3071 AC_MSG_RESULT([msgfmt not found - disabled]);
3073 if test $have_gettext = "yes"; then
3074 AC_DEFINE(HAVE_GETTEXT)
3077 dnl this was added in GNU gettext 0.10.36
3078 AC_CHECK_FUNCS(bind_textdomain_codeset)
3079 dnl _nl_msg_cat_cntr is required for GNU gettext
3080 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
3082 [#include <libintl.h>
3083 extern int _nl_msg_cat_cntr;],
3084 [++_nl_msg_cat_cntr;],
3085 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
3086 AC_MSG_RESULT([no]))
3089 AC_MSG_RESULT([no "po/Makefile" - disabled]);
3095 dnl Check for dynamic linking loader
3096 AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
3097 if test x${DLL} = xdlfcn.h; then
3098 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
3099 AC_MSG_CHECKING([for dlopen()])
3101 extern void* dlopen();
3105 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3107 AC_MSG_CHECKING([for dlopen() in -ldl])
3111 extern void* dlopen();
3115 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
3118 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
3120 AC_MSG_CHECKING([for dlsym()])
3122 extern void* dlsym();
3126 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3128 AC_MSG_CHECKING([for dlsym() in -ldl])
3132 extern void* dlsym();
3136 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
3139 elif test x${DLL} = xdl.h; then
3140 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
3141 AC_MSG_CHECKING([for shl_load()])
3143 extern void* shl_load();
3147 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3149 AC_MSG_CHECKING([for shl_load() in -ldld])
3153 extern void* shl_load();
3157 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
3161 AC_CHECK_HEADERS(setjmp.h)
3163 if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
3164 dnl -ldl must come after DynaLoader.a
3165 if echo $LIBS | grep -e '-ldl' >/dev/null; then
3166 LIBS=`echo $LIBS | sed s/-ldl//`
3167 PERL_LIBS="$PERL_LIBS -ldl"
3171 if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
3172 && test "x$GUITYPE" != "xCARBONGUI" && test "x$GUITYPE" != "xMACVIMGUI"; then
3173 AC_MSG_CHECKING(whether we need -framework Carbon)
3174 dnl check for MACOSX without Carbon GUI, but with FEAT_MBYTE
3175 if test "x$enable_multibyte" = "xyes" || test "x$features" = "xbig" \
3176 || test "x$features" = "xhuge"; then
3177 LIBS="$LIBS -framework Carbon"
3183 if test "x$MACARCH" = "xboth"; then
3184 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
3187 dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
3188 dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
3189 dnl But only when making dependencies, cproto and lint don't take "-isystem".
3190 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
3191 dnl the number before the version number.
3192 DEPEND_CFLAGS_FILTER=
3193 if test "$GCC" = yes; then
3194 AC_MSG_CHECKING(for GCC 3 or later)
3195 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
3196 if test "$gccmajor" -gt "2"; then
3197 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
3202 dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
3203 dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
3204 AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
3205 if test "$gccmajor" -gt "3"; then
3206 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
3212 AC_SUBST(DEPEND_CFLAGS_FILTER)
3214 dnl write output files
3215 AC_OUTPUT(auto/config.mk:config.mk.in)
3217 dnl vim: set sw=2 tw=78 fo+=l: