Bug 755145 - Define CCACHE_CPP2 when using ccache and Clang. r=glandium.

This commit is contained in:
Rafael Ávila de Espíndola 2012-07-19 09:20:46 -04:00
parent 6f83bbeaa8
commit 5964da33d6
12 changed files with 222 additions and 160 deletions

2
aclocal.m4 vendored
View File

@ -3,6 +3,8 @@ 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

36
build/autoconf/ccache.m4 Normal file
View File

@ -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)
])

View File

@ -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)
])

View File

@ -84,6 +84,8 @@ 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@

View File

@ -562,6 +562,13 @@ 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

View File

@ -363,60 +363,7 @@ else
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
@ -7167,32 +7114,7 @@ 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

2
js/src/aclocal.m4 vendored
View File

@ -3,6 +3,8 @@ 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

View File

@ -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)
])

View File

@ -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)
])

View File

@ -49,6 +49,8 @@ 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@

View File

@ -562,6 +562,13 @@ 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

View File

@ -340,60 +340,7 @@ else
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 ========================================================
@ -3876,32 +3823,7 @@ 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