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.
4
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
5
# 2003, 2004, 2006 Free Software Foundation, Inc.
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
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
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
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.
53
## --------------------------------- ##
54
## Defining macros in autoupdate::. ##
55
## --------------------------------- ##
58
# AU_DEFINE(NAME, GLUE-CODE, [MESSAGE])
59
# -------------------------------------
54
## ---------------------------------- ##
55
## Macros to define obsolete macros. ##
56
## ---------------------------------- ##
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.
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])])
65
m4_define([AU_DEFINE], [])
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.
74
74
# Also define NAME as a macro which code is NEW-CODE.
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],
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.
85
[m4_ifval([$3], [_au_warn_$1([$3])AC_DIAGNOSE([obsolete], [$3])d[]nl
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],
96
m4_define([_au_warn_$1], [])])
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.
104
[AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
82
105
You should run autoupdate.])dnl
88
109
# AU_ALIAS(OLD-NAME, NEW-NAME)
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.
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.
97
124
m4_define([AU_ALIAS],
98
[AU_DEFUN([$1], [$2($][@)])])
125
[AU_DEFUN([$1], _AU_ALIAS_BODY([$], [$2]))])
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@)])]])