Bug 755145 - Define CCACHE_CPP2 when using ccache and Clang. r=glandium.
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,13 +1,15 @@
dnl
dnl Local autoconf macros used with mozilla
dnl The contents of this file are under the Public Domain.
dnl
+builtin(include, build/autoconf/toolchain.m4)dnl
+builtin(include, build/autoconf/ccache.m4)dnl
builtin(include, build/autoconf/nspr.m4)dnl
builtin(include, build/autoconf/nss.m4)dnl
builtin(include, build/autoconf/pkg.m4)dnl
builtin(include, build/autoconf/codeset.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
builtin(include, build/autoconf/mozprog.m4)dnl
builtin(include, build/autoconf/mozheader.m4)dnl
builtin(include, build/autoconf/mozcommonheader.m4)dnl
new file mode 100644
--- /dev/null
+++ b/build/autoconf/ccache.m4
@@ -0,0 +1,36 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl ======================================================
+dnl = Enable compiling with ccache
+dnl ======================================================
+AC_DEFUN([MOZ_CHECK_CCACHE],
+[
+MOZ_ARG_WITH_STRING(ccache,
+[ --with-ccache[=path/to/ccache]
+ Enable compiling with ccache],
+ CCACHE=$withval, CCACHE="no")
+
+if test "$CCACHE" != "no"; then
+ if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
+ CCACHE=
+ else
+ if test ! -e "$CCACHE"; then
+ AC_MSG_ERROR([$CCACHE not found])
+ fi
+ fi
+ MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
+ if test -z "$CCACHE" -o "$CCACHE" = ":"; then
+ AC_MSG_ERROR([ccache not found])
+ elif test -x "$CCACHE"; then
+ CC="$CCACHE $CC"
+ CXX="$CCACHE $CXX"
+ MOZ_USING_CCACHE=1
+ else
+ AC_MSG_ERROR([$CCACHE is not executable])
+ fi
+fi
+
+AC_SUBST(MOZ_USING_CCACHE)
+])
new file mode 100644
--- /dev/null
+++ b/build/autoconf/toolchain.m4
@@ -0,0 +1,62 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_TOOL_VARIABLES],
+[
+GNU_AS=
+GNU_LD=
+GNU_CC=
+GNU_CXX=
+CC_VERSION='N/A'
+CXX_VERSION='N/A'
+if test "$GCC" = "yes"; then
+ GNU_CC=1
+ CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
+fi
+if test "$GXX" = "yes"; then
+ GNU_CXX=1
+ CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
+fi
+if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
+ GNU_AS=1
+fi
+rm -f conftest.out
+if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
+ GNU_LD=1
+fi
+if test "$GNU_CC"; then
+ if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
+ GCC_USE_GNU_LD=1
+ fi
+fi
+
+INTEL_CC=
+INTEL_CXX=
+if test "$GCC" = yes; then
+ if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
+ INTEL_CC=1
+ fi
+fi
+
+if test "$GXX" = yes; then
+ if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
+ INTEL_CXX=1
+ fi
+fi
+
+CLANG_CC=
+CLANG_CXX=
+if test "$GCC" = yes; then
+ if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
+ CLANG_CC=1
+ fi
+fi
+
+if test "$GXX" = yes; then
+ if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
+ CLANG_CXX=1
+ fi
+fi
+AC_SUBST(CLANG_CXX)
+])
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -79,16 +79,18 @@ MOZ_JPROF = @MOZ_JPROF@
MOZ_SHARK = @MOZ_SHARK@
MOZ_CALLGRIND = @MOZ_CALLGRIND@
MOZ_VALGRIND = @MOZ_VALGRIND@
MOZ_VTUNE = @MOZ_VTUNE@
MOZ_ETW = @MOZ_ETW@
MOZ_TRACE_JSCALLS = @MOZ_TRACE_JSCALLS@
DEHYDRA_PATH = @DEHYDRA_PATH@
+MOZ_USING_CCACHE = @MOZ_USING_CCACHE@
+CLANG_CXX = @CLANG_CXX@
MOZ_LINKER = @MOZ_LINKER@
MOZ_OLD_LINKER = @MOZ_OLD_LINKER@
MOZ_ENABLE_SZIP = @MOZ_ENABLE_SZIP@
NS_TRACE_MALLOC = @NS_TRACE_MALLOC@
USE_ELF_DYNSTR_GC = @USE_ELF_DYNSTR_GC@
USE_ELF_HACK = @USE_ELF_HACK@
STDCXX_COMPAT = @STDCXX_COMPAT@
MOZ_LIBSTDCXX_TARGET_VERSION=@MOZ_LIBSTDCXX_TARGET_VERSION@
--- a/config/config.mk
+++ b/config/config.mk
@@ -557,16 +557,23 @@ endif # NEXT_ROOT
PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
ifdef MACOS_SDK_DIR
PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
endif # MACOS_SDK_DIR
ifdef MACOSX_DEPLOYMENT_TARGET
export MACOSX_DEPLOYMENT_TARGET
PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)"
endif # MACOSX_DEPLOYMENT_TARGET
+
+ifdef MOZ_USING_CCACHE
+ifdef CLANG_CXX
+export CCACHE_CPP2=1
+endif
+endif
+
ifdef MOZ_OPTIMIZE
ifeq (2,$(MOZ_OPTIMIZE))
# Only override project defaults if the config specified explicit settings
PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)"
endif # MOZ_OPTIMIZE=2
endif # MOZ_OPTIMIZE
endif # OS_ARCH=Darwin
--- a/configure.in
+++ b/configure.in
@@ -358,70 +358,17 @@ else
if test -z "$HOST_AR"; then
HOST_AR='$(AR)'
fi
if test -z "$HOST_AR_FLAGS"; then
HOST_AR_FLAGS='$(AR_FLAGS)'
fi
fi
-GNU_AS=
-GNU_LD=
-GNU_CC=
-GNU_CXX=
-CC_VERSION='N/A'
-CXX_VERSION='N/A'
-if test "$GCC" = "yes"; then
- GNU_CC=1
- CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
-fi
-if test "$GXX" = "yes"; then
- GNU_CXX=1
- CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
-fi
-if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
- GNU_AS=1
-fi
-rm -f conftest.out
-if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
- GNU_LD=1
-fi
-if test "$GNU_CC"; then
- if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
- GCC_USE_GNU_LD=1
- fi
-fi
-
-INTEL_CC=
-INTEL_CXX=
-if test "$GCC" = yes; then
- if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
- INTEL_CC=1
- fi
-fi
-
-if test "$GXX" = yes; then
- if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
- INTEL_CXX=1
- fi
-fi
-
-CLANG_CC=
-CLANG_CXX=
-if test "$GCC" = yes; then
- if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
- CLANG_CC=1
- fi
-fi
-
-if test "$GXX" = yes; then
- if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
- CLANG_CXX=1
- fi
-fi
+MOZ_TOOL_VARIABLES
dnl ========================================================
dnl Special win32 checks
dnl ========================================================
# With win8, sdk target=602, WINVER=602
MOZ_ARG_ENABLE_BOOL(metro,
[ --enable-metro Enable Windows Metro build targets],
@@ -7162,42 +7109,17 @@ MOZ_ARG_ENABLE_BOOL(js-diagnostics,
[ --enable-js-diagnostics
Enable JS diagnostic assertions and breakpad data],
JS_CRASH_DIAGNOSTICS=1,
JS_CRASH_DIAGNOSTICS= )
if test -n "$JS_CRASH_DIAGNOSTICS"; then
AC_DEFINE(JS_CRASH_DIAGNOSTICS)
fi
-dnl ======================================================
-dnl = Enable compiling with ccache
-dnl ======================================================
-MOZ_ARG_WITH_STRING(ccache,
-[ --with-ccache[=path/to/ccache]
- Enable compiling with ccache],
- CCACHE=$withval, CCACHE="no")
-
-if test "$CCACHE" != "no"; then
- if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
- CCACHE=
- else
- if test ! -e "$CCACHE"; then
- AC_MSG_ERROR([$CCACHE not found])
- fi
- fi
- MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
- if test -z "$CCACHE" -o "$CCACHE" = ":"; then
- AC_MSG_ERROR([ccache not found])
- elif test -x "$CCACHE"; then
- CC="$CCACHE $CC"
- CXX="$CCACHE $CXX"
- else
- AC_MSG_ERROR([$CCACHE is not executable])
- fi
-fi
+MOZ_CHECK_CCACHE
dnl ========================================================
dnl = Enable static checking using gcc-dehydra
dnl ========================================================
MOZ_ARG_WITH_STRING(static-checking,
[ --with-static-checking=path/to/gcc_dehydra.so
Enable static checking of code using GCC-dehydra],
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -1,13 +1,15 @@
dnl
dnl Local autoconf macros used with mozilla
dnl The contents of this file are under the Public Domain.
dnl
+builtin(include, build/autoconf/toolchain.m4)dnl
+builtin(include, build/autoconf/ccache.m4)dnl
builtin(include, build/autoconf/pkg.m4)dnl
builtin(include, build/autoconf/nspr.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
builtin(include, build/autoconf/moznbytetype.m4)dnl
builtin(include, build/autoconf/mozprog.m4)dnl
builtin(include, build/autoconf/mozheader.m4)dnl
builtin(include, build/autoconf/mozcommonheader.m4)dnl
builtin(include, build/autoconf/acwinpaths.m4)dnl
new file mode 100644
--- /dev/null
+++ b/js/src/build/autoconf/ccache.m4
@@ -0,0 +1,36 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl ======================================================
+dnl = Enable compiling with ccache
+dnl ======================================================
+AC_DEFUN([MOZ_CHECK_CCACHE],
+[
+MOZ_ARG_WITH_STRING(ccache,
+[ --with-ccache[=path/to/ccache]
+ Enable compiling with ccache],
+ CCACHE=$withval, CCACHE="no")
+
+if test "$CCACHE" != "no"; then
+ if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
+ CCACHE=
+ else
+ if test ! -e "$CCACHE"; then
+ AC_MSG_ERROR([$CCACHE not found])
+ fi
+ fi
+ MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
+ if test -z "$CCACHE" -o "$CCACHE" = ":"; then
+ AC_MSG_ERROR([ccache not found])
+ elif test -x "$CCACHE"; then
+ CC="$CCACHE $CC"
+ CXX="$CCACHE $CXX"
+ MOZ_USING_CCACHE=1
+ else
+ AC_MSG_ERROR([$CCACHE is not executable])
+ fi
+fi
+
+AC_SUBST(MOZ_USING_CCACHE)
+])
new file mode 100644
--- /dev/null
+++ b/js/src/build/autoconf/toolchain.m4
@@ -0,0 +1,62 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_TOOL_VARIABLES],
+[
+GNU_AS=
+GNU_LD=
+GNU_CC=
+GNU_CXX=
+CC_VERSION='N/A'
+CXX_VERSION='N/A'
+if test "$GCC" = "yes"; then
+ GNU_CC=1
+ CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
+fi
+if test "$GXX" = "yes"; then
+ GNU_CXX=1
+ CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
+fi
+if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
+ GNU_AS=1
+fi
+rm -f conftest.out
+if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
+ GNU_LD=1
+fi
+if test "$GNU_CC"; then
+ if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
+ GCC_USE_GNU_LD=1
+ fi
+fi
+
+INTEL_CC=
+INTEL_CXX=
+if test "$GCC" = yes; then
+ if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
+ INTEL_CC=1
+ fi
+fi
+
+if test "$GXX" = yes; then
+ if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
+ INTEL_CXX=1
+ fi
+fi
+
+CLANG_CC=
+CLANG_CXX=
+if test "$GCC" = yes; then
+ if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
+ CLANG_CC=1
+ fi
+fi
+
+if test "$GXX" = yes; then
+ if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
+ CLANG_CXX=1
+ fi
+fi
+AC_SUBST(CLANG_CXX)
+])
--- a/js/src/config/autoconf.mk.in
+++ b/js/src/config/autoconf.mk.in
@@ -44,16 +44,18 @@ MOZ_JPROF = @MOZ_JPROF@
MOZ_SHARK = @MOZ_SHARK@
MOZ_VALGRIND = @MOZ_VALGRIND@
MOZ_CALLGRIND = @MOZ_CALLGRIND@
MOZ_VTUNE = @MOZ_VTUNE@
MOZ_ETW = @MOZ_ETW@
JS_HAS_CTYPES = @JS_HAS_CTYPES@
DEHYDRA_PATH = @DEHYDRA_PATH@
+MOZ_USING_CCACHE = @MOZ_USING_CCACHE@
+CLANG_CXX = @CLANG_CXX@
NS_TRACE_MALLOC = @NS_TRACE_MALLOC@
INCREMENTAL_LINKER = @INCREMENTAL_LINKER@
MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
ENABLE_TESTS = @ENABLE_TESTS@
TAR=@TAR@
# The MOZ_UI_LOCALE var is used to build a particular locale. Do *not*
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -557,16 +557,23 @@ endif # NEXT_ROOT
PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
ifdef MACOS_SDK_DIR
PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
endif # MACOS_SDK_DIR
ifdef MACOSX_DEPLOYMENT_TARGET
export MACOSX_DEPLOYMENT_TARGET
PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)"
endif # MACOSX_DEPLOYMENT_TARGET
+
+ifdef MOZ_USING_CCACHE
+ifdef CLANG_CXX
+export CCACHE_CPP2=1
+endif
+endif
+
ifdef MOZ_OPTIMIZE
ifeq (2,$(MOZ_OPTIMIZE))
# Only override project defaults if the config specified explicit settings
PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)"
endif # MOZ_OPTIMIZE=2
endif # MOZ_OPTIMIZE
endif # OS_ARCH=Darwin
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -335,70 +335,17 @@ else
if test -z "$HOST_AR"; then
HOST_AR='$(AR)'
fi
if test -z "$HOST_AR_FLAGS"; then
HOST_AR_FLAGS='$(AR_FLAGS)'
fi
fi
-GNU_AS=
-GNU_LD=
-GNU_CC=
-GNU_CXX=
-CC_VERSION='N/A'
-CXX_VERSION='N/A'
-if test "$GCC" = "yes"; then
- GNU_CC=1
- CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
-fi
-if test "$GXX" = "yes"; then
- GNU_CXX=1
- CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
-fi
-if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
- GNU_AS=1
-fi
-rm -f conftest.out
-if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
- GNU_LD=1
-fi
-if test "$GNU_CC"; then
- if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
- GCC_USE_GNU_LD=1
- fi
-fi
-
-INTEL_CC=
-INTEL_CXX=
-if test "$GCC" = yes; then
- if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
- INTEL_CC=1
- fi
-fi
-
-if test "$GXX" = yes; then
- if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
- INTEL_CXX=1
- fi
-fi
-
-CLANG_CC=
-CLANG_CXX=
-if test "$GCC" = yes; then
- if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
- CLANG_CC=1
- fi
-fi
-
-if test "$GXX" = yes; then
- if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
- CLANG_CXX=1
- fi
-fi
+MOZ_TOOL_VARIABLES
dnl Special win32 checks
dnl ========================================================
# With win8, sdk target=602, WINVER=602
MOZ_ARG_ENABLE_BOOL(metro,
[ --enable-metro Enable Windows Metro build targets],
MOZ_METRO=1,
@@ -3871,42 +3818,17 @@ MOZ_ARG_ENABLE_BOOL(oom-backtrace,
[ --enable-oom-backtrace
Enable output of backtraces on artificial OOMs (-A)],
JS_OOM_DO_BACKTRACES=1,
JS_OOM_DO_BACKTRACES= )
if test -n "$JS_OOM_DO_BACKTRACES"; then
AC_DEFINE(JS_OOM_DO_BACKTRACES)
fi
-dnl ======================================================
-dnl = Enable compiling with ccache
-dnl ======================================================
-MOZ_ARG_WITH_STRING(ccache,
-[ --with-ccache[=path/to/ccache]
- Enable compiling with ccache],
- CCACHE=$withval, CCACHE="no")
-
-if test "$CCACHE" != "no"; then
- if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
- CCACHE=
- else
- if test ! -e "$CCACHE"; then
- AC_MSG_ERROR([$CCACHE not found])
- fi
- fi
- MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
- if test -z "$CCACHE" -o "$CCACHE" = ":"; then
- AC_MSG_ERROR([ccache not found])
- elif test -x "$CCACHE"; then
- CC="$CCACHE $CC"
- CXX="$CCACHE $CXX"
- else
- AC_MSG_ERROR([$CCACHE is not executable])
- fi
-fi
+MOZ_CHECK_CCACHE
dnl ========================================================
dnl = Enable static checking using gcc-dehydra
dnl ========================================================
MOZ_ARG_WITH_STRING(static-checking,
[ --with-static-checking=path/to/gcc_dehydra.so
Enable static checking of code using GCC-dehydra],