2
0
mirror of git://git.sv.gnu.org/autoconf synced 2025-03-25 14:50:24 +08:00

fix messages and library checking

This commit is contained in:
David MacKenzie 1994-08-10 23:54:30 +00:00
parent 53b55a54e2
commit db6c43083e
7 changed files with 235 additions and 162 deletions

1
NEWS

@ -21,6 +21,7 @@ Major changes in release 2.0:
configure --verbose no longer has any effect. configure --verbose no longer has any effect.
* AC_PREFIX_PROGRAM, which obsoletes AC_PREFIX. * AC_PREFIX_PROGRAM, which obsoletes AC_PREFIX.
* AC_HEADER_DIRENT, which obsoletes AC_DIR_HEADER. * AC_HEADER_DIRENT, which obsoletes AC_DIR_HEADER.
* AC_CHECK_LIB, which obsoletes AC_HAVE_LIBRARY.
* AC_ARG_ENABLE and AC_ARG_WITH, which obsolete AC_ENABLE and AC_WITH. * AC_ARG_ENABLE and AC_ARG_WITH, which obsolete AC_ENABLE and AC_WITH.
* AC_SUBST_FILE, to insert one file into another. * AC_SUBST_FILE, to insert one file into another.

@ -756,7 +756,7 @@ fi
for ac_site_dir in $ac_site_dirs; do for ac_site_dir in $ac_site_dirs; do
ac_site_file=$ac_site_dir/lib/config.site ac_site_file=$ac_site_dir/lib/config.site
if test -r "$ac_site_file"; then if test -r "$ac_site_file"; then
echo "loading site initialization script $ac_site_file" echo "loading site script $ac_site_file"
. $ac_site_file . $ac_site_file
fi fi
done done
@ -764,16 +764,16 @@ done
dnl dnl
define(AC_CACHE_LOAD, define(AC_CACHE_LOAD,
[if test -r "$cache_file"; then [if test -r "$cache_file"; then
echo "loading test results from cache file $cache_file" echo "loading cache $cache_file"
. $cache_file . $cache_file
else else
echo "creating new cache file $cache_file" echo "creating cache $cache_file"
> $cache_file > $cache_file
fi])dnl fi])dnl
dnl dnl
define(AC_CACHE_SAVE, define(AC_CACHE_SAVE,
[if test -w $cache_file; then [if test -w $cache_file; then
echo "saving test results in cache file $cache_file" echo "updating cache $cache_file"
cat > $cache_file <<\CEOF cat > $cache_file <<\CEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure # tests run on this system so they can be shared between configure
@ -798,7 +798,7 @@ dnl
dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT)
dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved. dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
define(AC_CACHE_VAL, define(AC_CACHE_VAL,
[AC_REQUIRE([AC_MSG_ECHO_N])dnl [AC_REQUIRE([AC_PROG_ECHO_N])dnl
dnl We used to use the below line, but it fails if the 1st arg is a dnl We used to use the below line, but it fails if the 1st arg is a
dnl shell variable, so we need the eval. dnl shell variable, so we need the eval.
dnl if test "${$1+set}" = set; then dnl if test "${$1+set}" = set; then
@ -932,37 +932,20 @@ dnl
dnl ### Printing messages dnl ### Printing messages
dnl dnl
dnl dnl
dnl Check whether to use -n, \c, or newline-tab to separate
dnl checking messages from result messages.
define(AC_MSG_ECHO_N,
[AC_PROVIDE([$0])dnl
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi])dnl
dnl
dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION) dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)
define(AC_MSG_CHECKING, define(AC_MSG_CHECKING,
[AC_REQUIRE([AC_MSG_ECHO_N])dnl [AC_REQUIRE([AC_PROG_ECHO_N])dnl
echo $ac_n "checking $1""...$ac_c" 1>&4])dnl echo $ac_n "checking $1""... $ac_c" 1>&4])dnl
dnl dnl
dnl Obsolete version.
define(AC_CHECKING, define(AC_CHECKING,
[AC_OBSOLETE([$0], [; instead use AC_MSG_CHECKING])dnl [AC_OBSOLETE([$0], [; instead use AC_MSG_CHECKING])dnl
echo "checking $1" 1>&4])dnl echo "checking $1" 1>&4])dnl
dnl dnl
dnl AC_MSG_RESULT(RESULT-DESCRIPTION) dnl AC_MSG_RESULT(RESULT-DESCRIPTION)
define(AC_MSG_RESULT, define(AC_MSG_RESULT,
[AC_REQUIRE([AC_MSG_ECHO_N])dnl [AC_REQUIRE([AC_PROG_ECHO_N])dnl
echo "$ac_t""$1" 1>&4])dnl echo "$ac_t""$1" 1>&4])dnl
dnl dnl
dnl Obsolete version.
define(AC_VERBOSE, define(AC_VERBOSE,
[AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl [AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl
echo " $1" 1>&4])dnl echo " $1" 1>&4])dnl
@ -1115,10 +1098,10 @@ done
ifelse([$3], , , [test -n "[$]$1" || $1="$3" ifelse([$3], , , [test -n "[$]$1" || $1="$3"
])])dnl ])])dnl
dnl dnl
dnl AC_CHECK_LIB(LIBRARY [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND dnl AC_CHECK_LIB(LIBRARY, FUNCTION, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl [, OTHER-LIBRARIES]]]) dnl [, OTHER-LIBRARIES]]])
define(AC_CHECK_LIB, [dnl define(AC_CHECK_LIB,
changequote(/, /)dnl [changequote(/, /)dnl
define(/AC_LIB_NAME/, dnl define(/AC_LIB_NAME/, dnl
patsubst(patsubst($1, /lib\([^\.]*\)\.a/, /\1/), /-l/, //))dnl patsubst(patsubst($1, /lib\([^\.]*\)\.a/, /\1/), /-l/, //))dnl
define(/AC_CV_NAME/, ac_cv_lib_//AC_LIB_NAME)dnl define(/AC_CV_NAME/, ac_cv_lib_//AC_LIB_NAME)dnl
@ -1126,24 +1109,31 @@ changequote([, ])dnl
AC_MSG_CHECKING([for -l[]AC_LIB_NAME]) AC_MSG_CHECKING([for -l[]AC_LIB_NAME])
AC_CACHE_VAL(AC_CV_NAME, AC_CACHE_VAL(AC_CV_NAME,
[ac_save_LIBS="${LIBS}" [ac_save_LIBS="${LIBS}"
LIBS="${LIBS} -l[]AC_LIB_NAME[] $4" LIBS="${LIBS} -l[]AC_LIB_NAME[] $5"
AC_TRY_LINK( , [main();], AC_CV_NAME=yes, AC_CV_NAME=no)dnl AC_TRY_LINK( , [$2()], AC_CV_NAME=yes, AC_CV_NAME=no)dnl
LIBS="${ac_save_LIBS}" LIBS="${ac_save_LIBS}"
])dnl ])dnl
AC_MSG_RESULT($AC_CV_NAME) AC_MSG_RESULT($AC_CV_NAME)
if test "${AC_CV_NAME}" = yes; then if test "${AC_CV_NAME}" = yes; then
ifelse([$2], , ifelse([$3], ,
[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z])) [AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
LIBS="${LIBS} -l[]AC_LIB_NAME[]" LIBS="${LIBS} -l[]AC_LIB_NAME[]"
], [$2]) ], [$3])
ifelse([$3], , , [else ifelse([$4], , , [else
$3 $4
])dnl ])dnl
fi fi
undefine(AC_LIB_NAME)dnl undefine(AC_LIB_NAME)dnl
undefine(AC_CV_NAME)dnl undefine(AC_CV_NAME)dnl
])dnl ])dnl
dnl dnl
dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl [, OTHER-LIBRARIES]]])
define(AC_HAVE_LIBRARY,
[AC_OBSOLETE([$0], [; instead use AC_CHECK_LIB])dnl
AC_CHECK_LIB([$1], main, [$2], [$3], [$4])dnl
])dnl
dnl
dnl dnl
dnl ### Checking for C features - fundamental (no caching) dnl ### Checking for C features - fundamental (no caching)
dnl dnl

