tdf#62032 use style list level when changing style
[LibreOffice.git] / m4 / ax_boost_locale.m4
blobadaedf09ee3001c3c55123df037ea46826c11de2
1 # ===========================================================================
2 #     https://www.gnu.org/software/autoconf-archive/ax_boost_locale.html
3 # ===========================================================================
5 # SYNOPSIS
7 #   AX_BOOST_LOCALE
9 # DESCRIPTION
11 #   Test for System library from the Boost C++ libraries. The macro requires
12 #   a preceding call to AX_BOOST_BASE. Further documentation is available at
13 #   <http://randspringer.de/boost/index.html>.
15 #   This macro calls:
17 #     AC_SUBST(BOOST_LOCALE_LIB)
19 #   And sets:
21 #     HAVE_BOOST_LOCALE
23 # LICENSE
25 #   Copyright (c) 2012 Xiyue Deng <manphiz@gmail.com>
27 #   Copying and distribution of this file, with or without modification, are
28 #   permitted in any medium without royalty provided the copyright notice
29 #   and this notice are preserved. This file is offered as-is, without any
30 #   warranty.
32 #serial 2
34 AC_DEFUN([AX_BOOST_LOCALE],
36         AC_ARG_WITH([boost-locale],
37         AS_HELP_STRING([--with-boost-locale@<:@=special-lib@:>@],
38                    [use the Locale library from boost - it is possible to specify a certain library for the linker
39                         e.g. --with-boost-locale=boost_locale-gcc-mt ]),
40         [
41         if test "$withval" = "no"; then
42                         want_boost="no"
43         elif test "$withval" = "yes"; then
44             want_boost="yes"
45             ax_boost_user_locale_lib=""
46         else
47                     want_boost="yes"
48                 ax_boost_user_locale_lib="$withval"
49                 fi
50         ],
51         [want_boost="yes"]
52         )
54         if test "x$want_boost" = "xyes"; then
55         AC_REQUIRE([AC_PROG_CC])
56         AC_REQUIRE([AC_CANONICAL_BUILD])
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::Locale library is available,
66                                            ax_cv_boost_locale,
67         [AC_LANG_PUSH([C++])
68                          CXXFLAGS_SAVE=$CXXFLAGS
70                          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/locale.hpp>]],
71                                    [[boost::locale::generator gen;
72                                    std::locale::global(gen(""));]])],
73                    ax_cv_boost_locale=yes, ax_cv_boost_locale=no)
74                          CXXFLAGS=$CXXFLAGS_SAVE
75              AC_LANG_POP([C++])
76                 ])
77                 if test "x$ax_cv_boost_locale" = "xyes"; then
78                         AC_SUBST(BOOST_CPPFLAGS)
80                         AC_DEFINE(HAVE_BOOST_LOCALE,,[define if the Boost::Locale library is available])
81             BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
83                         LDFLAGS_SAVE=$LDFLAGS
84             if test "x$ax_boost_user_locale_lib" = "x"; then
85                 for libextension in `ls $BOOSTLIBDIR/libboost_locale*.so* $BOOSTLIBDIR/libboost_locale*.dylib* $BOOSTLIBDIR/libboost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_locale.*\)\.so.*$;\1;' -e 's;^lib\(boost_locale.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_locale.*\)\.a.*$;\1;'` ; do
86                      ax_lib=${libextension}
87                                     AC_CHECK_LIB($ax_lib, exit,
88                                  [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
89                                  [link_locale="no"])
90                                 done
91                 if test "x$link_locale" != "xyes"; then
92                 for libextension in `ls $BOOSTLIBDIR/boost_locale*.dll* $BOOSTLIBDIR/boost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_locale.*\)\.dll.*$;\1;' -e 's;^\(boost_locale.*\)\.a.*$;\1;'` ; do
93                      ax_lib=${libextension}
94                                     AC_CHECK_LIB($ax_lib, exit,
95                                  [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
96                                  [link_locale="no"])
97                                 done
98                 fi
100             else
101                for ax_lib in $ax_boost_user_locale_lib boost_locale-$ax_boost_user_locale_lib; do
102                                       AC_CHECK_LIB($ax_lib, exit,
103                                    [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
104                                    [link_locale="no"])
105                   done
107             fi
108             if test "x$ax_lib" = "x"; then
109                 AC_MSG_ERROR(Could not find a version of the library!)
110             fi
111                         if test "x$link_locale" = "xno"; then
112                                 AC_MSG_ERROR(Could not link against $ax_lib !)
113                         fi
114                 fi
116                 CPPFLAGS="$CPPFLAGS_SAVED"
117         LDFLAGS="$LDFLAGS_SAVED"
118         fi