Mesa (master): configure.ac: Respect LLVM_CFLAGS in LLVM version detection

Emil Velikov evelikov at kemper.freedesktop.org
Wed Jan 18 13:28:01 UTC 2017


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

Author: Tomasz Figa <tfiga at chromium.org>
Date:   Wed Dec 14 17:00:27 2016 +0900

configure.ac: Respect LLVM_CFLAGS in LLVM version detection

When compiling LLVM headers, including llvm-config.h, we need to respect
LLVM_CFLAGS. This is especially crucial if LLVM is located in a
non-standard location and it happens that llvm-config.h includes another
header. In such case the detection would fail due to missing header,
because the path is provided in LLVM_CFLAGS.

Let's add LLVM_CFLAGS to global CFLAGS for the time of detection and then
restore the original flags, as done in other places of the script.

Signed-off-by: Tomasz Figa <tfiga at chromium.org>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

---

 configure.ac | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index 655b76e..182d072 100644
--- a/configure.ac
+++ b/configure.ac
@@ -979,6 +979,10 @@ llvm_set_environment_variables() {
         LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
         LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
 
+        # We need to respect LLVM_CFLAGS when compiling LLVM headers.
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $LLVM_CFLAGS"
+
         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],
@@ -986,6 +990,8 @@ llvm_set_environment_variables() {
         AC_COMPUTE_INT([LLVM_VERSION_PATCH], [LLVM_VERSION_PATCH],
             [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
 
+        CFLAGS="$save_CFLAGS"
+
         # Only needed for LLVM < 3.6.0
         if test -z "$LLVM_VERSION_PATCH"; then
             LLVM_VERSION_PATCH=0




More information about the mesa-commit mailing list