[Mesa-dev] [PATCH v3 08/25] configure.ac: Move LLVM version check to the top

Tobias Droste tdroste at gmx.de
Tue Oct 11 23:02:35 UTC 2016


A function with the LLVM version checked is moved to the top.
The function is called where the old code was.
No functional change.

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

diff --git a/configure.ac b/configure.ac
index 933e7b5..0f19a4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -861,6 +861,54 @@ fi
 AC_SUBST([SELINUX_CFLAGS])
 AC_SUBST([SELINUX_LIBS])
 
+dnl
+dnl LLVM
+dnl
+llvm_get_version() {
+    if test -z "${LLVM_CONFIG}"; then
+        if test -n "$llvm_prefix"; then
+            AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
+        else
+            AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
+        fi
+    fi
+
+    if test "x$LLVM_CONFIG" != xno; then
+        LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
+        LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
+        LLVM_BINDIR=`$LLVM_CONFIG --bindir`
+        LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
+        LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
+        LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
+        LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
+        LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
+
+        AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
+            [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+        AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
+            [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+
+        LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
+        if test -z "$LLVM_VERSION_PATCH"; then
+            LLVM_VERSION_PATCH=0
+        fi
+
+        if test -n "${LLVM_VERSION_MAJOR}"; then
+            LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
+        else
+            LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
+        fi
+
+        llvm_add_default_components
+
+        DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
+        MESA_LLVM=1
+    else
+        MESA_LLVM=0
+        LLVM_VERSION_INT=0
+    fi
+}
+
 dnl Options for APIs
 AC_ARG_ENABLE([opengl],
     [AS_HELP_STRING([--disable-opengl],
@@ -2242,48 +2290,7 @@ if test "x$enable_gallium_llvm" = xauto; then
     esac
 fi
 if test "x$enable_gallium_llvm" = xyes || test "x$HAVE_RADEON_VULKAN" = xyes; then
-    if test -z "${LLVM_CONFIG}"; then
-        if test -n "$llvm_prefix"; then
-            AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
-        else
-            AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
-        fi
-    fi
-
-    if test "x$LLVM_CONFIG" != xno; then
-        LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
-        LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
-        LLVM_BINDIR=`$LLVM_CONFIG --bindir`
-        LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
-        LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
-        LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
-        LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
-        LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
-
-        AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
-            [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
-        AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
-            [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
-
-        LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
-        if test -z "$LLVM_VERSION_PATCH"; then
-            LLVM_VERSION_PATCH=0
-        fi
-
-        if test -n "${LLVM_VERSION_MAJOR}"; then
-            LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
-        else
-            LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
-        fi
-
-        llvm_add_default_components
-
-        DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
-        MESA_LLVM=1
-    else
-        MESA_LLVM=0
-        LLVM_VERSION_INT=0
-    fi
+    llvm_get_version
 else
     MESA_LLVM=0
     LLVM_VERSION_INT=0
-- 
2.10.0



More information about the mesa-dev mailing list