Commit Graph

3116 Commits

Author SHA1 Message Date
Paul Eggert
0c39ab024f Test AC_FC_LINE_LENGTH only to 250 columns
* NEWS, doc/autoconf.texi, lib/autoconf/fortran.m4:
Document 250, not 254.
* tests/fortran.at (AC_FC_LINE_LENGTH): Test lines with 250
columns not 253, since Oracle Studio 12.6 Fortran 95 8.8
2017/05/30 goes up only to 250.
2020-07-17 15:07:31 -07:00
Paul Eggert
c03ca42de3 Fix ${VAR-NONWORD} bugs
* lib/autoconf/functions.m4 (AC_FUNC_SELECT_ARGTYPES):
* lib/autoconf/programs.m4 (AC_FUNC_SELECT_ARGTYPES):
* lib/autotest/general.m4 (AT_INIT):
Rewrite to avoid ${VAR-VALUE} where VALUE is not a shell word.
2020-07-16 23:08:10 -07:00
Zack Weinberg
f7693b83f2
Revise documentation for AC_PROG_LEX.
- Better explanation of the additional tests performed by this macro,
   once the tool has been located.

 - Update advice re using Flex to generate a bundled lex.yy.c.

 - Remove text describing a bug in Automake that has long since been
   corrected.
2020-07-16 14:48:09 -04:00
Paul Eggert
29ede6b96f AC_PROG_LEX no longer sets LEXLIB for yywrap
Suggested by Zack Weinberg in:
https://lists.gnu.org/r/autoconf-patches/2020-07/msg00016.html
* lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL):
Define yywrap too.
2020-07-16 10:48:09 -07:00
Paul Eggert
eb4a1d7faf Fix AC_PROG_LEX regression
Problem reported by Ross Burton in:
https://savannah.gnu.org/support/?110269
* lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL):
If tests indicate that LEX or LEXLIB does not work, set LEX to ":"
and LEXLIB empty, instead of failing out of 'configure' entirely.
2020-07-16 09:49:14 -07:00
Paul Eggert
d45c2e2f5b Revert mistaken patch for Bison
Problem reported by Bruno Haible in:
https://savannah.gnu.org/support/?110266
* lib/autoconf/programs.m4 (AC_PROG_YACC):
Go back to using bison -y instead of bison -o y.tab.c.
2020-07-15 13:30:56 -07:00
Paul Eggert
6997ed9cee Revert mistaken patch for Wine
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_CROSS):
Revert patch trying to cater to GNU/Linux builds
for Wine.  They should use --build as well as --host.
Problem reported by Bruno Haible in:
https://savannah.gnu.org/support/?110268
2020-07-15 11:51:07 -07:00
Zack Weinberg
a1acd8e66b
Formally obsolete AC_CONFIG_HEADER (#105403)
This macro was replaced by AC_CONFIG_HEADERS many years ago (before
the beginning of the VCS history) and isn’t even documented, but we
never got around to making autoupdate notice it.  Problem reported
*in 2006* by jensseidel@users.sf.net.

There was one use of AC_CONFIG_HEADER in our source tree, which is
converted.  Also, to avoid confusing people reading old NEWS or TODO
entries, all mentions of AC_CONFIG_HEADER therein are also replaced
with AC_CONFIG_HEADERS.

* lib/autoconf/status.m4 (AC_CONFIG_HEADER): Make an AU_ALIAS for
  AC_CONFIG_HEADERS.
2020-07-12 11:59:14 -04:00
Zack Weinberg
d5cb54d02d
Add AC_PROG_EGREP to AU_DEFUN for AC_HEADER_STDC (#110215)
AC_HEADER_STDC used to use AC_EGREP_CPP, and therefore had the side
effect of AC_REQUIRE([AC_PROG_EGREP]).  In 2.70 AC_HEADER_STDC is an
AU_DEFUN and, before this change, the replacement didn’t invoke
AC_PROG_EGREP, which broke configure scripts that assumed $EGREP would
be set.  Problem reported by Ross Burton.

* lib/autoconf/headers.m4 (AU::AC_HEADER_STDC): Also invoke AC_PROG_EGREP.
2020-07-12 11:26:47 -04:00
Tom
8173e5d6fe
Fix logic error in _AC_PROG_LEX_YYTEXT_DECL (#109320)
The search for the appropriate value for @LEXLIB@ did not distinguish
correctly between success (‘break’ out of a shell for loop, having set
$ac_cv_lib_lex) and failure (normal termination of the loop, value in
$ac_cv_lib_lex is garbage).  Bug report and original patch by
Tom <tom@ojodeagua.com> with refinements by Zack Weinberg.

* lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL):
  Error out if we cannot find the library that (f)lex scanners
  need to be linked against, instead of continuing with @LEXLIB@
  set to the empty string.
2020-07-12 10:52:26 -04:00
Paul Eggert
63e8f7ad4d Fix ac_compiler_gnu bug
Problem and fix reported by Jannick in:
https://lists.gnu.org/r/autoconf/2020-03/msg00045.html
except that I omitted the comment, which I thought unnecessary.
* lib/autoconf/lang.m4 (_AC_LANG_COMPILER_GNU): Set
ac_compiler_gnu regardless of whether result was from cache.
2020-07-10 12:50:57 -07:00
Luke Mewburn
c6daae4127
AS_INIT: basename __file__
Fix AS_INIT to encode the basename of __file__
instead of the full path to the source directory.
Allows for reproducible builds.
2020-07-05 09:45:52 -04:00
Paul Eggert
d0acdabdec Fix AC_CHECK_LIB quoting bug
Problem reported by Bert Wesarg in:
https://lists.gnu.org/archive/html/autoconf/2016-04/msg00020.html
* lib/autoconf/libs.m4 (AC_CHECK_LIB): Fix quoting bug.
* tests/semantics.at (AC_CHECK_LIB): Add a test for the bug.
2020-07-02 22:24:38 -07:00
Zack Weinberg
0a0a337886 Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument.  It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list.  The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.

Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.

Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names).  Here’s
its documentation comment:

| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.

The text of the warning is

| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded

If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:

| configure.ac:N: note: ‘dnl’ is a macro

All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.

This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .

In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.

* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
  (AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
  m4_validate_w before use.

* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
  _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
  (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
  (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.

* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
  _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.

* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.

* tests/semantics.at: Add tests for expansion of M4 macros in
  whitespace-separated list arguments to all of the above.
2020-06-29 23:17:15 -07:00
Zack Weinberg
d330dd6273 AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally.
While investigating something else, I noticed that AC_REPLACE_FUNCS
calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an
AC_CHECK_FUNC.  This doesn’t work; both of those are marker macros
that need to be expanded unconditionally at m4 time so that traces
(placed by autoheader and automake, respectively) will fire.  In order
to fix this while keeping the code readable, I would up doing a major
refactor.  There are now four internal macros implementing AC_REPLACE_FUNCS.

_AC_REPLACE_FUNC_U is called unconditionally for every shell word in
the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC +
AC_LIBSOURCE if it can, or issues a warning if it can’t.  (It could
make sense to make this a public function, if we think shell variables
in the AC_REPLACE_FUNCS list need to be supported long-term.  I dunno
if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside
a shell conditional just as well.)

_AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test
performed for each function to be replaced; the difference is that _L
(for literal) can only be used on a function whose name is known at m4
expansion time, _NL (nonliteral) works regardless.  _AC_REPLACE_FUNCS,
which already existed, handles looping either at m4 time or shell time
as appropriate.  AC_REPLACE_FUNCS remains a thin wrapper that runs
_AC_REPLACE_FUNCS(m4_flatten([$1])).

The _bulk_ of the patch is changes to the testsuite so that it notices
the original bug.  Specifically, AT_CHECK_AUTOHEADER now takes an
argument which is a whitespace-separated list of preprocessor macro
names that ought to appear in the generated config.h.in.  This can be
set to ‘ignore’ to skip the test, and unfortunately that’s what the
“trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so
coverage is not ideal, but it’s better than what we had.  Also,
AT_CHECK_M4 now normalizes the backtrace lines that appear in the
output of an AC_DIAGNOSE, e.g.

    configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete.
    configure.ac:6: You should run autoupdate.
    ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from...
    configure.ac:6: the top level

becomes

    configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete.
    configure.ac:6: You should run autoupdate.
    lang.m4: AC_LANG_SAVE is expanded from...
    configure.ac:6: the top level

This allows us to write tests for these diagnostics that don’t depend
on the relationship between the source and build directories, and
won’t break when unrelated patches change the line number of a macro
definition.

	* lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS)
        (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS,
        _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L,
        _AC_REPLACE_FUNC_NL.  Ensure that _AH_CHECK_FUNC and
        AC_LIBSOURCE are invoked unconditionally at m4 expansion
        time for each literal function name in the argument to
        AC_CHECK_FUNCS.  Issue warnings about non-literal names.

        * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from
        the output of AC_DIAGNOSE / m4_warn.
        (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS
        giving a list of preprocessor macro names that should appear
        in the generated config.h.in.  Use AT_CHECK_M4 to invoke autoheader.
        (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO):
        Update uses of AT_CHECK_AUTOHEADER.
        * tests/fortran.at, tests/semantics.at, tests/tools.at
        * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER.

        * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat
        more thorough, using new functionality of AT_CHECK_M4 and
        AT_CHECK_AUTOHEADER.

Signed-off-by: Zack Weinberg <zackw@panix.com>
2020-06-29 23:17:15 -07:00
Paul Eggert
c92f7606d6 make fetch 2020-06-29 17:08:26 -07:00
Paul Eggert
b3eb40f9c9 Save and check Autom4te version in cache
Problem reported in <https://bugs.debian.org/219621>.
* bin/autom4te.in: Save and check autom4te version number into cache index.
* lib/Autom4te/C4che.pm (save): New arg $version.  All callers changed.
(good_version): New sub.
2020-06-29 17:08:26 -07:00
Paul Eggert
a1d8293f3b Fix undefined behavior in AC_SYS_LARGEFILE
* lib/autoconf/specific.m4 (_AC_SYS_LARGEFILE_TEST_INCLUDES):
Avoid undefined behavior on platforms where off_t is 32 bits.  See:
https://bugs.debian.org/742780
2020-06-29 17:08:26 -07:00
Andreas Barth
9019c72d8f Look for AM_PROG_LIBTOOL too
This helps out dh-autoreconf on Debian
<https://bugs.debian.org/759739>.
* bin/autoreconf.in (autoreconf_current_directory):
* lib/autom4te.in (args): Look for AM_PROG_LIBTOOL too.
Copyright-paperwork-exempt: Yes
2020-06-29 17:08:26 -07:00
Zack Weinberg
8a09003664
Define $as_echo and $as_echo_n for backward compatibility.
Commit 2b59b6f8a7 removed the internal
shell variables $as_echo and $as_echo_n.  It turns out that these are
used by several widely-used third-party m4 files (notably both
gnulib-common.m4 from gnulib, and ax_pthread.m4 from the Autoconf
macro archive) as well as any number of existing configure.ac’s.

Restore these shell variables, unconditionally defining them to use
printf.  Issue -Wobsolete warnings if they are used, recommending the
use of AS_ECHO and AS_ECHO_N respectively.  Add a test which checks
both that they do work and that they trigger warnings.
2020-03-13 14:50:50 -04:00
Zack Weinberg
b2e4b63337
_AS_REEXEC_WITH_SHELL: don’t use AS_EXIT.
If _AS_REEXEC_WITH_SHELL fails to exec the selected “better” shell
interpreter, and that failure somehow doesn’t terminate the process,
it calls AS_EXIT([255]).  This expands to an invocation of as_fn_exit.
However, the definition of as_fn_exit goes into the M4SH-INIT-FN
diversion, whereas _AS_REEXEC_WITH_SHELL goes into the M4SH-SANITIZE
diversion, so as_fn_exit won’t be defined at the point of this use.
We can’t move the definition of as_fn_exit earlier, because we don’t
know that the shell supports shell functions until after we get to the
end of the M4SH-SANITIZE diversion.

This is only a theoretical bug because, as the comments say, “all the
known shells bail out after a failed exec.”  However, a shell that
doesn’t bail out will instead give the user a flood of nonsensical
error messages (starting with “as_fn_exit: not found” and then going
on to choke on the rest of the script) so I think we should fix it
anyway.  There shouldn’t be any problem with using a plain ‘exit’ at
this point; no traps are active yet, and we are exiting with an
explicit error code.
2020-03-13 13:38:46 -04:00
Paul Eggert
9894c7b5ba Fix _AS_DETECT_BETTER_SHELL breakage
Problem reported by Zack Weinberg in:
https://lists.gnu.org/r/autoconf/2020-03/msg00017.html
* lib/m4sugar/m4sh.m4 (_AS_RUN): Use sh -c instead of
the no-longer-existent $as_echo.  This fixes a bug introduced
in 2013-01-28T03:44:45Z!gary@gnu.org.
2020-03-12 17:49:12 -07:00
Paul Eggert
98d67d660d Mention 32-bit GNU/Linux 64-bit inodes
* lib/autoconf/specific.m4 (AC_SYS_LARGEFILE):
In a comment, mention 64-bit inode problem on 32-bit GNU/Linux.
This is taken from Gnulib.
2020-02-21 17:24:19 -08:00
Paul Eggert
2864a5dbbf Remove definition of _DARWIN_USE_64_BIT_INODE
It’s not needed in currently-supported macOS versions, and was
problematic anyway in MacOS X 10.5 which was the only version that
could use it.  Problem reported by Peter Eisentraut in:
https://lists.gnu.org/r/bug-autoconf/2020-02/msg00004.html
* lib/autoconf/specific.m4 (AC_SYS_LARGEFILE):
Don’t define _DARWIN_USE_64_BIT_INODE.
2020-02-21 17:24:19 -08:00
Jim Meyering
d78a7dd95f maint: make update-copyright 2020-01-01 11:45:50 -08:00
Paul Eggert
babc8660d5 Fix terminology typo in mkdir -p check
* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P): Say “race-free”, not
“thread-safe”.  Problem reported by Reuben Thomas in:
https://lists.gnu.org/r/bug-autoconf/2019-09/msg00003.html
2019-10-06 01:38:10 -07:00
Paul Eggert
4677fc349c Port AC_C_BIGENDIAN to recent clang
Problem and trivial patch reported by Matthieu Gautier in:
https://lists.gnu.org/r/bug-autoconf/2019-05/msg00006.html
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Use unsigned short for
values greater than 2**15 - 1.
2019-05-29 13:00:59 -07:00
Noah Misch
92851e84f7 AC_CHECK_DECL: when cached, don't overwrite a werror flag
* 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.
2018-11-24 20:57:43 -08:00
Paul Eggert
487d6aaaa4 lib: use list of unsafe chars, not safe ones
* 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
2018-03-19 20:19:46 -07:00
Daniel Colascione
f0aa3cc07a fix quoting 2018-03-19 20:19:46 -07:00
Paul Eggert
e5f5e535ad lib: fix update_file timestamps
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.
2017-10-29 13:01:15 -07:00
Paul Eggert
b0ee838e11 maint: update URLs
Most of this is replacing http: with https: when either will do.
2017-09-23 12:49:23 -07:00
Paul Eggert
c5b290f6ae lib: check ‘install file dir/’
* 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.
2017-09-23 12:49:23 -07:00
Paul Eggert
c47935de9e maint: sync from Automake
This just updates comments, notably URLs.
2017-09-23 12:49:23 -07:00
Paul Eggert
d3dcd5895d Prefer HTTPS to FTP and HTTP 2017-09-16 17:48:51 -07:00
Paul Eggert
5a4041daca make fetch 2017-09-16 17:48:51 -07:00
Jim Meyering
60460b91d0 maint: update copyright dates for 2017
* all files: Run "make update-copyright".
* doc/autoconf.texi: Update manually.
2017-01-01 05:18:32 -08:00
Paolo Bonzini
0e2eecedb1 autoconf: prefer an unrolled loop for trivial AC_CHECK_HEADERS
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>
2016-12-21 08:32:45 -06:00
Paolo Bonzini
c54beb85aa autoconf: prefer an unrolled loop for trivial AC_CHECK_FUNCS
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>
2016-12-21 08:32:45 -06:00
Eric Blake
0848232967 AC_CHECK_HEADERS_ONCE: hoist cache name computation to m4 time
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>
2016-12-21 08:32:43 -06:00
Eric Blake
d068c0a5ac AC_CHECK_FUNCS_ONCE: hoist cache name computation to m4 time
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>
2016-12-21 08:32:41 -06:00
Eric Blake
76183791a4 AC_CHECK_HEADERS_ONCE: hoist CPP name computation to m4 time
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>
2016-12-21 08:32:39 -06:00
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
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
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
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
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
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
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
bbfa63cd4a maint: make update-copyright 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
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
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
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
Paul Eggert
7b13e39a11 maint: bump copyright to 2015
* all files: Run 'make update-copyright'.
2015-01-02 13:03:39 -08: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
Jehan
fbec57294a cross-compiling: handling modern platforms able to run foreign binaries.
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_CROSS):
When only --host is set, and no --build, but in the end, the resulting
computed $build and $host are different, set $cross_compiling = yes.
Indeed we can't rely only on a successful test program run, because false
positives occur on some platforms. In particular modern GNU/Linux
distributions set Wine to automatically handle Windows binaries.
Consequently $cross_compiling gets set to "no" even though we are in an
obvious cross-compilation case.
(tiny change)
2014-08-08 17:06:45 -07:00
Paul Eggert
f6156ba050 autoconf: modernize AC_C_VARARRAYS for C11
* lib/autoconf/c.m4 (AC_C_VARARRAYS): Define __STDC_NO_VLA__ if
VLAs are not supported, as this is what C11 does.  The old macro
HAVE_C_VARARRAYS is still defined if they are supported, but is
now obsolescent.  Also, check for VLA bug in GCC 3.4.3.
* doc/autoconf.texi (C Compiler), NEWS: Document the above.
2014-08-07 17:17:25 -07:00
Eric Blake
0443fa8d43 m4sh: allow trailing newlines in shell conditions
Dimitrios Apostolou reported getting a shell syntax error for
this construct in his configure.ac:

AM_CONDITIONAL([HAVE_LIBXML2],
    [test "x$with_libxml2" != xno &&
     test "x$ac_cv_lib_xml2_xmlFirstElementChild" = xyes]
)

He analyzed it to a root cause: his trailing newline, coupled
with an 'if $2; then' construct in the macro body, resulted in
configure containing:
if test ... xyes
; then
where the semicolon is a syntax error in shell; and proposed
a patch to automake to fix his use case.

While that macro is not under our control, it does highlight
the fact that the shell can use either ; or newline to
terminate a conditional prior to the next keyword in a compound
statement.  If we use newline, we gain two benefits - the
configure file is slightly smaller (more lines, but fewer
bytes), and any user that doesn't realize that unquoted
trailing newlines in a macro argument are still significant
can still generate valid shell code when their argument is
used in a shell compound statement.

* lib/m4sugar/m4sh.m4 (AS_IF, _AS_IF, _AS_CLEAN_DIR): Prefer
newline over semicolon to end user-supplied conditionals.
* lib/autoconf/general.m4 (AC_CONFIG_AUX_DIRS): Likewise.
* lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise.
* lib/autoconf/programs.m4 (_AC_PATH_PROGS_FEATURE_CHECK):
Likewise.
* tests/m4sh.at (AS_IF and AS_CASE): Test it.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-07-17 15:40:12 -06:00
Eric Blake
3f98a56621 AC_INIT: quote invalid feature names
Changes:
   configure: error: invalid feature name: debug
to
   configure: error: invalid feature name: `debug '
to make it obvious if trailing space is the reason why a feature
name was rejected; similar to existing error messages elsewhere
about invalid shell variable names.

* lib/autoconf/general.m4 (_AC_INIT_PARSE_ENABLE2): Add quotes.
Reported by Noel Grandin.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-05-30 08:58:17 -06:00
Paul Eggert
4edc6a771f autoconf: fix typo in description generated by AC_RUN_IFELSE
* lib/autoconf/general.m4 (_AC_RUN_IFELSE): "run" not "link"
in description.
2014-05-11 22:16:03 -07:00
Vincent Lefevre
1717921aa6 Change main () to main (void) for C/C++
This patch changes "main ()" to "main (void)" for C/C++.
See: http://lists.gnu.org/archive/html/bug-autoconf/2014-01/msg00005.html

On my machine, before this patch, 3 tests were failing:

  38: tools.at:1329      autom4te cache locking
 218: autotest.at:1893   C unit tests
      ac_config_testdir at_tested autotest
 219: autotest.at:1948   C unit tests (EXEEXT)
      ac_config_testdir at_tested autotest

With this patch, 2 tests were failing:

 218: autotest.at:1893   C unit tests
      ac_config_testdir at_tested autotest
 219: autotest.at:1948   C unit tests (EXEEXT)
      ac_config_testdir at_tested autotest

(I suspect that 38 is unrelated.)

Signed-off-by: Vincent Lefevre <vincent@vinc17.net>
Copyright-paperwork-exempt: Yes
2014-02-13 11:38:12 -07:00
Eric Blake
29943c7e4a maint: fix 'make syntax-check' findings
Fix syntax check warnings that are unrelated to the new copyright
year.

* lib/local.mk (lib/autoscan/autoscan.list): Reduce indent, to
avoid mix of tab and 8 spaces.
* bin/local.mk (bin/autoconf.in): Likewise.
* lib/autoconf/c.m4 (_AC_CXX_CXX98_TEST_BODY): Use consistent case
in message.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-01-01 16:32:04 -07:00
Eric Blake
a610501ded maint: bump copyright to 2014
Done via 'make update-copyright', since all files are effectively
modified and distributed this year via public version control.

* all files: Update copyright year.
2014-01-01 16:27:53 -07:00
Zack Weinberg
f181785d0e Expose the checks done by AC_INCLUDES_DEFAULT as a public macro.
* lib/autoconf/headers.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS):
   Rename to AC_CHECK_INCLUDES_DEFAULT.  All callers changed.
   (AC_HEADER_STDC, AC_UNISTD_H): Use AC_CHECK_INCLUDES_DEFAULT instead
   of previous kludge.

 * doc/autoconf.texi, NEWS: Document AC_CHECK_INCLUDES_DEFAULT.
2013-09-21 20:02:47 -04:00
Zack Weinberg
5509c49845 Use AC_CHECK_{DECLS,FUNCS,HEADERS}_ONCE more in specific-check macros.
* lib/autoconf/functions.m4 (AC_FUNC_CHOWN): No need to check for unistd.h.
   (_AC_LIBOBJ_FNMATCH): Use AC_CHECK_DECLS_ONCE and AC_CHECK_FUNCS_ONCE.
   (_AC_LIBOBJ_GETLOADAVG): Use AC_CHECK_FUNCS_ONCE for setlocale.
   (AC_FUNC_MMAP): Use AC_CHECK_FUNCS_ONCE for getpagesize.
   (AC_FUNC_SELECT_ARGTYPES): Use AC_CHECK_HEADERS_ONCE for sys/select.h and
   sys/socket.h.
   (AC_FUNC_STRERROR_R): Use AC_CHECK_DECLS_ONCE + AC_CHECK_FUNCS_ONCE for
   strerror_r.
   (AC_FUNC_UTIME_NULL): Use AC_CHECK_HEADERS_ONCE for utime.h.
   (AC_FUNC_FORK): Use AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE.
   (AC_FUNC_VPRINTF): Use AC_CHECK_FUNCS_ONCE for vprintf (but not _doprnt).

 * lib/autoconf/headers.m4 (AC_HEADER_TIME, AC_MEMORY_H): Use
   AC_CHECK_HEADERS_ONCE.
2013-09-21 19:55:46 -04:00
Zack Weinberg
bb7b27a9c7 Use AC_CHECK_HEADERS_ONCE for the tests done by AC_INCLUDES_DEFAULT.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS_ONCE): Divide into a public
   macro that AC_REQUIREs _AC_INCLUDES_DEFAULT_REQUIREMENTS, and ...
   (_AC_CHECK_HEADERS_ONCE): ... a private macro, that doesn't.
   (_AC_HEADERS_EXPANSION): Use $ac_includes_default, not
   AC_INCLUDES_DEFAULT.
   (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Use AC_CHECK_HEADERS_ONCE.
2013-09-21 19:38:17 -04:00
Zack Weinberg
86c213d0e3 Modernize AC_INCLUDES_DEFAULT and friends.
* lib/autoconf/headers.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS):
   Include stddef.h, stdlib.h, and string.h unconditionally.
   Don't include memory.h at all.
   Don't use AC_HEADER_STDC.
   Don't check for stddef.h, stdlib.h, string.h, or memory.h.
   For compatibility, unconditionally define STDC_HEADERS,
   HAVE_STDLIB_H, and HAVE_STRING_H.
   (AN_HEADER list): Remove C89 headers, and memory.h from list.
   (AC_HEADER_STDC, AC_UNISTD_H): AU_DEFUN to trigger
   _AC_INCLUDES_DEFAULT_REQUIREMENTS if it hasn't already happened,
   and do nothing else.
   (AC_HEADER_TIME): AU_DEFUN, and define TIME_WITH_SYS_TIME unconditionally
   as long as sys/time.h is present.
   (AC_USG, AC_MEMORY_H): Assume existence of string.h.
 * lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF):
   Don't use AC_HEADER_STDC. Assume stdlib.h exists.
   (AC_FUNC_MKTIME): Don't use AC_HEADER_TIME.  Assume time.h exists.
   (AC_FUNC_ALLOCA): Assume stdlib.h exists.
   (_AC_LIBOBJ_FNMATCH): Assume wchar.h and wctype.h exist.
   (_AC_LIBOBJ_GETLOADAVG): Assume locale.h exists.
   (AC_FUNC_MMAP): Assume stdlib.h exists.
 * tests/tools.at: Use AC_WORDS_BIGENDIAN instead of AC_STDC_HEADERS in
   autoupdate test.

 * NEWS, doc/autoconf.texi: Document changes. Remove obsolete advice.
2013-09-21 19:38:09 -04:00
Zack Weinberg
11f520c61d AC_CHECK_HEADER/AC_CHECK_HEADERS: complete transition to compile tests.
* lib/autoconf/headers.m4 (AC_CHECK_HEADER): Use _AC_CHECK_HEADER_COMPILE
  by default.  Continue to use _AC_CHECK_HEADER_PREPROC if fourth arg is '-'.
  (_AC_CHECK_HEADER_PREPROC): Issue a deprecation warning.
  (_AC_CHECK_HEADER_MONGREL, _AC_CHECK_HEADER_MONGREL_BODY): Remove.

* tests/c.at, tests/semantics.at: Update uses of AC_CHECK_HEADER(S).
* doc/autoconf.texi, NEWS: Document change.
2013-09-21 19:01:40 -04:00
Eric Blake
a197431414 AC_INIT: add --runstatedir option to configure
http://lwn.net/Articles/436012/ documents that many distros
are now preferring to use /run rather than /var/run for
storage of pid files and other per-process temporary files
that must not be cleaned out during arbitrary TMPDIR sweeps.
As such, the GNU Coding Standards were recently changed to
recommend a new configure option to make it easy to choose
this directory at configure time.  This patch adds support
for the option to all configure scripts built by autoconf.

* general.m4 (_AC_INIT_PARSE_ARGS): Add new directory option.
(_AC_INIT_HELP): Document it.
* doc/autoconf.texi (Installation Directory Variables): Document
new option.
(Site Defaults): Mention typical use within a distro.
* NEWS: Mention the addition.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-09-14 06:28:34 -06:00
Eric Blake
f5b1ea6793 AC_PROG_CC: also try $CC -version, for cl6x compiler
Anaïs Bouque reported that the cl6x compiler only understands -version:
https://lists.gnu.org/archive/html/bug-autoconf/2013-07/msg00003.html

* c.m4 (AC_PROG_CC): Add another version probe.
* THANKS: Update.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-09-12 09:26:25 -06:00
Paul Eggert
3d9fa1399e * lib/autoconf/functions.m4 (HAVE_DOPRNT): Fix missing-comma typo.
Reported by Peter Breitenlohner in:
http://lists.gnu.org/archive/html/autoconf-patches/2013-06/msg00007.html
2013-06-21 11:00:58 -07:00
Stefano Lattarini
aa5f20ecd0 AC_PROG_CC: don't check whether $CC supports "-c -o" together
This reverts commit ce48964f.  The extra code added by that commit was
planned to be used by future version of Automake, but the implementation
and future directions there have in the meantime be changed in a way
that makes the extra code in Autoconf superfluous.  Just get rid of it.

* lib/autoconf/c.m4 (AC_PROG_CC): Adjust.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-28 14:11:17 +02:00
Stefano Lattarini
569ab3f6b1 maint: sync few files from upstream
* build-aux/config.guess: This file.
* lib/Autom4te/Channels.pm: And this one.
* maint.mk: And this one.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-28 14:10:28 +02:00
Stefano Lattarini
ef573a26aa build: remove last make recursion (for subdir 'man')
* Makefile.am (SUBDIRS): Remove (its last component 'man' has just
been removed).
(SUFFIXES): New, defined to empty, to be updated later by included
files.
($(srcdir)/man/local.mk): Include this.
* configure.ac (AC_CONFIG_FILES): Drop 'man/Makefile'.
* lib/freeze.mk (SUFFIXES): Extend with '+=' rather than defining
with '='.
* man/Makefile.am: Rename ...
* man/local.mk: ... like this, and adjust throughout.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:50:07 +02:00
Stefano Lattarini
b8c07dc5b0 build: no more recursion for 'tests' subdir
* Makefile.am (SUBDIRS): Drop 'tests'.  Adjust comments.
(DISTCLEANFILES, MAINTAINERCLEANFILES): Define to empty, to be
updated later.
(MAINTAINERCLEANFILES): Adjust later definition to use '+='
rather than '='.
($(srcdir)/tests/local.mk): Include this.
* configure.ac (AC_CONFIG_FILES): Drop 'tests/Makefile'.
* lib/freeze.mk ($(AUTOM4TE_CFG)): Drop now-redundant remake rule.
($(build_libdir)/m4sugar/version.m4): Likewise.
* tests/Makefile.am: Rename ...
* tests/local.mk: ... like this, and adjust (quite heavily).
* tests/mktests.sh: Adjust to generate output files and temporary
files in the tests subdirectory rather than in the current
directory.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:35:42 +02:00
Stefano Lattarini
fa18cbafd8 build: fixup: don't define ETAGS_ARGS multiple times
* Makefile.am (ETAGS_ARGS): Define to empty, to be updated later.
* bin/local.mk (ETAGS_ARGS): Append to it, rather than re-defining it.
* lib/local.mk (ETAGS_ARGS): Likewise.  Also, do not bother appending
"--lang=perl" once again, as that is already done in 'bin/local.mk'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:35:37 +02:00
Stefano Lattarini
f7932b176c build: avoid repeating the same etags args several times
* lib/local.mk: Here.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:33:04 +02:00
Stefano Lattarini
a2af455752 build: no more recursion for lib 'subdir'
* Makefile.am (SUBDIRS): Drop 'lib'.
(edit): New, shared among the recipes in 'lib/local.mk' and
'bin/local.mk'.
(CLEANFILES): New, will be updated later in included files.
($(srcdir)/lib/local.mk): Include it.
($(srcdir)/lib/freeze.mk): Likewise.
* lib/Makefile.am: Rename ...
* lib/local.mk: .. like this, with several adjustments.  In
particular ...
(edit): Drop this definition, subsumed by the one in the
top-level Makefile.am.
* bin/local.mk (edit): Drop definition, that is already present
in the top-level Makefile.am now.
($(srcdir)/lib/freeze.mk): Drop inclusion; that is already done
in the top-level Makefile.am now.
* doc/local.mk (CLEANFILES): Adjust: append to it, do not define
it.
* lib/freeze.mk ($(AUTOM4TE_CFG)): Adjust recipe.
* configure.ac (AC_CONFIG_FILES): Drop 'lib/Makefile'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:26:37 +02:00
Stefano Lattarini
f8ac780d14 build: define RELEASE_YEAR with AC_SUBST
Rather than reading it dynamically from the ChangeLog -- that,
remember, is only a dummy in a Git checkout!  To avoid risking
the definition to get out-of-sync, let's enhance the maintainer
target 'update-copyright' to update it automatically (the same
way it's done in the Automake build system).

* configure.ac (RELEASE_YEAR): New AC_SUBST'd variable.
* cfg.mk (update-release-year): New maintainer-specific target
to automatically update the value of that variable.
(update-copyright): Depend on the new target.
* bin/local.mk (RELEASE_YEAR): Drop definition.
(edit): Simplify quoting of $(RELEASE_YEAR).
* lib/Makefile.am (RELEASE_YEAR): Drop definition.
(m4sugar/version.m4): Simplify quoting of $(RELEASE_YEAR).

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:23:20 +02:00
Stefano Lattarini
3c5f3ba069 build: no more recursion for 'lib/Autom4te' subdir
* lib/Autom4te/Makefile.am: Delete, its contents merged ...
* lib/Makefile.am: ... in here, with proper adjustments.
(SUBDIRS): Delete (last component 'Autom4te' has been dropped).
* configure.ac (AC_CONFIG_FILES): Drop 'lib/Autom4te/Makefile'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:22:24 +02:00
Stefano Lattarini
0891dc5f0d build: no more recursion for' lib/autoconf' subdir
* lib/autoconf/Makefile.am: Delete, its contents merged ...
* lib/Makefile.am: ... in here, with proper adjustments.
(SUBDIRS): Drop 'autoconf'.
* configure.ac (AC_CONFIG_FILES): Drop 'lib/autoconf/Makefile'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:22:24 +02:00
Stefano Lattarini
6e35109fd3 build: no more recursion for 'lib/m4sugar' subdir
* lib/m4sugar/Makefile.am: Delete, its contents merged ...
* lib/Makefile.am: ... in here, with proper adjustments.
(SUBDIRS): Drop 'lib/m4sugar'.
Other related adjustments and re-organizations.
* configure.ac (AC_CONFIG_FILES): Drop 'lib/m4sugar/Makefile'.
* lib/freeze.mk ($(build_libdir)/m4sugar/version.m4): Adjust
recipe.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:22:24 +02:00
Stefano Lattarini
6cef85e8d6 build: no more recursion for 'lib/autotest' subdir
* lib/autotest/Makefile.am: Delete, its contents merged ...
* lib/Makefile.am: ... in here, with proper adjustments.
(SUBDIRS): Drop 'autotest'.
Other minor related modifications.
* configure.ac (AC_CONFIG_FILES): Drop 'lib/autotest/Makefile'.
* lib/freeze.mk (MY_AUTOM4TE): Small required adjustments.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:22:23 +02:00
Stefano Lattarini
16d8b403b5 build: no more recursion for 'lib/autoscan' subdir
* lib/autoscan/Makefile.am: Delete, its contents merged ...
* lib/Makefile.am: ... in here, with proper adjustments.
(SUBDIRS): Drop 'autoscan'.
* configure.ac (AC_CONFIG_FILES): Drop 'lib/autoscan/Makefile'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:22:23 +02:00
Stefano Lattarini
0e7ac8501f build: no more recursion for 'lib/emacs' subdir
* lib/emacs/Makefile.am: Delete, its contents merged ...
* lib/Makefile.am: ... in here, with proper adjustments.
(SUBDIRS): Drop 'emacs'.
* configure.ac (AC_CONFIG_FILES): Drop 'lib/emacs/Makefile'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 12:22:17 +02:00
Stefano Lattarini
3184ecc187 build: don't distribute lib/freeze.mk explicitly
It is automatically distributed by Automake, being included by
other Makefile.am files.

* lib/Makefile.am (EXTRA_DIST): Drop 'freeze.mk'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-05-06 11:53:34 +02:00
Paul Eggert
0bdae82738 AC_PROG_CC etc: avoid warnings when removing conftest* on OS X
I forgot one of the fixes Mr. Nakada reported for the 2013-03-08 fix.
* lib/autoconf/general.m4 (AC_EGREP_CPP):
Use rm -rf, not just rm -f, when removing conftest*.
2013-03-19 11:22:34 -07:00
Akim Demaille
42761668c0 AC_PROG_YACC: don't force Bison to warn against its own features
When invoked with -y/--yacc, Bison warns when its extensions over
POSIX Yacc are used.  Yet many packages requiring GNU Bison use
Autoconf/Automake's Yacc support, which passes -y to Bison.  It
turns out that passing '-o y.tab.c' has exactly the desired
effect: generating not only y.tab.c but also y.tab.h with -d and
y.output with -v.  See:
http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00100.html
* lib/autoconf/programs.m4 (AC_PROG_YACC): Use bison -o y.tab.c.
* NEWS, doc/autoconf.texi: Document this change.
2013-03-19 11:19:40 -07:00
Paul Eggert
88b2010a97 AC_PROG_CC etc: avoid warnings when removing conftest* on OS X
Reported by Nobuyoshi Nakada in:
http://lists.gnu.org/archive/html/autoconf-patches/2013-03/msg00003.html
* lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_CC_C_O, AC_PROG_CXX_C_O):
* lib/autoconf/fortran.m4 (_AC_PROG_FC_C_O):
* lib/autoconf/functions.m4 (AC_FUNC_SELECT_ARGTYPES):
Use rm -rf, not just rm -f, when removing conftest*.
2013-03-08 08:56:48 -08:00
Paul Eggert
1c048e2f9f AC_FUNC_SETPGRP: work even when cross-compiling
* lib/autoconf/functions.m4 (AC_FUNC_SETPGRP):
Use AC_COMPILE_IFELSE rather than AC_RUN_IFELSE.
Problem reported by Alvaro Soliverez in
<http://lists.gnu.org/archive/html/bug-autoconf/2013-02/msg00002.html>.
2013-02-13 23:28:48 -08:00
Paul Eggert
1e3779d9b1 AC_USE_SYSTEM_EXTENSIONS: improve port to HP-UX
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
On hosts that need _XOPEN_SOURCE, define it when configuring, too,
so that it's compatible with the value used when compiling.
2013-02-08 13:09:33 -08:00
Paul Eggert
9e33646cac AC_USE_SYSTEM_EXTENSIONS: port to HP-UX, MINUX 3, OS X.
* NEWS: Mention this.
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
Define _NETBSD_HOST on MINUX, for MINUX 3.
Define _DARWIN_C_SOURCE, for OS X.
On HP-UX, define _XOPEN_SOURCE.
2013-02-06 22:47:17 -08:00
Gary V. Vaughan
c3d301efd6 m4sugar: fix AS_VAR_GET regression.
AS_VAR_GET expands AS_ECHO inside en evaled single quoted string,
which causes the single quotes in "printf '%s\n'" to expose the
%s\n to the shell which expands "\n" to simply "n" before passing
it to printf.
* lib/m4sugar/m4sh.m4 (AS_ECHO): Use double quotes around the
format string.
* doc/autoconf.texi (Limitations of Shell Builtins): Show double
quotes to match AS_ECHO expansion.
* NEWS: Likewise.
2013-01-29 19:25:14 +07:00
Gary V. Vaughan
2b59b6f8a7 m4sugar: factor away _AS_ECHO_PREPARE.
"printf '%s\n' ..." has been a fine replacement for plain "echo"
for at least 5 years (probably more like 10), even with most
museum-piece shells.
* lib/m4sugar/m4sh.m4 (_AS_ECHO_PREPARE): Remove.
(_AS_SHELL_SANITIZE): Keep as_nl setting originally from
_AS_ECHO_PREPARE here where it more properly belongs.
(AS_ECHO, AS_ECHO_N): Use printf unconditionally.
* doc/autoconf.texi (Limitations of Shell Builtins): Document
preference for 'printf' over working around 'echo' bugs.
* NEWS: Updated.
Reported by Jim Meyering.
2013-01-29 16:47:48 +07:00
Roger Leigh
bd79b51000 AC_PROG_CXX: Add checks for C++11, C++98TR1 and C++98
These checks are the C++ equivalent of the existing C
standards checks.
* doc/autoconf.texi (C++ Compiler): Document new behavior.
* lib/autoconf/c.m4 (AC_PROG_CXX): Try for C++11,
falling back to C++98.
(_AC_CXX_STD_TRY, _AC_CXX_CXX98_TEST_HEADER, _AC_CXX_CXX98_TEST_BODY)
(_AC_CXX_CXX11_TEST_HEADER, _AC_CXX_CXX11_TEST_BODY)
(_AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11):
New macros.
2013-01-28 23:32:05 -08:00
Eric Blake
93ed0f1524 AT_TESTED: fix regression in word splitting
Regression introduced in commit 851ef51.

* lib/autotest/general.m4 (AT_TESTED): Rework loop to quote each
element, not the entire argument.
2013-01-16 14:53:46 -07:00
Paul Eggert
33545d77b2 AC_SYS_LARGEFILE: port better to Mac OS X 10.5.
* lib/autoconf/specific.m4 (AC_SYS_LARGEFILE): Use AC_DEFINE, not
AH_VERBATIM, to define _DARWIN_USE_64_BIT_INODE, to avoid problems
with ino_t size being different for configuration time versus
build/run time.  Problem reported by PHO in
<http://lists.gnu.org/archive/html/bug-autoconf/2013-01/msg00040.html>.
2013-01-16 09:27:37 -08:00
Stefano Lattarini
ce48964f64 AC_PROG_CC: also check whether $CC supports "-c -o" together
This is for Automake and its 'subdir-object' mode (see automake bug#13378,
in particular <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13378#73>), so
we make the new behavior available only if the special witness macro
'_AM_PROG_CC_C_O_HELPME' is defined (future Automake versions will define
it).  We might decide, at a later date, to make this behaviour public;
but then we'll have to discuss its usefulness and design more in depth,
and if they are agreed upon, adjust the documentation to match, and also
decide what to do with the macro AC_PROG_CC_C_O, with its similar (but
slightly incompatible) semantics; since doing so right now would bring us
off-track (and Automake needs this change *today*, or better, yesterday),
we proceed with this simpler hack.

* lib/autoconf/c.m4 (AC_PROG_CC): Adjust.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-01-11 11:11:31 +01:00
Eric Blake
fbaee459bf maint: bump copyright to 2013
Done via 'make update-copyright', since all files are effectively
modified and distributed this year via public version control.

* all files: Update copyright year.
2013-01-03 14:58:52 -07:00
Stefano Lattarini
5766355051 go: fix checks for about I/O functions
Reference:
<http://lists.gnu.org/archive/html/bug-autoconf/2013-01/msg00000.html>

* lib/autoconf/go.m4 (_AC_LANG_IO_PROGRAM(Go), AC_LANG_INT_SAVE): Here,
correctly use 'os.OpenFile()' <http://golang.org/pkg/os/#OpenFile>
rather than 'os.Open()' <http://golang.org/pkg/os/#Open> (which has
more restricted semantics and incompatible signature).

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-01-02 19:08:13 +01:00
Stefano Lattarini
adc8482c10 preselections: update for Automake 1.13.
Issue revealed by a failure in test "36: autom4te preselections".

* autoconf/lib/autom4te.in (Automake-preselections): Add
'AM_EXTRA_RECURSIVE_TARGETS', remove '_AM_EXTRA_RECURSIVE_TARGETS';
this latter is not, and will not be, present in any *released*
Automake version.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-12-29 11:01:40 +01:00
Paul Eggert
ca8b864f43 AC_C__GENERIC: New macro.
* NEWS, doc/autoconf.texi (C Compiler): Document it.
* lib/autoconf/c.m4 (AC_C__GENERIC): Implement it.
2012-12-27 14:35:16 -08:00
Paolo Bonzini
851ef51796 autotest: enable usage of EXEEXT in AT_TESTED
Together with Linux's binfmt-misc feature, Wine can be used to test
cross-compiled programs as if they were native.  However, the shell
will not perform the "magic" addition of the .exe extension after a
program name when searching for an executable.  These simple patches
let the user work around this by specifying $EXEEXT in the AT_CHECK
and AT_TESTED argument.  (More care is needed because of carriage
returns, but this is beyond the scope of this series).

* tests/autotest.at (AT_INIT): Expand contents of $at_tested.
(AT_TESTED): Quote each program that is passed to the function.
* lib/autotest/general.m4 (C unit tests): Add AT_TESTED invocation
and keyword.
* doc/autoconf.texi (Writing testsuites): Document usage of variables
in AT_TESTED.
* NEWS: Document change.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
2012-12-22 15:34:50 +01:00
Paolo Bonzini
d902536845 autotest: add a simple test suite that runs a C program
* tests/autotest.at (C unit tests): New testcase.
* NEWS: Document change.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
2012-12-22 15:34:50 +01:00
Paul Eggert
fd29dbd7d9 AC_FUNC_ALLOCA: port to recent BSDs and remove obsolete AIX
* doc/autoconf.texi (Particular Functions): Remove the AIX case
from the recommended code, as the most recent version of the AIX
compiler that IBM still supports (V10.1 as of this writing) has
<alloca.h> and thus longer needs this, and the old suggestion
wasn't completely working anyway.  Remove obsolete discussion of
SVR3 libPW alloca and of SVR4 libucb alloca.
* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA):
Rework to match documentation, including abovementioned AIX change.
Inconsistency with documentation reported by Steven G. Johnson in
<http://lists.gnu.org/archive/html/autoconf/2003-03/msg00179.html>.
As this adds stdlib.h, it should also fix the problems on recent
BSD platforms noted by Patrick Welche in
http://lists.gnu.org/archive/html/autoconf-patches/2012-12/msg00009.html
though the fix differs from NetBSD's current workaround.
Also, don't bother checking for alloca if <alloca.h> works,
as the latter implies the former.
2012-12-20 21:22:34 -08:00
Paul Eggert
eeb7e7d58e AC_PROG_CC_C99: avoid unused-var warning
* lib/autoconf/c.m4 (_AC_C_C99_TEST_HEADER): Rewrite to use vars.
Problem reported by ChangZhuo Chen in
<http://lists.gnu.org/archive/html/bug-autoconf/2012-12/msg00000.html>.
2012-12-10 10:06:29 -08:00
Paolo Bonzini
42b4918d16 autotest: define AT_DATA_UNQUOTED
* lib/autotest/general.m4 (AT_DATA_UNQUOTED): New macro, paralleling
AT_DATA but not quoting the contents.
* doc/autoconf.texi (Writing Testsuites): Document it.
* tests/autotest.at (AT_DATA_UNQUOTED): Test it.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
2012-12-07 14:25:08 +01:00
Stefano Lattarini
56369cf6ce syntax-check: remove SPACE-TAB sequence
* lib/autoconf/c.m4 (_AC_PROG_CC_C99): Here.  Was causing a
failure in the 'space_tab' syntax check.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-11-16 12:48:03 +01:00
Eric Blake
5269030d19 AC_CONFIG_MACRO_DIRS: improve tracing and add sanity checks
Too many legacy tools exist for us to unilaterally quit supporting
AC_CONFIG_MACRO_DIR - it is feasible for someone to want their
package to bootstrap with both automake 1.13 and libtool 2.4.2,
where the newer automake will only trace the new style of multiple
directory listings, but the older libtool does a sed and settles
on the one use of the old name.  So, we let both macros forward
to a new tracing macro, which also has the benefit of sanitizing
calls into one directory per trace; we also ensure that the old
macro is always traced, and appears at most once and before any
use of the new macro.

* doc/autoconf.texi (Input) <AC_CONFIG_MACRO_DIRS>: Document how
to trace this macro.
* lib/autom4te.in (Autoreconf-preselections)
(Automake-preselections): Preselect this trace.
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIR_TRACE): New trace.
(_AC_CONFIG_MACRO_DIRS_USED, _AC_CONFIG_MACRO_DIRS): New internal
macros.
(AC_CONFIG_MACRO_DIRS, AC_CONFIG_MACRO_DIR): Use them.
* tests/tools.at (autoconf --trace: AC_CONFIG_MACRO_DIRS): New
test.
2012-11-09 16:16:22 -07:00
Stefano Lattarini
1ed0548896 warn: allow aclocal to silence m4_require warnings
We introduce a new witness macro, m4_require_silent_probe, for use by
aclocal during the Autoconf-without-aclocal-m4 language.  This will let
aclocal process AC_CONFIG_MACRO_DIRS without emitting spurious warnings.
In fact, if aclocal doesn't suppress require warnings, then, when some macro
expanded in configure.ac calls AC_REQUIRE on another macro that is defined
in one of the local m4 macro dirs specified with AC_CONFIG_MACRO_DIRS, the
*first* autom4te invocation issued by aclocal, not yet being able to "see"
the m4 macro definitions in the local m4 dirs, will print spurious
warnings like:

    configure.ac:4: warning: MY_BAR is m4_require'd but not m4_defun'd
    configure.ac:3: MY_FOO is expanded from...

Expose the use of this macro in our testsuite.

Originally reported by Nick Bowler; see point (4) of:
<http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html>

* lib/m4sugar/m4sugar.m4 (_m4_require_call): Make warnings in the
-Wsyntax category depend on the witness macro.
* tests/m4sugar.at (m4@&t@_require: warning message): New test.
* doc/autoconf.texi (Prerequisite Macros): Document how aclocal
can silence AC_REQUIRE (m4_require) warnings.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2012-11-09 16:16:22 -07:00
Stefano Lattarini
d73770f879 AC_CONFIG_MACRO_DIRS: new macro, mostly for aclocal
Similar to AC_CONFIG_MACRO_DIR, but accepts more than one argument.
This will allow projects to use several m4 macro local dirs.  This is
especially important for projects that are used as nested subpackages
of larger projects.

See also:
<http://lists.gnu.org/archive/html/autoconf/2011-12/msg00037.html>
<http://lists.gnu.org/archive/html/automake-patches/2012-07/msg00010.html>

* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS): New.  Expands to the
empty anyway, since it is only meant to be traced by tools like aclocal
and autoreconf.
(AC_CONFIG_MACRO_DIR): Updated comments.
* doc/autoconf.texi (@node "Input"): Document AC_CONFIG_MACRO_DIRS as
preferred over AC_CONFIG_MACRO_DIR.
* NEWS: Update.

Suggested-by: Eric Blake <eblake@redhat.com>
Helped-by: Nick Bowler <nbowler@elliptictech.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2012-11-09 15:45:44 -07:00
Stefano Lattarini
26cb0918d3 cosmetics: slightly improve a comment
* lib/autom4te.in: Here, the comment about 'AM_PROG_MKDIR_P'.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-10-27 12:32:35 +02:00
Stefano Lattarini
efc0049176 autom4te: update Automake preselections to reflect upcoming 1.13
Issue revealed by a failure in test "35: tools.at: autom4te preselections"

* lib/autom4te.in ("Automake-preselections"): Add automake-provided
macro '_AM_EXTRA_RECURSIVE_TARGETS'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-10-27 12:32:35 +02:00
Paul Eggert
32fbf346b7 AC_PROG_CC_C89, AC_PROG_CC_C99, AC_PROG_CC_STDC: Use AU_DEFUN
This fixes a bug introduced by the most recent change to c.m4.
Problem reported by Jim Meyering in
<http://lists.gnu.org/archive/html/autoconf/2012-10/msg00048.html>.
* lib/autoconf/c.m4 (AC_PROG_CC_C89, AC_PROG_CC_C99, AC_PROG_CC_STDC):
Use AU_DEFUN and AC_REQUIRE, not AU_ALIAS, as the latter is not
compatible with how Automake redefines AC_PROG_CC.
2012-10-24 12:25:58 -07:00
Paul Eggert
b9dc6b6e9c AC_PROG_CC_C89, AC_PROG_CC_C99, AC_PROG_CC_STDC: Use AU_ALIAS.
Based on a suggestion by Adrian Bunk in
http://lists.gnu.org/archive/html/autoconf-patches/2012-09/msg00040.html
* lib/autoconf/c.m4 (AC_PROG_CC_C89, AC_PROG_CC_C99, AC_PROG_CC_STDC):
Use AU_ALIAS, now that AC_PROG_CC is defined via AC_DEFUN_ONCE.
2012-10-16 13:41:34 -07:00
Paul Eggert
18c140b50b AC_PROG_CC: define via AC_DEFUN_ONCE
Suggested by Adrian Bunk in
http://lists.gnu.org/archive/html/autoconf-patches/2012-09/msg00034.html
* NEWS:
* doc/autoconf.texi (C Compiler): Document it
* lib/autoconf/c.m4 (AC_PROG_CC): Implement it.
2012-10-16 13:41:34 -07:00
Paul Eggert
c8d2326a71 AC_PROG_CC: clarify documentation, encourage -qlanglvl=extc1x
* doc/autoconf.texi (C Compiler): Document the intent of AC_PROG_CC
better.  It's not meant to check for strict conformance, only to
get the latest version with extensions.
(Running the Preprocessor, Present But Cannot Be Compiled):
Document new diagnostic wording.
* lib/autoconf/c.m4 (_AC_C_STD_TRY): Change diagnostic wording from
"checking for gcc option to accept ISO C11" to
"checkint for gcc option to enable C11 features", as this better
reflects what is actually happening.
(_AC_PROG_CC_C99): Put -qlanglvl=extc1x here ...
(_AC_PROG_CC_C11): ... rather than here, as it doesn't pass the C11
test with IBM XL C V12.1, and the point is to enable features not to
test for strict conformance.
2012-09-28 10:45:02 -07:00
Paul Eggert
55ccec071b AC_PROG_CC: try -qlanglvl=extc1x, for IBM XL C V12.1
* lib/autoconf/c.m4 (_AC_PROG_CC_C11): Add -qlanglvl=extc1x, for
IBM XL C V12.1.  It shouldn't pass the C11 test yet, since it's not
documented to support _Alignas, _Alignof, UTF-8 string literals,
and duplicate typedefs, but presumably it will eventually.
2012-09-26 07:50:27 -07:00
Adrian Bunk
6cd9694ba8 maint: fix the comment at the end of _AC_FUNC_REALLOC_IF
* lib/autoconf/functions.m4: fix the comment at the end of
_AC_FUNC_REALLOC_IF
Copyright-paperwork-exempt: yes
2012-09-25 08:47:11 -06:00
Paul Eggert
27eb3aef3e AC_PROG_CC_C89, AC_PROG_CC_C99: now obsolete; defer to AC_PROG_CC
* NEWS:
* doc/autoconf.texi (C Compiler, Running the Preprocessor)
(Limitations of Usual Tools, Present But Cannot Be Compiled)
(Obsolete Macros):
Document the changes described below.
* lib/autoconf/c.m4 (_AC_PROG_CC_FORCE_VERSION): Remove.
(AC_PROG_CC_C89, AC_PROG_CC_C99, AC_PROG_CC_STDC):
Just do AC_PROG_CC, but mark as obsolete.  This replaces my recent
ill-advised attempt to let AC_PROG_CC_C89 and AC_PROG_CC_C99 downgrade
the version of C supported.
* doc/autoconf.texi (Limitations of Usual Tools, Volatile Objects):
Document C11 more accurately.  In some cases this involves removing
some details about 'volatile', alas, since C11 changed this stuff.
Again.
2012-09-21 19:28:20 -07:00
Stefano Lattarini
7528220334 build: quote 'like this', not `like this'
As per updated GCS recommendations.

* Makefile.am, configure.ac, lib/m4sugar/Makefile.am,
tests/Makefile.am, m4/m4.m4: Here.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-09-21 21:42:59 +02:00
Stefano Lattarini
2b9ab0ee8a autom4te: update Automake preselections to reflect the changes in 1.12.x
Issue revealed by a failure in test "35: tools.at: autom4te preselections":
<http://lists.gnu.org/archive/html/bug-autoconf/2012-09/msg00020.html>

* lib/autom4te.in: Add 'AM_PROG_MKDIR_P'.

Helped-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-09-21 21:42:35 +02:00
Paul Eggert
8e796471bf AC_PROG_CC_STDC: fold into AC_PROG_CC, removing C11 macro
* NEWS:
* doc/autoconf.texi (C Compiler): Document the following.
* lib/autoconf/c.m4 (AC_PROG_CC): Check for the latest C version
supported, not just C89.
(_AC_C_STD_TRY): Keep track of the options we add to bring
the C compiler up to standard, so that we can undo it if the
user later requests some other C standard.
(_AC_PROG_CC_FORCE_VERSION): New macro.
(AC_PROG_CC_C89, AC_PROG_CC_C99): Use it.  These macros now
have a documented side effect of changing the C version requested.
(AC_PROG_CC_C11): Remove.  It wasn't useful.
(AC_PROG_CC_STDC): Now an obsolescent alias for AC_PROG_CC.
(AC_C_PROTOTYPES): Allow any standard C version, not just c89.
Don't chatter, since we don't actually run any checking code.
* lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT)
(AC_TYPE_UNSIGNED_LONG_LONG_INT): Treat C11 like C99.
* TODO: Remove the TODO item corresponding to the above.
2012-09-20 14:33:32 -07:00
Paul Eggert
787acdfaa7 AC_FUNC_VFORK: check for Solaris 2.4 signal-handling bug
* NEWS:
* doc/autoconf.texi (Particular Functions): Document this.
* lib/autoconf/functions.m4 (_AC_FUNC_VFORK): Check for the bug.
2012-09-16 16:42:20 -07:00
Paul Eggert
f52459d158 AC_CHECK_ALIGNOF: fix cross-compilation bug with newer gcc
* doc/autoconf.texi (Default Includes, Particular Functions)
(Header Portability):
* lib/autoconf/c.m4 (AC_LANG_FUNC_LINK_TRY(C)):
* lib/autoconf/headers.m4 (AC_HEADER_STDC):
* lib/autoconf/types.m4 (_AC_CHECK_ALIGNOF):
* lib/m4sugar/m4sugar.m4 (m4_require) [comment only]:
Assume the existence of the C89 freestanding headers <float.h>,
<limits.h>, <stdarg.h>, <stddef.h>, as that's safe nowadays.
This is less likely to run into gotchas, and should fix a
cross-compilation bug with newer GCC reported by Myke Frysinger in
<http://lists.gnu.org/archive/html/bug-autoconf/2012-09/msg00001.html>.
2012-09-06 14:55:09 -07:00
Paul Eggert
db36f6df60 AC_PROG_CC_C11: new macro, which AC_PROG_CC_STDC now defaults to
* NEWS:
* doc/autoconf.texi (C Compiler): Document this.
(Gnulib, Function Portability, Particular Functions)
(Header Portability, Particular Headers, Defining Symbols)
(Printing Messages, Limitations of Usual Tools)
(Preprocessor Arithmetic, Volatile Objects, Exiting Portably):
Modernize wording for C11.
* lib/autoconf/c.m4 (_AC_C_C99_TEST_HEADER, _AC_C_C99_TEST_BODY):
New macros, taken from _AC_PROG_CC_C99.  These are so that we can
also include the C99 tests in the C11 test program.
(_AC_PROG_CC_C99): Use them.
(_AC_PROG_CC_C11, AC_PROG_CC_C11): New macros.
(AC_PROG_CC_STDC): Prefer C11 to C99 or C89.
2012-08-23 12:46:20 -07:00
Nick Bowler
5fdd360bcb AC_SUBST: don't underquote the variable name
Consider the following:

% cat >configure.ac <<'EOF'
AC_INIT([test], [0])

m4_define([FOO], [baz])
AC_SUBST([FOO], [bar])

AC_CONFIG_FILES([test])
AC_OUTPUT
EOF

% cat >test.in <<'EOF'
@FOO@
EOF

This produces no error messages at autoconf time and none at configure
time.  Nevertheless, the substituted value of FOO is the empty string,
instead of bar, as expected.  Sure enough, in the output variables
section of config.log, we see FOO='' instead of FOO='bar'.  Looking
at the generated configure script, we see that AC_SUBST has produced
baz=bar in the output, instead of the expected FOO=bar.  But this is
the only place: everywhere else is still using FOO.

* lib/autoconf/general.m4 (AC_SUBST): Add another layer of
quoting.
* THANKS: Update.

Signed-off-by: Eric Blake <eblake@redhat.com>
2012-08-15 21:54:53 -06:00
Andreas Schwab
2738235a0c general: Sanitize IFS in EXIT trap
IFS may be modified temporarily when the configure script receives a
signal.  Make sure the EXIT trap uses the standard value.

* lib/autoconf/general.m4: Sanitize IFS in trap.
* THANKS: Update.

Copyright-paperwork-exempt: Yes
2012-07-18 14:44:53 -06:00
Eric Blake
0eebfff3e0 m4sh: avoid // issues in _AS_PATH_WALK
As reported by Paul Keir on the cygwin lists,
http://cygwin.com/ml/cygwin/2012-07/msg00263.html,
some people like to stick / in their $PATH, and if we then try
to probe $as_dir/progname for existence, we can end up causing
cygwin to have a several-second timeout per //name probe.  It
is better to avoid inserting the extra slash when $as_dir is the
root directory, and simpler to code by always having a trailing
slash present than it is to strip a trailing slash.  Thankfully,
_AS_PATH_WALK is an undocumented interface, and even if someone
was using it in spite of the warnings, their use of $as_dir/foo
will typically only lead to odd-looking /dir//foo probes, with
only the case of / in $PATH causing slowdowns, and only when //
is special.

There was also a minor bug where the if-not-found code of
_AS_PATH_WALK could be executed with $IFS still in the wrong state.

* lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Always end as_dir in /.
Avoid wrong IFS during if-not-found.  Minor optimization to avoid
regex.
(_AS_DETECT_BETTER_SHELL, _AS_SHELL_SANITIZE): Update clients.
* lib/autotest/general.m4 (_AT_FINISH): Likewise.
* lib/autoconf/programs.m4 (_AC_CHECK_PROG, _AC_PATH_PROG)
(_AC_PATH_PROGS_FEATURE_CHECK, _AC_PATH_PROG_FLAVOR_GNU): Likewise.
2012-07-13 11:33:13 -06:00
David Hill
9b484c0be0 functions: add Bitrig defaults
Cater to the Bitrig OS, an OpenBSD fork.  config.guess and
config.sub have been updated upstream.

* lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF)
(_AC_FUNC_REALLOC_IF): Bitrig inherits from BSD.
2012-06-18 07:08:46 -06:00
Stefano Lattarini
560f16b52d general: deprecate 'configure.in' as autoconf input
It has been years since that has been deprecated in the documentation,
in favour of 'configure.ac':

  Previous versions of Autoconf promoted the name configure.in, which
  is somewhat ambiguous (the tool needed to process this file is not
  described by its extension), and introduces a slight confusion with
  config.h.in and so on (for which '.in' means "to be processed by
  configure"). Using configure.ac is now preferred.

It's now time to start giving runtime warning about the use of
'configure.in', so that support for it can be removed in future
versions of autoconf/automake.

* lib/Autom4te/Configure_ac.pm: Issue a warning in the 'obsolete'
category if 'configure.in' is detected.  Since this module is synced
from Automake, this change is to be backported there (and will be
soon).
* doc/autoconf.texi: Update.
* tests/tools.at: Adjust to avoid spurious failures.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-05-23 00:13:01 +02:00
Bruno Haible
7fbb553727 functions: improve cross-compilation guesses for glibc system hosts
Paul and Eric suggested that improving the cross-compilation guesses
for targets that are glibc systems would be welcome here [1][2].

This patch modifies the cross-compilation behaviour of
  AC_FUNC_CHOWN
  AC_FUNC_GETGROUPS
  AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
  AC_FUNC_MALLOC
  AC_FUNC_MMAP
  AC_FUNC_REALLOC
  AC_FUNC_STRCOLL
so that when the target is a glibc system (or, in case of AC_FUNC_MALLOC
and AC_FUNC_REALLOC, any known "good" Unix system), the guess is
"yes it works" rather than "guessing no".

This is important because some of these macros are used in Gnulib, and
in case of "guessing no" Gnulib provides extra workaround code, and
  1) Generally, when targetting embedded systems, code size should be
     minimized,
  2) In [3], unnecessary workaround code will look like a Glibc bug.

