Bug 1500160 [wpt PR 13600] - Add tests for simple dialog newline normalization, a...
[gecko.git] / build / autoconf / hooks.m4
blob5c921b549e18b64b988da76badd4d38c023228b3
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}'
14 > subconfigures
15 > skip_subconfigures
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
22   *:*)
23     objdir=$(echo $moz_config_dir | awk -F: '{print [$]2}')
24     ;;
25   *)
26     objdir=$moz_config_dir
27     ;;
28   esac
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
35   dumpenv="true | "
36   case "$host" in
37   *-mingw*)
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"
41     fi
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 | "
48     ;;
49   esac
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
54 done
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`)
63 done
66 define([MOZ_RUN_SUBCONFIGURES],
67 [dnl Execute subconfigure, unless --no-recursion was passed to configure.
68 if test "$no_recursion" != yes; then
69   trap '' EXIT
70   if ! $PYTHON $_topsrcdir/build/subconfigure.py $1; then
71       exit 1
72   fi
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; }])