automake-patches
[Top][All Lists]
Advanced

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

Re: conditional AC_CONFIG_FILES:AM_COND_IF.


From: Eric Blake
Subject: Re: conditional AC_CONFIG_FILES:AM_COND_IF.
Date: Fri, 21 Mar 2008 13:02:15 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:

> Comments, reviews appreciated.

Looks like a good idea.  Sorry for the delayed review.

> @@ -4881,6 +4889,9 @@ sub scan_autoconf_traces ($)
>               AM_MAINTAINER_MODE => 0,
>               AM_PROG_CC_C_O => 0,
>               _AM_SUBST_NOTMAKE => 1,
> +             _AM_COND_IF => 1,
> +             _AM_COND_ELSE => 1,
> +             _AM_COND_ENDIF => 1,

Based on your question about trace order, should this section be modified to
take macro invocation depth into account to work around underquoted usage?

> address@hidden AM_COND_IF
> +This macro allows to access a conditional introduced with
> address@hidden later in @file{configure.ac} in a way that
> address@hidden can detect, thus enabling conditional
> address@hidden (@pxref{Conditionals}).

s/to access/access to/

But it still comes off awkwardly (is the AM_CONDITIONAL later in the file?). 
How about:

This macro allows @code{automake} to detect subsequent access within
@file{configure.ac} to a conditional previously introduced with
@code{AM_CONDITIONAL}, thus enabling conditional @code{AC_CONFIG_FILES}
(@pxref{Conditionals}).

> 
> address@hidden AM_COND_IF
> +In order to allow access to the condition registered by
> address@hidden inside @file{configure.ac} and to allow

I think s/ and/,\&/ helps the flow of the sentence.

> +conditional @code{AC_CONFIG_FILES}, @code{AM_COND_IF} may be used:
> +
> address@hidden AM_COND_IF (@var{conditional}, @var{if-true}, @var{if-false})

Would it be worth copying autoconf's @ovar macro?  It is designed for use inside
@defmac, and adds nice markup for optional parameters (such as if-false).

> +If @var{conditional} is fulfilled, execute @var{if-true}, otherwise
> +execute @var{if-false}.  If the contain @code{AC_CONFIG_FILES}, it
> +will cause @command{automake} to output the rules for the respective
> +files only for the given condition.

s/the contain/either branch contains/

>  # AM_CONDITIONAL(NAME, SHELL-CONDITION)
>  # -------------------------------------
> @@ -20,6 +20,7 @@ AC_SUBST([$1_TRUE])dnl
>  AC_SUBST([$1_FALSE])dnl
>  _AM_SUBST_NOTMAKE([$1_TRUE])dnl
>  _AM_SUBST_NOTMAKE([$1_FALSE])dnl
> +m4_define([_AM_COND_VALUE_]$1, [$2])dnl

Was it intentional to use $1 unquoted?  That's asking for problems if $1
contains , or is a macro name.

> +# AM_COND_IF(COND, [IF-TRUE], [IF-FALSE])
> +# ---------------------------------------
> +# If the shell condition matchind COND is true, execute IF-TRUE,

s/matchind/matching/

> +# otherwise execute IF-FALSE.  Allow automake to learn about conditional
> +# instantiating macros (the AC_CONFIG_FOOS).
> +AC_DEFUN([AM_COND_IF],
> +[m4_ifndef([_AM_COND_VALUE_]$1,
> +        [m4_fatal([$0: no such condition "$1"])])dnl

Likewise.  I would use [_AM_COND_VALUE_$1].

> +_AM_COND_IF([$1])dnl
> +if _AM_COND_VALUE_]$1[; then

and not break the quotes here.

-- 
Eric Blake






reply via email to

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