[Mesa-dev] [PATCH v2 4/6] configure.ac: Move gallium LLVM to the gallium section

Tobias Droste tdroste at gmx.de
Tue Oct 11 01:44:55 UTC 2016


All gallium drivers that need LLVM have to call "gallium_require_llvm()".
This runs the checks for "-.enable_gallium_llvm", the host_cpu checks
and adds the "x86" target.

"--enable-gallium-llvm" is only needed if at least one driver calls
"gallium_require_llvm()". If the flag is set to auto it will default
to no now if no driver with "gallium_require_llvm()" is included.

If gallium swrast driver is selected and LLVM is installed and
"--enable-gallium-llvm" is yes or auto, it defaults to llvmpipe,
otherwise to softpipe.

WARNING: Still a broken build!!!

Signed-off-by: Tobias Droste <tdroste at gmx.de>
---
 configure.ac | 70 ++++++++++++++++++++++--------------------------------------
 1 file changed, 25 insertions(+), 45 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3b87856..6f45e46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -947,12 +947,6 @@ if test "x$LLVM_CONFIG" != xno; then
         LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
     fi
 
-    LLVM_REQUIRED_VERSION_MAJOR="3"
-    LLVM_REQUIRED_VERSION_MINOR="3"
-    if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
-        AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
-    fi
-
     DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
     MESA_LLVM=1
 else
@@ -1049,23 +1043,6 @@ radeon_llvm_check() {
     fi
 }
 
-radeon_gallium_llvm_check() {
-    if test "x$enable_gallium_llvm" != "xyes"; then
-        AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
-    fi
-    radeon_llvm_check $*
-}
-
-swr_llvm_check() {
-    gallium_require_llvm $1
-    if test ${LLVM_VERSION_INT} -lt 306; then
-        AC_MSG_ERROR([LLVM version 3.6 or later required when building $1])
-    fi
-    if test "x$enable_gallium_llvm" != "xyes"; then
-        AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
-    fi
-}
-
 dnl Options for APIs
 AC_ARG_ENABLE([opengl],
     [AS_HELP_STRING([--disable-opengl],
@@ -2356,17 +2333,6 @@ AC_ARG_ENABLE([gallium-llvm],
 if test -z "$with_gallium_drivers"; then
     enable_gallium_llvm=no
 fi
-if test "x$enable_gallium_llvm" = xauto; then
-    case "$host_cpu" in
-    i*86|x86_64|amd64) enable_gallium_llvm=yes;;
-    esac
-fi
-if test "x$enable_gallium_llvm" = xyes || test "x$HAVE_RADEON_VULKAN" = xyes; then
-
-else
-    MESA_LLVM=0
-    LLVM_VERSION_INT=0
-fi
 
 dnl Directory for XVMC libs
 AC_ARG_WITH([xvmc-libdir],
@@ -2424,12 +2390,21 @@ gallium_require_drm() {
 }
 
 gallium_require_llvm() {
-    if test "x$MESA_LLVM" = x0; then
-        case "$host" in *gnux32) return;; esac
-        case "$host_cpu" in
-        i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
-        esac
-    fi
+    case "$host" in *gnux32) return;; esac
+    case "$host_cpu" in
+    i*86|x86_64|amd64)
+        if test "x$enable_gallium_llvm" = xauto; then
+            enable_gallium_llvm=yes
+        fi
+
+        if test "x$enable_gallium_llvm" != "xyes"; then
+            AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+        fi
+
+        llvm_check_version_for "3" "3" "0" "gallium"
+        llvm_add_target "x86" "gallium"
+        ;;
+    esac
 }
 
 gallium_require_drm_loader() {
@@ -2530,8 +2505,9 @@ if test -n "$with_gallium_drivers"; then
             gallium_require_drm "Gallium R600"
             gallium_require_drm_loader
             if test "x$enable_opencl" = xyes; then
-                radeon_gallium_llvm_check "r600g" "3" "6" "0"
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
+                radeon_llvm_check "r600g" "3" "6" "0"
+                gallium_require_llvm "r600"
+                llvm_add_component "asmparser" "r600"
             fi
             ;;
         xradeonsi)
@@ -2540,7 +2516,8 @@ if test -n "$with_gallium_drivers"; then
             PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
             gallium_require_drm "radeonsi"
             gallium_require_drm_loader
-            radeon_gallium_llvm_check "radeonsi" "3" "6" "0"
+            radeon_llvm_check "radeonsi" "3" "6" "0"
+            gallium_require_llvm "radeonsi"
             require_egl_drm "radeonsi"
             ;;
         xnouveau)
@@ -2557,12 +2534,15 @@ if test -n "$with_gallium_drivers"; then
             ;;
         xswrast)
             HAVE_GALLIUM_SOFTPIPE=yes
-            if test "x$MESA_LLVM" = x1; then
+            if test "x$MESA_LLVM" = x1 && (test "x$enable_gallium_llvm" = xyes || test "x$enable_gallium_llvm" = xauto); then
+                llvm_check_version_for "3" "6" "0" "llvmpipe"
+                gallium_require_llvm "llvmpipe"
                 HAVE_GALLIUM_LLVMPIPE=yes
             fi
             ;;
         xswr)
-            swr_llvm_check "swr"
+            llvm_check_version_for "3" "6" "0" "swr"
+            gallium_require_llvm "swr"
 
             swr_require_cxx_feature_flags "C++11" "__cplusplus >= 201103L" \
                 ",-std=c++11" \
-- 
2.10.0



More information about the mesa-dev mailing list