Commit Graph

6701 Commits

Author SHA1 Message Date
Eric Blake
7377078751 AC_CHECK_FUNCS_ONCE: hoist CPP name computation to m4 time
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>
2016-12-21 08:32:36 -06:00
Eric Blake
501ccbbfdb AC_CHECK_HEADERS_ONCE: honor current AC_LANG
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>
2016-12-21 08:32:29 -06:00
Eric Blake
4523f7c32b AC_CHECK_FUNCS_ONCE: honor current AC_LANG
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>
2016-12-20 13:34:20 -06:00
Bruno Haible
eea950a012 * doc/autoconf.texi (Using Autotest): Stop mentioning Free Recode.
Free Wdiff is now GNU Wdiff again.
2016-12-14 10:29:05 -08:00
Paolo Bonzini
527f183f23 autoconf: refine quadrigraph test in _AC_DEFINE_UNQUOTED
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>
2016-11-04 16:12:52 -05:00
Quinn Grier
b2621a91d7 doc: fix an infinitely recursing example
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.
2016-11-02 12:19:14 -05:00
Pádraig Brady
251cc70252 doc: detail inconsistencies in sed word boundary handling
* doc/autoconf.texi (Limitations of usual tools): Display a
table showing where the various syntaxes for word boundaries
are supported.
2016-11-01 15:30:32 -05:00
Paul Eggert
2b4844a760 AC_USE_SYSTEM_EXTENSIONS: Remove stray TR in doc 2016-09-15 12:26:52 -07:00
Paul Eggert
9021c82280 AC_USE_SYSTEM_EXTENSIONS: port to more ISO C TSes
* 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
2016-09-15 10:10:14 -07:00
Eric Blake
e17a30e987 AC_HEADER_MAJOR: port to glibc 2.25
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>
2016-09-15 09:42:07 -05:00
Paul Eggert
565a6dc50c doc: resplit lines to avoid Texinfo chaos
* doc/autoconf.texi (Introduction): Resplit lines to avoid
Texinfo 6.3 incompatibility with Perl 5.22.  See:
http://lists.gnu.org/archive/html/bug-texinfo/2016-09/msg00037.html
2016-09-14 12:15:46 -07:00
Paul Eggert
4f08ddfe35 AC_USE_SYSTEM_EXTENSIONS: port to recent ISO C
* 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.
2016-09-13 18:28:47 -07:00
Paul Eggert
0bd5dbd9b2 doc: port to Texinfo 6.3
* doc/autoconf.texi: Remove obsolete @setcontentsaftertitlepage
that provokes a warning from Texinfo 6.3.
2016-09-13 17:51:41 -07:00
Eric Blake
125ec0d7a0 doc: use @xref correctly
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>
2016-09-13 17:44:02 -05:00
Paul Eggert
ab3086737c Port AC_CHECK_HEADER_STDBOOL to C++11
* lib/autoconf/headers.m4: Port to C++11.
Problem reported by David Seifert in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-05/msg00052.html
2016-05-31 08:57:39 -07:00
Paul Eggert
017d5ddd82 Use American spelling for "initialize"
* lib/autoconf/c.m4: Prefer the spelling "initializer" in comments.
2016-04-03 13:57:40 -07:00
Paul Eggert
dc3dad37db autom4te: fix problem when tracing to '-'
* 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.
2016-03-15 10:51:53 -07:00
Paul Eggert
739cdc82b5 Also try clang
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.
2016-03-15 09:34:34 -07:00
Paul Eggert
12aec07e44 Port C11 and C++11 testing to clang
* lib/autoconf/c.m4 (_AC_C_C99_TEST_HEADER):
Include stddef.h, for offsetof.
(_AC_PROG_CC_C11): Limit _Static_assert to integer constant
expressions.  Suggested by Nick Bowler in:
http://lists.gnu.org/archive/html/autoconf/2016-02/msg00009.html
(_AC_CXX_CXX11_TEST_BODY): Don't use string literals to initialize
non-const pointers.  Suggested by Mike Miller in:
http://lists.gnu.org/archive/html/autoconf/2016-02/msg00008.html
2016-03-15 08:57:10 -07:00
Paul Eggert
6236291e58 Fix broken URL to Unix history
* doc/autoconf.texi (Systemology): Fix broken URL.
Reported by Tom Wilcox.
2016-03-15 08:16:05 -07:00
Paul Eggert
19fc364cf8 AC_C_RESTRICT: port better to non-GCC + glibc
Problem reported by Dwight Guth in:
http://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html
* lib/autoconf/c.m4 (AC_C_RESTRICT): Prefer __restrict__ to __restrict.
Also, fix and update some comments.
2016-02-22 23:07:29 -08:00
Paul Eggert
04be2b7a29 Move config.* man pages to its source tree
Suggested by Ben Elliston in:
https://lists.gnu.org/archive/html/autoconf-patches/2015-11/msg00000.html
* man/config.guess.x, man/config.sub.x: Remove.
* NEWS: Mention this.
* man/local.mk (dist_man_MANS): Remove them.
($(mansrcdir)/config.guess.1, $(mansrcdir)/config.sub.1): Remove rules.
2016-02-06 17:17:50 -08:00
Paul Eggert
bbfa63cd4a maint: make update-copyright 2016-02-06 17:17:49 -08:00
Paul Eggert
21a3ac968c port to new Autom4te::XFile API 2016-02-06 17:17:49 -08:00
Paul Eggert
2ca0d5755f make fetch 2016-02-06 17:17:49 -08:00
Paul Eggert
14f568f683 Port better to gcc -fsanitize=address
* lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF):
Free heap-allocated storage before exiting.
2016-02-06 17:17:48 -08:00
Paul Eggert
09b6e78d15 Fix memory leak in AC_FUNC_MMAP
* lib/autoconf/functions.m4 (AC_FUNC_MMAP): Fix memory leak
in test case, found by configuring with gcc -fsanitize=address.
2016-02-05 21:06:45 -08:00
Paul Eggert
5483deb8ae Document dash ${*-unset} behavior
* doc/autoconf.texi (Shell Substitutions): Document dash
incompatibility.  Problem reported by David Caldwell in:
http://bugs.gnu.org/22556
2016-02-05 14:15:38 -08:00
Thomas Jahns
5ad3567c3c Add -mdir flag for NAG Fortran compiler
* lib/autoconf/fortran.m4 (AC_FC_MODULE_OUTPUT_FLAG):
Also try -mdir.  Also, prefer autoconf macros instead of verbatim shell
code and make tests safer.
Copyright-paperwork-exempt: yes
2015-10-08 12:53:34 -07:00
Paul Eggert
244d3f9acb tests: port to recent libtool diagnostics
Problem reported by Christian Fafard in:
http://lists.gnu.org/archive/html/bug-autoconf/2015-09/msg00009.html
* tests/foreign.at (libtool): Run the scripts in the C locale,
so that we need not worry about localized quotes in their output.
2015-09-05 07:56:28 -07:00
Paul Eggert
57ec362325 Add /opt/X11/include to X search path
* lib/autoconf/libs.m4 (_AC_PATH_X_DIRECT):
Add /opt/X11/include for OS X.
Problem reported by Daniel Macks at:
http://lists.gnu.org/archive/html/bug-autoconf/2015-08/msg00002.html
2015-08-07 18:09:44 -07:00
Eric Blake
51b89d1ccd doc: mention 'for' syntax issue on older shells
Based on a report by Michael Felt, via Paul Eggert on the
coreutils list.

