DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (4b8605e6a17d)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
dnl vi: set tabstop=4 shiftwidth=4 expandtab:
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 Process this file with autoconf to produce a configure script.
dnl ========================================================

AC_PREREQ(2.13)
AC_INIT(config/config.mk)
MOZILLA_SRCDIR=$topsrcdir/mozilla
AC_CONFIG_AUX_DIR(${MOZILLA_SRCDIR}/build/autoconf)
AC_CANONICAL_SYSTEM

dnl comm-central-specific options
dnl (MOZILLA_SRCDIR would fit here, but is needed to find autoconf tools)
COMM_BUILD=1

dnl export this, so the var is set for mozilla/configure
MOZCONFIG=`$_AUTOCONF_TOOLS_DIR/mozconfig-find $topsrcdir`
export MOZCONFIG

dnl Do not allow a separate objdir build if a srcdir build exists.
dnl ==============================================================
_topsrcdir=`cd \`dirname $0\`; pwd`
_objdir=`pwd`

if test "$_topsrcdir" != "$_objdir"
then
  # Check for a couple representative files in the source tree
  _conflict_files=
  for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
    if test -f $file; then
      _conflict_files="$_conflict_files $file"
    fi
  done
  if test "$_conflict_files"; then
    echo "***"
    echo "*   Your source tree contains these files:"
    for file in $_conflict_files; do
      echo "*         $file"
    done
    cat 1>&2 <<-EOF
	*   This indicates that you previously built in the source tree.
	*   A source tree build can confuse the separate objdir build.
	*
	*   To clean up the source tree:
	*     1. cd $_topsrcdir
	*     2. gmake distclean
	***
	EOF
    exit 1
    break
  fi
fi

MOZ_BUILD_ROOT=`pwd`/mozilla
MOZILLA_CENTRAL_PATH=$_topsrcdir/mozilla
MOZ_PYTHON

MOZ_BUILD_ROOT=`pwd`

MOZ_ARG_WITH_STRING(l10n-base,
[  --with-l10n-base=DIR     path to l10n repositories],
    L10NBASEDIR=$withval)
if test -n "$L10NBASEDIR"; then
    if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
        AC_MSG_ERROR([--with-l10n-base must specify a path])
    elif test -d "$L10NBASEDIR"; then
        dnl Ensure to use an absolute path.
        L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
    else
        AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
    fi
fi

