* acspecific.m4 (AC_PROG_CXX_WORKS): Specify an explicit return
type for `main' to keep modern C++ compilers happy.
+1998-12-28 Jeff Garzik <jgarzik@pobox.com>
+
+ * autoconf.texi:
+ (AC_SEARCH_LIBS, AC_CHECK_FILE, AC_CHECK_FILES,
+ AC_TRY_LINK_FUNC): Document.
+ (AC_CHECK_LIB): Indicate the absence of
+ action-if-not-found will not kill default action.
+ (AC_SYS_INTERPRETER): Alphabetize with rest of section,
+ s/ac_cv_sys_interpreter/interpval/
+
+ * acgeneral.m4:
+ (AC_TRY_LINK_FUNC): Fix arg transposition.
+ (AC_SEARCH_LIBS): Require autoconf 2.13, add other-libs arg.
+ (AC_CHECK_FILES): Add underscore to HAVE_file define.
+
+ * acspecific.m4:
+ (AC_SYS_INTERPRETER): New shell var 'interpval' stores
+ internal var ac_cv_sys_interpreter.
+
1998-12-27 Ben Elliston <bje@cygnus.com>
* autoconf.texi (AC_PROG_INSTALL): Update.
AC_DEFUN(AC_TRY_LINK_FUNC,
AC_TRY_LINK(dnl
-ifelse([$2], [main], , dnl Avoid conflicting decl of main.
+ifelse([$1], [main], , dnl Avoid conflicting decl of main.
[/* Override any gcc2 internal prototype to avoid an error. */
]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
extern "C"
[$3]))
-dnl AC_SEARCH_LIBS(func, searchlibs, [action-if-found], [action-if-not-found])
+dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
+dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
dnl Search for a library defining FUNC, if it's not already available.
AC_DEFUN(AC_SEARCH_LIBS,
-[AC_PREREQ([2.12])
+[AC_PREREQ([2.13])
AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
[ac_func_search_save_LIBS="$LIBS"
ac_cv_search_$1="no"
AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
test "$ac_cv_search_$1" = "no" && for i in $2; do
-LIBS="-l$i $ac_func_search_save_LIBS"
+LIBS="-l$i $5 $ac_func_search_save_LIBS"
AC_TRY_LINK_FUNC([$1],
[ac_cv_search_$1="-l$i"
break])
do
AC_CHECK_FILE($ac_file,
[changequote(, )dnl
- ac_tr_file=HAVE`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ ac_tr_file=HAVE_`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
changequote([, ])dnl
AC_DEFINE_UNQUOTED($ac_tr_file) $2], $3)dnl
done
ac_cv_sys_interpreter=no
fi
rm -f conftest])
+interpval="$ac_cv_sys_interpreter"
])
define(AC_HAVE_POUNDBANG,
the @var{library} argument.
@var{action-if-found} is a list of shell commands to run if the link
-with the library succeeds; @var{action-if-not-found} is a list of shell
-commands to run if the link fails. If @var{action-if-found} and
-@var{action-if-not-found} are not specified, the default action is to
-add @samp{-l@var{library}} to @code{LIBS} and define
-@samp{HAVE_LIB@var{library}} (in all capitals).
+with the library succeeds; @var{action-if-not-found} is a list of
+shell commands to run if the link fails. If @var{action-if-found} is
+not specified, the default action will add @samp{-l@var{library}} to
+@code{LIBS} and define @samp{HAVE_LIB@var{library}} (in all capitals).
If linking with @var{library} results in unresolved symbols, which would
be resolved by linking with additional libraries, give those libraries
This macro is considered obsolete.
@end defmac
+@defmac AC_SEARCH_LIBS (@var{function}, @var{search-libs} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]})
+@maindex SEARCH_LIBS
+Search for a library defining @var{function}, if it's not already
+available. This equates to calling @code{AC_TRY_LINK_FUNC} first
+with no libraries, then for each library listed in @var{search-libs}.
+
+If the function is found, run @var{action-if-found}, otherwise run
+@var{action-if-not-found}.
+
+If linking with @var{library} results in unresolved symbols, which would
+be resolved by linking with additional libraries, give those libraries
+as the @var{other-libraries} argument, separated by spaces: @samp{-lXt
+-lX11}. Otherwise this macro will fail to detect that @var{function} is
+present, because linking the test program will always fail with
+unresolved symbols.
+@end defmac
+
@node Library Functions, Header Files, Libraries, Existing Tests
@section Library Functions
The following macros check for operating system services or capabilities.
-@defmac AC_SYS_INTERPRETER
-@maindex SYS_INTERPRETER
-Check whether the system supports starting scripts with a line of the
-form @samp{#! /bin/csh} to select the interpreter to use for the script.
-After running this macro, shell code in @code{configure.in} can check
-the variable @code{ac_cv_sys_interpreter}; it will be set to @samp{yes}
-if the system supports @samp{#!}, @samp{no} if not.
+
+@defmac AC_CHECK_FILE (@var{file}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]})
+@maindex CHECK_FILE
+Checks for the existence of @var{file} in the native file system.
+This macro will generate a fatal error if cross-compiling.
+
+If the file is found and readable, run shell commands
+@var{action-if-found}, otherwise run @var{action-if-not-found}.
+@end defmac
+
+@defmac AC_CHECK_FILES (@var{files}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]})
+@maindex CHECK_FILES
+Checks for the existence of @var{files} in the native file system.
+This is equivalent to running @code{AC_CHECK_FILE} for each file
+in @var{files}. This macro will generate a fatal error if
+cross-compiling.
+
+For each readable file found, run shell commands @var{action-if-found}
+and define @samp{HAVE_@var{file}} (in all capitals), otherwise run
+@var{action-if-not-found}.
@end defmac
@defmac AC_PATH_X
@c @code{LIBS} temporarily, like this:
@end defmac
+@defmac AC_SYS_INTERPRETER
+@maindex SYS_INTERPRETER
+Check whether the system supports starting scripts with a line of the
+form @samp{#! /bin/csh} to select the interpreter to use for the script.
+After running this macro, shell code in @code{configure.in} can check
+the shell variable @code{interpval}; it will be set to @samp{yes}
+if the system supports @samp{#!}, @samp{no} if not.
+@end defmac
+
@defmac AC_SYS_LONG_FILE_NAMES
@maindex SYS_LONG_FILE_NAMES
@cvindex HAVE_LONG_FILE_NAMES
@var{action-if-found}, otherwise run @var{action-if-not-found}.
@end defmac
+@defmac AC_TRY_LINK_FUNC (@var{function}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]})
+@maindex TRY_LINK_FUNC
+Depending on the current language (@pxref{Language Choice}), create a
+test program to see whether a program whose body consists of
+a prototype of and a call to @var{function} can be compiled and linked.
+
+If the file compiles and links successfully, run shell commands
+@var{action-if-found}, otherwise run @var{action-if-not-found}.
+@end defmac
+
@defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex COMPILE_CHECK
This is an obsolete version of @code{AC_TRY_LINK}, with the addition
the @var{library} argument.
@var{action-if-found} is a list of shell commands to run if the link
-with the library succeeds; @var{action-if-not-found} is a list of shell
-commands to run if the link fails. If @var{action-if-found} and
-@var{action-if-not-found} are not specified, the default action is to
-add @samp{-l@var{library}} to @code{LIBS} and define
-@samp{HAVE_LIB@var{library}} (in all capitals).
+with the library succeeds; @var{action-if-not-found} is a list of
+shell commands to run if the link fails. If @var{action-if-found} is
+not specified, the default action will add @samp{-l@var{library}} to
+@code{LIBS} and define @samp{HAVE_LIB@var{library}} (in all capitals).
If linking with @var{library} results in unresolved symbols, which would
be resolved by linking with additional libraries, give those libraries
This macro is considered obsolete.
@end defmac
+@defmac AC_SEARCH_LIBS (@var{function}, @var{search-libs} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]})
+@maindex SEARCH_LIBS
+Search for a library defining @var{function}, if it's not already
+available. This equates to calling @code{AC_TRY_LINK_FUNC} first
+with no libraries, then for each library listed in @var{search-libs}.
+
+If the function is found, run @var{action-if-found}, otherwise run
+@var{action-if-not-found}.
+
+If linking with @var{library} results in unresolved symbols, which would
+be resolved by linking with additional libraries, give those libraries
+as the @var{other-libraries} argument, separated by spaces: @samp{-lXt
+-lX11}. Otherwise this macro will fail to detect that @var{function} is
+present, because linking the test program will always fail with
+unresolved symbols.
+@end defmac
+
@node Library Functions, Header Files, Libraries, Existing Tests
@section Library Functions
The following macros check for operating system services or capabilities.
-@defmac AC_SYS_INTERPRETER
-@maindex SYS_INTERPRETER
-Check whether the system supports starting scripts with a line of the
-form @samp{#! /bin/csh} to select the interpreter to use for the script.
-After running this macro, shell code in @code{configure.in} can check
-the variable @code{ac_cv_sys_interpreter}; it will be set to @samp{yes}
-if the system supports @samp{#!}, @samp{no} if not.
+
+@defmac AC_CHECK_FILE (@var{file}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]})
+@maindex CHECK_FILE
+Checks for the existence of @var{file} in the native file system.
+This macro will generate a fatal error if cross-compiling.
+
+If the file is found and readable, run shell commands
+@var{action-if-found}, otherwise run @var{action-if-not-found}.
+@end defmac
+
+@defmac AC_CHECK_FILES (@var{files}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]})
+@maindex CHECK_FILES
+Checks for the existence of @var{files} in the native file system.
+This is equivalent to running @code{AC_CHECK_FILE} for each file
+in @var{files}. This macro will generate a fatal error if
+cross-compiling.
+
+For each readable file found, run shell commands @var{action-if-found}
+and define @samp{HAVE_@var{file}} (in all capitals), otherwise run
+@var{action-if-not-found}.
@end defmac
@defmac AC_PATH_X
@c @code{LIBS} temporarily, like this:
@end defmac
+@defmac AC_SYS_INTERPRETER
+@maindex SYS_INTERPRETER
+Check whether the system supports starting scripts with a line of the
+form @samp{#! /bin/csh} to select the interpreter to use for the script.
+After running this macro, shell code in @code{configure.in} can check
+the shell variable @code{interpval}; it will be set to @samp{yes}
+if the system supports @samp{#!}, @samp{no} if not.
+@end defmac
+
@defmac AC_SYS_LONG_FILE_NAMES
@maindex SYS_LONG_FILE_NAMES
@cvindex HAVE_LONG_FILE_NAMES
@var{action-if-found}, otherwise run @var{action-if-not-found}.
@end defmac
+@defmac AC_TRY_LINK_FUNC (@var{function}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]})
+@maindex TRY_LINK_FUNC
+Depending on the current language (@pxref{Language Choice}), create a
+test program to see whether a program whose body consists of
+a prototype of and a call to @var{function} can be compiled and linked.
+
+If the file compiles and links successfully, run shell commands
+@var{action-if-found}, otherwise run @var{action-if-not-found}.
+@end defmac
+
@defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex COMPILE_CHECK
This is an obsolete version of @code{AC_TRY_LINK}, with the addition
AC_DEFUN(AC_TRY_LINK_FUNC,
AC_TRY_LINK(dnl
-ifelse([$2], [main], , dnl Avoid conflicting decl of main.
+ifelse([$1], [main], , dnl Avoid conflicting decl of main.
[/* Override any gcc2 internal prototype to avoid an error. */
]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
extern "C"
[$3]))
-dnl AC_SEARCH_LIBS(func, searchlibs, [action-if-found], [action-if-not-found])
+dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
+dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
dnl Search for a library defining FUNC, if it's not already available.
AC_DEFUN(AC_SEARCH_LIBS,
-[AC_PREREQ([2.12])
+[AC_PREREQ([2.13])
AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
[ac_func_search_save_LIBS="$LIBS"
ac_cv_search_$1="no"
AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
test "$ac_cv_search_$1" = "no" && for i in $2; do
-LIBS="-l$i $ac_func_search_save_LIBS"
+LIBS="-l$i $5 $ac_func_search_save_LIBS"
AC_TRY_LINK_FUNC([$1],
[ac_cv_search_$1="-l$i"
break])
do
AC_CHECK_FILE($ac_file,
[changequote(, )dnl
- ac_tr_file=HAVE`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ ac_tr_file=HAVE_`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
changequote([, ])dnl
AC_DEFINE_UNQUOTED($ac_tr_file) $2], $3)dnl
done
ac_cv_sys_interpreter=no
fi
rm -f conftest])
+interpval="$ac_cv_sys_interpreter"
])
define(AC_HAVE_POUNDBANG,