@ -24,6 +24,23 @@ dnl
dnl ### Checks for programs dnl ### Checks for programs
dnl dnl
dnl dnl
dnl Check whether to use -n, \c, or newline-tab to separate
dnl checking messages from result messages.
dnl Idea borrowed from dist 3.0.
dnl Internal use only.
define(AC_PROG_ECHO_N,
[AC_PROVIDE([$0])dnl
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi])dnl
dnl
define(AC_PROG_CC, define(AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl [AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_PROVIDE([$0])dnl AC_PROVIDE([$0])dnl
@ -213,7 +230,7 @@ AC_MSG_CHECKING(for $LEX library)
if test -z "$LEXLIB" if test -z "$LEXLIB"
then then
case "$LEX" in case "$LEX" in
flex*) AC_CHECK_LIB(fl, LEXLIB="-lfl") ;; flex*) AC_CHECK_LIB(fl, main, LEXLIB="-lfl") ;;
*) LEXLIB="-ll" ;; *) LEXLIB="-ll" ;;
esac esac
fi fi
@ -953,15 +970,15 @@ AC_SUBST(NEED_SETGID)dnl
ac_have_func=no ac_have_func=no
# Check for the 4.4BSD definition of getloadavg. # Check for the 4.4BSD definition of getloadavg.
AC_CHECK_LIB(util, [LIBS="$LIBS -lutil" ac_have_func=yes AC_CHECK_LIB(util, getloadavg, [LIBS="$LIBS -lutil" ac_have_func=yes
# Some systems with -lutil have (and need) -lkvm as well, some do not. # Some systems with -lutil have (and need) -lkvm as well, some do not.
AC_CHECK_LIB(kvm, LIBS="$LIBS -lkvm")]) AC_CHECK_LIB(kvm, kvm_open, LIBS="$LIBS -lkvm")])
if test $ac_have_func = no; then if test $ac_have_func = no; then
# There is a commonly available library for RS/6000 AIX. # There is a commonly available library for RS/6000 AIX.
# Since it is not a standard part of AIX, it might be installed locally. # Since it is not a standard part of AIX, it might be installed locally.
ac_save_LIBS="$LIBS" LIBS="-L/usr/local/lib $LIBS" ac_save_LIBS="$LIBS" LIBS="-L/usr/local/lib $LIBS"
AC_CHECK_LIB(getloadavg, LIBS="$LIBS -lgetloadavg", LIBS="$ac_save_LIBS") AC_CHECK_LIB(getloadavg, getloadavg, LIBS="$LIBS -lgetloadavg", LIBS="$ac_save_LIBS")
fi fi
# Make sure it is really in the library, if we think we found it. # Make sure it is really in the library, if we think we found it.
@ -973,15 +990,14 @@ else
ac_have_func=no ac_have_func=no
AC_CHECK_HEADER(sys/dg_sys_info.h, AC_CHECK_HEADER(sys/dg_sys_info.h,
[ac_have_func=yes AC_DEFINE(DGUX) [ac_have_func=yes AC_DEFINE(DGUX)
# Some versions of DGUX need -ldgc for dg_sys_info. AC_CHECK_LIB(dgc, dg_sys_info)])
AC_CHECK_LIB(dgc)])
if test $ac_have_func = no; then if test $ac_have_func = no; then
# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
# uses stabs), but it is still SVR4. We cannot check for <elf.h> because # uses stabs), but it is still SVR4. We cannot check for <elf.h> because
# Irix 4.0.5F has the header but not the library. # Irix 4.0.5F has the header but not the library.
AC_CHECK_LIB(elf, AC_CHECK_LIB(elf, elf_read,
[LIBS="$LIBS -lelf" ac_have_func=yes AC_DEFINE(SVR4) [LIBS="$LIBS -lelf" ac_have_func=yes AC_DEFINE(SVR4)
AC_CHECK_LIB(kvm, LIBS="$LIBS -lkvm")]) AC_CHECK_LIB(kvm, kvm_open, LIBS="$LIBS -lkvm")])
fi fi
if test $ac_have_func = no; then if test $ac_have_func = no; then
AC_CHECK_HEADER(inq_stats/cpustats.h, AC_CHECK_HEADER(inq_stats/cpustats.h,
@ -1547,9 +1563,9 @@ dnl
dnl Internal subroutine of AC_PATH_X. dnl Internal subroutine of AC_PATH_X.
define(AC_PATH_X_DIRECT, define(AC_PATH_X_DIRECT,
[AC_CHECKING(for X include and library files directly) [AC_CHECKING(for X include and library files directly)
test -z "$x_direct_TRY_library" && x_direct_TRY_library=Xt test -z "$x_direct_test_library" && x_direct_test_library=Xt
test -z "$x_direct_TRY_include" && x_direct_TRY_include=X11/Intrinsic.h test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
AC_TRY_CPP([#include <$x_direct_TRY_include>], no_x=, AC_TRY_CPP([#include <$x_direct_test_include>], no_x=,
for ac_dir in \ for ac_dir in \
/usr/X11R6/include \ /usr/X11R6/include \
/usr/X11R5/include \ /usr/X11R5/include \
@ -1587,7 +1603,7 @@ AC_TRY_CPP([#include <$x_direct_TRY_include>], no_x=,
/usr/openwin/share/include \ /usr/openwin/share/include \
; \ ; \
do do
if test -r "$ac_dir/$x_direct_TRY_include"; then if test -r "$ac_dir/$x_direct_test_include"; then
test -z "$ac_cv_x_includes" && ac_cv_x_includes=$ac_dir test -z "$ac_cv_x_includes" && ac_cv_x_includes=$ac_dir
no_x= no_x=
break break
@ -1596,7 +1612,7 @@ AC_TRY_CPP([#include <$x_direct_TRY_include>], no_x=,
# Check for the libraries. First see if replacing the include by # Check for the libraries. First see if replacing the include by
# lib works. # lib works.
AC_CHECK_LIB("$x_direct_TRY_library", no_x=, AC_HAVE_LIBRARY("$x_direct_test_library", no_x=,
for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \ for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
/usr/X11R6/lib \ /usr/X11R6/lib \
/usr/X11R5/lib \ /usr/X11R5/lib \
@ -1635,7 +1651,7 @@ for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
; \ ; \
do do
for ac_extension in a so sl; do for ac_extension in a so sl; do
if test -r $ac_dir/lib${x_direct_TRY_library}.$ac_extension; then if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=$ac_dir test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=$ac_dir
no_x= no_x=
break 2 break 2
@ -1674,16 +1690,17 @@ else
# Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
# libraries were built with DECnet support. And karl@cs.umb.edu says # libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist). # the Alpha needs dnet_stub (dnet does not exist).
AC_CHECK_LIB(dnet, AC_CHECK_LIB(dnet, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ac_have_dnet=yes], ac_have_dnet=no) [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ac_have_dnet=yes], ac_have_dnet=no)
if test "$ac_have_dnet" = no; then if test "$ac_have_dnet" = no; then
AC_CHECK_LIB(dnet_stub, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) AC_CHECK_LIB(dnet_stub, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
fi fi
# lieder@skyler.mavd.honeywell.com says without -lsocket, # lieder@skyler.mavd.honeywell.com says without -lsocket,
# socket/setsockopt and other routines are undefined under SCO ODT 2.0. # socket/setsockopt and other routines are undefined under SCO ODT 2.0.
# But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch. # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
if test "`(uname) 2>/dev/null`" != IRIX; then if test "`(uname) 2>/dev/null`" != IRIX; then
AC_CHECK_LIB(socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"]) AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
fi fi
fi fi
# #
@ -1766,13 +1783,13 @@ fi
])dnl ])dnl
dnl dnl
define(AC_OS_SCO, define(AC_OS_SCO,
[AC_CHECK_LIB(intl, LIBS="$LIBS -lintl") [AC_CHECK_LIB(intl, strftime, LIBS="$LIBS -lintl")
])dnl ])dnl
dnl dnl
define(AC_OS_IRIX, define(AC_OS_IRIX,
[AC_CHECK_LIB(sun, LIBS="$LIBS -lsun") [AC_CHECK_LIB(sun, getmntent, LIBS="$LIBS -lsun")
])dnl ])dnl
dnl dnl
define(AC_OS_DYNIX, define(AC_OS_DYNIX,
[AC_CHECK_LIB(seq, LIBS="$LIBS -lseq") [AC_CHECK_LIB(seq, getmntent, LIBS="$LIBS -lseq")
])dnl ])dnl

@ -1904,18 +1904,21 @@ produces this in @file{configure}:
These macros check whether particular files exist. These macros check whether particular files exist.
@defmac AC_CHECK_LIB (@var{library} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]}) @defmac AC_CHECK_LIB (@var{library}, @var{function}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]})
@maindex CHECK_LIB @maindex CHECK_LIB
Create a test C program to see whether that program can be linked with Create a test C program to see whether that program can be linked with
the library @var{library}. @var{action-if-found} is a list of shell the library @var{library}. @var{function} should be the name of a
commands to run if the link succeeds (which means that the library is function that that library contains, to force the linker to try to link
present); @var{action-if-not-found} is a list of shell commands to run with the library to resolve the name.
if the link fails. If @var{action-if-found} and
@var{action-if-not-found} are not specified, the default action is to @var{action-if-found} is a list of shell commands to run if the link
add @samp{-lfoo} to @code{LIBS} and define @samp{HAVE_LIBfoo} succeeds (which means that the library is present);
for library @samp{foo}. @var{library} can be written as any of @var{action-if-not-found} is a list of shell commands to run if the link
@samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In all of those cases, fails. If @var{action-if-found} and @var{action-if-not-found} are not
the compiler is passed @samp{-lfoo}. specified, the default action is to add @samp{-lfoo} to @code{LIBS} and
define @samp{HAVE_LIBfoo} for library @samp{foo}. @var{library} can be
written as any of @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In all
of those cases, the compiler is passed @samp{-lfoo}.
If linking with @var{library} results in unresolved symbols, which would If linking with @var{library} results in unresolved symbols, which would
be resolved by linking with additional libraries, give those libraries be resolved by linking with additional libraries, give those libraries
@ -1925,6 +1928,14 @@ present, because linking the test program will always fail with
unresolved symbols. unresolved symbols.
@end defmac @end defmac
@defmac AC_HAVE_LIBRARY (@var{library}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]})
@maindex HAVE_LIBRARY
This macro is equivalent to calling @code{AC_CHECK_LIB} with a
@var{function} argument of @code{main}. It is considered obsolete,
because some linkers (e.g., Apollo's) do not fail when asked to link
with a nonexistent library if there are no unresolved sybols.
@end defmac
@defmac AC_PREFIX (@var{program}) @defmac AC_PREFIX (@var{program})
@maindex PREFIX @maindex PREFIX
This macro is like @code{AC_PREFIX_PROGRAM}, except that it prevents This macro is like @code{AC_PREFIX_PROGRAM}, except that it prevents
@ -2087,7 +2098,8 @@ shell commands @var{action-if-false}.
This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
on which language is current, @pxref{Language Choice}), if it hasn't on which language is current, @pxref{Language Choice}), if it hasn't
been called already. been called already. It does not use @code{CFLAGS}, because -g, -O,
etc. are not valid options to many C preprocessors.
@end defmac @end defmac
@defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) @defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@ -2096,7 +2108,9 @@ Create a test C program to see whether a function whose body consists of
@var{function-body} can be compiled and linked; @var{includes} is any @var{function-body} can be compiled and linked; @var{includes} is any
@code{#include} statements needed by the code in @var{function-body}. @code{#include} statements needed by the code in @var{function-body}.
If the file compiles and links successfully, run shell commands If the file compiles and links successfully, run shell commands
@var{action-if-found}, otherwise run @var{action-if-not-found}. @var{action-if-found}, otherwise run @var{action-if-not-found}. This
macro uses @code{CFLAGS} and @code{LDFLAGS} and @code{LIBS} when
compiling.
@end defmac @end defmac
@defmac AC_TRY_RUN (@var{program}, @var{action-if-true} @r{[}, @var{action-if-false} @r{[}, @var{action-if-cross-compiling}@r{]]}) @defmac AC_TRY_RUN (@var{program}, @var{action-if-true} @r{[}, @var{action-if-false} @r{[}, @var{action-if-cross-compiling}@r{]]})
@ -2105,14 +2119,18 @@ If the file compiles and links successfully, run shell commands
backquote substitutions are performed. If it compiles and links backquote substitutions are performed. If it compiles and links
successfully and returns an exit status of 0 when executed, run shell successfully and returns an exit status of 0 when executed, run shell
commands @var{action-if-true}. Otherwise run shell commands commands @var{action-if-true}. Otherwise run shell commands
@var{action-if-false}. @var{action-if-false}. This macro uses @code{CFLAGS} and @code{LDFLAGS}
and @code{LIBS} when compiling.
If the optional argument @var{action-if-cross-compiling} is given and If the C compiler being used does not produce executables that run on
the C compiler being used does not produce executables that run on the the system where @code{configure} is being run, then the test program is
system where @code{configure} is being run, then the test program is not not run. If the optional shell commands @var{action-if-cross-compiling}
run. Instead, the shell commands @var{action-if-cross-compiling} are are given, they are run instead and this macro calls @code{AC_C_CROSS}
run. If that argument is given, this macro calls @code{AC_C_CROSS}
if it has not already been called (@pxref{Compiler Characteristics}). if it has not already been called (@pxref{Compiler Characteristics}).
Otherwise, @code{configure} prints an error message and exits.
It is preferable to use @code{AC_TRY_LINK} instead of @code{AC_TRY_RUN},
when possible. @xref{Test Programs}, for more information.
@end defmac @end defmac
@node Command Line, Setting Variables, C Features, General Purpose Macros @node Command Line, Setting Variables, C Features, General Purpose Macros
@ -2945,7 +2963,7 @@ exists on the system or has a certain value, then you can't use
test program by hand. You can compile and run it using test program by hand. You can compile and run it using
@code{AC_TRY_RUN} (@pxref{C Features}). @code{AC_TRY_RUN} (@pxref{C Features}).
Try to avoid writing test programs if possible, because using them Try to avoid running test programs if possible, because using them
prevents people from configuring your package for cross-compiling. If prevents people from configuring your package for cross-compiling. If
it's really best that you test for a run-time behavior, try to provide a it's really best that you test for a run-time behavior, try to provide a
default ``worst case'' value to use when cross-compiling makes run-time default ``worst case'' value to use when cross-compiling makes run-time
@ -3477,11 +3495,12 @@ code are really appropriate to be in them. Besides a cache file, they
are good places to set default values for other shell variables like are good places to set default values for other shell variables like
@code{CC}, if you need to give them unusual values: anything you would @code{CC}, if you need to give them unusual values: anything you would
normally do, repetitively, on the command line. If you use non-default normally do, repetitively, on the command line. If you use non-default
values for @var{prefix} or @var{exec_prefix}, you can't set them in the values for @var{prefix} or @var{exec_prefix} (wherever you locate the
site file, since you have to specify them on the command line in order site file), you can't set them in the site file, since you have to
for @code{configure} to find the site file! specify them on the command line in order for @code{configure} to find
the site file!
In addition, it is possible to set some cache values in the site file. It is possible to set some cache values in the site file.
If you are cross-compiling, it is impossible to check features that If you are cross-compiling, it is impossible to check features that
require running a test program. You could ``prime the cache'' by require running a test program. You could ``prime the cache'' by
setting those values correctly for that system in setting those values correctly for that system in
@ -3492,6 +3511,20 @@ check that variables such as @code{prefix} and @code{cache_file} have
their default values (as set near the top of @code{configure}) before their default values (as set near the top of @code{configure}) before
changing them. changing them.
Here is a sample file @file{/usr/share/local/gnu/lib/config.site}.
@samp{configure --prefix=/usr/share/local/gnu} would read this file.
@example
# config.site for configure
#
# Give Autoconf 2.x generated configure scripts a shared default
# cache file for feature test results, architecture-specific.
test $cache_file = ./config.cache &&
cache_file=/usr/local/gnu/lib/config.cache
# Also, if you give --prefix, you get --exec-prefix automatically.
test $exec_prefix = NONE && exec_prefix=/usr/local/gnu
@end example
@node Old Macro Names, Example, Site Default Values, Top @node Old Macro Names, Example, Site Default Values, Top
@chapter Old Macro Names @chapter Old Macro Names
@ -3539,10 +3572,6 @@ for backward compatibility, the old names are considered obsolete.
@vindex PROGRAMS_PATH @vindex PROGRAMS_PATH
@vindex PATH_PROGS @vindex PATH_PROGS
@code{AC_PATH_PROGS} @code{AC_PATH_PROGS}
@item AC_HAVE_LIBRARY
@vindex HAVE_LIBRARY
@vindex CHECK_LIB
@code{AC_CHECK_LIB}
@item AC_HEADER_EGREP @item AC_HEADER_EGREP
@vindex HEADER_EGREP @vindex HEADER_EGREP
@vindex EGREP_HEADER @vindex EGREP_HEADER

@ -1904,18 +1904,21 @@ produces this in @file{configure}:
These macros check whether particular files exist. These macros check whether particular files exist.
@defmac AC_CHECK_LIB (@var{library} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]}) @defmac AC_CHECK_LIB (@var{library}, @var{function}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]})
@maindex CHECK_LIB @maindex CHECK_LIB
Create a test C program to see whether that program can be linked with Create a test C program to see whether that program can be linked with
the library @var{library}. @var{action-if-found} is a list of shell the library @var{library}. @var{function} should be the name of a
commands to run if the link succeeds (which means that the library is function that that library contains, to force the linker to try to link
present); @var{action-if-not-found} is a list of shell commands to run with the library to resolve the name.
if the link fails. If @var{action-if-found} and
@var{action-if-not-found} are not specified, the default action is to @var{action-if-found} is a list of shell commands to run if the link
add @samp{-lfoo} to @code{LIBS} and define @samp{HAVE_LIBfoo} succeeds (which means that the library is present);
for library @samp{foo}. @var{library} can be written as any of @var{action-if-not-found} is a list of shell commands to run if the link
@samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In all of those cases, fails. If @var{action-if-found} and @var{action-if-not-found} are not
the compiler is passed @samp{-lfoo}. specified, the default action is to add @samp{-lfoo} to @code{LIBS} and
define @samp{HAVE_LIBfoo} for library @samp{foo}. @var{library} can be
written as any of @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In all
of those cases, the compiler is passed @samp{-lfoo}.
If linking with @var{library} results in unresolved symbols, which would If linking with @var{library} results in unresolved symbols, which would
be resolved by linking with additional libraries, give those libraries be resolved by linking with additional libraries, give those libraries
@ -1925,6 +1928,14 @@ present, because linking the test program will always fail with
unresolved symbols. unresolved symbols.
@end defmac @end defmac
@defmac AC_HAVE_LIBRARY (@var{library}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]})
@maindex HAVE_LIBRARY
This macro is equivalent to calling @code{AC_CHECK_LIB} with a
@var{function} argument of @code{main}. It is considered obsolete,
because some linkers (e.g., Apollo's) do not fail when asked to link
with a nonexistent library if there are no unresolved sybols.
@end defmac
@defmac AC_PREFIX (@var{program}) @defmac AC_PREFIX (@var{program})
@maindex PREFIX @maindex PREFIX
This macro is like @code{AC_PREFIX_PROGRAM}, except that it prevents This macro is like @code{AC_PREFIX_PROGRAM}, except that it prevents
@ -2087,7 +2098,8 @@ shell commands @var{action-if-false}.
This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
on which language is current, @pxref{Language Choice}), if it hasn't on which language is current, @pxref{Language Choice}), if it hasn't
been called already. been called already. It does not use @code{CFLAGS}, because -g, -O,
etc. are not valid options to many C preprocessors.
@end defmac @end defmac
@defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) @defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@ -2096,7 +2108,9 @@ Create a test C program to see whether a function whose body consists of
@var{function-body} can be compiled and linked; @var{includes} is any @var{function-body} can be compiled and linked; @var{includes} is any
@code{#include} statements needed by the code in @var{function-body}. @code{#include} statements needed by the code in @var{function-body}.
If the file compiles and links successfully, run shell commands If the file compiles and links successfully, run shell commands
@var{action-if-found}, otherwise run @var{action-if-not-found}. @var{action-if-found}, otherwise run @var{action-if-not-found}. This
macro uses @code{CFLAGS} and @code{LDFLAGS} and @code{LIBS} when
compiling.
@end defmac @end defmac
@defmac AC_TRY_RUN (@var{program}, @var{action-if-true} @r{[}, @var{action-if-false} @r{[}, @var{action-if-cross-compiling}@r{]]}) @defmac AC_TRY_RUN (@var{program}, @var{action-if-true} @r{[}, @var{action-if-false} @r{[}, @var{action-if-cross-compiling}@r{]]})
@ -2105,14 +2119,18 @@ If the file compiles and links successfully, run shell commands
backquote substitutions are performed. If it compiles and links backquote substitutions are performed. If it compiles and links
successfully and returns an exit status of 0 when executed, run shell successfully and returns an exit status of 0 when executed, run shell
commands @var{action-if-true}. Otherwise run shell commands commands @var{action-if-true}. Otherwise run shell commands
@var{action-if-false}. @var{action-if-false}. This macro uses @code{CFLAGS} and @code{LDFLAGS}
and @code{LIBS} when compiling.
If the optional argument @var{action-if-cross-compiling} is given and If the C compiler being used does not produce executables that run on
the C compiler being used does not produce executables that run on the the system where @code{configure} is being run, then the test program is
system where @code{configure} is being run, then the test program is not not run. If the optional shell commands @var{action-if-cross-compiling}
run. Instead, the shell commands @var{action-if-cross-compiling} are are given, they are run instead and this macro calls @code{AC_C_CROSS}
run. If that argument is given, this macro calls @code{AC_C_CROSS}
if it has not already been called (@pxref{Compiler Characteristics}). if it has not already been called (@pxref{Compiler Characteristics}).
Otherwise, @code{configure} prints an error message and exits.
It is preferable to use @code{AC_TRY_LINK} instead of @code{AC_TRY_RUN},
when possible. @xref{Test Programs}, for more information.
@end defmac @end defmac
@node Command Line, Setting Variables, C Features, General Purpose Macros @node Command Line, Setting Variables, C Features, General Purpose Macros
@ -2945,7 +2963,7 @@ exists on the system or has a certain value, then you can't use
test program by hand. You can compile and run it using test program by hand. You can compile and run it using
@code{AC_TRY_RUN} (@pxref{C Features}). @code{AC_TRY_RUN} (@pxref{C Features}).
Try to avoid writing test programs if possible, because using them Try to avoid running test programs if possible, because using them
prevents people from configuring your package for cross-compiling. If prevents people from configuring your package for cross-compiling. If
it's really best that you test for a run-time behavior, try to provide a it's really best that you test for a run-time behavior, try to provide a
default ``worst case'' value to use when cross-compiling makes run-time default ``worst case'' value to use when cross-compiling makes run-time
@ -3477,11 +3495,12 @@ code are really appropriate to be in them. Besides a cache file, they
are good places to set default values for other shell variables like are good places to set default values for other shell variables like
@code{CC}, if you need to give them unusual values: anything you would @code{CC}, if you need to give them unusual values: anything you would
normally do, repetitively, on the command line. If you use non-default normally do, repetitively, on the command line. If you use non-default
values for @var{prefix} or @var{exec_prefix}, you can't set them in the values for @var{prefix} or @var{exec_prefix} (wherever you locate the
site file, since you have to specify them on the command line in order site file), you can't set them in the site file, since you have to
for @code{configure} to find the site file! specify them on the command line in order for @code{configure} to find
the site file!
In addition, it is possible to set some cache values in the site file. It is possible to set some cache values in the site file.
If you are cross-compiling, it is impossible to check features that If you are cross-compiling, it is impossible to check features that
require running a test program. You could ``prime the cache'' by require running a test program. You could ``prime the cache'' by
setting those values correctly for that system in setting those values correctly for that system in
@ -3492,6 +3511,20 @@ check that variables such as @code{prefix} and @code{cache_file} have
their default values (as set near the top of @code{configure}) before their default values (as set near the top of @code{configure}) before
changing them. changing them.
Here is a sample file @file{/usr/share/local/gnu/lib/config.site}.
@samp{configure --prefix=/usr/share/local/gnu} would read this file.
@example
# config.site for configure
#
# Give Autoconf 2.x generated configure scripts a shared default
# cache file for feature test results, architecture-specific.
test $cache_file = ./config.cache &&
cache_file=/usr/local/gnu/lib/config.cache
# Also, if you give --prefix, you get --exec-prefix automatically.
test $exec_prefix = NONE && exec_prefix=/usr/local/gnu
@end example
@node Old Macro Names, Example, Site Default Values, Top @node Old Macro Names, Example, Site Default Values, Top
@chapter Old Macro Names @chapter Old Macro Names
@ -3539,10 +3572,6 @@ for backward compatibility, the old names are considered obsolete.
@vindex PROGRAMS_PATH @vindex PROGRAMS_PATH
@vindex PATH_PROGS @vindex PATH_PROGS
@code{AC_PATH_PROGS} @code{AC_PATH_PROGS}
@item AC_HAVE_LIBRARY
@vindex HAVE_LIBRARY
@vindex CHECK_LIB
@code{AC_CHECK_LIB}
@item AC_HEADER_EGREP @item AC_HEADER_EGREP
@vindex HEADER_EGREP @vindex HEADER_EGREP
@vindex EGREP_HEADER @vindex EGREP_HEADER

