Properly find the pthreads flags for use with Boost.Thread.
[boost.m4.git] / tests / testsuite.at
blob540c4a7da19e62fb2c2e43f48459cbe1a45aef78
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 \
127            ./configure --host=$host --build=$build \
128            $CONFIGURE_FLAGS "CXX=$CXX" "LD=$LD" $1],
129           [$2],
130           m4_default([$3], [ignore]), [$4])])
133 # AT_CONFIG_CMP(VAR-FILE-A, VAR-FILE-B)
134 # -------------------------------------
135 # Check the outcomes of two configure runs for equality by comparing dumps of
136 # their shell variables.  VAR-FILE-A and VAR-FILE-B are two `set'-style shell
137 # variable space dumps.
139 # We permit variance between runs in the following shell variables:
140 # - ^as_
141 #   M4sh's shell name space.
142 # - ^ac_, excluding ^ac_cv_
143 #   Autoconf's private shell name space.
144 # - PPID [bash, zsh]
145 # - RANDOM [zsh]
146 # - SECONDS [zsh]
147 # - '$' [zsh]
149 # Furthermore, it is okay for a non-cache variable initialized to empty in one
150 # run to be unset in another run.  This happens when, for example, cache update
151 # code tries a number of values in LIBS and eventually restores LIBS to its
152 # original value. If LIBS was previously unset, it will have become set and
153 # empty.  (OTOH, cache variables indicate the result of the test even if they
154 # are empty, so we have to be strict about them.)
156 # Lines that do not look like `foo=bar' are probably latter lines of
157 # multiline values; trim them.
159 m4_define([AT_CONFIG_CMP],
160 [for act_file in $1 $2
162   $SED '/^ac_cv_/ b
163         /^m4_defn([m4_re_word])=./ !d
164         /^[[^=]]*='\'''\''$/ d
165         /^a[[cs]]_/ d
166         /^PPID=/ d
167         /^RANDOM=/ d
168         /^SECONDS=/ d
169         /'\'\\\$\''=/ d
170         ' $act_file >at_config_vars-$act_file
171 done
172 AT_CMP([at_config_vars-$1], [at_config_vars-$2])[]dnl
173 ])# AT_CONFIG_CMP
176 # AT_CHECK_MACRO(MACRO, [MACRO-USE], [ADDITIONAL-CMDS],
177 #                [AUTOCONF-FLAGS = -W obsolete])
178 # -----------------------------------------------------
179 # Create a minimalist configure.ac running the macro named
180 # NAME-OF-THE-MACRO, check that autoconf runs on that script,
181 # and that the shell runs correctly the configure.
183 # We run `configure' twice, both times with a cache, and compare
184 # the environment after each run to detect inconsistencies.
186 # New macros are not expected to depend upon obsolete macros.
187 m4_define([AT_CHECK_MACRO],
188 [AT_SETUP([$1])
190 AT_CONFIGURE_AC([m4_default([$2], [$1])])
192 AT_CHECK_AUTOCONF([m4_default([$4], [-W obsolete])])
194 for at_run in r1 r2
196     AT_CHECK_CONFIGURE([-C])
197     cp -f state-env.after state-env.$at_run
198     dnl cp -f config.h config-h.$at_run
199     dnl AT_CHECK_ENV
200 done
202 AT_CONFIG_CMP([state-env.r1], [state-env.r2])
206 AT_CLEANUP[]dnl
207 ])# AT_CHECK_MACRO
210 # AT_CHECK_MACRO_CROSS(MACRO, [MACRO-USE], [ADDITIONAL-CMDS],
211 #                      [AUTOCONF-FLAGS = -W obsolete])
212 # -----------------------------------------------------------
213 # Like the previous one, but creates two checks: for native
214 # compile and for cross-compile.
215 m4_define([AT_CHECK_MACRO_CROSS],
216 [AT_CHECK_MACRO($@)
217 AT_CHECK_MACRO([$1 (cross compile)],
218   [AT_KEYWORDS([cross])
219   # Exercise the code used when cross-compiling.
220   cross_compiling=yes
221   ac_tool_warned=yes
222   m4_default([$2], [$1])],
223   [$3], [$4])
226 ## ----------------------- ##
227 ## Launch the test suite.  ##
228 ## ----------------------- ##
230 AT_INIT
231 AT_COPYRIGHT(
232 [Copyright (C) 2007  Benoit Sigoure <tsuna@lrde.epita.fr>
233 This is free software; see the source for copying conditions.  There is NO
234 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.])
236 AT_BANNER([Boost headers])
238 AT_CHECK_MACRO([BOOST_REQUIRE])
239 AT_CHECK_MACRO([BOOST_REQUIRE 0.0], [BOOST_REQUIRE([0.0])])
240 AT_CHECK_MACRO_CROSS([BOOST_REQUIRE 1.0], [BOOST_REQUIRE([1.0])])
241 AT_CHECK_MACRO([BOOST_REQUIRE 1.1.1], [BOOST_REQUIRE([1.1.1])])
243 AT_CHECK_MACRO([BOOST_REQUIRE $var 0.0], [var=0.0; BOOST_REQUIRE([$var])])
244 AT_CHECK_MACRO_CROSS([BOOST_REQUIRE $var 1.0], [var=1.0; BOOST_REQUIRE([$var])])
245 AT_CHECK_MACRO([BOOST_REQUIRE $var 1.1.1], [var=1.1.1; BOOST_REQUIRE([$var])])
247 AT_BANNER([Boost header-only libraries])
249 AT_CHECK_MACRO([BOOST_CONVERSION])
250 AT_CHECK_MACRO([BOOST_FOREACH])
251 AT_CHECK_MACRO([BOOST_FORMAT])
252 AT_CHECK_MACRO([BOOST_UTILITY])
253 AT_CHECK_MACRO([BOOST_VARIANT])
255 AT_BANNER([Boost libraries])
257 AT_CHECK_MACRO_CROSS([BOOST_FILESYSTEM])
258 AT_CHECK_MACRO([BOOST_GRAPH])
259 AT_CHECK_MACRO([BOOST_THREADS])