autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 2/3] autoconf: prefer an unrolled loop for trivial AC_CHECK_H


From: Eric Blake
Subject: Re: [PATCH 2/3] autoconf: prefer an unrolled loop for trivial AC_CHECK_HEADERS
Date: Mon, 31 Oct 2016 10:32:02 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 10/31/2016 06:39 AM, Paolo Bonzini wrote:
> An unrolled loop avoids the cost of spawning sed in AS_TR_SH and
> AS_TR_CPP.  Prefer it if there is nothing in the second and third
> argument of AC_CHECK_HEADERS and the first argument is a literal.
> Modify AC_CHECK_HEADERS_ONCE to avoid the variable indirection too.
> 
> * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Unroll loop if safe.
> (_AC_CHECK_HEADERS): Move basic implementation here.
> (_AC_CHECK_HEADER_ONCE): Expand AC_CHECK_HEADERS here...
> (_AC_HEADERS_EXPANSION): ... and not here, so remove.
> (AC_CHECK_INCLUDES_DEFAULT): Remove unnecessary arguments after the first.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  lib/autoconf/headers.m4 | 30 +++++++++++++-----------------
>  1 file changed, 13 insertions(+), 17 deletions(-)
> 
> diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
> index 72262c1..e855025 100644
> --- a/lib/autoconf/headers.m4
> +++ b/lib/autoconf/headers.m4
> @@ -182,22 +182,25 @@ m4_define([AH_CHECK_HEADERS],
>  # header.  Either ACTION may include `break' to stop the search.
>  AC_DEFUN([AC_CHECK_HEADERS],
>  [m4_map_args_w([$1], [_AH_CHECK_HEADER(], [)])]dnl
> -[AS_FOR([AC_header], [ac_header], [$1],
> -[AC_CHECK_HEADER(AC_header,
> -              [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_]AC_header)) $2],
> -              [$3], [$4])dnl])
> +[m4_if([$2$3]AS_LITERAL_IF([$1], [yes], [no]), []yes,

Again, why []yes instead of [yes]?

>  
>  ## --------------------- ##
> @@ -261,8 +258,7 @@ ac_includes_default="\
>  #endif"
>  ])]dnl
>  [_AC_CHECK_HEADERS_ONCE(
> -  [sys/types.h sys/stat.h strings.h inttypes.h stdint.h unistd.h],
> -  [], [], [$ac_includes_default])]dnl
> +  [sys/types.h sys/stat.h strings.h inttypes.h stdint.h unistd.h])]dnl

This one, I'm worried about.  $ac_includes_default is a shell variable
not documented in the manual (so we can probably get away with changing
it), but doesn't it exist so that projects can redefine the core set of
default headers to check by default, whereas you are now losing that
flexibility?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
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]