bug-autoconf
[Top][All Lists]
Advanced

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

Re: AC_SUBST_FILE regression in -cvs


From: Stepan Kasal
Subject: Re: AC_SUBST_FILE regression in -cvs
Date: Tue, 12 Jul 2005 12:39:24 +0200
User-agent: Mutt/1.4.1i

Hello,

several more ideas.  Numbering starts from 7 today.

On Mon, Jul 11, 2005 at 10:35:51PM +0200, Peter Ekberg wrote:
> > ------8<------
> > EXPSYMS: EXPSYMS.in EXPSYMS.extra
> >     cat EXPSYMS.in EXPSYMS.extra >$@
> > ------8<------
[...]
> 
> A bit convoluted, but EXPSYMS.extra is empty for most systems and
> I would prefer if it didn't need to exist. [...]

7) Then you perhaps could use AM_CONDITIONAL (see the Automake manual):

In configure.ac:
------8<------
AM_CONDITIONAL([EXPSYMS_EXTRA], [text $extra = yes])
if text $extra = yes; then
        echo '_foo
_bar' >EXPSYMS.extra
fi
------8<------
and in Makefile.am:
------8<------
EXPSYMS_src = EXPSYMS.in
if EXPSYMS_EXTRA
  EXPSYMS_src += EXPSYMS.extra
fi
EXPSYMS: $(EXPSYMS_src)
        cat $(EXPSYMS_src) >$@
------8<------

8) Another possibility:

In configure.ac:
------8<------
if text $extra = yes; then
        EXPSYMS_EXTRA=EXPSYMS.extra
        echo '_foo
_bar' >EXPSYMS.extra
else
        EXPSYMS_EXTRA=
fi
AM_SUBST([EXPSYMS_EXTRA])
------8<------
and in Makefile.am:
------8<------
EXPSYMS_src = EXPSYMS.in $(EXPSYMS_EXTRA)
EXPSYMS: $(EXPSYMS_src)
        cat $(EXPSYMS_src) >$@
------8<------


Do you know if it need
> to exist to not trigger some make error/warning in the above rule?
> 
> > 3) If there are more AC_SUBSTs in EXPSYMS.in, you can make use of the
> > fact that EXPSYMS can have more sources, not only EXPSYMS.in.
> > 
> > For example:
> > ------8<------
> > rm -f EXPSYMS.extra
> > if text $extra = yes; then
> >     echo '_foo
> > _bar' >EXPSYMS.extra
> > else
> >     >EXPSYMS.extra
> > fi
> > AC_CONFIG_FILES([EXPSYMS:EXPSYMS.in:EXPSYMS.extra])
> > ------8<------
> > or perhaps
> > ------8<------
> > expsyms_extra=
> > if text $extra = yes; then
> >     expsyms_extra=:EXPSYMS.extra
> >     rm -f EXPSYMS.extra
> >     echo '_foo
> > _bar' >EXPSYMS.extra
> > fi
> > AC_CONFIG_FILES([EXPSYMS:EXPSYMS.in$expsyms_extra])
> > ------8<------
> > or
> 
> Automake complains with:
> configure.in:1545: required file `EXPSYMS.in$expsyms_extra' not found
...
> Do you know of a way to silence that warning?

9) Actually, when I tested it, I used something like:

------8<------
expsyms_tag=EXPSYMS:EXPSYMS.in
if text $extra = yes; then
        expsyms_TAG=$expsyms_tag:EXPSYMS.extra
        rm -f EXPSYMS.extra
        echo '_foo
_bar' >EXPSYMS.extra
fi
AC_CONFIG_FILES([$expsyms_tag])
------8<------

Does this eliminate the warning?

> 4) Write code in configure.ac to concatenate the desired EXPSYMS
> file directly w/o help from AC_SUBST* (@EXTRA_SYMBOLS@ is the only
> substituted symbol).

Sure, this is the easiest solution.  There is only one thing you lose
this way:  when Automake sees AC_CONFIG_FILES([EXPSYMS]), it generates
a rule in Makefile.in which ensures that the file is regenarated when
needed.  If that were a problem, you would have to write a make rule
yourself; for example, you could pick my solution 7) or 8).

a) Actually, 9) has this disadvantage, too.  But you could probably fix
it by the following trick:
------8<------
...
fi
AC_CONFIG_FILES([$expsyms_tag])
if false; then
        AC_CONFIG_FILES([EXPSYMS:EXPSYMS.in])
fi
------8<------
Statically, Autoconf doesn't see any problem, $expsyms_tag remains
a complete mystery.
Dynamically, there is no conflict either, as the second AC_CONFIG_FILES
is never executed.
(Well, I haven't tested this, but I hope I guessed right.  ;-)

Have a nice day,
        Stepan




reply via email to

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