Merge branch 'master' of /home/eggert/src/gnu/autoconf-savannah/

This commit is contained in:
Paul Eggert 2007-10-12 23:29:12 -07:00
commit a03734d05b
19 changed files with 1270 additions and 404 deletions

2
.gitignore vendored
View File

@ -11,3 +11,5 @@ autom4te.cache
.#*
CVS
*~
tags
TAGS

162
ChangeLog
View File

@ -1,3 +1,164 @@
2007-10-12 Eric Blake <ebb9@byu.net>
* doc/autoconf.texi (Text processing Macros): Fix bad merge.
(Reporting Messages): Fix underfull hbox.
Some more m4sugar documentation.
* lib/m4sugar/m4sugar.m4: Clean up macro order.
* doc/autoconf.texi (Programming in M4): Lighten the warning on
using m4sugar; it is stabilizing and useful.
(Redefined M4 Macros): Touch up wording on M4 builtins; sort. Add
m4_divert, m4_undivert, __file__, __line__, __oline__.
(Diagnostics): New node, documenting m4_assert, m4_errprintn,
m4_fatal, m4_location, m4_warn.
(Diversion support): New node, documenting m4_divert_push,
m4_divert_pop, m4_divert_text, m4_divert_once.
(Text processing Macros): Sort. Add m4_flatten, m4_join,
m4_newline, m4_strip, m4_text_box, m4_text_wrap.
(Reporting Messages): Mark AC_DIAGNOSE, AC_WARNING, and AC_FATAL
as obsolescent.
(Printing Messages): Change cross-reference.
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.
* lib/autoconf/general.m4 (AC_AUTOCONF_VERSION): Likewise.
* tests/tools.at (autoconf: AC_AUTOCONF_VERSION): Likewise.
Suggested by Ralf Wildenhues.
Namespace cleanup.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE)
(_AC_OUTPUT_HEADERS_PREPARE): Convert here-doc delimiters into
autoconf namespace.
* doc/autoconf.texi (Programming in M4sugar, Forbidden Patterns)
(Programming in M4sh, Macro Names): Beef up description of
namespaces reserved for autoconf.
* configure: Regenerate.
2007-10-12 Eric Blake <ebb9@byu.net>
and Paolo Bonzini <bonzini@gnu.org>
Speed up execution of subset of testsuite.
* lib/autotest/general.m4 (TEST_FUNCTIONS): New diversion.
(AT_INIT) <at_func_test>: New shell function.
(AT_INIT) <at_myself>: New variable, set to absolute $as_myself.
(AT_INIT) <at_test_source> New variable, names file that holds
current test function definition.
(AT_SETUP): Start the shell function at_func_test_#, into the
TEST_FUNCTIONS diversion.
(AT_CLEANUP): End the shell function. Simplify the TESTS
diversion to invoke the function.
2007-10-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* .gitignore: Ignore tags and TAGS files.
2007-10-11 Eric Blake <ebb9@byu.net>
Config header generation followup.
* lib/autoconf/general.m4 (_AC_DEFINE_Q): Check for raw newlines,
which won't work with the preprocessor nor with the awk
implementation.
* tests/torture.at (Define a newline): Test raw newline detection,
removing the XFAIL.
* doc/autoconf.texi (Defining Symbols): Document recent change to
allow backslash-newline.
* THANKS: Update.
2007-10-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4: Put function braces in separate line.
2007-10-10 Eric Blake <ebb9@byu.net>
Avoid some overhead from m4_defn and m4_popdef.
* lib/m4sugar/m4sugar.m4 (m4_defn, m4_popdef, m4_undefine): Only
pass on first argument, since we are documented that way.
(m4_for, m4_append_uniq, m4_text_wrap): Optimize out defined-ness
check where it is safe to do so.
(m4_append): Likewise, and quote the separator.
(m4_text_box): Likewise, and avoid regex, also be robust to
expansion and quadrigraphs.
Another AC_DEFINE speedup.
* lib/autoconf/general.m4 (AC_DEFINE_TRACE): Move parameter
elision...
(_AC_DEFINE_Q): ...here, and only do it once.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Avoid overquoting.
* lib/m4sugar/m4sh.m4 (AS_LITERAL_IF): Fix m4_defn overquoting
introduced 2007-10-05.
Whitespace cleanup.
* lib/autoconf/general.m4: Use consistent indentation.
* configure: Regenerate.
* NEWS: Announce recent round of speed optimizations.
2007-10-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* NEWS: Announce shell function usage in Autotest.
2007-10-10 Eric Blake <ebb9@byu.net>
and Paul Eggert <eggert@cs.ucla.edu>
Reduce number of forks at startup.
* lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Speed up NLS
sanitization.
* configure: Regenerate.
2007-10-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
and Paul Eggert <eggert@cs.ucla.edu>
Use awk for config header generation.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Fix comments.
(_AC_OUTPUT_HEADERS_PREPARE): New macro. Rewrite of the config
header machinery for use with awk and placement outside the main
config.status instantiation loop. Retain multi-line defines
through backslash-newline combinations, do not split the script
any more.
(_AC_OUTPUT_HEADER): Simplify accordingly, use $AWK.
(_AC_OUTPUT_MAIN_LOOP): Call _AC_OUTPUT_HEADERS_PREPARE if
needed.
(AC_OUTPUT_MAKE_DEFS): Remove backslash-newline combinations
from define values.
* NEWS: Update.
* tests/torture.at (#define header templates): Extend test by
several more cases: white space before and after `#', macros
with parameters in config.hin and as defines, multi-line macro
values.
(Torturing config.status): Use a define value twice the length
in order to exercise the awk literal string limit.
(Substitute and define special characters): Also try special
delimiter, to exercise the special-case code.
Suggestion by Eric Lemings.
2007-10-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* tests/local.at (AT_COPYRIGHT): Bump copyright years.
2007-10-09 Eric Blake <ebb9@byu.net>
Improve header of bin/autoconf.
* lib/m4sugar/m4sh.m4 (AS_INIT): Add a 'generated from' notice.
* lib/autoconf/general.m4 (_AC_INIT_NOTICE): Override new notice
from M4sh.
* bin/autoconf.as: Put copyright up front in generated file.
* bin/autoconf.as (exit_missing_arg): Font-lock tweak.
2007-10-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* doc/install.texi (Basic Installation): Document `uninstall'.
* INSTALL: Regenerate.
Suggestion by Roberto Bagnara.
2007-10-08 Paul Eggert <eggert@cs.ucla.edu>
* doc/autoconf.texi (Limitations of Usual Tools): V7 awk had 'index'.
@ -41,6 +202,7 @@
at_func_check_skip, at_func_check_status, at_func_filter_trace,
at_func_log_failure shell functions. Use test -s to avoid
useless diff invocations.
(at_func_check_newline): Renamed from at_check_newline.
(AT_SETUP): Define AT_captured_files to empty.
(AT_DIFF_STDERR(*), AT_DIFF_STDOUT(*)): New, extracted from _AT_CHECK.
(_AT_CHECK): Replace m4_case with m4_ifdef/m4_indir. Use all

View File

@ -67,6 +67,9 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
6. Often, you can also type `make uninstall' to remove the installed
files again.
Compilers and Options
=====================

70
NEWS
View File

@ -2,13 +2,25 @@ GNU Autoconf NEWS - User visible changes.
* Major changes in Autoconf 2.61b (????-??-??)
** Many optimizations have been applied to make overall execution faster.
** Autotest now makes use of shell functions.
** config.status now uses awk instead of sed also for config headers.
- As a side effect, AC_DEFINE and AC_DEFINE_UNQUOTED now handle multi-line
values, i.e., backslash-newline combinations are handled correctly.
Further, for config headers, the total size of values is not limited by
the POSIX length limit of text lines any more, only each single line.
** Autoconf is now licensed under the General Public License version 3
or later (GPLv3+). As with earlier versions, the license includes
an exception clause so that you may release a configure script
generated by autoconf under the license of your own program.
FIXME - revisit this line once exception clause is finalized.
** New Autoconf macros AC_OPENMP, AC_PATH_PROGS_FEATURE_CHECK, AC_VERSION.
** New Autoconf macros:
AC_AUTOCONF_VERSION AC_OPENMP AC_PATH_PROGS_FEATURE_CHECK
** AC_C_BIGENDIAN now supports universal binaries a la Mac OS X.
@ -61,10 +73,49 @@ 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_VERSION instead.
** Documentation for m4sugar is improved.
- The following macros were previously available as undocumented
interfaces; the macros are now documented as stable interfaces.
__oline__ m4_assert m4_bmatch m4_bpatsubsts m4_case
m4_default m4_divert_once m4_divert_pop m4_divert_push
m4_divert_text m4_do m4_errprintn m4_fatal m4_flatten
m4_ifndef m4_ifset m4_ifval m4_ifvaln m4_location
m4_n m4_shiftn m4_strip 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_join m4_text_box 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.
@ -95,6 +146,15 @@ GNU Autoconf NEWS - User visible changes.
practical importance on current systems. New programs need not use
AC_C_LONG_DOUBLE. We have no current plans to remove it.
** AC_DIAGNOSE, AC_WARNING, and AC_FATAL are obsolescent.
The documentation now favors the use of M4sugar macros m4_warn and
m4_fatal, since the naming makes it more obvious that the
diagnostics are associated with M4 expansion (ie. when running
`autoconf'), and offers less confusion with the AC_MSG_ERROR,
AC_MSG_FAILURE, and AC_MSG_WARN macros which manage diagnostics
when running `configure'. We have no current plans to remove these
macros.
* Major changes in Autoconf 2.61a (2006-12-11)
** AC_FUNC_FSEEKO was broken in 2.61; it didn't make fseeko and ftello visible

1
THANKS
View File

@ -96,6 +96,7 @@ Enrique Robledo Arnuncio enrique.robledo@wanadoo.es
Erez Zadok ezk@cs.columbia.edu
Eric Backus ericb@lsid.hp.com
Eric Blake ebb9@byu.net
Eric Lemings lemings@roguewave.com
Eric Mumpower nocturne@mit.edu
Eric Paire ?
Eric Sunshine sunshine@sunshineco.com

View File

@ -1,4 +1,6 @@
AS_INIT[]dnl -*- shell-script -*-
m4_divert_push([HEADER-COPYRIGHT])dnl
# @configure_input@
# autoconf -- create `configure' using m4 macros
# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003,
@ -17,6 +19,8 @@ AS_INIT[]dnl -*- shell-script -*-
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_divert_pop([HEADER-COPYRIGHT])dnl back to BODY
usage=["\
Usage: $0 [OPTION] ... [TEMPLATE-FILE]
@ -73,7 +77,7 @@ exit_missing_arg='
AS_ECHO(["$as_me: option \`$[1]'\'' requires an argument"]) >&2
AS_ECHO(["$help"]) >&2
exit 1
'
' # restore font-lock: "
# Variables.
: ${AUTOM4TE='@bindir@/@autom4te-name@'}

52
configure vendored
View File

@ -128,17 +128,10 @@ PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
@ -808,7 +801,7 @@ do
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
@ -835,7 +828,7 @@ do
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
@ -1040,7 +1033,7 @@ do
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
@ -1057,7 +1050,7 @@ do
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
@ -2966,6 +2959,12 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# take arguments), then branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
ac_script='
:mline
/\\$/{
N
s,\\\n,,
b mline
}
t clear
:clear
s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
@ -3146,17 +3145,10 @@ PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
@ -3582,7 +3574,7 @@ done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF
cat >>"\$tmp/subs1.awk" <<\CEOF
cat >>"\$tmp/subs1.awk" <<\_ACAWK
_ACEOF
sed -n '
h
@ -3629,8 +3621,8 @@ t delim
' >>$CONFIG_STATUS
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF
CEOF
cat >>"\$tmp/subs1.awk" <<CEOF
_ACAWK
cat >>"\$tmp/subs1.awk" <<_ACAWK
for (key in S) S_is_set[key] = 1
FS = ""
@ -3655,7 +3647,7 @@ cat >>"\$tmp/subs1.awk" <<CEOF
print line
}
CEOF
_ACAWK
sed "s/\$ac_cr\\\$//; s/\$ac_cr/\$ac_cs_awk_cr/g" < "\$tmp/subs1.awk" > "\$tmp/subs.awk"
_ACEOF

View File

@ -449,6 +449,8 @@ Using @command{autom4te}
Programming in M4sugar
* Redefined M4 Macros:: M4 builtins changed in M4sugar
* Diagnostic Macros:: Diagnostic messages from M4sugar
* Diversion support:: Diversions in M4sugar
* Conditional constructs:: Conditions in M4
* Looping constructs:: Iteration in M4
* Evaluation Macros:: More quotation and evaluation control
@ -1792,8 +1794,8 @@ This macro is the only macro that may be used before @code{AC_INIT}, but
for consistency, you are invited not to do so.
@end defmac
@defmac AC_VERSION
@acindex{VERSION}
@defmac AC_AUTOCONF_VERSION
@acindex{AUTOCONF_VERSION}
This macro was introduced in Autoconf 2.62. It identifies the version
of Autoconf that is currently parsing the input file, in a format
suitable for @code{m4_version_compare} (@pxref{m4_version_compare}); in
@ -8494,10 +8496,15 @@ terminated by an ellipsis @samp{...} if C99 syntax is employed.
backslash-newlines, universal character names, or non-@acronym{ASCII}
characters.
@var{value} should not contain literal newlines, and if you are not
using @code{AC_CONFIG_HEADERS} it should not contain any @samp{#}
characters, as @command{make} tends to eat them. To use a shell variable,
use @code{AC_DEFINE_UNQUOTED} instead.
@var{value} may contain backslash-escaped newlines, which will be
preserved if you use @code{AC_CONFIG_HEADERS} but flattened if passed
via @code{@@DEFS@@} (with no effect on the compilation, since the
preprocessor sees only one line in the first place). @var{value} should
not contain raw newlines. If you are not using
@code{AC_CONFIG_HEADERS}, @var{value} should not contain any @samp{#}
characters, as @command{make} tends to eat them. To use a shell
variable, use @code{AC_DEFINE_UNQUOTED} instead.
@var{description} is only useful if you are using
@code{AC_CONFIG_HEADERS}. In this case, @var{description} is put into
the generated @file{config.h.in} as the comment before the macro define.
@ -8993,7 +9000,7 @@ only be made to the macro definitions and all the callers change
automatically.
To diagnose static issues, i.e., when @command{autoconf} is run, see
@ref{Reporting Messages}.
@ref{Diagnostic Macros}.
@defmac AC_MSG_CHECKING (@var{feature-description})
@acindex{MSG_CHECKING}
@ -9082,9 +9089,9 @@ Autoconf is written on top of two layers: @dfn{M4sugar}, which provides
convenient macros for pure M4 programming, and @dfn{M4sh}, which
provides macros dedicated to shell script generation.
As of this version of Autoconf, these two layers are still experimental,
and their interface might change in the future. As a matter of fact,
@emph{anything that is not documented must not be used}.
As of this version of Autoconf, these two layers still contain
experimental macros, whose interface might change in the future. As a
matter of fact, @emph{anything that is not documented must not be used}.
@menu
* M4 Quotation:: Protecting macros from unwanted expansion
@ -10068,8 +10075,14 @@ macros. M4sugar introduces additional generic macros. Its name was
coined by Lars J. Aas: ``Readability And Greater Understanding Stands 4
M4sugar''.
M4sugar reserves the macro namespace @samp{^_m4_} for internal use, and
the macro namespace @samp{^m4_} for M4sugar macros. You should not
define your own macros into these namespaces.
@menu
* Redefined M4 Macros:: M4 builtins changed in M4sugar
* Diagnostic Macros:: Diagnostic messages from M4sugar
* Diversion support:: Diversions in M4sugar
* Conditional constructs:: Conditions in M4
* Looping constructs:: Iteration in M4
* Evaluation Macros:: More quotation and evaluation control
@ -10106,27 +10119,98 @@ M4sugar''.
@msindex{traceoff}
@msindex{traceon}
@msindex{translit}
@msindex{undefine}
With a few exceptions, all the M4 native macros are moved in the
@samp{m4_} pseudo-namespace, e.g., M4sugar renames @code{define} as
@code{m4_define} etc.
The list of macros unchanged from M4, except for their name, is:
@itemize @minus
@item m4_builtin
@item m4_changecom
@item m4_changequote
@item m4_debugfile
@item m4_debugmode
@item m4_decr
@item m4_define
@item m4_divnum
@item m4_dumpdef
@item m4_errprint
@item m4_esyscmd
@item m4_eval
@item m4_format
@item m4_ifdef
@item m4_incr
@item m4_index
@item m4_indir
@item m4_len
@item m4_pushdef
@item m4_shift
@item m4_substr
@item m4_syscmd
@item m4_sysval
@item m4_traceoff
@item m4_traceon
@item m4_translit
@end itemize
Some M4 macros are redefined, and are slightly incompatible with their
native equivalent.
@defmac __file__
@defmacx __line__
@MSindex __file__
@MSindex __line__
All M4 macros starting with @samp{__} retain their original name: for
example, no @code{m4__file__} is defined.
@end defmac
@defmac __oline__
@MSindex __oline__
This is not technically a macro, but a feature of Autom4te. The
sequence @code{__oline__} can be used similarly to the other m4sugar
location macros, but rather than expanding to the location of the input
file, it is translated to the line number where it appears in the output
file after all other M4 expansions.
@end defmac
@defmac dnl
@msindex{dnl}
@MSindex dnl
This macro kept its original name: no @code{m4_dnl} is defined.
@end defmac
@defmac m4_bpatsubst (@var{string}, @var{regexp}, @ovar{replacement})
@msindex{bpatsubst}
This macro corresponds to @code{patsubst}. The name @code{m4_patsubst}
is kept for future versions of M4sugar, once @acronym{GNU} M4 2.0 is
released and supports extended regular expression syntax.
@end defmac
@defmac m4_bregexp (@var{string}, @var{regexp}, @ovar{replacement})
@msindex{bregexp}
This macro corresponds to @code{regexp}. The name @code{m4_regexp}
is kept for future versions of M4sugar, once @acronym{GNU} M4 2.0 is
released and supports extended regular expression syntax.
@end defmac
@defmac m4_defn (@var{macro})
@msindex{defn}
Unlike the M4 builtin, this macro fails if @var{macro} is not
defined. See @code{m4_undefine}.
defined. Also, while newer M4 can concatenate multiple definitions,
this version currently only supports a single @var{macro}. See
@code{m4_undefine}.
@end defmac
@c FIXME: Need to document m4_divert, m4_undivert, m4_divert_push,
@c m4_divert_pop, m4_divert_text, m4_divert_once
@defmac m4_divert (@var{diversion})
@msindex{divert}
M4sugar relies heavily on diversions, so rather than behaving as a
primitive, @code{m4_divert} behaves like:
@example
m4_divert_pop()m4_divert_push([@var{diversion}])
@end example
@noindent
@xref{Diversion support}, for more details about the use of the
diversion stack.
@end defmac
@defmac m4_exit (@var{exit-status})
@msindex{exit}
@ -10165,30 +10249,19 @@ and both have the secure semantics regardless of which macro the
underlying M4 provides.
@end defmac
@defmac m4_bpatsubst (@var{string}, @var{regexp}, @ovar{replacement})
@msindex{bpatsubst}
This macro corresponds to @code{patsubst}. The name @code{m4_patsubst}
is kept for future versions of M4sugar, once @acronym{GNU} M4 2.0 is
released and supports extended regular expression syntax.
@end defmac
@defmac m4_popdef (@var{macro})
@msindex{popdef}
Unlike the M4 builtin, this macro fails if @var{macro} is not
defined. See @code{m4_undefine}.
@end defmac
@defmac m4_bregexp (@var{string}, @var{regexp}, @ovar{replacement})
@msindex{bregexp}
This macro corresponds to @code{regexp}. The name @code{m4_regexp}
is kept for future versions of M4sugar, once @acronym{GNU} M4 2.0 is
released and supports extended regular expression syntax.
defined. Also, while newer M4 can pop multiple definitions at once,
this version currently only supports a single @var{macro}. See
@code{m4_undefine}.
@end defmac
@defmac m4_undefine (@var{macro})
@msindex{undefine}
Unlike the M4 builtin, this macro fails if @var{macro} is not
defined. Use
defined. Also, while newer M4 can undefine multiple definitions at
once, this version currently only supports a single @var{macro}. Use
@example
m4_ifdef([@var{macro}], [m4_undefine([@var{macro}])])
@ -10198,6 +10271,15 @@ m4_ifdef([@var{macro}], [m4_undefine([@var{macro}])])
to recover the behavior of the builtin.
@end defmac
@defmac m4_undivert (@var{diversion})
@msindex{undivert}
Unlike the M4 builtin, only one diversion can be undiverted per
invocation. Also, since the M4sugar diversion stack prefers named
diversions, the use of @code{m4_undivert} to include files is risky.
@xref{Diversion support}, for more details about the use of the
diversion stack.
@end defmac
@defmac m4_wrap (@var{text})
@msindex{wrap}
This macro corresponds to @code{m4wrap}.
@ -10225,14 +10307,160 @@ m4_wrap([foo])
@end defmac
@node Diagnostic Macros
@subsection Diagnostic messages from M4sugar
@cindex Messages, from @command{M4sugar}
When macros statically diagnose abnormal situations, benign or fatal,
they should report them using these macros. For issuing dynamic issues,
i.e., when @command{configure} is run, see @ref{Printing Messages}.
@defmac m4_assert (@var{expression}, @dvar{exit-status, 1})
@msindex{assert}
Assert that the arithmetic @var{expression} evaluates to non-zero.
Otherwise, issue a fatal error, and exit @command{autom4te} with
@var{exit-status}.
@end defmac
@defmac m4_errprintn (@var{message})
@msindex{errprintn}
Similar to the builtin @code{m4_errprint}, except that a newline is
guaranteed after @var{message}.
@end defmac
@anchor{m4_fatal}
@defmac m4_fatal
@msindex{fatal}
Report a severe error @var{message} prefixed with the current location,
and have @command{autom4te} die.
@end defmac
@defmac m4_location
@msindex{location}
Useful as a prefix in a message line. Short for:
@example
__file__:__line__
@end example
@end defmac
@anchor{m4_warn}
@defmac m4_warn (@var{category}, @var{message})
@msindex{warn}
Report @var{message} as a warning (or as an error if requested by the
user) if warnings of the @var{category} are turned on. If the message
is emitted, it is prefixed with the current location, and followed by a
call trace of all macros defined via @code{AC_DEFUN} used to get to the
current expansion. You are encouraged to use standard categories, which
currently include:
@table @samp
@item all
messages that don't fall into one of the following categories. Use of an
empty @var{category} is equivalent.
@item cross
related to cross compilation issues.
@item obsolete
use of an obsolete construct.
@item syntax
dubious syntactic constructs, incorrectly ordered macro calls.
@end table
@end defmac
@node Diversion support
@subsection Diversion support
M4sugar makes heavy use of diversions, because it is often the case that
text that must appear early in the output is not discovered until late
in the input. Additionally, some of the topological sorting algorithms
used in resolving macro dependencies use diversions. Therefore, most
macros should not need to change diversions directly, but rather rely on
higher-level M4sugar macros to manage diversions transparently.
To make diversion management easier, M4sugar uses the concept of named
diversions. Rather than using diversion numbers directly, it is nicer
to associate a name with each diversion; the diversion number associated
with a particular diversion name is an implementation detail, so you
should only use diversion names.
M4sugar defines two named diversions.
@table @code
@item KILL
Text written to this diversion is discarded. This is the default
diversion once M4sugar is initialized.
@item GROW
This diversion is used behind the scenes by topological sorting macros,
such as @code{AC_REQUIRE}.
@end table
M4sh adds several more named diversions.
@table @code
@item BINSH
This diversion is reserved for the @samp{#!} interpreter line.
@item HEADER-REVISION
This diversion holds text from @code{AC_REVISION}.
@item HEADER-COMMENT
This diversion holds comments about the purpose of a file.
@item HEADER-COPYRIGHT
This diversion is managed by @code{AC_COPYRIGHT}.
@item M4SH-SANITIZE
This diversion contains M4sh sanitization code, used to ensure M4sh is
executing in a reasonable shell environment.
@item M4SH-INIT
This diversion contains M4sh initialization code, initializing variables
that are required by other M4sh macros.
@item BODY
This diversion contains the body of the shell code, and is the default
diversion once M4sh is initialized.
@end table
For now, the named diversions of Autoconf, Autoheader, and Autotest are
not documented.
@defmac m4_divert_once (@var{diversion}, @ovar{content})
@msindex{divert_once}
Similar to @code{m4_divert_text}, except that @var{content} is only
output to @var{diversion} if this is the first time that
@code{m4_divert_once} has been called with its particular arguments.
@end defmac
@defmac m4_divert_pop (@ovar{diversion})
@msindex{divert_pop}
If provided, check that the current diversion is indeed @var{diversion}.
Then change to the diversion located earlier on the stack, giving an
error if an attempt is made to pop beyond the initial m4sugar diversion
of @code{KILL}.
@end defmac
@defmac m4_divert_push (@var{diversion})
@msindex{divert_push}
Remember the former diversion on the diversion stack, and output
subsequent text into @var{diversion}. M4sugar maintains a diversion
stack, and issues an error if there is not a matching pop for every
push.
@end defmac
@defmac m4_divert_text (@var{diversion}, @ovar{content})
@msindex{divert_text}
Output @var{content} and a newline into @var{diversion}, without
affecting the current diversion. Shorthand for:
@example
m4_divert_push([@var{diversion}])@var{content}
m4_divert_pop([@var{diversion}])dnl
@end example
@end defmac
@node Conditional constructs
@subsection Conditional constructs
The following macros provide additional conditional contructs, as
convenience wrappers around @code{m4_if}.
@defmac m4_bmatch (@var{string}, @var{regex-1}, @var{value-1}, @dots{}, @
@ovar{default})
@defmac m4_bmatch (@var{string}, @var{regex-1}, @var{value-1}, @
@ovar{regex-2}, @ovar{value-2}, @dots{}, @ovar{default})
@msindex{bmatch}
The string @var{string} is repeatedly compared against a series of
@var{regex} arguments; if a match is found, the expansion is the
@ -10241,7 +10469,8 @@ corresponding @var{value}, otherwise, the macro moves on to the next
@var{default}, or nothing.
@end defmac
@defmac m4_bpatsubsts (@var{string}, @var{regex-1}, @var{subst-1}, @dots{})
@defmac m4_bpatsubsts (@var{string}, @var{regex-1}, @var{subst-1}, @
@ovar{regex-2}, @ovar{subst-2}, @dots{})
@msindex{bpatsubsts}
The string @var{string} is altered by @var{regex-1} and @var{subst-1},
as if by:
@ -10260,8 +10489,8 @@ will line up with the extra quotations, and not the characters of the
original string.
@end defmac
@defmac m4_case (@var{string}, @var{value-1}, @var{if-value-1}, @dots{}, @
@ovar{default})
@defmac m4_case (@var{string}, @var{value-1}, @var{if-value-1}, @
@ovar{value-2}, @ovar{if-value-2}, @dots{}, @ovar{default})
@msindex{case}
Test @var{string} against multiple @var{value} possibilities, resulting
in the first @var{if-value} for a match, or in the optional
@ -10274,13 +10503,14 @@ m4_if([@var{string}], [@var{value-1}], [@var{if-value-1}],
@end defmac
@defmac m4_cond (@var{test-1}, @var{value-1}, @var{if-value-1}, @
@var{test-2}, @var{value-2}, @var{if-value-2}, @dots{}, @ovar{default})
@ovar{test-2}, @ovar{value-2}, @ovar{if-value-2}, @dots{}, @ovar{default})
@msindex{cond}
Similar to @code{m4_if}, except that each @var{test} is expanded only
when it is encountered. This is useful for short-circuiting expensive
tests; while @code{m4_if} requires all its strings to be expanded up
front before doing comparisons, @code{m4_cond} only expands a @var{test}
when all earlier tests have failed.
This macro was introduced in Autoconf 2.62. Similar to @code{m4_if},
except that each @var{test} is expanded only when it is encountered.
This is useful for short-circuiting expensive tests; while @code{m4_if}
requires all its strings to be expanded up front before doing
comparisons, @code{m4_cond} only expands a @var{test} when all earlier
tests have failed.
For an example, these two sequences give the same result, but in the
case where @samp{$1} does not contain a backslash, the @code{m4_cond}
@ -10410,8 +10640,8 @@ fewer @code{dnl} to result in the same expansion.
@code{m4_shiftn} performs @var{count} iterations of @code{m4_shift},
along with validation that enough arguments were passed in to match the
shift count. @code{m4_shift2} and @code{m4_shift3} are specializations
of @code{m4_shiftn} that are more efficient for two and three shifts,
respectively.
of @code{m4_shiftn}, introduced in Autoconf 2.62, and are more efficient
for two and three shifts, respectively.
@end defmac
@ -10464,19 +10694,156 @@ mkargs
@end example
@node Text processing Macros
@subsection Text processing Macros
The following macros may be used to manipulate strings in M4.
They are not intended for casual use.
@defmac m4_append (@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. 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
@defmac m4_flatten (@var{string})
@msindex{flatten}
Flatten @var{string} into a single line. Delete all backslash-newline
pairs, and replace all remaining newlines with a space. The result is
still a quoted string.
@end defmac
@defmac m4_join (@ovar{separator}, @var{args}@dots{})
@msindex{join}
Concatenate each @var{arg}, separated by @var{separator}. The result is
a quoted string.
@end defmac
@defmac m4_newline
@msindex{newline}
This macro was introduced in Autoconf 2.62, and expands to a newline.
It is primarily useful for maintaining macro formatting, and ensuring
that M4 does not discard leading whitespace during argument collection.
@end defmac
@defmac m4_normalize (@var{string})
@msindex{normalize}
Remove leading and trailing spaces and tabs, sequences of
backslash-then-newline, and replace multiple spaces, tabs, and newlines
with a single space. This is a combination of @code{m4_flatten} and
@code{m4_strip}.
@end defmac
@defmac m4_re_escape (@var{string})
@msindex{re_escape}
Backslash-escape all characters in @var{string} that are active in
regexps.
@end defmac
@defmac m4_split (@var{string}, @dvar{regexp, [\t ]+})
@msindex{split}
Split @var{string} into an M4 list of elements quoted by @samp{[} and
@samp{]}, while keeping white space at the beginning and at the end.
If @var{regexp} is given, use it instead of @samp{[\t ]+} for splitting.
If @var{string} is empty, the result is an empty list.
@end defmac
@defmac m4_strip (@var{string})
@msindex{strip}
Strip whitespace from @var{string}. Sequences of space and tab are
reduced to a single space, then leading and trailing spaces are
removed. The result is still a quoted string.
@end defmac
@defmac m4_text_box (@var{message}, @dvar{frame, -})
@msindex{text_box}
Add a text box around @var{message}, using @var{frame} as the border
character above and below the message. The frame correctly accounts for
the subsequent expansion of @var{message}. For example:
@example
m4_define([macro], [abc])dnl
m4_text_box([macro])
@result{}## --- ##
@result{}## abc ##
@result{}## --- ##
@end example
@end defmac
@defmac m4_text_wrap (@var{string}, @ovar{prefix}, @
@dvar{prefix1, @var{prefix}}, @dvar{width, 79})
@msindex{text_wrap}
Break @var{string} into a series of whitespace-separated words, then
format those words to wrap within @var{width} columns, and without
trailing whitespace. If given, @var{prefix1} is prepended to the first
line, and @var{prefix} is prepended to each continuation line. As a
special case, if @var{prefix1} is longer than @var{prefix}, the first
line will consist solely of @var{prefix1}.
For some examples:
@example
m4_text_wrap([Short string */], [@ @ @ ], [/* ], [20])
@result{}/* Short string */
m4_text_wrap([Much longer string */], [@ @ @ ], [/* ], [20])
@result{}/* Much longer
@result{}@ @ @ string */
m4_text_wrap([Short doc.], [@ @ @ @ @ @ @ @ @ @ ], [@ @ --short ], [30])
@result{}@ @ --short Short doc.
m4_text_wrap([Short doc.], [@ @ @ @ @ @ @ @ @ @ ], [@ @ --too-wide ], [30])
@result{}@ @ --too-wide
@result{}@ @ @ @ @ @ @ @ @ @ Short doc.
m4_text_wrap([Super long documentation.], [@ @ @ @ @ ],
[@ @ --too-wide ], 30)
@result{}@ @ --too-wide
@result{}@ @ @ @ @ Super long
@result{}@ @ @ @ @ documentation.
@end example
@end defmac
@defmac m4_tolower (@var{string})
@defmacx m4_toupper (@var{string})
@msindex{tolower}
@ -10485,36 +10852,10 @@ Return @var{string} with letters converted to upper or lower case,
respectively.
@end defmac
@defmac m4_split (@var{string}, @ovar{regexp})
@msindex{split}
Split @var{string} into an M4 list of elements quoted by @samp{[} and
@samp{]}, while keeping white space at the beginning and at the end.
If @var{regexp} is given, use it instead of @samp{[\t ]+} for splitting.
If @var{string} is empty, the result is an empty list.
@end defmac
@defmac m4_normalize (@var{string})
@msindex{normalize}
Remove leading and trailing spaces and tabs, sequences of
backslash-then-newline, and replace multiple spaces and tabs with a
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})
@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.
@end defmac
@anchor{m4_version_compare}
@defmac m4_version_compare (@var{version-1}, @var{version-2})
@msindex{version_compare}
Introduced in autoconf 2.53. Compare the version strings
This macro was introduced in Autoconf 2.53. Compare the version strings
@var{version-1} and @var{version-2}, and expand to @samp{-1} if
@var{version-1} is smaller, @samp{0} if they are the same, or @samp{1}
@var{version-2} is smaller. Version strings must be a list of elements
@ -10534,6 +10875,8 @@ m4_version_compare([1.2], [1.1.1a])
@result{}1
m4_version_compare([1.0], [1])
@result{}0
m4_version_compare([1.1a], [1,10])
@result{}-1
@end example
@end defmac
@ -10549,7 +10892,9 @@ instance, if an Autoconf @file{configure} script includes tokens such as
@samp{AC_DEFINE}, or @samp{dnl}, then most probably something went
wrong (typically a macro was not evaluated because of overquotation).
M4sugar forbids all the tokens matching @samp{^m4_} and @samp{^dnl$}.
M4sugar forbids all the tokens matching @samp{^_?m4_} and @samp{^dnl$}.
Additional layers, such as M4sh and Autoconf, add additional forbidden
patterns to the list.
@defmac m4_pattern_forbid (@var{pattern})
@msindex{pattern_forbid}
@ -10558,8 +10903,9 @@ Comments are not checked; this can be a problem if, for instance, you
have some macro left unexpanded after an @samp{#include}. No consensus
is currently found in the Autoconf community, as some people consider it
should be valid to name macros in comments (which doesn't make sense to
the author of this documentation, as @samp{#}-comments should document
the output, not the input, documented by @samp{dnl} comments).
the authors of this documentation: input, such as macros, should be
documented by @samp{dnl} comments; reserving @samp{#}-comments to
document the output).
@end defmac
Of course, you might encounter exceptions to these generic rules, for
@ -10601,6 +10947,13 @@ A mess; trouble. [Obs.] --Beau.@: & Fl.
For the time being, it is not mature enough to be widely used.
M4sh reserves the M4 macro namespace @samp{^_AS_} for internal use, and
the namespace @samp{^AS_} for M4sh macros. It also reserves the shell
and environment variable namespace @samp{^as_}, and the here-doc
delimiter namespace @samp{^_AS[A-Z]} in the output file. You should not
define your own macros or output shell code that conflicts with these
namespaces.
M4sh provides portable alternatives for some common shell constructs
that unfortunately are not portable in practice.
@ -10846,14 +11199,36 @@ that produce no output, such as @code{AC_REQUIRE}.
@node Macro Names
@section Macro Names
All of the Autoconf macros have all-uppercase names starting with
@samp{AC_} to prevent them from accidentally conflicting with other
text. All shell variables that they use for internal purposes have
mostly-lowercase names starting with @samp{ac_}. To ensure that your
macros don't conflict with present or future Autoconf macros, you should
prefix your own macro names and any shell variables they use with some
other sequence. Possibilities include your initials, or an abbreviation
for the name of your organization or software package.
All of the public Autoconf macros have all-uppercase names in the
namespace @samp{^AC_} to prevent them from accidentally conflicting with
other text; Autoconf also reserves the namespace @samp{^_AC_} for
internal macros. All shell variables that they use for internal
purposes have mostly-lowercase names starting with @samp{ac_}. Autoconf
also uses here-doc delimiters in the namespace @samp{^_AC[A-Z]}. During
@command{configure}, files produced by Autoconf make heavy use of the
file system namespace @samp{^conf}.
Since Autoconf is built on top of M4sugar (@pxref{Programming in
M4sugar}) and M4sh (@pxref{Programming in M4sh}), you must also be aware
of those namespaces (@samp{^_?\(m4\|AS\)_}). And since
@file{configure.ac} is also designed to be scanned by Autoheader,
Autoscan, Autoupdate, and Automake, you should be aware of the
@samp{^_?A[HNUM]_} namespaces. In general, you @emph{should not use}
the namespace of a package that does not own the macro or shell code you
are writing.
To ensure that your macros don't conflict with present or future
Autoconf macros, you should prefix your own macro names and any shell
variables they use with some other sequence. Possibilities include your
initials, or an abbreviation for the name of your organization or
software package. Historically, people have not always followed the
rule of using a namespace appropriate for their package, and this has
made it difficult for determining the origin of a macro (and where to
report bugs about that macro), as well as difficult for the true
namespace owner to add new macros without interference from pre-existing
uses of third-party macros. Perhaps the best example of this confusion
is the @code{AM_GNU_GETTEXT} macro, which belongs, not to Automake, but
to Gettext.
Most of the Autoconf macros' names follow a structured naming convention
that indicates the kind of feature check by the name. The macro names
@ -10862,7 +11237,8 @@ general to most specific. The names of their cache variables use the
same convention (@pxref{Cache Variable Names}, for more information on
them).
The first word of the name after @samp{AC_} usually tells the category
The first word of the name after the namepace initials (such as
@samp{AC_}) usually tells the category
of the feature being tested. Here are the categories used in Autoconf for
specific test macros, the kind of macro that you are more likely to
write. They are also used for cache variables, in all-lowercase. Use
@ -10910,46 +11286,57 @@ macro does. For example, @code{AC_PATH_X} has internal macros
@section Reporting Messages
@cindex Messages, from @command{autoconf}
When macros statically diagnose abnormal situations, benign or fatal,
they should report them using these macros. For dynamic issues, i.e.,
when @command{configure} is run, see @ref{Printing Messages}.
When macros statically diagnose abnormal situations, benign or fatal, it
is possible to make @command{autoconf} detect the problem, and refuse to
create @file{configure} in the case of an error. The macros in this
section are considered obsolescent, and new code should use M4sugar
macros for this purpose, see @ref{Diagnostic Macros}.
On the other hand, it is possible to want to detect errors when
@command{configure} is run, which are dependent on the environment of
the user rather than the maintainer. For dynamic diagnostics, see
@ref{Printing Messages}.
@defmac AC_DIAGNOSE (@var{category}, @var{message})
@acindex{DIAGNOSE}
Report @var{message} as a warning (or as an error if requested by the
user) if warnings of the @var{category} are turned on. You are
encouraged to use standard categories, which currently include:
@table @samp
@item all
messages that don't fall into one of the following categories. Use of an
empty @var{category} is equivalent.
@item cross
related to cross compilation issues.
@item obsolete
use of an obsolete construct.
@item syntax
dubious syntactic constructs, incorrectly ordered macro calls.
@end table
user) if warnings of the @var{category} are turned on. This macro is
obsolescent; you are encouraged to use:
@example
m4_warn([@var{category}], [@var{message}])
@end example
@noindent
instead. @xref{m4_warn}, for more details, including valid
@var{category} names.
@end defmac
@defmac AC_WARNING (@var{message})
@acindex{WARNING}
Equivalent to @samp{AC_DIAGNOSE([syntax], @var{message})}, but you are
strongly encouraged to use a finer grained category.
Report @var{message} as a syntax warning. This macro is obsolescent;
you are encouraged to use:
@example
m4_warn([syntax], [@var{message}])
@end example
@noindent
instead. @xref{m4_warn}, for more details, as well as better
finer-grained categories of warnings (not all problems have to do with
syntax).
@end defmac
@defmac AC_FATAL (@var{message})
@acindex{FATAL}
Report a severe error @var{message}, and have @command{autoconf} die.
This macro is obsolescent; you are encouraged to use:
@example
m4_fatal([@var{message}])
@end example
@noindent
instead. @xref{m4_fatal}, for more details.
@end defmac
When the user runs @samp{autoconf -W error}, warnings from
@code{AC_DIAGNOSE} and @code{AC_WARNING} are reported as error, see
@ref{autoconf Invocation}.
@code{m4_warn} (including those issued through @code{AC_DIAGNOSE} and
@code{AC_WARNING}) are reported as errors, see @ref{autoconf Invocation}.
@node Dependencies Between Macros
@section Dependencies Between Macros

View File

@ -79,6 +79,10 @@ a @samp{make maintainer-clean} target, but that is intended mainly for
the package's developers. If you use it, you may have to get all sorts
of other programs in order to regenerate files that came with the
distribution.
@item
Often, you can also type @samp{make uninstall} to remove the installed
files again.
@end enumerate
@node Compilers and Options

View File

@ -1,6 +1,6 @@
# This file is part of Autoconf. -*- Autoconf -*-
# Checking for functions.
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
@ -88,7 +88,7 @@ AC_DEFUN([AC_CHECK_FUNCS],
for ac_func in $1
do
AC_CHECK_FUNC($ac_func,
[AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_func])]) $2],
[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$ac_func])) $2],
[$3])dnl
done
])

