+# Check for EGL
+USE_EGL="no"
+if test "$enable_egl" = "yes"; then
+ PKG_CHECK_MODULES([EGL], [egl], [USE_EGL="yes"], [:])
+ saved_CPPFLAGS="$CPPFLAGS"
+ saved_LIBS="$LIBS"
+ CPPFLAGS="$CPPFLAGS $EGL_CFLAGS"
+ LIBS="$LIBS $EGL_LIBS"
+ AC_CHECK_HEADERS([EGL/egl.h], [:], [USE_EGL="no"])
+ AC_CHECK_LIB([EGL], [eglGetDisplay], [:], [USE_EGL="no"])
+ CPPFLAGS="$saved_CPPFLAGS"
+ LIBS="$saved_LIBS"
+ if test "$USE_EGL" = "yes"; then
+ AC_DEFINE([HAVE_VA_EGL], [1], [Defined to 1 if VA/EGL API is built])
+ fi
+fi
+AM_CONDITIONAL(USE_EGL, test "$USE_EGL" = "yes")
+
+# Check for Wayland
+WAYLAND_API_VERSION=wayland_api_version
+AC_SUBST(WAYLAND_API_VERSION)
+
+USE_WAYLAND="no"
+if test "$enable_wayland" = "yes"; then
+ PKG_CHECK_MODULES([WAYLAND], [wayland-client >= wayland_api_version],
+ [USE_WAYLAND="yes"], [:])
+ if test "$USE_WAYLAND" = "yes"; then
+ AC_DEFINE([HAVE_VA_WAYLAND], [1],
+ [Defined to 1 if VA/Wayland API is built])
+ fi
+fi
+AM_CONDITIONAL(USE_WAYLAND, test "$USE_WAYLAND" = "yes")
+
+m4_ifdef([WAYLAND_SCANNER_RULES],
+ [WAYLAND_SCANNER_RULES(['$(top_srcdir)/va/wayland/protocol'])],
+ [wayland_scanner_rules=""; AC_SUBST(wayland_scanner_rules)])