[Mesa-dev] [PATCH] st: require compatible driver in autotools

Alyssa Ross hi at alyssa.is
Fri Apr 19 17:53:25 UTC 2019


The meson build system already has these checks. I've just copied them
to autotools.

Without this, state trackers could be enabled when building with the
following set of options, which resulted in a compile error due to VL
being built without DRM.

     --enable-autotools
     --with-platforms=x11
     --with-dri-drivers=
     --with-gallium-drivers=swrast
     --disable-glx
     --disable-dri3
     --disable-gbm

The compile error was:

    vl/vl_winsys_dri.c:36:10: fatal error: xf86drm.h: No such file or directory
     #include <xf86drm.h>
              ^~~~~~~~~~~
    compilation terminated.

Cc: mesa-stable at lists.freedesktop.org
---
 configure.ac | 336 +++++++++++++++++++++++++++------------------------
 1 file changed, 178 insertions(+), 158 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1ef68fe68e6..cf7124328ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2341,6 +2341,164 @@ if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then
     fi
 fi

+dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
+if test -n "$with_gallium_drivers"; then
+    gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
+    for driver in $gallium_drivers; do
+        case "x$driver" in
+        xsvga)
+            HAVE_GALLIUM_SVGA=yes
+            require_libdrm "svga"
+            ;;
+        xi915)
+            HAVE_GALLIUM_I915=yes
+            PKG_CHECK_MODULES([I915], [libdrm >= $LIBDRM_INTEL_REQUIRED libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
+            require_libdrm "Gallium i915"
+            ;;
+        xr300)
+            HAVE_GALLIUM_R300=yes
+            PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
+            require_libdrm "r300"
+            r300_require_llvm "r300"
+            ;;
+        xr600)
+            HAVE_GALLIUM_R600=yes
+            PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
+            require_libdrm "r600"
+            if test "x$enable_llvm" = xyes; then
+                radeon_llvm_check $LLVM_REQUIRED_R600 "r600"
+
+                llvm_add_component "asmparser" "r600"
+                llvm_add_component "bitreader" "r600"
+            fi
+            ;;
+        xradeonsi)
+            HAVE_GALLIUM_RADEONSI=yes
+            PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
+            PKG_CHECK_MODULES([AMDGPU], [libdrm >= $LIBDRM_AMDGPU_REQUIRED libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
+            require_libdrm "radeonsi"
+            radeon_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
+            if test "x$enable_egl" = xyes; then
+                require_basic_egl "radeonsi"
+            fi
+            ;;
+        xnouveau)
+            HAVE_GALLIUM_NOUVEAU=yes
+            PKG_CHECK_MODULES([NOUVEAU], [libdrm >= $LIBDRM_NOUVEAU_REQUIRED libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
+            require_libdrm "nouveau"
+            ;;
+        xfreedreno)
+            HAVE_GALLIUM_FREEDRENO=yes
+            require_libdrm "freedreno"
+            ;;
+        xetnaviv)
+            HAVE_GALLIUM_ETNAVIV=yes
+            PKG_CHECK_MODULES([ETNAVIV], [libdrm >= $LIBDRM_ETNAVIV_REQUIRED libdrm_etnaviv >= $LIBDRM_ETNAVIV_REQUIRED])
+            require_libdrm "etnaviv"
+            ;;
+        xtegra)
+            HAVE_GALLIUM_TEGRA=yes
+            require_libdrm "tegra"
+            ;;
+        xswrast)
+            HAVE_GALLIUM_SOFTPIPE=yes
+            if test "x$enable_llvm" = xyes; then
+                HAVE_GALLIUM_LLVMPIPE=yes
+            fi
+            ;;
+        xswr)
+            llvm_require_version $LLVM_REQUIRED_SWR "swr"
+
+            if test "x$HAVE_CXX11" != "xyes"; then
+                AC_MSG_ERROR([swr requires c++11 support])
+            fi
+
+            swr_require_cxx_feature_flags "AVX" "defined(__AVX__)" \
+                ",-target-cpu=sandybridge,-mavx,-march=core-avx,-tp=sandybridge" \
+                SWR_AVX_CXXFLAGS
+            AC_SUBST([SWR_AVX_CXXFLAGS])
+
+            swr_archs=`IFS=', '; echo $with_swr_archs`
+            for arch in $swr_archs; do
+                case "x$arch" in
+                xavx)
+                    HAVE_SWR_AVX=yes
+                    ;;
+                xavx2)
+                    swr_require_cxx_feature_flags "AVX2" "defined(__AVX2__)" \
+                        ",-target-cpu=haswell,-mavx2 -mfma -mbmi2 -mf16c,-march=core-avx2,-tp=haswell" \
+                        SWR_AVX2_CXXFLAGS
+                    AC_SUBST([SWR_AVX2_CXXFLAGS])
+                    HAVE_SWR_AVX2=yes
+                    ;;
+                xknl)
+                    swr_require_cxx_feature_flags "KNL" "defined(__AVX512F__) && defined(__AVX512ER__)" \
+                        ",-target-cpu=mic-knl,-march=knl,-xMIC-AVX512" \
+                        SWR_KNL_CXXFLAGS
+                    AC_SUBST([SWR_KNL_CXXFLAGS])
+                    HAVE_SWR_KNL=yes
+                    ;;
+                xskx)
+                    swr_require_cxx_feature_flags "SKX" "defined(__AVX512F__) && defined(__AVX512BW__)" \
+                        ",-target-cpu=x86-skylake,-march=skylake-avx512,-xCORE-AVX512" \
+                        SWR_SKX_CXXFLAGS
+                    AC_SUBST([SWR_SKX_CXXFLAGS])
+                    HAVE_SWR_SKX=yes
+                    ;;
+                *)
+                    AC_MSG_ERROR([unknown SWR build architecture '$arch'])
+                    ;;
+                esac
+            done
+
+            if test "x$HAVE_SWR_AVX" != xyes -a \
+                    "x$HAVE_SWR_AVX2" != xyes -a \
+                    "x$HAVE_SWR_KNL" != xyes -a \
+                    "x$HAVE_SWR_SKX" != xyes; then
+               AC_MSG_ERROR([swr enabled but no swr architectures selected])
+            fi
+
+            # test if more than one swr arch configured
+            if test `echo $swr_archs | wc -w` -eq 1; then
+                HAVE_SWR_BUILTIN=yes
+            fi
+
+            HAVE_GALLIUM_SWR=yes
+            ;;
+        xvc4)
+            HAVE_GALLIUM_VC4=yes
+            PKG_CHECK_MODULES([VC4], [libdrm >= $LIBDRM_VC4_REQUIRED])
+
+            PKG_CHECK_MODULES([SIMPENROSE], [simpenrose],
+                              [USE_VC4_SIMULATOR=yes;
+                               DEFINES="$DEFINES -DUSE_VC4_SIMULATOR"],
+                              [USE_VC4_SIMULATOR=no])
+            ;;
+        xv3d)
+            HAVE_GALLIUM_V3D=yes
+
+            PKG_CHECK_MODULES([V3D_SIMULATOR], [v3dv3],
+                              [USE_V3D_SIMULATOR=yes;
+                               DEFINES="$DEFINES -DUSE_V3D_SIMULATOR"],
+                              [USE_V3D_SIMULATOR=no])
+            ;;
+        xkmsro)
+            HAVE_GALLIUM_KMSRO=yes
+            ;;
+        xvirgl)
+            HAVE_GALLIUM_VIRGL=yes
+            require_libdrm "virgl"
+            if test "x$enable_egl" = xyes; then
+                require_basic_egl "virgl"
+            fi
+            ;;
+        *)
+            AC_MSG_ERROR([Unknown Gallium driver: $driver])
+            ;;
+        esac
+    done
+fi
+
 if test "x$enable_dri" = xyes -o \
         "x$enable_xvmc" = xyes -o \
         "x$enable_vdpau" = xyes -o \
