releases-comm-central/configure.in

278 строки
9.0 KiB
Plaintext

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
if isinstance(value, set):
return name, value
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'))
__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs']
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 mozbuild.config_status 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
export MOZ_PSEUDO_DERECURSE=
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