* tests/local.at (AT_CHECK_ENV, AT_CONFIG_CMP):
Add BASH_ARGC, BASH_ARGV to list of variables to be ignored when
comparing variable space dumps.
(AT_CONFIG_CMP): Also ignore LINENO.
* tests/m4sh.at: Also unset LINENO in 'reference' and 'test/test-1'.
* lib/autoconf/general.m4 (_AC_CHECK_DECL_BODY): Restore werror flags
inside the AC_CACHE_CHECK that saves them. Commit
82ef7805fa broke this. From Tom Lane
(trivial change).
* tests/semantics.at (AC_CHECK_DECLS): Test this.
* lib/autoconf/general.m4 (_AC_INIT_CONFIG_LOG):
Rely on list of unsafe chars instead of list of safe ones.
This corresponds more closely to POSIX and should result
in less quoting.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS):
Adjust to this change.
x
Problem reported by Bruno Haible in:
https://savannah.gnu.org/support/?109406
* lib/Autom4te/FileUtils.pm (update_file): Use rename + system
instead of move, since move truncates file timestamps.
* lib/autoconf/programs.m4 (AC_PROG_INSTALL): Check that the
system install program works when the destination name has a
trailing slash. This helped catch problems in an experimental and
never-published version of GNU Coreutils, and is a good thing to
check in general.
* doc/autoconf.texi (C and Posix Variants, System Services):
Remind user to include config.h first.
(Configuration Headers): Give another reason why config.h must be
first, and mention that only .c files need it.
Based on discussion on bugs.debian.org/158969
Signed-off-by: Eric Blake <eblake@redhat.com>
Several projects have a bootstrap script that invokes
'autoreconf -fi' as part of a fresh version control checkout,
in order to avoid storing common files in version control,
while also allowing contributors to rerun bootstrap to pick
up the benefits of any upgrade of one of the autotools.
However, the documentation did not make it obvious that such
a setup will overwrite any customizations to files like
INSTALL, if those files are stored in version control, when
automake still considers that file to be standard based on
AM_INIT_AUTOMAKE settings. In such a case, a mere
'autoreconf -i' is good for the bootstrap script, while a
separate 'autoreconf -f' is good for picking up on an upgrade
of any autotools.
* bin/autoreconf.in (help): Mention standard files.
* doc/autoconf.texi (autoreconf Invocation): Add more text, including
warning that mixing --force and --install may undo customizations,
and that the set of files impacted is controlled by automake.
Reported by Emil Laine <laine.emil@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
The example text regarding a desired literal AC_DC in output
claimed that the result would trigger a warning if one does
not use creative quoting; but in reality, autoconf's use of
m4_pattern_forbid to reserve the entire AC_ namespace makes
it a hard error. Reword the section to mention the use of
m4_pattern_allow() as the fix, and beef up the example to
better demonstrate the problem.
* doc/autoconf.texi (Autoconf Language): Improve AC_DC example.
Reported by Gavin Smith <gavinsmith0123@gmail.com>.
Signed-off-by: Eric Blake <eblake@redhat.com>
* bin/autoheader.in: When checking for missing templates, take
all config headers into account, not just the one generated by
autoheader. This makes it possible to use AC_DEFINE() for
secondary headers without duplicating the template into the
first header.
* tests/tools.at: Add a check for autoheader with multiple
config headers.
* NEWS: Document the new behavior.
Message-Id: <1482336946.31331.2.camel@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
An unrolled loop avoids the cost of spawning sed in AS_TR_SH and
AS_TR_CPP. Prefer it if there is nothing in the second and third
argument of AC_CHECK_HEADERS and the first argument is a literal.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Unroll loop if safe.
(_AC_CHECK_HEADERS): Move basic implementation here.
(AC_CHECK_INCLUDES_DEFAULT): Remove unnecessary arguments after the first.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Message-Id: <1477933688-4884-3-git-send-email-bonzini@gnu.org>
[eblake: perform AC_CHECK_HEADERS_ONCE changes separately, use
dnl to reduce generated blank lines]
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
An unrolled loop avoids the cost of spawning sed in AS_TR_SH and
AS_TR_CPP. Prefer it if there is nothing in the second and third
argument of AC_CHECK_FUNCS and the first argument is a literal.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Unroll loop if safe.
(_AC_CHECK_FUNCS): Move basic implementation here.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Message-Id: <1477933688-4884-2-git-send-email-bonzini@gnu.org>
[eblake: perform AC_CHECK_FUNCS_ONCE changes separately, use
dnl to reduce generated blank lines]
Signed-off-by: Eric Blake <eblake@redhat.com>
Rather than perform a sed script on each element of the
$ac_header_c_list to compute the corresponding cache name, we
can inline enough of AC_CHECK_HEADER to bypass the normal
polymorphic code, and instead directly use the literal
header and cache name that we are consuming from the list.
The resulting configure script is roughly unchanged in size,
but performs slightly faster.
* lib/autoconf/headers.m4 (AC_CHECK_HEADER_COMPILE): Split out shell
function registration...
(_AC_CHECK_HEADER_COMPILE_FN): ...to here.
(_AC_HEADERS_EXPANSION): Use it to inline enough of AC_CHECK_HEADER
to operate on a literal rather than a shell variable, for fewer sed
calls.
Signed-off-by: Eric Blake <eblake@redhat.com>
Rather than perform a sed script on each element of the
$ac_func_c_list to compute the corresponding cache name, we
can inline enough of AC_CHECK_FUNC to bypass the normal
polymorphic code, and instead directly use the literal
function name that we are consuming from the list.
While at it, we can use echo instead of cat to append to
confdefs.h, for another process shaved.
The resulting configure script is roughly unchanged in size,
but performs slightly faster.
* lib/autoconf/functions.m4 (AC_CHECK_FUNC): Split out shell
function registration...
(_AC_CHECK_FUNC_FN): ...to here.
(_AC_FUNCS_EXPANSION): Use it to inline enough of AC_CHECK_FUNC to
operate on a literal rather than a shell variable, for fewer sed
calls.
Signed-off-by: Eric Blake <eblake@redhat.com>
Rather than perform a sed script on each element of the
$ac_header_c_list to compute the corresponding CPP name, we can
make the list store a series of triples of header names, shell-safe
names, and CPP names all computed at m4 time.
The resulting configure script is slightly larger based on
how many headers are checked once, but also performs
slightly faster.
There is still a sed call in AC_CHECK_HEADER for computing the
cache variable name; that will be dealt with next. That patch
will also be the one that takes advantage of the shell-safe name.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_ONCE): Track the shell
and CPP name in the list...
(_AC_HEADERS_EXPANSION): ...and rewrite the list walk to parse off
triples of arguments, for fewer sed calls.
Signed-off-by: Eric Blake <eblake@redhat.com>
Rather than perform a sed script on each element of the
$ac_func_c_list to compute the corresponding CPP name, we can
make the list store a series of pairs of function names and
CPP names all computed at m4 time.
The resulting configure script is slightly larger based on
how many function names are checked once, but also performs
slightly faster.
There is still a sed call in AC_CHECK_FUNC for computing the
cache variable name; that will be dealt with next.
* lib/autoconf/functions.m4 (_AC_CHECK_FUNC_ONCE): Track the CPP
name in the list...
(_AC_FUNCS_EXPANSION): ...and rewrite the list walk to parse off
pairs of arguments, for fewer sed calls.
Signed-off-by: Eric Blake <eblake@redhat.com>
Previously, AC_CHECK_HEADERS_ONCE collected a list of header names
to check, but ran the checks using the AC_LANG that was active
during the first encounter of the macro. In practice, this is
usually the C language, and we haven't had actual reports of projects
attempting to use AC_CHECK_HEADERS_ONCE across multiple languages,
rather this was discovered by code inspection.
With this patch, the code now tracks a separate per-language list of
names to check. Note, however, that it is only possible to check for
a given header name in one language; attempting to add a name again
under AC_CHECK_HEADERS_ONCE while a different language is active is a
no-op (this still makes sense because the side-effect of defining
the CPP macro HAVE_HEADER does not include a language prefix).
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_ONCE)
(_AC_HEADERS_EXPANSION):
* NEWS: Mention it.
Signed-off-by: Eric Blake <eblake@redhat.com>
Previously, AC_CHECK_FUNCS_ONCE collected a list of function names
to check, but ran the checks using the AC_LANG that was active
during the first encounter of the macro. In practice, this is
usually the C language, and we haven't had actual reports of projects
attempting to use AC_CHECK_FUNCS_ONCE across multiple languages,
rather this was discovered by code inspection.
With this patch, the code now tracks a separate per-language list of
names to check. Note, however, that it is only possible to check for
a given function name in one language; attempting to add a name again
under AC_CHECK_FUNCS_ONCE while a different language is active is a
no-op (this still makes sense because the side-effect of defining
the CPP macro HAVE_FUNC does not include a language prefix).
* lib/autoconf/functions.m4 (_AC_CHECK_FUNC_ONCE)
(_AC_FUNCS_EXPANSION):
* NEWS: Mention it.
Signed-off-by: Eric Blake <eblake@redhat.com>
It is a very common case that a quadrigraph appears in the argument of
_AC_DEFINE_UNQUOTED, because "#define" is expanded through a quadrigraph.
Therefore, restrict the quadrigraph tests to "$" (for "$(" and "${")
and "(" (for "$(").
At the same time, "#" should not be used inside AC_ECHO because it confuses
m4's comment parsing. This pre-existing latent bug is caught by test 251:
AC_DEFINE_UNQUOTED([bar], [[%!_!# X]])
Previously the quadrigraph in "@%:@define bar %!_!# X" made Autoconf fall back
to cat anyway. Now that Autoconf is not fooled by the quadrigraph, the test
catches that "#" is not special-cased. Kudos to Eric for coming up with it!
* lib/autoconf/general (_AC_DEFINE_UNQUOTED): Do not blindly
use cat on all quadrigraphs.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Message-Id: <1477933688-4884-4-git-send-email-bonzini@gnu.org>
The "single" macro infinitely recurses because its expansion contains
the unquoted text " single-". The "double" macro almost has the same
problem, but it is protected by extra quotes. In any case, the macro
names being repeated in the macro definitions is not necessary.
This commit changes the macro names to "foo" and "bar", which are taken
from a very similar example in the GNU M4 1.4.17 manual. See lines 1971
to 1980 of v1.4.17:doc/m4.texi in the GNU M4 Git repository.
* doc/autoconf.texi (Quoting and Parameters): Fix broken example.
* doc/autoconf.texi (C and Posix Variants): Rename from "Posix
Variants", and document updated behavior.
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Also define
__STDC_WANT_IEC_60559_ATTRIBS_EXT__,
__STDC_WANT_IEC_60559_DFP_EXT__,
__STDC_WANT_IEC_60559_TYPES_EXT__, and
__STDC_WANT_MATH_SPEC_FUNCS__. From a suggestion by Joseph Myers in:
http://lists.gnu.org/archive/html/autoconf-patches/2016-09/msg00011.html
glibc 2.25 is deprecating the namespace pollution of <sys/types.h>
injecting major(), minor(), and makedev() into the compilation
environment, with a warning that insists that users include
<sys/sysmacros.h> instead. However, because the expansion of
AC_HEADER_MAJOR didn't bother checking sys/sysmacros.h until
after probing whether sys/types.h pollutes the namespace, it was
not defining MAJOR_IN_SYSMACROS, with the result that code
compiled with -Werror chokes on the deprecation warnings because
it was not including sysmacros.h.
In addition to fixing autoconf (which only benefits projects
that rebuild configure after this fix is released), we can also
give a hint to distros on how they can populate config.site with
a cache variable to force pre-existing configure scripts without
the updated macro to behave sanely in the presence of glibc 2.25
(the documentation is especially useful since that cache variable
is no longer present in autoconf after this patch).
Note that mingw lacks major/minor/makedev in any of its standard
headers; for that platform, the behavior of this macro is unchanged
(code using the recommended include formula will get a compile error
when trying to use major(), whether before or after this patch); but
for now, it is assumed that programs actually concerned with
creating devices are not worried about portability to mingw. If
desired, a later patch could tighten AC_HEADER_MAJOR to fail at
configure time if the macros are unavailable in any of the three
system headers, but that semantic change is not worth mixing into
this patch.
* lib/autoconf/headers.m4 (AC_HEADER_MAJOR): Drop check for
major within sys/types.h; it interferes with the need to check
sysmacros.h first.
* doc/autoconf.texi (Particular Headers) <AC_HEADER_MAJOR>: Expand
details on usage, and on workarounds for non-updated projects.
Signed-off-by: Eric Blake <eblake@redhat.com>
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
Also define __STDC_WANT_IEC_60559_BFP_EXT__,
__STDC_WANT_IEC_60559_FUNCS_EXT__, and __STDC_WANT_LIB_EXT2__.
* NEWS, doc/autoconf.texi (Posix Variants):
Document this. Also, document other changes in this area
that were not properly documented before.
Silences this warning from new-enough texinfo:
./doc/autoconf.texi:14236: warning: @xref node name should not contain `.'
* doc/autoconf.texi (Macro Definitions): No need for .info.
Signed-off-by: Eric Blake <eblake@redhat.com>
* bin/autom4te.in (handle_traces): When $output is '-', use
stdout rather than creating a file named '-'. This fixes a problem
introduced by the recent port to the new Autom4te::XFile API.
Problem reported by Václav Zeman in:
http://lists.gnu.org/archive/html/autoconf/2012-10/msg00000.html
* lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_OBJC): Also try clang.
(AC_PROG_CXX): Also try clang++.
These are at the end of the existing lists, to avoid compatibility
issues in older installations.