[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    icecream
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2012-07-08 15:27:10
Message-ID: 20120708152710.AD413AC7A9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1304631 by lunakl:

try to guess default for ICECC_REWRITE_INCLUDES

based on clang present at icecream build time, which is simple and
should generally work fine



 M  +11 -2     client/local.cpp  
 M  +20 -0     configure.in  


--- trunk/icecream/client/local.cpp #1304630:1304631
@@ -132,8 +132,17 @@
 */
 bool compiler_only_rewrite_includes( const CompileJob& job )
 {
-    if ( compiler_is_clang( job ))
-        return getenv( "ICECC_REWRITE_INCLUDES" ) != NULL;
+    if ( compiler_is_clang( job )) {
+        if( const char* rewrite_includes = getenv( "ICECC_REWRITE_INCLUDES" ))
+            return *rewrite_includes != '\0' && *rewrite_includes != '0';
+#ifdef HAVE_CLANG_REWRITE_INCLUDES
+        // Assume that we use the same clang (as least as far as capabilities go)
+        // as was available when icecream was built. ICECC_REWRITE_INCLUDES above
+        // allows override, and the only case when this should realistically break
+        // is if somebody downgrades their clang.
+        return true;
+#endif
+    }
     return false;
 }
 
--- trunk/icecream/configure.in #1304630:1304631
@@ -222,6 +222,26 @@
 esac
 AC_SUBST(LIB_KINFO)
 
+AC_CHECK_PROG(CLANG,clang,clang)
+if test -n "$CLANG"; then
+    AC_MSG_CHECKING([whether clang -Werror works for unknown options])
+    $CLANG -Werror -totallybogusoption -E - >/dev/null 2>/dev/null
+    if test $? -eq 0; then
+        AC_MSG_RESULT(no)
+        # can't detect if the option is supported, but that's too old clang anyway
+    else
+        AC_MSG_RESULT(yes)
+        AC_MSG_CHECKING([for clang -E -Wp,-rewrite-includes])
+        $CLANG -Werror -E -Wp,-rewrite-includes - >/dev/null 2>/dev/null
+        if test $? -eq 0; then
+            AC_MSG_RESULT(yes)
+            AC_DEFINE(HAVE_CLANG_REWRITE_INCLUDES, 1, [Define to 1 if clang supports \
-Wp,-rewrite-includes]) +        else
+            AC_MSG_RESULT(no)
+        fi
+    fi
+fi
+
 AC_CONFIG_FILES([ Makefile ])
 AC_CONFIG_FILES([ client/Makefile ])
 AC_CONFIG_FILES([ daemon/Makefile ])


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic