According to Eric Blake on 2/25/2010 4:52 PM:
>> m4_define([_AC_REPLACE_FUNC],
>> [AC_CHECK_FUNC([$1, [AC_LIBOBJ([$1])])
>> ])
>>
>> This should expand to just four lines per function.  It won't give a
>> size reduction but it would noticeably reduce forks.
> 
> By the way, AC_CHECK_FUNC is insufficient (it doesn't define HAVE_FUNC);
> but AC_CHECK_FUNCS generates efficient output with single-literal input.
> But I may decide to use the former with a copy of the HAVE_FUNC logic, if
> that proves to be faster at m4 time than the current approach of making
> AC_CHECK_FUNCS is acting on a single-element list.

After further testing, here's the incremental diff that I'm squashing onto
my previous proposal, which results in the fewest forks.

diff --git i/lib/autoconf/functions.m4 w/lib/autoconf/functions.m4
index f2e6ad6..aae7220 100644
--- i/lib/autoconf/functions.m4
+++ w/lib/autoconf/functions.m4
@@ -121,7 +121,9 @@ 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.
 m4_define([_AC_REPLACE_FUNC],
-[AC_CHECK_FUNCS([$1], [], [AC_LIBOBJ([$1])])])
+[AC_CHECK_FUNC([$1],
+  [_AH_CHECK_FUNC([$1])AC_DEFINE(AS_TR_CPP([HAVE_$1]))],
+  [AC_LIBOBJ([$1])])])

 # AC_REPLACE_FUNCS(FUNCTION...)
 # -----------------------------

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to