Add support for Boost.Optional.
[boost.m4.git] / tests / testsuite.at
blobc10007cc4150bdee9a919144244ecb3b7e094fa4
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 # If you want to add a test, look near the end of this file.
21 ## ---------------- ##
22 ## Utility macros.  ##
23 ## ---------------- ##
25 # AT_CMP(FILE-1, FILE-2)
26 # ----------------------
27 # Check FILE-1 and FILE-2 for equality, like `cmp FILE-1 FILE-2'.
28 m4_define([AT_CMP],
29 [m4_ifval([$2],, [m4_fatal([AT_CMP takes two arguments.])])[]dnl
30 AT_CHECK([$at_diff "$1" "$2"])
31 ])# AT_CMP
34 ## ----------------------- ##
35 ## Testing with Autoconf.  ##
36 ## ----------------------- ##
39 # AT_CHECK_M4(COMMAND, [EXIT-STATUS = 0], STDOUT, STDERR)
40 # -------------------------------------------------------
41 # If stderr is specified, normalize the observed stderr.
42 # This (using GNU M4 1.4.6 or later)
44 #  /usr/local/bin/m4:script.4s:1: cannot open `foo': No such file or directory
45 #  autom4te: /usr/local/bin/m4 failed with exit status: 1
47 # or this (GNU M4 1.4 installed as gm4)
49 #  script.4s:1: /usr/local/bin/gm4: Cannot open foo: No such file or directory
50 #  autom4te: /usr/local/bin/gm4 failed with exit status: 1
52 # becomes
54 #  m4:script.4s:1: cannot open `foo': No such file or directory
55 #  autom4te: m4 failed with exit status: 1
57 # We use the following sed patterns:
59 #     (m4): ?(file): ?(line):
60 # or  (file): ?(line): ?(m4):
61 # to  m4:(file):(line):
63 # and
64 #     m4:(file):(line): Cannot open foo:
65 # to  m4:(file):(line): cannot open `foo':
67 # and
68 #     autom4te: [^ ]m4
69 # or  autom4te: [^ ]m4.exe
70 # to  autom4te: m4
72 # Moreover, DJGPP error messages include the error code in brackets;
73 # remove the error code during normalization.
75 m4_define([AT_CHECK_M4],
76 [AT_CHECK([$1], [$2], [$3],
77           m4_case([$4], [], [], [ignore], [ignore], [stderr]))
78 m4_case([$4], [], [], [ignore], [],
79 [AT_CHECK([[sed 's/^[^:]*m4: *\([^:]*:\) *\([0-9][0-9]*: \)/m4:\1\2/
80         s/^\([^:]*:\) *\([0-9][0-9]*:\)[^:]*m4: /m4:\1\2 /
81         s/^\(m4:[^:]*:[0-9][0-9]*: \)C\(annot open \)\([^`:]*\):/\1c\2`\3'\'':/
82         s/^autom4te: [^ ]*m4 /autom4te: m4 /
83         s/^autom4te: [^ ]*m4\.exe /autom4te: m4 /
84         s/ (E[A-Z]*)$//
85     ' stderr >&2]], [0], [], [$4])])
89 # AT_CONFIGURE_AC(BODY)
90 # ---------------------
91 # Create a full configure.ac running BODY,
92 # AC_OUTPUT, and environment checking hooks.
93 m4_define([AT_CONFIGURE_AC],
94 [AT_DATA([aclocal.m4], [])
95 # FIXME: kludge so that we can find the macros we're testing (I can't think of
96 # anything better) and to get the definitions require to use Libtool without
97 # all the hassle of running libtoolize (which complain because there is a
98 # variable in AC@&t@_CONFIG_AUX_DIR).
99 sed '/m4@&t@_include/d' "$abs_top_srcdir/aclocal.m4" >>aclocal.m4
100 for i in "$abs_top_srcdir"/build-aux/*.m4; do
101   echo "m4@&t@_include([[$i]])" >>aclocal.m4
102 done
104 AT_DATA([configure.ac],
105 [[AC_INIT
106 AC_CONFIG_AUX_DIR([$top_srcdir/build-aux])]
107 AC_PROG_LIBTOOL
109 [AC_OUTPUT
111 ])# AT_CONFIGURE_AC
114 # AT_CHECK_AUTOCONF(ARGS, [EXIT-STATUS = 0], STDOUT, STDERR)
115 # ----------------------------------------------------------
116 # We always use "--force", to prevent problems with timestamps if the testsuite
117 # were running too fast.
118 m4_define([AT_CHECK_AUTOCONF],
119 [AT_CHECK_M4([autoconf --force $1], [$2], [$3], [$4])
123 # AT_CHECK_CONFIGURE(END-COMMAND,
124 #                    [EXIT-STATUS = 0],
125 #                    [STDOUT = IGNORE], STDERR)
126 # --------------------------------------------
127 # `abs_top_srcdir' is needed so that `./configure' finds install-sh.
128 # Using --srcdir is more expensive.
129 m4_define([AT_CHECK_CONFIGURE],
130 [AT_CAPTURE_FILE([config.log])[]dnl
131  AT_CHECK([top_srcdir=$abs_top_srcdir \
132            ./configure --host=$host_alias --build=$build_alias \
133            $CONFIGURE_FLAGS "CXX=$CXX" "LD=$LD" $1],
134           [$2],
135           m4_default([$3], [ignore]), [$4])])
138 # AT_CONFIG_CMP(VAR-FILE-A, VAR-FILE-B)
139 # -------------------------------------
140 # Check the outcomes of two configure runs for equality by comparing dumps of
141 # their shell variables.  VAR-FILE-A and VAR-FILE-B are two `set'-style shell
142 # variable space dumps.
144 # We permit variance between runs in the following shell variables:
145 # - ^as_
146 #   M4sh's shell name space.
147 # - ^ac_, excluding ^ac_cv_
148 #   Autoconf's private shell name space.
149 # - PPID [bash, zsh]
150 # - RANDOM [zsh]
151 # - SECONDS [zsh]
152 # - '$' [zsh]
154 # Furthermore, it is okay for a non-cache variable initialized to empty in one
155 # run to be unset in another run.  This happens when, for example, cache update
156 # code tries a number of values in LIBS and eventually restores LIBS to its
157 # original value. If LIBS was previously unset, it will have become set and
158 # empty.  (OTOH, cache variables indicate the result of the test even if they
159 # are empty, so we have to be strict about them.)
161 # Lines that do not look like `foo=bar' are probably latter lines of
162 # multiline values; trim them.
164 m4_define([AT_CONFIG_CMP],
165 [for act_file in $1 $2
167   $SED '/^ac_cv_/ b
168         /^m4_defn([m4_re_word])=./ !d
169         /^[[^=]]*='\'''\''$/ d
170         /^a[[cs]]_/ d
171         /^PPID=/ d
172         /^RANDOM=/ d
173         /^SECONDS=/ d
174         /'\'\\\$\''=/ d
175         ' $act_file >at_config_vars-$act_file
176 done
177 AT_CMP([at_config_vars-$1], [at_config_vars-$2])[]dnl
178 ])# AT_CONFIG_CMP
181 # AT_CHECK_MACRO(MACRO, [KEYWORDS], [MACRO-USE], [ADDITIONAL-CMDS],
182 #                [AUTOCONF-FLAGS = -W obsolete])
183 # -----------------------------------------------------------------
184 # Create a minimalist configure.ac running the macro named
185 # NAME-OF-THE-MACRO, check that autoconf runs on that script,
186 # and that the shell runs correctly the configure.
188 # We run `configure' twice, both times with a cache, and compare
189 # the environment after each run to detect inconsistencies.
191 # New macros are not expected to depend upon obsolete macros.
193 # KEYWORDS is a space-separated list of keywords for autotest.
194 m4_define([AT_CHECK_MACRO],
195 [AT_SETUP([$1])
196 m4_if([$2], [], [], [AT_KEYWORDS([$2])])
197 AT_CONFIGURE_AC([m4_default([$3], [$1])])
199 dnl FIXME: We should use:
200 dnl   AT_CHECK_AUTOCONF([m4_default([$4], [-W obsolete])])
201 dnl But because Libtool uses obsolete Autoconf macros, it generates lots of
202 dnl spurious warnings.
203 AT_CHECK_AUTOCONF([m4_default([$5], [])])
205 for at_run in r1 r2
207     AT_CHECK_CONFIGURE([-C])
208     cp -f state-env.after state-env.$at_run
209     dnl cp -f config.h config-h.$at_run
210     dnl AT_CHECK_ENV
211 done
213 AT_CONFIG_CMP([state-env.r1], [state-env.r2])
217 AT_CLEANUP[]dnl
218 ])# AT_CHECK_MACRO
221 # AT_CHECK_MACRO_CROSS(MACRO, [KEYWORDS], [MACRO-USE], [ADDITIONAL-CMDS],
222 #                      [AUTOCONF-FLAGS = -W obsolete])
223 # -----------------------------------------------------------------------
224 # Like the previous one, but creates two checks: for native
225 # compile and for cross-compile.
226 m4_define([AT_CHECK_MACRO_CROSS],
227 [AT_CHECK_MACRO($@)
228 AT_CHECK_MACRO([$1 (cross compile)], [$2],
229   [AT_KEYWORDS([cross])
230   # Exercise the code used when cross-compiling.
231   cross_compiling=yes
232   ac_tool_warned=yes
233   m4_default([$3], [$1])],
234   [$4], [$5])
237 ## ----------------------- ##
238 ## Launch the test suite.  ##
239 ## ----------------------- ##
241 AT_INIT
242 AT_COPYRIGHT(
243 [Copyright (C) 2007  Benoit Sigoure <tsuna@lrde.epita.fr>
244 This is free software; see the source for copying conditions.  There is NO
245 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.])
247 AT_BANNER([Boost headers])
249 AT_CHECK_MACRO([BOOST_REQUIRE], [core])
250 AT_CHECK_MACRO([BOOST_REQUIRE 0.0], [core], [BOOST_REQUIRE([0.0])])
251 AT_CHECK_MACRO_CROSS([BOOST_REQUIRE 1.0], [core], [BOOST_REQUIRE([1.0])])
252 AT_CHECK_MACRO([BOOST_REQUIRE 1.1.1], [core], [BOOST_REQUIRE([1.1.1])])
254 AT_CHECK_MACRO([BOOST_REQUIRE $var 0.0], [core],
255                [var=0.0; BOOST_REQUIRE([$var])])
256 AT_CHECK_MACRO_CROSS([BOOST_REQUIRE $var 1.0], [core],
257                      [var=1.0; BOOST_REQUIRE([$var])])
258 AT_CHECK_MACRO([BOOST_REQUIRE $var 1.1.1], [core],
259                [var=1.1.1; BOOST_REQUIRE([$var])])
261 AT_BANNER([Boost libraries])
263 AT_CHECK_MACRO([BOOST_DATE_TIME], [lib])
264 AT_CHECK_MACRO_CROSS([BOOST_FILESYSTEM], [lib])
265 AT_CHECK_MACRO([BOOST_GRAPH], [lib])
266 AT_CHECK_MACRO([BOOST_IOSTREAMS], [lib])
267 AT_CHECK_MACRO([BOOST_IOSTREAMS (static)], [lib], [BOOST_IOSTREAMS([s])])
268 AT_CHECK_MACRO([BOOST_PROGRAM_OPTIONS], [lib])
269 AT_CHECK_MACRO([BOOST_SERIALIZATION], [lib])
270 AT_CHECK_MACRO([BOOST_SIGNALS], [lib])
271 AT_CHECK_MACRO([BOOST_SYSTEM], [lib])
272 AT_CHECK_MACRO([BOOST_REGEX], [lib])
273 AT_CHECK_MACRO([BOOST_TEST], [lib])
274 AT_CHECK_MACRO([BOOST_TEST (static)], [lib], [BOOST_TEST([s])])
275 AT_CHECK_MACRO([BOOST_THREADS], [lib])
276 AT_CHECK_MACRO([BOOST_WAVE], [lib])
278 AT_BANNER([Boost header-only libraries])
280 AT_CHECK_MACRO([BOOST_BIND], [header])
281 AT_CHECK_MACRO([BOOST_CONVERSION], [header])
282 AT_CHECK_MACRO([BOOST_FOREACH], [header])
283 AT_CHECK_MACRO([BOOST_FORMAT], [header])
284 AT_CHECK_MACRO([BOOST_FUNCTION], [header])
285 AT_CHECK_MACRO([BOOST_HASH], [header])
286 AT_CHECK_MACRO([BOOST_LAMBDA], [header])
287 AT_CHECK_MACRO([BOOST_OPTIONAL], [header])
288 AT_CHECK_MACRO([BOOST_PREPROCESSOR], [header])
289 AT_CHECK_MACRO([BOOST_UTILITY], [header])
290 AT_CHECK_MACRO([BOOST_REF], [header])
291 AT_CHECK_MACRO([BOOST_SMART_PTR], [header])
292 AT_CHECK_MACRO([BOOST_STRING_ALGO], [header])
293 AT_CHECK_MACRO([BOOST_TOKENIZER], [header])
294 AT_CHECK_MACRO([BOOST_TRIBOOL], [header])
295 AT_CHECK_MACRO([BOOST_TUPLE], [header])
296 AT_CHECK_MACRO([BOOST_VARIANT], [header])
297 AT_CHECK_MACRO([BOOST_XPRESSIVE], [header])