autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 3/3] Use AC_CHECK_HEADERS_ONCE for the tests done by AC_INCLU


From: Eric Blake
Subject: Re: [PATCH 3/3] Use AC_CHECK_HEADERS_ONCE for the tests done by AC_INCLUDES_DEFAULT.
Date: Wed, 11 Sep 2013 21:16:06 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

On 09/06/2013 08:10 PM, Zack Weinberg wrote:
>  * lib/autoconf/headers.m4 (AC_CHECK_HEADERS_ONCE): Divide into a public
>    macro that AC_REQUIREs _AC_INCLUDES_DEFAULT_REQUIREMENTS, and ...
>    (_AC_CHECK_HEADERS_ONCE): ... a private macro, that doesn't.
>    (_AC_HEADERS_EXPANSION): Use $ac_includes_default, not AC_INCLUDES_DEFAULT.
>    (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Use AC_CHECK_HEADERS_ONCE.
>    (all of the above): Sprinkle dnl's around.
> 
> Signed-off-by: Zack Weinberg <address@hidden>
> ---
>  lib/autoconf/headers.m4 |   24 +++++++++++++++---------
>  1 files changed, 15 insertions(+), 9 deletions(-)
> 

>  
>  m4_define([_AC_HEADERS_EXPANSION],
> -[
> -  m4_divert_text([DEFAULTS], [ac_header_list=])
> -  AC_CHECK_HEADERS([$ac_header_list], [], [], [AC_INCLUDES_DEFAULT])
> -  m4_define([_AC_HEADERS_EXPANSION], [])
> +[dnl
> +  m4_divert_text([DEFAULTS], [ac_header_list=])dnl
> +  AC_CHECK_HEADERS([$ac_header_list], [], [], [$ac_includes_default])dnl
> +  m4_define([_AC_HEADERS_EXPANSION], [])dnl
>  ])

Rather than adding expanded dnl's (which cause more m4 processing time
every time _AC_HEADERS_EXPANSION is expanded), it's better to avoid the
spurious whitespace in the first place.  I've lately been using a style:

m4_define([_AC_HEADERS_EXPANSION],
[m4_divert_text([DEFAULTS], [ac_header_list=])]dnl
[AC_CHECK_HEADERS([$ac_header_list], [], [], [$ac_includes_default])]dnl
[m4_define([_AC_HEADERS_EXPANSION])])

Note that in my style, the dnl's are processed exactly once, while
piecing together the outer m4_define's argument, and the definition has
no spurious whitespace to begin with, so overall processing is somewhat
faster.

>  dnl For backward compatibility, provide unconditional AC_DEFINEs of
>  dnl HAVE_STDLIB_H, HAVE_STRING_H, and STDC_HEADERS.
>  AC_DEFINE(HAVE_STDLIB_H, 1,
>    [Always define to 1, for backward compatibility.
> -   You can assume <stdlib.h> exists.])
> +   You can assume <stdlib.h> exists.])dnl

Uggh.  This was new code in 2/3; you should avoid churn by rebasing this
hunk (or even better, using my style of "]dnl
[") into that patch.

Looks nice.  I'd still like to see another spin of this series that adds
a new public macro so that users can explicitly does what
_AC_INCLUDES_DEFAULT_REQUIREMENTS does now.

-- 
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]