From 2a7761f95f4fedd4c764c989f14700a4a54be2fd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 29 Dec 2006 06:44:41 +0000 Subject: [PATCH] * lib/autoconf/general.m4 (AC_DEFINE_TRACE): Don't include preprocessor macro arguments in traced name. * doc/autoconf.texi (Defining symbols): Document longstanding support for AC_DEFINE-ing macros with arguments, and document behavior when the same variable has multiple AC_DEFINEs. * lib/autoconf/fortran.m4 (_AC_FC_WRAPPERS): Revert to the old implementation which AC_DEFINEs the FC_FUNC and FC_FUNC_ macros directly, giving much shorter and simpler code. --- ChangeLog | 11 ++++++ doc/autoconf.texi | 15 +++++++- lib/autoconf/fortran.m4 | 100 ++++++++++++++---------------------------------- lib/autoconf/general.m4 | 2 +- 4 files changed, 54 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index d66ea034..501f72b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-12-28 Steven G. Johnson + + * lib/autoconf/general.m4 (AC_DEFINE_TRACE): Don't include + preprocessor macro arguments in traced name. + * doc/autoconf.texi (Defining symbols): Document longstanding + support for AC_DEFINE-ing macros with arguments, and document + behavior when the same variable has multiple AC_DEFINEs. + * lib/autoconf/fortran.m4 (_AC_FC_WRAPPERS): Revert to the + old implementation which AC_DEFINEs the FC_FUNC and FC_FUNC_ + macros directly, giving much shorter and simpler code. + 2006-12-28 Malcolm Purvis (trivial change) * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Insert a diff --git a/doc/autoconf.texi b/doc/autoconf.texi index b217075a..f225e794 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -8252,8 +8252,15 @@ output. @defmacx AC_DEFINE (@var{variable}) @acindex{DEFINE} Define @var{variable} to @var{value} (verbatim), by defining a C -object-like macro for @var{variable}. @var{variable} should be a C -identifier that contains only letters, digits, and underscores. +preprocessor macro for @var{variable}. @var{variable} should be a C +identifier, optionally suffixed by a parenthesized argument list to +define a C preprocessor macro with arguments. The macro argument list, +if present, should be a comma-separated list of C identifiers, possibly +terminated by an ellipsis @samp{...} if C99 syntax is employed. +@var{variable} should not contain comments, white space, trigraphs, +backslash-newlines, universal character names, or non-@acronym{ASCII} +characters. + @var{value} should not contain literal newlines, and if you are not using @code{AC_CONFIG_HEADERS} it should not contain any @samp{#} characters, as @command{make} tends to eat them. To use a shell variable, @@ -8276,6 +8283,10 @@ is obsolescent and may be withdrawn in future versions of Autoconf. If the @var{variable} is a literal string, it is passed to @code{m4_pattern_allow} (@pxref{Forbidden Patterns}). + +If multiple @code{AC_DEFINE} statements are executed for the same +@var{variable} name (not counting any parenthesized argument list), +the last one wins. @end defmac @defmac AC_DEFINE_UNQUOTED (@var{variable}, @var{value}, @ovar{description}) diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index b7dbe4c7..e53a2e5b 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -1033,82 +1033,40 @@ AC_LANG_POP(Fortran)dnl # scheme used by the Fortran compiler. AC_DEFUN([_AC_FC_WRAPPERS], [_AC_FORTRAN_ASSERT()dnl +AH_TEMPLATE(_AC_FC[_FUNC], + [Define to a macro mangling the given C identifier (in lower and upper + case), which must not contain underscores, for linking with Fortran.])dnl +AH_TEMPLATE(_AC_FC[_FUNC_], + [As ]_AC_FC[_FUNC, but for C identifiers containing underscores.])dnl case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in - 'lower case, no underscore, extra underscore' | \ - 'lower case, underscore, no extra underscore' | \ - 'lower case, underscore, extra underscore' | \ - 'upper case, no underscore, no extra underscore' | \ - 'upper case, no underscore, extra underscore' | \ - 'upper case, underscore, no extra underscore' | \ - 'upper case, underscore, extra underscore') ;; + "lower case, no underscore, no extra underscore") + AC_DEFINE(_AC_FC[_FUNC(name,NAME)], [name]) + AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name]) ;; + "lower case, no underscore, extra underscore") + AC_DEFINE(_AC_FC[_FUNC(name,NAME)], [name]) + AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name ## _]) ;; + "lower case, underscore, no extra underscore") + AC_DEFINE(_AC_FC[_FUNC(name,NAME)], [name ## _]) + AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name ## _]) ;; + "lower case, underscore, extra underscore") + AC_DEFINE(_AC_FC[_FUNC(name,NAME)], [name ## _]) + AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name ## __]) ;; + "upper case, no underscore, no extra underscore") + AC_DEFINE(_AC_FC[_FUNC(name,NAME)], [NAME]) + AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME]) ;; + "upper case, no underscore, extra underscore") + AC_DEFINE(_AC_FC[_FUNC(name,NAME)], [NAME]) + AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME ## _]) ;; + "upper case, underscore, no extra underscore") + AC_DEFINE(_AC_FC[_FUNC(name,NAME)], [NAME ## _]) + AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME ## _]) ;; + "upper case, underscore, extra underscore") + AC_DEFINE(_AC_FC[_FUNC(name,NAME)], [NAME ## _]) + AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME ## __]) ;; *) AC_MSG_WARN([unknown Fortran name-mangling scheme]) ;; esac -case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in #( - 'upper case',*,) - AC_DEFINE(_AC_FC[_UPPER_CASE], 1, - [Define to 1 if upper case spelling should be used.]);; -esac -case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in #( - *,' underscore',*) - AC_DEFINE(_AC_FC[_UNDERSCORE], 1, - [Define to 1 if an underscore should be appended.]);; -esac -case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in #( - *,*,' extra underscore') - AC_DEFINE(_AC_FC[_EXTRA_UNDERSCORE], 1, - [Define to 1 if an extra underscore should be appended.]);; -esac -AH_VERBATIM(_AC_FC[_FUNC], -[/* Define to 1 if upper case spelling should be used. */ -#undef ]_AC_FC[_UPPER_CASE - -/* Define to 1 if an underscore should be appended. */ -#undef ]_AC_FC[_UNDERSCORE - -/* Define to 1 if an extra underscore should be appended. */ -#undef ]_AC_FC[_EXTRA_UNDERSCORE - -/* Define to a macro mangling the given C identifier (in lower and upper - case), which must not contain underscores, for linking with Fortran. */ -#ifdef ]_AC_FC[_UPPER_CASE -# ifdef ]_AC_FC[_UNDERSCORE -# ifdef ]_AC_FC[_EXTRA_UNDERSCORE -# define ]_AC_FC[_FUNC(name, NAME) NAME ## _ -# define ]_AC_FC[_FUNC_(name, NAME) NAME ## __ -# else -# define ]_AC_FC[_FUNC(name, NAME) NAME ## _ -# define ]_AC_FC[_FUNC_(name, NAME) NAME ## _ -# endif -# else -# ifdef ]_AC_FC[_EXTRA_UNDERSCORE -# define ]_AC_FC[_FUNC(name, NAME) NAME -# define ]_AC_FC[_FUNC_(name, NAME) NAME ## _ -# else -# define ]_AC_FC[_FUNC(name, NAME) NAME -# define ]_AC_FC[_FUNC_(name, NAME) NAME -# endif -# endif -#else -# ifdef ]_AC_FC[_UNDERSCORE -# ifdef ]_AC_FC[_EXTRA_UNDERSCORE -# define ]_AC_FC[_FUNC(name, NAME) name ## _ -# define ]_AC_FC[_FUNC_(name, NAME) name ## __ -# else -# define ]_AC_FC[_FUNC(name, NAME) name ## _ -# define ]_AC_FC[_FUNC_(name, NAME) name ## _ -# endif -# else -# ifdef ]_AC_FC[_EXTRA_UNDERSCORE -# define ]_AC_FC[_FUNC(name, NAME) name -# define ]_AC_FC[_FUNC_(name, NAME) name ## _ -# else -# define ]_AC_FC[_FUNC(name, NAME) name -# define ]_AC_FC[_FUNC_(name, NAME) name -# endif -# endif -#endif]) ])# _AC_FC_WRAPPERS diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 5e10d7bd..0e2c8eb4 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1987,7 +1987,7 @@ m4_bmatch([$1], ^m4_defn([m4_re_word])$, [], # This macro is a wrapper around AC_DEFINE_TRACE_LITERAL which filters # out non literal symbols. m4_define([AC_DEFINE_TRACE], -[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL([$1])])]) +[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL(m4_bpatsubst([[$1]], [(.*)]))])]) # AC_DEFINE(VARIABLE, [VALUE], [DESCRIPTION]) -- 2.11.4.GIT