From: David MacKenzie Date: Mon, 12 Sep 1994 04:40:56 +0000 (+0000) Subject: misc little fixes X-Git-Tag: fsf-origin~458 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdb9e9a1d111cd7df023ca9897208c2eb4de3ee1;p=thirdparty%2Fautoconf.git misc little fixes --- diff --git a/NEWS b/NEWS index 88c51fa05..1062f0ea6 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,8 @@ Major changes in release 2.0: * AC_DEFINE, AC_DEFINE_UNQUOTED, and AC_SUBST are more robust and smaller. * AC_DEFINE no longer prints anything, because of the new result reporting mechanism (AC_MSG_CHECKING and AC_MSG_RESULT). +* AC_ARG_ENABLE and AC_ARG_WITH support whitespace in the arguments to + --enable- and --with- options. * AC_VERBOSE pays attention to --quiet/--silent, not --verbose. * AC_CHECK_FUNCS and AC_CHECK_HEADERS take optional shell commands to execute on success or failure. diff --git a/TODO b/TODO index 4f6d12835..aa13fb02b 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,16 @@ Things it might be nice to do someday: ------------------------------------------------------------------------------ * Add AC_PROG_CC_POSIX to replace the current ad-hoc macros for AIX, -Minix, ISC, etc. + Minix, ISC, etc. + +------------------------------------------------------------------------------ + +* Use AC_EGREP_CPP instead of AC_TRY_LINK to detect structures and members. + +------------------------------------------------------------------------------ + +* Make AC_CHECK_FUNC[S] automatically use any particular macros for the + listed functions. ------------------------------------------------------------------------------ diff --git a/acfunctions b/acfunctions index a53e36433..5947ba69a 100644 --- a/acfunctions +++ b/acfunctions @@ -8,7 +8,7 @@ bzero AC_HEADER_STDC ioctl AC_PROG_GCC_TRADITIONAL memchr AC_HEADER_STDC memcpy AC_HEADER_STDC -memcmp AC_HEADER_STDC +memcmp AC_FUNC_MEMCMP memmove AC_HEADER_STDC memset AC_HEADER_STDC index AC_HEADER_STDC diff --git a/acgeneral.m4 b/acgeneral.m4 index a21fa49d6..4f2d89f74 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -966,7 +966,7 @@ AC_DEFUN(AC_LANG_C, ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='${CPP} $CPPFLAGS' -ac_compile='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' +ac_link='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' ]) dnl AC_LANG_CPLUSPLUS() @@ -975,7 +975,7 @@ AC_DEFUN(AC_LANG_CPLUSPLUS, ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='${CXXCPP} $CPPFLAGS' -ac_compile='${CXX-gcc} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' +ac_link='${CXX-gcc} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' ]) dnl Push the current language on a stack. @@ -1222,8 +1222,7 @@ rm -f conftest* dnl AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY, dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) AC_DEFUN(AC_COMPILE_CHECK, -[dnl It's actually ok to use this, if you don't care about caching. -dnl AC_OBSOLETE([$0], [; instead use AC_TRY_LINK])dnl +[AC_OBSOLETE([$0], [; instead use AC_TRY_LINK])dnl ifelse([$1], , , [AC_CHECKING([for $1]) ])dnl AC_TRY_LINK([$2], [$3], [$4], [$5])dnl @@ -1247,7 +1246,7 @@ int t() { [$2] ; return 0; } EOF -if eval $ac_compile; then +if eval $ac_link; then ifelse([$3], , :, [rm -rf conftest* $3]) ifelse([$4], , , [else @@ -1278,7 +1277,7 @@ extern "C" void exit(int); ])dnl [$1] EOF -eval $ac_compile +eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then ifelse([$2], , :, [$2]) ifelse([$3], , , [else diff --git a/acspecific.m4 b/acspecific.m4 index eef35d24b..c58d31ed2 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -1761,7 +1761,11 @@ else ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -L$x_libraries" AC_CHECK_LIB(ICE, IceConnectionNumbers, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lICE"]) + # On SunOS 4, -lSM requires -lICE in order to link, according to + # interran@uluru.Stanford.EDU (John Interrante). + ac_save_LIBS="$LIBS"; LIBS="$LIBS $X_EXTRA_LIBS" AC_CHECK_LIB(SM, SmcOpenConnection, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM"]) + LIBS="$ac_save_LIBS" LDFLAGS="$ac_save_LDFLAGS" # Check for system-dependent libraries X programs must link with. diff --git a/autoconf.texi b/autoconf.texi index 6bfaf3562..7be89965f 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -182,8 +182,8 @@ Typedefs Writing Tests -* Checking Declarations:: Detecting header files and declarations. -* Checking Libraries:: Detecting functions and global variables. +* Examining Declarations:: Detecting header files and declarations. +* Examining Libraries:: Detecting functions and global variables. * Run Time:: Testing for run-time features. * Portable Shell:: Shell script portability pitfalls. * Testing Values and Files:: Checking strings and files. @@ -921,9 +921,9 @@ The @file{stamp-} files are necessary because the timestamps of them does not change their contents. This feature avoids unnecessary recompilation. You should include the file @file{stamp-h.in} your package's distribution, so @code{make} will consider @file{config.h.in} -up to date. On some old BSD systems, @code{touch} does not update the -timestamps on empty files, so use @code{echo} or an empty command as a -workaround. +up to date. On some old BSD systems, @code{touch} or any command that +results in an empty file does not update the timestamps, so use a +command like @code{date} as a workaround. @example @group @@ -934,7 +934,7 @@ configure: configure.in aclocal.m4 config.h.in: stamp-h.in stamp-h.in: configure.in aclocal.m4 acconfig.h config.h.top config.h.bot cd $@{srcdir@} && autoheader - echo > $@{srcdir@}/stamp-h.in + date > $@{srcdir@}/stamp-h.in config.h: stamp-h stamp-h: config.h.in config.status @@ -948,7 +948,7 @@ config.status: configure @end group @end example -In addition, you should pass @samp{echo > stamp-h} in the @var{extra-cmds} +In addition, you should pass @samp{date > stamp-h} in the @var{extra-cmds} argument to @code{AC_OUTPUT}, so @file{config.status} will ensure that @file{config.h} is considered up to date. @xref{Output}, for more information about @code{AC_OUTPUT}. @@ -1658,8 +1658,8 @@ variable @code{LIBOBJS}. @defmac AC_FUNC_MMAP @maindex FUNC_MMAP @cvindex HAVE_MMAP -If the @code{mmap} function exists and works correctly, define -@code{HAVE_MMAP}. +If the @code{mmap} function exists and works correctly on memory mapped +files, define @code{HAVE_MMAP}. @end defmac @defmac AC_FUNC_SETVBUF_REVERSED @@ -1842,10 +1842,10 @@ something like the following: @group #if HAVE_DIRENT_H # include -# define NAMLEN(dirent) (strlen((dirent)->d_name)) +# define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct -# define NAMLEN(dirent) ((dirent)->d_namlen) +# define NAMLEN(dirent) (dirent)->d_namlen # if HAVE_SYS_NDIR_H # include # endif @@ -1928,7 +1928,6 @@ char *strchr (), *strrchr (); # ifndef HAVE_MEMCPY # define memcpy(d, s, n) bcopy ((s), (d), (n)) # define memmove(d, s, n) bcopy ((s), (d), (n)) -# define memcmp(s1, s2, n) bcmp ((s1), (s2), (n)) # endif #endif @end group @@ -2025,8 +2024,9 @@ is executed when one of the header files is not found. @section Structures The following macros check for certain structures or structure members. -You can use @code{AC_TRY_LINK} (@pxref{Checking Libraries}) to check -structures not listed here. +You can use @code{AC_EGREP_CPP} (@pxref{Examining Declarations}) or +@code{AC_TRY_LINK} (@pxref{Examining Libraries}) to check structures not +listed here. @defmac AC_HEADER_STAT @maindex HEADER_STAT @@ -2205,7 +2205,7 @@ to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or @section Compiler Characteristics The following macros check for C compiler or machine architecture -features. You can use @code{AC_TRY_LINK} (@pxref{Checking Libraries}) +features. You can use @code{AC_TRY_LINK} (@pxref{Examining Libraries}) or @code{AC_TRY_RUN} (@pxref{Run Time}) to check for characteristics not listed here. @@ -2440,8 +2440,8 @@ features call these macros and do cache their results and print messages about what they're checking for. @menu -* Checking Declarations:: Detecting header files and declarations. -* Checking Libraries:: Detecting functions and global variables. +* Examining Declarations:: Detecting header files and declarations. +* Examining Libraries:: Detecting functions and global variables. * Run Time:: Testing for run-time features. * Portable Shell:: Shell script portability pitfalls. * Testing Values and Files:: Checking strings and files. @@ -2449,10 +2449,12 @@ about what they're checking for. * Language Choice:: Selecting which language to use for testing. @end menu -@node Checking Declarations, Checking Libraries, , Writing Tests -@section Checking Declarations +@node Examining Declarations, Examining Libraries, , Writing Tests +@section Examining Declarations -Here is how to check whether particular header files exist. +Here is how to check whether particular header files exist. You can +check for one at a time, or more than one if you need several header +files to all exist for some purpose. @defmac AC_TRY_CPP (@var{includes}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]}) @maindex TRY_CPP @@ -2470,14 +2472,28 @@ because @samp{-g}, @samp{-O}, etc. are not valid options to many C preprocessors. @end defmac -The following macros check whether header files contain particular -symbols. You can not check whether preprocessor symbols are defined -this way, because they get expanded before @code{egrep} sees them. But -you can detect them by simply using @code{#ifdef} directives in your -programs. +Here is now to find out whether a header file contains a particular +declaration, such as a typedef, a structure, a structure member, or a +function. Use @code{AC_EGREP_HEADER} instead of running @code{grep} +directly on the header file; on some systems the symbol might be defined +in another header file that the file you are checking @samp{#include}s. -You can also use @code{AC_EGREP_CPP} to check whether the C preprocessor -predefines particular symbols, like this: +@defmac AC_EGREP_HEADER (@var{pattern}, @var{header-file}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) +@maindex EGREP_HEADER +If the output of running the preprocessor on the system header file +@var{header-file} matches the @code{egrep} regular expression +@var{pattern}, execute shell commands @var{action-if-found}, otherwise +execute @var{action-if-not-found}. + +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 +been called already. +@var{action-if-not-found}. +@end defmac + +To check for C preprocessor symbols, either defined by header files or +predefined by the C preprocessor, use @code{AC_EGREP_CPP}. Here is an +example of the latter: @example AC_EGREP_CPP(yes, @@ -2500,38 +2516,19 @@ on which language is current, @pxref{Language Choice}), if it hasn't been called already. @end defmac -To find out whether a header file contains a particular symbol, use the -following macro instead of using @code{grep} directly on the header -file. On some systems the symbol might be defined in another header -file that the file you are checking @samp{#include}s. +@node Examining Libraries, Run Time, Examining Declarations, Writing Tests +@section Examining Libraries -@defmac AC_EGREP_HEADER (@var{pattern}, @var{header-file}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) -@maindex EGREP_HEADER -If the output of running the preprocessor on the system header file -@var{header-file} matches the @code{egrep} regular expression -@var{pattern}, execute shell commands @var{action-if-found}, otherwise -execute @var{action-if-not-found}. - -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 -been called already. -@var{action-if-not-found}. -@end defmac - -@node Checking Libraries, Run Time, Checking Declarations, Writing Tests -@section Checking Libraries - -Autoconf checks for many features by examining or compiling small test -programs. To find out whether a library function is available, Autoconf -tries to compile and link a small program that uses it. This is unlike -Larry Wall's Metaconfig, which uses @code{nm} or @code{ar} on the C -library to try to figure out which functions are available. Trying to -link with the function is usually a more reliable and flexible approach +To find out whether a library function or global variable is available, +Autoconf tries to compile and link a small program that uses it. This +is unlike Larry Wall's Metaconfig, which uses @code{nm} or @code{ar} on +the C library to try to figure out which functions are available. +Trying to link with the function is usually a more reliable approach because it avoids dealing with the variations in the options and output formats of @code{nm} and @code{ar} and in the location of the standard libraries. It also allows configuring for cross-compilation or checking -a function's runtime behavior if needed. On the other hand, it is -sometimes slower than scanning the libraries. +a function's runtime behavior if needed. On the other hand, it can be +slower than scanning the libraries once. A few systems have linkers that do not return a failure exit status when there are unresolved functions in the link. This bug makes the @@ -2540,6 +2537,13 @@ However, some of them can be given options that make the exit status correct. This is a problem that Autoconf does not currently handle automatically. +The below macro is used to compile test programs to test for functions +and global variables. It is also used to check for libraries, by adding +the library being checked for to @samp{$LIBS} temporarily and trying to +link a small program. And it is used to check matters of C syntax, such +as whether a particular keyword is recognized---a test program using a +keyword does not compile on systems that don't support it. + @defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) @maindex TRY_LINK Create a test C program to see whether a function whose body consists of @@ -2553,12 +2557,12 @@ macro uses @code{CFLAGS} or @code{CXXFLAGS}, @code{CPPFLAGS}, @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 alias for @code{AC_TRY_LINK}, with the addition that it +This is an obsolete version of @code{AC_TRY_LINK}, with the addition that it prints @samp{checking for @var{echo-text}} to the standard output first, if @var{echo-text} is non-empty. @end defmac -@node Run Time, Portable Shell, Checking Libraries, Writing Tests +@node Run Time, Portable Shell, Examining Libraries, Writing Tests @section Checking Run Time Behavior Sometimes you need to find out how a system performs at run time, such @@ -3690,9 +3694,6 @@ only of alphanumeric characters and dashes. The option's argument is available to the shell commands @var{action-if-true} in the shell variable @code{withval}. -Arguments containing blanks are not handled correctly; if you need an -argument to contain a list, require the items to be separated by commas -instead. The argument @var{help-string} is a description of the option which looks like this: @@ -3752,9 +3753,7 @@ user-level facility. It should consist only of alphanumeric characters and dashes. The option's argument is available to the shell commands -@var{action-if-true} in the shell variable @code{enableval}. Arguments -containing blanks are not handled correctly; if you need an argument to -contain a list, require the items to be separated by commas instead. +@var{action-if-true} in the shell variable @code{enableval}. The @var{help-string} argument is like that of @code{AC_ARG_WITH} (@pxref{External Software}). @end defmac @@ -4146,6 +4145,11 @@ If you have an @file{aclocal.m4} installed with Autoconf (as opposed to in a particular package's source directory), you must rename it to @file{acsite.m4}. @xref{Invoking autoconf}. +If you distribute @file{install.sh} with your package, rename it to +@file{install-sh} so @code{make} builtin rules won't inadvertantly +create a file called @file{install} from it. @code{AC_PROG_INSTALL} +looks for the script under both names, but it is best to use the new name. + If you were using @file{config.h.top} or @file{config.h.bot}, you still can, but you will have less clutter if you merge them into @file{acconfig.h}. @xref{Invoking autoheader}. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 6bfaf3562..7be89965f 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -182,8 +182,8 @@ Typedefs Writing Tests -* Checking Declarations:: Detecting header files and declarations. -* Checking Libraries:: Detecting functions and global variables. +* Examining Declarations:: Detecting header files and declarations. +* Examining Libraries:: Detecting functions and global variables. * Run Time:: Testing for run-time features. * Portable Shell:: Shell script portability pitfalls. * Testing Values and Files:: Checking strings and files. @@ -921,9 +921,9 @@ The @file{stamp-} files are necessary because the timestamps of them does not change their contents. This feature avoids unnecessary recompilation. You should include the file @file{stamp-h.in} your package's distribution, so @code{make} will consider @file{config.h.in} -up to date. On some old BSD systems, @code{touch} does not update the -timestamps on empty files, so use @code{echo} or an empty command as a -workaround. +up to date. On some old BSD systems, @code{touch} or any command that +results in an empty file does not update the timestamps, so use a +command like @code{date} as a workaround. @example @group @@ -934,7 +934,7 @@ configure: configure.in aclocal.m4 config.h.in: stamp-h.in stamp-h.in: configure.in aclocal.m4 acconfig.h config.h.top config.h.bot cd $@{srcdir@} && autoheader - echo > $@{srcdir@}/stamp-h.in + date > $@{srcdir@}/stamp-h.in config.h: stamp-h stamp-h: config.h.in config.status @@ -948,7 +948,7 @@ config.status: configure @end group @end example -In addition, you should pass @samp{echo > stamp-h} in the @var{extra-cmds} +In addition, you should pass @samp{date > stamp-h} in the @var{extra-cmds} argument to @code{AC_OUTPUT}, so @file{config.status} will ensure that @file{config.h} is considered up to date. @xref{Output}, for more information about @code{AC_OUTPUT}. @@ -1658,8 +1658,8 @@ variable @code{LIBOBJS}. @defmac AC_FUNC_MMAP @maindex FUNC_MMAP @cvindex HAVE_MMAP -If the @code{mmap} function exists and works correctly, define -@code{HAVE_MMAP}. +If the @code{mmap} function exists and works correctly on memory mapped +files, define @code{HAVE_MMAP}. @end defmac @defmac AC_FUNC_SETVBUF_REVERSED @@ -1842,10 +1842,10 @@ something like the following: @group #if HAVE_DIRENT_H # include -# define NAMLEN(dirent) (strlen((dirent)->d_name)) +# define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct -# define NAMLEN(dirent) ((dirent)->d_namlen) +# define NAMLEN(dirent) (dirent)->d_namlen # if HAVE_SYS_NDIR_H # include # endif @@ -1928,7 +1928,6 @@ char *strchr (), *strrchr (); # ifndef HAVE_MEMCPY # define memcpy(d, s, n) bcopy ((s), (d), (n)) # define memmove(d, s, n) bcopy ((s), (d), (n)) -# define memcmp(s1, s2, n) bcmp ((s1), (s2), (n)) # endif #endif @end group @@ -2025,8 +2024,9 @@ is executed when one of the header files is not found. @section Structures The following macros check for certain structures or structure members. -You can use @code{AC_TRY_LINK} (@pxref{Checking Libraries}) to check -structures not listed here. +You can use @code{AC_EGREP_CPP} (@pxref{Examining Declarations}) or +@code{AC_TRY_LINK} (@pxref{Examining Libraries}) to check structures not +listed here. @defmac AC_HEADER_STAT @maindex HEADER_STAT @@ -2205,7 +2205,7 @@ to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or @section Compiler Characteristics The following macros check for C compiler or machine architecture -features. You can use @code{AC_TRY_LINK} (@pxref{Checking Libraries}) +features. You can use @code{AC_TRY_LINK} (@pxref{Examining Libraries}) or @code{AC_TRY_RUN} (@pxref{Run Time}) to check for characteristics not listed here. @@ -2440,8 +2440,8 @@ features call these macros and do cache their results and print messages about what they're checking for. @menu -* Checking Declarations:: Detecting header files and declarations. -* Checking Libraries:: Detecting functions and global variables. +* Examining Declarations:: Detecting header files and declarations. +* Examining Libraries:: Detecting functions and global variables. * Run Time:: Testing for run-time features. * Portable Shell:: Shell script portability pitfalls. * Testing Values and Files:: Checking strings and files. @@ -2449,10 +2449,12 @@ about what they're checking for. * Language Choice:: Selecting which language to use for testing. @end menu -@node Checking Declarations, Checking Libraries, , Writing Tests -@section Checking Declarations +@node Examining Declarations, Examining Libraries, , Writing Tests +@section Examining Declarations -Here is how to check whether particular header files exist. +Here is how to check whether particular header files exist. You can +check for one at a time, or more than one if you need several header +files to all exist for some purpose. @defmac AC_TRY_CPP (@var{includes}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]}) @maindex TRY_CPP @@ -2470,14 +2472,28 @@ because @samp{-g}, @samp{-O}, etc. are not valid options to many C preprocessors. @end defmac -The following macros check whether header files contain particular -symbols. You can not check whether preprocessor symbols are defined -this way, because they get expanded before @code{egrep} sees them. But -you can detect them by simply using @code{#ifdef} directives in your -programs. +Here is now to find out whether a header file contains a particular +declaration, such as a typedef, a structure, a structure member, or a +function. Use @code{AC_EGREP_HEADER} instead of running @code{grep} +directly on the header file; on some systems the symbol might be defined +in another header file that the file you are checking @samp{#include}s. -You can also use @code{AC_EGREP_CPP} to check whether the C preprocessor -predefines particular symbols, like this: +@defmac AC_EGREP_HEADER (@var{pattern}, @var{header-file}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) +@maindex EGREP_HEADER +If the output of running the preprocessor on the system header file +@var{header-file} matches the @code{egrep} regular expression +@var{pattern}, execute shell commands @var{action-if-found}, otherwise +execute @var{action-if-not-found}. + +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 +been called already. +@var{action-if-not-found}. +@end defmac + +To check for C preprocessor symbols, either defined by header files or +predefined by the C preprocessor, use @code{AC_EGREP_CPP}. Here is an +example of the latter: @example AC_EGREP_CPP(yes, @@ -2500,38 +2516,19 @@ on which language is current, @pxref{Language Choice}), if it hasn't been called already. @end defmac -To find out whether a header file contains a particular symbol, use the -following macro instead of using @code{grep} directly on the header -file. On some systems the symbol might be defined in another header -file that the file you are checking @samp{#include}s. +@node Examining Libraries, Run Time, Examining Declarations, Writing Tests +@section Examining Libraries -@defmac AC_EGREP_HEADER (@var{pattern}, @var{header-file}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) -@maindex EGREP_HEADER -If the output of running the preprocessor on the system header file -@var{header-file} matches the @code{egrep} regular expression -@var{pattern}, execute shell commands @var{action-if-found}, otherwise -execute @var{action-if-not-found}. - -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 -been called already. -@var{action-if-not-found}. -@end defmac - -@node Checking Libraries, Run Time, Checking Declarations, Writing Tests -@section Checking Libraries - -Autoconf checks for many features by examining or compiling small test -programs. To find out whether a library function is available, Autoconf -tries to compile and link a small program that uses it. This is unlike -Larry Wall's Metaconfig, which uses @code{nm} or @code{ar} on the C -library to try to figure out which functions are available. Trying to -link with the function is usually a more reliable and flexible approach +To find out whether a library function or global variable is available, +Autoconf tries to compile and link a small program that uses it. This +is unlike Larry Wall's Metaconfig, which uses @code{nm} or @code{ar} on +the C library to try to figure out which functions are available. +Trying to link with the function is usually a more reliable approach because it avoids dealing with the variations in the options and output formats of @code{nm} and @code{ar} and in the location of the standard libraries. It also allows configuring for cross-compilation or checking -a function's runtime behavior if needed. On the other hand, it is -sometimes slower than scanning the libraries. +a function's runtime behavior if needed. On the other hand, it can be +slower than scanning the libraries once. A few systems have linkers that do not return a failure exit status when there are unresolved functions in the link. This bug makes the @@ -2540,6 +2537,13 @@ However, some of them can be given options that make the exit status correct. This is a problem that Autoconf does not currently handle automatically. +The below macro is used to compile test programs to test for functions +and global variables. It is also used to check for libraries, by adding +the library being checked for to @samp{$LIBS} temporarily and trying to +link a small program. And it is used to check matters of C syntax, such +as whether a particular keyword is recognized---a test program using a +keyword does not compile on systems that don't support it. + @defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) @maindex TRY_LINK Create a test C program to see whether a function whose body consists of @@ -2553,12 +2557,12 @@ macro uses @code{CFLAGS} or @code{CXXFLAGS}, @code{CPPFLAGS}, @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 alias for @code{AC_TRY_LINK}, with the addition that it +This is an obsolete version of @code{AC_TRY_LINK}, with the addition that it prints @samp{checking for @var{echo-text}} to the standard output first, if @var{echo-text} is non-empty. @end defmac -@node Run Time, Portable Shell, Checking Libraries, Writing Tests +@node Run Time, Portable Shell, Examining Libraries, Writing Tests @section Checking Run Time Behavior Sometimes you need to find out how a system performs at run time, such @@ -3690,9 +3694,6 @@ only of alphanumeric characters and dashes. The option's argument is available to the shell commands @var{action-if-true} in the shell variable @code{withval}. -Arguments containing blanks are not handled correctly; if you need an -argument to contain a list, require the items to be separated by commas -instead. The argument @var{help-string} is a description of the option which looks like this: @@ -3752,9 +3753,7 @@ user-level facility. It should consist only of alphanumeric characters and dashes. The option's argument is available to the shell commands -@var{action-if-true} in the shell variable @code{enableval}. Arguments -containing blanks are not handled correctly; if you need an argument to -contain a list, require the items to be separated by commas instead. +@var{action-if-true} in the shell variable @code{enableval}. The @var{help-string} argument is like that of @code{AC_ARG_WITH} (@pxref{External Software}). @end defmac @@ -4146,6 +4145,11 @@ If you have an @file{aclocal.m4} installed with Autoconf (as opposed to in a particular package's source directory), you must rename it to @file{acsite.m4}. @xref{Invoking autoconf}. +If you distribute @file{install.sh} with your package, rename it to +@file{install-sh} so @code{make} builtin rules won't inadvertantly +create a file called @file{install} from it. @code{AC_PROG_INSTALL} +looks for the script under both names, but it is best to use the new name. + If you were using @file{config.h.top} or @file{config.h.bot}, you still can, but you will have less clutter if you merge them into @file{acconfig.h}. @xref{Invoking autoheader}. diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index a21fa49d6..4f2d89f74 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -966,7 +966,7 @@ AC_DEFUN(AC_LANG_C, ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='${CPP} $CPPFLAGS' -ac_compile='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' +ac_link='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' ]) dnl AC_LANG_CPLUSPLUS() @@ -975,7 +975,7 @@ AC_DEFUN(AC_LANG_CPLUSPLUS, ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='${CXXCPP} $CPPFLAGS' -ac_compile='${CXX-gcc} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' +ac_link='${CXX-gcc} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS 1>&AC_FD_CC 2>&AC_FD_CC' ]) dnl Push the current language on a stack. @@ -1222,8 +1222,7 @@ rm -f conftest* dnl AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY, dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) AC_DEFUN(AC_COMPILE_CHECK, -[dnl It's actually ok to use this, if you don't care about caching. -dnl AC_OBSOLETE([$0], [; instead use AC_TRY_LINK])dnl +[AC_OBSOLETE([$0], [; instead use AC_TRY_LINK])dnl ifelse([$1], , , [AC_CHECKING([for $1]) ])dnl AC_TRY_LINK([$2], [$3], [$4], [$5])dnl @@ -1247,7 +1246,7 @@ int t() { [$2] ; return 0; } EOF -if eval $ac_compile; then +if eval $ac_link; then ifelse([$3], , :, [rm -rf conftest* $3]) ifelse([$4], , , [else @@ -1278,7 +1277,7 @@ extern "C" void exit(int); ])dnl [$1] EOF -eval $ac_compile +eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then ifelse([$2], , :, [$2]) ifelse([$3], , , [else diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index eef35d24b..c58d31ed2 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -1761,7 +1761,11 @@ else ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -L$x_libraries" AC_CHECK_LIB(ICE, IceConnectionNumbers, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lICE"]) + # On SunOS 4, -lSM requires -lICE in order to link, according to + # interran@uluru.Stanford.EDU (John Interrante). + ac_save_LIBS="$LIBS"; LIBS="$LIBS $X_EXTRA_LIBS" AC_CHECK_LIB(SM, SmcOpenConnection, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM"]) + LIBS="$ac_save_LIBS" LDFLAGS="$ac_save_LDFLAGS" # Check for system-dependent libraries X programs must link with. diff --git a/lib/autoscan/functions b/lib/autoscan/functions index a53e36433..5947ba69a 100644 --- a/lib/autoscan/functions +++ b/lib/autoscan/functions @@ -8,7 +8,7 @@ bzero AC_HEADER_STDC ioctl AC_PROG_GCC_TRADITIONAL memchr AC_HEADER_STDC memcpy AC_HEADER_STDC -memcmp AC_HEADER_STDC +memcmp AC_FUNC_MEMCMP memmove AC_HEADER_STDC memset AC_HEADER_STDC index AC_HEADER_STDC