1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/autoconf/hooks.m4 Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +dnl This Source Code Form is subject to the terms of the Mozilla Public 1.5 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +dnl Output the contents of config.log when configure exits with an 1.9 +dnl error code. 1.10 +define([MOZ_CONFIG_LOG_TRAP], 1.11 +[changequote(<<<, >>>)dnl 1.12 +trap '[ "$?" != 0 ] && echo "------ config.log ------" && tail -n 25 config.log' EXIT 1.13 +changequote([, ])dnl 1.14 +]) 1.15 + 1.16 +dnl Wrap AC_INIT_PREPARE to add the above trap. 1.17 +define([_MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE])) 1.18 +define([AC_INIT_PREPARE], 1.19 +[_MOZ_AC_INIT_PREPARE($1) 1.20 +MOZ_CONFIG_LOG_TRAP 1.21 +]) 1.22 + 1.23 +dnl Disable the trap when running sub-configures. 1.24 +define([_MOZ_AC_OUTPUT_SUBDIRS], defn([AC_OUTPUT_SUBDIRS])) 1.25 +define([MOZ_SUBCONFIGURE_WRAP], 1.26 +[ _CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} 1.27 +case "$host" in 1.28 +*-mingw*) 1.29 + _CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL) 1.30 + if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then 1.31 + _CONFIG_SHELL="${_CONFIG_SHELL}.exe" 1.32 + fi 1.33 + ;; 1.34 +esac 1.35 + 1.36 +if test -d "$1"; then 1.37 + (cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py dump "$_CONFIG_SHELL") 1.38 +else 1.39 + mkdir -p "$1" 1.40 +fi 1.41 +$2 1.42 +(cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py adjust $ac_sub_configure) 1.43 +]) 1.44 + 1.45 +define([AC_OUTPUT_SUBDIRS], 1.46 +[trap '' EXIT 1.47 +for moz_config_dir in $1; do 1.48 + MOZ_SUBCONFIGURE_WRAP([$moz_config_dir],[ 1.49 + _MOZ_AC_OUTPUT_SUBDIRS($moz_config_dir) 1.50 + ]) 1.51 +done 1.52 + 1.53 +MOZ_CONFIG_LOG_TRAP 1.54 +]) 1.55 + 1.56 +dnl Print error messages in config.log as well as stderr 1.57 +define([AC_MSG_ERROR], 1.58 +[{ echo "configure: error: $1" 1>&2; echo "configure: error: $1" 1>&5; exit 1; }])