Commit edcd74a9 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1259381 - Move --with-ccache and --with-compiler-wrapper to moz.configure. r=chmanchester

parent 78ec73cc
Loading
Loading
Loading
Loading
+1 −51
Original line number Diff line number Diff line
@@ -7,54 +7,7 @@ dnl = Enable compiling with various compiler wrappers (distcc, ccache, etc)
dnl =======================================================================
AC_DEFUN([MOZ_CHECK_COMPILER_WRAPPER],
[
MOZ_ARG_WITH_STRING(compiler_wrapper,
[  --with-compiler-wrapper[=path/to/wrapper]
    Enable compiling with wrappers such as distcc and ccache],
    COMPILER_WRAPPER=$withval, COMPILER_WRAPPER="no")

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
        if test "$COMPILER_WRAPPER" != "no"; then
            COMPILER_WRAPPER="$CCACHE $COMPILER_WRAPPER"
        else
            COMPILER_WRAPPER="$CCACHE"
        fi
        MOZ_USING_CCACHE=1
    else
        AC_MSG_ERROR([$CCACHE is not executable])
    fi
fi

AC_SUBST(MOZ_USING_CCACHE)

if test "$COMPILER_WRAPPER" != "no"; then
    case "$target" in
    *-mingw*)
        dnl When giving a windows path with backslashes, js/src/configure
        dnl fails because of double wrapping because the test further below
        dnl doesn't work with backslashes. While fixing that test to work
        dnl might seem better, a lot of the make build backend actually
        dnl doesn't like backslashes, so normalize windows paths to use
        dnl forward slashes.
        COMPILER_WRAPPER=`echo "$COMPILER_WRAPPER" | tr '\\' '/'`
        ;;
    esac

if test -n "$COMPILER_WRAPPER"; then
    case "$CC" in
    $COMPILER_WRAPPER\ *)
        :
@@ -68,8 +21,5 @@ if test "$COMPILER_WRAPPER" != "no"; then
        ac_cv_prog_CXX="$CXX"
        ;;
    esac
    MOZ_USING_COMPILER_WRAPPER=1
fi

AC_SUBST(MOZ_USING_COMPILER_WRAPPER)
])
+4 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ def add_old_configure_assignment(var, value_func):
            assignments.append('%s=' % var)
        else:
            from mozbuild.shellutil import quote
            if isinstance(value, (list, tuple)):
                value = ' '.join(quote(v) for v in value)
            assignments.append('%s=%s' % (var, quote(value)))

@template
@@ -273,6 +275,8 @@ def wanted_mozconfig_variables(help):
     return set([
         'AUTOCONF',
         'AWK',
         'CCACHE',
         'COMPILER_WRAPPER',
         'DISABLE_EXPORT_JS',
         'DISABLE_SHARED_JS',
         'DOXYGEN',
+0 −2
Original line number Diff line number Diff line
@@ -314,8 +314,6 @@ def old_configure_options(*options):
    '--with-arm-kuser',
    '--with-bing-api-keyfile',
    '--with-branding',
    '--with-ccache',
    '--with-compiler-wrapper',
    '--with-crashreporter-enable-percent',
    '--with-cross-lib',
    '--with-debug-label',
+45 −0
Original line number Diff line number Diff line
@@ -58,3 +58,48 @@ def have_yasm(value):
set_config('HAVE_YASM', have_yasm)
# Until the YASM variable is not necessary in old-configure.
add_old_configure_assignment('YASM', have_yasm)


# Compiler wrappers
# ==============================================================
js_option('--with-compiler-wrapper', env='COMPILER_WRAPPER', nargs=1,
          help='Enable compiling with wrappers such as distcc and ccache')

js_option('--with-ccache', env='CCACHE', nargs='?',
          help='Enable compiling with ccache')

@depends_if('--with-ccache')
def ccache(value):
    if len(value):
        return value
    # If --with-ccache was given without an explicit value, we default to
    # 'ccache'.
    return 'ccache'

ccache = check_prog('CCACHE', progs=(), input=ccache)

@depends_if(ccache)
def using_ccache(ccache):
    return True

set_config('MOZ_USING_CCACHE', using_ccache)

@depends('--with-compiler-wrapper', ccache)
@advanced
def compiler_wrapper(wrapper, ccache):
    from mozbuild.shellutil import split as shell_split
    if ccache:
        if wrapper:
            return tuple([ccache] + shell_split(wrapper[0]))
        else:
            return (ccache,)
    elif wrapper:
        return tuple(shell_split(wrapper[0]))

add_old_configure_assignment('COMPILER_WRAPPER', compiler_wrapper)

@depends_if(compiler_wrapper)
def using_compiler_wrapper(compiler_wrapper):
    return True

set_config('MOZ_USING_COMPILER_WRAPPER', using_compiler_wrapper)