Mesa (master): configure.ac: Check gallium LLVM version in gallium_require_llvm

Emil Velikov evelikov at kemper.freedesktop.org
Mon Dec 5 14:45:01 UTC 2016


Module: Mesa
Branch: master
Commit: b3119a3360824a93e193b326a57f71cda15bc96f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3119a3360824a93e193b326a57f71cda15bc96f

Author: Tobias Droste <tdroste at gmx.de>
Date:   Sat Nov 19 02:39:02 2016 +0100

configure.ac: Check gallium LLVM version in gallium_require_llvm

This moves the LLVM version check to the helper function
gallium_require_llvm() and uses the llvm_check_version_for() helper
instead of open conding the LLVM version check.

gallium_require_llvm is functionally the same as before, because
"enable_gallium_llvm" is only set to "yes" if the host cpu is x86:

if test "x$enable_gallium_llvm" = xauto; then
    case "$host_cpu" in
    i*86|x86_64|amd64) enable_gallium_llvm=yes;;
    esac
fi

This function is also only called now when needed.
Before this patch llvmpipe would call this as soon as LLVM is
installed. Now it only gets called by llvmpipe if gallium
LLVM is actually enabled (i.e. only on x86).

Both reasons mentioned above remove the need to check host cpu
in the gallium_require_llvm function.

Signed-off-by: Tobias Droste <tdroste at gmx.de>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

---

 configure.ac | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7557733..b52dc71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -982,12 +982,6 @@ llvm_set_environment_variables() {
             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
-
         llvm_add_default_components "gallium"
 
         if test "x$enable_opencl" = xyes; then
@@ -2348,11 +2342,10 @@ dnl
 dnl Gallium helper functions
 dnl
 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
+    if test "x$enable_gallium_llvm" == "xyes"; then
+        llvm_check_version_for "3" "3" "0" "gallium"
+    else
+        AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
     fi
 }
 
@@ -2485,7 +2478,7 @@ 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";  then
                 HAVE_GALLIUM_LLVMPIPE=yes
             fi
             ;;




More information about the mesa-commit mailing list