ecf8827
# Use ccache by default.  Users who don't want that can set the CCACHE_DISABLE
ecf8827
# environment variable in their personal profile.
ecf8827
fc4c39b
case ":${PATH:-}:" in
ab56ad3
    *:@LIBDIR@/ccache:*) ;;
fc4c39b
    *) PATH="@LIBDIR@/ccache${PATH:+:$PATH}" ;;
ab56ad3
esac
ecf8827
7ad63b9
# If @CACHEDIR@ is writable, use a shared cache there, except for root.
7ad63b9
# Users who don't want that even if they have the write permission can set
7ad63b9
# the CCACHE_DIR environment variable to another location and possibly unset
7ad63b9
# the CCACHE_UMASK environment variables in their personal profile.
ecf8827
7ad63b9
if [ -n "${CCACHE_DIR:-}" ] ; then
7ad63b9
    if [ ! -w "$CCACHE_DIR" ] ; then
7ad63b9
        # Reset broken settings maybe inherited when switching users (#651023).
7ad63b9
        unset CCACHE_DIR
7ad63b9
        unset CCACHE_UMASK
7ad63b9
    fi
7ad63b9
elif [ "${EUID:-}" != 0 ] ; then
7ad63b9
    if [ -w @CACHEDIR@ ] && [ -d @CACHEDIR@ ] ; then
7ad63b9
        # Set up the shared cache.
7ad63b9
        export CCACHE_DIR=@CACHEDIR@
7ad63b9
        export CCACHE_UMASK=002
7ad63b9
        unset CCACHE_HARDLINK
7ad63b9
    fi
ecf8827
fi