* doc/autoconf.texi (Limitations of Builtins) <for>: Document
problem with 'for var in ;'.

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-06-04 15:58:24 -06:00
Noah Misch
82ef7805fa AC_CHECK_DECL, AC_CHECK_DECLS: port to the Clang compiler
* lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): New macro.
(_AC_CHECK_DECL_BODY): Call it once per language; treat warnings as
errors when its verdict indicates that.
* tests/semantics.at (AC_CHECK_DECLS): Add a macro call that relies on
the new semantics.  Avoid -Wmissing-variable-declarations warnings.
* doc/autoconf.texi (Generic Declarations): Document the implications.
* NEWS: Mention this change.
2015-05-13 21:11:47 -04:00
Matěj Týč
d2f0ec8708 m4_pattern_forbid: better documentation
Give a more concrete description of what the m4_pattern_forbid
thingy that pretends it is a macro accepts as an argument.

Copyright-paper-exempt: Yes
Signed-off-by: Eric Blake <eblake@redhat.com>
2015-04-21 06:37:10 -06:00
Eric Blake
76754e04fc lib: use shorter way to test if variable is set
Based on an idea by Bernhard Reutner-Fischer.

We frequently used the idiom of 'test "${var+set}" = set' to
test if $var was set to a non-empty string, but this can portably
be trimmed to a more compact 'test ${var+y}' for a smaller
configure file.  Testing that a variable is not set can be done
with '${var+false} :' (although the value of $? is not reliably
1 when the variable is set).

