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