build/autoconf/hooks.m4
author Mike Hommey <mh+mozilla@glandium.org>
Thu, 15 Aug 2013 23:45:07 +0900
changeset 142775 afb4c2e449b447ef879034b8d59ab79a39a8ab0b
parent 128337 32c37babc5bf9f2aa42b0a8d5dc4406e2bf23b60
child 143211 f6f98e1ea1ef6139d838555f9d97727821e5c96f
permissions -rw-r--r--
Bug 861285 - Print AC_MSG_ERROR messages in config.log too. r=ted

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 Output the contents of config.log when configure exits with an
dnl error code.
define([MOZ_CONFIG_LOG_TRAP],
[changequote(<<<, >>>)dnl
trap '[ "$?" != 0 ] && echo "------ config.log ------" && tail -n 25 config.log' EXIT
changequote([, ])dnl
])

dnl Wrap AC_INIT_PREPARE to add the above trap.
define([_MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
define([AC_INIT_PREPARE],
[_MOZ_AC_INIT_PREPARE($1)
MOZ_CONFIG_LOG_TRAP
])

dnl Disable the trap when running sub-configures.
define([_MOZ_AC_OUTPUT_SUBDIRS], defn([AC_OUTPUT_SUBDIRS]))
define([AC_OUTPUT_SUBDIRS],
[trap '' EXIT
_MOZ_AC_OUTPUT_SUBDIRS($1)
MOZ_CONFIG_LOG_TRAP
])

dnl Print error messages in config.log as well as stderr
define([AC_MSG_ERROR],
[{ echo "configure: error: $1" 1>&2; echo "configure: error: $1" 1>&5; exit 1; }])