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

Daiki Ueno ueno at gnu.org
Tue Aug 6 22:46:43 PDT 2013


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.

Regards,
-- 
Daiki Ueno


More information about the wayland-devel mailing list