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

Emil Velikov emil.l.velikov at gmail.com
Mon Feb 23 07:31:38 PST 2015

On 23 February 2015 at 14:10,  <sardemff7+wayland at sardemff7.net> wrote:
> On 2015-02-17 16:13, 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.
>> 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])
> We should (must) set wayland_scanner as precious with AC_ARG_VAR. Probably a
> good idea to put that in this patch directly. (Ouch, I just saw that I did
> not add it in a patch of mine, shame on me.)
> Also, AC_PATH_TOOL (or AC_PATH_TARGET_TOOL) may be a better choice
> considering the usage of wayland-scanner. Would the scanner generate
> *anything* different depending on the host(/target) platform? If so, it’s a
> (target) tool and AC_PATH_TOOL is the best way to go.
> By the way, it seems sensible to me to ask for it in the standard PATH in
> all cases, as the C compiler is required, thus making the pkg-config check
> useless. I would consider wayland-scanner as part of the cross-compiling
> toolchain, not a library. You do have to *run* it on the compiling machine,
> right?
Well my idea is that wayland-scanner is build for and used on the
--build platform, as such the package should not exist within the host
specific PKG_CONFIG_PATH. That aside v2 shifts things and uses the
variable in wayland-scanner.pc as a fall-back, based on popular demand

> I am not fully aware of all the cross compiling stuff, so I just look at how
> Autoconf is telling me to handle that, since it’s one of its goal.
>>   if test x$wayland_scanner = x; then
>> -       AC_MSG_ERROR([wayland-scanner is needed to compile weston])
>> +       PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
>> +       wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner
>> wayland-scanner`
> I guess we cannot require pkg-config 0.28. If we can, PKG_CHECK_VAR is your
> friend.
0.28 was released Jan 2013 although I've not checked if it's available
in all the supported distros. As such would be nice to keep this as a
follow up commit, considering there is strong interest.

> Anyway, I think PKG_CHECK_EXISTS is better here (if we keep the pkg-config
> check as explained above). The _CFLAGS and _LIBS vars are just noise, and
> the error message should be clearer than the default one, imo. I am probably
> nitpicking here.
Note that my idea here is to actually make use of existing code,
rather than completely redoing the detection. Imho doing the latter,
as a first patch in a new project, feels a bit excessive. So please
feel free to follow up/or completely discard the patch.


More information about the wayland-devel mailing list