MOZ_ARG_WITH_STRING(unify-dist,
[  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
    UNIFY_DIST=$withval)
if test -n "$UNIVERSAL_BINARY"; then
    if test -z "$UNIFY_DIST"; then
        AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
    fi
    case "$UNIFY_DIST" in
    /*)
        ;;
    *)
        UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
        ;;
    esac
fi

dnl ========================================================
dnl =
dnl = Application
dnl =
dnl ========================================================

MOZ_ARG_HEADER(Application)

MOZ_BRANDING_DIRECTORY=

MOZ_ARG_ENABLE_STRING(application,
[  --enable-application=APP
                          Options include:
                            suite (SeaMonkey)
                            mail (Thunderbird)],
[ MOZ_BUILD_APP=$enableval ] )

AC_MSG_CHECKING([for application to build])
if test -z "$MOZ_BUILD_APP"; then
  AC_MSG_RESULT([mail])
  echo "Building Thunderbird by default. Set --enable-application to build a different application."
  MOZ_BUILD_APP=mail
else
  # We have a valid application only if it has a build.mk file in its top
  # directory.
  if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
    AC_MSG_RESULT([none])
    AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
  else
    AC_MSG_RESULT([$MOZ_BUILD_APP])
  fi
fi

# Allow the application to influence configure with a confvars.sh script. We
# still need this for MOZ_BRANDING_DIRECTORY.

AC_MSG_CHECKING([if app-specific confvars.sh exists])
if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
  AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
  . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
else
  AC_MSG_RESULT([no])
fi

dnl ========================================================
dnl = Trademarked Branding 
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(official-branding,
[  --enable-official-branding Enable Official mozilla.org Branding
                          Do not distribute builds with
                          --enable-official-branding unless you have
                          permission to use trademarks per
                          http://www.mozilla.org/foundation/trademarks/ .],
[
  if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
    AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
  else
    MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
  fi
])

MOZ_ARG_WITH_STRING(branding,
[  --with-branding=dir    Use branding from the specified directory.],
    MOZ_BRANDING_DIRECTORY=$withval)

REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
if test -z "$REAL_BRANDING_DIRECTORY"; then
  REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
fi

if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
  . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
fi

case "$host_os" in
mingw*)
    WIN_TOP_SRC=`cd $srcdir; pwd -W`
    ;;
esac

# These lines do no useful work, but if we don't have them, then the output
# configure script is really messed up.
touch confdefs.pytmp
AC_OUTPUT([])

# Build the config.status for comm-central
changequote(<<<,>>>)dnl
: ${CONFIG_STATUS=./config.status}

echo creating $CONFIG_STATUS
cat > $CONFIG_STATUS <<EOF
#!${PYTHON}

import os
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
if not os.path.isabs(topsrcdir):
    rel = os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir)
    topsrcdir = os.path.normpath(os.path.abspath(rel))

topobjdir = os.path.dirname(<<<__file__>>>)

from mozbuild.backend.configenvironment import BuildConfig
mozfile = os.path.join(topobjdir, 'mozilla', 'config.status')
mozbuildcfg = BuildConfig.from_config_status(mozfile)

dnl No need to tweak these from mozilla-central
defines = mozbuildcfg.defines
non_global_defines = mozbuildcfg.non_global_defines

dnl Fix up substitutitons
def remap_subst(pair):
    name, value = pair
    value = value.replace('\$(DEPTH)', '\$(DEPTH)/mozilla')
    value = value.replace('\$(topsrcdir)', '\$(topsrcdir)/mozilla')
    if name == 'ac_configure_args':
        value = r''' $ac_configure_args '''[1:-1]
    elif name in ['MOZ_BRANDING_DIRECTORY', 'MOZ_BUILD_APP']:
        value = value[3:] # Strip off ../ from the beginning
    elif name in ['top_srcdir', 'MOZ_BUILD_ROOT', 'WIN_TOP_SRC']:
        value = value[:-8] # Strip off /mozilla from the end
    return name, value

substs = map(remap_subst, mozbuildcfg.substs)
substs.append(('COMM_BUILD', '1'))

dnl These are what we output
files = ['config/autoconf.mk']
headers = []

__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs', 'files', 'headers']

dnl Do the actual work
if __name__ == '__main__':
    args = dict([(name, globals()[name]) for name in __all__])
    import sys
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
    sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
    from ConfigStatus import config_status
    config_status(**args)
EOF
changequote([,])dnl

# Make the config.status file executable
chmod +x $CONFIG_STATUS

_SUBDIR_CONFIG_ARGS="$ac_configure_args"
if test -n "$UNIFY_DIST"; then
    # Make --with-unify-dist point to the right path
    _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --with-unify-dist=$UNIFY_DIST"
fi

# build Mozilla first
#
# the subdir may not yet have been created in the build tree.
#
if test ! -d "mozilla"; then
    mkdir "mozilla"
fi

external_topsrcdir=$_topsrcdir

if test "$msyshost"; then
    external_topsrcdir=`cd $_topsrcdir && pwd -W $_topsrcdir`
fi

# --enable-application needs to find confvars.sh, build.mk, etc in the gived dir, so add ../
# --external-source-dir is so the build system doesn't reject files outside known locations.
# --disable-official-branding disables all checks for official branding, as we're doing this ourselves in our own repo
ac_configure_args="$_SUBDIR_CONFIG_ARGS --enable-application=../$MOZ_BUILD_APP --with-external-source-dir=$external_topsrcdir --disable-official-branding --with-branding=../$REAL_BRANDING_DIRECTORY"
if test -n "$L10NBASEDIR"; then
    dnl Override the initial value with the new one which is guaranteed to be an absolute path.
    ac_configure_args="$ac_configure_args --with-l10n-base=$L10NBASEDIR"
fi

# for Mac universal builds, we need to call the Mozilla configure with MOZ_BUILD_APP=[i386|x86_64]
MOZ_BUILD_APP_CACHED="$MOZ_BUILD_APP"
if test -n "$MOZ_CURRENT_PROJECT"; then
    export MOZ_BUILD_APP="$MOZ_CURRENT_PROJECT"
fi

AC_OUTPUT_SUBDIRS(mozilla)
MOZ_BUILD_APP="$MOZ_BUILD_APP_CACHED"

# Build the comm-central files with config.status
test "$no_create" = yes || ${PYTHON} $CONFIG_STATUS || exit 1