autoconf
[Top][All Lists]
Advanced

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

Re: PKG_CHECK_MODULES: bug or I don't know something?


From: Evgeniy Dushistov
Subject: Re: PKG_CHECK_MODULES: bug or I don't know something?
Date: Sun, 18 Jun 2006 23:55:54 +0400

I already fix this in such ugly way

if
LIB=lib_a
elif
LIB=lib_b
else
fi

PKG_CHECK_MODULES(APP, $LIB)

if
all other code except PKG_CHECK
elf
...
else
fi

This post just attempt to understand who's responsible for this.

Thanks for your reply, it's clear situation for me.


On 6/18/06, Ralf Wildenhues <address@hidden> wrote:

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



reply via email to

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