+# Check for __attribute__((visibility()))
+AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
+ ac_cv_have_gnuc_visibility_attribute,
+ [cat > conftest.c <<EOF
+int foo __attribute__ ((visibility ("hidden"))) = 1;
+int bar __attribute__ ((visibility ("protected"))) = 1;
+EOF
+ ac_cv_have_gnuc_visibility_attribute="no"
+ if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
+ if grep '\.hidden.*foo' conftest.s >/dev/null; then
+ if grep '\.protected.*bar' conftest.s >/dev/null; then
+ ac_cv_have_gnuc_visibility_attribute="yes"
+ fi
+ fi
+ fi
+ rm -f conftest.[cs]
+])
+if test "$ac_cv_have_gnuc_visibility_attribute" = "yes"; then
+ AC_DEFINE([HAVE_GNUC_VISIBILITY_ATTRIBUTE], [1],
+ [Defined to 1 if GCC visibility attribute is supported])
+fi
+
+# Dummy backend
+if test x$enable_dummy_backend = xyes; then
+ PKG_CHECK_MODULES([UDEV], [libudev], [libudev=yes], [libudev=no])
+fi
+if test x$libudev = xno; then
+ enable_dummy_backend=no
+fi
+AM_CONDITIONAL(BUILD_DUMMY_BACKEND, test x$enable_dummy_backend = xyes)
+
+# Check for DRM (mandatory)
+LIBDRM_VERSION=libdrm_version
+PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
+AC_SUBST(LIBDRM_VERSION)
+
+USE_DRM="no"
+if test "$enable_drm" = "yes"; then
+ USE_DRM="yes"
+ AC_DEFINE([HAVE_VA_DRM], [1], [Defined to 1 if VA/DRM API is built])
+fi
+AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
+
+# Check for X11
+USE_X11="no"
+if test "$enable_x11" = "yes"; then
+ USE_X11="yes"
+ PKG_CHECK_MODULES([X11], [x11], [:], [USE_X11="no"])
+ PKG_CHECK_MODULES([XEXT], [xext], [:], [USE_X11="no"])
+ PKG_CHECK_MODULES([XFIXES], [xfixes], [:], [USE_X11="no"])
+ if test "$USE_X11" = "yes"; then
+ AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is built])
+ fi
+fi
+AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
+
+# Check for GLX
+USE_GLX="no"
+if test "$USE_X11:$enable_glx" = "yes:yes"; then
+ PKG_CHECK_MODULES([GLX], [gl x11], [USE_GLX="yes"], [:])
+ saved_CPPFLAGS="$CPPFLAGS"
+ saved_LIBS="$LIBS"
+ CPPFLAGS="$CPPFLAGS $GLX_CFLAGS"
+ LIBS="$LIBS $GLX_LIBS"
+ AC_CHECK_HEADERS([GL/gl.h GL/glx.h], [:], [USE_GLX="no"])
+ AC_CHECK_LIB([GL], [glXCreateContext], [:] [USE_GLX="no"])
+ CPPFLAGS="$saved_CPPFLAGS"
+ LIBS="$saved_LIBS"
+ if test "$USE_GLX" = "yes"; then
+ AC_DEFINE([HAVE_VA_GLX], [1], [Defined to 1 if VA/GLX API is built])
+ fi
+fi
+AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")