~ubuntu-branches/ubuntu/vivid/ekiga/vivid-proposed

« back to all changes in this revision

Viewing changes to m4/ax_boost_base.m4

  • Committer: Bazaar Package Importer
  • Author(s): Kilian Krause
  • Date: 2011-07-17 00:24:50 UTC
  • mfrom: (5.1.5 upstream) (7.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110717002450-ytg3wsrc1ptd3153
Tags: 3.3.1-1
* New upstream release.
 - Required libpt-dev 2.10 and libopal-dev 3.10
* Fix debian/watch to catch new version
* Remove libnotify0.7.patch - included upstream
* Add libboost-dev and libboost-signals-dev to Build-Depends
* debian/rules: Don't install *.la files for new internal shared libs
* Fix Vcs URIs to point to correct desktop/experimental/ekiga tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ===========================================================================
 
2
#       http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
 
3
# ===========================================================================
 
4
#
 
5
# SYNOPSIS
 
6
#
 
7
#   AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
8
#
 
9
# DESCRIPTION
 
10
#
 
11
#   Test for the Boost C++ libraries of a particular version (or newer)
 
12
#
 
13
#   If no path to the installed boost library is given the macro searchs
 
14
#   under /usr, /usr/local, /opt and /opt/local and evaluates the
 
15
#   $BOOST_ROOT environment variable. Further documentation is available at
 
16
#   <http://randspringer.de/boost/index.html>.
 
17
#
 
18
#   This macro calls:
 
19
#
 
20
#     AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
 
21
#
 
22
#   And sets:
 
23
#
 
24
#     HAVE_BOOST
 
25
#
 
26
# LICENSE
 
27
#
 
28
#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
 
29
#   Copyright (c) 2009 Peter Adolphs
 
30
#
 
31
#   Copying and distribution of this file, with or without modification, are
 
32
#   permitted in any medium without royalty provided the copyright notice
 
33
#   and this notice are preserved. This file is offered as-is, without any
 
34
#   warranty.
 
35
 
 
36
#serial 18
 
37
 
 
38
AC_DEFUN([AX_BOOST_BASE],
 
39
[
 
40
AC_ARG_WITH([boost],
 
41
  [AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
 
42
    [use Boost library from a standard location (ARG=yes),
 
43
     from the specified location (ARG=<path>),
 
44
     or disable it (ARG=no)
 
45
     @<:@ARG=yes@:>@ ])],
 
46
    [
 
47
    if test "$withval" = "no"; then
 
48
        want_boost="no"
 
49
    elif test "$withval" = "yes"; then
 
50
        want_boost="yes"
 
51
        ac_boost_path=""
 
52
    else
 
53
        want_boost="yes"
 
54
        ac_boost_path="$withval"
 
55
    fi
 
56
    ],
 
57
    [want_boost="yes"])
 
58
 
 
59
 
 
60
AC_ARG_WITH([boost-libdir],
 
61
        AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
 
62
        [Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
 
63
        [
 
64
        if test -d "$withval"
 
65
        then
 
66
                ac_boost_lib_path="$withval"
 
67
        else
 
68
                AC_MSG_ERROR(--with-boost-libdir expected directory name)
 
69
        fi
 
70
        ],
 
71
        [ac_boost_lib_path=""]
 
72
)
 
73
 
 
74
if test "x$want_boost" = "xyes"; then
 
75
    boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
 
76
    boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
 
77
    boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
 
78
    boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
 
79
    boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
 
80
    if test "x$boost_lib_version_req_sub_minor" = "x" ; then
 
81
        boost_lib_version_req_sub_minor="0"
 
82
        fi
 
83
    WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
 
84
    AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
 
85
    succeeded=no
 
86
 
 
87
    dnl On x86_64 systems check for system libraries in both lib64 and lib.
 
88
    dnl The former is specified by FHS, but e.g. Debian does not adhere to
 
89
    dnl this (as it rises problems for generic multi-arch support).
 
90
    dnl The last entry in the list is chosen by default when no libraries
 
91
    dnl are found, e.g. when only header-only libraries are installed!
 
92
    libsubdirs="lib"
 
93
    if test `uname -m` = x86_64; then
 
94
        libsubdirs="lib64 lib lib64"
 
95
    fi
 
96
 
 
97
    dnl first we check the system location for boost libraries
 
98
    dnl this location ist chosen if boost libraries are installed with the --layout=system option
 
99
    dnl or if you install boost with RPM
 
100
    if test "$ac_boost_path" != ""; then
 
101
        BOOST_CPPFLAGS="-I$ac_boost_path/include"
 
102
        for ac_boost_path_tmp in $libsubdirs; do
 
103
                if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
 
104
                        BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
 
105
                        break
 
106
                fi
 
107
        done
 
108
    elif test "$cross_compiling" != yes; then
 
109
        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
 
110
            if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
 
111
                for libsubdir in $libsubdirs ; do
 
112
                    if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
 
113
                done
 
114
                BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
 
115
                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
 
116
                break;
 
117
            fi
 
118
        done
 
119
    fi
 
120
 
 
121
    dnl overwrite ld flags if we have required special directory with
 
122
    dnl --with-boost-libdir parameter
 
123
    if test "$ac_boost_lib_path" != ""; then
 
124
       BOOST_LDFLAGS="-L$ac_boost_lib_path"
 
125
    fi
 
126
 
 
127
    CPPFLAGS_SAVED="$CPPFLAGS"
 
128
    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
 
129
    export CPPFLAGS
 
130
 
 
131
    LDFLAGS_SAVED="$LDFLAGS"
 
132
    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
 
133
    export LDFLAGS
 
134
 
 
135
    AC_REQUIRE([AC_PROG_CXX])
 
136
    AC_LANG_PUSH(C++)
 
137
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 
138
    @%:@include <boost/version.hpp>
 
139
    ]], [[
 
140
    #if BOOST_VERSION >= $WANT_BOOST_VERSION
 
141
    // Everything is okay
 
142
    #else
 
143
    #  error Boost version is too old
 
144
    #endif
 
145
    ]])],[
 
146
        AC_MSG_RESULT(yes)
 
147
    succeeded=yes
 
148
    found_system=yes
 
149
        ],[
 
150
        ])
 
