1From 27635f902831fac898586f1f3dc98369f12582c9 Mon Sep 17 00:00:00 2001
2From: Bernd Kuhls <bernd.kuhls@t-online.de>
3Date: Sun, 26 Aug 2018 12:51:04 +0200
4Subject: [PATCH] configure.ac: also use AC_PATH_PROG to check for
5 wayland-scanner
6
7When cross-compiling the .pc file might point to the wrong
8wayland-scanner binary (target rather than host) resulting in a
9non-executable and wrong scanner.
10Try searching the PATH first, and if that fails fall back into
11pkg-config.
12
13Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
14---
15 configure.ac | 19 +++++++++++--------
16 1 file changed, 11 insertions(+), 8 deletions(-)
17
18diff --git a/configure.ac b/configure.ac
19index 4808b8becf..a18641ed23 100644
20--- a/configure.ac
21+++ b/configure.ac
22@@ -3140,14 +3140,17 @@ AS_IF([test "${enable_wayland}" != "no"], [
23       AC_MSG_ERROR([$(${PKG_CONFIG} --print-errors 'wayland-protocols >= 1.4')])
24     ])
25
26-    AC_MSG_CHECKING([for the Wayland scanner])
27-    PKG_CHECK_EXISTS([wayland-scanner], [
28-      WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
29-      AC_MSG_RESULT([${WAYLAND_SCANNER}])
30-    ], [
31-      AC_MSG_RESULT([not found])
32-      AC_MSG_ERROR([$(${PKG_CONFIG} --print-errors wayland-scanner)])
33-    ])
34+    AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
35+    if test "x$WAYLAND_SCANNER" = x; then
36+        AC_MSG_CHECKING([for the Wayland scanner])
37+        PKG_CHECK_EXISTS([wayland-scanner], [
38+          WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
39+          AC_MSG_RESULT([${WAYLAND_SCANNER}])
40+        ], [
41+          AC_MSG_RESULT([not found])
42+          AC_MSG_ERROR([$(${PKG_CONFIG} --print-errors wayland-scanner)])
43+        ])
44+    fi
45
46     have_wayland="yes"
47
48--
492.18.0
50
51