[PATCH weston] configure.ac: make use of wayland-scanner.pc

Emil Velikov emil.l.velikov at gmail.com
Sat Feb 21 03:04:13 PST 2015

Hi Bryce

On 20 February 2015 at 23:26, Bryce Harrington <bryce at osg.samsung.com> wrote:
> On Tue, Feb 17, 2015 at 03:13:32PM +0000, Emil Velikov wrote:
>> Currently we use the wayland-scanner executable as found with
>> AC_PATH_PROG, and then check the presence of wayland-scanner.pc
>> Currently the latter is unused even if AC_PATH_PROG fails to find the
>> binary. Rework things to use the pkg-config variable as a fall-back.
> Sorry to have to ask some rather stupid questions, but I want to make
> sure I understand the effects of this before landing.
>> Cc: Andrew Oakley <aoakley at espial.com>
>> Cc: Bill Spitzak <spitzak at gmail.com>
>> Cc: Daniel Stone <daniel at fooishbar.org>
>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
>> ---
>>  configure.ac | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>> diff --git a/configure.ac b/configure.ac
>> index 1db9f79..b44675f 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -503,11 +503,10 @@ AM_CONDITIONAL(HAVE_LCMS, [test "x$have_lcms" = xyes])
>>  AC_PATH_PROG([wayland_scanner], [wayland-scanner])
>>  if test x$wayland_scanner = x; then
>> -     AC_MSG_ERROR([wayland-scanner is needed to compile weston])
> Shouldn't there still be an error message generated if the $PKG_CONFIG
> run (below) fails?
The macro has an optional [action-if-not-found]. If it's missing (as
below) we will error out by default.

>> +     PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
> Here's where I think I'm confused.  The main purpose of
> PKG_CHECK_MODULES as I understand it is to define CFLAGS and LIBS
> variables, so this would be e.g. WAYLAND_SCANNER_CFLAGS and
> WAYLAND_SCANNER_LIBS.  Yet I'm not spotting where either of these are
> actually used.  We only need the binary, not the library stuff, right?
> Is it declaring any other variables or doing other work we need?
Afaik the macro does three things
 1 Check for the presence of the required package(s)
 2 Sets the relevant _CFLAGS and _LIBS variables.
 3 Errors out with a very informative message, when
action-if-not-found is not set.

Here we're using it for 1 & 3. One can use PKG_CHECK_EXISTS() and then
manually add the error message, but that is rather uncommon afaict.

Hope that clears things up a bit.

More information about the wayland-devel mailing list