From: Akim Demaille Date: Tue, 28 Sep 1999 08:37:40 +0000 (+0000) Subject: 1999-09-28 Akim Demaille X-Git-Tag: experimental-pre-merge-trunk-into-experimental-1999-10-01~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=097e336c3c2ed3fde68687675d9a8a9482d6f4d7;p=thirdparty%2Fautoconf.git 1999-09-28 Akim Demaille * 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. --- diff --git a/ChangeLog b/ChangeLog index f1e0ff69..451a0da7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +1999-09-28 Akim Demaille + + * 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 * acgeneral.m4 (AC_OUTPUT): Divert AC_OUTPUT_FILE to diff --git a/acgeneral.m4 b/acgeneral.m4 index d019024f..0b9c9d43 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2491,16 +2491,16 @@ dnl ]) 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 +[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 #ifdef HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include @@ -2522,36 +2522,36 @@ AC_CACHE_CHECK([whether $1 is declared], ac_Symbol, #ifdef HAVE_UNISTD_H # include #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 diff --git a/autoconf.texi b/autoconf.texi index 8f58198a..4cdbe87f 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -2633,30 +2633,29 @@ 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-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 diff --git a/autoheader.sh b/autoheader.sh index da644b62..df2b516b 100644 --- a/autoheader.sh +++ b/autoheader.sh @@ -264,8 +264,8 @@ if test -n "$decls"; then 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 diff --git a/configure b/configure index 26bc53ab..10e9633e 100755 --- a/configure +++ b/configure @@ -913,6 +913,7 @@ Usage: $CONFIG_STATUS [OPTIONS] FILE... Files to instanciate: Configuration files: Makefile testsuite/Makefile + Report bugs to ." ac_cs_version="\ diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 8f58198a..4cdbe87f 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2633,30 +2633,29 @@ 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-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 diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index d019024f..0b9c9d43 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2491,16 +2491,16 @@ dnl ]) 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 +[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 #ifdef HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include @@ -2522,36 +2522,36 @@ AC_CACHE_CHECK([whether $1 is declared], ac_Symbol, #ifdef HAVE_UNISTD_H # include #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