[PATCH wayland 3/3] scanner: check for wayland-scanner.pc before using variables

Peter Hutterer peter.hutterer at who-t.net
Tue Aug 6 23:33:20 PDT 2013


On Wed, Aug 07, 2013 at 07:46:43AM +0200, Daiki Ueno wrote:
> Hi,
> 
> Peter Hutterer <peter.hutterer at who-t.net> writes:
> 
> >  AC_DEFUN([WAYLAND_SCANNER_RULES], [
> >      PKG_PROG_PKG_CONFIG
> >  
> > +    PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner])
> > +
> 
> With this change, configure will abort if wayland-scanner.pc is not
> found.  However, the current WAYLAND_SCANNER_RULES cannot be invoked
> conditionally, because the make rules are expanded using AC_SUBST_FILE:
> 
>     wayland_scanner_rules=`$PKG_CONFIG --variable=pkgdatadir wayland-scanner`/wayland-scanner.mk
>     AC_SUBST_FILE([wayland_scanner_rules])
> 
> and in Makefile.am:
> 
>     @wayland_scanner_rules@
> 
> which will be left unexpanded and cause a syntax error if
> WAYLAND_SCANNER_RULES is not invoked.  Note that Automake conditionals
> don't work for the multiline substitution variables.
> 
> Perhaps an idea is changing the substitution to:
> 
>     wayland_scanner_rules=`$PKG_CONFIG --variable=pkgdatadir wayland-scanner`/wayland-scanner.mk
>     AC_SUBST_FILE([wayland_scanner_rules])
>     AC_SUBST([wayland_scanner_makefile], [$wayland_scanner_rules])
> 
> and in Makefile.am, include the rule instead of embedding:
> 
>     -include $(wayland_scanner_makefile)
> 
> By the way,
> 
> > If wayland-scanner.pc can't be found the variables end up being set
> > irrespectively, leaving the user with odd compiler errors about missing
> > headers, etc.
> 
> Did you actually get any errors?  I didn't get any, when compiling the
> Wayland support for IBus, without Wayland installation.

yep, I don't go searching for these things ;)
happened when building weston, and the problem in my case was that
PKG_CONFIG_PATH pointed to $prefix/lib/pkgconfig but not
$prefix/share/pkgconfig. which is a setup problem, but we shouldn't trust
that a package is there.

The real problem is that the error message is non-intuitive:
make[2]: *** No rule to make target `screenshooter-server-protocol.h',
needed by `all'.  Stop.

I guess the easiest alternative here would be to have a fixed dependency on
wayland-scanner in weston.

Cheers,
   Peter



More information about the wayland-devel mailing list