* tests/base.at, tests/compile.at, tests/foreign.at,
* tests/m4sh.at, tests/m4sugar.at, tests/mktests.sh,
* tests/semantics.at, tests/suite.at, tests/tools.at,
* tests/torture.at: Ask Autotest mode, not Autoconf mode.
2001-08-20 22:44:38 +08:00
|
|
|
# -*- Autotest -*-
|
2000-02-09 16:36:01 +08:00
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
AT_BANNER([Autoconf base layer.])
|
2000-02-09 16:36:01 +08:00
|
|
|
|
2020-01-02 03:45:50 +08:00
|
|
|
# Copyright (C) 2000-2001, 2003, 2005-2017, 2020 Free Software
|
|
|
|
# Foundation, Inc.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
#
|
2007-07-21 07:11:49 +08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
Update License to GPLv3+ including new Autoconf Exception.
* NEWS, README: Update licensing information.
* COPYING.EXCEPTION: New file.
* Makefile.am (EXTRA_DIST): Distribute it.
* cfg.mk (autom4te-update): Remove copyright change warning.
* lib/autoconf/autoconf.m4, lib/autoconf/autoheader.m4,
lib/autoconf/autoscan.m4, lib/autoconf/autotest.m4,
lib/autoconf/autoupdate.m4, lib/autoconf/c.m4,
lib/autoconf/erlang.m4, lib/autoconf/fortran.m4,
lib/autoconf/functions.m4, lib/autoconf/general.m4,
lib/autoconf/headers.m4, lib/autoconf/lang.m4,
lib/autoconf/libs.m4, lib/autoconf/oldnames.m4,
lib/autoconf/programs.m4, lib/autoconf/specific.m4,
lib/autoconf/status.m4, lib/autoconf/types.m4,
lib/autotest/autotest.m4, lib/autotest/general.m4,
lib/autotest/specific.m4, lib/m4sugar/foreach.m4,
lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4: Update exception
statement, bump to GPLv3.
* bin/autoconf.as, bin/autoheader.in, bin/autom4te.in,
bin/autoreconf.in, bin/autoscan.in, bin/autoupdate.in,
bin/ifnames.in: Bump to GPLv3+, adjust --version output
to reflect the GPLv3+ and the Autoconf Exception.
* lib/Autom4te/C4che.pm, lib/Autom4te/ChannelDefs.pm,
lib/Autom4te/General.pm, lib/Autom4te/Request.pm,
lib/autom4te.in, lib/autoscan/autoscan.pre,
lib/emacs/autoconf-mode.el, lib/emacs/autotest-mode.el,
lib/freeze.mk, tests/atlocal.in, tests/autoscan.at,
tests/autotest.at, tests/base.at, tests/c.at,
tests/compile.at, tests/erlang.at, tests/foreign.at,
tests/fortran.at, tests/local.at, tests/m4sh.at,
tests/m4sugar.at, tests/mktests.sh, tests/semantics.at,
tests/statesave.m4, tests/suite.at, tests/tools.at,
tests/torture.at, tests/wrapper.as: Bump to GPLv3+.
2009-09-10 01:53:31 +08:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2017-09-17 08:48:19 +08:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
|
2000-06-26 17:06:02 +08:00
|
|
|
|
2000-11-04 00:02:54 +08:00
|
|
|
## ------------------------------- ##
|
|
|
|
## AC_REQUIRE: topological sort.. ##
|
|
|
|
## ------------------------------- ##
|
2000-06-26 17:06:02 +08:00
|
|
|
|
|
|
|
# Check that dependencies are always properly honored.
|
|
|
|
|
2000-11-04 00:02:54 +08:00
|
|
|
AT_SETUP([AC_REQUIRE: topological sort])
|
2009-01-27 00:55:57 +08:00
|
|
|
AT_KEYWORDS([m4@&t@_require])
|
2000-06-26 17:06:02 +08:00
|
|
|
|
2001-08-20 22:45:09 +08:00
|
|
|
AT_DATA([configure.ac],
|
2000-06-26 17:06:02 +08:00
|
|
|
[[define([REQUIRE_AND_CHECK],
|
2001-08-20 22:45:00 +08:00
|
|
|
[AC_REQUIRE([$1])
|
2001-08-29 21:11:16 +08:00
|
|
|
test -z "$m4@&t@_translit([$1], [A-Z], [a-z])" && AS_EXIT(1)])
|
2000-06-26 17:06:02 +08:00
|
|
|
|
|
|
|
AC_DEFUN([TEST1],
|
|
|
|
[REQUIRE_AND_CHECK([TEST2a])
|
|
|
|
REQUIRE_AND_CHECK([TEST2b])
|
|
|
|
test1=set])
|
|
|
|
|
|
|
|
AC_DEFUN([TEST2a],
|
|
|
|
[test2a=set])
|
|
|
|
|
|
|
|
AC_DEFUN([TEST2b],
|
|
|
|
[REQUIRE_AND_CHECK([TEST3])
|
|
|
|
test2b=set])
|
|
|
|
|
|
|
|
AC_DEFUN([TEST3],
|
|
|
|
[REQUIRE_AND_CHECK([TEST2a])
|
|
|
|
test3=set])
|
|
|
|
|
2001-10-08 16:20:59 +08:00
|
|
|
AS@&t@_INIT
|
2001-05-31 15:02:13 +08:00
|
|
|
|
2000-06-26 17:06:02 +08:00
|
|
|
TEST1
|
2000-10-27 22:15:28 +08:00
|
|
|
test -z "$test1" &&
|
|
|
|
AC_MSG_ERROR([\$test1 is empty])
|
2000-11-02 03:57:54 +08:00
|
|
|
AS_EXIT(0)
|
2000-06-26 17:06:02 +08:00
|
|
|
]])
|
|
|
|
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AT_CHECK_AUTOCONF([], [0], [],
|
|
|
|
[[trailer.m4: warning: AC_INIT was never used
|
|
|
|
trailer.m4: warning: AC_OUTPUT was never used
|
|
|
|
]])
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CHECK_CONFIGURE
|
2000-06-26 17:06:02 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CLEANUP
|
2000-11-03 18:39:27 +08:00
|
|
|
|
|
|
|
|
2006-06-05 16:18:33 +08:00
|
|
|
## --------------------------- ##
|
|
|
|
## AC_REQUIRE: error message. ##
|
|
|
|
## --------------------------- ##
|
|
|
|
|
|
|
|
# Check that the message mentions AC_DEFUN, not m4_defun.
|
|
|
|
|
|
|
|
AT_SETUP([AC_REQUIRE: error message])
|
2009-01-27 00:55:57 +08:00
|
|
|
AT_KEYWORDS([m4@&t@_require])
|
2006-06-05 16:18:33 +08:00
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_REQUIRE([AC_PROG_CC])
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([], [1], [],
|
|
|
|
[[configure.ac:1: error: AC_REQUIRE(AC_PROG_CC): cannot be used outside of an AC_DEFUN'd macro
|
|
|
|
configure.ac:1: the top level
|
|
|
|
autom4te: m4 failed with exit status: 1
|
|
|
|
]])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
2000-11-03 18:39:27 +08:00
|
|
|
|
|
|
|
## ----------------------------------------------- ##
|
|
|
|
## AC_REQUIRE and AC_DEFUN_ONCE: Require, expand. ##
|
|
|
|
## ----------------------------------------------- ##
|
|
|
|
|
2007-09-27 07:23:00 +08:00
|
|
|
AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: [Require, expand]])
|
2009-01-27 00:55:57 +08:00
|
|
|
AT_KEYWORDS([m4@&t@_require m4@&t@_require_once])
|
2000-11-03 18:39:27 +08:00
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
AT_DATA([configure.ac],
|
2000-11-03 18:39:27 +08:00
|
|
|
[[AC_DEFUN([TEST],
|
|
|
|
[AC_REQUIRE([MULTI_TEST])
|
|
|
|
AC_REQUIRE([SINGLE_TEST])])
|
|
|
|
|
|
|
|
AC_DEFUN([MULTI_TEST],
|
|
|
|
[multi_test=".$multi_test"])
|
|
|
|
|
|
|
|
AC_DEFUN_ONCE([SINGLE_TEST],
|
|
|
|
[single_test=".$single_test"])
|
|
|
|
|
2001-10-08 16:20:59 +08:00
|
|
|
AS@&t@_INIT
|
2001-05-31 15:02:13 +08:00
|
|
|
|
2000-11-03 18:39:27 +08:00
|
|
|
TEST
|
|
|
|
TEST
|
|
|
|
MULTI_TEST
|
|
|
|
MULTI_TEST
|
|
|
|
SINGLE_TEST
|
|
|
|
SINGLE_TEST
|
|
|
|
|
|
|
|
case $multi_test:$single_test in
|
|
|
|
...:. ) AS_EXIT(0);;
|
|
|
|
...:* ) AC_MSG_ERROR([DEFUN_ONCE is broken]);;
|
|
|
|
*:. ) AC_MSG_ERROR([DEFUN is broken (Wow, congrats!)]);;
|
|
|
|
esac
|
|
|
|
]])
|
|
|
|
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AT_CHECK_AUTOCONF([], 0, [],
|
|
|
|
[[trailer.m4: warning: AC_INIT was never used
|
|
|
|
trailer.m4: warning: AC_OUTPUT was never used
|
|
|
|
]])
|
2000-11-03 18:39:27 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CHECK_CONFIGURE
|
2000-11-03 18:39:27 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CLEANUP
|
2000-11-03 18:39:27 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## ----------------------------------------------- ##
|
|
|
|
## AC_REQUIRE and AC_DEFUN_ONCE: Expand, require. ##
|
|
|
|
## ----------------------------------------------- ##
|
|
|
|
|
2007-09-27 07:23:00 +08:00
|
|
|
AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: [Expand, require]])
|
2009-01-27 00:55:57 +08:00
|
|
|
AT_KEYWORDS([m4@&t@_require m4@&t@_require_once])
|
2000-11-03 18:39:27 +08:00
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
AT_DATA([configure.ac],
|
2000-11-03 18:39:27 +08:00
|
|
|
[[AC_DEFUN([TEST],
|
|
|
|
[AC_REQUIRE([MULTI_TEST])
|
|
|
|
AC_REQUIRE([SINGLE_TEST])])
|
|
|
|
|
|
|
|
AC_DEFUN([MULTI_TEST],
|
|
|
|
[multi_test=".$multi_test"])
|
|
|
|
|
|
|
|
AC_DEFUN_ONCE([SINGLE_TEST],
|
|
|
|
[single_test=".$single_test"])
|
|
|
|
|
2001-10-08 16:20:59 +08:00
|
|
|
AS@&t@_INIT
|
2001-05-31 15:02:13 +08:00
|
|
|
|
2000-11-03 18:39:27 +08:00
|
|
|
MULTI_TEST
|
|
|
|
MULTI_TEST
|
|
|
|
SINGLE_TEST
|
|
|
|
SINGLE_TEST
|
|
|
|
TEST
|
|
|
|
TEST
|
|
|
|
|
|
|
|
case $multi_test:$single_test in
|
|
|
|
..:. ) AS_EXIT(0);;
|
|
|
|
..:* ) AC_MSG_ERROR([DEFUN_ONCE is broken]);;
|
|
|
|
*:. ) AC_MSG_ERROR([DEFUN is broken (Wow, congrats!)]);;
|
2000-11-04 00:02:54 +08:00
|
|
|
* ) AC_MSG_ERROR([received `$multi_test:$single_test']);;
|
2000-11-03 18:39:27 +08:00
|
|
|
esac
|
|
|
|
]])
|
|
|
|
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AT_CHECK_AUTOCONF([], 0, [],
|
|
|
|
[[trailer.m4: warning: AC_INIT was never used
|
|
|
|
trailer.m4: warning: AC_OUTPUT was never used
|
|
|
|
]])
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CHECK_CONFIGURE
|
2000-11-03 18:39:27 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CLEANUP
|
2000-11-04 00:02:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## ------------------------- ##
|
|
|
|
## AC_REQUIRE & AC_PROVIDE. ##
|
|
|
|
## ------------------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_REQUIRE & AC_PROVIDE])
|
2009-01-27 00:55:57 +08:00
|
|
|
AT_KEYWORDS([m4@&t@_require])
|
2000-11-04 00:02:54 +08:00
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
AT_DATA([configure.ac],
|
2000-11-04 00:02:54 +08:00
|
|
|
[[AC_DEFUN([TEST],
|
|
|
|
[AC_REQUIRE([INNER_TEST])])
|
|
|
|
|
|
|
|
AC_DEFUN([INNER_TEST],
|
|
|
|
[inner_test=".$inner_test"])
|
|
|
|
|
2001-10-08 16:20:59 +08:00
|
|
|
AS@&t@_INIT
|
2001-05-31 15:02:13 +08:00
|
|
|
|
2000-11-04 00:02:54 +08:00
|
|
|
AC_PROVIDE([INNER_TEST])
|
|
|
|
TEST
|
|
|
|
|
|
|
|
case $inner_test in
|
|
|
|
"" ) AS_EXIT(0);;
|
|
|
|
* ) AC_MSG_ERROR([received `$inner_test']);;
|
|
|
|
esac
|
|
|
|
]])
|
|
|
|
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AT_CHECK_AUTOCONF([], 0, [],
|
|
|
|
[[trailer.m4: warning: AC_INIT was never used
|
|
|
|
trailer.m4: warning: AC_OUTPUT was never used
|
|
|
|
]])
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CHECK_CONFIGURE
|
2000-11-04 00:02:54 +08:00
|
|
|
|
2001-01-17 23:26:42 +08:00
|
|
|
AT_CLEANUP
|
2001-01-23 20:53:52 +08:00
|
|
|
|
|
|
|
|
2009-09-16 01:21:21 +08:00
|
|
|
## -------- ##
|
|
|
|
## AC_INIT. ##
|
|
|
|
## -------- ##
|
|
|
|
|
|
|
|
# Make sure AC_INIT sets PACKAGE_TARNAME properly.
|
|
|
|
|
|
|
|
AT_SETUP([AC_INIT])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU fu], [1.0], [bug-fu@gnu.org])
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AC_OUTPUT
|
2009-09-16 01:21:21 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE([-q])
|
|
|
|
|
|
|
|
# Ensure we get the expected definition:
|
|
|
|
AT_CHECK([grep "^PACKAGE_TARNAME='fu'\$" configure], [], [ignore])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2010-07-20 05:50:45 +08:00
|
|
|
## ------------------------------------- ##
|
|
|
|
## AC_INIT with unusual version strings. ##
|
|
|
|
## ------------------------------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_INIT with unusual version strings])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
2010-07-20 06:39:45 +08:00
|
|
|
[[AC_INIT([GNU String++ with spaces (foo)],
|
Trim whitespace from arguments of AC_INIT (#107986)
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
2020-08-07 02:51:32 +08:00
|
|
|
[2.48++ (2010-07-03)],
|
|
|
|
[[https://example.com/?a=b&c=d#e]],
|
|
|
|
[string++],
|
|
|
|
[[https://example.com/?f=g&h=i%2fj#42]])
|
2010-07-20 05:50:45 +08:00
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
2010-07-20 06:39:45 +08:00
|
|
|
if echo 'ab*c' | grep -F 'ab*c' >/dev/null 2>&1; then
|
|
|
|
FGREP="grep -F"
|
|
|
|
else
|
|
|
|
FGREP=fgrep
|
|
|
|
fi
|
|
|
|
|
2010-07-20 05:50:45 +08:00
|
|
|
AT_CHECK_AUTOCONF([-Werror])
|
|
|
|
AT_CHECK_CONFIGURE([-q])
|
2010-08-15 03:17:04 +08:00
|
|
|
AT_CHECK_CONFIGURE([--help], [], [stdout])
|
|
|
|
AT_CHECK([[$FGREP 'com/?a=b&c=d#e' stdout]], [], [ignore])
|
Trim whitespace from arguments of AC_INIT (#107986)
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
2020-08-07 02:51:32 +08:00
|
|
|
AT_CHECK([[$FGREP 'com/?f=g&h=i%2fj#42' stdout]], [], [ignore])
|
2010-07-20 06:39:45 +08:00
|
|
|
AT_CHECK_CONFIGURE([--version], [], [stdout])
|
Trim whitespace from arguments of AC_INIT (#107986)
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
2020-08-07 02:51:32 +08:00
|
|
|
AT_CHECK([$FGREP 'GNU String++ with spaces (foo)' stdout], [], [ignore])
|
|
|
|
AT_CHECK([$FGREP '2.48++ (2010-07-03)' stdout], [], [ignore])
|
2010-07-20 06:39:45 +08:00
|
|
|
|
2010-08-15 03:17:04 +08:00
|
|
|
AT_CHECK([./config.status --help], [], [stdout])
|
|
|
|
AT_CHECK([[$FGREP 'com/?a=b&c=d#e' stdout]], [], [ignore])
|
2010-07-20 06:39:45 +08:00
|
|
|
AT_CHECK([./config.status --version], [], [stdout])
|
Trim whitespace from arguments of AC_INIT (#107986)
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
2020-08-07 02:51:32 +08:00
|
|
|
AT_CHECK([$FGREP 'GNU String++ with spaces (foo)' stdout], [], [ignore])
|
|
|
|
AT_CHECK([$FGREP '2.48++ (2010-07-03)' stdout], [], [ignore])
|
2010-07-20 06:39:45 +08:00
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU "String++"],
|
Trim whitespace from arguments of AC_INIT (#107986)
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
2020-08-07 02:51:32 +08:00
|
|
|
[2.48], [https://example.com/], [string++])
|
2010-07-20 06:39:45 +08:00
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU String++],
|
Trim whitespace from arguments of AC_INIT (#107986)
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
2020-08-07 02:51:32 +08:00
|
|
|
['codename' 2.48], [https://example.com/], [string++])
|
2010-07-20 21:43:56 +08:00
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU
|
Trim whitespace from arguments of AC_INIT (#107986)
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
2020-08-07 02:51:32 +08:00
|
|
|
String++], [2.48], [https://example.com/], [string++])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU String++], ['2.48'], [https://example.com], [string++])
|
2010-07-20 06:39:45 +08:00
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore])
|
2010-07-20 05:50:45 +08:00
|
|
|
|
Trim whitespace from arguments of AC_INIT (#107986)
Specifically, all five arguments, if present, are passed through
m4_normalize before doing anything else with them. For instance,
AC_INIT([ GNU Hello ], [1.0]) is now equivalent to
AC_INIT([GNU Hello], [1.0]).
As a consequence, newlines in the arguments to AC_INIT are now
converted to spaces and no longer trigger warnings.
Also, diagnose inappropriate contents of the fourth and fifth
arguments as well as the first three. The fifth argument should be
“usable as-is in single- and double-quoted strings and quoted and
unquoted here-docs,” like the first three. (This is the check
performed by _AC_INIT_LITERAL.) The fourth argument (TARNAME) is used
to construct filenames, so apply an even more stringent test, namely
AS_LITERAL_WORD_IF.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Not necessary to check
for newlines anymore.
(_AC_INIT_PACKAGE): Pass all five arguments through m4_normalize
before doing anything else with them. New warning: apply
_AC_INIT_LITERAL to fifth argument (URL). New warning: complain
if fourth argument (TARNAME) is not a literal word according to
AS_LITERAL_WORD_IF. Simplify a conditional by using m4_default.
* tests/base.at (AC_INIT with unusual version strings): Adjust to
match above changes, add more subtests.
2020-08-07 02:51:32 +08:00
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU String++], [2.48], ['https://example.com'], [string++])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU String++], [2.48], [https://example.com], [string++],
|
|
|
|
['https://example.com'])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore])
|
|
|
|
|
|
|
|
|
|
|
|
# The TARNAME argument is used to construct filenames, so it's even
|
|
|
|
# more constrained.
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU String++], [2.48], [https://example.com], ['string++'])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'AC_INIT: unsafe as a filename: ' stderr], [], [ignore])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU String++], [2.48], [https://example.com], [string ++])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'AC_INIT: unsafe as a filename: ' stderr], [], [ignore])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU String++], [2.48], [https://example.com], [string*])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'AC_INIT: unsafe as a filename: ' stderr], [], [ignore])
|
|
|
|
|
|
|
|
|
2010-07-20 05:50:45 +08:00
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2010-06-08 12:51:39 +08:00
|
|
|
## -------------- ##
|
|
|
|
## AC_COPYRIGHT. ##
|
|
|
|
## -------------- ##
|
|
|
|
|
|
|
|
# Ensure the FSF notice as well as the user-provided one are present
|
|
|
|
# in the head of the testsuite as well as the --version output.
|
|
|
|
|
|
|
|
AT_SETUP([AC@&t@_COPYRIGHT])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([GNU fu], [1.0])
|
|
|
|
AC_COPYRIGHT([[This is just a test notice, not a real one, so let's avoid
|
|
|
|
words that may be matched by scanners for legal things,
|
|
|
|
causing extra work for distributors.
|
|
|
|
Multi-line values should be supported.
|
|
|
|
]])
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AC_OUTPUT
|
2010-06-08 12:51:39 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE([--version], [], [stdout])
|
|
|
|
AT_CHECK([grep 'Copyright.*Free Software Foundation' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'This is just a test notice' stdout], [], [ignore])
|
|
|
|
AT_CHECK([sed -ne 50q -e '/Copyright/{' -e N -e N -e N -e N -e 's/#//g' ]dnl
|
|
|
|
[ -e 's/\n//g' -e p -e '}' configure ]dnl
|
|
|
|
[ | grep 'Copyright.*Free Software Foundation'],
|
|
|
|
[], [ignore])
|
|
|
|
AT_CHECK([sed 50q configure | grep 'This is just a test notice'], [], [ignore])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2001-01-31 00:21:21 +08:00
|
|
|
## ---------------- ##
|
|
|
|
## AC_CACHE_CHECK. ##
|
|
|
|
## ---------------- ##
|
2001-01-24 18:04:47 +08:00
|
|
|
|
2001-01-31 00:21:21 +08:00
|
|
|
# Make sure AC_CACHE_CHECK is silent with -q.
|
2007-09-28 12:14:06 +08:00
|
|
|
# Also make sure we warn about cache id's not named with `_cv_'.
|
2001-01-24 18:04:47 +08:00
|
|
|
|
|
|
|
AT_SETUP([AC_CACHE_CHECK])
|
2010-06-08 20:25:35 +08:00
|
|
|
AT_KEYWORDS([CONFIG_SITE])
|
2001-01-24 18:04:47 +08:00
|
|
|
|
2010-06-08 12:49:55 +08:00
|
|
|
# Don't let a config.site file affect this test.
|
|
|
|
AS_UNSET([CONFIG_SITE])
|
|
|
|
|
2001-01-24 18:04:47 +08:00
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
2007-09-28 12:14:06 +08:00
|
|
|
# m4_define([ac_nothing], [ac_cv_absolutely_nothing])
|
2001-01-31 02:26:31 +08:00
|
|
|
AC_CACHE_CHECK([for nothing],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[ac_nothing],
|
|
|
|
[ac_nothing=found])
|
2010-06-08 12:49:55 +08:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for some other variable])
|
|
|
|
commands_to_set_it_was_run=false
|
|
|
|
AC_CACHE_VAL([my_cv_variable], [
|
|
|
|
# FOO
|
|
|
|
commands_to_set_it_was_run=true
|
|
|
|
my_cv_variable=true
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT([$my_cv_variable])
|
|
|
|
|
|
|
|
# Ensure that the result is available at this point.
|
2015-04-16 06:31:34 +08:00
|
|
|
if ${my_cv_variable+false} :; then
|
2010-06-08 12:49:55 +08:00
|
|
|
AC_MSG_ERROR([AC@&@&t@t@_CACHE_VAL did not ensure that the cache variable was set])
|
|
|
|
fi
|
|
|
|
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AC_OUTPUT
|
2001-01-24 18:04:47 +08:00
|
|
|
]])
|
|
|
|
|
2007-09-28 12:14:06 +08:00
|
|
|
AT_CHECK_AUTOCONF([], [], [], [stderr])
|
|
|
|
AT_CHECK([grep 'must contain _cv_ to be cached' stderr], [], [ignore])
|
|
|
|
|
|
|
|
# Do not warn about defines:
|
2010-06-08 12:49:55 +08:00
|
|
|
sed 's/^# m4_define/m4_define/' configure.ac > t
|
2007-09-28 12:14:06 +08:00
|
|
|
mv -f t configure.ac
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE([-q])
|
|
|
|
|
|
|
|
sed '/m4_define/d; s/ac_nothing/ac_cv_nothing/' configure.ac > t
|
|
|
|
mv -f t configure.ac
|
2001-01-24 18:04:47 +08:00
|
|
|
AT_CHECK_AUTOCONF
|
2001-01-31 00:21:21 +08:00
|
|
|
AT_CHECK_CONFIGURE([-q])
|
2001-01-24 18:04:47 +08:00
|
|
|
|
2010-06-08 12:49:55 +08:00
|
|
|
# Print a message saying that the result was cached, iff it was cached.
|
|
|
|
AT_CHECK_CONFIGURE([], [], [stdout])
|
|
|
|
AT_CHECK([grep 'cached' stdout], [1])
|
|
|
|
AT_CHECK_CONFIGURE([my_cv_variable='yes it is set'], [], [stdout])
|
|
|
|
AT_CHECK([grep 'cached.*yes it is set' stdout], [], [ignore])
|
|
|
|
|
|
|
|
# --cache-file is honored and has caching semantics.
|
|
|
|
AT_CHECK_CONFIGURE([--cache-file=foobar.cache], [], [stdout])
|
|
|
|
AT_CHECK([grep 'cached' stdout], [1])
|
|
|
|
AT_CHECK([test ! -f config.cache])
|
|
|
|
AT_CHECK([grep 'my_cv_variable.*true' foobar.cache], [], [ignore])
|
|
|
|
AT_CHECK_CONFIGURE([--cache-file=foobar.cache], [], [stdout])
|
|
|
|
AT_CHECK([grep 'some other variable.*cached.*true' stdout], [], [ignore])
|
|
|
|
|
|
|
|
# A setting on the command line overrides the cache.
|
|
|
|
AT_CHECK_CONFIGURE([--cache-file=foobar.cache my_cv_variable='override'], [], [stdout])
|
|
|
|
AT_CHECK([grep 'cached.*override' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'my_cv_variable.*override' foobar.cache], [], [ignore])
|
|
|
|
|
|
|
|
# Values containing braces need special internal treatment.
|
|
|
|
AT_CHECK_CONFIGURE([-C ac_cv_nothing='{' my_cv_variable='contains } brace'],
|
|
|
|
[], [stdout])
|
|
|
|
AT_CHECK([grep 'ac_cv_nothing.*{' config.cache], [], [ignore])
|
|
|
|
AT_CHECK([grep 'my_cv_variable.*contains } brace' config.cache], [], [ignore])
|
|
|
|
AT_CHECK_CONFIGURE([-C], [], [stdout])
|
|
|
|
AT_CHECK([grep 'nothing.*{' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'some other variable.*contains } brace' stdout], [], [ignore])
|
|
|
|
rm -f config.cache
|
|
|
|
|
|
|
|
# Diagnose common side-effects that are errors in COMMANDS-TO-SET-IT:
|
|
|
|
sed 's/^# FOO/AC_DEFINE([some-define], [1], [oooh.])/' configure.ac > t
|
|
|
|
mv -f t configure.ac
|
|
|
|
AT_CHECK_AUTOCONF([], [], [], [stderr])
|
|
|
|
AT_CHECK([grep 'suspicious.*AC_DEFINE' stderr], [], [ignore])
|
|
|
|
|
|
|
|
sed 's/^AC_DEFINE.*/AC_SUBST([some_substitution], [oooh.])/' configure.ac > t
|
|
|
|
mv -f t configure.ac
|
|
|
|
AT_CHECK_AUTOCONF([], [], [], [stderr])
|
|
|
|
AT_CHECK([grep 'suspicious.*AC_SUBST' stderr], [], [ignore])
|
|
|
|
|
|
|
|
# Ensure the examples from the manual work as intended.
|
|
|
|
# Taken from autoconf.texi:Caching Results
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
AC_DEFUN([AC_SHELL_TRUE],
|
|
|
|
[AC_CACHE_CHECK([whether true(1) works], [my_cv_shell_true_works],
|
|
|
|
[my_cv_shell_true_works=no
|
|
|
|
(true) 2>/dev/null && my_cv_shell_true_works=yes
|
|
|
|
if test "x$my_cv_shell_true_works" = xyes; then
|
|
|
|
AC_DEFINE([TRUE_WORKS], [1],
|
|
|
|
[Define if `true(1)' works properly.])
|
|
|
|
fi])
|
|
|
|
])
|
|
|
|
AC_SHELL_TRUE
|
|
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF([-Werror], [1], [], [stderr])
|
|
|
|
AT_CHECK([grep 'suspicious.*AC_DEFINE' stderr], [], [ignore])
|
|
|
|
|
|
|
|
# Taken from autoconf.texi:Caching Results
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
AC_DEFUN([AC_SHELL_TRUE],
|
|
|
|
[AC_CACHE_CHECK([whether true(1) works], [my_cv_shell_true_works],
|
|
|
|
[my_cv_shell_true_works=no
|
|
|
|
(true) 2>/dev/null && my_cv_shell_true_works=yes])
|
|
|
|
if test "x$my_cv_shell_true_works" = xyes; then
|
|
|
|
AC_DEFINE([TRUE_WORKS], [1],
|
|
|
|
[Define if `true(1)' works properly.])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
AC_SHELL_TRUE
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF([-Werror])
|
|
|
|
AT_CHECK_CONFIGURE([-C], [], [stdout])
|
|
|
|
AT_CHECK([grep my_cv_shell_true_works config.cache], [], [ignore])
|
|
|
|
AT_CHECK([grep 'true.*works.*yes' stdout], [], [ignore])
|
|
|
|
|
|
|
|
AT_CHECK_CONFIGURE([--config-cache], [], [stdout])
|
|
|
|
AT_CHECK([grep 'true.*works.*cached.*yes' stdout], [], [ignore])
|
|
|
|
|
|
|
|
# config.status only pays attention to the cache file with --recheck.
|
|
|
|
AT_CHECK([./config.status], [], [stdout])
|
|
|
|
AT_CHECK([grep cache stdout], [1])
|
|
|
|
AT_CHECK([./config.status --recheck], [], [stdout])
|
|
|
|
AT_CHECK([grep cache stdout], [0], [ignore])
|
|
|
|
|
|
|
|
# By default, configure uses no cache file, neither loading nor updating it.
|
|
|
|
: > a-stamp-file
|
|
|
|
AT_CHECK_CONFIGURE([], [], [stdout])
|
|
|
|
AT_CHECK([grep cache stdout], [1])
|
|
|
|
AT_CHECK([LC_ALL=C ls -t config.cache a-stamp-file | sed 1q | grep config.cache], [1])
|
|
|
|
|
2010-08-14 14:34:01 +08:00
|
|
|
# Using a symlinked cache file works.
|
|
|
|
: > cache
|
|
|
|
rm -f config.cache
|
|
|
|
AS_LN_S([cache], [config.cache])
|
|
|
|
AT_CHECK_CONFIGURE([-C])
|
|
|
|
# Either the system does not support symlinks, or the symlinked-to file
|
|
|
|
# should be updated.
|
|
|
|
AT_CHECK([test -s cache || test ! -h config.cache])
|
|
|
|
|
2010-06-08 12:49:55 +08:00
|
|
|
# config.site can specify a site-wide cache, accumulating information.
|
2010-06-08 20:25:35 +08:00
|
|
|
# Also test that we don't run afoul of sourcing a file with leading -.
|
|
|
|
AT_DATA([-config.site],
|
2010-06-08 12:49:55 +08:00
|
|
|
[[cache_file=sitecache
|
|
|
|
]])
|
|
|
|
AT_DATA([sitecache],
|
|
|
|
[[my_cv_some_preset_cache_var=yes
|
|
|
|
]])
|
2010-06-08 20:25:35 +08:00
|
|
|
CONFIG_SITE=-config.site
|
2010-06-08 12:49:55 +08:00
|
|
|
export CONFIG_SITE
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_CHECK([grep my_cv_some_preset_cache_var sitecache], [], [ignore])
|
|
|
|
AT_CHECK([grep my_cv_shell_true_works sitecache], [], [ignore])
|
|
|
|
AT_CHECK_CONFIGURE([], [], [stdout])
|
|
|
|
AT_CHECK([grep 'whether true.*works.*cached' stdout], [], [ignore])
|
|
|
|
|
2010-08-25 04:59:13 +08:00
|
|
|
dnl Until we can find a way to avoid catastrophic failure,
|
|
|
|
dnl skip the rest of this test on such shells.
|
|
|
|
echo 'if' > syntax
|
|
|
|
AT_CHECK([${CONFIG_SHELL-$SHELL} -c 'case `. ./syntax; echo $?` in
|
|
|
|
0|"") exit 77;; esac'], [0], [ignore], [ignore])
|
|
|
|
|
2010-06-08 20:25:35 +08:00
|
|
|
# Check that config cache scripts must be well-formed.
|
|
|
|
AT_DATA([bad.site],
|
|
|
|
[[fi
|
|
|
|
]])
|
|
|
|
CONFIG_SITE=$PWD/bad.site
|
2010-10-13 02:29:58 +08:00
|
|
|
AT_CHECK_CONFIGURE([ || exit 1], [1], [stdout], [stderr])
|
|
|
|
AT_CHECK([grep 'failed to load site script' stderr], [], [ignore], [ignore],
|
|
|
|
[AT_CHECK([grep 'whether true' stdout], [1])])
|
2010-06-08 20:25:35 +08:00
|
|
|
|
|
|
|
# However, a missing file is ignored.
|
|
|
|
CONFIG_SITE=./no-such-file
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
|
2010-06-08 12:49:55 +08:00
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
## --------------- ##
|
|
|
|
## AC_CACHE_LOAD. ##
|
|
|
|
## --------------- ##
|
|
|
|
|
|
|
|
# Test AC_CACHE_LOAD.
|
|
|
|
|
|
|
|
AT_SETUP([AC_CACHE_LOAD])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
$some_test_code
|
|
|
|
AC_CACHE_LOAD
|
|
|
|
AC_MSG_NOTICE([some_cv_variable is $some_cv_variable])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AS_UNSET([some_test_code])
|
|
|
|
AT_DATA([new-cache],
|
|
|
|
[[some_cv_variable=value-from-new-cache
|
|
|
|
]])
|
|
|
|
AT_CHECK_CONFIGURE([some_test_code='eval cache_file=new-cache'], [], [stdout])
|
|
|
|
AT_CHECK([grep 'some_cv_variable.*value-from-new-cache' stdout], [], [ignore])
|
|
|
|
|
2001-01-24 18:04:47 +08:00
|
|
|
AT_CLEANUP
|
2001-01-31 23:00:35 +08:00
|
|
|
|
|
|
|
|
2006-10-23 14:12:40 +08:00
|
|
|
## ---------------- ##
|
|
|
|
## AC_COMPUTE_INT. ##
|
|
|
|
## ---------------- ##
|
|
|
|
|
|
|
|
# Make sure AC_COMPUTE_INT fails properly.
|
2006-09-02 13:37:07 +08:00
|
|
|
|
2006-10-23 14:12:40 +08:00
|
|
|
AT_SETUP([AC_COMPUTE_INT])
|
2006-09-02 13:37:07 +08:00
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
2006-10-27 03:30:32 +08:00
|
|
|
AC_COMPUTE_INT([invalid_expression],
|
|
|
|
[**0**],
|
2006-10-23 14:12:40 +08:00
|
|
|
[],
|
2006-10-27 03:30:32 +08:00
|
|
|
[invalid_expression=failed])
|
|
|
|
test "$invalid_expression" = failed ||
|
|
|
|
AC_MSG_ERROR([**0** evaluated to $invalid_expression instead of failing])
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AC_OUTPUT
|
2006-09-02 13:37:07 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2001-09-27 21:28:15 +08:00
|
|
|
## ---------------- ##
|
|
|
|
## AC_TRY_COMMAND. ##
|
|
|
|
## ---------------- ##
|
2001-01-31 23:00:35 +08:00
|
|
|
|
2001-09-27 21:28:15 +08:00
|
|
|
AT_SETUP([AC_TRY_COMMAND])
|
2001-01-31 23:00:35 +08:00
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
|
2001-02-04 03:27:14 +08:00
|
|
|
if AC_TRY_COMMAND([(echo "The Cat in the Hat";
|
2006-05-27 06:29:50 +08:00
|
|
|
echo "The Hat in the Cat" >&2) |
|
|
|
|
grep \^The\ Cat\ in\ the\ Hat\$ >/dev/null]); then
|
2001-02-04 03:27:14 +08:00
|
|
|
:
|
2001-01-31 23:00:35 +08:00
|
|
|
else
|
2010-04-25 23:02:47 +08:00
|
|
|
AC_MSG_ERROR([didn't see the Cat in the Hat])
|
2001-01-31 23:00:35 +08:00
|
|
|
fi
|
|
|
|
|
2001-02-04 03:27:14 +08:00
|
|
|
if AC_TRY_COMMAND([(echo "The Cat in the Hat";
|
2006-05-27 06:29:50 +08:00
|
|
|
echo "The Hat in the Cat" >&2) |
|
|
|
|
grep \^The\ Hat\ in\ the\ Cat\$ >/dev/null]); then
|
2010-04-25 23:02:47 +08:00
|
|
|
AC_MSG_ERROR([saw the Hat in the Cat])
|
2001-01-31 23:00:35 +08:00
|
|
|
fi
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
|
|
|
|
AC_OUTPUT
|
2001-01-31 23:00:35 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE([-q])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
2005-02-24 07:24:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
## ------------ ##
|
|
|
|
## Input/Output ##
|
|
|
|
## ------------ ##
|
|
|
|
|
|
|
|
AT_SETUP([Input/Output])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
2008-09-11 04:06:33 +08:00
|
|
|
cat <&AS@&t@_ORIGINAL_STDIN_FD >&AS@&t@_MESSAGE_FD
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AC_OUTPUT
|
2005-02-24 07:24:49 +08:00
|
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AT_CHECK([echo Hello | CONFIG_SITE=/dev/null ./configure $configure_options | grep -v '^configure: '],, [Hello
|
2005-02-24 07:24:49 +08:00
|
|
|
])
|
2009-09-14 00:03:31 +08:00
|
|
|
AT_CHECK([echo Hello | CONFIG_SITE=/dev/null ./configure $configure_options --silent])
|
2005-02-24 07:24:49 +08:00
|
|
|
|
|
|
|
AT_CLEANUP
|
2007-08-22 04:23:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
## ------------------- ##
|
|
|
|
## configure arguments ##
|
|
|
|
## ------------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([configure arguments])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
echo "$@"
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AC_OUTPUT
|
2007-08-22 04:23:16 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE([FOO=bar --enable-baz --without-zork --silent], [0], [stdout], [ignore])
|
|
|
|
AT_CHECK([grep 'FOO=bar --enable-baz --without-zork --silent' stdout], [0], [ignore], [ignore])
|
|
|
|
|
2008-11-05 10:13:38 +08:00
|
|
|
dnl check that syntax error is detected
|
|
|
|
AT_CHECK_CONFIGURE([=], [1], [], [ignore], [ignore])
|
|
|
|
AT_CHECK_CONFIGURE([1=2], [1], [], [ignore], [ignore])
|
|
|
|
|
2007-08-22 04:23:16 +08:00
|
|
|
AT_CLEANUP
|
2007-10-06 01:26:26 +08:00
|
|
|
|
|
|
|
|
2010-03-16 14:04:40 +08:00
|
|
|
## ------------------------------ ##
|
|
|
|
## AC_ARG_ENABLE and AC_ARG_WITH. ##
|
|
|
|
## ------------------------------ ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_ARG_ENABLE and AC_ARG_WITH])
|
|
|
|
|
|
|
|
AT_DATA_M4SH([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
# Taken from autoconf.texi:Pretty Help Strings.
|
|
|
|
AC_ARG_WITH([foo],
|
|
|
|
[AS_HELP_STRING([--with-foo],
|
|
|
|
[use foo (default is no)])],
|
|
|
|
[use_foo=$withval],
|
|
|
|
[use_foo=no])
|
|
|
|
AC_ARG_WITH([c++],
|
|
|
|
[AS_HELP_STRING([--with-c++],
|
|
|
|
[with c++])],
|
|
|
|
[choice_with=$withval])
|
|
|
|
AC_ARG_ENABLE([c++],
|
|
|
|
[AS_HELP_STRING([--enable-c++],
|
|
|
|
[enable c++])],
|
|
|
|
[choice_enable=$enableval])
|
|
|
|
echo "use_foo: $use_foo"
|
|
|
|
echo "with_c++: $with_c__, $choice_with"
|
|
|
|
echo "enable_c++: $enable_c__, $choice_enable"
|
Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)
It is almost always incorrect for a configure script to omit either
AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for
this.
The implementation is, unfortunately, a bit of a kludge. To check for
the _absence_ of a macro invocation, we can use m4_provide_if inside a
m4_wrap hook. However, if we activate the m4_wrap hook directly from
general.m4, we get spurious warnings at freeze time. We also get
warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT
is *traced*, which means we get double warnings from autoconf, and
autoheader and aclocal complain about it too, which seems unnecessary.
A clean way to deal with this would be to make the hook look for a
special macro that’s defined only when autoconf (the program) is
invoked without any --trace arguments. Unfortunately, autom4te
doesn’t pass --define down to M4, and changing that would involve
coordinating with Automake (the project), so instead I’ve gone for the
kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This
file is *not* included in autoconf.m4f, but it’s installed, and it’s
added to the m4 invocation by autoconf (the program) only when not
tracing. (It still uses m4_wrap, because we pass it to m4 *before*
configure.ac, because otherwise we get nonsense locations for any
*other* diagnostics coming out of this autoconf invocation. I don’t
know why.)
The additional checks in autoreconf are intended to make sure that if
autoreconf skips a directory entirely, you get told why.
Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and
somewhat fewer didn’t bother with AC_INIT; where possible I just added
them.
Suggested by David A. Wheeler, who submitted a patch, but I didn’t
wind up using any of his code. (His implementation used an extra
tracing pass, only checked for a missing AC_INIT, and invented a new
command-line option to turn off this specific warning. I thought this
was tidier overall, despite the kludge.)
* lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run
when generating configure, after the entire configure.ac is
processed. Currently only checks that AC_INIT and AC_OUTPUT were
called at some point, issuing syntax-category warnings if not.
(AC_INIT, AC_OUTPUT): m4_provide self.
* lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]).
* lib/local.mk: Install new file.
* bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te,
but only when not tracing.
* bin/autoreconf.in (autoreconf_current_directory): Distinguish in
diagnostics between “directory skipped because it doesn’t have a
configure.ac or configure.in” (e.g. Cygnus configure) and “directory
has a configure.ac but it doesn’t appear to be autoconf input.”
* tests/*.at: Fix all tests affected by the new warnings.
2020-08-15 01:16:58 +08:00
|
|
|
AC_OUTPUT
|
2010-03-16 14:04:40 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE([--help | grep foo], [0],
|
|
|
|
[[ --with-foo use foo (default is no)
|
|
|
|
]], [ignore])
|
|
|
|
AT_CHECK_CONFIGURE([--with-foo=yes --with-c++ --disable-c++],
|
|
|
|
[], [stdout], [ignore])
|
|
|
|
AT_CHECK([grep 'use_foo: yes' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'with_c++: yes, yes' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'enable_c++: no, no' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'unrecognized option' stdout], [1])
|
|
|
|
AT_CHECK_CONFIGURE([--without-foo --with-c++=no --enable-c++=maybe],
|
|
|
|
[], [stdout], [ignore])
|
|
|
|
AT_CHECK([grep 'use_foo: no' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'with_c++: no, no' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'enable_c++: maybe, maybe' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'unrecognized option' stdout], [1])
|
|
|
|
AT_CHECK_CONFIGURE([], [], [stdout], [ignore])
|
|
|
|
AT_CHECK([grep 'use_foo: no' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'with_c++: , $' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'enable_c++: , $' stdout], [], [ignore])
|
|
|
|
AT_CHECK([grep 'unrecognized option' stdout], [1])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2007-10-06 01:26:26 +08:00
|
|
|
## --------------------- ##
|
|
|
|
## configure directories ##
|
|
|
|
## --------------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([configure directories])
|
|
|
|
|
2014-01-02 07:46:48 +08:00
|
|
|
CONFIG_SITE=/dev/null
|
|
|
|
export CONFIG_SITE
|
|
|
|
|
2007-10-06 01:26:26 +08:00
|
|
|
AT_DATA([foo.in],
|
|
|
|
[[prefix=@prefix@
|
|
|
|
exec_prefix=@exec_prefix@
|
|
|
|
libdir=@libdir@
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
AC_CONFIG_FILES([foo])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
dnl check that relative paths are rejected
|
|
|
|
AT_CHECK_CONFIGURE([--libdir=.], [1], [ignore], [stderr])
|
|
|
|
AT_CHECK([grep 'expected an absolute directory name for --libdir: \.' stderr],
|
|
|
|
[0], [ignore])
|
|
|
|
|
|
|
|
dnl check that extra slashes are stripped, and that defaults are not expanded
|
|
|
|
AT_CHECK_CONFIGURE([--prefix=/usr//])
|
|
|
|
AT_CHECK([cat foo], [0], [[prefix=/usr
|
|
|
|
exec_prefix=${prefix}
|
|
|
|
libdir=${exec_prefix}/lib
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
2012-08-16 12:17:49 +08:00
|
|
|
|
|
|
|
## ---------- ##
|
|
|
|
## AC_SUBST. ##
|
|
|
|
## ---------- ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_SUBST])
|
|
|
|
AT_KEYWORDS([AS@&t@_IDENTIFIER_IF])
|
|
|
|
|
|
|
|
# Check that a valid variable name is used.
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([test], [1])
|
|
|
|
AC_SUBST([1], [bar])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF([], [1], [], [stderr])
|
|
|
|
AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([test], [1])
|
|
|
|
AC_SUBST([], [bar])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF([], [1], [], [stderr])
|
|
|
|
AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([test], [1])
|
|
|
|
AC_SUBST([*], [bar])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF([], [1], [], [stderr])
|
|
|
|
AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
|
|
|
|
|
|
|
|
# Make sure AC_SUBST handles variables as expected.
|
|
|
|
AT_DATA([file.in],
|
|
|
|
[[@FOO@
|
|
|
|
@BAR@
|
|
|
|
FOO
|
|
|
|
]])
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT([test], [0])
|
|
|
|
m4_define([FOO], [baz])
|
|
|
|
AC_SUBST([FOO], [bar])
|
|
|
|
BAR=one
|
|
|
|
AC_SUBST([B@&t@AR])
|
|
|
|
BAR=two
|
|
|
|
AC_CONFIG_FILES([file])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF([], [], [], [stderr])
|
|
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_CHECK([cat file], [],
|
|
|
|
[[bar
|
|
|
|
two
|
|
|
|
FOO
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
AS_INIT: ensure fds 0, 1, 2 are open
A patch was recently proposed for GNU libc to make *all* processes
start up with file descriptors 0, 1, and 2 guaranteed to be open.
Part of the rationale for this patch was that configure scripts fail
catastrophically if these fds are closed, even if you just want to run
--help or --version, e.g.
$ ./configure --version <&-; echo $?
./configure: line 555: 0: Bad file descriptor
1
configure scripts cannot rely on behavior specific to GNU libc, so
whether or not that patch gets committed, it makes sense for us to
make configure scripts robust against being started up with closed
stdin/stdout/stderr.
This patch adds code to ensure fds 0, 1, and 2 are open, early in
_AS_SHELL_SANITIZE. It uses a construct, ‘(exec 3>&n)’, that’s known
not to work in very old shells, but that’s OK because those shells
will be rejected by _AS_DETECT_BETTER_SHELL anyway. The worst-case
scenario is that the “This script requires a shell more modern than
all the shells I found on your system” error message won’t get printed.
When these fds are found not to be open, we open them on /dev/null, in
the normal I/O direction (0 for reading, 1 and 2 for writing). There
is a case for opening them in the *opposite* direction so that, for
instance, writes to fd 1 will fail when fd 1 started out closed.
However, that would expose latent bugs that I think should be dealt
with *after* 2.70. (See Savannah bug #110300 for more detail.)
I also took the opportunity to rationalize the order of operations in
_AS_SHELL_SANITIZE a little. All the special shell and environment
variables that we care about are dealt with immediately after
AS_BOURNE_COMPATIBLE, and _AS_PATH_SEPARATOR_PREPARE happens
immediately before the first use of _AS_PATH_WALK.
* lib/m4sugar/m4sh.m4 (_AS_ENSURE_STANDARD_FDS): New macro.
(_AS_SHELL_SANITIZE): Move the “Unset variables that we do not need”
and “NLS nuisances” blocks immediately after setting IFS; merge the
unsetting of CDPATH into the main unsetting loop; move invocation of
_AS_PATH_SEPARATOR_PREPARE to immediately above the “Find who we are”
block; invoke _AS_ENSURE_STANDARD_FDS immediately before
_AS_PATH_SEPARATOR_PREPARE.
* tests/base.at (configure with closed standard fds): New test.
* tests/torture.at (--help and --version in unwritable directory): New test.
2020-08-27 22:14:53 +08:00
|
|
|
|
|
|
|
## ----------------------------------- ##
|
|
|
|
## configure with closed standard fds ##
|
|
|
|
## ----------------------------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([configure with closed standard fds])
|
|
|
|
AT_KEYWORDS([AS@&t@_INIT])
|
|
|
|
|
|
|
|
# Create a configure script that runs a relatively complicated but
|
|
|
|
# self-contained test. Run it.
|
|
|
|
AT_CONFIGURE_AC([[AC_PROG_CC]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_AUTOHEADER
|
|
|
|
AT_CHECK_CONFIGURE([], [], [stdout], [stderr])
|
|
|
|
AT_CHECK_ENV
|
|
|
|
|
|
|
|
mv stdout stdout-expected
|
|
|
|
mv stderr stderr-expected
|
|
|
|
mv state-env.after state-env-expected
|
|
|
|
mv config.status config-status-expected
|
|
|
|
mv config.h config-h-expected
|
|
|
|
|
|
|
|
# Run it again with stdin (fd 0) closed.
|
|
|
|
# There should be no change to the stdout or stderr output and thoe
|
|
|
|
# result of configuration should be the same.
|
|
|
|
|
|
|
|
AT_CHECK_CONFIGURE([ 0<&- ], [], [stdout], [stderr])
|
|
|
|
AT_CHECK_ENV
|
|
|
|
AT_CMP([stdout-expected], [stdout])
|
|
|
|
AT_CMP([stderr-expected], [stderr])
|
|
|
|
AT_CONFIG_CMP([state-env-expected], [state-env.after])
|
|
|
|
|
|
|
|
mv stdout stdout-closed-0
|
|
|
|
mv stderr stderr-closed-0
|
|
|
|
mv state-env.after state-env-closed-0
|
|
|
|
mv config.status config-status-closed-0
|
|
|
|
mv config.h config-h-closed-0
|
|
|
|
|
|
|
|
# Run it again with stdout (fd 1) closed.
|
|
|
|
# There should be no change to the stderr output and the
|
|
|
|
# result of configuration should be the same. (Any output
|
|
|
|
# that would have gone to stdout, of course, is lost.)
|
|
|
|
|
|
|
|
AT_CHECK_CONFIGURE([ 1>&- ], [], [stdout], [stderr])
|
|
|
|
AT_CHECK_ENV
|
|
|
|
AT_CHECK([test -f stdout && test ! -s stdout])
|
|
|
|
AT_CMP([stderr-expected], [stderr])
|
|
|
|
AT_CONFIG_CMP([state-env-expected], [state-env.after])
|
|
|
|
|
|
|
|
mv stdout stdout-closed-1
|
|
|
|
mv stderr stderr-closed-1
|
|
|
|
mv state-env.after state-env-closed-1
|
|
|
|
mv config.status config-status-closed-1
|
|
|
|
mv config.h config-h-closed-1
|
|
|
|
|
|
|
|
# Run it again with stderr (fd 2) closed.
|
|
|
|
# There should be no change to the stdout output and the
|
|
|
|
# result of configuration should be the same. (Any output
|
|
|
|
# that would have gone to stderr, of course, is lost.)
|
|
|
|
|
|
|
|
AT_CHECK_CONFIGURE([ 2>&- ], [], [stdout], [stderr])
|
|
|
|
AT_CHECK_ENV
|
|
|
|
AT_CMP([stdout-expected], [stdout])
|
|
|
|
AT_CHECK([test -f stderr && test ! -s stderr])
|
|
|
|
AT_CONFIG_CMP([state-env-expected], [state-env.after])
|
|
|
|
|
|
|
|
mv stdout stdout-closed-2
|
|
|
|
mv stderr stderr-closed-2
|
|
|
|
mv state-env.after state-env-closed-2
|
|
|
|
mv config.status config-status-closed-2
|
|
|
|
mv config.h config-h-closed-2
|
|
|
|
|
|
|
|
AT_CLEANUP
|