1 dnl This Source Code Form is subject to the terms of the Mozilla Public
2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 dnl Wrap AC_INIT_PREPARE to add the above trap.
6 define([_MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
7 define([AC_INIT_PREPARE],
8 [_MOZ_AC_INIT_PREPARE($1)
10 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11 # Let make expand exec_prefix.
12 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
18 define([AC_OUTPUT_SUBDIRS],
19 [for moz_config_dir in $1; do
20 _CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
21 case "$moz_config_dir" in
23 objdir=$(echo $moz_config_dir | awk -F: '{print [$]2}')
26 objdir=$moz_config_dir
29 dnl Because config.status, storing AC_SUBSTs, is written before any
30 dnl subconfigure runs, we need to use a file. Moreover, some subconfigures
31 dnl are started from a subshell, and variable modifications from a subshell
32 dnl wouldn't be preserved.
33 echo $objdir >> subconfigures
38 _CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL)
39 if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then
40 _CONFIG_SHELL="${_CONFIG_SHELL}.exe"
42 dnl Yes, this is horrible. But since msys doesn't preserve environment
43 dnl variables and command line arguments as they are when transitioning
44 dnl from msys (this script) to python (below), we have to resort to hacks,
45 dnl storing the environment and command line arguments from a msys process
46 dnl (perl), and reading it from python.
47 dumpenv="$PERL $_topsrcdir/build/win32/dumpenv4python.pl $ac_configure_args | "
51 eval $dumpenv $PYTHON $_topsrcdir/build/subconfigure.py --prepare "$srcdir" "$moz_config_dir" "$_CONFIG_SHELL" $ac_configure_args ifelse($2,,,--cache-file="$2")
53 dnl Actual subconfigure execution happens in MOZ_RUN_CONFIG_STATUS
57 define([AC_OUTPUT_SUBDIRS_NOW],
59 for moz_config_dir_ in $1; do
60 AC_OUTPUT_SUBDIRS($moz_config_dir_,$2)
61 tail -1 subconfigures >> skip_subconfigures
62 MOZ_RUN_SUBCONFIGURES(`tail -1 skip_subconfigures`)
66 define([MOZ_RUN_SUBCONFIGURES],
67 [dnl Execute subconfigure, unless --no-recursion was passed to configure.
68 if test "$no_recursion" != yes; then
70 if ! $PYTHON $_topsrcdir/build/subconfigure.py $1; then
76 define([MOZ_RUN_ALL_SUBCONFIGURES],[
77 MOZ_RUN_SUBCONFIGURES([--list subconfigures --skip skip_subconfigures])
80 dnl Print error messages in config.log as well as stderr
81 define([AC_MSG_ERROR],
82 [{ echo "configure: error: $1" 1>&2; echo "configure: error: $1" 1>&5; exit 1; }])