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