View File

@ -299,10 +299,10 @@ AU_DEFUN([AC_PREREQ],
m4_copy([m4_version_prereq], [AC_PREREQ])
# AC_VERSION
# ----------
# AC_AUTOCONF_VERSION
# -------------------
# The current version of Autoconf parsing this file.
m4_copy([m4_PACKAGE_VERSION], [AC_VERSION])
m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])
@ -320,8 +320,10 @@ m4_copy([m4_PACKAGE_VERSION], [AC_VERSION])
# _AC_INIT_NOTICE
# ---------------
# Provide useful headers; override the HEADER-COMMENT created by M4sh.
m4_define([_AC_INIT_NOTICE],
[m4_divert_text([HEADER-COMMENT],
[m4_divert_text([KILL], [m4_undivert([HEADER-COMMENT])])dnl
m4_divert_text([HEADER-COMMENT],
[@%:@ Guess values for system-dependent variables and create Makefiles.
@%:@ Generated by m4_PACKAGE_STRING[]dnl
m4_ifset([AC_PACKAGE_STRING], [ for AC_PACKAGE_STRING]).])
@ -977,7 +979,7 @@ m4_define([_AC_INIT_PARSE_ENABLE2],
"$2_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--$1-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
ac_unrecognized_sep=', ';;
esac
eval $2_$ac_useropt=m4_if([$1], [$2], [\$ac_optarg], [no]) ;;dnl
])
@ -2013,14 +2015,9 @@ AS_IDENTIFIER_IF([$1], [],
# AC_DEFINE_TRACE(CPP-SYMBOL)
# ---------------------------
# This macro is a wrapper around AC_DEFINE_TRACE_LITERAL which filters
# out non literal symbols.
#
# m4_index is roughly 5 to 8 times faster than m4_bpatsubst, so only
# use the regex when necessary.
# out non literal symbols. CPP-SYMBOL must not include any parameters.
m4_define([AC_DEFINE_TRACE],
[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL(
m4_if(m4_index([$1], [(]), [-1], [[$1]],
[m4_bpatsubst([[$1]], [(.*)])]))])])
[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL([$1])])])
# AC_DEFINE(VARIABLE, [VALUE], [DESCRIPTION])
@ -2039,9 +2036,23 @@ m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([], $@)])
# _AC_DEFINE_Q(QUOTE, VARIABLE, [VALUE], [DESCRIPTION])
# -----------------------------------------------------
# Internal function that performs common elements of AC_DEFINE{,_UNQUOTED}.
#
# m4_index is roughly 5 to 8 times faster than m4_bpatsubst, so only
# use the regex when necessary. AC_name is defined with over-quotation,
# so that we can avoid m4_defn.
m4_define([_AC_DEFINE_Q],
[AC_DEFINE_TRACE([$2])dnl
m4_ifval([$4], [AH_TEMPLATE(m4_bpatsubst([[$2]], [(.*)]), [$4])])dnl
[m4_pushdef([AC_name], m4_if(m4_index([$2], [(]), [-1], [[[$2]]],
[m4_bpatsubst([[[$2]]], [(.*)])]))dnl
AC_DEFINE_TRACE(AC_name)dnl
m4_cond([m4_index([$3], [
])], [-1], [],
[AS_LITERAL_IF([$3], [m4_bregexp([[$3]], [[^\\]
], [-])])], [], [],
[m4_warn([syntax], [AC_DEFINE]m4_ifval([$1], [], [[_UNQUOTED]])dnl
[: `$3' is not a valid preprocessor define value])])dnl
m4_ifval([$4], [AH_TEMPLATE(AC_name, [$4])])dnl
m4_popdef([AC_name])dnl
cat >>confdefs.h <<$1_ACEOF
[@%:@define] $2 m4_if($#, 2, 1, [$3])
_ACEOF

View File

@ -321,11 +321,11 @@ m4_define([_AC_AWK_LITERAL_LIMIT],
# _AC_OUTPUT_FILES_PREPARE
# ------------------------
# Create the sed scripts needed for CONFIG_FILES.
# Create the awk scripts needed for CONFIG_FILES.
# Support multiline substitutions and make sure that the substitutions are
# not evaluated recursively.
# The intention is to have readable config.status and configure, even
# though this m4 code might be scaring.
# though this m4 code might be scary.
#
# This code was written by Dan Manthey and rewritten by Ralf Wildenhues.
#
@ -387,9 +387,9 @@ m4_ifdef([_AC_SUBST_FILES],
[# Create commands to substitute file output variables.
{
echo "cat >>$CONFIG_STATUS <<_ACEOF"
echo 'cat >>"\$tmp/subs1.awk" <<\CEOF'
echo 'cat >>"\$tmp/subs1.awk" <<\_ACAWK'
echo "$ac_subst_files" | sed 's/.*/F@<:@"&"@:>@="$&"/'
echo "CEOF"
echo "_ACAWK"
echo "_ACEOF"
} >conf$$files.sh
. ./conf$$files.sh
@ -444,7 +444,7 @@ dnl - Writing `$ 0' prevents expansion by both the shell and m4 here.
dnl
dnl m4-double-quote most of the scripting for readability.
[cat >>$CONFIG_STATUS <<_ACEOF
cat >>"\$tmp/subs1.awk" <<\CEOF
cat >>"\$tmp/subs1.awk" <<\_ACAWK
_ACEOF
sed -n '
h
@ -491,8 +491,8 @@ t delim
' >>$CONFIG_STATUS
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF
CEOF
cat >>"\$tmp/subs1.awk" <<CEOF
_ACAWK
cat >>"\$tmp/subs1.awk" <<_ACAWK
for (key in S) S_is_set[key] = 1
FS = ""
]m4_ifdef([_AC_SUBST_FILES],
@ -526,7 +526,7 @@ cat >>"\$tmp/subs1.awk" <<CEOF
}
]m4_ifdef([_AC_SUBST_FILES],
[\$ac_cs_awk_pipe_fini])[
CEOF
_ACAWK
sed "s/\$ac_cr\\\$//; s/\$ac_cr/\$ac_cs_awk_cr/g" < "\$tmp/subs1.awk" > "\$tmp/subs.awk"
_ACEOF
]dnl end of double-quoted part
@ -586,13 +586,13 @@ m4_ifndef([AC_DATAROOTDIR_CHECKED],
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
m4_define([_AC_datarootdir_vars],
[datadir, docdir, infodir, localedir, mandir])
[datadir, docdir, infodir, localedir, mandir])
case `sed -n '/datarootdir/ {
p
q
}
m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]),
[/@_AC_Var@/p
[/@_AC_Var@/p
])' $ac_file_inputs` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@[]m4_join([@*|*@], _AC_datarootdir_vars)@*)
@ -601,7 +601,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_datarootdir_hack='
m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]),
[s&@_AC_Var@&$_AC_Var&g
[s&@_AC_Var@&$_AC_Var&g
])dnl
s&\\\${datarootdir}&$datarootdir&g' ;;
esac
@ -675,6 +675,147 @@ AC_DEFUN([AC_CONFIG_HEADER],
[AC_CONFIG_HEADERS([$1])])
# _AC_OUTPUT_HEADERS_PREPARE
# --------------------------
# Create the awk scripts needed for CONFIG_HEADERS.
# Support multiline #defines.
#
# This macro is expanded inside a here document. If the here document is
# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
#
m4_define([_AC_OUTPUT_HEADERS_PREPARE],
[# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$tmp/defines.awk" <<\_ACAWK
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_t=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_t"; then
break
elif $ac_last_try; then
AC_MSG_ERROR([could not make $CONFIG_HEADERS])
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
dnl
dnl Structure of the sed script that reads confdefs.h:
dnl rset: main loop, searches for `#define' lines
dnl def: deal with a `#define' line
dnl bsnl: deal with a `#define' line that ends with backslash-newline
dnl cont: handle a continuation line
dnl bsnlc: handle a continuation line that ends with backslash-newline
dnl
dnl Each sub part escapes the awk special characters and outputs a statement
dnl inserting the macro value into the array D, keyed by name. If the macro
dnl uses parameters, they are added in the array P, keyed by name.
dnl
dnl Long values are split into several string literals with help of ac_delim.
dnl Assume nobody uses macro names of nearly 150 bytes length.
dnl
dnl The initial replace for `#define' lines inserts a leading space
dnl in order to ease later matching; otherwise, output lines may be
dnl repeatedly matched.
dnl
dnl m4-double-quote most of this for [, ], define, and substr:
[
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{]_AC_AWK_LITERAL_LIMIT[\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{]_AC_AWK_LITERAL_LIMIT[\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' <confdefs.h | sed '
s/'"$ac_delim"'/"\\\
"/g' >>$CONFIG_STATUS
cat >>$CONFIG_STATUS <<_ACEOF
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
definiens = D[macro]
if (definiens) {
# Preserve the white space surrounding the "#".
prefix = substr(line, 1, index(line, defundef) - 1)
print prefix "define", macro P[macro] definiens
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", line, "*/"
next
}
}
}
{ print }
]dnl End of double-quoted section
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
fi # test -n "$CONFIG_HEADERS"
])# _AC_OUTPUT_HEADERS_PREPARE
# _AC_OUTPUT_HEADER
# -----------------
#
@ -689,110 +830,9 @@ m4_define([_AC_OUTPUT_HEADER],
#
# CONFIG_HEADER
#
_ACEOF
# Transform confdefs.h into a sed script `conftest.defines', that
# substitutes the proper values into config.h.in to produce config.h.
rm -f conftest.defines conftest.tail
# First, append a space to every undef/define line, to ease matching.
echo 's/$/ /' >conftest.defines
# Then, protect against being on the right side of a sed subst, or in
# an unquoted here document, in config.status. If some macros were
# called several times there might be several #defines for the same
# symbol, which is useless. But do not sort them, since the last
# AC_DEFINE must be honored.
dnl
dnl Quote, for `[ ]' and `define'.
[ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
# NAME is the cpp macro being defined, VALUE is the value it is being given.
# PARAMS is the parameter list in the macro definition--in most cases, it's
# just an empty string.
ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
ac_dB='\\)[ (].*,\\1define\\2'
ac_dC=' '
ac_dD=' ,']
dnl ac_dD used to contain `;t' at the end, but that was both slow and incorrect.
dnl 1) Since the script must be broken into chunks containing 100 commands,
dnl the extra command meant extra calls to sed.
dnl 2) The code was incorrect: in the unusual case where a symbol has multiple
dnl different AC_DEFINEs, the last one should be honored.
dnl
dnl ac_dB works because every line has a space appended. ac_dD reinserts
dnl the space, because some symbol may have been AC_DEFINEd several times.
dnl
dnl The first use of ac_dA has a space prepended, so that the second
dnl use does not match the initial 's' of $ac_dA.
[
uniq confdefs.h |
sed -n '
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*//
t ok
d
:ok
s/[\\&,]/\\&/g
s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
' >>conftest.defines
]
# Remove the space that was appended to ease matching.
# Then replace #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
# (The regexp can be short, since the line contains either #define or #undef.)
echo 's/ $//
[s,^[ #]*u.*,/* & */,]' >>conftest.defines
# Break up conftest.defines:
dnl If we cared only about not exceeding line count limits, we would use this:
dnl ac_max_sed_lines=m4_eval(_AC_SED_CMD_LIMIT - 3)
dnl But in practice this can generate scripts that contain too many bytes;
dnl and this can cause obscure 'sed' failures, e.g.,
dnl http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00127.html
dnl So instead, we use the following, which is about half the size we'd like:
ac_max_sed_lines=50
dnl In the future, let's use awk or sh instead of sed to do substitutions,
dnl since we have so many problems with sed.
# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
# et cetera.
ac_in='$ac_file_inputs'
ac_out='"$tmp/out1"'
ac_nxt='"$tmp/out2"'
while :
do
# Write a here document:
dnl Quote, for the `[ ]' and `define'.
[ cat >>$CONFIG_STATUS <<_ACEOF
# First, check the format of the line:
cat >"\$tmp/defines.sed" <<\\CEOF
/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
b
:def
_ACEOF]
sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
echo 'CEOF
sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
grep . conftest.tail >/dev/null || break
rm -f conftest.defines
mv conftest.tail conftest.defines
done
rm -f conftest.defines conftest.tail
dnl Now back to your regularly scheduled config.status.
echo "ac_result=$ac_in" >>$CONFIG_STATUS
cat >>$CONFIG_STATUS <<\_ACEOF
if test x"$ac_file" != x-; then
AS_ECHO(["/* $configure_input */"]) >"$tmp/config.h"
cat "$ac_result" >>"$tmp/config.h"
$AWK -f "$tmp/defines.awk" $ac_file_inputs >>"$tmp/config.h"
if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
AC_MSG_NOTICE([$ac_file is unchanged])
else
@ -801,9 +841,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF
fi
else
AS_ECHO(["/* $configure_input */"])
cat "$ac_result"
$AWK -f "$tmp/defines.awk" $ac_file_inputs
fi
rm -f "$tmp/out[12]"
dnl If running for Automake, be ready to perform additional
dnl commands to set up the timestamp files.
m4_ifdef([_AC_AM_CONFIG_HEADER_HOOK],
@ -1513,6 +1552,7 @@ dnl The comment above AS_TMPDIR says at most 4 chars are allowed.
AS_TMPDIR([conf], [.])
m4_ifdef([_AC_SEEN_CONFIG(FILES)], [_AC_OUTPUT_FILES_PREPARE])[]dnl
m4_ifdef([_AC_SEEN_CONFIG(HEADERS)], [_AC_OUTPUT_HEADERS_PREPARE])[]dnl
for ac_tag in[]dnl
m4_ifdef([_AC_SEEN_CONFIG(FILES)], [:F $CONFIG_FILES])[]dnl
@ -1611,6 +1651,12 @@ m4_define([AC_OUTPUT_MAKE_DEFS],
# take arguments), then branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
ac_script='
:mline
/\\$/{
N
s,\\\n,,
b mline
}
t clear
:clear
s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g

View File

@ -105,7 +105,13 @@
# tail of the core for;case, overall wrap up, generation of debugging
# scripts and statistics.
# - TEST_SCRIPT
# The code for each test, the ``normal'' diversion
# The collector for code for each test, the ``normal'' diversion, but
# undiverted into other locations before final output.
#
# - TEST_FUNCTIONS
# Series of functions for each test group. The functions deliberately
# occur after the end of the shell script, so that the shell need not
# spend time parsing functions it will not execute.
m4_define([_m4_divert(DEFAULTS)], 100)
m4_define([_m4_divert(PARSE_ARGS_BEGIN)], 200)
@ -123,6 +129,7 @@ m4_define([_m4_divert(PREPARE_TESTS)], 400)
m4_define([_m4_divert(TESTS)], 401)
m4_define([_m4_divert(TESTS_END)], 402)
m4_define([_m4_divert(TEST_SCRIPT)], 403)
m4_define([_m4_divert(TEST_FUNCTIONS)], 500)
# AT_LINE
@ -251,7 +258,8 @@ at_func_log_failure ()
# at_func_check_skip EXIT-CODE
# Check whether EXIT-CODE is the special exit code 77, and if so exit the shell
# with that same exit code.
at_func_check_skip () {
at_func_check_skip ()
{
case $[1] in
77) echo 77 > "$at_status_file"; exit 77;;
esac
@ -261,7 +269,8 @@ at_func_check_skip () {
# Check whether EXIT-CODE is the expected exit code, and if so do nothing. Else,
# if it is 77 exit the shell with that same exit code; if it is anything else
# print an error message and fail the test.
at_func_check_status () {
at_func_check_status ()
{
dnl This order ensures that we don't `skip' if we are precisely checking $? = 77.
case $[2] in
$[1] ) ;;
@ -274,11 +283,30 @@ at_func_check_status () {
# at_func_diff_devnull FILE
# Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless
# diff invocations.
at_func_diff_devnull () {
at_func_diff_devnull ()
{
test -s "$[1]" || return 0
$at_diff "$at_devnull" "$[1]"
}
# at_func_test NUMBER
# -------------------
# Parse out at_func_test_NUMBER from the tail of this file, source it,
# then invoke it.
at_func_test ()
{
if sed -n '/^@%:@AT_START_'$[1]$'/,/^@%:@AT_STOP_'$[1]$'/p' "$at_myself" \
> "$at_test_source" && . "$at_test_source" ; then
at_func_test_$[1] || {
AS_ECHO(["$as_me: unable to execute test group: $[1]"]) >&2
at_failed=:
}
else
AS_ECHO(["$as_me: unable to parse test group: $[1]"]) >&2
at_failed=:
fi
}
# Load the config file.
for at_file in atconfig atlocal
do
@ -331,8 +359,14 @@ at_groups=
# The directory we are in.
at_dir=`pwd`
# An absolute reference to this testsuite script.
dnl m4-double quote, to preserve []
[case $as_myself in
[\\/]* | ?:[\\/]* ) at_myself=$as_myself ;;
* ) at_myself=$at_dir/$as_myself ;;
esac]
# The directory the whole suite works in.
# Should be absolutely to let the user `cd' at will.
# Should be absolute to let the user `cd' at will.
at_suite_dir=$at_dir/$as_me.dir
# The file containing the suite.
at_suite_log=$at_dir/$as_me.log
@ -344,6 +378,8 @@ at_status_file=$at_suite_dir/at-status
at_stdout=$at_suite_dir/at-stdout
at_stder1=$at_suite_dir/at-stder1
at_stderr=$at_suite_dir/at-stderr
# The file containing the function to run a test group.
at_test_source=$at_suite_dir/at-test-source
# The file containing dates.
at_times_file=$at_suite_dir/at-times
m4_divert_pop([DEFAULTS])dnl
@ -779,6 +815,7 @@ else
fi
m4_text_box([Driver loop.])
for at_group in $at_groups
do
# Be sure to come back to the top test directory.
@ -1088,6 +1125,8 @@ $at_xpass_list${at_xpass_list:+ passed unexpectedly}
fi
exit 0
m4_text_box([Actual tests.])
m4_divert_pop([TESTS_END])dnl
dnl End of AT_INIT: divert to KILL, only test groups are to be
dnl output, the rest is ignored. Current diversion is BODY, inherited
@ -1253,8 +1292,11 @@ m4_define([AT_xfail], [at_xfail=no])
m4_define([AT_description], m4_quote($1))
m4_define([AT_ordinal], m4_incr(AT_ordinal))
m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))
m4_divert_push([TESTS])dnl
AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): m4_defn([AT_description])
m4_divert_push([TEST_FUNCTIONS])dnl
[#AT_START_]AT_ordinal
@%:@ AT_ordinal. m4_defn([AT_line]): m4_defn([AT_description])
at_func_test_[]AT_ordinal ()
{
at_setup_line='m4_defn([AT_line])'
at_desc="AS_ESCAPE(m4_dquote(m4_defn([AT_description])))"
$at_quiet AS_ECHO_N([m4_format(["%3d: $at_desc%*s"], AT_ordinal,
@ -1302,7 +1344,7 @@ m4_define([AT_CLEANUP],
[m4_append([AT_help_all],
m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]);
)dnl
m4_divert_pop([TEST_SCRIPT])dnl Back to TESTS
m4_divert_pop([TEST_SCRIPT])dnl Back to TEST_FUNCTIONS
AT_xfail
echo "# -*- compilation -*-" >> "$at_group_log"
(
@ -1313,9 +1355,11 @@ m4_undivert([TEST_SCRIPT])dnl Insert the code here
$at_times_p && times >"$at_times_file"
) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe
at_status=`cat "$at_status_file"`
;;
m4_divert_pop([TESTS])dnl Back to KILL.
}
[#AT_STOP_]AT_ordinal
m4_divert_pop([TEST_FUNCTIONS])dnl Back to KILL.
m4_divert_text([TESTS],
[ AT_ordinal ) at_func_test AT_ordinal ;;])
])# AT_CLEANUP

View File

@ -384,17 +384,10 @@ PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# Required to use basename.
_AS_EXPR_PREPARE
@ -1279,7 +1272,8 @@ m4_dquote(m4_dquote(m4_defn([m4_cr_symbols1])))[[))], [0], [$2], [$3])])
m4_define([AS_LITERAL_IF],
[m4_cond([m4_eval(m4_index(m4_quote($1), [@S|@]) == -1)], [0], [$3],
[m4_index(m4_translit(m4_quote($1),
[[]`,#]]m4_dquote(m4_defn([m4_cr_symbols2]))[,
[[]`,#]]]dnl
m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
[$$$]),
[$])], [-1], [$2],
[$3])])
@ -1651,6 +1645,8 @@ m4_pattern_forbid([^_?AS_])
# Bangshe and minimal initialization.
m4_divert_text([BINSH], [@%:@! /bin/sh])
m4_divert_text([HEADER-COMMENT],
[@%:@ Generated from __file__ by m4_PACKAGE_STRING.])
m4_divert_text([M4SH-SANITIZE], [AS_SHELL_SANITIZE])
AS_REQUIRE([_AS_SHELL_FN_SPY])

View File

@ -530,7 +530,7 @@ m4_define([m4_default],
m4_define([m4_defn],
[m4_ifdef([$1], [],
[m4_fatal([$0: undefined macro: $1])])]dnl
[m4_builtin([defn], $@)])
[m4_builtin([defn], [$1])])
# _m4_dumpdefs_up(NAME)
@ -571,35 +571,7 @@ _m4_dumpdefs_down([$1])])
m4_define([m4_popdef],
[m4_ifdef([$1], [],
[m4_fatal([$0: undefined macro: $1])])]dnl
[m4_builtin([popdef], $@)])
# m4_quote(ARGS)
# --------------
# Return ARGS as a single argument. Any whitespace after unquoted commas
# is stripped.
#
# It is important to realize the difference between `m4_quote(exp)' and
# `[exp]': in the first case you obtain the quoted *result* of the
# expansion of EXP, while in the latter you just obtain the string
# `exp'.
m4_define([m4_quote], [[$*]])
# m4_dquote(ARGS)
# ---------------
# Return ARGS as a quoted list of quoted arguments.
m4_define([m4_dquote], [[$@]])
# m4_noquote(STRING)
# ------------------
# Return the result of ignoring all quotes in STRING and invoking the
# macros it contains. Amongst other things, this is useful for enabling
# macro invocations inside strings with [] blocks (for instance regexps
# and help-strings).
m4_define([m4_noquote],
[m4_changequote(-=<{,}>=-)$1-=<{}>=-m4_changequote([,])])
[m4_builtin([popdef], [$1])])
# m4_shiftn(N, ...)
@ -631,11 +603,43 @@ m4_define([m4_shift3], [m4_shift(m4_shift(m4_shift($@)))])
m4_define([m4_undefine],
[m4_ifdef([$1], [],
[m4_fatal([$0: undefined macro: $1])])]dnl
[m4_builtin([undefine], $@)])
[m4_builtin([undefine], [$1])])
## ------------------------- ##
## 7. Quoting manipulation. ##
## ------------------------- ##
# m4_quote(ARGS)
# --------------
# Return ARGS as a single argument. Any whitespace after unquoted commas
# is stripped.
#
# It is important to realize the difference between `m4_quote(exp)' and
# `[exp]': in the first case you obtain the quoted *result* of the
# expansion of EXP, while in the latter you just obtain the string
# `exp'.
m4_define([m4_quote], [[$*]])
# m4_dquote(ARGS)
# ---------------
# Return ARGS as a quoted list of quoted arguments.
m4_define([m4_dquote], [[$@]])
# m4_noquote(STRING)
# ------------------
# Return the result of ignoring all quotes in STRING and invoking the
# macros it contains. Amongst other things, this is useful for enabling
# macro invocations inside strings with [] blocks (for instance regexps
# and help-strings).
m4_define([m4_noquote],
[m4_changequote(-=<{,}>=-)$1-=<{}>=-m4_changequote([,])])
## -------------------------- ##
## 7. Implementing m4 loops. ##
## 8. Implementing m4 loops. ##
## -------------------------- ##
@ -644,22 +648,23 @@ m4_define([m4_undefine],
# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO with
# increments of STEP.
# Both limits are included, and bounds are checked for consistency.
# The algorithm is robust to indirect VARIABLE names.
# The algorithm is robust to indirect VARIABLE names, and uses m4_builtin
# to avoid some of the m4_defn overhead.
m4_define([m4_for],
[m4_pushdef([$1], m4_eval([$2]))dnl
m4_if(m4_eval(([$3]) > m4_defn([$1])), 1,
m4_cond([m4_eval(([$3]) > m4_builtin([defn], [$1]))], 1,
[m4_pushdef([_m4_step], m4_eval(m4_default([$4], 1)))dnl
m4_assert(_m4_step > 0)dnl
_m4_for([$1], m4_eval((([$3]) - m4_defn([$1]))
/ _m4_step * _m4_step + m4_defn([$1])),
_m4_for([$1], m4_eval((([$3]) - m4_builtin([defn], [$1]))
/ _m4_step * _m4_step + m4_builtin([defn], [$1])),
_m4_step, [$5])],
m4_eval(([$3]) < m4_defn([$1])), 1,
[m4_eval(([$3]) < m4_builtin([defn], [$1]))], 1,
[m4_pushdef([_m4_step], m4_eval(m4_default([$4], -1)))dnl
m4_assert(_m4_step < 0)dnl
_m4_for([$1], m4_eval((m4_defn([$1]) - ([$3]))
/ -(_m4_step) * _m4_step + m4_defn([$1])),
_m4_for([$1], m4_eval((m4_builtin([defn], [$1]) - ([$3]))
/ -(_m4_step) * _m4_step + m4_builtin([defn], [$1])),
_m4_step, [$5])],
[m4_pushdef(_m4_step,[])dnl
[m4_pushdef([_m4_step])dnl
$5])[]dnl
m4_popdef([_m4_step])dnl
m4_popdef([$1])])
@ -800,7 +805,7 @@ m4_define([m4_foreach_w],
## --------------------------- ##
## 8. More diversion support. ##
## 9. More diversion support. ##
## --------------------------- ##
@ -888,14 +893,15 @@ m4_define([m4_divert_once],
# m4_undivert(DIVERSION-NAME)
# ---------------------------
# Undivert DIVERSION-NAME.
# Undivert DIVERSION-NAME. Unlike the M4 version, this only takes a single
# diversion identifier, and should not be used to undivert files.
m4_define([m4_undivert],
[m4_builtin([undivert], _m4_divert([$1]))])
## -------------------------------------------- ##
## 8. Defining macros with bells and whistles. ##
## -------------------------------------------- ##
## --------------------------------------------- ##
## 10. Defining macros with bells and whistles. ##
## --------------------------------------------- ##
# `m4_defun' is basically `m4_define' but it equips the macro with the
# needed machinery for `m4_require'. A macro must be m4_defun'd if
@ -1287,9 +1293,9 @@ m4_define([m4_pattern_forbid], [])
m4_define([m4_pattern_allow], [])
## ----------------------------- ##
## Dependencies between macros. ##
## ----------------------------- ##
## --------------------------------- ##
## 11. Dependencies between macros. ##
## --------------------------------- ##
# m4_before(THIS-MACRO-NAME, CALLED-MACRO-NAME)
@ -1395,9 +1401,9 @@ m4_define([m4_provide_if],
[$2], [$3])])
## -------------------- ##
## 9. Text processing. ##
## -------------------- ##
## --------------------- ##
## 12. Text processing. ##
## --------------------- ##
# m4_cr_letters
@ -1655,13 +1661,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
@ -1670,29 +1679,43 @@ 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
# => act1
# =>
# => 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_defn([$1])$3])[$2])])
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_defn([$1])[$3], [$3$2$3]), [-1],
[m4_append($@)])],
[m4_append($@)])])
[m4_if(m4_index([$3]m4_builtin([defn], [$1])[$3], [$3$2$3]), [-1],
[m4_append([$1], [$2], [$3])$4], [$5])],
[m4_append([$1], [$2], [$3])$4])])
# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH])
@ -1732,38 +1755,44 @@ m4_define([m4_append_uniq],
# which complicates it a bit. The algorithm is otherwise stupid and simple:
# all the words are preceded by m4_Separator which is defined to empty for
# the first word, and then ` ' (single space) for all the others.
#
# The algorithm overquotes m4_Prefix1 to avoid m4_defn overhead, and bypasses
# m4_popdef overhead with m4_builtin since no user macro expansion occurs in
# the meantime.
m4_define([m4_text_wrap],
[m4_pushdef([m4_Prefix], [$2])dnl
m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl
m4_pushdef([m4_Prefix1], m4_dquote(m4_default([$3], [m4_Prefix])))dnl
m4_pushdef([m4_Width], m4_default([$4], 79))dnl
m4_pushdef([m4_Cursor], m4_qlen(m4_defn([m4_Prefix1])))dnl
m4_pushdef([m4_Cursor], m4_qlen(m4_Prefix1))dnl
m4_pushdef([m4_Separator], [])dnl
m4_defn([m4_Prefix1])[]dnl
m4_cond([m4_eval(m4_qlen(m4_defn([m4_Prefix1])) > m4_len(m4_Prefix))],
m4_Prefix1[]dnl
m4_cond([m4_eval(m4_qlen(m4_Prefix1) > m4_len(m4_Prefix))],
[1], [m4_define([m4_Cursor], m4_len(m4_Prefix))
m4_Prefix],
[m4_eval(m4_qlen(m4_defn([m4_Prefix1])) < m4_len(m4_Prefix))],
[m4_eval(m4_qlen(m4_Prefix1) < m4_len(m4_Prefix))],
[0], [],
[m4_define([m4_Cursor], m4_len(m4_Prefix))[]dnl
m4_format([%*s],
m4_max(0,m4_eval(m4_len(m4_Prefix) - m4_qlen(m4_defn([m4_Prefix1])))),
m4_max([0], m4_eval(m4_len(m4_Prefix) - m4_qlen(m4_Prefix1))),
[])])[]dnl
m4_foreach_w([m4_Word], [$1],
[m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_qlen(m4_defn([m4_Word])) + 1))dnl
[m4_define([m4_Cursor],
m4_eval(m4_Cursor + m4_qlen(m4_builtin([defn], [m4_Word])) + 1))dnl
dnl New line if too long, else insert a space unless it is the first
dnl of the words.
m4_if(m4_eval(m4_Cursor > m4_Width),
1, [m4_define([m4_Cursor],
m4_eval(m4_len(m4_Prefix) + m4_qlen(m4_defn([m4_Word])) + 1))]
m4_eval(m4_len(m4_Prefix)
+ m4_qlen(m4_builtin([defn], [m4_Word])) + 1))]
m4_Prefix,
[m4_Separator])[]dnl
m4_defn([m4_Word])[]dnl
m4_builtin([defn], [m4_Word])[]dnl
m4_define([m4_Separator], [ ])])dnl
m4_popdef([m4_Separator])dnl
m4_popdef([m4_Cursor])dnl
m4_popdef([m4_Width])dnl
m4_popdef([m4_Prefix1])dnl
m4_popdef([m4_Prefix])dnl
m4_builtin([popdef], [m4_Separator])dnl
m4_builtin([popdef], [m4_Cursor])dnl
m4_builtin([popdef], [m4_Width])dnl
m4_builtin([popdef], [m4_Prefix1])dnl
m4_builtin([popdef], [m4_Prefix])dnl
])
@ -1775,9 +1804,13 @@ m4_popdef([m4_Prefix])dnl
# ## ------- ##
# using FRAME-CHARACTER in the border.
m4_define([m4_text_box],
[@%:@@%:@ m4_bpatsubst([$1], [.], m4_if([$2], [], [[-]], [[$2]])) @%:@@%:@
[m4_pushdef([m4_Border],
m4_translit(m4_format([%*s], m4_qlen(m4_quote($1)), []),
[ ], m4_if([$2], [], [[-]], [[$2]])))dnl
@%:@@%:@ m4_Border @%:@@%:@
@%:@@%:@ $1 @%:@@%:@
@%:@@%:@ m4_bpatsubst([$1], [.], m4_if([$2], [], [[-]], [[$2]])) @%:@@%:@[]dnl
@%:@@%:@ m4_Border @%:@@%:@dnl
m4_builtin([popdef], [m4_Border])dnl
])
@ -1801,7 +1834,7 @@ m4_define([m4_qdelta],
## ----------------------- ##
## 10. Number processing. ##
## 13. Number processing. ##
## ----------------------- ##
# m4_cmp(A, B)
@ -1867,7 +1900,7 @@ m4_define([m4_sign],
## ------------------------ ##
## 11. Version processing. ##
## 14. Version processing. ##
## ------------------------ ##
@ -1926,7 +1959,7 @@ m4_define([m4_version_prereq],
## ------------------- ##
## 12. File handling. ##
## 15. File handling. ##
## ------------------- ##
@ -1948,7 +1981,7 @@ m4_if(m4_sysval, [0], [],
## ------------------------ ##
## 13. Setting M4sugar up. ##
## 16. Setting M4sugar up. ##
## ------------------------ ##

View File

@ -501,7 +501,7 @@ AT_CLEANUP[]dnl
AT_INIT
AT_COPYRIGHT(
[Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
[Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.])

View File

@ -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. ##
## -------------- ##

View File

@ -405,13 +405,13 @@ AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
AT_CLEANUP
# autoconf: AC_VERSION
# autoconf: AC_AUTOCONF_VERSION
# --------------------------------------
AT_SETUP([autoconf: AC_VERSION])
AT_SETUP([autoconf: AC_AUTOCONF_VERSION])
AT_DATA([configure.ac],
[[AC_INIT
version AC_VERSION version
version AC_AUTOCONF_VERSION version
AC_OUTPUT
]])

View File

@ -335,6 +335,14 @@ AC_DEFINE(fubar, tutu)
AC_DEFINE(a, A)
AC_DEFINE(aaa, AAA)
AC_DEFINE(aa, AA)
# backslash-newline combinations
AC_DEFINE([multiline], [line1\
line2\
line3 \
line4])
AC_DEFINE([multiline_args(ARG1, ARG2)], [ARG2 \
ARG1])
AC_CONFIG_FILES(defs)
# Things included in confdefs.h, but which make no sense in
@ -361,13 +369,22 @@ AT_DATA([config.hin],
[[#define foo 0
# define bar bar
# define baz "Archimedes was sinking in his baz"
# define fubar tutu
# define fubar tutu
#define a B
#define aa BB
#define aaa BBB
#define aa BB
# define aaa BBB
#undef a
#undef aa
# undef aa
#undef aaa
#define aaa(a, aa) aa a
#define aaab
#define aaac(a, aa) aa a
#undef multiline
# undef multiline_args
/* an ugly one: */
#define str(define) \
#define
#define stringify(arg) str(arg)
]])
AT_CHECK_AUTOCONF
@ -378,19 +395,32 @@ AT_DATA([expout],
#define foo toto
# define bar tata
# define baz titi
# define fubar tutu
# define fubar tutu
#define a A
#define aa AA
#define aaa AAA
#define aa AA
# define aaa AAA
#define a A
#define aa AA
# define aa AA
#define aaa AAA
#define aaa AAA
#define aaab
#define aaac(a, aa) aa a
#define multiline line1\
line2\
line3 \
line4
# define multiline_args(ARG1, ARG2) ARG2 \
ARG1
/* an ugly one: */
#define str(define) \
#define
#define stringify(arg) str(arg)
]])
AT_CHECK([cat config.h], 0, expout)
# Check the value of DEFS.
AT_DATA([expout],
[[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA
[[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA -Dmultiline=line1line2line3\ line4 -Dmultiline_args\(ARG1,\ ARG2\)=ARG2\ ARG1
]])
# Because we strip trailing spaces in `testsuite' we can't leave one in
@ -478,7 +508,7 @@ m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
# used in the torture tests.
m4_defun([AC_DEFUBST],
[AC_DUMMY_VAR($1)="AC_BIG_VALUE"
AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)",
AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1) $AC_DUMMY_VAR($1)",
AC_DESCRIPTION)
AC_SUBST(AC_DUMMY_VAR($1))
AC_SUBST_FILE([f]$1)
@ -519,7 +549,7 @@ for awk_arg in FOO= AWK=awk; do
m4_for(AT_Count, 1, 100, 1,
[
/* AT_DESCRIPTION */
[#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE"
[#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE AT_BIG_VALUE"
])])
AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
@ -659,6 +689,7 @@ AC_SUBST([zardoz])
file=File
AC_SUBST_FILE([file])
AC_DEFINE([foo], [[X*'[]+ ",& &`\($foo !]], [Awful value.])
AC_DEFINE([bar], [[%!_!# X]], [Value that is used as special delimiter.])
AC_PROG_AWK
AC_CONFIG_FILES([Foo Zardoz])]])
@ -681,7 +712,8 @@ X@file@
@file@X
]])
AT_CHECK([cmp allowed-chars Zardoz])
AT_CHECK_DEFINES([[#define foo X*'[]+ ",& &`\($foo !
AT_CHECK_DEFINES([[#define bar %!_!# X
#define foo X*'[]+ ",& &`\($foo !
]])
done
AT_CLEANUP
@ -731,16 +763,36 @@ AT_CLEANUP
## ------------------ ##
AT_SETUP([Define a newline])
AT_XFAIL_IF(:)
AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
two], [This spans two lines.])
]])
AT_CHECK_AUTOCONF
AT_CHECK_AUTOHEADER
AT_CHECK_AUTOCONF([], [], [],
[[configure.ac:5: warning: AC_DEFINE: `one
configure.ac:5: two' is not a valid preprocessor define value
]])
AT_CHECK_AUTOHEADER([], [], [],
[[configure.ac:5: warning: AC_DEFINE: `one
configure.ac:5: two' is not a valid preprocessor define value
]])
AT_CHECK_CONFIGURE
AT_CHECK_DEFINES([[#define foo one
two
]])
AT_CONFIGURE_AC([[AC_DEFINE_UNQUOTED([foo], [one
two], [This spans two lines.])
]])
AT_CHECK_AUTOCONF([], [], [],
[[configure.ac:5: warning: AC_DEFINE_UNQUOTED: `one
configure.ac:5: two' is not a valid preprocessor define value
]])
AT_CHECK_AUTOHEADER([], [], [],
[[configure.ac:5: warning: AC_DEFINE_UNQUOTED: `one
configure.ac:5: two' is not a valid preprocessor define value
]])
AT_CHECK_CONFIGURE
AT_CHECK_DEFINES([[#define foo one
]])
AT_CLEANUP