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