From: David MacKenzie Date: Thu, 3 Nov 1994 15:49:58 +0000 (+0000) Subject: fix misc little bugs X-Git-Tag: fsf-origin~365 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c20472d09c52c5a67284d98fc22ecb9c69d6adf;p=thirdparty%2Fautoconf.git fix misc little bugs --- diff --git a/acgeneral.m4 b/acgeneral.m4 index ee06735fa..83ecce4bf 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -1328,7 +1328,7 @@ dnl ### Examining libraries dnl AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY, dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) AC_DEFUN(AC_COMPILE_CHECK, -[AC_OBSOLETE([$0], [; instead use AC_TRY_COMPILE or AC_TRY_LINK])dnl +[AC_OBSOLETE([$0], [; instead use AC_TRY_COMPILE or AC_TRY_LINK, and AC_MSG_CHECKING and AC_MSG_RESULT])dnl ifelse([$1], , , [AC_CHECKING([for $1]) ])dnl AC_TRY_LINK([$2], [$3], [$4], [$5])dnl @@ -1436,19 +1436,21 @@ AC_DEFUN(AC_CHECK_FUNC, [AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(ac_cv_func_$1, [AC_TRY_LINK( -[#include /* Arbitrary system header to define __stub macros. */], [ +[#include /* Arbitrary system header to define __stub macros. */ +/* Override any gcc2 internal prototype to avoid an error. */ +]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" +#endif +])dnl +[char $1(); +], [ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$1) || defined (__stub___$1) choke me #else -/* Override any gcc2 internal prototype to avoid an error. */ -]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus -extern "C" -#endif -])dnl -[char $1(); $1(); +$1(); #endif ], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")])dnl if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then diff --git a/autoconf.texi b/autoconf.texi index 1933160d5..954180534 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -488,6 +488,14 @@ checks for system services @end group @end display +It is best to put each macro call on its own line in +@file{configure.in}. Most of the macros don't add extra newlines; they +rely on the newline after the macro call to terminate the commands. +This approach makes the generated @code{configure} script a little +easier to read by not inserting lots of blank lines. It is generally +safe to set shell variables on the same line as a macro call, because +the shell allows assignments without intervening newlines. + When calling macros that take arguments, there must not be any blank space between the macro name and the open parenthesis. Arguments can be more than one line long if they are enclosed within the @code{m4} quote @@ -1495,6 +1503,7 @@ work. It prefers to find a C program rather than a shell script, for speed. Instead of @file{install-sh}, it can also use @file{install.sh}, but that name is obsolete because some @code{make} programs have a rule that creates @file{install} from it if there is no @file{Makefile}. +A copy of @file{install-sh} which you may use comes with Autoconf. If you need to use your own installation program because it has features not found in standard @code{install} programs, there is no @@ -2253,7 +2262,8 @@ typedef check macro. @node Particular Typedefs, Generic Typedefs, , Typedefs @subsection Particular Typedef Checks -These macros check for particular C typedefs. +These macros check for particular C typedefs in @file{sys/types.h} and +@file{stdlib.h} (if it exists). @defmac AC_TYPE_GETGROUPS @maindex TYPE_GETGROUPS @@ -2265,22 +2275,19 @@ is the base type of the array argument to @code{getgroups}. @defmac AC_TYPE_MODE_T @maindex TYPE_MODE_T @cvindex mode_t -If @code{mode_t} is not defined in @file{sys/types.h}, define -@code{mode_t} to be @code{int}. +If @code{mode_t} is not defined, define @code{mode_t} to be @code{int}. @end defmac @defmac AC_TYPE_OFF_T @maindex TYPE_OFF_T @cvindex off_t -If @code{off_t} is not defined in @file{sys/types.h}, define -@code{off_t} to be @code{long}. +If @code{off_t} is not defined, define @code{off_t} to be @code{long}. @end defmac @defmac AC_TYPE_PID_T @maindex TYPE_PID_T @cvindex pid_t -If @code{pid_t} is not defined in @file{sys/types.h}, define -@code{pid_t} to be @code{int}. +If @code{pid_t} is not defined, define @code{pid_t} to be @code{int}. @end defmac @defmac AC_TYPE_SIGNAL @@ -2306,16 +2313,16 @@ hup_handler () @defmac AC_TYPE_SIZE_T @maindex TYPE_SIZE_T @cvindex size_t -If @code{size_t} is not defined in @file{sys/types.h}, define -@code{size_t} to be @code{unsigned}. +If @code{size_t} is not defined, define @code{size_t} to be +@code{unsigned}. @end defmac @defmac AC_TYPE_UID_T @maindex TYPE_UID_T @cvindex uid_t @cvindex gid_t -If @code{uid_t} is not defined in @file{sys/types.h}, define -@code{uid_t} to be @code{int} and @code{gid_t} to be @code{int}. +If @code{uid_t} is not defined, define @code{uid_t} to be @code{int} and +@code{gid_t} to be @code{int}. @end defmac @node Generic Typedefs, , Particular Typedefs, Typedefs @@ -2327,7 +2334,7 @@ test macros. @defmac AC_CHECK_TYPE (@var{type}, @var{default}) @maindex CHECK_TYPE If the type @var{type} is not defined in @file{sys/types.h} or -@file{stdlib.h} (if that is present), define it to be the C (or C++) +@file{stdlib.h} (if it exists), define it to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or @samp{unsigned}. @end defmac @@ -2701,7 +2708,8 @@ macro uses @code{CFLAGS} or @code{CXXFLAGS}, @code{CPPFLAGS}, @maindex COMPILE_CHECK 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. +if @var{echo-text} is non-empty. Use @code{AC_MSG_CHECKING} and +@code{AC_MSG_RESULT} instead to print messages (@pxref{Printing Messages}). @end defmac @node Run Time, Portable Shell, Examining Libraries, Writing Tests @@ -4128,7 +4136,8 @@ fi Below are instructions on how to configure a package that uses a @code{configure} script, suitable for inclusion as an @file{INSTALL} -file in the package. +file in the package. A plain-text version of @file{INSTALL} which you +may use comes with Autoconf. @menu * Basic Installation:: Instructions for typical cases. @@ -4494,15 +4503,15 @@ convert your @file{configure.in} to using the new macro names. Some macros have been superseded by similar ones that do the job better, but are not call-compatible. If you get warnings about calling obsolete -macros while running @code{autoconf}, you may safely ignore them, but your -@code{configure} script will generally work better if you follow the -advice it prints about what to replace the obsolete macros with. In +macros while running @code{autoconf}, you may safely ignore them, but +your @code{configure} script will generally work better if you follow +the advice it prints about what to replace the obsolete macros with. In particular, the mechanism for reporting the results of tests has -changed. If you were using @code{echo} or @code{AC_VERBOSE}, your -@code{configure} script's output will look better if you switch to -@code{AC_MSG_CHECKING} and @code{AC_MSG_RESULT}. @xref{Printing -Messages}. Those macros work best in conjunction with cache variables. -@xref{Caching Results}. +changed. If you were using @code{echo} or @code{AC_VERBOSE} (perhaps +via @code{AC_COMPILE_CHECK}), your @code{configure} script's output will +look better if you switch to @code{AC_MSG_CHECKING} and +@code{AC_MSG_RESULT}. @xref{Printing Messages}. Those macros work best +in conjunction with cache variables. @xref{Caching Results}. @node Invoking autoupdate, Changed Results, Changed Macros, Upgrading @section Using @code{autoupdate} to Modernize @code{configure} diff --git a/autoscan.in b/autoscan.in index 52827a7eb..9f26bfb2d 100644 --- a/autoscan.in +++ b/autoscan.in @@ -344,7 +344,8 @@ sub output_programs } print CONF "\ndnl Checks for libraries.\n"; foreach $word (sort keys %libraries) { - print CONF "AC_HAVE_LIBRARY($word)\n"; + print CONF "dnl Replace `\main\' with a function in -l$word:\n"; + print CONF "AC_CHECK_LIB($word, main)\n"; } } diff --git a/autoscan.pl b/autoscan.pl index 52827a7eb..9f26bfb2d 100644 --- a/autoscan.pl +++ b/autoscan.pl @@ -344,7 +344,8 @@ sub output_programs } print CONF "\ndnl Checks for libraries.\n"; foreach $word (sort keys %libraries) { - print CONF "AC_HAVE_LIBRARY($word)\n"; + print CONF "dnl Replace `\main\' with a function in -l$word:\n"; + print CONF "AC_CHECK_LIB($word, main)\n"; } } diff --git a/bin/autoscan.in b/bin/autoscan.in index 52827a7eb..9f26bfb2d 100644 --- a/bin/autoscan.in +++ b/bin/autoscan.in @@ -344,7 +344,8 @@ sub output_programs } print CONF "\ndnl Checks for libraries.\n"; foreach $word (sort keys %libraries) { - print CONF "AC_HAVE_LIBRARY($word)\n"; + print CONF "dnl Replace `\main\' with a function in -l$word:\n"; + print CONF "AC_CHECK_LIB($word, main)\n"; } } diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 1933160d5..954180534 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -488,6 +488,14 @@ checks for system services @end group @end display +It is best to put each macro call on its own line in +@file{configure.in}. Most of the macros don't add extra newlines; they +rely on the newline after the macro call to terminate the commands. +This approach makes the generated @code{configure} script a little +easier to read by not inserting lots of blank lines. It is generally +safe to set shell variables on the same line as a macro call, because +the shell allows assignments without intervening newlines. + When calling macros that take arguments, there must not be any blank space between the macro name and the open parenthesis. Arguments can be more than one line long if they are enclosed within the @code{m4} quote @@ -1495,6 +1503,7 @@ work. It prefers to find a C program rather than a shell script, for speed. Instead of @file{install-sh}, it can also use @file{install.sh}, but that name is obsolete because some @code{make} programs have a rule that creates @file{install} from it if there is no @file{Makefile}. +A copy of @file{install-sh} which you may use comes with Autoconf. If you need to use your own installation program because it has features not found in standard @code{install} programs, there is no @@ -2253,7 +2262,8 @@ typedef check macro. @node Particular Typedefs, Generic Typedefs, , Typedefs @subsection Particular Typedef Checks -These macros check for particular C typedefs. +These macros check for particular C typedefs in @file{sys/types.h} and +@file{stdlib.h} (if it exists). @defmac AC_TYPE_GETGROUPS @maindex TYPE_GETGROUPS @@ -2265,22 +2275,19 @@ is the base type of the array argument to @code{getgroups}. @defmac AC_TYPE_MODE_T @maindex TYPE_MODE_T @cvindex mode_t -If @code{mode_t} is not defined in @file{sys/types.h}, define -@code{mode_t} to be @code{int}. +If @code{mode_t} is not defined, define @code{mode_t} to be @code{int}. @end defmac @defmac AC_TYPE_OFF_T @maindex TYPE_OFF_T @cvindex off_t -If @code{off_t} is not defined in @file{sys/types.h}, define -@code{off_t} to be @code{long}. +If @code{off_t} is not defined, define @code{off_t} to be @code{long}. @end defmac @defmac AC_TYPE_PID_T @maindex TYPE_PID_T @cvindex pid_t -If @code{pid_t} is not defined in @file{sys/types.h}, define -@code{pid_t} to be @code{int}. +If @code{pid_t} is not defined, define @code{pid_t} to be @code{int}. @end defmac @defmac AC_TYPE_SIGNAL @@ -2306,16 +2313,16 @@ hup_handler () @defmac AC_TYPE_SIZE_T @maindex TYPE_SIZE_T @cvindex size_t -If @code{size_t} is not defined in @file{sys/types.h}, define -@code{size_t} to be @code{unsigned}. +If @code{size_t} is not defined, define @code{size_t} to be +@code{unsigned}. @end defmac @defmac AC_TYPE_UID_T @maindex TYPE_UID_T @cvindex uid_t @cvindex gid_t -If @code{uid_t} is not defined in @file{sys/types.h}, define -@code{uid_t} to be @code{int} and @code{gid_t} to be @code{int}. +If @code{uid_t} is not defined, define @code{uid_t} to be @code{int} and +@code{gid_t} to be @code{int}. @end defmac @node Generic Typedefs, , Particular Typedefs, Typedefs @@ -2327,7 +2334,7 @@ test macros. @defmac AC_CHECK_TYPE (@var{type}, @var{default}) @maindex CHECK_TYPE If the type @var{type} is not defined in @file{sys/types.h} or -@file{stdlib.h} (if that is present), define it to be the C (or C++) +@file{stdlib.h} (if it exists), define it to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or @samp{unsigned}. @end defmac @@ -2701,7 +2708,8 @@ macro uses @code{CFLAGS} or @code{CXXFLAGS}, @code{CPPFLAGS}, @maindex COMPILE_CHECK 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. +if @var{echo-text} is non-empty. Use @code{AC_MSG_CHECKING} and +@code{AC_MSG_RESULT} instead to print messages (@pxref{Printing Messages}). @end defmac @node Run Time, Portable Shell, Examining Libraries, Writing Tests @@ -4128,7 +4136,8 @@ fi Below are instructions on how to configure a package that uses a @code{configure} script, suitable for inclusion as an @file{INSTALL} -file in the package. +file in the package. A plain-text version of @file{INSTALL} which you +may use comes with Autoconf. @menu * Basic Installation:: Instructions for typical cases. @@ -4494,15 +4503,15 @@ convert your @file{configure.in} to using the new macro names. Some macros have been superseded by similar ones that do the job better, but are not call-compatible. If you get warnings about calling obsolete -macros while running @code{autoconf}, you may safely ignore them, but your -@code{configure} script will generally work better if you follow the -advice it prints about what to replace the obsolete macros with. In +macros while running @code{autoconf}, you may safely ignore them, but +your @code{configure} script will generally work better if you follow +the advice it prints about what to replace the obsolete macros with. In particular, the mechanism for reporting the results of tests has -changed. If you were using @code{echo} or @code{AC_VERBOSE}, your -@code{configure} script's output will look better if you switch to -@code{AC_MSG_CHECKING} and @code{AC_MSG_RESULT}. @xref{Printing -Messages}. Those macros work best in conjunction with cache variables. -@xref{Caching Results}. +changed. If you were using @code{echo} or @code{AC_VERBOSE} (perhaps +via @code{AC_COMPILE_CHECK}), your @code{configure} script's output will +look better if you switch to @code{AC_MSG_CHECKING} and +@code{AC_MSG_RESULT}. @xref{Printing Messages}. Those macros work best +in conjunction with cache variables. @xref{Caching Results}. @node Invoking autoupdate, Changed Results, Changed Macros, Upgrading @section Using @code{autoupdate} to Modernize @code{configure} diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index ee06735fa..83ecce4bf 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1328,7 +1328,7 @@ dnl ### Examining libraries dnl AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY, dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) AC_DEFUN(AC_COMPILE_CHECK, -[AC_OBSOLETE([$0], [; instead use AC_TRY_COMPILE or AC_TRY_LINK])dnl +[AC_OBSOLETE([$0], [; instead use AC_TRY_COMPILE or AC_TRY_LINK, and AC_MSG_CHECKING and AC_MSG_RESULT])dnl ifelse([$1], , , [AC_CHECKING([for $1]) ])dnl AC_TRY_LINK([$2], [$3], [$4], [$5])dnl @@ -1436,19 +1436,21 @@ AC_DEFUN(AC_CHECK_FUNC, [AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(ac_cv_func_$1, [AC_TRY_LINK( -[#include /* Arbitrary system header to define __stub macros. */], [ +[#include /* Arbitrary system header to define __stub macros. */ +/* Override any gcc2 internal prototype to avoid an error. */ +]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" +#endif +])dnl +[char $1(); +], [ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$1) || defined (__stub___$1) choke me #else -/* Override any gcc2 internal prototype to avoid an error. */ -]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus -extern "C" -#endif -])dnl -[char $1(); $1(); +$1(); #endif ], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")])dnl if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then