[mq]: subconfigure
authorJoshua Cranmer <Pidgeot18@gmail.com>
Tue, 02 Oct 2012 00:22:32 -0500
changeset 14367 79553ee62db0f43a35dffbdd2a3b83d81ab5ea92
parent 14308 a5a09c169ceec5a13d466cfdcf25403105c05e48
child 14368 7065680ca532ac012a0ed118e37d53b0b9d6e79a
push id288
push userPidgeot18@gmail.com
push dateTue, 02 Oct 2012 15:18:28 +0000
treeherdertry-comm-central@7065680ca532 [default view] [failures only]
[mq]: subconfigure
aclocal.m4
build/autoconf/config.status.m4
build/autoconf/subconfigure.m4
configure.in
mail/configure.in
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,16 +1,16 @@
 dnl
 dnl Local autoconf macros used with mozilla
 dnl The contents of this file are under the Public Domain.
 dnl
 
 builtin(include, mozilla/build/autoconf/toolchain.m4)dnl
 builtin(include, mozilla/build/autoconf/ccache.m4)dnl
-builtin(include, mozilla/build/autoconf/config.status.m4)dnl
+builtin(include, build/autoconf/config.status.m4)dnl
 builtin(include, mozilla/build/autoconf/nspr.m4)dnl
 builtin(include, mozilla/build/autoconf/nss.m4)dnl
 builtin(include, mozilla/build/autoconf/pkg.m4)dnl
 builtin(include, mozilla/build/autoconf/codeset.m4)dnl
 builtin(include, mozilla/build/autoconf/altoptions.m4)dnl
 builtin(include, mozilla/build/autoconf/mozprog.m4)dnl
 builtin(include, mozilla/build/autoconf/acwinpaths.m4)dnl
 builtin(include, mozilla/build/autoconf/lto.m4)dnl
