From 9de6a6bf92fc90b0331b7091c051ef43ae99e748 Mon Sep 17 00:00:00 2001
From: Benoit Sigoure <tsuna@lrde.epita.fr>
Date: Mon, 7 Jan 2008 08:39:21 +0100
Subject: [PATCH] Fix the test for Boost.Test.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

	Some extra code is required to use Boost.Test which defines its own
	`main' function.
	* build-aux/boost.m4 (BOOST_FIND_LIB): Accept a 5th optional
	argument.
	(BOOST_TEST): Use it to define `init_unit_test_suite'.
	* tests/testsuite.at: Add a test for the static flavor of
	BOOST_TEST.
	* THANKS: Update.
	Problem reported by Jens Seidel.  Patch contributed by Hubert
	Figuière.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
---
Patch to apply against 59d8d8f of http://repo.or.cz/w/boost.m4.git

 ChangeLog          |   14 ++++++++++++++
 THANKS             |    1 +
 build-aux/boost.m4 |   17 ++++++++++++-----
 tests/testsuite.at |    1 +
 4 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index db5f1a4..746c666 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-01-07  Benoit Sigoure  <tsuna@lrde.epita.fr>
+
+	Fix the test for Boost.Test.
+	Some extra code is required to use Boost.Test which defines its own
+	`main' function.
+	* build-aux/boost.m4 (BOOST_FIND_LIB): Accept a 5th optional
+	argument.
+	(BOOST_TEST): Use it to define `init_unit_test_suite'.
+	* tests/testsuite.at: Add a test for the static flavor of
+	BOOST_TEST.
+	* THANKS: Update.
+	Problem reported by Jens Seidel.  Patch contributed by Hubert
+	Figuière.
+
 2008-01-06  Benoit Sigoure  <tsuna@lrde.epita.fr>
 
 	Add support for Boost.Serialization.
diff --git a/THANKS b/THANKS
index 3e2b1ee..5e98af6 100644
--- a/THANKS
+++ b/THANKS
@@ -6,4 +6,5 @@ suggesting improvements, submitting patches or proofreading the code.
 Akim Demaille
 David Herring
 Jens Seidel
+Hubert Figuière
 Staffan Gimåker
diff --git a/build-aux/boost.m4 b/build-aux/boost.m4
index 6d50cd2..086b326 100644
--- a/build-aux/boost.m4
+++ b/build-aux/boost.m4
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# serial 5
+# serial 6
 # Original sources can be found at http://repo.or.cz/w/boost.m4.git
 # You can fetch the latest version of the script by doing:
 #   wget 'http://repo.or.cz/w/boost.m4.git?a=blob_plain;f=build-aux/boost.m4;hb=HEAD' -O boost.m4
@@ -173,11 +173,14 @@ AC_LANG_POP([C++])dnl
 ])# BOOST_FIND_HEADER
 
 
-# BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST])
+# BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
+#                [CXX-PROLOGUE])
 # -------------------------------------------------------------------------
 # Look for the Boost library LIB-NAME (e.g., LIB-NAME = `thread', for
 # libboost_thread).  Check that HEADER-NAME works and check that
-# libboost_LIB-NAME can link with the code CXX-TEST.
+# libboost_LIB-NAME can link with the code CXX-TEST.  The optional argument
+# CXX-PROLOGUE can be used to include some C++ code before the `main'
+# function.
 #
 # Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above).
 #
@@ -227,7 +230,8 @@ AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib],
     AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?])
   boost_save_ac_objext=$ac_objext
   # Generate the test file.
-  AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3>], [$4])])
+  AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3>
+$5], [$4])])
 dnl Optimization hacks: compiling C++ is slow, especially with Boost.  What
 dnl we're trying to do here is guess the right combination of link flags
 dnl (LIBS / LDFLAGS) to use a given library.  This can take several
@@ -498,7 +502,10 @@ AC_DEFUN([BOOST_STRING_ALGO],
 AC_DEFUN([BOOST_TEST],
 [m4_pattern_allow([^BOOST_CHECK$])dnl
 BOOST_FIND_LIB([unit_test_framework], [$1],
-               [boost/test/unit_test.hpp], [BOOST_CHECK(2==2);])
+               [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);],
+               [using boost::unit_test::test_suite;
+               test_suite* init_unit_test_suite(int argc, char ** argv)
+               { return NULL; }])
 ])# BOOST_TEST
 
 
diff --git a/tests/testsuite.at b/tests/testsuite.at
index b3ae87e..7d776a0 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -270,6 +270,7 @@ AT_CHECK_MACRO([BOOST_SERIALIZATION], [lib])
 AT_CHECK_MACRO([BOOST_SIGNALS], [lib])
 AT_CHECK_MACRO([BOOST_REGEX], [lib])
 AT_CHECK_MACRO([BOOST_TEST], [lib])
+AT_CHECK_MACRO([BOOST_TEST (static)], [lib], [BOOST_TEST([s])])
 AT_CHECK_MACRO([BOOST_THREADS], [lib])
 AT_CHECK_MACRO([BOOST_WAVE], [lib])
 
-- 
1.5.4.rc0.88.g7d4e-dirty

