]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
1999-10-31 Akim Demaille <akim@epita.fr>
authorAkim Demaille <akim@epita.fr>
Mon, 20 Dec 1999 13:40:18 +0000 (13:40 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 20 Dec 1999 13:40:18 +0000 (13:40 +0000)
Rename the family AC_NEED_DECL as AC_CHECK: it is more uniform,
but keep defining NEED_FOO_DECL when `foo' is not declared.  Files
not using Autoconf behave better when declarations lacks than when
they are wrong.  So the unset position should off, hence #if NEEDS
instead of #if !HAVE (which is triggered when HAVE is not set).

* acgeneral.m4 (AC_NEED_DECL): Renamed as...
(AC_CHECK_DECL): This.  Make sure the arguments are the usual
IF-FOUND, IF-NOT-FOUND.
(AC_NEED_DECLS, AC_CHECK_DECLS): Likewise.
* autoconf.texi (Generic Declarations): Document the changes
  aforementioned.
* autoheader.m4 (AH_NEED_DECLS): Renamed as
(AH_CHECK_DECLS): This.
(AH_HOOKS): Hook AH_CHECK_DECLS on AC_CHECK_DECLS instead of
_NEED_.

ChangeLog
TODO
acgeneral.m4
acspecific.m4
autoconf.texi
autoheader.m4
doc/autoconf.texi
lib/autoconf/general.m4
lib/autoconf/specific.m4

index b64cfcf99615cc0adc637da6bd242dac6d8d8761..bcce91e6ffeac954f261916753213af959618ad8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+1999-10-31  Akim Demaille  <akim@epita.fr>
+
+       Rename the family AC_NEED_DECL as AC_CHECK: it is more uniform,
+       but keep defining NEED_FOO_DECL when `foo' is not declared.  Files
+       not using Autoconf behave better when declarations lacks than when
+       they are wrong.  So the unset position should off, hence #if NEEDS
+       instead of #if !HAVE (which is triggered when HAVE is not set).
+
+       * acgeneral.m4 (AC_NEED_DECL): Renamed as...
+       (AC_CHECK_DECL): This.  Make sure the arguments are the usual
+       IF-FOUND, IF-NOT-FOUND.
+       (AC_NEED_DECLS, AC_CHECK_DECLS): Likewise.
+       * autoconf.texi (Generic Declarations): Document the changes
+       aforementioned.
+       * autoheader.m4 (AH_NEED_DECLS): Renamed as
+       (AH_CHECK_DECLS): This.
+       (AH_HOOKS): Hook AH_CHECK_DECLS on AC_CHECK_DECLS instead of
+       _NEED_.
+
 1999-10-31  Akim Demaille  <akim@epita.fr>
 
        Revamp the handling of the arguments of config.status: instead of
diff --git a/TODO b/TODO
index b5ef67e87c911defd865803b78cbfdd090d61be1..9bcf7cbee26f1314c61c5d0a30e64ba09368b199 100644 (file)
--- a/TODO
+++ b/TODO
@@ -288,7 +288,6 @@ in a dnl comment.  (Seems to be hard.)
 ------------------------------------------------------------------------------
 
 * Look at user contributed macros:
-       prototypes
        IEEE double precision math
        more
 
index 2294e35066cf43cd22b1beb67f5c2d266d3aa9d5..5dec803ed9e879cfdb8863ddba89cf6e4ad2190a 100644 (file)
@@ -2731,15 +2731,13 @@ dnl ])
 dnl ### Checking for declared symbols
 
 
-dnl AC_NEED_DECL(SYMBOL, [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED
+dnl AC_CHECK_DECL(SYMBOL, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl              [, INCLUDES,]]])
-dnl --------------------------------------------------------------
+dnl -------------------------------------------------------------
 dnl Check if SYMBOL (a variable or a function) is declared.