new file mode 100644
--- /dev/null
+++ b/build/autoconf/config.status.m4
@@ -0,0 +1,180 @@
+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 For use in AC_SUBST replacement
+define([MOZ_DIVERSION_SUBST], 11)
+
+dnl Replace AC_SUBST to store values in a format suitable for python.
+dnl The necessary comma after the tuple can't be put here because it
+dnl can mess around with things like:
+dnl    AC_SOMETHING(foo,AC_SUBST(),bar)
+define([AC_SUBST],
+[ifdef([AC_SUBST_$1], ,
+[define([AC_SUBST_$1], )dnl
+AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
+    (''' $1 ''', r''' [$]$1 ''')
+AC_DIVERT_POP()dnl
+])])
+
+dnl Wrap AC_DEFINE to store values in a format suitable for python.
+dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
+dnl which is #included during some compile checks.
+dnl The necessary comma after the tuple can't be put here because it
+dnl can mess around with things like:
+dnl    AC_SOMETHING(foo,AC_DEFINE(),bar)
+define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
+define([AC_DEFINE],
+[cat >> confdefs.pytmp <<\EOF
+    (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
+EOF
+ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
+])
+
+dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
+dnl python.
+define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
+define([AC_DEFINE_UNQUOTED],
+[cat >> confdefs.pytmp <<EOF
+    (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
+EOF
+ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
+])
+
+dnl Replace AC_OUTPUT to create and call a python config.status
+define([AC_OUTPUT],
+[dnl Top source directory in Windows format (as opposed to msys format).
+WIN_TOP_SRC=
+encoding=utf-8
+case "$host_os" in
+mingw*)
+    WIN_TOP_SRC=`cd $srcdir; pwd -W`
+    encoding=mbcs
+    ;;
+esac
+AC_SUBST(WIN_TOP_SRC)
+
+dnl Used in all Makefile.in files
+top_srcdir=$srcdir
+AC_SUBST(top_srcdir)
+
+dnl Picked from autoconf 2.13
+trap '' 1 2 15
+AC_CACHE_SAVE
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+: ${CONFIG_STATUS=./config.status}
+
+dnl We're going to need [ ] for python syntax.
+changequote(<<<, >>>)dnl
+echo creating $CONFIG_STATUS
+
+extra_python_path=${COMM_BUILD:+"'mozilla', "}
+
+cat > $CONFIG_STATUS <<EOF
+#!${PYTHON}
+# coding=$encoding
+
+import os
+dnl topsrcdir is the top source directory in native form, as opposed to a
+dnl form suitable for make.
+topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
+if not os.path.isabs(topsrcdir):
+    topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
+
+topobjdir = os.path.dirname(<<<__file__>>>)
+
+dnl All defines and substs are stored with an additional space at the beginning
+dnl and at the end of the string, to avoid any problem with values starting or
+dnl ending with quotes.
+defines = [(name[1:-1], value[1:-1]) for name, value in [
+EOF
+
+dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
+dnl lacks the final comma (see above).
+sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
+rm confdefs.pytmp confdefs.h
+
+cat >> $CONFIG_STATUS <<\EOF
+] ]
+
+substs = [(name[1:-1], value[1:-1]) for name, value in [
+EOF
+
+dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
+dnl expected format, but lacks the final comma (see above).
+sed 's/$/,/' >> $CONFIG_STATUS <<EOF
+undivert(MOZ_DIVERSION_SUBST)dnl
+EOF
+
+dnl Add in the output from the subconfigure script
+for ac_subst_arg in $_subconfigure_ac_subst_args; do
+  variable='$'$ac_subst_arg
+  echo "    (''' $ac_subst_arg ''', r''' `eval echo $variable` ''')," >> $CONFIG_STATUS
+done
+
+cat >> $CONFIG_STATUS <<\EOF
+] ]
+
+dnl List of files to apply AC_SUBSTs to. This is the list of files given
+dnl as an argument to AC_OUTPUT ($1)
+files = [
+EOF
+
+for out in $1; do
+  echo "    '$out'," >> $CONFIG_STATUS
+done
+
+cat >> $CONFIG_STATUS <<\EOF
+]
+
+dnl List of header files to apply AC_DEFINEs to. This is stored in the
+dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
+headers = [
+EOF
+
+ifdef(<<<AC_LIST_HEADER>>>, <<<
+HEADERS="AC_LIST_HEADER"
+for header in $HEADERS; do
+  echo "    '$header'," >> $CONFIG_STATUS
+done
+>>>)dnl
+
+cat >> $CONFIG_STATUS <<\EOF
+]
+
+dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
+non_global_defines = [
+EOF
+
+if test -n "$_NON_GLOBAL_ACDEFINES"; then
+  for var in $_NON_GLOBAL_ACDEFINES; do
+    echo "    '$var'," >> $CONFIG_STATUS
+  done
+fi
+
+cat >> $CONFIG_STATUS <<EOF
+]
+
+__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([, ])
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+dnl Execute config.status, unless --no-create was passed to configure.
+test "$no_create" = yes || ${PYTHON} $CONFIG_STATUS || exit 1
+])
new file mode 100644
--- /dev/null
+++ b/build/autoconf/subconfigure.m4
@@ -0,0 +1,144 @@
+dnl We are not running in a real autoconf environment. So we're using real m4
+dnl here, not the crazier environment that autoconf provides.
+
+dnl Autoconf expects [] for quotes; give it to them
+changequote([, ])
+
+dnl AC_DEFUN is provided to use instead of define in autoconf. Provide it to.
+define([AC_DEFUN], [define($1, [$2])])
+
+dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, IF-TRUE[, IF-FALSE])
+dnl We have to ignore the help string due to how help works in autoconf...
+AC_DEFUN([AC_ARG_ENABLE],
+[#] Check whether --enable-[$1] or --disable-[$1] was given.
+[if test "[${enable_]patsubst([$1], -, _)+set}" = set; then
+  enableval="[$enable_]patsubst([$1], -, _)"
+  $3
+ifelse([$4], , , [else
+  $4
+])dnl
+fi
+])
+
+dnl AC_MSG_ERROR(error-description)
+AC_DEFUN([AC_MSG_ERROR], [{ echo "configure: error: $1" 1>&2; exit 1; }])
+
+AC_DEFUN([AC_MSG_WARN],  [ echo "configure: warning: $1" 1>&2 ])
+
+dnl Add the variable to the list of substitution variables
+AC_DEFUN([AC_SUBST], [add_sub_subst "$1"])
+
+dnl Override for AC_DEFINE. This turns out to be the simple one. :-)
+AC_DEFUN([AC_DEFINE],
+[
+cat >>confdefs.h <<\EOF
+[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) 
+EOF
+cat >> confdefs.pytmp <<\EOF
+    (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
+EOF
+])
+
+dnl AC_OUTPUT_SUBDIRS(subdirectory)
+define([AC_OUTPUT_SUBDIRS],
+[
+if test "$no_recursion" != yes; then
+
+  # Remove --cache-file and --srcdir arguments so they do not pile up.
+  ac_sub_configure_args=
+  ac_prev=
+  for ac_arg in $ac_configure_args; do
+    if test -n "$ac_prev"; then
+      ac_prev=
+      continue
+    fi
+    case "$ac_arg" in
+    -cache-file | --cache-file | --cache-fil | --cache-fi \
+    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+      ac_prev=cache_file ;;
+    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+      ;;
+    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+      ac_prev=srcdir ;;
+    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+      ;;
+    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+    esac
+  done
+
+  for ac_config_dir in $1; do
+
+    # Do not complain, so a configure script can configure whichever
+    # parts of a large source tree are present.
+    if test ! -d $srcdir/$ac_config_dir; then
+      continue
+    fi
+
+    echo configuring in $ac_config_dir
+
+    case "$srcdir" in
+    .) ;;
+    *)
+      if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
+      else
+        AC_MSG_ERROR(can not create `pwd`/$ac_config_dir)
+      fi
+      ;;
+    esac
+
+    ac_popdir=`pwd`
+    cd $ac_config_dir
+
+changequote(, )dnl
+      # A "../" for each directory in /$ac_config_dir.
+      ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+changequote([, ])dnl
+
+    case "$srcdir" in
+    .) # No --srcdir option.  We are building in place.
+      ac_sub_srcdir=$srcdir ;;
+    /* | ?:/*) # Absolute path.
+      ac_sub_srcdir=$srcdir/$ac_config_dir ;;
+    *) # Relative path.
+      ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
+    esac
+
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_sub_srcdir/configure; then
+      ac_sub_configure=$ac_sub_srcdir/configure
+    elif test -f $ac_sub_srcdir/configure.in; then
+      ac_sub_configure=$ac_configure
+    else
+      echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
+      ac_sub_configure=
+    fi
+
+    # The recursion is here.
+    if test -n "$ac_sub_configure"; then
+
+      # Make the cache file name correct relative to the subdirectory.
+      case "$cache_file" in
+      /* | ?:/*) ac_sub_cache_file=$cache_file ;;
+      *) # Relative path.
+        ac_sub_cache_file="$ac_dots$cache_file" ;;
+      esac
+      case "$ac_given_INSTALL" in
+changequote(, )dnl
+      [/$]*) INSTALL="$ac_given_INSTALL" ;;
+changequote([, ])dnl
+      *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+      esac
+
+      echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
+      # The eval makes quoting arguments work.
+      if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+      then :
+      else
+        AC_MSG_ERROR($ac_sub_configure failed for $ac_config_dir)
+      fi
+    fi
+
+    cd "$ac_popdir"
+  done
+fi])
--- a/configure.in
+++ b/configure.in
@@ -4087,20 +4087,18 @@ dnl = Application
 dnl =
 dnl ========================================================
 
 MOZ_ARG_HEADER(Application)
 
 ENABLE_TESTS=1
 MOZ_BRANDING_DIRECTORY=
 MOZ_OFFICIAL_BRANDING=
-MOZ_CALENDAR=
 MOZ_FEEDS=1
 MOZ_JSDEBUGGER=1
-MOZ_LDAP_XPCOM=
 MOZ_MORK=
 MOZ_MORKREADER=1
 MOZ_AUTH_EXTENSION=1
 MOZ_NO_FAST_LOAD=
 MOZ_OGG=1
 MOZ_SYDNEYAUDIO=
 MOZ_WAVE=1
 MOZ_PANGO=1
@@ -4183,16 +4181,27 @@ fi
 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
 
+if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
+add_sub_subst() {
+  _subconfigure_ac_subst_args="$_subconfigure_ac_subst_args $1"
+}
+tmpscript=/tmp/a.sh
+m4 "${srcdir}/build/autoconf/subconfigure.m4" \
+   "${srcdir}/mozilla/build/autoconf/altoptions.m4" \
+   "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
+. $tmpscript
+fi
+
 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
 # that haven't made a confvars.sh yet. Don't add new stuff here, use
 # MOZ_BUILD_APP.
 case "$MOZ_BUILD_APP" in
 suite)
   AC_DEFINE(MOZ_SUITE)
   ;;
 
@@ -4418,33 +4427,16 @@ dnl ====================================
 dnl = Localization
 dnl ========================================================
 MOZ_ARG_ENABLE_STRING(ui-locale,
 [  --enable-ui-locale=ab-CD
                           Select the user interface locale (default: en-US)],
     MOZ_UI_LOCALE=$enableval )
 AC_SUBST(MOZ_UI_LOCALE)
 
-dnl =========================================================
-dnl = Calendar client
-dnl =========================================================
-MOZ_ARG_ENABLE_BOOL(calendar,
-[  --enable-calendar      Enable building of the Lightning calendar extension],
-    MOZ_CALENDAR=1,
-    MOZ_CALENDAR= )
-AC_SUBST(MOZ_CALENDAR)
-
-dnl =========================================================
-dnl = LDAP
-dnl =========================================================
-MOZ_ARG_DISABLE_BOOL(ldap,
-[  --disable-ldap          Disable LDAP support],
-    MOZ_LDAP_XPCOM=,
-    MOZ_LDAP_XPCOM=1)
-
 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
@@ -6126,24 +6118,16 @@ if test -n "$ENABLE_SHARED_JS"; then
 else
   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
   AC_DEFINE(MOZ_STATIC_JS)
 fi
 AC_SUBST(JS_SHARED_LIBRARY)
 
 XPCOM_LIBS="$LIBXUL_LIBS"
 
-MOZ_ARG_ENABLE_BOOL(incomplete-external-linkage,
-[  --enable-incomplete-external-linkage Changes some comm-central code to be built with external linkage. Developer only option, incomplete broken builds will result - There are already existing bugs for this. ],
-    MOZ_INCOMPLETE_EXTERNAL_LINKAGE=1,
-    MOZ_INCOMPLETE_EXTERNAL_LINKAGE= )
-
-export MOZ_INCOMPLETE_EXTERNAL_LINKAGE
-AC_SUBST(MOZ_INCOMPLETE_EXTERNAL_LINKAGE)
-
 dnl ========================================================
 dnl =
 dnl = Standalone module options
 dnl = 
 dnl ========================================================
 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
 
 dnl Check for GLib.
@@ -6290,32 +6274,16 @@ MOZ_ARG_DISABLE_BOOL(ctypes,
 [  --disable-ctypes        Disable js-ctypes],
     BUILD_CTYPES=,
     BUILD_CTYPES=1)
 AC_SUBST(BUILD_CTYPES)
 if test "$BUILD_CTYPES"; then
     AC_DEFINE(BUILD_CTYPES)
 fi
 
-dnl Only build Mork if it's required
-AC_SUBST(MOZ_MORK)
-if test "$MOZ_MORK"; then
-  AC_DEFINE(MOZ_MORK)
-  MORK_COMPONENT=mork
-  export MORK_COMPONENT
-  MORK_MODULE="MODULE(nsMorkModule)"
-  export MORK_MODULE
-fi
-
-dnl Build the lightweight Mork reader if required
-AC_SUBST(MOZ_MORKREADER)
-if test "$MOZ_MORKREADER"; then
-  AC_DEFINE(MOZ_MORKREADER)
-fi
-
 AC_SUBST(MOZ_PLACES)
 if test "$MOZ_PLACES"; then
   AC_DEFINE(MOZ_PLACES)
 fi
 
 dnl Build Apps in the Cloud (AITC) if required
 AC_SUBST(MOZ_SERVICES_AITC)
 if test -n "$MOZ_SERVICES_AITC"; then
@@ -6334,47 +6302,16 @@ if test -n "$MOZ_SERVICES_SYNC"; then
   AC_DEFINE(MOZ_SERVICES_SYNC)
 fi
 
 dnl ========================================================
 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
 fi
 
-if test "$MOZ_LDAP_XPCOM"; then
-    MOZ_ARG_ENABLE_BOOL(incomplete-toolkit-ldap-autocomplete,
-    [  --enable-incomplete-toolkit-ldap-autocomplete Builds a JavaScript component that implements an LDAP autocomplete component using the toolkit interfaces rather than the C++ component using the obsolete XPFE interfaces. ],
-        MOZ_INCOMPLETE_TOOLKIT_LDAP_AUTOCOMPLETE=1,
-        MOZ_INCOMPLETE_TOOLKIT_LDAP_AUTOCOMPLETE= )
-
-    LDAP_CFLAGS='-I${DIST}/public/ldap'
-    if test "$OS_ARCH" = "WINNT"; then
-        if test -n "$GNU_CC"; then
-            LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
-        else
-            LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)nsldap32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldappr32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldif32v60.${IMPORT_LIB_SUFFIX}'
-        fi
-    elif test "$OS_ARCH" = "OS2"; then
-            LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)ldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)prldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)ldif60.${IMPORT_LIB_SUFFIX}'
-    else
-        LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
-    fi
-
-    dnl export LDAP_LIBS so that confvars.sh can pick it up, so when we get to
-    dnl linking libxul in the mozilla-central build system, we'll have the LDAP
-    dnl LIBS
-    export LDAP_LIBS
-    LDAP_COMPONENT=mozldap
-    export LDAP_COMPONENT
-    LDAP_MODULE="MODULE(nsLDAPProtocolModule)"
-    export LDAP_MODULE
-fi
-AC_SUBST(MOZ_INCOMPLETE_TOOLKIT_LDAP_AUTOCOMPLETE)
-
-
 dnl ========================================================
 dnl =
 dnl = Maintainer debug option (no --enable equivalent)
 dnl =
 dnl ========================================================
 
 AC_SUBST(AR)
 AC_SUBST(AR_FLAGS)
@@ -6411,19 +6348,16 @@ AC_SUBST(MOZ_DEBUG_LDFLAGS)
 AC_SUBST(WARNINGS_AS_ERRORS)
 AC_SUBST(MOZ_JSDEBUGGER)
 AC_SUBST(MOZ_PLUGINS)
 AC_SUBST(MOZ_LOG_REFCNT)
 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
 AC_SUBST(MOZ_JPROF)
 AC_SUBST(MOZ_SHARK)
 AC_SUBST(MOZ_PROFILING)
-AC_SUBST(MOZ_LDAP_XPCOM)
-AC_SUBST(LDAP_CFLAGS)
-AC_SUBST(LDAP_LIBS)
 AC_SUBST(LIBICONV)
 AC_SUBST(MOZ_PLACES_BOOKMARKS)
 AC_SUBST(MOZ_STORAGE)
 AC_SUBST(MOZ_FEEDS)
 AC_SUBST(NS_PRINTING)
 AC_SUBST(MOZ_HELP_VIEWER)
 
 AC_SUBST(MOZ_PROFILELOCKING)
@@ -6820,38 +6754,8 @@ fi
 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)
 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 MOZ_BUILD_APP="$MOZ_BUILD_APP_CACHED"
-
-# if we're building the LDAP XPCOM component, we need to build 
-# the c-sdk first.  
-if test -n "$COMPILE_ENVIRONMENT" -a -n "$MOZ_LDAP_XPCOM"; then
-    # these subdirs may not yet have been created in the build tree.
-    # don't use the "-p" switch to mkdir, since not all platforms have it
-    if test ! -d "ldap/sdks/c-sdk/ldap"; then
-        if test ! -d "ldap/sdks/c-sdk"; then
-            if test ! -d "ldap/sdks"; then
-                if test ! -d "ldap"; then
-                    mkdir "ldap"
-                fi
-                mkdir "ldap/sdks"
-            fi
-            mkdir "ldap/sdks/c-sdk"
-        fi
-        mkdir "ldap/sdks/c-sdk/ldap"
-    fi
-
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/mozilla/dist --with-dist-prefix=$MOZ_BUILD_ROOT/mozilla/dist --without-nss --with-mozilla"
-    if test -n "$HAVE_64BIT_OS"; then
-        dnl A 64-bit OS was (auto-)detected: (explicitly) enable 64-bit support.
-        ac_configure_args="$ac_configure_args --enable-64bit"
-    fi
-    if test -n "$LIBXUL_SDK"; then
-        ac_configure_args="$ac_configure_args --with-nspr=$LIBXUL_DIST"
-    fi
-    AC_OUTPUT_SUBDIRS(ldap/sdks/c-sdk)
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
-fi # COMPILE_ENVIRONMENT && MOZ_LDAP_XPCOM
new file mode 100644
--- /dev/null
+++ b/mail/configure.in
@@ -0,0 +1,112 @@
+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/.
+
+#MOZ_CALENDAR=
+#MOZ_LDAP_XPCOM=
+
+dnl =========================================================
+dnl = Calendar client
+dnl =========================================================
+MOZ_ARG_ENABLE_BOOL(calendar,
+[  --enable-calendar      Enable building of the Lightning calendar extension],
+    MOZ_CALENDAR=1,
+    MOZ_CALENDAR= )
+AC_SUBST(MOZ_CALENDAR)
+
+MOZ_ARG_ENABLE_BOOL(incomplete-external-linkage,
+[  --enable-incomplete-external-linkage Changes some comm-central code to be built with external linkage. Developer only option, incomplete broken builds will result - There are already existing bugs for this. ],
+    MOZ_INCOMPLETE_EXTERNAL_LINKAGE=1,
+    MOZ_INCOMPLETE_EXTERNAL_LINKAGE= )
+
+export MOZ_INCOMPLETE_EXTERNAL_LINKAGE
+AC_SUBST(MOZ_INCOMPLETE_EXTERNAL_LINKAGE)
+
+dnl =========================================================
+dnl = LDAP
+dnl =========================================================
+MOZ_ARG_DISABLE_BOOL(ldap,
+[  --disable-ldap          Disable LDAP support],
+    MOZ_LDAP_XPCOM=,
+    MOZ_LDAP_XPCOM=1)
+
+if test "$MOZ_LDAP_XPCOM"; then
+    MOZ_ARG_ENABLE_BOOL(incomplete-toolkit-ldap-autocomplete,
+    [  --enable-incomplete-toolkit-ldap-autocomplete Builds a JavaScript component that implements an LDAP autocomplete component using the toolkit interfaces rather than the C++ component using the obsolete XPFE interfaces. ],
+        MOZ_INCOMPLETE_TOOLKIT_LDAP_AUTOCOMPLETE=1,
+        MOZ_INCOMPLETE_TOOLKIT_LDAP_AUTOCOMPLETE= )
+
+    LDAP_CFLAGS='-I${DIST}/public/ldap'
+    if test "$OS_ARCH" = "WINNT"; then
+        if test -n "$GNU_CC"; then
+            LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
+        else
+            LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)nsldap32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldappr32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldif32v60.${IMPORT_LIB_SUFFIX}'
+        fi
+    elif test "$OS_ARCH" = "OS2"; then
+            LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)ldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)prldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)ldif60.${IMPORT_LIB_SUFFIX}'
+    else
+        LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
+    fi
+
+    dnl export LDAP_LIBS so that confvars.sh can pick it up, so when we get to
+    dnl linking libxul in the mozilla-central build system, we'll have the LDAP
+    dnl LIBS
+    export LDAP_LIBS
+    LDAP_COMPONENT=mozldap
+    export LDAP_COMPONENT
+    LDAP_MODULE="MODULE(nsLDAPProtocolModule)"
+    export LDAP_MODULE
+fi
+AC_SUBST(MOZ_INCOMPLETE_TOOLKIT_LDAP_AUTOCOMPLETE)
+
+AC_SUBST(MOZ_LDAP_XPCOM)
+AC_SUBST(LDAP_CFLAGS)
+AC_SUBST(LDAP_LIBS)
+
+dnl Only build Mork if it's required
+AC_SUBST(MOZ_MORK)
+if test "$MOZ_MORK"; then
+  AC_DEFINE(MOZ_MORK)
+  MORK_COMPONENT=mork
+  export MORK_COMPONENT
+  MORK_MODULE="MODULE(nsMorkModule)"
+  export MORK_MODULE
+fi
+
+_save_ac_configure_args="$ac_configure_args"
+ac_configure_args="$_SUBDIR_CONFIG_ARGS"
+
+# if we're building the LDAP XPCOM component, we need to build 
+# the c-sdk first.  
+if test -n "$COMPILE_ENVIRONMENT" -a -n "$MOZ_LDAP_XPCOM"; then
+    # these subdirs may not yet have been created in the build tree.
+    # don't use the "-p" switch to mkdir, since not all platforms have it
+    if test ! -d "ldap/sdks/c-sdk/ldap"; then
+        if test ! -d "ldap/sdks/c-sdk"; then
+            if test ! -d "ldap/sdks"; then
+                if test ! -d "ldap"; then
+                    mkdir "ldap"
+                fi
+                mkdir "ldap/sdks"
+            fi
+            mkdir "ldap/sdks/c-sdk"
+        fi
+        mkdir "ldap/sdks/c-sdk/ldap"
+    fi
+
+    ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/mozilla/dist --with-dist-prefix=$MOZ_BUILD_ROOT/mozilla/dist --without-nss --with-mozilla"
+    if test -n "$HAVE_64BIT_OS"; then
+        dnl A 64-bit OS was (auto-)detected: (explicitly) enable 64-bit support.
+        ac_configure_args="$ac_configure_args --enable-64bit"
+    fi
+    if test -n "$LIBXUL_SDK"; then
+        ac_configure_args="$ac_configure_args --with-nspr=$LIBXUL_DIST"
+    fi
+    AC_OUTPUT_SUBDIRS(ldap/sdks/c-sdk)
+    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
+fi # COMPILE_ENVIRONMENT && MOZ_LDAP_XPCOM
+
+ac_configure_args="$_save_ac_configure_args"