@@ -2367,6 +2525,10 @@ if test "x$enable_xvmc" = xyes; then
     if test "x$have_xvmc_platform" != xyes; then
         AC_MSG_ERROR([XVMC requires the x11 platforms])
     fi
+    if test "x$HAVE_GALLIUM_R600" != xyes -a \
+            "x$HAVE_GALLIUM_NOUVEAU" != "xyes"; then
+        AC_MSG_ERROR([XVMC state tracker requires at least one of the r600 or nouveau gallium drivers])
+    fi
     PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED])
     gallium_st="$gallium_st xvmc"
 fi
@@ -2376,6 +2538,12 @@ if test "x$enable_vdpau" = xyes; then
     if test "x$have_vdpau_platform" != xyes; then
         AC_MSG_ERROR([VDPAU requires the x11 platforms])
     fi
+    if test "x$HAVE_GALLIUM_R300" != xyes -a \
+            "x$HAVE_GALLIUM_R600" != xyes -a \
+            "x$HAVE_GALLIUM_RADEONSI" != xyes -a \
+            "x$HAVE_GALLIUM_NOUVEAU" != "xyes"; then
+        AC_MSG_ERROR([VDPAU state tracker requires at least one of the r300, r600, radeonsi or nouveau gallium drivers])
+    fi
     PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED])
     gallium_st="$gallium_st vdpau"
     DEFINES="$DEFINES -DHAVE_ST_VDPAU"
