1 # This file is part of Autoconf. -*- Autoconf -*-
2 # Macros that test for specific features.
3 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
4 # Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 # As a special exception, the Free Software Foundation gives unlimited
22 # permission to copy, distribute and modify the configure scripts that
23 # are the output of Autoconf. You need not follow the terms of the GNU
24 # General Public License when using or distributing such scripts, even
25 # though portions of the text of Autoconf appear in them. The GNU
26 # General Public License (GPL) does govern all other use of the material
27 # that constitutes the Autoconf program.
29 # Certain portions of the Autoconf source text are designed to be copied
30 # (in certain cases, depending on the input) into the output of
31 # Autoconf. We call these the "data" portions. The rest of the Autoconf
32 # source text consists of comments plus executable code that decides which
33 # of the data portions to output in any given case. We call these
34 # comments and executable code the "non-data" portions. Autoconf never
35 # copies any of the non-data portions into its output.
37 # This special exception to the GPL applies to versions of Autoconf
38 # released by the Free Software Foundation. When you make and
39 # distribute a modified version of Autoconf, you may extend this special
40 # exception to the GPL to apply to your modified version as well, *unless*
41 # your modified version has the potential to copy into its output some
42 # of the text that was the non-data portion of the version that you started
43 # with. (In other words, unless your change moves or copies text from
44 # the non-data portions to the data portions.) If your modification has
45 # such potential, you must delete any notice of this special exception
46 # to the GPL from your modified version.
48 # Written by David MacKenzie, with help from
49 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
50 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
53 ## --------------------- ##
54 ## Checks for programs. ##
55 ## --------------------- ##
60 # Check whether to use -n, \c, or newline-tab to separate
61 # checking messages from result messages.
62 # Don't try to cache, since the results of this macro are needed to
63 # display the checking message. In addition, caching something used once
64 # has little interest.
65 # Idea borrowed from dist 3.0. Use `*c*,', not `*c,' because if `\c'
66 # failed there is also a new-line to match.
67 m4_define([_AC_PROG_ECHO],
68 [case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
69 *c*,-n*) ECHO_N= ECHO_C='
71 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
72 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
82 # Define SET_MAKE to set ${MAKE} if make doesn't.
83 AC_DEFUN([AC_PROG_MAKE_SET],
84 [AC_MSG_CHECKING([whether ${MAKE-make} sets \${MAKE}])
85 set dummy ${MAKE-make}; ac_make=`echo "$[2]" | sed 'y,./+-,__p_,'`
86 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
87 [cat >conftest.make <<\EOF
89 @echo 'ac_maketemp="${MAKE}"'
91 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
92 eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
93 if test -n "$ac_maketemp"; then
94 eval ac_cv_prog_make_${ac_make}_set=yes
96 eval ac_cv_prog_make_${ac_make}_set=no
98 rm -f conftest.make])dnl
99 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
104 SET_MAKE="MAKE=${MAKE-make}"
106 AC_SUBST([SET_MAKE])dnl
112 AC_DEFUN([AC_PROG_RANLIB],
113 [AC_CHECK_TOOL(RANLIB, ranlib, :)])
116 # Check for mawk first since it's generally faster.
117 AC_DEFUN([AC_PROG_AWK],
118 [AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
123 AC_DEFUN([AC_PROG_YACC],
124 [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)])
129 # Look for flex or lex. Set its associated library to LEXLIB.
130 # Check if lex declares yytext as a char * by default, not a char[].
131 AC_DEFUN_ONCE([AC_PROG_LEX],
132 [AC_CHECK_PROGS(LEX, flex lex, :)
135 AC_CHECK_LIB(fl, yywrap, LEXLIB="-lfl",
136 [AC_CHECK_LIB(l, yywrap, LEXLIB="-ll")])
139 if test "x$LEX" != "x:"; then
146 # Check if lex declares yytext as a char * by default, not a char[].
147 m4_define([_AC_DECL_YYTEXT],
148 [AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
149 [# The minimal lex program is just a single line: %%. But some broken lexes
150 # (Solaris, I think it was) want two %% lines, so accommodate them.
153 if test -f lex.yy.c; then
154 ac_cv_prog_lex_root=lex.yy
155 elif test -f lexyy.c; then
156 ac_cv_prog_lex_root=lexyy
158 AC_MSG_ERROR([cannot find output from $LEX; giving up])
160 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
161 AC_SUBST(LEX_OUTPUT_ROOT)dnl
163 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
164 [# POSIX says lex can declare yytext either as a pointer or an array; the
165 # default is implementation-dependent. Figure out which it is, since
166 # not all implementations provide the %pointer and %array declarations.
167 ac_cv_prog_lex_yytext_pointer=no
168 echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
171 AC_LINK_IFELSE([`cat $LEX_OUTPUT_ROOT.c`], ac_cv_prog_lex_yytext_pointer=yes)
173 rm -f "${LEX_OUTPUT_ROOT}.c"
176 if test $ac_cv_prog_lex_yytext_pointer = yes; then
177 AC_DEFINE(YYTEXT_POINTER, 1,
178 [Define if `lex' declares `yytext' as a `char *' by default,
184 # Require AC_PROG_LEX in case some people were just calling this macro.
185 AU_DEFUN([AC_DECL_YYTEXT],
191 AC_DEFUN([AC_PROG_INSTALL],
192 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
193 # Find a good install program. We prefer a C program (faster),
194 # so one script is as good as another. But avoid the broken or
195 # incompatible versions:
196 # SysV /etc/install, /usr/sbin/install
197 # SunOS /usr/etc/install
200 # AmigaOS /C/install, which installs bootblocks on floppy discs
201 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
202 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
203 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
204 # ./install, which can be erroneously created by make from ./install.sh.
205 AC_MSG_CHECKING([for a BSD compatible install])
206 if test -z "$INSTALL"; then
207 AC_CACHE_VAL(ac_cv_path_install,
208 [ ac_save_IFS=$IFS; IFS=$ac_path_separator
209 for ac_dir in $PATH; do
211 # Account for people who put trailing slashes in PATH elements.
213 / | ./ | .// | /[cC]/* \
214 | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \
217 # OSF1 and SCO ODT 3.0 have their own names for install.
218 # Don't use installbsd from OSF since it installs stuff as root
220 for ac_prog in ginstall scoinst install; do
221 if AS_EXECUTABLE_P(["$ac_dir/$ac_prog"]); then
222 if test $ac_prog = install &&
223 grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then
224 # AIX install. It has an incompatible calling convention.
226 elif test $ac_prog = install &&
227 grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then
228 # program-specific install script used by HP pwplus--don't use.
231 ac_cv_path_install="$ac_dir/$ac_prog -c"
240 if test "${ac_cv_path_install+set}" = set; then
241 INSTALL=$ac_cv_path_install
243 # As a last resort, use the slow shell script. We don't cache a
244 # path for INSTALL within a source directory, because that will
245 # break other packages using the cache if that directory is
246 # removed, or if the path is relative.
247 INSTALL=$ac_install_sh
250 dnl We do special magic for INSTALL instead of AC_SUBST, to get
251 dnl relative paths right.
252 AC_MSG_RESULT([$INSTALL])
254 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
255 # It thinks the first close brace ends the variable substitution.
256 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
257 AC_SUBST(INSTALL_PROGRAM)dnl
259 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
260 AC_SUBST(INSTALL_SCRIPT)dnl
262 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
263 AC_SUBST(INSTALL_DATA)dnl
269 AC_DEFUN([AC_PROG_LN_S],
270 [AC_MSG_CHECKING([whether ln -s works])
271 AC_SUBST([LN_S], [$as_ln_s])dnl
272 if test "$LN_S" = "ln -s"; then
275 AC_MSG_RESULT([no, using $LN_S])
282 # I don't know what it used to do, but it no longer does.
284 [AC_DIAGNOSE([obsolete], [$0: is no longer supported.
285 Remove this warning when you adjust the code.])])
289 ## ------------------------- ##
290 ## Checks for declarations. ##
291 ## ------------------------- ##
294 # AC_DECL_SYS_SIGLIST
295 # -------------------
296 AC_DEFUN([AC_DECL_SYS_SIGLIST],
297 [AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
298 ac_cv_decl_sys_siglist,
300 [AC_LANG_PROGRAM([#include <sys/types.h>
302 /* NetBSD declares sys_siglist in unistd.h. */
306 ], [char *msg = *(sys_siglist + 1);])],
307 [ac_cv_decl_sys_siglist=yes],
308 [ac_cv_decl_sys_siglist=no])])
309 if test $ac_cv_decl_sys_siglist = yes; then
310 AC_DEFINE(SYS_SIGLIST_DECLARED, 1,
311 [Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
313 ])# AC_DECL_SYS_SIGLIST
318 ## -------------------------------------- ##
319 ## Checks for operating system services. ##
320 ## -------------------------------------- ##
325 AC_DEFUN([AC_SYS_INTERPRETER],
326 [AC_CACHE_CHECK(whether @%:@! works in shell scripts, ac_cv_sys_interpreter,
331 (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)
332 if test $? -ne 69; then
333 ac_cv_sys_interpreter=yes
335 ac_cv_sys_interpreter=no
338 interpval=$ac_cv_sys_interpreter
342 AU_DEFUN([AC_HAVE_POUNDBANG],
344 AC_DIAGNOSE([obsolete],
345 [$0: Remove this warning when you adjust your code to use
346 `AC_SYS_INTERPRETER'.])])
349 AU_DEFUN([AC_ARG_ARRAY],
350 [AC_DIAGNOSE([obsolete],
351 [$0: no longer implemented: don't do unportable things
352 with arguments. Remove this warning when you adjust your code.])])
355 # _AC_SYS_LARGEFILE_TEST_INCLUDES
356 # -------------------------------
357 m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
358 [@%:@include <sys/types.h>
359 /* Check that off_t can represent 2**63 - 1 correctly.
360 We can't simply define LARGE_OFF_T to be 9223372036854775807,
361 since some C++ compilers masquerading as C compilers
362 incorrectly reject 9223372036854775807. */
363 @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
364 int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
365 && LARGE_OFF_T % 2147483647 == 1)
370 # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
373 # [INCLUDES], [FUNCTION-BODY])
374 # ----------------------------------------------------------
375 m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
376 [AC_CACHE_CHECK([for $1 value needed for large files], [$3],
379 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$5], [$6])],
381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@define $1 $2
386 if test "$$3" != no; then
387 AC_DEFINE_UNQUOTED([$1], [$$3], [$4])
390 ])# _AC_SYS_LARGEFILE_MACRO_VALUE
395 # By default, many hosts won't let programs access large files;
396 # one must use special compiler options to get large-file access to work.
397 # For more details about this brain damage please see:
398 # http://www.sas.com/standards/large.file/x_open.20Mar96.html
399 AC_DEFUN([AC_SYS_LARGEFILE],
400 [AC_ARG_ENABLE(largefile,
401 [ --disable-largefile omit support for large files])
402 if test "$enable_largefile" != no; then
404 AC_CACHE_CHECK([for special C compiler options needed for large files],
405 ac_cv_sys_largefile_CC,
406 [ac_cv_sys_largefile_CC=no
407 if test "$GCC" != yes; then
410 # IRIX 6.2 and later do not support large files by default,
411 # so use the C compiler's -n32 option if that helps.
412 AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
413 AC_COMPILE_IFELSE([], [break])
415 AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
419 rm -f conftest.$ac_ext
421 if test "$ac_cv_sys_largefile_CC" != no; then
422 CC=$CC$ac_cv_sys_largefile_CC
425 _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
426 ac_cv_sys_file_offset_bits,
427 [Number of bits in a file offset, on hosts where this is settable.],
428 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
429 _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
430 ac_cv_sys_large_files,
431 [Define for large files, on AIX-style hosts.],
432 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
437 # AC_SYS_LONG_FILE_NAMES
438 # ----------------------
439 # Security: use a temporary directory as the most portable way of
440 # creating files in /tmp securely. Removing them leaves a race
441 # condition, set -C is not portably guaranteed to use O_EXCL, so still
442 # leaves a race, and not all systems have the `mktemp' utility. We
443 # still test for existence first in case of broken systems where the
444 # mkdir succeeds even when the directory exists. Broken systems may
445 # retain a race, but they probably have other security problems
446 # anyway; this should be secure on well-behaved systems. In any case,
447 # use of `mktemp' is probably inappropriate here since it would fail in
448 # attempting to create different file names differing after the 14th
449 # character on file systems without long file names.
450 AC_DEFUN([AC_SYS_LONG_FILE_NAMES],
451 [AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names,
452 [ac_cv_sys_long_file_names=yes
453 # Test for long file names in all the places we know might matter:
454 # . the current directory, where building will happen
455 # $prefix/lib where we will be installing things
456 # $exec_prefix/lib likewise
457 # eval it to expand exec_prefix.
458 # $TMPDIR if set, where it might want to write temporary files
459 # if $TMPDIR is not set:
460 # /tmp where it might want to write temporary files
463 if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then
466 ac_tmpdirs='/tmp /var/tmp /usr/tmp'
468 for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do
469 test -d $ac_dir || continue
470 test -w $ac_dir || continue # It is less confusing to not echo anything here.
472 (umask 077 && mkdir $ac_xdir 2>/dev/null) || continue
473 ac_tf1=$ac_xdir/conftest9012345
474 ac_tf2=$ac_xdir/conftest9012346
475 (echo 1 >$ac_tf1) 2>/dev/null
476 (echo 2 >$ac_tf2) 2>/dev/null
477 ac_val=`cat $ac_tf1 2>/dev/null`
478 if test ! -f $ac_tf1 || test "$ac_val" != 1; then
479 ac_cv_sys_long_file_names=no
480 rm -rf $ac_xdir 2>/dev/null
483 rm -rf $ac_xdir 2>/dev/null
485 if test $ac_cv_sys_long_file_names = yes; then
486 AC_DEFINE(HAVE_LONG_FILE_NAMES, 1,
487 [Define if you support file names longer than 14 characters.])
492 # AC_SYS_RESTARTABLE_SYSCALLS
493 # ---------------------------
494 # If the system automatically restarts a system call that is
495 # interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'.
496 AC_DEFUN([AC_SYS_RESTARTABLE_SYSCALLS],
497 [AC_DIAGNOSE([obsolete],
498 [$0: System call restartability is now typically set at runtime.
499 Remove this `AC_SYS_RESTARTABLE_SYSCALLS'
500 and adjust your code to use `sigaction' with `SA_RESTART' instead.])dnl
501 AC_REQUIRE([AC_HEADER_SYS_WAIT])dnl
502 AC_CHECK_HEADERS(unistd.h)
503 AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls,
504 [AC_RUN_IFELSE([AC_LANG_SOURCE(
505 [/* Exit 0 (true) if wait returns something other than -1,
506 i.e. the pid of the child, which means that wait was restarted
507 after getting the signal. */
509 #include <sys/types.h>
515 # include <sys/wait.h>
518 /* Some platforms explicitly require an extern "C" signal handler
521 extern "C" void ucatch (int dummy) { }
523 void ucatch (dummy) int dummy; { }
529 int i = fork (), status;
534 kill (getppid (), SIGINT);
539 signal (SIGINT, ucatch);
547 [ac_cv_sys_restartable_syscalls=yes],
548 [ac_cv_sys_restartable_syscalls=no])])
549 if test $ac_cv_sys_restartable_syscalls = yes; then
550 AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS, 1,
551 [Define if system calls automatically restart after interruption
554 ])# AC_SYS_RESTARTABLE_SYSCALLS
557 # AC_SYS_POSIX_TERMIOS
558 # --------------------
559 AC_DEFUN([AC_SYS_POSIX_TERMIOS],
560 [AC_CACHE_CHECK([POSIX termios], ac_cv_sys_posix_termios,
561 [AC_TRY_LINK([#include <sys/types.h>
563 @%:@include <termios.h>],
564 [/* SunOS 4.0.3 has termios.h but not the library calls. */
566 ac_cv_sys_posix_termios=yes,
567 ac_cv_sys_posix_termios=no)])
568 ])# AC_SYS_POSIX_TERMIOS
572 ## --------------------- ##
573 ## Checks for X window. ##
574 ## --------------------- ##
579 # Internal subroutine of _AC_PATH_X.
580 # Set ac_x_includes and/or ac_x_libraries.
581 m4_define([_AC_PATH_X_XMKMF],
583 if mkdir conftest.dir; then
585 # Make sure to not put "make" in the Imakefile rules, since we grep it out.
586 cat >Imakefile <<'EOF'
588 @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
590 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
591 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
592 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
593 # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
594 for ac_extension in a so sl; do
595 if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
596 test -f $ac_im_libdir/libX11.$ac_extension; then
597 ac_im_usrlibdir=$ac_im_libdir; break
600 # Screen out bogus values from the imake configuration. They are
601 # bogus both because they are the default anyway, and because
602 # using them would break gcc on systems where it needs fixed includes.
603 case $ac_im_incroot in
605 *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
607 case $ac_im_usrlibdir in
609 *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
620 # Internal subroutine of _AC_PATH_X.
621 # Set ac_x_includes and/or ac_x_libraries.
622 m4_define([_AC_PATH_X_DIRECT],
623 [# Standard set of common directories for X headers.
624 # Check X11 before X11Rn because it is often a symlink to the current release.
636 /usr/local/X11/include
637 /usr/local/X11R6/include
638 /usr/local/X11R5/include
639 /usr/local/X11R4/include
641 /usr/local/include/X11
642 /usr/local/include/X11R6
643 /usr/local/include/X11R5
644 /usr/local/include/X11R4
648 /usr/XFree86/include/X11
652 /usr/unsupported/include
654 /usr/local/x11r5/include
655 /usr/lpp/Xamples/include
658 /usr/openwin/share/include'
660 if test "$ac_x_includes" = no; then
661 # Guess where to find include files, by looking for Intrinsic.h.
662 # First, try using that file with no special directory specified.
663 AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include <X11/Intrinsic.h>])],
664 [# We can compile using X headers with no special include directory.
666 [for ac_dir in $ac_x_header_dirs; do
667 if test -r "$ac_dir/X11/Intrinsic.h"; then
668 ac_x_includes=$ac_dir
672 fi # $ac_x_includes = no
674 if test "$ac_x_libraries" = no; then
675 # Check for the libraries.
676 # See if we find them without any special options.
677 # Don't add to $LIBS permanently.
680 AC_TRY_LINK([@%:@include <X11/Intrinsic.h>], [XtMalloc (0)],
682 # We can link X programs with no special library path.
685 for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
687 # Don't even attempt the hair of trying to link an X program!
688 for ac_extension in a so sl; do
689 if test -r $ac_dir/libXt.$ac_extension; then
690 ac_x_libraries=$ac_dir
695 fi # $ac_x_libraries = no
696 ])# _AC_PATH_X_DIRECT
701 # Compute ac_cv_have_x.
702 AC_DEFUN([_AC_PATH_X],
703 [AC_CACHE_VAL(ac_cv_have_x,
704 [# One or both of the vars are not set, and there is no cached value.
705 ac_x_includes=no ac_x_libraries=no
708 if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
709 # Didn't find X anywhere. Cache the known absence of X.
710 ac_cv_have_x="have_x=no"
712 # Record where we found X for the cache.
713 ac_cv_have_x="have_x=yes \
714 ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
721 # If we find X, set shell vars x_includes and x_libraries to the
722 # paths, otherwise set no_x=yes.
723 # Uses ac_ vars as temps to allow command line to override cache and checks.
724 # --without-x overrides everything else, but does not touch the cache.
725 AC_DEFUN([AC_PATH_X],
726 [dnl Document the X abnormal options inherited from history.
727 m4_divert_once([HELP_BEGIN], [
729 --x-includes=DIR X include files are in DIR
730 --x-libraries=DIR X library files are in DIR])dnl
731 AC_MSG_CHECKING([for X])
733 AC_ARG_WITH(x, [ --with-x use the X Window System])
734 # $have_x is `yes', `no', `disabled', or empty when we do not yet know.
735 if test "x$with_x" = xno; then
736 # The user explicitly disabled X.
739 if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
740 # Both variables are already set.
748 if test "$have_x" != yes; then
749 AC_MSG_RESULT([$have_x])
752 # If each of the values was on the command line, it overrides each guess.
753 test "x$x_includes" = xNONE && x_includes=$ac_x_includes
754 test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
755 # Update the cache value to reflect the command line values.
756 ac_cv_have_x="have_x=yes \
757 ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
758 AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
766 # Find additional X libraries, magic flags, etc.
767 AC_DEFUN([AC_PATH_XTRA],
768 [AC_REQUIRE([AC_PATH_X])dnl
769 if test "$no_x" = yes; then
770 # Not all programs may use this symbol, but it does not hurt to define it.
771 AC_DEFINE([X_DISPLAY_MISSING], 1,
772 [Define if the X Window System is missing or not being used.])
773 X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
775 if test -n "$x_includes"; then
776 X_CFLAGS="$X_CFLAGS -I$x_includes"
779 # It would also be nice to do this for all -L options, not just this one.
780 if test -n "$x_libraries"; then
781 X_LIBS="$X_LIBS -L$x_libraries"
782 dnl FIXME: banish uname from this macro!
783 # For Solaris; some versions of Sun CC require a space after -R and
784 # others require no space. Words are not sufficient . . . .
785 case `(uname -sr) 2>/dev/null` in
787 AC_MSG_CHECKING([whether -R must be followed by a space])
788 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
789 AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_R_nospace=yes, ac_R_nospace=no)
790 if test $ac_R_nospace = yes; then
792 X_LIBS="$X_LIBS -R$x_libraries"
794 LIBS="$ac_xsave_LIBS -R $x_libraries"
795 AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_R_space=yes, ac_R_space=no)
796 if test $ac_R_space = yes; then
798 X_LIBS="$X_LIBS -R $x_libraries"
800 AC_MSG_RESULT([neither works])
807 # Check for system-dependent libraries X programs must link with.
808 # Do this before checking for the system-independent R6 libraries
809 # (-lICE), since we may need -lsocket or whatever for X linking.
811 if test "$ISC" = yes; then
812 X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
814 # Martyn Johnson says this is needed for Ultrix, if the X
815 # libraries were built with DECnet support. And Karl Berry says
816 # the Alpha needs dnet_stub (dnet does not exist).
817 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
818 AC_TRY_LINK_FUNC(XOpenDisplay, ,
819 [AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
820 if test $ac_cv_lib_dnet_dnet_ntoa = no; then
821 AC_CHECK_LIB(dnet_stub, dnet_ntoa,
822 [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
824 LIBS="$ac_xsave_LIBS"
826 # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
827 # to get the SysV transport functions.
828 # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
830 # The nsl library prevents programs from opening the X display
831 # on Irix 5.2, according to T.E. Dickey.
832 # The functions gethostbyname, getservbyname, and inet_addr are
833 # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
834 AC_CHECK_FUNC(gethostbyname)
835 if test $ac_cv_func_gethostbyname = no; then
836 AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
837 if test $ac_cv_lib_nsl_gethostbyname = no; then
838 AC_CHECK_LIB(bsd, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd")
842 # lieder@skyler.mavd.honeywell.com says without -lsocket,
843 # socket/setsockopt and other routines are undefined under SCO ODT
844 # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
845 # on later versions), says Simon Leinen: it contains gethostby*
846 # variants that don't use the nameserver (or something). -lsocket
847 # must be given before -lnsl if both are needed. We assume that
848 # if connect needs -lnsl, so does gethostbyname.
849 AC_CHECK_FUNC(connect)
850 if test $ac_cv_func_connect = no; then
851 AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
855 # Guillermo Gomez says -lposix is necessary on A/UX.
856 AC_CHECK_FUNC(remove)
857 if test $ac_cv_func_remove = no; then
858 AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
861 # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
863 if test $ac_cv_func_shmat = no; then
864 AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
868 # Check for libraries that X11R6 Xt/Xaw programs need.
869 ac_save_LDFLAGS=$LDFLAGS
870 test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
871 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
872 # check for ICE first), but we must link in the order -lSM -lICE or
873 # we get undefined symbols. So assume we have SM if we have ICE.
874 # These have to be linked with before -lX11, unlike the other
875 # libraries we check for below, so use a different variable.
876 # John Interrante, Karl Berry
877 AC_CHECK_LIB(ICE, IceConnectionNumber,
878 [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS)
879 LDFLAGS=$ac_save_LDFLAGS
882 AC_SUBST(X_CFLAGS)dnl
883 AC_SUBST(X_PRE_LIBS)dnl
885 AC_SUBST(X_EXTRA_LIBS)dnl
890 ## ------------------------------------ ##
891 ## Checks for not-quite-Unix variants. ##
892 ## ------------------------------------ ##
897 # Check for Cygwin. This is a way to set the right value for
899 AU_DEFUN([AC_CYGWIN],
900 [AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
901 AC_DIAGNOSE([obsolete],
902 [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
904 *cygwin* ) CYGWIN=yes;;
912 # Check for EMX on OS/2. This is another way to set the right value
914 AU_DEFUN([AC_EMXOS2],
915 [AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
916 AC_DIAGNOSE([obsolete],
917 [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
927 # Check for mingw32. This is another way to set the right value for
929 AU_DEFUN([AC_MINGW32],
930 [AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
931 AC_DIAGNOSE([obsolete],
932 [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl
934 *mingw32* ) MINGW32=yes;;
942 ## -------------------------- ##
943 ## Checks for UNIX variants. ##
944 ## -------------------------- ##
947 # These are kludges which should be replaced by a single POSIX check.
948 # They aren't cached, to discourage their use.
953 [AH_VERBATIM([_ALL_SOURCE],
954 [/* Define if on AIX 3.
955 System headers sometimes define this.
956 We just want to avoid a redefinition error message. */
957 @%:@ifndef _ALL_SOURCE
958 @%:@ undef _ALL_SOURCE
960 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
961 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
962 AC_MSG_CHECKING([for AIX])
968 [AC_MSG_RESULT([yes])
969 AC_DEFINE(_ALL_SOURCE)],
970 [AC_MSG_RESULT([no])])
977 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
978 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
979 AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
980 if test "$MINIX" = yes; then
981 AC_DEFINE(_POSIX_SOURCE, 1,
982 [Define if you need to in order for `stat' and other things to
984 AC_DEFINE(_POSIX_1_SOURCE, 2,
985 [Define if the system does not provide POSIX.1 features except
988 [Define if on MINIX.])
995 AC_DEFUN([AC_ISC_POSIX],
996 [AC_REQUIRE([AC_PROG_CC])dnl
997 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
998 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
999 AC_MSG_CHECKING([for POSIXized ISC])
1000 if test -d /etc/conf/kconfig.d &&
1001 grep _POSIX_VERSION [/usr/include/sys/unistd.h] >/dev/null 2>&1
1003 AC_MSG_RESULT([yes])
1004 ISC=yes # If later tests want to check for ISC.
1005 AC_DEFINE(_POSIX_SOURCE, 1,
1006 [Define if you need to in order for stat and other things to
1008 if test "$GCC" = yes; then
1022 AU_DEFUN(AC_XENIX_DIR,
1023 [# You shouldn't need to depend upon XENIX. Remove this test if useless.
1024 AC_MSG_CHECKING([for Xenix])
1026 [#if defined(M_XENIX) && !defined(M_UNIX)
1029 [AC_MSG_RESULT([yes]); XENIX=yes],
1030 [AC_MSG_RESULT([no]); XENIX=])
1032 AC_HEADER_DIRENT[]dnl
1038 AU_DEFUN([AC_DYNIX_SEQ], [AC_FUNC_GETMNTENT])
1043 AU_DEFUN([AC_IRIX_SUN],
1045 AC_CHECK_LIB(sun, getpwnam)])
1050 AU_DEFUN([AC_SCO_INTL], [AC_FUNC_STRFTIME])