source: trunk/m4/yat_msg_error.m4 @ 2445

Last change on this file since 2445 was 2445, checked in by Peter, 11 years ago

adding a macro similar to AC_MSG_ERROR with the difference that it lets configure continue and exit with the error message(s) in the end of configure

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 1.8 KB
RevLine 
[2445]1## $Id: yat_msg_error.m4 2445 2011-03-19 23:06:05Z peter $
2
3#
4# serial 0 (yat 0.8)
5#
6
7#
8#   Copyright (C) 2011 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#
33AC_DEFUN([YAT_MSG_ERROR],
34[
35  AC_REQUIRE([YAT_MSG_ERROR_PREPARE])
36  AS_ECHO(["$1"]) >> conftest.yat_msg_error
37  AS_ECHO(["configure:$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.
46AC_DEFUN([YAT_MSG_ERROR_PREPARE],
47[
48AC_CONFIG_COMMANDS_PRE([
49   AS_IF([test -f conftest.yat_msg_error], [
50     msg="m4_default([$1], [some requirements were not fulfilled, see below])"
51     AS_ECHO(["configure: error: $msg"]) >&2
52     cat conftest.yat_msg_error >&2
53     AS_EXIT([1])
54   ])
55  ])
56]) # _YAT_MSG_ERROR
Note: See TracBrowser for help on using the repository browser.