@@ -2386,6 +2554,11 @@ if test "x$enable_omx_bellagio" = xyes; then
     if test "x$have_omx_platform" != xyes; then
         AC_MSG_ERROR([OMX requires at least one of the x11 or drm platforms])
     fi
+    if test "x$HAVE_GALLIUM_R600" != xyes -a \
+            "x$HAVE_GALLIUM_RADEONSI" != xyes -a \
+            "x$HAVE_GALLIUM_NOUVEAU" != "xyes"; then
+        AC_MSG_ERROR([OMX state tracker requires at least one of the r600, radeonsi or nouveau gallium drivers])
+    fi
     PKG_CHECK_MODULES([OMX_BELLAGIO], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED])
     gallium_st="$gallium_st omx_bellagio"
     AC_DEFINE([ENABLE_ST_OMX_BELLAGIO], 1, [Use Bellagio for OMX IL])
@@ -2413,6 +2586,11 @@ if test "x$enable_va" = xyes; then
     if test "x$have_va_platform" != xyes; then
         AC_MSG_ERROR([VA requires at least one of the x11 drm or wayland platforms])
     fi
+    if test "x$HAVE_GALLIUM_R600" != xyes -a \
+            "x$HAVE_GALLIUM_RADEONSI" != xyes -a \
+            "x$HAVE_GALLIUM_NOUVEAU" != "xyes"; then
+        AC_MSG_ERROR([VA state tracker requires at least one of the r600, radeonsi or nouveau gallium drivers])
+    fi
     PKG_CHECK_MODULES([VA], [libva >= $LIBVA_REQUIRED])
     gallium_st="$gallium_st va"
 fi
@@ -2686,164 +2864,6 @@ swr_require_cxx_feature_flags() {
     return 1
 }

-dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
-if test -n "$with_gallium_drivers"; then
-    gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
-    for driver in $gallium_drivers; do
-        case "x$driver" in
-        xsvga)
-            HAVE_GALLIUM_SVGA=yes
-            require_libdrm "svga"
-            ;;
-        xi915)
-            HAVE_GALLIUM_I915=yes
-            PKG_CHECK_MODULES([I915], [libdrm >= $LIBDRM_INTEL_REQUIRED libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
-            require_libdrm "Gallium i915"
-            ;;
-        xr300)
-            HAVE_GALLIUM_R300=yes
-            PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
-            require_libdrm "r300"
-            r300_require_llvm "r300"
-            ;;
-        xr600)
-            HAVE_GALLIUM_R600=yes
-            PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
-            require_libdrm "r600"
-            if test "x$enable_llvm" = xyes; then
-                radeon_llvm_check $LLVM_REQUIRED_R600 "r600"
-
-                llvm_add_component "asmparser" "r600"
-                llvm_add_component "bitreader" "r600"
-            fi
-            ;;
-        xradeonsi)
-            HAVE_GALLIUM_RADEONSI=yes
-            PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
-            PKG_CHECK_MODULES([AMDGPU], [libdrm >= $LIBDRM_AMDGPU_REQUIRED libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
-            require_libdrm "radeonsi"
-            radeon_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
-            if test "x$enable_egl" = xyes; then
-                require_basic_egl "radeonsi"
-            fi
-            ;;
-        xnouveau)
-            HAVE_GALLIUM_NOUVEAU=yes
-            PKG_CHECK_MODULES([NOUVEAU], [libdrm >= $LIBDRM_NOUVEAU_REQUIRED libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
-            require_libdrm "nouveau"
-            ;;
-        xfreedreno)
-            HAVE_GALLIUM_FREEDRENO=yes
-            require_libdrm "freedreno"
-            ;;
-        xetnaviv)
-            HAVE_GALLIUM_ETNAVIV=yes
-            PKG_CHECK_MODULES([ETNAVIV], [libdrm >= $LIBDRM_ETNAVIV_REQUIRED libdrm_etnaviv >= $LIBDRM_ETNAVIV_REQUIRED])
-            require_libdrm "etnaviv"
-            ;;
-        xtegra)
-            HAVE_GALLIUM_TEGRA=yes
-            require_libdrm "tegra"
-            ;;
-        xswrast)
-            HAVE_GALLIUM_SOFTPIPE=yes
-            if test "x$enable_llvm" = xyes; then
-                HAVE_GALLIUM_LLVMPIPE=yes
-            fi
-            ;;
-        xswr)
-            llvm_require_version $LLVM_REQUIRED_SWR "swr"
-
-            if test "x$HAVE_CXX11" != "xyes"; then
-                AC_MSG_ERROR([swr requires c++11 support])
-            fi
-
-            swr_require_cxx_feature_flags "AVX" "defined(__AVX__)" \
-                ",-target-cpu=sandybridge,-mavx,-march=core-avx,-tp=sandybridge" \
-                SWR_AVX_CXXFLAGS
-            AC_SUBST([SWR_AVX_CXXFLAGS])
-
-            swr_archs=`IFS=', '; echo $with_swr_archs`
-            for arch in $swr_archs; do
-                case "x$arch" in
-                xavx)
-                    HAVE_SWR_AVX=yes
-                    ;;
-                xavx2)
-                    swr_require_cxx_feature_flags "AVX2" "defined(__AVX2__)" \
-                        ",-target-cpu=haswell,-mavx2 -mfma -mbmi2 -mf16c,-march=core-avx2,-tp=haswell" \
-                        SWR_AVX2_CXXFLAGS
-                    AC_SUBST([SWR_AVX2_CXXFLAGS])
-                    HAVE_SWR_AVX2=yes
-                    ;;
-                xknl)
-                    swr_require_cxx_feature_flags "KNL" "defined(__AVX512F__) && defined(__AVX512ER__)" \
-                        ",-target-cpu=mic-knl,-march=knl,-xMIC-AVX512" \
-                        SWR_KNL_CXXFLAGS
-                    AC_SUBST([SWR_KNL_CXXFLAGS])
-                    HAVE_SWR_KNL=yes
-                    ;;
-                xskx)
-                    swr_require_cxx_feature_flags "SKX" "defined(__AVX512F__) && defined(__AVX512BW__)" \
-                        ",-target-cpu=x86-skylake,-march=skylake-avx512,-xCORE-AVX512" \
-                        SWR_SKX_CXXFLAGS
-                    AC_SUBST([SWR_SKX_CXXFLAGS])
-                    HAVE_SWR_SKX=yes
-                    ;;
-                *)
-                    AC_MSG_ERROR([unknown SWR build architecture '$arch'])
-                    ;;
-                esac
-            done
-
-            if test "x$HAVE_SWR_AVX" != xyes -a \
-                    "x$HAVE_SWR_AVX2" != xyes -a \
-                    "x$HAVE_SWR_KNL" != xyes -a \
-                    "x$HAVE_SWR_SKX" != xyes; then
-               AC_MSG_ERROR([swr enabled but no swr architectures selected])
-            fi
-
-            # test if more than one swr arch configured
-            if test `echo $swr_archs | wc -w` -eq 1; then
-                HAVE_SWR_BUILTIN=yes
-            fi
-
-            HAVE_GALLIUM_SWR=yes
-            ;;
-        xvc4)
-            HAVE_GALLIUM_VC4=yes
-            PKG_CHECK_MODULES([VC4], [libdrm >= $LIBDRM_VC4_REQUIRED])
-
-            PKG_CHECK_MODULES([SIMPENROSE], [simpenrose],
-                              [USE_VC4_SIMULATOR=yes;
-                               DEFINES="$DEFINES -DUSE_VC4_SIMULATOR"],
-                              [USE_VC4_SIMULATOR=no])
-            ;;
-        xv3d)
-            HAVE_GALLIUM_V3D=yes
-
-            PKG_CHECK_MODULES([V3D_SIMULATOR], [v3dv3],
-                              [USE_V3D_SIMULATOR=yes;
-                               DEFINES="$DEFINES -DUSE_V3D_SIMULATOR"],
-                              [USE_V3D_SIMULATOR=no])
-            ;;
-        xkmsro)
-            HAVE_GALLIUM_KMSRO=yes
-            ;;
-        xvirgl)
-            HAVE_GALLIUM_VIRGL=yes
-            require_libdrm "virgl"
-            if test "x$enable_egl" = xyes; then
-                require_basic_egl "virgl"
-            fi
-            ;;
-        *)
-            AC_MSG_ERROR([Unknown Gallium driver: $driver])
-            ;;
-        esac
-    done
-fi
-
 # XXX: Keep in sync with LLVM_REQUIRED_SWR
 AM_CONDITIONAL(SWR_INVALID_LLVM_VERSION, test "x$LLVM_VERSION" != x7.0.0 -a \
                                               "x$LLVM_VERSION" != x7.0.1)
--
2.19.2



More information about the mesa-dev mailing list