Hello Evgeniy,
* Evgeniy Dushistov wrote on Sun, Jun 18, 2006 at 05:42:28PM CEST:
>
> if one_option; then
> ...
> PKG_CHECK_MODULES(APP, lib_a)
> ...
> elif another_option; then
> ...
> PKG_CHECK_MODULES(APP, lib_b)
> ...
> else
> ...
> PKG_CHECK_MODULES(APP, lib_a)
> ...
> fi
>
> only first PKG_CHECK_MODULES works fine,
Yes. PKG_CHECK_MODULES apparently uses AC_REQUIRE to pull in some
required macros; the version on my system requires the
PKG_PROG_PKG_CONFIG macro. Several alternatives to fix this for you,
in decreasing order of cleanliness:
- Wait for Autoconf-2.60, then use
AS_IF([one_option],
[...
PKG_CHECK_MODULES(APP, lib_a)
],
[another_option],
[...
PKG_CHECK_MODULES(APP, lib_b)
],
[...
PKG_CHECK_MODULES(APP, lib_a)
])
- Call the required macro PKG_PROG_PKG_CONFIG beforehand,
unconditionally. (This breaks if a newer version of the macro
PKG_CHECK_MODULES has a different set of required macros.)
- Make sure the first expansion of PKG_CHECK_MODULES in your script is
not inside a shell conditional, but called unconditionally (e.g., you
could check for an unrelated library).
Cheers,
Ralf