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

Author: Marek Olšák <mar...@gmail.com>
Date:   Tue Nov 27 23:38:01 2012 +0100

configure.ac: consolidate stripping unwanted LLVM flags

Reviewed-by: Tom Stellard <thomas.stell...@amd.com>

---

 configure.ac |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6b0d703..ec06d37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1641,6 +1641,19 @@ AC_ARG_WITH([llvm-prefix],
     [llvm_prefix=""])
 
 
+# Call this inside ` ` to get the return value.
+# $1 is the llvm-config command with arguments.
+strip_unwanted_llvm_flags() {
+    echo `$1` | sed \
+       -e 's/-DNDEBUG\>//g' \
+       -e 's/-pedantic//g' \
+       -e 's/-Wcovered-switch-default//g' \
+       -e 's/-O.//g' \
+       -e 's/-g//g' \
+       -e 's/-Wall//g'
+}
+
+
 if test "x$with_gallium_drivers" = x; then
     enable_gallium_llvm=no
 fi
@@ -1658,7 +1671,6 @@ if test "x$enable_gallium_llvm" = xyes; then
 
     if test "x$LLVM_CONFIG" != xno; then
        LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
-       LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 
's/-pedantic//g' -e 's/-Wcovered-switch-default//g' -e 's/-O.//g' -e 's/-g//g' 
-e 's/-Wall//g'`
        if test "x$with_llvm_shared_libs" = xyes; then
            dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
            LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
@@ -1675,8 +1687,9 @@ if test "x$enable_gallium_llvm" = xyes; then
        fi
        LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
        LLVM_BINDIR=`$LLVM_CONFIG --bindir`
-       LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags|sed -e 's/-DNDEBUG\>//g' -e 
's/-pedantic//g' -e 's/-Wcovered-switch-default//g' -e 's/-O.//g' -e 's/-g//g' 
-e 's/-Wall//g'`
-       LLVM_CPPFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 
's/-pedantic//g' -e 's/-Wcovered-switch-default//g' -e 's/-O.//g' -e 's/-g//g' 
-e 's/-Wall//g'`
+       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`
        DEFINES="${DEFINES} -DHAVE_LLVM=`echo $LLVM_VERSION | sed -e 
's/\([[0-9]]\)\.\([[0-9]]\)/0x0\10\2/g'`"

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to