~ubuntu-branches/ubuntu/maverick/autoconf/maverick

« back to all changes in this revision

Viewing changes to lib/autoconf/autoupdate.m4

  • Committer: Bazaar Package Importer
  • Author(s): Ben Pfaff
  • Date: 2007-01-17 19:57:13 UTC
  • mfrom: (3.1.7 feisty)
  • Revision ID: james.westby@ubuntu.com-20070117195713-n2q7e2pbpu4ezbx7
Tags: 2.61-4
debian/control: Require m4 version 1.4.8 or later.  Thanks to Jim
Paris <jim@jtan.com> for reporting this bug.  Closes: #407385.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# This file is part of Autoconf.                       -*- Autoconf -*-
2
2
# Interface with autoupdate.
3
 
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2003
4
 
# Free Software Foundation, Inc.
 
3
 
 
4
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 
5
# 2003, 2004, 2006 Free Software Foundation, Inc.
5
6
 
6
7
# This program is free software; you can redistribute it and/or modify
7
8
# it under the terms of the GNU General Public License as published by
15
16
#
16
17
# You should have received a copy of the GNU General Public License
17
18
# along with this program; if not, write to the Free Software
18
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
 
# 02111-1307, USA.
 
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
20
# 02110-1301, USA.
20
21
 
21
22
# As a special exception, the Free Software Foundation gives unlimited
22
23
# permission to copy, distribute and modify the configure scripts that
50
51
# Roland McGrath, Noah Friedman, david d zuhn, and many others.
51
52
 
52
53
 
53
 
## --------------------------------- ##
54
 
## Defining macros in autoupdate::.  ##
55
 
## --------------------------------- ##
56
 
 
57
 
 
58
 
# AU_DEFINE(NAME, GLUE-CODE, [MESSAGE])
59
 
# -------------------------------------
 
54
## ---------------------------------- ##
 
55
## Macros to define obsolete macros.  ##
 
56
## ---------------------------------- ##
 
57
 
 
58
 
 
59
# AU_DEFINE(NAME, CODE)
 
60
# ---------------------
 
61
# Define the macro NAME so that it expand to CODE only when
 
62
# autoupdate is running.  This is achieved with traces in
 
63
# autoupdate itself, so this macro expands to nothing.
60
64
#
61
 
# Declare `autoupdate::NAME' to be `GLUE-CODE', with all the needed
62
 
# wrapping actions required by `autoupdate'.
63
 
# We do not define anything in `autoconf::'.
64
 
m4_define([AU_DEFINE],
65
 
[AC_DEFUN([$1], [$2])])
66
 
 
 
65
m4_define([AU_DEFINE], [])
67
66
 
68
67
# AU_DEFUN(NAME, NEW-CODE, [MESSAGE])
69
68
# -----------------------------------
70
69
# Declare that the macro NAME is now obsoleted, and should be replaced
71
 
# by NEW-CODE.  Tell the user she should run autoupdate, and include
72
 
# the additional MESSAGE.
 
70
# by NEW-CODE.  Tell the user she should run autoupdate, and when
 
71
# autoupdate is run, emit MESSAGE as a warning and include it in
 
72
# the updated configure.ac file.
73
73
#
74
74
# Also define NAME as a macro which code is NEW-CODE.
75
75
#
76
 
# This allows to share the same code for both supporting obsoleted macros,
 
76
# This allows sharing the same code for both supporting obsoleted macros,
77
77
# and to update a configure.ac.
78
 
# See `acobsolete.m4' for a longer description.
 
78
# See the end of `autoupdate.in' for a longer description.
79
79
m4_define([AU_DEFUN],
80
 
[AU_DEFINE([$1],
81
 
           [AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
 
80
[# This is what autoupdate's m4 run will expand.  It fires
 
81
# the warning (with _au_warn_XXX), outputs it into the
 
82
# updated configure.ac (with AC_DIAGNOSE), and then outputs
 
83
# the replacement expansion.
 
84
AU_DEFINE([$1],
 
85
[m4_ifval([$3], [_au_warn_$1([$3])AC_DIAGNOSE([obsolete], [$3])d[]nl
 
86
])dnl
 
87
$2])
 
88
 
 
89
# This is an auxiliary macro that is also run when
 
90
# autoupdate runs m4.  It simply calls m4_warning, but
 
91
# we need a wrapper so that each warning is emitted only
 
92
# once.  We break the quoting in m4_warning's argument in
 
93
# order to expand this macro's arguments, not AU_DEFUN's.
 
94
AU_DEFINE([_au_warn_$1],
 
95
[m4_warning($][@)dnl
 
96
m4_define([_au_warn_$1], [])])
 
97
 
 
98
# Finally, this is the expansion that is picked up by
 
99
# autoconf.  It tells the user to run autoupdate, and
 
100
# then outputs the replacement expansion.  We do not care
 
101
# about autoupdate's warning because that contains
 
102
# information on what to do *after* running autoupdate.
 
103
AC_DEFUN([$1],
 
104
         [AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
82
105
You should run autoupdate.])dnl
83
 
$2],
84
 
           [$3])dnl
85
 
])
 
106
$2])])
86
107
 
87
108
 
88
109
# AU_ALIAS(OLD-NAME, NEW-NAME)
94
115
#
95
116
# Do not use `defn' since then autoupdate would replace an old macro
96
117
# call with the new macro body instead of the new macro call.
 
118
#
 
119
# Moreover, we have to take care that calls without parameters are
 
120
# expanded to calls without parameters, not with one empty parameter.
 
121
# This is not only an aesthetical improvement of autoupdate, it also
 
122
# matters with poorly written macros which test for $# = 0.
 
123
#
97
124
m4_define([AU_ALIAS],
98
 
[AU_DEFUN([$1], [$2($][@)])])
 
125
[AU_DEFUN([$1], _AU_ALIAS_BODY([$], [$2]))])
 
126
 
 
127
# The body for the AU_DEFUN above should look like:
 
128
#       [m4_if($#, 0, [NEW-NAME], [NEW-NAME($@)])]
 
129
# Thus the helper macro is:
 
130
m4_define([_AU_ALIAS_BODY], [[m4_if($1#, 0, [$2], [$2($1@)])]])