1999-10-31 Akim Demaille <akim@epita.fr>

Perform a better checking for missing templates in autoheader.

	* autoheader.m4 (AH_HOOK): When hook AC_FOO on AH_FOO, define the
	new AC_FOO to be the expansion of both AH_FOO *and* AC_FOO.  See
	its definition for the motivations.

	* autoheader.m4 (AH_FUNC_ALLOCA): Remove the now useless
	additional templates.
This commit is contained in:
Akim Demaille 2000-01-10 10:06:51 +00:00
parent 0df82df28e
commit ecb19983da
5 changed files with 70 additions and 30 deletions

View File

@ -1,3 +1,14 @@
1999-10-31 Akim Demaille <akim@epita.fr>
Perform a better checking for missing templates in autoheader.
* autoheader.m4 (AH_HOOK): When hook AC_FOO on AH_FOO, define the
new AC_FOO to be the expansion of both AH_FOO *and* AC_FOO. See
its definition for the motivations.
* autoheader.m4 (AH_FUNC_ALLOCA): Remove the now useless
additional templates.
1999-10-31 Akim Demaille <akim@epita.fr> 1999-10-31 Akim Demaille <akim@epita.fr>
Work properly with Automake 1.4. Work properly with Automake 1.4.

View File

@ -260,7 +260,8 @@ if test $status -eq 0; then
if test $# -eq 0; then if test $# -eq 0; then
# Output is a file # Output is a file
if test -f ${config_h_in} && cmp -s $tmpout ${config_h_in}; then if test -f ${config_h_in} && cmp -s $tmpout ${config_h_in}; then
: # File didn't change, so don't update its mod time. # File didn't change, so don't update its mod time.
echo "$0: $config_h_in is unchanged" >&2
else else
mv -f $tmpout ${config_h_in} mv -f $tmpout ${config_h_in}
fi fi

View File

