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