diff --git a/configure.ac b/configure.ac index 9c8f236bb22..97cea4de9c4 100644 --- a/configure.ac +++ b/configure.ac @@ -86,7 +86,8 @@ AC_PATH_TOOL(STRIP, strip) dnl Python 3.5 is specified in .python-version and should be used if available, see doc/dependencies.md AC_PATH_PROGS([PYTHON], [python3.5 python3.6 python3.7 python3.8 python3 python]) AC_PATH_PROG([GIT], [git]) -AC_PATH_PROG(CCACHE,ccache) +AC_PATH_PROG(CCACHE, ccache) +AC_PATH_PROG(SCCACHE, sccache) AC_PATH_PROG(HEXDUMP, hexdump) AC_PATH_TOOL(READELF, readelf) AC_PATH_TOOL(CPPFILT, c++filt) @@ -162,6 +163,12 @@ AC_ARG_ENABLE([reduce-exports], [use_reduce_exports=$enableval], [use_reduce_exports=no]) +AC_ARG_ENABLE([sccache], + [AS_HELP_STRING([--disable-sccache], + [do not use sccache for building (default is to use if found)])], + [use_sccache=$enableval], + [use_sccache=auto]) + AC_ARG_ENABLE([ccache], [AS_HELP_STRING([--disable-ccache], [do not use ccache for building (default is to use if found)])], @@ -1214,7 +1221,23 @@ AC_MSG_RESULT($build_defi_wallet) AC_LANG_POP -if test "x$use_ccache" != "xno"; then +if test "x$use_sccache" != "xno"; then + AC_MSG_CHECKING(if sccache should be used) + if test x$SCCACHE = x; then + if test "x$use_sccache" = "xyes"; then + AC_MSG_ERROR([ccache not found.]); + else + use_sccache=no + fi + else + use_sccache=yes + CC="$ac_cv_path_SCCACHE $CC" + CXX="$ac_cv_path_SCCACHE $CXX" + fi + AC_MSG_RESULT($use_sccache) +fi + +if test "x$use_ccache" != "xno" && test "x$use_sccache" == "xno"; then AC_MSG_CHECKING(if ccache should be used) if test x$CCACHE = x; then if test "x$use_ccache" = "xyes"; then @@ -1229,7 +1252,7 @@ if test "x$use_ccache" != "xno"; then fi AC_MSG_RESULT($use_ccache) fi -if test "x$use_ccache" = "xyes"; then +if test "x$use_sccache" = "xyes" || test "x$use_ccache" = "xyes"; then AX_CHECK_PREPROC_FLAG([-Qunused-arguments],[CPPFLAGS="-Qunused-arguments $CPPFLAGS"]) fi