michael@0: dnl This Source Code Form is subject to the terms of the Mozilla Public michael@0: dnl License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: dnl Output the contents of config.log when configure exits with an michael@0: dnl error code. michael@0: define([MOZ_CONFIG_LOG_TRAP], michael@0: [changequote(<<<, >>>)dnl michael@0: trap '[ "$?" != 0 ] && echo "------ config.log ------" && tail -n 25 config.log' EXIT michael@0: changequote([, ])dnl michael@0: ]) michael@0: michael@0: dnl Wrap AC_INIT_PREPARE to add the above trap. michael@0: define([_MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE])) michael@0: define([AC_INIT_PREPARE], michael@0: [_MOZ_AC_INIT_PREPARE($1) michael@0: MOZ_CONFIG_LOG_TRAP michael@0: ]) michael@0: michael@0: dnl Disable the trap when running sub-configures. michael@0: define([_MOZ_AC_OUTPUT_SUBDIRS], defn([AC_OUTPUT_SUBDIRS])) michael@0: define([MOZ_SUBCONFIGURE_WRAP], michael@0: [ _CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} michael@0: case "$host" in michael@0: *-mingw*) michael@0: _CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL) michael@0: if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then michael@0: _CONFIG_SHELL="${_CONFIG_SHELL}.exe" michael@0: fi michael@0: ;; michael@0: esac michael@0: michael@0: if test -d "$1"; then michael@0: (cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py dump "$_CONFIG_SHELL") michael@0: else michael@0: mkdir -p "$1" michael@0: fi michael@0: $2 michael@0: (cd "$1"; $PYTHON $_topsrcdir/build/subconfigure.py adjust $ac_sub_configure) michael@0: ]) michael@0: michael@0: define([AC_OUTPUT_SUBDIRS], michael@0: [trap '' EXIT michael@0: for moz_config_dir in $1; do michael@0: MOZ_SUBCONFIGURE_WRAP([$moz_config_dir],[ michael@0: _MOZ_AC_OUTPUT_SUBDIRS($moz_config_dir) michael@0: ]) michael@0: done michael@0: michael@0: MOZ_CONFIG_LOG_TRAP michael@0: ]) michael@0: michael@0: dnl Print error messages in config.log as well as stderr michael@0: define([AC_MSG_ERROR], michael@0: [{ echo "configure: error: $1" 1>&2; echo "configure: error: $1" 1>&5; exit 1; }])