fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / m4 / ax_boost_date_time.m4
blobec9c0445a2f0c84a85392876f12cea4f17c4043f
1 # ===========================================================================
2 #    http://www.gnu.org/software/autoconf-archive/ax_boost_date_time.html
3 # ===========================================================================
5 # SYNOPSIS
7 #   AX_BOOST_DATE_TIME
9 # DESCRIPTION
11 #   Test for Date_Time library from the Boost C++ libraries. The macro
12 #   requires a preceding call to AX_BOOST_BASE. Further documentation is
13 #   available at <http://randspringer.de/boost/index.html>.
15 #   This macro calls:
17 #     AC_SUBST(BOOST_DATE_TIME_LIB)
19 #   And sets:
21 #     HAVE_BOOST_DATE_TIME
23 # LICENSE
25 #   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
26 #   Copyright (c) 2008 Michael Tindal
28 #   Copying and distribution of this file, with or without modification, are
29 #   permitted in any medium without royalty provided the copyright notice
30 #   and this notice are preserved. This file is offered as-is, without any
31 #   warranty.
33 #serial 21
35 AC_DEFUN([AX_BOOST_DATE_TIME],
37         AC_ARG_WITH([boost-date-time],
38         AS_HELP_STRING([--with-boost-date-time@<:@=special-lib@:>@],
39                    [use the Date_Time library from boost - it is possible to specify a certain library for the linker
40                         e.g. --with-boost-date-time=boost_date_time-gcc-mt-d-1_33_1 ]),
41         [
42         if test "$withval" = "no"; then
43                         want_boost="no"
44         elif test "$withval" = "yes"; then
45             want_boost="yes"
46             ax_boost_user_date_time_lib=""
47         else
48                     want_boost="yes"
49                 ax_boost_user_date_time_lib="$withval"
50                 fi
51         ],
52         [want_boost="yes"]
53         )
55         if test "x$want_boost" = "xyes"; then
56         AC_REQUIRE([AC_PROG_CC])
57                 CPPFLAGS_SAVED="$CPPFLAGS"
58                 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
59                 export CPPFLAGS
61                 LDFLAGS_SAVED="$LDFLAGS"
62                 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
63                 export LDFLAGS
65         AC_CACHE_CHECK(whether the Boost::Date_Time library is available,
66                                            ax_cv_boost_date_time,
67         [AC_LANG_PUSH([C++])
68                  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/date_time/gregorian/gregorian_types.hpp>]],
69                                    [[using namespace boost::gregorian; date d(2002,Jan,10);
70                                      return 0;
71                                    ]])],
72          ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no)
73          AC_LANG_POP([C++])
74                 ])
75                 if test "x$ax_cv_boost_date_time" = "xyes"; then
76                         AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::Date_Time library is available])
77             BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
78             if test "x$ax_boost_user_date_time_lib" = "x"; then
79                 for libextension in `ls $BOOSTLIBDIR/libboost_date_time*.so* $BOOSTLIBDIR/libboost_date_time*.dylib* $BOOSTLIBDIR/libboost_date_time*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_date_time.*\)\.so.*$;\1;' -e 's;^lib\(boost_date_time.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_date_time.*\)\.a*$;\1;'` ; do
80                      ax_lib=${libextension}
81                                     AC_CHECK_LIB($ax_lib, exit,
82                                  [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
83                                  [link_date_time="no"])
84                                 done
85                 if test "x$link_date_time" != "xyes"; then
86                 for libextension in `ls $BOOSTLIBDIR/boost_date_time*.dll* $BOOSTLIBDIR/boost_date_time*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_date_time.*\)\.dll.*$;\1;' -e 's;^\(boost_date_time.*\)\.a.*$;\1;'` ; do
87                      ax_lib=${libextension}
88                                     AC_CHECK_LIB($ax_lib, exit,
89                                  [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
90                                  [link_date_time="no"])
91                                 done
92                 fi
94             else
95                for ax_lib in $ax_boost_user_date_time_lib boost_date_time-$ax_boost_user_date_time_lib; do
96                                       AC_CHECK_LIB($ax_lib, main,
97                                    [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
98                                    [link_date_time="no"])
99                   done
101             fi
102             if test "x$ax_lib" = "x"; then
103                 AC_MSG_ERROR(Could not find a version of the library!)
104             fi
105                         if test "x$link_date_time" != "xyes"; then
106                                 AC_MSG_ERROR(Could not link against $ax_lib !)
107                         fi
108                 fi
110                 CPPFLAGS="$CPPFLAGS_SAVED"
111         LDFLAGS="$LDFLAGS_SAVED"
112         fi