@ -756,7 +756,7 @@ fi
for ac_site_dir in $ac_site_dirs; do for ac_site_dir in $ac_site_dirs; do
ac_site_file=$ac_site_dir/lib/config.site ac_site_file=$ac_site_dir/lib/config.site
if test -r "$ac_site_file"; then if test -r "$ac_site_file"; then
echo "loading site initialization script $ac_site_file" echo "loading site script $ac_site_file"
. $ac_site_file . $ac_site_file
fi fi
done done
@ -764,16 +764,16 @@ done
dnl dnl
define(AC_CACHE_LOAD, define(AC_CACHE_LOAD,
[if test -r "$cache_file"; then [if test -r "$cache_file"; then
echo "loading test results from cache file $cache_file" echo "loading cache $cache_file"
. $cache_file . $cache_file
else else
echo "creating new cache file $cache_file" echo "creating cache $cache_file"
> $cache_file > $cache_file
fi])dnl fi])dnl
dnl dnl
define(AC_CACHE_SAVE, define(AC_CACHE_SAVE,
[if test -w $cache_file; then [if test -w $cache_file; then
echo "saving test results in cache file $cache_file" echo "updating cache $cache_file"
cat > $cache_file <<\CEOF cat > $cache_file <<\CEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure # tests run on this system so they can be shared between configure
@ -798,7 +798,7 @@ dnl
dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT)
dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved. dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
define(AC_CACHE_VAL, define(AC_CACHE_VAL,
[AC_REQUIRE([AC_MSG_ECHO_N])dnl [AC_REQUIRE([AC_PROG_ECHO_N])dnl
dnl We used to use the below line, but it fails if the 1st arg is a dnl We used to use the below line, but it fails if the 1st arg is a
dnl shell variable, so we need the eval. dnl shell variable, so we need the eval.
dnl if test "${$1+set}" = set; then dnl if test "${$1+set}" = set; then
@ -932,37 +932,20 @@ dnl
dnl ### Printing messages dnl ### Printing messages
dnl dnl
dnl dnl
dnl Check whether to use -n, \c, or newline-tab to separate
dnl checking messages from result messages.
define(AC_MSG_ECHO_N,
[AC_PROVIDE([$0])dnl
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi])dnl
dnl
dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION) dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)
define(AC_MSG_CHECKING, define(AC_MSG_CHECKING,
[AC_REQUIRE([AC_MSG_ECHO_N])dnl [AC_REQUIRE([AC_PROG_ECHO_N])dnl
echo $ac_n "checking $1""...$ac_c" 1>&4])dnl echo $ac_n "checking $1""... $ac_c" 1>&4])dnl
dnl dnl
dnl Obsolete version.
define(AC_CHECKING, define(AC_CHECKING,
[AC_OBSOLETE([$0], [; instead use AC_MSG_CHECKING])dnl [AC_OBSOLETE([$0], [; instead use AC_MSG_CHECKING])dnl
echo "checking $1" 1>&4])dnl echo "checking $1" 1>&4])dnl
dnl dnl
dnl AC_MSG_RESULT(RESULT-DESCRIPTION) dnl AC_MSG_RESULT(RESULT-DESCRIPTION)
define(AC_MSG_RESULT, define(AC_MSG_RESULT,
[AC_REQUIRE([AC_MSG_ECHO_N])dnl [AC_REQUIRE([AC_PROG_ECHO_N])dnl
echo "$ac_t""$1" 1>&4])dnl echo "$ac_t""$1" 1>&4])dnl
dnl dnl
dnl Obsolete version.
define(AC_VERBOSE, define(AC_VERBOSE,
[AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl [AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl
echo " $1" 1>&4])dnl echo " $1" 1>&4])dnl
@ -1115,10 +1098,10 @@ done
ifelse([$3], , , [test -n "[$]$1" || $1="$3" ifelse([$3], , , [test -n "[$]$1" || $1="$3"
])])dnl ])])dnl
dnl dnl
dnl AC_CHECK_LIB(LIBRARY [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND dnl AC_CHECK_LIB(LIBRARY, FUNCTION, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl [, OTHER-LIBRARIES]]]) dnl [, OTHER-LIBRARIES]]])
define(AC_CHECK_LIB, [dnl define(AC_CHECK_LIB,
changequote(/, /)dnl [changequote(/, /)dnl
define(/AC_LIB_NAME/, dnl define(/AC_LIB_NAME/, dnl
patsubst(patsubst($1, /lib\([^\.]*\)\.a/, /\1/), /-l/, //))dnl patsubst(patsubst($1, /lib\([^\.]*\)\.a/, /\1/), /-l/, //))dnl
define(/AC_CV_NAME/, ac_cv_lib_//AC_LIB_NAME)dnl define(/AC_CV_NAME/, ac_cv_lib_//AC_LIB_NAME)dnl
@ -1126,24 +1109,31 @@ changequote([, ])dnl
AC_MSG_CHECKING([for -l[]AC_LIB_NAME]) AC_MSG_CHECKING([for -l[]AC_LIB_NAME])
AC_CACHE_VAL(AC_CV_NAME, AC_CACHE_VAL(AC_CV_NAME,
[ac_save_LIBS="${LIBS}" [ac_save_LIBS="${LIBS}"
LIBS="${LIBS} -l[]AC_LIB_NAME[] $4" LIBS="${LIBS} -l[]AC_LIB_NAME[] $5"
AC_TRY_LINK( , [main();], AC_CV_NAME=yes, AC_CV_NAME=no)dnl AC_TRY_LINK( , [$2()], AC_CV_NAME=yes, AC_CV_NAME=no)dnl
LIBS="${ac_save_LIBS}" LIBS="${ac_save_LIBS}"
])dnl ])dnl
AC_MSG_RESULT($AC_CV_NAME) AC_MSG_RESULT($AC_CV_NAME)
if test "${AC_CV_NAME}" = yes; then if test "${AC_CV_NAME}" = yes; then
ifelse([$2], , ifelse([$3], ,
[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z])) [AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
LIBS="${LIBS} -l[]AC_LIB_NAME[]" LIBS="${LIBS} -l[]AC_LIB_NAME[]"
], [$2]) ], [$3])
ifelse([$3], , , [else ifelse([$4], , , [else
$3 $4
])dnl ])dnl
fi fi
undefine(AC_LIB_NAME)dnl undefine(AC_LIB_NAME)dnl
undefine(AC_CV_NAME)dnl undefine(AC_CV_NAME)dnl
])dnl ])dnl
dnl dnl
dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl [, OTHER-LIBRARIES]]])
define(AC_HAVE_LIBRARY,
[AC_OBSOLETE([$0], [; instead use AC_CHECK_LIB])dnl
AC_CHECK_LIB([$1], main, [$2], [$3], [$4])dnl
])dnl
dnl
dnl dnl
dnl ### Checking for C features - fundamental (no caching) dnl ### Checking for C features - fundamental (no caching)
dnl dnl

