common/autoconf/build-performance.m4

Print this page

        

@@ -174,51 +174,17 @@
     if test "x$with_ccache_dir" != x; then
         # When using a non home ccache directory, assume the use is to share ccache files
         # with other users. Thus change the umask.
         SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
     fi
-    CCACHE_FOUND=""
-    if test "x$CCACHE" != x; then
-        BPERF_SETUP_CCACHE_USAGE
-    fi    
-])
-
-AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
-[
-    if test "x$CCACHE" != x; then
-        CCACHE_FOUND="true"
-        # Only use ccache if it is 3.1.4 or later, which supports
-        # precompiled headers.
-        AC_MSG_CHECKING([if ccache supports precompiled headers])
-        HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null`
-        if test "x$HAS_GOOD_CCACHE" = x; then
-            AC_MSG_RESULT([no, disabling ccache])
-            CCACHE=
-        else
-            AC_MSG_RESULT([yes])
-            AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
-            PUSHED_FLAGS="$CXXFLAGS"
-            CXXFLAGS="-fpch-preprocess $CXXFLAGS"
-            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
-            CXXFLAGS="$PUSHED_FLAGS"
-            if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
-                AC_MSG_RESULT([yes])
-            else
-                AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
-                CCACHE=
-            fi
-        fi
-    fi
-
     if test "x$CCACHE" != x; then
         CCACHE_SLOPPINESS=time_macros
         CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"
-        CCACHE_FLAGS=-fpch-preprocess
 
         if test "x$SET_CCACHE_DIR" != x; then
-            mkdir -p $CCACHE_DIR > /dev/null 2>&1
-            chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
+            mkdir -p $with_ccache_dir > /dev/null 2>&1
+            chmod a+rwxs $with_ccache_dir > /dev/null 2>&1
         fi
     fi
 ])
 
 AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],

@@ -230,16 +196,17 @@
 #
 AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
         [disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
     [ENABLE_PRECOMPH=${enable_precompiled_headers}], [ENABLE_PRECOMPH=yes])
 
-USE_PRECOMPILED_HEADER=1
-if test "x$ENABLE_PRECOMPH" = xno; then
+  USE_PRECOMPILED_HEADER=1
+  if test "x$ENABLE_PRECOMPH" = xno; then
     USE_PRECOMPILED_HEADER=0
-fi
-
-if test "x$ENABLE_PRECOMPH" = xyes; then
+  elif test "x$CCACHE" != x; then
+    # Disable precompiled header when using ccache as they don't work well together.
+    USE_PRECOMPILED_HEADER=0
+  elif test "x$ENABLE_PRECOMPH" = xyes; then
     # Check that the compiler actually supports precomp headers.
     if test "x$GCC" = xyes; then
          AC_MSG_CHECKING([that precompiled headers work])
          echo "int alfa();" > conftest.h
          $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD

@@ -249,13 +216,13 @@
          else
              AC_MSG_RESULT([yes])
          fi
          rm -f conftest.h conftest.hpp.gch
     fi
-fi
+  fi
 
-AC_SUBST(USE_PRECOMPILED_HEADER)
+  AC_SUBST(USE_PRECOMPILED_HEADER)
 ])
 
 
 AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
 [