diff options
author | Eric Blake <eblake@redhat.com> | 2012-11-09 15:41:18 -0700 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-11-09 16:16:22 -0700 |
commit | 5269030d19da56c4b0a180e4a9793c959a28d9e9 (patch) | |
tree | e3282f86fa6617253849168310a151e2d5c059ed /tests/tools.at | |
parent | 1ed0548896e941b381e96724e41badc42ef7ec6e (diff) | |
download | autoconf-5269030d19da56c4b0a180e4a9793c959a28d9e9.tar.gz |
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.
Diffstat (limited to 'tests/tools.at')
-rw-r--r-- | tests/tools.at | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/tools.at b/tests/tools.at index 4ffe3da9..675cdfd1 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -358,6 +358,77 @@ AT_CHECK_AUTOCONF([[-t define:'$1' -i| sed -n '$p']], AT_CLEANUP +# autoconf --trace: AC_CONFIG_MACRO_DIRS +# -------------------------------------- +AT_SETUP([autoconf --trace: AC_CONFIG_MACRO_DIRS]) +AT_KEYWORDS([AC_CONFIG_MACRO_DIR AC_CONFIG_MACRO_DIR_TRACE]) + +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_MACRO_DIR([dir1]) +AC_CONFIG_MACRO_DIRS([dir2 dir3 \ +dir4]) +AC_CONFIG_MACRO_DIRS([dir5]) +]]) + +# Legacy tracing +AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR], 0, +[[configure.ac:2:AC_CONFIG_MACRO_DIR:dir1 +]]) + +# Preferred tracing +AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR_TRACE], 0, +[[configure.ac:2:AC_CONFIG_MACRO_DIR_TRACE:dir1 +configure.ac:3:AC_CONFIG_MACRO_DIR_TRACE:dir2 +configure.ac:3:AC_CONFIG_MACRO_DIR_TRACE:dir3 +configure.ac:3:AC_CONFIG_MACRO_DIR_TRACE:dir4 +configure.ac:5:AC_CONFIG_MACRO_DIR_TRACE:dir5 +]]) + +# Legacy macro can only be used once +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_MACRO_DIR([dir1]) +AC_CONFIG_MACRO_DIR([dir2]) +]]) +AT_CHECK_AUTOCONF([], [1], [], [stderr]) +AT_CHECK([grep 'error: AC_CONFIG_MACRO_DIR can only be used once' stderr], +[], [ignore]) + +# Legacy macro must be used first, if present +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_MACRO_DIRS([dir1]) +AC_CONFIG_MACRO_DIR([dir2]) +]]) +AT_CHECK_AUTOCONF([], [1], [], [stderr]) +AT_CHECK([grep 'error: AC_CONFIG_MACRO_DIR can only be used once' stderr], +[], [ignore]) + +# Only use the public macros +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_MACRO_DIR_TRACE([dir1]) +]]) +AT_CHECK_AUTOCONF([], [1], [], +[[configure.ac:2: error: Do not invoke AC_CONFIG_MACRO_DIR_TRACE directly +configure.ac:2: the top level +autom4te: m4 failed with exit status: 1 +]]) + +# Legacy macro use is not required, but still gets traced +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_MACRO_DIRS([dir1]) +AC_CONFIG_MACRO_DIRS([dir2]) +]]) +AT_CHECK_AUTOCONF([], [0], [], []) +AT_CHECK_AUTOCONF([-t AC_CONFIG_MACRO_DIR], [0], +[[configure.ac:2:AC_CONFIG_MACRO_DIR:dir1 +]]) + +AT_CLEANUP + ## ---------------------------- ## ## autoconf: forbidden tokens. ## |