diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-08-17 14:40:52 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-08-18 16:24:28 +0200 |
commit | a88e477346361665311eb2310e84023ce8a2fe59 (patch) | |
tree | d0aeba5118cbb3b3adc05e44c428405df34ad01d /configure.ac | |
parent | c0fb40ddbf82c60052bab41f9ad1e9647ddc99a8 (diff) |
make --enable-ccache affect also CLANG_CC/CXX
Change-Id: I743ef8cc00eb605ee20da5d9524a5a46ed841e3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100865
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index ce2cdec3be4c..62052bb63a58 100644 --- a/configure.ac +++ b/configure.ac @@ -11489,6 +11489,49 @@ if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then CXX="$save_CXX" fi fi +# +# prefix CLANG_CC/CLANG_CXX with ccache if needed +# +if test "$CCACHE" != "" -a -n "$CLANG_CC" -a -n "$CLANG_CXX"; then + AC_MSG_CHECKING([whether $CLANG_CC is already ccached]) + AC_LANG_PUSH([C]) + save_CC="$CC" + CC="$CLANG_CC" + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS --ccache-skip -O2" + dnl an empty program will do, we're checking the compiler flags + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], + [use_ccache=yes], [use_ccache=no]) + if test $use_ccache = yes; then + AC_MSG_RESULT([yes]) + else + CLANG_CC="$CCACHE $CLANG_CC" + AC_MSG_RESULT([no]) + fi + CFLAGS=$save_CFLAGS + CC=$save_CC + AC_LANG_POP([C]) + + AC_MSG_CHECKING([whether $CLANG_CXX is already ccached]) + AC_LANG_PUSH([C++]) + save_CXX="$CXX" + CXX="$CLANG_CXX" + save_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS --ccache-skip -O2" + dnl an empty program will do, we're checking the compiler flags + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], + [use_ccache=yes], [use_ccache=no]) + if test $use_ccache = yes; then + AC_MSG_RESULT([yes]) + else + CLANG_CXX="$CCACHE $CLANG_CXX" + AC_MSG_RESULT([no]) + fi + CXXFLAGS=$save_CXXFLAGS + CXX=$save_CXX + AC_LANG_POP([C++]) +fi + AC_SUBST(CLANG_CC) AC_SUBST(CLANG_CXX) AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE2) |