3 AT_BANNER([Autoconf base layer.])
5 # Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 ## ------------------------------- ##
24 ## AC_REQUIRE: topological sort.. ##
25 ## ------------------------------- ##
27 # Check that dependencies are always properly honored.
29 AT_SETUP([AC_REQUIRE: topological sort])
31 AT_DATA([configure.ac],
32 [[define([REQUIRE_AND_CHECK],
34 test -z "$m4@&t@_translit([$1], [A-Z], [a-z])" && AS_EXIT(1)])
37 [REQUIRE_AND_CHECK([TEST2a])
38 REQUIRE_AND_CHECK([TEST2b])
45 [REQUIRE_AND_CHECK([TEST3])
49 [REQUIRE_AND_CHECK([TEST2a])
56 AC_MSG_ERROR([\$test1 is empty])
67 ## ----------------------------------------------- ##
68 ## AC_REQUIRE and AC_DEFUN_ONCE: Require, expand. ##
69 ## ----------------------------------------------- ##
71 AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: Require, expand])
73 AT_DATA([configure.ac],
75 [AC_REQUIRE([MULTI_TEST])
76 AC_REQUIRE([SINGLE_TEST])])
78 AC_DEFUN([MULTI_TEST],
79 [multi_test=".$multi_test"])
81 AC_DEFUN_ONCE([SINGLE_TEST],
82 [single_test=".$single_test"])
93 case $multi_test:$single_test in
95 ...:* ) AC_MSG_ERROR([DEFUN_ONCE is broken]);;
96 *:. ) AC_MSG_ERROR([DEFUN is broken (Wow, congrats!)]);;
100 AT_CHECK_AUTOCONF([], 0, [],
101 [configure.ac:17: warning: SINGLE_TEST invoked multiple times
102 configure.ac:18: warning: SINGLE_TEST invoked multiple times
111 ## ----------------------------------------------- ##
112 ## AC_REQUIRE and AC_DEFUN_ONCE: Expand, require. ##
113 ## ----------------------------------------------- ##
115 AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: Expand, require])
117 AT_DATA([configure.ac],
119 [AC_REQUIRE([MULTI_TEST])
120 AC_REQUIRE([SINGLE_TEST])])
122 AC_DEFUN([MULTI_TEST],
123 [multi_test=".$multi_test"])
125 AC_DEFUN_ONCE([SINGLE_TEST],
126 [single_test=".$single_test"])
137 case $multi_test:$single_test in
139 ..:* ) AC_MSG_ERROR([DEFUN_ONCE is broken]);;
140 *:. ) AC_MSG_ERROR([DEFUN is broken (Wow, congrats!)]);;
141 * ) AC_MSG_ERROR([received `$multi_test:$single_test']);;
145 AT_CHECK_AUTOCONF([], 0, [],
146 [configure.ac:16: warning: SINGLE_TEST invoked multiple times
154 ## ------------------------- ##
155 ## AC_REQUIRE & AC_PROVIDE. ##
156 ## ------------------------- ##
158 AT_SETUP([AC_REQUIRE & AC_PROVIDE])
160 AT_DATA([configure.ac],
162 [AC_REQUIRE([INNER_TEST])])
164 AC_DEFUN([INNER_TEST],
165 [inner_test=".$inner_test"])
169 AC_PROVIDE([INNER_TEST])
174 * ) AC_MSG_ERROR([received `$inner_test']);;
184 ## ---------------- ##
185 ## AC_CACHE_CHECK. ##
186 ## ---------------- ##
188 # Make sure AC_CACHE_CHECK is silent with -q.
190 AT_SETUP([AC_CACHE_CHECK])
192 AT_DATA([configure.ac],
194 AC_CACHE_CHECK([for nothing],
200 AT_CHECK_CONFIGURE([-q])
205 ## ---------------- ##
206 ## AC_TRY_COMMAND. ##
207 ## ---------------- ##
209 AT_SETUP([AC_TRY_COMMAND])
211 AT_DATA([configure.ac],
214 if AC_TRY_COMMAND([(echo "The Cat in the Hat";
215 echo "The Hat in the Cat" >&2)
216 | grep \^The\ Cat\ in\ the\ Hat\$ >/dev/null]); then
219 AC_MSG_ERROR([Didn't see the Cat in the Hat!])
222 if AC_TRY_COMMAND([(echo "The Cat in the Hat";
223 echo "The Hat in the Cat" >&2)
224 | grep \^The\ Hat\ in\ the\ Cat\$ >/dev/null]); then
225 AC_MSG_ERROR([Saw the Hat in the Cat!])
230 AT_CHECK_CONFIGURE([-q])