autoconf/tests/base.at
Akim Demaille 8a3c7070bd * m4sugar.m4 (m4_undefine, m4_popdef): Don't tolerate undefined
arguments.
(_m4_expansion_stack): Rename as...
(m4_expansion_stack): this, and change its value: instead of using
the pushdef stack to stack each *line* of the stack, each
definition contains the whole stack.  I.e., to display the whole
stack, instead of popdefing and displaying each definition, just
display the current definition.
(m4_expansion_stack_push, m4_expansion_stack_pop): New.
* tests/atspecific.m4 (AT_CHECK_AUTOCONF): Let $2 be the expected
exit status.
* tests/m4sugar.m4 (m4_require: circular dependencies): New test.
2001-01-17 15:26:42 +00:00

161 lines
2.9 KiB
Plaintext

# -*- autoconf -*-
AT_BANNER([Autoconf base layer.])
## ------------------------------- ##
## AC_REQUIRE: topological sort.. ##
## ------------------------------- ##
# Check that dependencies are always properly honored.
AT_SETUP([AC_REQUIRE: topological sort])
AT_DATA(configure.ac,
[[define([REQUIRE_AND_CHECK],
[AC_REQUIRE([$1])dnl
test -z "$m4_translit([$1], [A-Z], [a-z])" && AS_EXIT(1)])
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])
AC_PLAIN_SCRIPT
TEST1
test -z "$test1" &&
AC_MSG_ERROR([\$test1 is empty])
AS_EXIT(0)
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP
## ----------------------------------------------- ##
## AC_REQUIRE and AC_DEFUN_ONCE: Require, expand. ##
## ----------------------------------------------- ##
AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: Require, expand])
AT_DATA([configure.ac],
[[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"])
AC_PLAIN_SCRIPT
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
]])
AT_CHECK_AUTOCONF([], 0, [],
[configure.ac:16: warning: SINGLE_TEST invoked multiple times
configure.ac:17: warning: SINGLE_TEST invoked multiple times
])
AT_CHECK_CONFIGURE
AT_CLEANUP
## ----------------------------------------------- ##
## AC_REQUIRE and AC_DEFUN_ONCE: Expand, require. ##
## ----------------------------------------------- ##
AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: Expand, require])
AT_DATA([configure.ac],
[[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"])
AC_PLAIN_SCRIPT
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!)]);;
* ) AC_MSG_ERROR([received `$multi_test:$single_test']);;
esac
]])
AT_CHECK_AUTOCONF([], 0, [],
[configure.ac:15: warning: SINGLE_TEST invoked multiple times
])
AT_CHECK_CONFIGURE
AT_CLEANUP
## ------------------------- ##
## AC_REQUIRE & AC_PROVIDE. ##
## ------------------------- ##
AT_SETUP([AC_REQUIRE & AC_PROVIDE])
AT_DATA([configure.ac],
[[AC_DEFUN([TEST],
[AC_REQUIRE([INNER_TEST])])
AC_DEFUN([INNER_TEST],
[inner_test=".$inner_test"])
AC_PLAIN_SCRIPT
AC_PROVIDE([INNER_TEST])
TEST
case $inner_test in
"" ) AS_EXIT(0);;
* ) AC_MSG_ERROR([received `$inner_test']);;
esac
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP