root / config / ax_boost_thread.m4 @ 41c94e0a
History | View | Annotate | Download (2 kB)
| 1 | # |
|---|---|
| 2 | # SYNOPSIS |
| 3 | # |
| 4 | # AX_BOOST_THREAD |
| 5 | # |
| 6 | # DESCRIPTION |
| 7 | # |
| 8 | # Test for Thread library from the Boost C++ libraries. |
| 9 | # |
| 10 | # This macro calls: |
| 11 | # |
| 12 | # AC_SUBST(BOOST_THREAD_LIB) |
| 13 | # AC_SUBST(BOOST_CXXFLAGS) |
| 14 | # |
| 15 | # And sets: |
| 16 | # |
| 17 | # HAVE_BOOST_THREAD |
| 18 | # |
| 19 | # COPYLEFT |
| 20 | # |
| 21 | # Copyright (c) 2008 Thomas Porschberg <[email protected]> |
| 22 | # Copyright (c) 2008 Michael Tindal |
| 23 | # Copyright (c) 2008 Free Software Foundation, Inc. |
| 24 | # |
| 25 | # Copying and distribution of this file, with or without modification, are |
| 26 | # permitted in any medium without royalty provided the copyright notice |
| 27 | # and this notice are preserved. |
| 28 | |
| 29 | |
| 30 | AC_DEFUN([AX_BOOST_THREAD], |
| 31 | [ |
| 32 | AC_REQUIRE([AX_BOOST_BASE]) |
| 33 | AC_REQUIRE([ACX_PTHREAD]) |
| 34 | _AX_BOOST_WITH([boost_thread]) |
| 35 | |
| 36 | if test "$want_boost" = "yes"; then |
| 37 | AC_REQUIRE([AC_PROG_CC]) |
| 38 | AC_REQUIRE([AC_PROG_CXX]) |
| 39 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 40 | |
| 41 | CPPFLAGS_SAVED="$CPPFLAGS" |
| 42 | LDFLAGS_SAVED="$LDFLAGS" |
| 43 | CXXFLAGS_SAVED="$CXXFLAGS" |
| 44 | |
| 45 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" |
| 46 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS $PTHREAD_LIBS" |
| 47 | CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" |
| 48 | |
| 49 | AC_CACHE_CHECK([whether the boost::thread includes are available], |
| 50 | [ax_cv_boost_thread], |
| 51 | [AC_LANG_PUSH([C++]) |
| 52 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]], |
| 53 | [[boost::thread_group thrds; |
| 54 | return 0;]])], |
| 55 | [ax_cv_boost_thread=yes], [ax_cv_boost_thread=no]) |
| 56 | AC_LANG_POP([C++]) |
| 57 | ]) |
| 58 | |
| 59 | if test "$ax_cv_boost_thread" = "yes"; then |
| 60 | BOOST_CXXFLAGS="$PTHREAD_CFLAGS" |
| 61 | AC_SUBST([BOOST_CXXFLAGS]) |
| 62 | _AX_BOOST_CHECK_LIB([boost_thread]) |
| 63 | if test "$link_ok" = "yes" && test -n "$PTHREAD_LIBS"; then |
| 64 | BOOST_THREAD_LIB="$BOOST_THREAD_LIB $PTHREAD_LIBS" |
| 65 | fi |
| 66 | fi |
| 67 | |
| 68 | CPPFLAGS="$CPPFLAGS_SAVED" |
| 69 | LDFLAGS="$LDFLAGS_SAVED" |
| 70 | CXXFLAGS="$CXXFLAGS_SAVED" |
| 71 | fi |
| 72 | ]) |