151
    AC_LANG_POP([C++])
 
152
 
 
153
 
 
154
 
 
155
    dnl if we found no boost with system layout we search for boost libraries
 
156
    dnl built and installed without the --layout=system option or for a staged(not installed) version
 
157
    if test "x$succeeded" != "xyes"; then
 
158
        _version=0
 
159
        if test "$ac_boost_path" != ""; then
 
160
            if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
 
161
                for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
 
162
                    _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
 
163
                    V_CHECK=`expr $_version_tmp \> $_version`
 
164
                    if test "$V_CHECK" = "1" ; then
 
165
                        _version=$_version_tmp
 
166
                    fi
 
167
                    VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
 
168
                    BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
 
169
                done
 
170
            fi
 
171
        else
 
172
            if test "$cross_compiling" != yes; then
 
173
                for ac_boost_path in /usr /usr/local /opt /opt/local ; do
 
174
                    if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
 
175
                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
 
176
                            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
 
177
                            V_CHECK=`expr $_version_tmp \> $_version`
 
178
                            if test "$V_CHECK" = "1" ; then
 
179
                                _version=$_version_tmp
 
180
                                best_path=$ac_boost_path
 
181
                            fi
 
182
                        done
 
183
                    fi
 
184
                done
 
185
 
 
186
                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
 
187
                BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
 
188
                if test "$ac_boost_lib_path" = ""; then
 
189
                    for libsubdir in $libsubdirs ; do
 
190
                        if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
 
191
                    done
 
192
                    BOOST_LDFLAGS="-L$best_path/$libsubdir"
 
193
                fi
 
194
            fi
 
195
 
 
196
            if test "x$BOOST_ROOT" != "x"; then
 
197
                for libsubdir in $libsubdirs ; do
 
198
                    if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
 
199
                done
 
200
                if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
 
201
                    version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
 
202
                    stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
 
203
                        stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
 
204
                    V_CHECK=`expr $stage_version_shorten \>\= $_version`
 
205
                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
 
206
                        AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
 
207
                        BOOST_CPPFLAGS="-I$BOOST_ROOT"
 
208
                        BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
 
209
                    fi
 
210
                fi
 
211
            fi
 
212
        fi
 
213
 
 
214
        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
 
215
        export CPPFLAGS
 
216
        LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
 
217
        export LDFLAGS
 
218
 
 
219
        AC_LANG_PUSH(C++)
 
220
            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 
221
        @%:@include <boost/version.hpp>
 
222
        ]], [[
 
223
        #if BOOST_VERSION >= $WANT_BOOST_VERSION
 
224
        // Everything is okay
 
225
        #else
 
226
        #  error Boost version is too old
 
227
        #endif
 
228
        ]])],[
 
229
            AC_MSG_RESULT(yes)
 
230
        succeeded=yes
 
231
        found_system=yes
 
232
            ],[
 
233
            ])
 
234
        AC_LANG_POP([C++])
 
235
    fi
 
236
 
 
237
    if test "$succeeded" != "yes" ; then
 
238
        if test "$_version" = "0" ; then
 
239
            AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
 
240
        else
 
241
            AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
 
242
        fi
 
243
        # execute ACTION-IF-NOT-FOUND (if present):
 
244
        ifelse([$3], , :, [$3])
 
245
    else
 
246
        AC_SUBST(BOOST_CPPFLAGS)
 
247
        AC_SUBST(BOOST_LDFLAGS)
 
248
        AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
 
249
        # execute ACTION-IF-FOUND (if present):
 
250
        ifelse([$2], , :, [$2])
 
251
    fi
 
252
 
 
253
    CPPFLAGS="$CPPFLAGS_SAVED"
 
254
    LDFLAGS="$LDFLAGS_SAVED"
 
255
fi
 
256
 
 
257
])