m4/yat_msg_error.m4

Code
Comments
Other
Rev Date Author Line
2445 19 Mar 11 peter 1 ## $Id$
2445 19 Mar 11 peter 2
2445 19 Mar 11 peter 3 #
2865 11 Nov 12 peter 4 # serial 3 (yat 0.10)
2445 19 Mar 11 peter 5 #
2445 19 Mar 11 peter 6
2445 19 Mar 11 peter 7 #
2787 23 Jul 12 peter 8 #   Copyright (C) 2011, 2012 Peter Johansson
2445 19 Mar 11 peter 9 #
2445 19 Mar 11 peter 10 #   This file is part of the yat library, http://dev.thep.lu.se/yat
2445 19 Mar 11 peter 11 #
2445 19 Mar 11 peter 12 #   The yat library is free software; you can redistribute it and/or
2445 19 Mar 11 peter 13 #   modify it under the terms of the GNU General Public License as
2445 19 Mar 11 peter 14 #   published by the Free Software Foundation; either version 3 of the
2445 19 Mar 11 peter 15 #   License, or (at your option) any later version.
2445 19 Mar 11 peter 16 #
2445 19 Mar 11 peter 17 #   The yat library is distributed in the hope that it will be useful,
2445 19 Mar 11 peter 18 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
2445 19 Mar 11 peter 19 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2445 19 Mar 11 peter 20 #   General Public License for more details.
2445 19 Mar 11 peter 21 #
2445 19 Mar 11 peter 22 #   You should have received a copy of the GNU General Public License
2445 19 Mar 11 peter 23 #   along with yat. If not, see <http://www.gnu.org/licenses/>.
2445 19 Mar 11 peter 24 #
2445 19 Mar 11 peter 25
2445 19 Mar 11 peter 26 # YAT_MSG_ERROR(ERROR)
2445 19 Mar 11 peter 27 #
2445 19 Mar 11 peter 28 # Just like AC_MSG_ERROR this macro prints an error message, ERROR, to
2445 19 Mar 11 peter 29 # standard error and exits. But rather than doing that immediately
2445 19 Mar 11 peter 30 # this macro lets configure continue and prints the error message and
2445 19 Mar 11 peter 31 # exits just before the end.
2445 19 Mar 11 peter 32 #
2445 19 Mar 11 peter 33 AC_DEFUN([YAT_MSG_ERROR],
2445 19 Mar 11 peter 34 [
2445 19 Mar 11 peter 35   AC_REQUIRE([YAT_MSG_ERROR_PREPARE])
2865 11 Nov 12 peter 36   AS_ECHO(["$1"]) >> yat_msg_error.txt
2726 18 Apr 12 peter 37   AS_ECHO(["$as_me:$LINENO: error: $1"]) >& AS_MESSAGE_LOG_FD
2445 19 Mar 11 peter 38 ]) # YAT_MSG_ERROR
2445 19 Mar 11 peter 39
2445 19 Mar 11 peter 40 # YAT_MSG_ERROR_PREPARE([MESSAGE])
2445 19 Mar 11 peter 41 #
2445 19 Mar 11 peter 42 # The error messages generated by YAT_MSG_ERROR is preceeded by a
2445 19 Mar 11 peter 43 # message: 'some requirements were not fulfilled, see below'. This
2445 19 Mar 11 peter 44 # default message can can be changed to MESSAGE by calling
2445 19 Mar 11 peter 45 # YAT_MSG_ERROR_PREPARE prior the first YAT_MSG_ERROR.
2445 19 Mar 11 peter 46 AC_DEFUN([YAT_MSG_ERROR_PREPARE],
2445 19 Mar 11 peter 47 [
2865 11 Nov 12 peter 48 rm -f yat_msg_error.txt
2445 19 Mar 11 peter 49 AC_CONFIG_COMMANDS_PRE([
2865 11 Nov 12 peter 50    AS_IF([test -f yat_msg_error.txt], [
2445 19 Mar 11 peter 51      msg="m4_default([$1], [some requirements were not fulfilled, see below])"
2726 18 Apr 12 peter 52      AS_ECHO(["$as_me: error: $msg"]) >&2
2865 11 Nov 12 peter 53      cat yat_msg_error.txt >&2
2445 19 Mar 11 peter 54      AS_EXIT([1])
2445 19 Mar 11 peter 55    ])
2445 19 Mar 11 peter 56   ])
2445 19 Mar 11 peter 57 ]) # _YAT_MSG_ERROR