author Botond Ballo <>
Mon, 14 Mar 2016 16:36:54 -0700
changeset 289035 28ec277c75ac72f0a27a4440d0ce6dbba551d380
parent 288869 1e381e3428d1b46233bb649d572ceddcc7cc0f91
child 289071 bea1d2b7531368d5b3a5228b430c3caa685a43d1
permissions -rw-r--r--
Bug 1247964 - Allow InputBlockState::SetScrolledApzc to accept new APZC when it is an ancestor of the current APZC r=kats

# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at


# Note:
# - Gecko-specific options and rules should go in toolkit/moz.configure.
# - Firefox-specific options and rules should go in browser/moz.configure.
# - Fennec-specific options and rules should go in
#   mobile/android/moz.configure.
# - Spidermonkey-specific options and rules should go in js/moz.configure.
# - etc.

option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
       help='Download and use prebuilt binary artifacts.')

def artifact_builds(value):
    if value:
        set_config('MOZ_ARTIFACT_BUILDS', '1')
    return bool(value)

       help='Disable compiler/library checks')

def compile_environment(value):
    if value:
        set_config('COMPILE_ENVIRONMENT', '1')
        add_old_configure_assignment('COMPILE_ENVIRONMENT', '1')
    return bool(value)

def build_backends_choices(help):
    from mozbuild.backend import backends
    return tuple(backends)

option('--enable-build-backend', nargs='+', choices=build_backends_choices,
       help='Enable additional build backends')

@depends('--enable-build-backend', '--enable-artifact-builds')
def build_backend(backends, artifact_builds):
    if artifact_builds:
        all_backends = ['FasterMake+RecursiveMake']
        all_backends = ['RecursiveMake', 'FasterMake']
    set_config('BUILD_BACKENDS', unique_list(all_backends))

# Awk detection
# ==============================================================
awk = check_prog('AWK', ('gawk', 'mawk', 'nawk', 'awk'))

# Until the AWK variable is not necessary in old-configure
def awk_for_old_configure(value):
    add_old_configure_assignment('AWK', value)

# Perl detection
# ==============================================================
perl = check_prog('PERL', ('perl5', 'perl'))

# Until the PERL variable is not necessary in old-configure
def perl_for_old_configure(value):
    add_old_configure_assignment('PERL', value)

def perl_version_check(min_version):
    @checking('for minimum required perl version >= %s' % min_version)
    def get_perl_version(perl):
        import subprocess
            return subprocess.check_output([perl, '-e', 'print $]'])
        except subprocess.CalledProcessError as e:
            error('Failed to get perl version: %s' % e.message)

    def check_perl_version(version):
        if version < min_version:
            error('Perl %s or higher is required.' % min_version)

    @checking('for full perl installation')
    def has_full_perl_installation(perl):
        import subprocess
        ret =
            [perl, '-e', 'use Config; exit(!-d $Config{archlib})'])
        return ret == 0

    def require_full_perl_installation(has_full_perl_installation):
        if not has_full_perl_installation:
            error('Cannot find or $Config{archlib}. '
                  'A full perl installation is required.')


# Miscellaneous programs
# ==============================================================
check_prog('DOXYGEN', ('doxygen',), allow_missing=True)
check_prog('TAR', ('gnutar', 'gtar', 'tar'))
check_prog('UNZIP', ('unzip',))
check_prog('XARGS', ('xargs',))
check_prog('ZIP', ('zip',))

def mac_programs(target):
    if target.os == 'Darwin':
        check_prog('DSYMUTIL', ('dsymutil', 'llvm-dsymutil'), allow_missing=True)
        check_prog('GENISOIMAGE', ('genisoimage',), allow_missing=True)

def linux_programs(target):
    if target.os == 'GNU' and target.kernel == 'Linux':
        check_prog('RPMBUILD', ('rpmbuild',), allow_missing=True)

# Fallthrough to autoconf-based configure