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