1# This file is part of Autoconf. -*- Autoconf -*- 2# Interface with autoupdate. 3 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 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2, or (at your option) 10# any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program; if not, write to the Free Software 19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20# 02110-1301, USA. 21 22# As a special exception, the Free Software Foundation gives unlimited 23# permission to copy, distribute and modify the configure scripts that 24# are the output of Autoconf. You need not follow the terms of the GNU 25# General Public License when using or distributing such scripts, even 26# though portions of the text of Autoconf appear in them. The GNU 27# General Public License (GPL) does govern all other use of the material 28# that constitutes the Autoconf program. 29# 30# Certain portions of the Autoconf source text are designed to be copied 31# (in certain cases, depending on the input) into the output of 32# Autoconf. We call these the "data" portions. The rest of the Autoconf 33# source text consists of comments plus executable code that decides which 34# of the data portions to output in any given case. We call these 35# comments and executable code the "non-data" portions. Autoconf never 36# copies any of the non-data portions into its output. 37# 38# This special exception to the GPL applies to versions of Autoconf 39# released by the Free Software Foundation. When you make and 40# distribute a modified version of Autoconf, you may extend this special 41# exception to the GPL to apply to your modified version as well, *unless* 42# your modified version has the potential to copy into its output some 43# of the text that was the non-data portion of the version that you started 44# with. (In other words, unless your change moves or copies text from 45# the non-data portions to the data portions.) If your modification has 46# such potential, you must delete any notice of this special exception 47# to the GPL from your modified version. 48# 49# Written by David MacKenzie, with help from 50# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, 51# Roland McGrath, Noah Friedman, david d zuhn, and many others. 52 53 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. 64# 65m4_define([AU_DEFINE], []) 66 67# AU_DEFUN(NAME, NEW-CODE, [MESSAGE]) 68# ----------------------------------- 69# Declare that the macro NAME is now obsoleted, and should be replaced 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# 74# Also define NAME as a macro which code is NEW-CODE. 75# 76# This allows sharing the same code for both supporting obsoleted macros, 77# and to update a configure.ac. 78# See the end of `autoupdate.in' for a longer description. 79m4_define([AU_DEFUN], 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. 84AU_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. 94AU_DEFINE([_au_warn_$1], 95[m4_warning($][@)dnl 96m4_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. 103AC_DEFUN([$1], 104 [AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete. 105You should run autoupdate.])dnl 106$2])]) 107 108 109# AU_ALIAS(OLD-NAME, NEW-NAME) 110# ---------------------------- 111# The OLD-NAME is no longer used, just use NEW-NAME instead. There is 112# little difference with using AU_DEFUN but the fact there is little 113# interest in running the test suite on both OLD-NAME and NEW-NAME. 114# This macro makes it possible to distinguish such cases. 115# 116# Do not use `defn' since then autoupdate would replace an old macro 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# 124m4_define([AU_ALIAS], 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: 130m4_define([_AU_ALIAS_BODY], [[m4_if($1#, 0, [$2], [$2($1@)])]]) 131