+dnl
+dnl EGL Gallium configuration
+dnl
+if test "x$enable_gallium_egl" = xyes; then
+ if test "x$with_gallium_drivers" = x; then
+ AC_MSG_ERROR([cannot enable egl_gallium without Gallium])
+ fi
+ if test "x$enable_egl" = xno; then
+ AC_MSG_ERROR([cannot enable egl_gallium without EGL])
+ fi
+ if test "x$have_libdrm" != xyes; then
+ AC_MSG_ERROR([egl_gallium requires libdrm >= $LIBDRM_REQUIRED])
+ fi
+
+ GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
+ HAVE_ST_EGL="yes"
+fi
+
+dnl
+dnl gbm Gallium configuration
+dnl
+if test "x$enable_gallium_gbm" = xauto; then
+ case "$enable_gbm$HAVE_ST_EGL$enable_dri$with_egl_platforms" in
+ yesyesyes*drm*)
+ enable_gallium_gbm=yes ;;
+ *)
+ enable_gallium_gbm=no ;;
+ esac
+fi
+if test "x$enable_gallium_gbm" = xyes; then
+ if test "x$with_gallium_drivers" = x; then
+ AC_MSG_ERROR([cannot enable gbm_gallium without Gallium])
+ fi
+ if test "x$enable_gbm" = xno; then
+ AC_MSG_ERROR([cannot enable gbm_gallium without gbm])
+ fi
+ # gbm_gallium abuses DRI_LIB_DEPS to link. Make sure it is set.
+ if test "x$enable_dri" = xno; then
+ AC_MSG_ERROR([gbm_gallium requires --enable-dri to build])
+ fi
+
+ GALLIUM_STATE_TRACKERS_DIRS="gbm $GALLIUM_STATE_TRACKERS_DIRS"
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS gbm"
+ HAVE_ST_GBM="yes"
+fi
+
+dnl
+dnl X.Org DDX configuration
+dnl
+if test "x$enable_xorg" = xyes; then
+ PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
+ PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
+ PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
+ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
+ HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
+ HAVE_XEXTPROTO_71="no")
+ GALLIUM_STATE_TRACKERS_DIRS="xorg $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_ST_XORG=yes
+fi
+
+dnl
+dnl XA configuration
+dnl
+if test "x$enable_xa" = xyes; then
+AC_PROG_AWK
+AC_PROG_GREP
+AC_CHECK_PROG(NM, nm, "nm")
+if test "x$AWK" = x || test "x$GREP" = x || test "x$NM" = x; then
+AC_MSG_WARN([Missing one of nm, grep or awk. Disabling xa.])
+enable_xa=no
+fi
+fi
+if test "x$enable_xa" = xyes; then
+ GALLIUM_STATE_TRACKERS_DIRS="xa $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_ST_XA=yes
+ AC_SUBST(AWK)
+ AC_SUBST(GREP)
+ AC_SUBST(NM)
+fi
+
+dnl
+dnl OpenVG configuration
+dnl
+VG_LIB_DEPS=""
+
+if test "x$enable_openvg" = xyes; then
+ if test "x$enable_egl" = xno; then
+ AC_MSG_ERROR([cannot enable OpenVG without EGL])
+ fi
+ if test "x$with_gallium_drivers" = x; then
+ AC_MSG_ERROR([cannot enable OpenVG without Gallium])
+ fi
+ if test "x$enable_gallium_egl" = xno; then
+ AC_MSG_ERROR([cannot enable OpenVG without egl_gallium])
+ fi
+
+ EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
+ VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
+ CORE_DIRS="$CORE_DIRS mapi/vgapi"
+ GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_ST_VEGA=yes
+fi
+
+dnl
+dnl D3D1X configuration
+dnl
+
+if test "x$enable_d3d1x" = xyes; then
+ if test "x$with_gallium_drivers" = x; then
+ AC_MSG_ERROR([cannot enable D3D1X without Gallium])
+ fi
+
+ GALLIUM_STATE_TRACKERS_DIRS="d3d1x $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_ST_D3D1X=yes
+fi
+
+dnl
+dnl Gallium G3DVL configuration
+dnl
+AC_ARG_ENABLE([gallium-g3dvl],
+ [AS_HELP_STRING([--enable-gallium-g3dvl],
+ [build gallium g3dvl @<:@default=disabled@:>@])],
+ [enable_gallium_g3dvl="$enableval"],
+ [enable_gallium_g3dvl=no])
+if test "x$enable_gallium_g3dvl" = xyes; then
+ if test "x$with_gallium_drivers" = x; then
+ AC_MSG_ERROR([cannot enable G3DVL without Gallium])
+ fi
+
+ if test "x$enable_xvmc" = xauto; then
+ PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
+ fi
+
+ if test "x$enable_vdpau" = xauto; then
+ PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no])
+ fi
+
+ if test "x$enable_va" = xauto; then
+ #don't enable vaapi state tracker even if package exists
+ #PKG_CHECK_EXISTS([libva], [enable_vdpau=yes], [enable_vdpau=no])
+ enable_va=no
+ fi
+fi
+
+if test "x$enable_xvmc" = xyes; then
+ PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 xorg-server])
+ GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg/xvmc"
+ HAVE_ST_XVMC="yes"
+fi
+
+if test "x$enable_vdpau" = xyes; then
+ PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.4.1])
+ GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
+ HAVE_ST_VDPAU="yes"
+fi
+
+if test "x$enable_va" = xyes; then
+ PKG_CHECK_MODULES([LIBVA], [libva = 0.31.1])
+ AC_MSG_WARN([vaapi state tracker currently unmaintained])
+ GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS va"
+ HAVE_ST_VA="yes"
+fi
+