configure.ac: Mandate --enable-gallium-llvm when checking LLVM version
[mesa.git] / configure.ac
index 8fd7b6f001c8fcb88567df94fef6afb91a739f41..78b9b0316f0446ed76da96636e2d6627f1dc3158 100644 (file)
@@ -967,11 +967,18 @@ llvm_set_environment_variables() {
     fi
 }
 
-llvm_check_version_for() {
+require_llvm() {
+    if test "x$enable_gallium_llvm" != "xyes"; then
+        AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+    fi
+}
+
+llvm_require_version() {
     if test "x$MESA_LLVM" = x0; then
         AC_MSG_ERROR([LLVM $1 or newer is required for $2])
         return
     fi
+    require_llvm $2
 
     llvm_target_version_major=`echo $1 | cut -d. -f1 | egrep -o '^[[0-9]]+'`
     llvm_target_version_minor=`echo $1 | cut -d. -f2 | egrep -o '^[[0-9]]+'`
@@ -1012,7 +1019,7 @@ radeon_llvm_check() {
         amdgpu_llvm_target_name='amdgpu'
     fi
 
-    llvm_check_version_for $*
+    llvm_require_version $*
 
     llvm_add_target $amdgpu_llvm_target_name $2
 
@@ -2024,7 +2031,7 @@ if test "x$enable_opencl" = xyes; then
        AC_MSG_ERROR([Clover requires libelf])
     fi
 
-    llvm_check_version_for $LLVM_REQUIRED_OPENCL "opencl"
+    llvm_require_version $LLVM_REQUIRED_OPENCL "opencl"
 
     llvm_add_default_components "opencl"
     llvm_add_component "all-targets" "opencl"
@@ -2195,15 +2202,6 @@ AC_ARG_WITH([d3d-libdir],
     [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
 AC_SUBST([D3D_DRIVER_INSTALL_DIR])
 
-dnl
-dnl Gallium helper functions
-dnl
-gallium_require_llvm() {
-    if test "x$enable_gallium_llvm" != "xyes"; then
-        AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
-    fi
-}
-
 dnl
 dnl r300 doesn't strictly require LLVM, but for performance reasons we
 dnl highly recommend LLVM usage. So require it at least on x86 and x86_64
@@ -2212,7 +2210,7 @@ dnl
 r300_require_llvm() {
     case "$host" in *gnux32) return;; esac
     case "$host_cpu" in
-    i*86|x86_64|amd64) gallium_require_llvm $1
+    i*86|x86_64|amd64) require_llvm $1
         ;;
     esac
 }
@@ -2344,8 +2342,7 @@ if test -n "$with_gallium_drivers"; then
             fi
             ;;
         xswr)
-            llvm_check_version_for $LLVM_REQUIRED_SWR "swr"
-            gallium_require_llvm "swr"
+            llvm_require_version $LLVM_REQUIRED_SWR "swr"
 
             swr_require_cxx_feature_flags "C++11" "__cplusplus >= 201103L" \
                 ",-std=c++11" \
@@ -2387,7 +2384,7 @@ if test -n "$with_gallium_drivers"; then
 fi
 
 if test "x$enable_gallium_llvm" == "xyes"; then
-    llvm_check_version_for $LLVM_REQUIRED_GALLIUM "gallium"
+    llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
     llvm_add_default_components "gallium"
 fi