@ -36,12 +36,9 @@ dnl --------------------------------------------
dnl When running autoheader, this macro replaces AC_DEFINE and dnl When running autoheader, this macro replaces AC_DEFINE and
dnl AC_DEFINE_UNQUOTED. dnl AC_DEFINE_UNQUOTED.
dnl dnl
dnl We remember the symbols we already defined to avoid to define dnl If DESCRIPTION is not given, then there is a risk that VARIABLE will
dnl them twice. In the future we may want to use another program dnl not be properly templated. To control later that it has been
dnl than sh to issue the templates. For instance with AWK, we dnl templated elsewhere, store VARIABLE in a shell growing string, SYMS.
dnl may fill an associative array (key is $1, value is the template).
dnl This garantees that there is a unique prototype issued, and also
dnl that it will be sorted!
define([AH_DEFINE], define([AH_DEFINE],
[ifval([$3], [ifval([$3],
[AH_TEMPLATE([$1], [$3])], [AH_TEMPLATE([$1], [$3])],
@ -51,6 +48,7 @@ dnl Ignore CPP macro arguments.
])]) ])])
dnl AH_TEMPLATE(KEY, DESCRIPTION) dnl AH_TEMPLATE(KEY, DESCRIPTION)
dnl -----------------------------
dnl Issue an autoheader template for KEY, i.e., a comment composed dnl Issue an autoheader template for KEY, i.e., a comment composed
dnl of DESCRIPTION (properly wrapped), and then #undef KEY. dnl of DESCRIPTION (properly wrapped), and then #undef KEY.
define([AH_TEMPLATE], define([AH_TEMPLATE],
@ -87,19 +85,19 @@ define([AH_CHECK_HEADERS],
[AC_FOREACH([AC_Header], [$1], [AC_FOREACH([AC_Header], [$1],
[AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Header), [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Header),
[Define if you have the <]AC_Header[> header file.]) [Define if you have the <]AC_Header[> header file.])
# Success # Success
$2 $2
# Failure # Failure
$3])]) $3])])
define([AH_CHECK_DECLS], define([AH_CHECK_DECLS],
[AC_FOREACH([AC_Symbol], [$1], [AC_FOREACH([AC_Symbol], [$1],
[AH_TEMPLATE(AC_TR_CPP([NEED_]AC_Symbol[_DECL]), [AH_TEMPLATE(AC_TR_CPP([NEED_]AC_Symbol[_DECL]),
[Define if you need the declaration of `]AC_Symbol['.]) [Define if you need the declaration of `]AC_Symbol['.])
# Success # Success
$2 $2
# Failure # Failure
$3])]) $3])])
define([AH_CHECK_FUNCS], define([AH_CHECK_FUNCS],
[AC_FOREACH([AC_Func], [$1], [AC_FOREACH([AC_Func], [$1],
@ -136,17 +134,7 @@ define([AH_CHECK_MEMBERS],
define([AH_FUNC_ALLOCA], define([AH_FUNC_ALLOCA],
[AH_TEMPLATE(HAVE_ALLOCA_H, [AH_VERBATIM([STACK_DIRECTION],
[Define if you have <alloca.h> and it should be used
(not on Ultrix).])
AH_TEMPLATE(HAVE_ALLOCA,
[Define if you have `alloca', as a function or macro.])
AH_TEMPLATE(C_ALLOCA, [Define if using `alloca.c'.])
AH_TEMPLATE(CRAY_STACKSEG_END,
[Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
systems. This function is required for alloca.c support on those
systems.])
AH_VERBATIM([STACK_DIRECTION],
[/* If using the C implementation of alloca, define if you know the [/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be direction of stack growth for your system; otherwise it will be
automatically deduced at run-time. automatically deduced at run-time.
@ -194,9 +182,47 @@ define([AC_CONFIG_H], patsubst($1, [ .*$], []))dnl
@@@config_h=AC_CONFIG_H@@@ @@@config_h=AC_CONFIG_H@@@
]) ])
dnl Install a new hook for AH_ macros. dnl AH_HOOK(AUTOCONF-NAME, AUTOHEADER-NAME)
dnl ---------------------------------------
dnl Install a new hook for AH_ macros. Specify that the macro
dnl AUTOCONF-NAME will later be defined as the concatenation of
dnl both its former definition, and that of AUTOHEADER-NAME.
dnl
dnl There are motivations for not just defining to AUTOHEADER-NAME. For
dnl instance, if there is an AC macro which requires a special template
dnl but also has traditional AC_DEFINEs which are documented, then it is
dnl logical that these templates are preserved. AC_FUNC_ALLOCA is such an
dnl example.
dnl Another reason is that this way
dnl
dnl There are several for not just defining to be equivalent to
dnl AUTOHEADER-NAME.
dnl
dnl Let AC_FOO be
dnl | AC_DEFINE(FOO, 1)
dnl | AC_DEFINE(BAR, 1)
dnl | AC_DEFINE(BAZ, 1, The value of BAZ.)
dnl Let AH_FOO be
dnl | AH_TEMPLATE(FOO, The value of FOO.)
dnl
dnl If we hook AC_FOO to be AH_FOO only, then only FOO will be templated.
dnl If we hook AC_FOO to expand in both the former AC_FOO and AH_FOO, then
dnl both FOO and BAZ are templated.
dnl
dnl Additionaly, if AC_FOO is hooked to AH_FOO only, then we loose track
dnl of the other AC_DEFINE, and the autoheader machinery (see the use of
dnl the shell variable SYMS in AC_TEMPLATE) won't be able to see that BAR
dnl is not templated at all. Hooking AC_FOO on both its AC_ and AH_ faces
dnl makes sure we keep track of non templated DEFINEs.
dnl
dnl The two last end of lines make AH_HOOKS more readable.
define(AH_HOOK, define(AH_HOOK,
[m4_append([AH_HOOKS], [define([$1], defn([$2]))])]) [m4_append([AH_HOOKS],
[define([$1],
defn([$1])
defn([$2])
)
])])
dnl Autoheader is not the right program to complain about cross-compiling. dnl Autoheader is not the right program to complain about cross-compiling.

View File

@ -260,7 +260,8 @@ if test $status -eq 0; then
if test $# -eq 0; then if test $# -eq 0; then
# Output is a file # Output is a file
if test -f ${config_h_in} && cmp -s $tmpout ${config_h_in}; then if test -f ${config_h_in} && cmp -s $tmpout ${config_h_in}; then
: # File didn't change, so don't update its mod time. # File didn't change, so don't update its mod time.
echo "$0: $config_h_in is unchanged" >&2
else else
mv -f $tmpout ${config_h_in} mv -f $tmpout ${config_h_in}
fi fi

View File

@ -260,7 +260,8 @@ if test $status -eq 0; then
if test $# -eq 0; then if test $# -eq 0; then
# Output is a file # Output is a file
if test -f ${config_h_in} && cmp -s $tmpout ${config_h_in}; then if test -f ${config_h_in} && cmp -s $tmpout ${config_h_in}; then
: # File didn't change, so don't update its mod time. # File didn't change, so don't update its mod time.
echo "$0: $config_h_in is unchanged" >&2
else else
mv -f $tmpout ${config_h_in} mv -f $tmpout ${config_h_in}
fi fi