[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wed, 16 Sep 2009 21:37:53 +0000 (UTC)
I've been playing with this patch for more than a week. It gives a reduction
in size by using more AC_CHECK_FUNCS_ONCE instead of inline function checks,
and can reduce forks by using a literal rather than a shell variable in more
places; particularly when doing AC_REPLACE_FUNCS([a b]).
It doesn't impact gnulib: each project using gnulib is given an override of
AC_LIBOBJ that fits in better with the concept of multiple libraries, and
gnulib currently has to hijack AC_REPLACE_FUNCS because it was not using
AC_LIBOBJ prior to this patch. But once gnulib can assume autoconf 2.65, it
will also reduce configure size there. Meanwhile, we should someday figure out
how to improve AC_LIBOBJ to fit gnulib's needs of multiple replacement object
From: Eric Blake <address@hidden>
Date: Wed, 9 Sep 2009 08:32:46 -0600
Subject: [PATCH] Optimize AC_REPLACE_FUNCS.
* lib/autoconf/functions.m4 (_AC_REPLACE_FUNC): New helper macro.
(AC_REPLACE_FUNCS): Use it to check for functions only once, and
to pass literal rather than shell variable to AC_LIBOBJ.
Signed-off-by: Eric Blake <address@hidden>
ChangeLog | 7 +++++++
lib/autoconf/functions.m4 | 17 ++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 50f6fb7..3a4d9f5 100644
@@ -1,3 +1,10 @@
+2009-09-16 Eric Blake <address@hidden>
+ Optimize AC_REPLACE_FUNCS.
+ * lib/autoconf/functions.m4 (_AC_REPLACE_FUNC): New helper macro.
+ (AC_REPLACE_FUNCS): Use it to check for functions only once, and
+ to pass literal rather than shell variable to AC_LIBOBJ.
2009-09-15 Peter Breitenlohner <address@hidden>
Implement and document Objective C++ support.
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 810a0a7..cc2d99d 100644
@@ -116,12 +116,23 @@ m4_define([_AC_FUNCS_EXPANSION],
+# If FUNCTION exists, define HAVE_FUNCTION; else add FUNCTION.c
+# to the list of library objects. FUNCTION must be literal.
+[_AC_CHECK_FUNC_ONCE([$1])if test "x$ac_cv_func_$1" != xyes; then
+# For each FUNCTION in the whitespace separated list, perform the
+# equivalent of AC_CHECK_FUNC, then call AC_LIBOBJ if the function
+# was not found.
-[m4_map_args_w([$1], [AC_LIBSOURCE(], [.c)])]dnl
-[AC_CHECK_FUNCS([$1], , [_AC_LIBOBJ($ac_func)])
+[m4_map_args_w([$1], [_AC_REPLACE_FUNC(], [)
# AC_TRY_LINK_FUNC(FUNC, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
- Improve AC_REPLACE_FUNCS,
Eric Blake <=