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