-dnl This macro is not a _CHECK_, because it is better not to declare
-dnl a symbol if you don't really need it.
-AC_DEFUN([AC_NEED_DECL],
-[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_need_decl_$1])dnl
-AC_CACHE_CHECK([whether $1 needs to be declared], ac_Symbol,
+AC_DEFUN([AC_CHECK_DECL],
+[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl
+AC_CACHE_CHECK([whether `$1' is declared], ac_Symbol,
 [AC_TRY_COMPILE(m4_default([$4], [#include <stdio.h>
 #ifdef HAVE_STRING_H
 # if !STDC_HEADERS && HAVE_MEMORY_H
@@ -2767,23 +2765,23 @@ AC_CACHE_CHECK([whether $1 needs to be declared], ac_Symbol,
 char *p = (char *) $1;
 #endif
 ],
-AC_VAR_SET(ac_Symbol, no), AC_VAR_SET(ac_Symbol, yes))])
+AC_VAR_SET(ac_Symbol, yes), AC_VAR_SET(ac_Symbol, no))])
 AC_SHELL_IFELSE(test AC_VAR_GET(ac_Symbol) = yes,
                 [$2], [$3])dnl
 AC_VAR_POPDEF([ac_Symbol])dnl
-])dnl AC_NEED_DECL
+])dnl AC_CHECK_DECL
 
-dnl AC_NEED_DECLS(SYMBOL, [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED
+dnl AC_CHECK_DECLS(SYMBOL, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl               [, INCLUDES]]])
-dnl ---------------------------------------------------------------
-AC_DEFUN([AC_NEED_DECLS],
+dnl --------------------------------------------------------------
+AC_DEFUN([AC_CHECK_DECLS],
 [AC_FOREACH([AC_Symbol], [$1],
-  [AC_SPECIALIZE([AC_NEED_DECL], AC_Symbol,
-                 [AC_DEFINE_UNQUOTED(AC_TR_CPP(NEED_DECL_[]AC_Symbol))
-$2],
-                 [$3],
+  [AC_SPECIALIZE([AC_CHECK_DECL], AC_Symbol,
+                 [$2],
+                 [AC_DEFINE_UNQUOTED(AC_TR_CPP([NEED_]AC_Symbol[_DECL]))
+$3],
                  [$4])])
-])dnl AC_NEED_DECLS
+])dnl AC_CHECK_DECLS
 
 
 dnl ### Checking for library functions
index 06e0ee4fe092c546d16f790fa42d88e493fd43a0..e3f2c57489bb8fbc994ccaa3bb2f61d3d199abf0 100644 (file)
@@ -2438,7 +2438,7 @@ char *s = x(teststring);
 ], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))
 if test "${ac_cv_c_stringize}" = yes; then
   AC_DEFINE(HAVE_STRINGIZE, 1,
-            [Define if you have the ANSI # stringizing operator in cpp.])
+            [Define if cpp supports the ANSI # stringizing operator.])
 fi
 AC_MSG_RESULT([${ac_cv_c_stringize}])
 ])dnl AC_C_STRINGIZE
index 905be4367a2d08e4dd226b0de8215da862f09681..b51eb9302e9293d5991b7f3e482a5b5c0b3ac583 100644 (file)
@@ -2607,11 +2607,11 @@ is declared in a system header file, either @file{signal.h} or
 These macros are used to find declarations not covered by the particular
 test macros.
 
-@defmac AC_NEED_DECL (@var{symbol} @r{[}, @var{action-if-needed}@r{[}, @var{action-if-not-needed} @r{[},@var{includes} @r{]]]})
-@maindex NEED_DECL
+@defmac AC_CHECK_DECL (@var{symbol} @r{[}, @var{action-if-found}@r{[}, @var{action-if-not-found} @r{[},@var{includes} @r{]]]})
+@maindex CHECK_DECL
 If the declaration of @var{symbol} (a function or a variable) is needed
 because it is not declared in @var{includes}, run the shell commands
-@var{action-if-needed}, otherwise @var{action-if-not-needed}.  If no
+@var{action-if-not-found}, otherwise @var{action-if-found}.  If no
 @var{includes} are given at all, by default @file{stdio.h},
 @file{stdlib.h}, @file{stddef.h}, @file{memory.h}, @file{string.h},
 @file{strings.h}, and @file{unistd.h} will be included.
@@ -2621,15 +2621,31 @@ r-value, not if it is really declared, because it is much safer to avoid
 introducing extra declarations when not needed.
 @end defmac
 
-@defmac AC_NEED_DECLS (@var{symbol} @r{[}, @var{action-if-needed}@r{[}, @var{action-if-not-needed} @r{[},@var{includes} @r{]]]})
-@maindex NEED_DECLS
-@cvindex NEED_DECL_@var{symbol}
+@defmac AC_CHECK_DECLS (@var{symbol} @r{[}, @var{action-if-found}@r{[}, @var{action-if-not-found} @r{[},@var{includes} @r{]]]})
+@maindex CHECK_DECLS
+@cvindex NEED_@var{symbol}_DECL
 For each given @var{symbol} (whitespace-separated), define
-@code{NEED_DECL_@var{symbol}} (in all capitals) if @var{symbol} has to
-be declared to be used as an r-value.  If @var{action-if-needed} is
+@code{NEED_@var{symbol}_DECL} (in all capitals) if @var{symbol} has to
+be declared to be used as an r-value.  If @var{action-if-not-found} is
 given, it is additional shell code to execute when one of the function
-declarations is needed, otherwise @var{action-if-not-needed} is
-executed.
+declarations is needed, otherwise @var{action-if-found} is executed.
+
+This macro does not define @code{HAVE_@var{symbol}_DECL} on purpose.
+The following code
+@example
+#if NEED_FOO_DECL
+/* Declare foo. */
+#endif
+@end example
+is safer than
+@example
+#if !HAVE_FOO_DECL
+/* Declare foo. */
+#endif
+@end example
+since in this last case, if @code{configure} was not run, then the test
+succeeds, thus @code{foo} is declared, with risks to clash with previous
+declarations.  It is safer not to declare in case of doubts.
 @end defmac
 
 
index 652a5b71ceba3d041c0b543c06818835de93fed3..e005d6d249e08980958abf7616452cef180207de 100644 (file)
@@ -90,9 +90,9 @@ $2
 # Failure
 $3])])
 
-define([AH_NEED_DECLS],
+define([AH_CHECK_DECLS],
 [AC_FOREACH([AC_Symbol], [$1],
-  [AH_TEMPLATE(AC_TR_CPP(NEED_DECL_[]AC_Symbol),
+  [AH_TEMPLATE(AC_TR_CPP([NEED_]AC_Symbol[_DECL]),
                [Define if you need the declaration of `]AC_Symbol['.])
 # Success
 $2
@@ -205,7 +205,7 @@ $4])
 
 AH_HOOK([AC_DEFINE], [AH_DEFINE])
 AH_HOOK([AC_DEFINE_UNQUOTED], [AH_DEFINE])
-AH_HOOK([AC_NEED_DECLS], [AH_NEED_DECLS])
+AH_HOOK([AC_CHECK_DECLS], [AH_CHECK_DECLS])
 AH_HOOK([AC_CHECK_SIZEOF], [AH_CHECK_SIZEOF])
 AH_HOOK([AC_CHECK_FUNCS], [AH_CHECK_FUNCS])
 AH_HOOK([AC_CHECK_HEADERS], [AH_CHECK_HEADERS])
index 905be4367a2d08e4dd226b0de8215da862f09681..b51eb9302e9293d5991b7f3e482a5b5c0b3ac583 100644 (file)
@@ -2607,11 +2607,11 @@ is declared in a system header file, either @file{signal.h} or
 These macros are used to find declarations not covered by the particular
 test macros.
 
-@defmac AC_NEED_DECL (@var{symbol} @r{[}, @var{action-if-needed}@r{[}, @var{action-if-not-needed} @r{[},@var{includes} @r{]]]})
-@maindex NEED_DECL
+@defmac AC_CHECK_DECL (@var{symbol} @r{[}, @var{action-if-found}@r{[}, @var{action-if-not-found} @r{[},@var{includes} @r{]]]})
+@maindex CHECK_DECL
 If the declaration of @var{symbol} (a function or a variable) is needed
 because it is not declared in @var{includes}, run the shell commands
-@var{action-if-needed}, otherwise @var{action-if-not-needed}.  If no
+@var{action-if-not-found}, otherwise @var{action-if-found}.  If no
 @var{includes} are given at all, by default @file{stdio.h},
 @file{stdlib.h}, @file{stddef.h}, @file{memory.h}, @file{string.h},
 @file{strings.h}, and @file{unistd.h} will be included.
@@ -2621,15 +2621,31 @@ r-value, not if it is really declared, because it is much safer to avoid
 introducing extra declarations when not needed.
 @end defmac
 
-@defmac AC_NEED_DECLS (@var{symbol} @r{[}, @var{action-if-needed}@r{[}, @var{action-if-not-needed} @r{[},@var{includes} @r{]]]})
-@maindex NEED_DECLS
-@cvindex NEED_DECL_@var{symbol}
+@defmac AC_CHECK_DECLS (@var{symbol} @r{[}, @var{action-if-found}@r{[}, @var{action-if-not-found} @r{[},@var{includes} @r{]]]})
+@maindex CHECK_DECLS
+@cvindex NEED_@var{symbol}_DECL
 For each given @var{symbol} (whitespace-separated), define
-@code{NEED_DECL_@var{symbol}} (in all capitals) if @var{symbol} has to
-be declared to be used as an r-value.  If @var{action-if-needed} is
+@code{NEED_@var{symbol}_DECL} (in all capitals) if @var{symbol} has to
+be declared to be used as an r-value.  If @var{action-if-not-found} is
 given, it is additional shell code to execute when one of the function
-declarations is needed, otherwise @var{action-if-not-needed} is
-executed.
+declarations is needed, otherwise @var{action-if-found} is executed.
+
+This macro does not define @code{HAVE_@var{symbol}_DECL} on purpose.
+The following code
+@example
+#if NEED_FOO_DECL
+/* Declare foo. */
+#endif
+@end example
+is safer than
+@example
+#if !HAVE_FOO_DECL
+/* Declare foo. */
+#endif
+@end example
+since in this last case, if @code{configure} was not run, then the test
+succeeds, thus @code{foo} is declared, with risks to clash with previous
+declarations.  It is safer not to declare in case of doubts.
 @end defmac
 
 
index 2294e35066cf43cd22b1beb67f5c2d266d3aa9d5..5dec803ed9e879cfdb8863ddba89cf6e4ad2190a 100644 (file)
@@ -2731,15 +2731,13 @@ dnl ])
 dnl ### Checking for declared symbols
 
 
-dnl AC_NEED_DECL(SYMBOL, [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED
+dnl AC_CHECK_DECL(SYMBOL, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl              [, INCLUDES,]]])
-dnl --------------------------------------------------------------
+dnl -------------------------------------------------------------
 dnl Check if SYMBOL (a variable or a function) is declared.
-dnl This macro is not a _CHECK_, because it is better not to declare
-dnl a symbol if you don't really need it.
-AC_DEFUN([AC_NEED_DECL],
-[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_need_decl_$1])dnl
-AC_CACHE_CHECK([whether $1 needs to be declared], ac_Symbol,
+AC_DEFUN([AC_CHECK_DECL],
+[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl
+AC_CACHE_CHECK([whether `$1' is declared], ac_Symbol,
 [AC_TRY_COMPILE(m4_default([$4], [#include <stdio.h>
 #ifdef HAVE_STRING_H
 # if !STDC_HEADERS && HAVE_MEMORY_H
@@ -2767,23 +2765,23 @@ AC_CACHE_CHECK([whether $1 needs to be declared], ac_Symbol,
 char *p = (char *) $1;
 #endif
 ],
-AC_VAR_SET(ac_Symbol, no), AC_VAR_SET(ac_Symbol, yes))])
+AC_VAR_SET(ac_Symbol, yes), AC_VAR_SET(ac_Symbol, no))])
 AC_SHELL_IFELSE(test AC_VAR_GET(ac_Symbol) = yes,
                 [$2], [$3])dnl
 AC_VAR_POPDEF([ac_Symbol])dnl
-])dnl AC_NEED_DECL
+])dnl AC_CHECK_DECL
 
-dnl AC_NEED_DECLS(SYMBOL, [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED
+dnl AC_CHECK_DECLS(SYMBOL, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl               [, INCLUDES]]])
-dnl ---------------------------------------------------------------
-AC_DEFUN([AC_NEED_DECLS],
+dnl --------------------------------------------------------------
+AC_DEFUN([AC_CHECK_DECLS],
 [AC_FOREACH([AC_Symbol], [$1],
-  [AC_SPECIALIZE([AC_NEED_DECL], AC_Symbol,
-                 [AC_DEFINE_UNQUOTED(AC_TR_CPP(NEED_DECL_[]AC_Symbol))
-$2],
-                 [$3],
+  [AC_SPECIALIZE([AC_CHECK_DECL], AC_Symbol,
+                 [$2],
+                 [AC_DEFINE_UNQUOTED(AC_TR_CPP([NEED_]AC_Symbol[_DECL]))
+$3],
                  [$4])])
-])dnl AC_NEED_DECLS
+])dnl AC_CHECK_DECLS
 
 
 dnl ### Checking for library functions
index 06e0ee4fe092c546d16f790fa42d88e493fd43a0..e3f2c57489bb8fbc994ccaa3bb2f61d3d199abf0 100644 (file)
@@ -2438,7 +2438,7 @@ char *s = x(teststring);
 ], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))
 if test "${ac_cv_c_stringize}" = yes; then
   AC_DEFINE(HAVE_STRINGIZE, 1,
-            [Define if you have the ANSI # stringizing operator in cpp.])
+            [Define if cpp supports the ANSI # stringizing operator.])
 fi
 AC_MSG_RESULT([${ac_cv_c_stringize}])
 ])dnl AC_C_STRINGIZE