Add a check for Boost.Conversion.
[boost.m4.git] / tests / testsuite.at
blobe7d17e47c97da53d030e1dd6d13172b634e39abf
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],
93 AT_DATA([aclocal.m4], [])
94 # FIXME: kludge so that we can find the macros we're testing (I can't think of
95 # anything better)
96 for i in "$abs_top_srcdir"/build-aux/*.m4; do
97   echo "m4@&t@_include([[$i]])" >>aclocal.m4
98 done
100 AT_DATA([configure.ac],
101 [[AC_INIT
102 AC_CONFIG_AUX_DIR($top_srcdir/build-aux)]
104 [AC_OUTPUT
106 ])# AT_CONFIGURE_AC
109 # AT_CHECK_AUTOCONF(ARGS, [EXIT-STATUS = 0], STDOUT, STDERR)
110 # ----------------------------------------------------------
111 # We always use "--force", to prevent problems with timestamps if the testsuite
112 # were running too fast.
113 m4_define([AT_CHECK_AUTOCONF],
114 [AT_CHECK_M4([autoconf --force $1], [$2], [$3], [$4])
118 # AT_CHECK_CONFIGURE(END-COMMAND,
119 #                    [EXIT-STATUS = 0],
120 #                    [STDOUT = IGNORE], STDERR)
121 # --------------------------------------------
122 # `abs_top_srcdir' is needed so that `./configure' finds install-sh.
123 # Using --srcdir is more expensive.
124 m4_define([AT_CHECK_CONFIGURE],
125 [AT_CAPTURE_FILE([config.log])[]dnl
126  AT_CHECK([top_srcdir=$abs_top_srcdir ./configure $1],
127           [$2],
128           m4_default([$3], [ignore]), [$4])])
131 # AT_CONFIG_CMP(VAR-FILE-A, VAR-FILE-B)
132 # -------------------------------------
133 # Check the outcomes of two configure runs for equality by comparing dumps of
134 # their shell variables.  VAR-FILE-A and VAR-FILE-B are two `set'-style shell
135 # variable space dumps.
137 # We permit variance between runs in the following shell variables:
138 # - ^as_
139 #   M4sh's shell name space.
140 # - ^ac_, excluding ^ac_cv_
141 #   Autoconf's private shell name space.
142 # - PPID [bash, zsh]
143 # - RANDOM [zsh]
144 # - SECONDS [zsh]
145 # - '$' [zsh]
147 # Furthermore, it is okay for a non-cache variable initialized to empty in one
148 # run to be unset in another run.  This happens when, for example, cache update
149 # code tries a number of values in LIBS and eventually restores LIBS to its
150 # original value. If LIBS was previously unset, it will have become set and
151 # empty.  (OTOH, cache variables indicate the result of the test even if they
152 # are empty, so we have to be strict about them.)
154 # Lines that do not look like `foo=bar' are probably latter lines of
155 # multiline values; trim them.
157 m4_define([AT_CONFIG_CMP],
158 [for act_file in $1 $2
160   $SED '/^ac_cv_/ b
161         /^m4_defn([m4_re_word])=./ !d
162         /^[[^=]]*='\'''\''$/ d
163         /^a[[cs]]_/ d
164         /^PPID=/ d
165         /^RANDOM=/ d
166         /^SECONDS=/ d
167         /'\'\\\$\''=/ d
168         ' $act_file >at_config_vars-$act_file
169 done
170 AT_CMP([at_config_vars-$1], [at_config_vars-$2])[]dnl
171 ])# AT_CONFIG_CMP
174 # AT_CHECK_MACRO(MACRO, [MACRO-USE], [ADDITIONAL-CMDS],
175 #                [AUTOCONF-FLAGS = -W obsolete])
176 # -----------------------------------------------------
177 # Create a minimalist configure.ac running the macro named
178 # NAME-OF-THE-MACRO, check that autoconf runs on that script,
179 # and that the shell runs correctly the configure.
181 # We run `configure' twice, both times with a cache, and compare
182 # the environment after each run to detect inconsistencies.
184 # New macros are not expected to depend upon obsolete macros.
185 m4_define([AT_CHECK_MACRO],
186 [AT_SETUP([$1])
188 AT_CONFIGURE_AC([m4_default([$2], [$1])])
190 AT_CHECK_AUTOCONF([m4_default([$4], [-W obsolete])])
192 for at_run in r1 r2
194     AT_CHECK_CONFIGURE([-C])
195     cp -f state-env.after state-env.$at_run
196     dnl cp -f config.h config-h.$at_run
197     dnl AT_CHECK_ENV
198 done
200 AT_CONFIG_CMP([state-env.r1], [state-env.r2])
204 AT_CLEANUP[]dnl
205 ])# AT_CHECK_MACRO
208 # AT_CHECK_MACRO_CROSS(MACRO, [MACRO-USE], [ADDITIONAL-CMDS],
209 #                      [AUTOCONF-FLAGS = -W obsolete])
210 # -----------------------------------------------------------
211 # Like the previous one, but creates two checks: for native
212 # compile and for cross-compile.
213 m4_define([AT_CHECK_MACRO_CROSS],
214 [AT_CHECK_MACRO($@)
215 AT_CHECK_MACRO([$1 (cross compile)],
216   [AT_KEYWORDS([cross])
217   # Exercise the code used when cross-compiling.
218   cross_compiling=yes
219   ac_tool_warned=yes
220   m4_default([$2], [$1])],
221   [$3], [$4])
224 ## ----------------------- ##
225 ## Launch the test suite.  ##
226 ## ----------------------- ##
228 AT_INIT
229 AT_COPYRIGHT(
230 [Copyright (C) 2007  Benoit Sigoure <tsuna@lrde.epita.fr>
231 This is free software; see the source for copying conditions.  There is NO
232 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.])
234 AT_BANNER([Boost headers])
236 AT_CHECK_MACRO([BOOST_REQUIRE])
237 AT_CHECK_MACRO([BOOST_REQUIRE 0.0], [BOOST_REQUIRE([0.0])])
238 AT_CHECK_MACRO_CROSS([BOOST_REQUIRE 1.0], [BOOST_REQUIRE([1.0])])
239 AT_CHECK_MACRO([BOOST_REQUIRE 1.1.1], [BOOST_REQUIRE([1.1.1])])
241 AT_CHECK_MACRO([BOOST_REQUIRE $var 0.0], [var=0.0; BOOST_REQUIRE([$var])])
242 AT_CHECK_MACRO_CROSS([BOOST_REQUIRE $var 1.0], [var=1.0; BOOST_REQUIRE([$var])])
243 AT_CHECK_MACRO([BOOST_REQUIRE $var 1.1.1], [var=1.1.1; BOOST_REQUIRE([$var])])
245 AT_BANNER([Boost header-only libraries])
247 AT_CHECK_MACRO([BOOST_CONVERSION])
248 AT_CHECK_MACRO([BOOST_FOREACH])
250 AT_BANNER([Boost libraries])
252 AT_CHECK_MACRO([BOOST_FILESYSTEM])
253 AT_CHECK_MACRO([BOOST_GRAPH])
254 AT_CHECK_MACRO_CROSS([BOOST_THREADS])