Support Boost.IOStreams.
[boost.m4.git] / tests / testsuite.at
blob8d1ccb8dd1bc9b4035a689edf1cee0195649055c
1 # Copyright (C) 2007  Benoit Sigoure <tsuna@lrde.epita.fr>
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 # Most of the macros were shamelessly stolen from autoconf's own testsuite.
17 # Version used to steal the macros: dc51583
19 ## ---------------- ##
20 ## Utility macros.  ##
21 ## ---------------- ##
23 # AT_CMP(FILE-1, FILE-2)
24 # ----------------------
25 # Check FILE-1 and FILE-2 for equality, like `cmp FILE-1 FILE-2'.
26 m4_define([AT_CMP],
27 [m4_ifval([$2],, [m4_fatal([AT_CMP takes two arguments.])])[]dnl
28 AT_CHECK([$at_diff "$1" "$2"])
29 ])# AT_CMP
32 ## ----------------------- ##
33 ## Testing with Autoconf.  ##
34 ## ----------------------- ##
37 # AT_CHECK_M4(COMMAND, [EXIT-STATUS = 0], STDOUT, STDERR)
38 # -------------------------------------------------------
39 # If stderr is specified, normalize the observed stderr.
40 # This (using GNU M4 1.4.6 or later)
42 #  /usr/local/bin/m4:script.4s:1: cannot open `foo': No such file or directory
43 #  autom4te: /usr/local/bin/m4 failed with exit status: 1
45 # or this (GNU M4 1.4 installed as gm4)
47 #  script.4s:1: /usr/local/bin/gm4: Cannot open foo: No such file or directory
48 #  autom4te: /usr/local/bin/gm4 failed with exit status: 1
50 # becomes
52 #  m4:script.4s:1: cannot open `foo': No such file or directory
53 #  autom4te: m4 failed with exit status: 1
55 # We use the following sed patterns:
57 #     (m4): ?(file): ?(line):
58 # or  (file): ?(line): ?(m4):
59 # to  m4:(file):(line):
61 # and
62 #     m4:(file):(line): Cannot open foo:
63 # to  m4:(file):(line): cannot open `foo':
65 # and
66 #     autom4te: [^ ]m4
67 # or  autom4te: [^ ]m4.exe
68 # to  autom4te: m4
70 # Moreover, DJGPP error messages include the error code in brackets;
71 # remove the error code during normalization.
73 m4_define([AT_CHECK_M4],
74 [AT_CHECK([$1], [$2], [$3],
75           m4_case([$4], [], [], [ignore], [ignore], [stderr]))
76 m4_case([$4], [], [], [ignore], [],
77 [AT_CHECK([[sed 's/^[^:]*m4: *\([^:]*:\) *\([0-9][0-9]*: \)/m4:\1\2/
78         s/^\([^:]*:\) *\([0-9][0-9]*:\)[^:]*m4: /m4:\1\2 /
79         s/^\(m4:[^:]*:[0-9][0-9]*: \)C\(annot open \)\([^`:]*\):/\1c\2`\3'\'':/
80         s/^autom4te: [^ ]*m4 /autom4te: m4 /
81         s/^autom4te: [^ ]*m4\.exe /autom4te: m4 /
82         s/ (E[A-Z]*)$//
83     ' stderr >&2]], [0], [], [$4])])
87 # AT_CONFIGURE_AC(BODY)
88 # ---------------------
89 # Create a full configure.ac running BODY,
90 # AC_OUTPUT, and environment checking hooks.
91 m4_define([AT_CONFIGURE_AC],
92 [AT_DATA([aclocal.m4], [])
93 # FIXME: kludge so that we can find the macros we're testing (I can't think of
94 # anything better) and to get the definitions require to use Libtool without
95 # all the hassle of running libtoolize (which complain because there is a
96 # variable in AC@&t@_CONFIG_AUX_DIR).
97 sed '/m4@&t@_include/d' "$abs_top_srcdir/aclocal.m4" >>aclocal.m4
98 for i in "$abs_top_srcdir"/build-aux/*.m4; do
99   echo "m4@&t@_include([[$i]])" >>aclocal.m4
100 done
102 AT_DATA([configure.ac],
103 [[AC_INIT
104 AC_CONFIG_AUX_DIR([$top_srcdir/build-aux])]
105 AC_PROG_LIBTOOL
107 [AC_OUTPUT
109 ])# AT_CONFIGURE_AC
112 # AT_CHECK_AUTOCONF(ARGS, [EXIT-STATUS = 0], STDOUT, STDERR)
113 # ----------------------------------------------------------
114 # We always use "--force", to prevent problems with timestamps if the testsuite
115 # were running too fast.
116 m4_define([AT_CHECK_AUTOCONF],
117 [AT_CHECK_M4([autoconf --force $1], [$2], [$3], [$4])
121 # AT_CHECK_CONFIGURE(END-COMMAND,
122 #                    [EXIT-STATUS = 0],
123 #                    [STDOUT = IGNORE], STDERR)
124 # --------------------------------------------
125 # `abs_top_srcdir' is needed so that `./configure' finds install-sh.
126 # Using --srcdir is more expensive.
127 m4_define([AT_CHECK_CONFIGURE],
128 [AT_CAPTURE_FILE([config.log])[]dnl
129  AT_CHECK([top_srcdir=$abs_top_srcdir \
130            ./configure --host=$host_alias --build=$build_alias \
131            $CONFIGURE_FLAGS "CXX=$CXX" "LD=$LD" $1],
132           [$2],
133           m4_default([$3], [ignore]), [$4])])
136 # AT_CONFIG_CMP(VAR-FILE-A, VAR-FILE-B)
137 # -------------------------------------
138 # Check the outcomes of two configure runs for equality by comparing dumps of
139 # their shell variables.  VAR-FILE-A and VAR-FILE-B are two `set'-style shell
140 # variable space dumps.
142 # We permit variance between runs in the following shell variables:
143 # - ^as_
144 #   M4sh's shell name space.
145 # - ^ac_, excluding ^ac_cv_
146 #   Autoconf's private shell name space.
147 # - PPID [bash, zsh]
148 # - RANDOM [zsh]
149 # - SECONDS [zsh]
150 # - '$' [zsh]
152 # Furthermore, it is okay for a non-cache variable initialized to empty in one
153 # run to be unset in another run.  This happens when, for example, cache update
154 # code tries a number of values in LIBS and eventually restores LIBS to its
155 # original value. If LIBS was previously unset, it will have become set and
156 # empty.  (OTOH, cache variables indicate the result of the test even if they
157 # are empty, so we have to be strict about them.)
159 # Lines that do not look like `foo=bar' are probably latter lines of
160 # multiline values; trim them.
162 m4_define([AT_CONFIG_CMP],
163 [for act_file in $1 $2
165   $SED '/^ac_cv_/ b
166         /^m4_defn([m4_re_word])=./ !d
167         /^[[^=]]*='\'''\''$/ d
168         /^a[[cs]]_/ d
169         /^PPID=/ d
170         /^RANDOM=/ d
171         /^SECONDS=/ d
172         /'\'\\\$\''=/ d
173         ' $act_file >at_config_vars-$act_file
174 done
175 AT_CMP([at_config_vars-$1], [at_config_vars-$2])[]dnl
176 ])# AT_CONFIG_CMP
179 # AT_CHECK_MACRO(MACRO, [KEYWORDS], [MACRO-USE], [ADDITIONAL-CMDS],
180 #                [AUTOCONF-FLAGS = -W obsolete])
181 # -----------------------------------------------------------------
182 # Create a minimalist configure.ac running the macro named
183 # NAME-OF-THE-MACRO, check that autoconf runs on that script,
184 # and that the shell runs correctly the configure.
186 # We run `configure' twice, both times with a cache, and compare
187 # the environment after each run to detect inconsistencies.
189 # New macros are not expected to depend upon obsolete macros.
191 # KEYWORDS is a space-separated list of keywords for autotest.
192 m4_define([AT_CHECK_MACRO],
193 [AT_SETUP([$1])
194 m4_if([$2], [], [], [AT_KEYWORDS([$2])])
195 AT_CONFIGURE_AC([m4_default([$3], [$1])])
197 dnl FIXME: We should use:
198 dnl   AT_CHECK_AUTOCONF([m4_default([$4], [-W obsolete])])
199 dnl But because Libtool uses obsolete Autoconf macros, it generates lots of
200 dnl spurious warnings.
201 AT_CHECK_AUTOCONF([m4_default([$5], [])])
203 for at_run in r1 r2
205     AT_CHECK_CONFIGURE([-C])
206     cp -f state-env.after state-env.$at_run
207     dnl cp -f config.h config-h.$at_run
208     dnl AT_CHECK_ENV
209 done
211 AT_CONFIG_CMP([state-env.r1], [state-env.r2])
215 AT_CLEANUP[]dnl
216 ])# AT_CHECK_MACRO
219 # AT_CHECK_MACRO_CROSS(MACRO, [KEYWORDS], [MACRO-USE], [ADDITIONAL-CMDS],
220 #                      [AUTOCONF-FLAGS = -W obsolete])
221 # -----------------------------------------------------------------------
222 # Like the previous one, but creates two checks: for native
223 # compile and for cross-compile.
224 m4_define([AT_CHECK_MACRO_CROSS],
225 [AT_CHECK_MACRO($@)
226 AT_CHECK_MACRO([$1 (cross compile)], [$2],
227   [AT_KEYWORDS([cross])
228   # Exercise the code used when cross-compiling.
229   cross_compiling=yes
230   ac_tool_warned=yes
231   m4_default([$3], [$1])],
232   [$4], [$5])
235 ## ----------------------- ##
236 ## Launch the test suite.  ##
237 ## ----------------------- ##
239 AT_INIT
240 AT_COPYRIGHT(
241 [Copyright (C) 2007  Benoit Sigoure <tsuna@lrde.epita.fr>
242 This is free software; see the source for copying conditions.  There is NO
243 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.])
245 AT_BANNER([Boost headers])
247 AT_CHECK_MACRO([BOOST_REQUIRE], [core])
248 AT_CHECK_MACRO([BOOST_REQUIRE 0.0], [core], [BOOST_REQUIRE([0.0])])
249 AT_CHECK_MACRO_CROSS([BOOST_REQUIRE 1.0], [core], [BOOST_REQUIRE([1.0])])
250 AT_CHECK_MACRO([BOOST_REQUIRE 1.1.1], [core], [BOOST_REQUIRE([1.1.1])])
252 AT_CHECK_MACRO([BOOST_REQUIRE $var 0.0], [core],
253                [var=0.0; BOOST_REQUIRE([$var])])
254 AT_CHECK_MACRO_CROSS([BOOST_REQUIRE $var 1.0], [core],
255                      [var=1.0; BOOST_REQUIRE([$var])])
256 AT_CHECK_MACRO([BOOST_REQUIRE $var 1.1.1], [core],
257                [var=1.1.1; BOOST_REQUIRE([$var])])
259 AT_BANNER([Boost libraries])
261 AT_CHECK_MACRO([BOOST_DATE_TIME], [lib])
262 AT_CHECK_MACRO_CROSS([BOOST_FILESYSTEM], [lib])
263 AT_CHECK_MACRO([BOOST_GRAPH], [lib])
264 AT_CHECK_MACRO([BOOST_IOSTREAMS], [lib])
265 AT_CHECK_MACRO([BOOST_PROGRAM_OPTIONS], [lib])
266 AT_CHECK_MACRO([BOOST_SIGNALS], [lib])
267 AT_CHECK_MACRO([BOOST_REGEX], [lib])
268 AT_CHECK_MACRO([BOOST_TEST], [lib])
269 AT_CHECK_MACRO([BOOST_THREADS], [lib])
270 AT_CHECK_MACRO([BOOST_WAVE], [lib])
272 AT_BANNER([Boost header-only libraries])
274 AT_CHECK_MACRO([BOOST_BIND], [header])
275 AT_CHECK_MACRO([BOOST_CONVERSION], [header])
276 AT_CHECK_MACRO([BOOST_FOREACH], [header])
277 AT_CHECK_MACRO([BOOST_FORMAT], [header])
278 AT_CHECK_MACRO([BOOST_FUNCTION], [header])
279 AT_CHECK_MACRO([BOOST_HASH], [header])
280 AT_CHECK_MACRO([BOOST_UTILITY], [header])
281 AT_CHECK_MACRO([BOOST_REF], [header])
282 AT_CHECK_MACRO([BOOST_SMART_PTR], [header])
283 AT_CHECK_MACRO([BOOST_STRING_ALGO], [header])
284 AT_CHECK_MACRO([BOOST_TRIBOOL], [header])
285 AT_CHECK_MACRO([BOOST_TUPLE], [header])
286 AT_CHECK_MACRO([BOOST_VARIANT], [header])