[Mesa-dev] [PATCH 05/12] configure.ac: bump the minimum LLVM version to 5.0.1

Emil Velikov emil.l.velikov at gmail.com
Wed Oct 31 13:29:57 UTC 2018


From: Emil Velikov <emil.velikov at collabora.com>

As mentioned in earlier commit - all recent distros have it.
With the version bumped, we can drop all the ugly hacks we've been
carrying for years.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 configure.ac | 85 ++++++++--------------------------------------------
 1 file changed, 13 insertions(+), 72 deletions(-)

diff --git a/configure.ac b/configure.ac
index be9674a0c1d..7a1ae058b5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,9 +104,7 @@ LIBSENSORS_REQUIRED=4.0.0
 ZLIB_REQUIRED=1.2.3
 
 dnl LLVM versions
-LLVM_REQUIRED_GALLIUM=3.3.0
-LLVM_REQUIRED_OPENCL=3.9.0
-LLVM_REQUIRED_R600=3.9.0
+LLVM_REQUIRED_BASE=5.0.1
 LLVM_REQUIRED_RADEONSI=6.0.0
 LLVM_REQUIRED_RADV=6.0.0
 LLVM_REQUIRED_SWR=6.0.0
@@ -1131,11 +1129,6 @@ llvm_set_environment_variables() {
 
         CFLAGS="$save_CFLAGS"
 
-        # Only needed for LLVM < 3.6.0
-        if test -z "$LLVM_VERSION_PATCH"; then
-            LLVM_VERSION_PATCH=0
-        fi
-
         LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
 
         FOUND_LLVM=yes
@@ -1187,15 +1180,9 @@ llvm_require_version() {
 }
 
 radeon_llvm_check() {
-    if test ${LLVM_VERSION_INT} -lt 307; then
-        amdgpu_llvm_target_name='r600'
-    else
-        amdgpu_llvm_target_name='amdgpu'
-    fi
-
     llvm_require_version $*
 
-    llvm_add_target $amdgpu_llvm_target_name $2
+    llvm_add_target "amdgpu" $2
 
     llvm_add_default_components $2
     llvm_add_component "bitreader" $2
@@ -2497,7 +2484,7 @@ if test "x$enable_opencl" = xyes; then
         AC_SUBST([CLOVER_STD_OVERRIDE])
     fi
 
-    llvm_require_version $LLVM_REQUIRED_OPENCL "opencl"
+    llvm_require_version $LLVM_REQUIRED_BASE "opencl"
 
     llvm_add_default_components "opencl"
     llvm_add_component "all-targets" "opencl"
@@ -2709,7 +2696,7 @@ if test -n "$with_gallium_drivers"; then
             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"
+                radeon_llvm_check $LLVM_REQUIRED_BASE "r600"
 
                 llvm_add_component "asmparser" "r600"
                 llvm_add_component "bitreader" "r600"
@@ -2850,7 +2837,7 @@ AM_CONDITIONAL(SWR_INVALID_LLVM_VERSION, test "x$LLVM_VERSION" != x6.0.0 -a \
                                               "x$LLVM_VERSION" != x6.0.1)
 
 if test "x$enable_llvm" = "xyes" -a "$with_gallium_drivers"; then
-    llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
+    llvm_require_version $LLVM_REQUIRED_BASE "gallium"
     llvm_add_default_components "gallium"
 fi
 
@@ -2874,38 +2861,6 @@ if test "x$HAVE_GALLIUM_NOUVEAU" != xyes -a "x$HAVE_GALLIUM_TEGRA" = xyes; then
     AC_MSG_ERROR([Building with tegra requires nouveau])
 fi
 
-detect_old_buggy_llvm() {
-    dnl llvm-config may not give the right answer when llvm is a built as a
-    dnl single shared library, so we must work the library name out for
-    dnl ourselves.
-    dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823)
-    dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
-    LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
-    AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"], [llvm_have_one_so=yes])
-
-    if test "x$llvm_have_one_so" = xyes; then
-        dnl LLVM was built using auto*, so there is only one shared object.
-        LLVM_LIBS="-l$LLVM_SO_NAME"
-    else
-        dnl If LLVM was built with CMake, there will be one shared object per
-        dnl component.
-        AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.$IMP_LIB_EXT"],
-               [AC_MSG_ERROR([Could not find llvm shared libraries:
-                Please make sure you have built llvm with the --enable-shared option
-                and that your llvm libraries are installed in $LLVM_LIBDIR
-                If you have installed your llvm libraries to a different directory you
-                can use the --with-llvm-prefix= configure flag to specify this directory.
-                NOTE: Mesa is attempting to use llvm shared libraries by default.
-                If you do not want to build with llvm shared libraries and instead want to
-                use llvm static libraries then add --disable-llvm-shared-libs to your configure
-                invocation and rebuild.])])
-
-        dnl We don't need to update LLVM_LIBS in this case because the LLVM
-        dnl install uses a shared object for each component and we have
-        dnl already added all of these objects to LLVM_LIBS.
-    fi
-}
-
 dnl
 dnl Set defines and buildtime variables only when using LLVM.
 dnl
@@ -2923,29 +2878,15 @@ if test "x$enable_llvm" = xyes; then
     dnl this was causing the same libraries to be appear multiple times
     dnl in LLVM_LIBS.
 
-    if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 9; then
-        if test "x$enable_llvm_shared_libs" = xyes; then
-            LLVM_LIBS="`$LLVM_CONFIG --link-shared --libs ${LLVM_COMPONENTS}`"
-        else
-            dnl Invoking llvm-config with both -libs and --system-libs produces the
-            dnl two separate lines - each for the set of libraries.
-		dnl Call the program twice, effectively folding them into a single line.
-            LLVM_LIBS="`$LLVM_CONFIG --link-static --libs ${LLVM_COMPONENTS}`"
-            dnl We need to link to llvm system libs when using static libs
-            LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --link-static --system-libs`"
-        fi
+    if test "x$enable_llvm_shared_libs" = xyes; then
+        LLVM_LIBS="`$LLVM_CONFIG --link-shared --libs ${LLVM_COMPONENTS}`"
     else
-        LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
-        if test "x$enable_llvm_shared_libs" = xyes; then
-            detect_old_buggy_llvm
-        else
-            AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
-            dnl We need to link to llvm system libs when using static libs
-            dnl However, only llvm 3.5+ provides --system-libs
-            if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
-                LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
-            fi
-        fi
+        dnl Invoking llvm-config with both -libs and --system-libs produces the
+        dnl two separate lines - each for the set of libraries.
+	dnl Call the program twice, effectively folding them into a single line.
+        LLVM_LIBS="`$LLVM_CONFIG --link-static --libs ${LLVM_COMPONENTS}`"
+        dnl We need to link to llvm system libs when using static libs
+        LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --link-static --system-libs`"
     fi
 
     dnl The gallium-xlib GLX and gallium OSMesa targets directly embed the
-- 
2.19.1



More information about the mesa-dev mailing list