+1999-09-28 Akim Demaille <akim@epita.fr>
+
+ * acgeneral.m4 (AC_NEED_DECL): When $4 is given, don't provide
+ defaults headers.
+ Change the message from `have' to `need'.
+ Change the actions for `if-(not-)found' to `if-(not-)needed.
+ Remove trailing parentheses.
+
+ * acgeneral.m4 (AC_NEED_DECLS): Change the actions for
+ `if-(not-)found' to `if-(not-)needed.
+ Define NEED_DECL_foo, instead of NEED_foo_DECL.
+
+ * autoheader.sh (decls): Reflect this.
+
+ * autoconf.texi (Generic Declarations): Update.
+
1999-09-27 Akim Demaille <akim@epita.fr>
* acgeneral.m4 (AC_OUTPUT): Divert AC_OUTPUT_FILE to
dnl ### Checking for declared symbols
-dnl AC_NEED_DECL(SYMBOL, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
+dnl AC_NEED_DECL(SYMBOL, [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED
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_decl_$1])dnl
-AC_CACHE_CHECK([whether $1 is declared], ac_Symbol,
-[AC_TRY_COMPILE([#include <stdio.h>
+[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_need_decl_$1])dnl
+AC_CACHE_CHECK([whether $1 needs to be declared], ac_Symbol,
+[AC_TRY_COMPILE(m4_default([$4], [#include <stdio.h>
#ifdef HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-$4],
+]),
[#ifndef $1
char *p = (char *) $1;
#endif
],
-AC_VAR_SET(ac_Symbol, yes), AC_VAR_SET(ac_Symbol, no))])
+AC_VAR_SET(ac_Symbol, no), AC_VAR_SET(ac_Symbol, yes))])
AC_SHELL_IFELSE(test AC_VAR_GET(ac_Symbol) = yes,
- [$2], [$3])dnl
+ [$2], [$3])dnl
AC_VAR_POPDEF([ac_Symbol])dnl
])dnl AC_NEED_DECL
-dnl AC_NEED_DECLS(SYMBOL, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
-dnl [, INCLUDES,]]])
-dnl -------------------------------------------------------------
+dnl AC_NEED_DECLS(SYMBOL, [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED
+dnl [, INCLUDES]]])
+dnl ---------------------------------------------------------------
AC_DEFUN([AC_NEED_DECLS],
-[AC_FOREACH([ac_Symbol], [$1],
- [AC_SPECIALIZE([AC_NEED_DECL], ac_Symbol,
- [$2],
- [AC_DEFINE_UNQUOTED(AC_TR_CPP(NEED_[]ac_Symbol[]_DECL))
-$3],
- [$4])])])
+[AC_FOREACH([AC_Symbol], [$1],
+ [AC_SPECIALIZE([AC_NEED_DECL], AC_Symbol,
+ [AC_DEFINE_UNQUOTED(AC_TR_CPP(NEED_DECL_[]AC_Symbol))
+$2],
+ [$3],
+ [$4])])
])dnl AC_NEED_DECLS
-dnl This is the pure sh versions of the macro above.
+dnl This is the pure sh version of the macro above.
dnl [for ac_sym in [$1]
dnl do
dnl AC_NEED_DECL($ac_sym,
-dnl [$4],
-dnl [AC_DEFINE_UNQUOTED(AC_TR_CPP(${ac_sym}_DECLARED)) $2],
-dnl [$3])dnl
+dnl [$2],
+dnl [AC_DEFINE_UNQUOTED(AC_TR_CPP(${ac_sym}_DECLARED)) $3],
+dnl [$4])dnl
dnl done
dnl ### Checking for library functions
These macros are used to find declarations not covered by the particular
test macros.
-@defmac AC_NEED_DECL (@var{symbol} @r{[}, @var{action-if-found}@r{[}, @var{action-if-not-found} @r{[},@var{includes} @r{]]]})
+@defmac AC_NEED_DECL (@var{symbol} @r{[}, @var{action-if-needed}@r{[}, @var{action-if-not-needed} @r{[},@var{includes} @r{]]]})
@maindex NEED_DECL
-If @var{symbol} (a function or a variable) is declared in
-@file{stdio.h}, @file{stdlib.h}, @file{stddef.h}, @file{memory.h},
-@file{string.h}, @file{strings.h}, and @file{unistd.h}. (plus
-@var{includes} if given), run the shell commands @var{action-if-found},
-otherwise @var{action-if-not-found}.
+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{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.
This macro actually tests whether it is valid to use @var{symbol} as an
r-value, not if it is really declared, because it is much safer to avoid
introducing extra declarations when not needed.
-
-Please, note that @var{action-if-found} when the symbol is declared, not
-when it is needed.
@end defmac
-@defmac AC_NEED_DECLS (@var{symbol} @r{[}, @var{action-if-found}@r{[}, @var{action-if-not-found} @r{[},@var{includes} @r{]]]})
+@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_@var{symbol}_DECL
+@cvindex NEED_DECL_@var{symbol}
For each given @var{symbol} (whitespace-separated), define
-@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-found} is
+@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
given, it is additional shell code to execute when one of the function
-declarations is found, otherwise @var{action-if-not-found} is executed.
+declarations is needed, otherwise @var{action-if-not-needed} is
+executed.
@end defmac
for decl in `for x in $decls; do echo $x; done | sort | uniq`; do
sym="`echo ${decl} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
echo "
-/* Define if you need the \`${decl}' declaration. */
-#undef NEED_${sym}_DECL"
+/* Define if you need the declaration of \`${decl}'. */
+#undef NEED_DECL_${sym}"
done
fi
Files to instanciate:
Configuration files:
Makefile testsuite/Makefile
+
Report bugs to <bug-autoconf@gnu.org>."
ac_cs_version="\
These macros are used to find declarations not covered by the particular
test macros.
-@defmac AC_NEED_DECL (@var{symbol} @r{[}, @var{action-if-found}@r{[}, @var{action-if-not-found} @r{[},@var{includes} @r{]]]})
+@defmac AC_NEED_DECL (@var{symbol} @r{[}, @var{action-if-needed}@r{[}, @var{action-if-not-needed} @r{[},@var{includes} @r{]]]})
@maindex NEED_DECL
-If @var{symbol} (a function or a variable) is declared in
-@file{stdio.h}, @file{stdlib.h}, @file{stddef.h}, @file{memory.h},
-@file{string.h}, @file{strings.h}, and @file{unistd.h}. (plus
-@var{includes} if given), run the shell commands @var{action-if-found},
-otherwise @var{action-if-not-found}.
+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{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.
This macro actually tests whether it is valid to use @var{symbol} as an
r-value, not if it is really declared, because it is much safer to avoid
introducing extra declarations when not needed.
-
-Please, note that @var{action-if-found} when the symbol is declared, not
-when it is needed.
@end defmac
-@defmac AC_NEED_DECLS (@var{symbol} @r{[}, @var{action-if-found}@r{[}, @var{action-if-not-found} @r{[},@var{includes} @r{]]]})
+@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_@var{symbol}_DECL
+@cvindex NEED_DECL_@var{symbol}
For each given @var{symbol} (whitespace-separated), define
-@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-found} is
+@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
given, it is additional shell code to execute when one of the function
-declarations is found, otherwise @var{action-if-not-found} is executed.
+declarations is needed, otherwise @var{action-if-not-needed} is
+executed.
@end defmac
dnl ### Checking for declared symbols
-dnl AC_NEED_DECL(SYMBOL, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
+dnl AC_NEED_DECL(SYMBOL, [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED
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_decl_$1])dnl
-AC_CACHE_CHECK([whether $1 is declared], ac_Symbol,
-[AC_TRY_COMPILE([#include <stdio.h>
+[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_need_decl_$1])dnl
+AC_CACHE_CHECK([whether $1 needs to be declared], ac_Symbol,
+[AC_TRY_COMPILE(m4_default([$4], [#include <stdio.h>
#ifdef HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-$4],
+]),
[#ifndef $1
char *p = (char *) $1;
#endif
],
-AC_VAR_SET(ac_Symbol, yes), AC_VAR_SET(ac_Symbol, no))])
+AC_VAR_SET(ac_Symbol, no), AC_VAR_SET(ac_Symbol, yes))])
AC_SHELL_IFELSE(test AC_VAR_GET(ac_Symbol) = yes,
- [$2], [$3])dnl
+ [$2], [$3])dnl
AC_VAR_POPDEF([ac_Symbol])dnl
])dnl AC_NEED_DECL
-dnl AC_NEED_DECLS(SYMBOL, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
-dnl [, INCLUDES,]]])
-dnl -------------------------------------------------------------
+dnl AC_NEED_DECLS(SYMBOL, [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED
+dnl [, INCLUDES]]])
+dnl ---------------------------------------------------------------
AC_DEFUN([AC_NEED_DECLS],
-[AC_FOREACH([ac_Symbol], [$1],
- [AC_SPECIALIZE([AC_NEED_DECL], ac_Symbol,
- [$2],
- [AC_DEFINE_UNQUOTED(AC_TR_CPP(NEED_[]ac_Symbol[]_DECL))
-$3],
- [$4])])])
+[AC_FOREACH([AC_Symbol], [$1],
+ [AC_SPECIALIZE([AC_NEED_DECL], AC_Symbol,
+ [AC_DEFINE_UNQUOTED(AC_TR_CPP(NEED_DECL_[]AC_Symbol))
+$2],
+ [$3],
+ [$4])])
])dnl AC_NEED_DECLS
-dnl This is the pure sh versions of the macro above.
+dnl This is the pure sh version of the macro above.
dnl [for ac_sym in [$1]
dnl do
dnl AC_NEED_DECL($ac_sym,
-dnl [$4],
-dnl [AC_DEFINE_UNQUOTED(AC_TR_CPP(${ac_sym}_DECLARED)) $2],
-dnl [$3])dnl
+dnl [$2],
+dnl [AC_DEFINE_UNQUOTED(AC_TR_CPP(${ac_sym}_DECLARED)) $3],
+dnl [$4])dnl
dnl done
dnl ### Checking for library functions