The code for AS_VAR_TEST_SET already used the form '${var+:} false',
but it is slightly longer, and does not guarantee $? of 1.

Tested on coreutils, where the resulting configure file is about
1k smaller.

* doc/autoconf.texi (Shell Substitutions): Prefer shorter sequence
for testing if a variable is set.
(Limitations of Builtins) <test (strings)>: Document it.
* configure.ac: Use it.
* lib/autoconf/c.m4 (_AC_PROG_CC_G, _AC_PROG_CXX_G)
(_AC_PROG_OBJC_G, _AC_PROG_OBJCXX_G): Likewise.
* lib/autoconf/fortran.m4 (_AC_PROG_FC_G): Likewise.
* lib/autoconf/general.m4 (_AC_ENABLE_IF_ACTION, AC_CACHE_SAVE):
Likewise.
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Likewise.
* lib/autoconf/programs.m4 (AC_PROG_INSTALL, AC_PROG_MKDIR_P)
(_AC_PROG_LEX_YYTEXT_DECL): Likewise.
* lib/autoconf/status.m4 (_AC_OUTPUT_MAIN_LOOP): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* tests/base.at (AC_CACHE_CHECK): Likewise.
* tests/m4sh.at (LINENO): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_BOURNE_COMPATIBLE)
(_AS_DETECT_BETTER_SHELL, _AS_SHELL_SANITIZE)
(_AS_PATH_SEPARATOR_PREPARE): Likewise.
(AS_VAR_TEST_SET): Use shorter sequence.

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-04-21 06:15:35 -06:00
Eric Blake
7bc2c5623d m4_set_foreach: minor optimization
As a minor optimization, most macros in m4sugar.m4 try to avoid
output of 'dnl' in the expansion, to reduce the number of macros
that must be expanded at each call site.

* lib/m4sugar/m4sugar.m4 (m4_set_foreach): Don't expand dnl in all
callers.

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-04-21 06:15:34 -06:00
Nick Bowler
6de6206717 m4sugar: fix pop typo in m4_set_foreach
* lib/m4sugar/m4sugar.m4 (m4_set_foreach): Pop macro definition.
Copyright-paperwork-exempt: Yes
2015-04-20 23:57:39 -07:00
Eric Blake
acb2004443 AC_PROG_MKDIR_P: reduce macro output size
Merging two case globs into one gives slightly smaller files and
less time spent in shell globbing on systems that lack GNU mkdir.

* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P): Combine two GNU cases.

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-04-09 08:49:09 -06:00
Bernhard Reutner-Fischer
38ac615e11 AC_PROG_MKDIR_P: Also accept BusyBox mkdir -p
* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P): Accept BusyBox.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-09 08:48:55 -06:00
Jim Meyering
365707e4cd tests: avoid two false-positive parallel test failures
* tests/local.mk (check-local): Add a leading "+",
to void false-positive test failures when running
them in parallel.  Before this change, running e.g.,
"make check TESTSUITEFLAGS=--jobs=15" would always
fail the two "make"-invoking tests: "C unit tests"
and "C unit tests (EXEEXT)".
(installcheck-local): Likewise for "installcheck".
2015-02-01 19:51:10 -08:00
Paul Eggert
4774ff5c33 doc: -f is now portable for cp and ln
This follows up on a comment by Glenn Morris in:
http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00011.html
* doc/autoconf.texi (Limitations of Usual Tools):
Remove circa-1990 advice about avoiding cp -f and ln -f.
Although that advice was reasonable for the early 1990s, the -f
option is portable for both cp and ln nowadays.  These options
were standardized in POSIX 1003.2-1992, and pre-POSIX systems such
as SunOS 4 are no longer of practical concern.
2015-01-02 13:03:39 -08:00
Paul Eggert
3d6479f6ae maint: bump copyright year
* doc/autoconf.texi: Update copyright year.
This had to be done by hand.
2015-01-02 13:03:39 -08:00
Paul Eggert
7b13e39a11 maint: bump copyright to 2015
* all files: Run 'make update-copyright'.
2015-01-02 13:03:39 -08:00
Stefano Lattarini
77694d0f0e Fix spurious testsuite failure when /bin/sh is dash
The testsuite used slightly different logic in the code employed to
decide whether a test should be skipped due to a limitation of the
selected shell, and in the code running the test itself.

* tests/autotest.at (Syntax error): Adjust.
(parallel syntax error): Likewise.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2014-12-17 14:10:21 +01:00
Gary V. Vaughan
247b02e5a5 tests: avoid spurious test failure with libtool 2.4.3
Based on a report by Bruce Dubbs.

* tests/foreign.at (Libtool): Be tolerant of 'quote' replacing the
older `quote'.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-11-03 07:25:03 +01:00
Eric Blake
36b77d7db8 docs: mention that not all values can be exported
There has been a LOT of news about bash's Shell Shock bug lately.
Document some of the ramifications it has on portable scripting.

* doc/autoconf.texi (Limitations of Builtins) <export>: Add some
details about Shell Shock CVE-2014-6271.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-11-03 07:17:15 +01:00
Paul Eggert
0263a9ff90 doc: distinguish GCC from GNU C, etc.
* doc/autoconf.texi (C Compiler, Objective C Compiler)
(Objective C++ Compiler, Fortran Compiler): Be more careful about
distinguishing GNU C from GCC, and similarly for other languages.
Problem reported by Marko Lindqvist in:
http://lists.gnu.org/archive/html/autoconf/2014-09/msg00027.html
2014-09-08 10:16:50 -07:00
Paul Eggert
9d1564fc5b autoconf: clarify "checking" message for GNU-compatible compiliers
Problem reported by Bastien Chevreux in:
http://lists.gnu.org/archive/html/autoconf/2014-09/msg00022.html
and idea for fix by Eric Blake in:
http://lists.gnu.org/archive/html/autoconf/2014-09/msg00025.html
* doc/autoconf.texi (Running the Preprocessor)
(Present But Cannot Be Compiled):
Adjust examples to match current behavior.
* lib/autoconf/lang.m4 (_AC_LANG_COMPILER_GNU): Say
"checking whether the compiler supports GNU C", not
"checking whether we are using the GNU C compiler".
2014-09-08 09:25:51 -07:00
Paul Eggert
43b1ebeebb autoconf: fix typo in previous change
* lib/autoconf/c.m4 (AC_C_RESTRICT): Fix typo in previous change.
2014-09-02 12:08:51 -07:00
Paul Eggert
785c3dff65 autoconf: port 'restrict' to GCC 4.2.1
* lib/autoconf/c.m4 (AC_C_RESTRICT): Detect GCC bug 14050.
Problem reported by Marco Munari for OpenBSD 5.5.
2014-09-02 11:44:00 -07:00