autoconf-patches
[Top][All Lists]
Advanced

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

Re: Improve AC_REPLACE_FUNCS


From: Eric Blake
Subject: Re: Improve AC_REPLACE_FUNCS
Date: Fri, 26 Feb 2010 16:17:13 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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