autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 09/12] use a shell function for AC_CHECK_TYPE


From: Eric Blake
Subject: Re: [PATCH 09/12] use a shell function for AC_CHECK_TYPE
Date: Mon, 27 Oct 2008 14:18:33 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Paolo Bonzini <bonzini <at> gnu.org> writes:

> 
> 2008-10-27  Paolo Bonzini  <bonzini <at> gnu.org>
> 
>       * lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW_BODY): Extract
>       test body here.  Move head comment of _AC_CHECK_TYPE_NEW here.
>       (_AC_CHECK_TYPE_NEW): Define a shell function and call it.

Fix these nits, then apply.

> +# _AC_CHECK_TYPE_NEW_BODY
> +# -----------------------
> +# Shell function body for _AC_CHECK_TYPE_NEW.  This macro implements the
> +# former task of AC_CHECK_TYPE, with one big difference though: AC_CHECK_TYPE
> +# used to grep in the headers, which, BTW, led to many problems until the
>  # extended regular expression was correct and did not given false positives.

Inherited typo, but while we're touching this comment:
s/given/give/

> +m4_define([_AC_CHECK_TYPE_NEW_BODY],
> +[  AS_LINENO_PUSH([$[]1])
> +  AC_CACHE_CHECK([for $[]2], [$[]3],
> +  [AS_VAR_SET([$[]3], [no])
> +  AC_COMPILE_IFELSE(
> +    [AC_LANG_PROGRAM([$[]4],
> +       [if (sizeof ($[]2))
> +         return 0;])],
> +    [AC_COMPILE_IFELSE(
> +       [AC_LANG_PROGRAM([$[]4],
> +       [if (sizeof (($[]2)))
> +         return 0;])],
> +       [],
> +       [AS_VAR_SET([$[]3], [yes])])])])
> +  AS_LINENO_POP
> +])dnl

Not for this patch, but food for thought for a subsequent improvement.  We are 
spending quite a few forks building two different test files; it should be 
possible to build a single test file that does:

if (sizeof ($[]2))
  return 0;
#ifdef AC_SECOND
if (sizeof (($[]2)))
  return 0;
#endif

then invoke the compiler with -DAC_SECOND added to CFLAGS on the second run, to 
reduce the overhead inherent in two full-blown AC_COMPILE_IFELSE.  I don't 
think we can skip two separate compile runs, however, as I don't think we'll be 
lucky enough to accurately parse error messages to the point where we verify 
that the compiler only complained about the second statement.


> +[AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])]dnl
> +[ac_func_[]_AC_LANG_ABBREV[]_check_type "$LINENO" "$1" "ac_Type" ]dnl
> +["AS_ESCAPE([AC_INCLUDES_DEFAULT([$4], ["])])"

Font-lock works better if you use [""] as the pattern to AS_ESCAPE (no change 
in behavior, but " are now paired).

-- 
Eric Blake






reply via email to

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