[Mesa-dev] [PATCH] configure.ac: Add --with-wayland-scanner-path

Jussi Kukkonen jussi.kukkonen at intel.com
Tue May 23 08:13:57 UTC 2017


Modify wayland-scanner lookup: Use the path given by pkg-config
but offer an option to override the path with
"--with-wayland-scanner-path=PATH". The latter is useful for
cross-compile situations.

AC_PATH_PROG is no longer used (if the scanner is installed it should
get found by pkg-config). AC_SUBST is added so the output variable is
created when only the configure option is used.
---

My goal is to standardize wayland-scanner usage in a way that does not
require patching when cross-compiling in Yocto (the detailed issue is
that in Yocto pkg-config will return a "wayland_scanner" variable but
that will contain a _target path_ when we would like to use a native
sysroot path instead).

I've sent a similar patch to weston and intend to fix other projects
if these two patches are well received.


Thanks,
 Jussi

 configure.ac | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 06883a9667..89fa99e0b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1661,12 +1661,19 @@ if test "x$with_platforms" = xauto; then
     with_platforms=$with_egl_platforms
 fi
 
-PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner],
+
+AC_ARG_WITH([wayland-scanner-path],
+    [AS_HELP_STRING([--with-wayland-scanner-path=PATH],
+        [Path to wayland-scanner (by default the path from
+        'pkg-config --variable=wayland_scanner wayland-scanner' is used)])],
+    [WAYLAND_SCANNER="$withval"],
+    [WAYLAND_SCANNER="auto"])
+if test x$WAYLAND_SCANNER = xauto; then
+    PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner],
         WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`,
-        WAYLAND_SCANNER='')
-if test "x$WAYLAND_SCANNER" = x; then
-    AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:])
+        WAYLAND_SCANNER=":")
 fi
+AC_SUBST(WAYLAND_SCANNER)
 
 # Do per platform setups and checks
 platforms=`IFS=', '; echo $with_platforms`
@@ -1677,7 +1684,7 @@ for plat in $platforms; do
 		PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED])
 
 		if test "x$WAYLAND_SCANNER" = "x:"; then
-			AC_MSG_ERROR([wayland-scanner is needed to compile the wayland platform])
+			AC_MSG_ERROR([wayland-scanner is needed by Wayland platform but it could not be found and --with-wayland-scanner-path was not used])
 		fi
 		DEFINES="$DEFINES -DHAVE_WAYLAND_PLATFORM"
 		;;
-- 
2.11.0



More information about the mesa-dev mailing list