Skip to content

Commit

Permalink
boost.m4: introduce Boost.Flyweight check
Browse files Browse the repository at this point in the history
* build-aux/boost.m4 (_BOOST_PTHREAD_FLAG): Documentation changes.
(BOOST_FLYWEIGHT): New.
  • Loading branch information
akimd committed Apr 7, 2014
1 parent 60bfbeb commit 28beefc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions README
Expand Up @@ -96,6 +96,7 @@ implemented:
- Bind
- Conversion
- CRC
- Flyweight (with a dependency on pthread)
- Foreach
- Format
- Function
Expand Down
41 changes: 27 additions & 14 deletions build-aux/boost.m4
Expand Up @@ -609,16 +609,27 @@ LDFLAGS=$boost_filesystem_save_LDFLAGS
])# BOOST_FILESYSTEM


# BOOST_FLYWEIGHT()
# -----------------
# Look for Boost.Flyweight.
BOOST_DEFUN([Flyweight],
[dnl There's a hidden dependency on pthreads.
AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
BOOST_FIND_HEADER([boost/flyweight.hpp])
AC_SUBST([BOOST_FLYWEIGHT_LIBS], [$boost_cv_pthread_flag])
])


# BOOST_FOREACH()
# ---------------
# Look for Boost.Foreach
# Look for Boost.Foreach.
BOOST_DEFUN([Foreach],
[BOOST_FIND_HEADER([boost/foreach.hpp])])


# BOOST_FORMAT()
# --------------
# Look for Boost.Format
# Look for Boost.Format.
# Note: we can't check for boost/format/format_fwd.hpp because the header isn't
# standalone. It can't be compiled because it triggers the following error:
# boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std'
Expand Down Expand Up @@ -922,7 +933,6 @@ BOOST_FIND_LIB([unit_test_framework], [$1],
# ---------------------------------
# Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
# FIXME: Provide an alias "BOOST_THREAD".
BOOST_DEFUN([Thread],
[dnl Having the pthread flag is required at least on GCC3 where
dnl boost/thread.hpp would complain if we try to compile without
Expand All @@ -938,11 +948,6 @@ fi # end of the Boost.System check.
m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
# boost/thread.hpp will trigger a #error if -pthread isn't used:
# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
# is not turned on. Please set the correct command line options for
# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
# When compiling for the Windows platform, the threads library is named
Expand Down Expand Up @@ -1062,8 +1067,16 @@ BOOST_DEFUN([Xpressive],

# _BOOST_PTHREAD_FLAG()
# ---------------------
# Internal helper for BOOST_THREAD. Based on ACX_PTHREAD:
# http://autoconf-archive.cryp.to/acx_pthread.html
# Internal helper for BOOST_THREAD. Computes boost_cv_pthread_flag
# which must be used in CPPFLAGS and LIBS.
#
# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
# boost/thread.hpp will trigger a #error if -pthread isn't used:
# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
# is not turned on. Please set the correct command line options for
# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
#
# Based on ACX_PTHREAD: http://autoconf-archive.cryp.to/acx_pthread.html
AC_DEFUN([_BOOST_PTHREAD_FLAG],
[AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
Expand Down Expand Up @@ -1280,11 +1293,11 @@ boost_use_source=:
test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
_AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
AS_IF([_AC_DO_STDERR($ac_link) && {
test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
test ! -s conftest.err
test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_executable_p conftest$ac_exeext
test "$cross_compiling" = yes ||
$as_executable_p conftest$ac_exeext
dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
}],
[$2],
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite.at
Expand Up @@ -305,6 +305,7 @@ AT_BANNER([Boost header-only libraries])
AT_CHECK_MACRO([BOOST_ARRAY], [header])
AT_CHECK_MACRO([BOOST_BIND], [header])
AT_CHECK_MACRO([BOOST_CONVERSION], [header])
AT_CHECK_MACRO([BOOST_FLYWEIGHT], [header])
AT_CHECK_MACRO([BOOST_FOREACH], [header])
AT_CHECK_MACRO([BOOST_FORMAT], [header])
AT_CHECK_MACRO([BOOST_FUNCTION], [header])
Expand Down

0 comments on commit 28beefc

Please sign in to comment.