Discussion:
Can packages rely on AC_PROVIDE_IFELSE?
Nick Bowler
2012-11-26 15:02:15 UTC
Permalink
Hi folks,

Autoconf defines a macro called AC_PROVIDE_IFELSE, which can allow
one to hook into the AC_REQUIRE machinery in order to do potentially
interesting things. For a specific example, I recently wanted to emit a
(hopefully) helpful warning message if LT_INIT had not been previously
expanded, and it seems that I can do that very easily with something
like:

AC_PROVIDE_IFELSE([LT_INIT], , [m4_warn([syntax], [blah blah])])

However, AC_PROVIDE_IFELSE is not described in the Autoconf manual,
which makes me wonder if the macro should be used by packages. The fact
that it's defined at all (as an alias for m4_provide_if) seems to
suggest that it was intended to be used...

Also, on a related note, AC_PROVIDE is referred to several times in the
Autoconf manual (in a manner that suggests that packages can use it) but
the manual never actually explains what AC_PROVIDE does or how to invoke
it properly.

So, are these macros intended to be used by packages? If so, can they
be documented in the manual?

Thanks,
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
Eric Blake
2012-12-07 13:59:25 UTC
Permalink
Post by Nick Bowler
Hi folks,
Autoconf defines a macro called AC_PROVIDE_IFELSE, which can allow
one to hook into the AC_REQUIRE machinery in order to do potentially
interesting things. For a specific example, I recently wanted to emit a
(hopefully) helpful warning message if LT_INIT had not been previously
expanded, and it seems that I can do that very easily with something
AC_PROVIDE_IFELSE([LT_INIT], , [m4_warn([syntax], [blah blah])])
Good question - looks like you found a real hole in the documentation.
It looks like AC_PROVIDE vs. AC_PROVIDE_IFELSE should be documented
together; and also that m4_provide and m4_provide_if should be
documented together. What's more, the manual mentions that macros can
call AC_PROVIDE but does not document what it does.
Post by Nick Bowler
However, AC_PROVIDE_IFELSE is not described in the Autoconf manual,
which makes me wonder if the macro should be used by packages. The fact
that it's defined at all (as an alias for m4_provide_if) seems to
suggest that it was intended to be used...
Yes, the macros are stable and intended to be usable; we're just missing
the documentation patch.
Post by Nick Bowler
Also, on a related note, AC_PROVIDE is referred to several times in the
Autoconf manual (in a manner that suggests that packages can use it) but
the manual never actually explains what AC_PROVIDE does or how to invoke
it properly.
Yep, I just came to the same conclusion after reading just your first
paragraph and searching for myself.
Post by Nick Bowler
So, are these macros intended to be used by packages? If so, can they
be documented in the manual?
Absolutely. Want to help write the patch?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Loading...