Re: [PATCH 1/3] AC_CHECK_HEADER/AC_CHECK_HEADERS: complete transition to compile tests.

Eric Blake <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 03/16/2013 10:37 AM, Zack Weinberg wrote:
> * lib/autoconf/headers.m4 (AC_CHECK_HEADER): Use _AC_CHECK_HEADER_COMPILE
>   by default.  Continue to use _AC_CHECK_HEADER_PREPROC if fourth arg is '-'.
>   (_AC_CHECK_HEADER_PREPROC): Issue a deprecation warning.
>   (_AC_CHECK_HEADER_MONGREL, _AC_CHECK_HEADER_MONGREL_BODY): Remove.
> 
> * tests/local.at (AT_CHECK_M4): Support 'stderr' as fourth argument.
> * tests/c.at, tests/semantics.at: Update uses of AC_CHECK_HEADER(S).
> * doc/autoconf.texi, NEWS: Document change.
> 
> Signed-off-by: Zack Weinberg <[email protected]>
> ---

>  # The m4_indir allows for fewer expansions of $@.
>  AC_DEFUN([AC_CHECK_HEADER],
>  [m4_indir(m4_case([$4],
> -		  [],  [[_AC_CHECK_HEADER_MONGREL]],
>  		  [-], [[_AC_CHECK_HEADER_PREPROC]],
>  		       [[_AC_CHECK_HEADER_COMPILE]]), $@)

Micro-optimization: when we had a ternary condition, m4_case was indeed
fastest, but now that we have a binary condition, write this:

[m4_indir(m4_if([$4], [-], [[_AC_CHECK_HEADER_PREPROC]],
                [[_AC_CHECK_HEADER_COMIPLE]]), $@)

> +++ b/tests/local.at
> @@ -113,13 +113,14 @@ m4_define([AT_CHECK_M4],
>  [AT_CHECK([$1], [$2], [$3],
>            m4_case([$4], [], [], [ignore], [ignore], [stderr]))
>  m4_case([$4], [], [], [ignore], [],
> -[AT_CHECK([[sed 's/^[^:]*m4[-.ex0-9]*: *\([^:]*:\) *\([0-9][0-9]*: \)/m4:\1\2/
> +[AT_CHECK([[mv stderr stderr-raw &&
> +   sed 's/^[^:]*m4[-.ex0-9]*: *\([^:]*:\) *\([0-9][0-9]*: \)/m4:\1\2/
>  	s/^\([^:]*:\) *\([0-9][0-9]*:\)[^:]*m4[-.ex0-9]*: /m4:\1\2 /
>  	s/: C\(annot open \)\([^`:]*\):/: c\1`\2'\'':/
>  	s/: include:\( cannot open\)/:\1/
>  	s/^autom4te: [^ ]*m4[.ex]* /autom4te: m4 /
>  	s/ (E[A-Z]*)$//
> -    ' stderr >&2]], [0], [], [$4])])
> +    ' stderr-raw >&2]], [0], [], [$4])])

This might be worth splitting into a separate patch, as it's a useful
cleanup whether or not you change AC_CHECK_HEADER.

Looks good with those changes.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 621 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJSMSprAAoJEKeha0olJ0NqqgEIAJaYWnm2FHrLs4HGkJ8ccB/5
PkzpW3a3NNVBxLDVQcwwrniW3w7Iv+yRMB3oO+JOG71QXq00T3zkqF3liAayywpl
TArjBBZ3ALCeqEkdDL9x1gg9f+kFZU4xcmutmUpXMemotsx603CA+2JD0yJegHTm
YlBqFQpsqdf2vFkc6CVuchvHctFqmidsLSdRvgbSI2nLTsR1EXeNm58uujfu7hVU
nKN6pYTgLxPUEH2LvvLcSDxFBgdLpTpPiE2FtsmbK40MSxoX5251/Ue1ycBdWJqC
9DAKss6eugbV0RMDArWH3o6zW4BA3KuByefGDqNOKBXLb6xhDGk6I9mowcKn0dc=
=QHY1
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.