1 ##### http://autoconf-archive.cryp.to/ax_boost_date_time.html
9 # Test for Date_Time library from the Boost C++ libraries. The macro
10 # requires a preceding call to AX_BOOST_BASE. Further documentation
11 # is available at <http://randspringer.de/boost/index.html>.
15 # AC_SUBST(BOOST_DATE_TIME_LIB)
19 # HAVE_BOOST_DATE_TIME
27 # Copyright (c) 2006 Thomas Porschberg <thomas@randspringer.de>
28 # Copyright (c) 2006 Michael Tindal <mtindal@paradoxpoint.com>
30 # Copying and distribution of this file, with or without
31 # modification, are permitted in any medium without royalty provided
32 # the copyright notice and this notice are preserved.
34 AC_DEFUN([AX_BOOST_DATE_TIME],
36 AC_ARG_WITH([boost-date-time],
37 AS_HELP_STRING([--with-boost-date-time@<:@=special-lib@:>@],
38 [use the Date_Time library from boost - it is possible to specify a certain library for the linker
39 e.g. --with-boost-date-time=boost_date_time-gcc-mt-d-1_33_1 ]),
41 if test "$withval" = "no"; then
43 elif test "$withval" = "yes"; then
45 ax_boost_user_date_time_lib=""
48 ax_boost_user_date_time_lib="$withval"
54 if test "x$want_boost" = "xyes"; then
55 AC_REQUIRE([AC_PROG_CC])
56 CPPFLAGS_SAVED="$CPPFLAGS"
57 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
60 LDFLAGS_SAVED="$LDFLAGS"
61 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
64 AC_CACHE_CHECK(whether the Boost::Date_Time library is available,
65 ax_cv_boost_date_time,
67 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/date_time/gregorian/gregorian_types.hpp>]],
68 [[using namespace boost::gregorian; date d(2002,Jan,10);
71 ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no)
74 if test "x$ax_cv_boost_date_time" = "xyes"; then
75 AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::Date_Time library is available])
77 if test "x$ax_boost_user_date_time_lib" = "x"; then
78 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
79 lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
80 $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
81 AC_CHECK_LIB($ax_lib, main, [BOOST_DATE_TIME_LIB="-l$ax_lib" AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes" break],
82 [link_date_time="no"])
85 for ax_lib in $ax_boost_user_date_time_lib $BN-$ax_boost_user_date_time_lib; do
86 AC_CHECK_LIB($ax_lib, main,
87 [BOOST_DATE_TIME_LIB="-l$ax_lib" AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes" break],
88 [link_date_time="no"])
92 if test "x$link_date_time" = "xno"; then
93 AC_MSG_ERROR(Could not link against $ax_lib !)
97 CPPFLAGS="$CPPFLAGS_SAVED"
98 LDFLAGS="$LDFLAGS_SAVED"