@ -24,6 +24,23 @@ dnl
dnl ### Checks for programs dnl ### Checks for programs
dnl dnl
dnl dnl
dnl Check whether to use -n, \c, or newline-tab to separate
dnl checking messages from result messages.
dnl Idea borrowed from dist 3.0.
dnl Internal use only.
define(AC_PROG_ECHO_N,
[AC_PROVIDE([$0])dnl
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi])dnl
dnl
define(AC_PROG_CC, define(AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl [AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_PROVIDE([$0])dnl AC_PROVIDE([$0])dnl
@ -213,7 +230,7 @@ AC_MSG_CHECKING(for $LEX library)
if test -z "$LEXLIB" if test -z "$LEXLIB"
then then
case "$LEX" in case "$LEX" in
flex*) AC_CHECK_LIB(fl, LEXLIB="-lfl") ;; flex*) AC_CHECK_LIB(fl, main, LEXLIB="-lfl") ;;
*) LEXLIB="-ll" ;; *) LEXLIB="-ll" ;;
esac esac
fi fi
@ -953,15 +970,15 @@ AC_SUBST(NEED_SETGID)dnl
ac_have_func=no ac_have_func=no
# Check for the 4.4BSD definition of getloadavg. # Check for the 4.4BSD definition of getloadavg.
AC_CHECK_LIB(util, [LIBS="$LIBS -lutil" ac_have_func=yes AC_CHECK_LIB(util, getloadavg, [LIBS="$LIBS -lutil" ac_have_func=yes
# Some systems with -lutil have (and need) -lkvm as well, some do not. # Some systems with -lutil have (and need) -lkvm as well, some do not.
AC_CHECK_LIB(kvm, LIBS="$LIBS -lkvm")]) AC_CHECK_LIB(kvm, kvm_open, LIBS="$LIBS -lkvm")])
if test $ac_have_func = no; then if test $ac_have_func = no; then
# There is a commonly available library for RS/6000 AIX. # There is a commonly available library for RS/6000 AIX.
# Since it is not a standard part of AIX, it might be installed locally. # Since it is not a standard part of AIX, it might be installed locally.
ac_save_LIBS="$LIBS" LIBS="-L/usr/local/lib $LIBS" ac_save_LIBS="$LIBS" LIBS="-L/usr/local/lib $LIBS"
AC_CHECK_LIB(getloadavg, LIBS="$LIBS -lgetloadavg", LIBS="$ac_save_LIBS") AC_CHECK_LIB(getloadavg, getloadavg, LIBS="$LIBS -lgetloadavg", LIBS="$ac_save_LIBS")
fi fi
# Make sure it is really in the library, if we think we found it. # Make sure it is really in the library, if we think we found it.
@ -973,15 +990,14 @@ else
ac_have_func=no ac_have_func=no
AC_CHECK_HEADER(sys/dg_sys_info.h, AC_CHECK_HEADER(sys/dg_sys_info.h,
[ac_have_func=yes AC_DEFINE(DGUX) [ac_have_func=yes AC_DEFINE(DGUX)
# Some versions of DGUX need -ldgc for dg_sys_info. AC_CHECK_LIB(dgc, dg_sys_info)])
AC_CHECK_LIB(dgc)])
if test $ac_have_func = no; then if test $ac_have_func = no; then
# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
# uses stabs), but it is still SVR4. We cannot check for <elf.h> because # uses stabs), but it is still SVR4. We cannot check for <elf.h> because
# Irix 4.0.5F has the header but not the library. # Irix 4.0.5F has the header but not the library.
AC_CHECK_LIB(elf, AC_CHECK_LIB(elf, elf_read,
[LIBS="$LIBS -lelf" ac_have_func=yes AC_DEFINE(SVR4) [LIBS="$LIBS -lelf" ac_have_func=yes AC_DEFINE(SVR4)
AC_CHECK_LIB(kvm, LIBS="$LIBS -lkvm")]) AC_CHECK_LIB(kvm, kvm_open, LIBS="$LIBS -lkvm")])
fi fi
if test $ac_have_func = no; then if test $ac_have_func = no; then
AC_CHECK_HEADER(inq_stats/cpustats.h, AC_CHECK_HEADER(inq_stats/cpustats.h,
@ -1547,9 +1563,9 @@ dnl
dnl Internal subroutine of AC_PATH_X. dnl Internal subroutine of AC_PATH_X.
define(AC_PATH_X_DIRECT, define(AC_PATH_X_DIRECT,
[AC_CHECKING(for X include and library files directly) [AC_CHECKING(for X include and library files directly)
test -z "$x_direct_TRY_library" && x_direct_TRY_library=Xt test -z "$x_direct_test_library" && x_direct_test_library=Xt
test -z "$x_direct_TRY_include" && x_direct_TRY_include=X11/Intrinsic.h test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
AC_TRY_CPP([#include <$x_direct_TRY_include>], no_x=, AC_TRY_CPP([#include <$x_direct_test_include>], no_x=,
for ac_dir in \ for ac_dir in \
/usr/X11R6/include \ /usr/X11R6/include \
/usr/X11R5/include \ /usr/X11R5/include \
@ -1587,7 +1603,7 @@ AC_TRY_CPP([#include <$x_direct_TRY_include>], no_x=,
/usr/openwin/share/include \ /usr/openwin/share/include \
; \ ; \
do do
if test -r "$ac_dir/$x_direct_TRY_include"; then if test -r "$ac_dir/$x_direct_test_include"; then
test -z "$ac_cv_x_includes" && ac_cv_x_includes=$ac_dir test -z "$ac_cv_x_includes" && ac_cv_x_includes=$ac_dir
no_x= no_x=
break break
@ -1596,7 +1612,7 @@ AC_TRY_CPP([#include <$x_direct_TRY_include>], no_x=,
# Check for the libraries. First see if replacing the include by # Check for the libraries. First see if replacing the include by
# lib works. # lib works.
AC_CHECK_LIB("$x_direct_TRY_library", no_x=, AC_HAVE_LIBRARY("$x_direct_test_library", no_x=,
for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \ for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
/usr/X11R6/lib \ /usr/X11R6/lib \
/usr/X11R5/lib \ /usr/X11R5/lib \
@ -1635,7 +1651,7 @@ for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
; \ ; \
do do
for ac_extension in a so sl; do for ac_extension in a so sl; do
if test -r $ac_dir/lib${x_direct_TRY_library}.$ac_extension; then if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=$ac_dir test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=$ac_dir
no_x= no_x=
break 2 break 2
@ -1674,16 +1690,17 @@ else
# Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
# libraries were built with DECnet support. And karl@cs.umb.edu says # libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist). # the Alpha needs dnet_stub (dnet does not exist).
AC_CHECK_LIB(dnet, AC_CHECK_LIB(dnet, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ac_have_dnet=yes], ac_have_dnet=no) [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ac_have_dnet=yes], ac_have_dnet=no)
if test "$ac_have_dnet" = no; then if test "$ac_have_dnet" = no; then
AC_CHECK_LIB(dnet_stub, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) AC_CHECK_LIB(dnet_stub, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
fi fi
# lieder@skyler.mavd.honeywell.com says without -lsocket, # lieder@skyler.mavd.honeywell.com says without -lsocket,
# socket/setsockopt and other routines are undefined under SCO ODT 2.0. # socket/setsockopt and other routines are undefined under SCO ODT 2.0.
# But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch. # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
if test "`(uname) 2>/dev/null`" != IRIX; then if test "`(uname) 2>/dev/null`" != IRIX; then
AC_CHECK_LIB(socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"]) AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
fi fi
fi fi
# #
@ -1766,13 +1783,13 @@ fi
])dnl ])dnl
dnl dnl
define(AC_OS_SCO, define(AC_OS_SCO,
[AC_CHECK_LIB(intl, LIBS="$LIBS -lintl") [AC_CHECK_LIB(intl, strftime, LIBS="$LIBS -lintl")
])dnl ])dnl
dnl dnl
define(AC_OS_IRIX, define(AC_OS_IRIX,
[AC_CHECK_LIB(sun, LIBS="$LIBS -lsun") [AC_CHECK_LIB(sun, getmntent, LIBS="$LIBS -lsun")
])dnl ])dnl
dnl dnl
define(AC_OS_DYNIX, define(AC_OS_DYNIX,
[AC_CHECK_LIB(seq, LIBS="$LIBS -lseq") [AC_CHECK_LIB(seq, getmntent, LIBS="$LIBS -lseq")
])dnl ])dnl