mirror of
git://git.sv.gnu.org/autoconf
synced 2024-11-27 01:49:56 +08:00
Document interaction of recent m4_append change with Libtool HEAD.
* lib/m4sugar/m4sugar.m4 (m4_append): Document semantics change. (m4_append_uniq): Add new parameters, based on lt_append_uniq. * tests/m4sugar.at (m4@&t@_append): New test. * NEWS: Document semantics change. * doc/autoconf.texi (Text processing Macros): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
This commit is contained in:
parent
408ce204ae
commit
be938d2dec
@ -1,5 +1,12 @@
|
||||
2007-10-12 Eric Blake <ebb9@byu.net>
|
||||
|
||||
Document interaction of recent m4_append change with Libtool HEAD.
|
||||
* lib/m4sugar/m4sugar.m4 (m4_append): Document semantics change.
|
||||
(m4_append_uniq): Add new parameters, based on lt_append_uniq.
|
||||
* tests/m4sugar.at (m4@&t@_append): New test.
|
||||
* NEWS: Document semantics change.
|
||||
* doc/autoconf.texi (Text processing Macros): Likewise.
|
||||
|
||||
s/AC_VERSION/AC_AUTOCONF_VERSION/.
|
||||
* doc/autoconf.texi (Versioning): Change the name.
|
||||
* NEWS: Likewise.
|
||||
|
45
NEWS
45
NEWS
@ -73,10 +73,47 @@ GNU Autoconf NEWS - User visible changes.
|
||||
Autoconf and Automake. GNU M4 1.4.8 or later is recommended. The
|
||||
configure search for a working M4 is improved.
|
||||
|
||||
** Document the m4sugar macros m4_ifndef and m4_version_compare
|
||||
(available without documentation since at least autoconf 2.53).
|
||||
Packages using the undocumented m4sugar macro m4_PACKAGE_VERSION
|
||||
should consider using the new AC_AUTOCONF_VERSION instead.
|
||||
** Documentation for m4sugar is improved.
|
||||
|
||||
- The following macros were previously available as undocumented
|
||||
interfaces; the macros are now documented as stable interfaces.
|
||||
|
||||
m4_bmatch m4_bpatsubsts m4_case m4_default m4_do m4_ifndef
|
||||
m4_ifset m4_ifval m4_ifvaln m4_n m4_shiftn
|
||||
m4_version_compare m4_warn
|
||||
|
||||
- The following macros were previously available as undocumented
|
||||
interfaces, but had bugs. Packages that relied on the
|
||||
undocumented and buggy behavior should analyze their code to make
|
||||
sure it still works with the new documented behavior.
|
||||
|
||||
m4_text_wrap
|
||||
|
||||
- Packages using the undocumented m4sugar macro m4_PACKAGE_VERSION
|
||||
should consider using the new AC_AUTOCONF_VERSION instead.
|
||||
|
||||
- m4sugar macros that are not documented in the manual are still
|
||||
deemed experimental, and should not be used outside of Autoconf.
|
||||
|
||||
** The m4sugar macros m4_append and m4_append_uniq, first documented in
|
||||
2.60, have been fixed to treat both the string and the separator
|
||||
arguments consistently with regards to quoting. Prior to this fix,
|
||||
m4_append_uniq could mistakenly duplicate entries if the expansion
|
||||
of the separator resulted in a different string (for example, if it
|
||||
contained quotes, a comma, or a macro name). However, it means
|
||||
that programs previously using
|
||||
m4_append([name], [string], [[, ]])
|
||||
are now using a four-character separator instead of the intended
|
||||
comma and space. If you need portability to earlier versions of
|
||||
Autoconf, you can insert the following snippet after AC_INIT but
|
||||
before any other macro expansions, to enforce the new semantics:
|
||||
m4_pushdef([m4_append], [m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
Additionally, m4_append_uniq now takes optional parameters that can
|
||||
be used to take action depending on whether anything was appended.
|
||||
|
||||
** The following m4sugar macros are new:
|
||||
m4_cond m4_newline m4_shift2 m4_shift3
|
||||
|
||||
** Warnings are now generated by default when an installer invokes
|
||||
'configure' with an unknown --enable-* or --with-* option.
|
||||
|
@ -10510,14 +10510,54 @@ single space.
|
||||
@end defmac
|
||||
|
||||
@defmac m4_append (@var{macro-name}, @var{string}, @ovar{separator})
|
||||
@defmacx m4_append_uniq (@var{macro-name}, @var{string}, @ovar{separator})
|
||||
@defmacx m4_append_uniq (@var{macro-name}, @var{string}, @ovar{separator} @
|
||||
@ovar{if-uniq}, @ovar{if-duplicate})
|
||||
@msindex{append}
|
||||
@msindex{append_uniq}
|
||||
Redefine @var{macro-name} to its former contents with @var{separator}
|
||||
and @var{string} added at the end. If @var{macro-name} was undefined
|
||||
before (but not if it was defined but empty), then no @var{separator} is
|
||||
added. @code{m4_append} can be used to grow strings, and
|
||||
@code{m4_append_uniq} to grow strings without duplicating substrings.
|
||||
added. As of Autoconf 2.62, neither @var{string} nor @var{separator}
|
||||
are expanded during this macro; instead, they are expanded when
|
||||
@var{macro-name} is invoked.
|
||||
|
||||
@code{m4_append} can be used to grow strings, and @code{m4_append_uniq}
|
||||
to grow strings without duplicating substrings. Additionally,
|
||||
@code{m4_append_uniq} takes two optional parameters; @var{if-uniq} is
|
||||
expanded if @var{string} was appended, and @var{if-duplicate} is
|
||||
expanded if @var{string} was already present.
|
||||
|
||||
@example
|
||||
m4_define([active], [ACTIVE])dnl
|
||||
m4_append([sentence], [This is an])dnl
|
||||
m4_append([sentence], [ active ])dnl
|
||||
m4_append([sentence], [symbol.])dnl
|
||||
sentence
|
||||
@result{}This is an ACTIVE symbol.
|
||||
m4_undefine([active])dnl
|
||||
@result{}This is an active symbol.
|
||||
m4_append_uniq([list], [one], [, ], [new], [existing])
|
||||
@result{}new
|
||||
m4_append_uniq([list], [one], [, ], [new], [existing])
|
||||
@result{}existing
|
||||
m4_append_uniq([list], [two], [, ], [new], [existing])
|
||||
@result{}new
|
||||
m4_append_uniq([list], [three], [, ], [new], [existing])
|
||||
@result{}new
|
||||
m4_append_uniq([list], [two], [, ], [new], [existing])
|
||||
@result{}existing
|
||||
list
|
||||
@result{}one, two, three
|
||||
m4_dquote(list)
|
||||
@result{}[one],[two],[three]
|
||||
m4_append([list2], [one], [[, ]])dnl
|
||||
m4_append_uniq([list2], [two], [[, ]])dnl
|
||||
m4_append([list2], [three], [[, ]])dnl
|
||||
list2
|
||||
@result{}one, two, three
|
||||
m4_dquote(list2)
|
||||
@result{}[one, two, three]
|
||||
@end example
|
||||
@end defmac
|
||||
|
||||
@anchor{m4_version_compare}
|
||||
|
@ -1656,13 +1656,16 @@ m4_defun([m4_join],
|
||||
# in which case no SEPARATOR is added. Be aware that the criterion is
|
||||
# `not being defined', and not `not being empty'.
|
||||
#
|
||||
# Note that neither STRING nor SEPARATOR are expanded here; rather, when
|
||||
# you expand MACRO-NAME, they will be expanded at that point in time.
|
||||
#
|
||||
# This macro is robust to active symbols. It can be used to grow
|
||||
# strings.
|
||||
#
|
||||
# | m4_define(active, ACTIVE)
|
||||
# | m4_append([sentence], [This is an])
|
||||
# | m4_append([sentence], [ active ])
|
||||
# | m4_append([sentence], [symbol.])
|
||||
# | m4_define(active, ACTIVE)dnl
|
||||
# | m4_append([sentence], [This is an])dnl
|
||||
# | m4_append([sentence], [ active ])dnl
|
||||
# | m4_append([sentence], [symbol.])dnl
|
||||
# | sentence
|
||||
# | m4_undefine([active])dnl
|
||||
# | sentence
|
||||
@ -1671,10 +1674,10 @@ m4_defun([m4_join],
|
||||
#
|
||||
# It can be used to define hooks.
|
||||
#
|
||||
# | m4_define(active, ACTIVE)
|
||||
# | m4_append([hooks], [m4_define([act1], [act2])])
|
||||
# | m4_append([hooks], [m4_define([act2], [active])])
|
||||
# | m4_undefine([active])
|
||||
# | m4_define(active, ACTIVE)dnl
|
||||
# | m4_append([hooks], [m4_define([act1], [act2])])dnl
|
||||
# | m4_append([hooks], [m4_define([act2], [active])])dnl
|
||||
# | m4_undefine([active])dnl
|
||||
# | act1
|
||||
# | hooks
|
||||
# | act1
|
||||
@ -1682,20 +1685,32 @@ m4_defun([m4_join],
|
||||
# =>
|
||||
# => active
|
||||
#
|
||||
# It can also be used to create lists, although this particular usage was
|
||||
# broken prior to autoconf 2.62.
|
||||
# | m4_append([list], [one], [, ])dnl
|
||||
# | m4_append([list], [two], [, ])dnl
|
||||
# | m4_append([list], [three], [, ])dnl
|
||||
# | list
|
||||
# | m4_dquote(list)
|
||||
# => one, two, three
|
||||
# => [one],[two],[three]
|
||||
#
|
||||
# Use m4_builtin to avoid overhead of m4_defn.
|
||||
m4_define([m4_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_builtin([defn], [$1])[$3]])[$2])])
|
||||
|
||||
|
||||
# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# -----------------------------------------------
|
||||
# Like `m4_append', but append only if not yet present.
|
||||
# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR], [IF-UNIQ], [IF-DUP])
|
||||
# --------------------------------------------------------------------
|
||||
# Like `m4_append', but append only if not yet present. Additionally,
|
||||
# expand IF-UNIQ if STRING was appended, or IF-DUP if STRING was already
|
||||
# present.
|
||||
m4_define([m4_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_builtin([defn], [$1])[$3], [$3$2$3]), [-1],
|
||||
[m4_append($@)])],
|
||||
[m4_append($@)])])
|
||||
[m4_append([$1], [$2], [$3])$4], [$5])],
|
||||
[m4_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH])
|
||||
|
@ -42,6 +42,8 @@ AT_CHECK_M4SUGAR([-o-],, [$2], [$3])
|
||||
#
|
||||
# - m4_split
|
||||
#
|
||||
# - m4_append
|
||||
#
|
||||
# - m4_text_wrap
|
||||
# uses m4_split code.
|
||||
|
||||
@ -182,6 +184,73 @@ m4_split([foo='' bar=``])
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ----------- ##
|
||||
## m4_append. ##
|
||||
## ----------- ##
|
||||
|
||||
AT_SETUP([m4@&t@_append])
|
||||
|
||||
AT_CHECK_M4SUGAR_TEXT(
|
||||
[[m4_define([active], [ACTIVE])dnl
|
||||
m4_append([sentence], [This is an])dnl
|
||||
m4_append([sentence], [ active ])dnl
|
||||
m4_append([sentence], [symbol.])dnl
|
||||
sentence
|
||||
m4_undefine([active])dnl
|
||||
sentence
|
||||
m4_define([active], [ACTIVE])dnl
|
||||
m4_append([hooks], [m4_define([act1], [act2])])dnl
|
||||
m4_append([hooks], [m4_define([act2], [active])])dnl
|
||||
m4_undefine([active])dnl
|
||||
act1
|
||||
hooks
|
||||
act1
|
||||
dnl Test for bug fixed in 2.62 when separator is active.
|
||||
m4_define([a], [A])dnl
|
||||
m4_append_uniq([foo], [-], [a])dnl
|
||||
m4_append_uniq([foo], [-], [a])dnl
|
||||
m4_append_uniq([bar], [-], [a])dnl
|
||||
m4_append_uniq([bar], [~], [a])dnl
|
||||
m4_append_uniq([bar], [-], [a])dnl
|
||||
m4_defn([foo])
|
||||
m4_defn([bar])
|
||||
foo
|
||||
bar
|
||||
m4_append_uniq([blah], [one], [, ], [new], [existing])
|
||||
m4_append_uniq([blah], [two], [, ], [new], [existing])
|
||||
m4_append_uniq([blah], [two], [, ], [new], [existing])
|
||||
m4_append_uniq([blah], [three], [, ], [new], [existing])
|
||||
m4_append([blah], [two], [, ])dnl
|
||||
blah
|
||||
m4_dquote(blah)
|
||||
m4_append([list], [one], [[, ]])dnl
|
||||
m4_append([list], [two], [[, ]])dnl
|
||||
m4_append([list], [three], [[, ]])dnl
|
||||
list
|
||||
m4_dquote(list)
|
||||
]],
|
||||
[[This is an ACTIVE symbol.
|
||||
This is an active symbol.
|
||||
act1
|
||||
|
||||
active
|
||||
-
|
||||
-a~
|
||||
-
|
||||
-A~
|
||||
new
|
||||
new
|
||||
existing
|
||||
new
|
||||
one, two, three, two
|
||||
[one],[two],[three],[two]
|
||||
one, two, three
|
||||
[one, two, three]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## m4_text_wrap. ##
|
||||
## -------------- ##
|
||||
|
Loading…
Reference in New Issue
Block a user