[PATCH wayland] scanner: Add autoconf macro to check for the proper scanner

Daniel Stone daniel at fooishbar.org
Tue Dec 5 13:15:55 UTC 2017


Hi Quentin,
I've added Ross and Fabien, who've been looking at this for Yocto.

On 18 August 2017 at 10:30, Quentin Glidic
<sardemff7+wayland at sardemff7.net> wrote:
> --- a/wayland-scanner.m4
> +++ b/wayland-scanner.m4
> @@ -1,3 +1,5 @@
> +#serial 2

I don't quite understand the significance of this.

> +# WL_PROG_WAYLAND_SCANNER()
> +AC_DEFUN([WL_PROG_WAYLAND_SCANNER], [
> +    AC_REQUIRE([AC_CANONICAL_BUILD])
> +    AC_REQUIRE([PKG_PROG_PKG_CONFIG])
> +    wl_cv_native_pkg_config=
> +    AS_IF([test x${cross_compiling} = xyes], [
> +        wl_cv_native_pkg_config=${build}-pkg-config
> +        AC_PATH_PROGS([wl_cv_native_pkg_config], [${build}-pkg-config])

Ah, no thanks. I would prefer to have this passed in as
$HOST_PKG_CONFIG (following the $HOST_CC precedent), falling back to
just plain 'pkg-config'. Guessing triplets is a bit too much like
magic, especially when you can be 'cross-compiling' to the same
triplet.

> +    wl_cv_scanner_found=no
> +    wl_cv_scanner_wanted_version=`${PKG_CONFIG} --modversion wayland-server`
> +    AC_MSG_CHECKING([that wayland-client and wayland-server versions are the same])
> +    AS_IF([test ${wl_cv_scanner_wanted_version} = `${PKG_CONFIG} --modversion wayland-client`], [
> +        AC_MSG_RESULT([ok])
> +    ], [
> +        AC_MSG_ERROR([mismatch])
> +    ])
> +    AC_MSG_CHECKING([for wayland-scanner ${wl_cv_scanner_wanted_version}])
> +    AS_IF([test x${ac_cv_env_WAYLAND_SCANNER_set} = xset], [
> +        _WL_PROG_WAYLAND_SCANNER_VERSION_CHECK()
> +    ])
> +    AS_IF([test x${cross_compiling} = xyes -a x${wl_cv_native_pkg_config} != xno], [
> +        AS_IF([AC_RUN_LOG([${wl_cv_native_pkg_config} --exists --print-errors wayland-scanner = ${wl_cv_scanner_wanted_version}])], [
> +            WAYLAND_SCANNER=`${wl_cv_native_pkg_config} --variable=wayland_scanner wayland-scanner = ${wl_cv_scanner_wanted_version}`
> +            _WL_PROG_WAYLAND_SCANNER_VERSION_CHECK()
> +        ])
> +    ])
> +    AS_IF([test x${wl_cv_scanner_found} = xno], [
> +        AS_IF([AC_RUN_LOG([${PKG_CONFIG} --exists --print-errors wayland-scanner = ${wl_cv_scanner_wanted_version}])], [
> +            WAYLAND_SCANNER=`${PKG_CONFIG} --variable=wayland_scanner wayland-scanner = ${wl_cv_scanner_wanted_version}`
> +            _WL_PROG_WAYLAND_SCANNER_VERSION_CHECK()
> +        ])
> +    ])

I found this whole AS_IF forest pretty difficult to read. The last one
seems like we could also try to end up running a non-native version if
we fall through? It's also quite verbose on checking. Shrug.

The rest looks good to me, so assuming we can test it in Yocto and it
works fine there, then it should be good to merge.

Cheers,
Daniel


More information about the wayland-devel mailing list