This patch also changes the configure output to "guessing yes" or
"guessing no" in a case where the ac_cv_* variable is undocumented.

[1] http://lists.gnu.org/archive/html/bug-gnulib/2012-05/msg00010.html
[2] http://lists.gnu.org/archive/html/bug-gnulib/2012-05/msg00013.html
[3] http://sourceware.org/glibc/wiki/Testing/Gnulib

This patch was tested with the simple configure.ac file
=============== configure.ac ==================
AC_INIT([dummy], [0])
AC_FUNC_CHOWN
AC_FUNC_GETGROUPS
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_STRCOLL
AC_OUTPUT
===============================================

* lib/autoconf/functions.m4 (AC_FUNC_CHOWN): Require AC_CANONICAL_HOST.
When cross-compiling to a glibc system, guess yes.
(AC_FUNC_GETGROUPS): Likewise.
(AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): Likewise.
(AC_FUNC_STRCOLL): Likewise.
(_AC_FUNC_MALLOC_IF): Require AC_CANONICAL_HOST. When cross-compiling
to a know Unix system other than AIX and OSF/1, guess yes.
(_AC_FUNC_REALLOC_IF): Likewise.
(AC_FUNC_MMAP): Require AC_CANONICAL_HOST. When cross-compiling to a
system with a Linux kernel, guess yes.
2012-05-03 09:32:01 -06:00
Bruno Haible
280f330992 AC_INIT: remove a transitional warning
On bi-arch systems (such as x86 / x86_64) it is often necessary to pass
the --host option together with an appropriate value for CC. But this
triggers a warning:

$ ./configure --host=i686-pc-linux-gnu CC="gcc -m32 -march=i586"
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
..

This warning was introduced on 2000-06-30, in commit
<http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=cb2e761b8e1181f97e8e09d85526bd22078433db>
with the remark "Re-enable the old behavior of --host and --build."

This warning was meant to warn users about a changed semantics of
--build and --host. This change is now 12 years in the past; users
have had enough time to learn it. I therefore suggest to remove the
warning.

I've done lots of cross and bi-arch compilations in the last 10 years,
all with --host and without --build, and have never observed a problem
with it, except for the warning. Simply relying on config.guess is sufficient.

* lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Don't warn if --host
given without --build.

Signed-off-by: Eric Blake <eblake@redhat.com>
2012-04-24 15:18:45 -06:00