autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] AC_REPLACE_FUNCS: restore shell loop for non-literal


From: Eric Blake
Subject: [PATCH 1/2] AC_REPLACE_FUNCS: restore shell loop for non-literal
Date: Tue, 21 Sep 2010 17:14:09 -0600

* lib/autoconf/functions.m4 (AC_REPLACE_FUNCS): Handle
non-literals, which was lost in 2010-02-26 optimization.
* tests/semantics.at (AC_REPLACE_FUNCS): Enhance test.
* NEWS: Document the fix.
* THANKS: Update.
Reported by Wiseman Jun.

Signed-off-by: Eric Blake <address@hidden>
---

Maybe not as obvious, but the enhancements to the testsuite show that
when you pass non-literal lists, you are also responsible for
manually calling AH_TEMPLATE for each function, as well as calling
AC_LIBSOURCES for each function replacement file.  Basically, this
patch restores 2.65 behavior.

 ChangeLog                 |    8 ++++++++
 NEWS                      |   10 +++++++---
 THANKS                    |    1 +
 lib/autoconf/functions.m4 |    6 +++++-
 tests/semantics.at        |   13 ++++++++++---
 5 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f705a59..27ab27d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-09-21  Eric Blake  <address@hidden>

+       AC_REPLACE_FUNCS: restore shell loop for non-literal
+       * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS): Handle
+       non-literals, which was lost in 2010-02-26 optimization.
+       * tests/semantics.at (AC_REPLACE_FUNCS): Enhance test.
+       * NEWS: Document the fix.
+       * THANKS: Update.
+       Reported by Wiseman Jun.
+
        maint: resync upstream files
        * build-aux/gendocs.sh: Resync via 'make fetch'.

diff --git a/NEWS b/NEWS
index 65013c7..1cae249 100644
--- a/NEWS
+++ b/NEWS
@@ -5,12 +5,16 @@ GNU Autoconf NEWS - User visible changes.
 ** AC_MSG_ERROR (and AS_ERROR) can once again be followed immediately by
    `dnl'.  Regression introduced in 2.66.

-** AT_BANNER() with empty argument will cause visual separation from previous
-   test category.
-
 ** AC_INIT again allows URLs with '?' for its BUG-REPORT argument.
    Regression introduced in 2.66.

+** AC_REPLACE_FUNCS again allows a non-literal argument, such as a shell
+   variable that expands to a list of functions to check.  Regression
+   introduced in 2.66.
+
+** AT_BANNER() with empty argument will cause visual separation from previous
+   test category.
+
 ** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and
    AC_RUN_IFELSE now warn if the first argument failed to use
    AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file
diff --git a/THANKS b/THANKS
index 4acb36f..ed871a8 100644
--- a/THANKS
+++ b/THANKS
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index f03991b..ca02712 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -131,8 +131,12 @@ m4_define([_AC_REPLACE_FUNC],
 # equivalent of AC_CHECK_FUNC, then call AC_LIBOBJ if the function
 # was not found.
 AC_DEFUN([AC_REPLACE_FUNCS],
+[AS_LITERAL_IF([$1],
 [m4_map_args_w([$1], [_AC_REPLACE_FUNC(], [)
-])])
+])],
+[AC_CHECK_FUNCS([$1],
+  [_AH_CHECK_FUNC([$ac_func])AC_DEFINE(AS_TR_CPP([HAVE_$ac_func]))],
+  [_AC_LIBOBJ([$ac_func])])])])


 # AC_TRY_LINK_FUNC(FUNC, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
diff --git a/tests/semantics.at b/tests/semantics.at
index 48136cd..9fd08e0 100644
--- a/tests/semantics.at
+++ b/tests/semantics.at
@@ -176,8 +176,13 @@ AT_DATA([config.in],
 ])

 AT_CONFIGURE_AC(
-[AC_CONFIG_FILES(config.libobjs:config.in)
-AC_REPLACE_FUNCS(printf autoconf_ftnirp)])
+[AC_CONFIG_FILES([config.libobjs:config.in])
+AC_REPLACE_FUNCS([printf autoconf_ftnirp])
+funcs='fprintf autoconf_ftnirpf'
+AH_TEMPLATE([HAVE_FPRINTF], [])
+AH_TEMPLATE([HAVE_AUTOCONF_FTNIRPF], [])
+AC_REPLACE_FUNCS([$funcs])
+AS_UNSET([funcs])])

 AT_CHECK_AUTOCONF([-W obsolete])
 AT_CHECK_AUTOHEADER
@@ -185,11 +190,13 @@ AT_CHECK_CONFIGURE
 AT_CHECK_ENV
 AT_CHECK_DEFINES(
 [/* #undef HAVE_AUTOCONF_FTNIRP */
+/* #undef HAVE_AUTOCONF_FTNIRPF */
+#define HAVE_FPRINTF 1
 #define HAVE_PRINTF 1
 ])

 AT_CHECK([sed 's/  */ /g;s/^ //;s/ $//' config.libobjs], [],
-        [${LIBOBJDIR}autoconf_ftnirp$U.o
+        [${LIBOBJDIR}autoconf_ftnirp$U.o ${LIBOBJDIR}autoconf_ftnirpf$U.o
 ])

 AT_CLEANUP
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]