Fixed boost test compilation with 1.34.1

This commit is contained in:
Pauli Nieminen 2008-01-13 19:22:09 +00:00
parent 4388ef8cfa
commit 22ab47d3ee
4 changed files with 91 additions and 13 deletions

View file

@ -1,6 +1,9 @@
Version 1.3.14+svn:
* language and i18n:
* updated translations: Dutch, Spanish
* miscellaneous and bug fixes:
* Fixed :control comamnd to work
* Fixed boost test compile with 1.34.1
Version 1.3.14:
* campaigns:

View file

@ -76,10 +76,20 @@ else
CXXFLAGS="-O2 -W -Wall -ansi $CXXFLAGS"
fi
# Make tests default in svn version
svn_in_version=`expr match "$WESNOTH_VERSION" '.*svn'`
test_build=yes
if test $svn_in_version == 0
then
#disabling building tests for release version
test_build=no
fi
AC_ARG_ENABLE([tests],
AS_HELP_STRING([--enable-tests], [build unit tests]),
AS_HELP_STRING([--enable-tests], [build unit tests]),
[tests=$enableval],
[tests=no])
[tests=$test_build])
AC_ARG_ENABLE([static],
AS_HELP_STRING([--enable-static], [enable static building of wesnoth]),
@ -885,14 +895,62 @@ CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
LDFLAGS="$BOOST_IOSTREAMS_LDFLAGS $LDFLAGS"
LIBS="$BOOST_IOSTREAMS_LIBS $LIBS"
if test "x$tests" = "xyes"; then
if test "x$tests" = "xyes"; then
BOOST_TEST
LDFLAGS="$BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS $LDFLAGS"
LIBS="$BOOST_UNIT_TEST_FRAMEWORK_LIBS $LIBS"
AC_LANG([C++])
AC_MSG_CHECKING([for dynamic linked boost test])
OLD_CPPFLAGS=$CPPFLAGS
OLD_CFLAGS=$CFLAGS
OLD_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
CFLAGS="$CFLAGS $BOOST_CPPFLAGS"
LIBS="$LIBS $BOOST_UNIT_TEST_FRAMEWORK_LIBS"
ac_link="$LDPREFIX $ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
])],
[AC_MSG_RESULT(yes)]
[boost_test_dyn_link=yes],
[AC_MSG_RESULT(no)]
[boost_test_dyn_link=no])
AC_MSG_CHECKING([for boost auto test not in core])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
])],
[AC_MSG_RESULT(yes)]
[boost_auto_test=yes],
[AC_MSG_RESULT(no)]
[boost_auto_test=no])
CPPFLAGS=$OLD_CPPFLAGS
CFLAGS=$OLD_CFLAGS
LIBS=$OLD_LIBS
fi
m4_pattern_allow([^BOOST_TEST_DYN_LINK$])
m4_pattern_allow([^BOOST_AUTO_TEST$])
AM_CONDITIONAL([BOOST_TEST_DYN_LINK], [test x"$boost_test_dyn_link" = xyes])
AM_CONDITIONAL([BOOST_AUTO_TEST], [test x"$boost_auto_test" = xyes])
#######################################################################
# Tune gettext stuff for our needs #
#######################################################################

View file

@ -44,11 +44,7 @@ pkgdatadir=$(datadir)/@DATADIR@
THELIBS = -L. -lwesnoth-core $(SDL_IMAGE_LIBS) $(SDL_MIXER_LIBS) $(SDL_NET_LIBS) \
$(SDL_TTF_LIBS) $(SDL_LIBS) $(PYTHON_LIBS) $(FREETYPE_LIBS) $(LIBINTL)
#############################################################################
# Wesnoth #
#############################################################################
wesnoth_SOURCES = \
wesnoth_source = \
about.cpp \
actions.cpp \
ai.cpp \
@ -62,7 +58,6 @@ wesnoth_SOURCES = \
config_adapter.cpp \
dialogs.cpp \
floating_textbox.cpp \
game.cpp \
game_display.cpp \
game_events.cpp \
game_preferences.cpp \
@ -112,6 +107,14 @@ wesnoth_SOURCES = \
widgets/combo.cpp \
widgets/scrollpane.cpp
#############################################################################
# Wesnoth #
#############################################################################
wesnoth_SOURCES = \
$(wesnoth_source) \
game.cpp
wesnoth_LDADD = $(THELIBS) libwesnoth.a
wesnoth_DEPENDENCIES=libwesnoth-core.a libwesnoth.a
@ -199,11 +202,12 @@ cutter_DEPENDENCIES=libwesnoth-core.a
#############################################################################
test_SOURCES = \
$(wesnoth_source) \
tests/main.cpp \
tests/test_util.cpp
test_LDADD = -L. -lwesnoth-core -lboost_unit_test_framework @SDL_IMAGE_LIBS@ @SDL_LIBS@ $(LIBINTL) $(PNG_LIBS)
test_DEPENDENCIES=libwesnoth-core.a
test_LDADD = -lboost_unit_test_framework $(THELIBS) libwesnoth.a
test_DEPENDENCIES=libwesnoth-core.a libwesnoth.a
#############################################################################
# Headers
@ -472,6 +476,16 @@ if PREFSDIR
CXXFLAGS += -DPREFERENCES_DIR=\"$(prefsdir)\"
endif
if BOOST_TEST_DYN_LINK
CXXFLAGS += -DBOOST_TEST_DYN_LINK
endif
if BOOST_AUTO_TEST
CXXFLAGS += -DBOOST_AUTO_TEST_MAIN
else
CXXFLAGS += -DBOOST_TEST_MAIN
endif
CXXLD = $(LDPREFIX) $(CXX)

View file

@ -11,8 +11,11 @@
See the COPYING file for more details.
*/
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#ifdef BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#else
#include <boost/test/unit_test.hpp>
#endif
/*
* This is a main compilation unit for the test program.