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