[evolution-data-server] build: Support (and prefer) libboost_thread-mt



commit 2ea57b8c42be6a2a7243a1045d2237588f45031d
Author: Mathias Hasselmann <mathias openismus com>
Date:   Tue Feb 26 16:06:56 2013 +0100

    build: Support (and prefer) libboost_thread-mt
    
    Google's libphonenumber uses the Boost Thread library but somehow fails
    to let its shared library express that dependency. Therefore we must
    manually link that library. Now Fedora only installs libboost_thread-mt,
    but not libboost_thread. This patch checks for both build variants of
    the threads library and prefers libboost_thread-mt.
    
    The change in preference is because it doesn't make much sense to use
    a thread support library that isn't thread-safe, does it?
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694749

 m4/evo_phonenumber.m4 |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/m4/evo_phonenumber.m4 b/m4/evo_phonenumber.m4
index 357b6af..0cc493f 100644
--- a/m4/evo_phonenumber.m4
+++ b/m4/evo_phonenumber.m4
@@ -47,7 +47,7 @@ AC_DEFUN([EVO_PHONENUMBER_SUPPORT],[
        AS_VAR_IF([with_phonenumber], [no],, [
                AC_LANG_PUSH(C++)
 
-               PHONENUMBER_LIBS="-lphonenumber -lboost_thread"
+               PHONENUMBER_LIBS="-lphonenumber"
 
                AS_VAR_IF([evo_phonenumber_prefix],,,[
                        PHONENUMBER_INCLUDES="-I$evo_phonenumber_prefix/include"
@@ -58,18 +58,28 @@ AC_DEFUN([EVO_PHONENUMBER_SUPPORT],[
                CXXFLAGS="$CXXFLAGS $PHONENUMBER_INCLUDES"
 
                evo_libs_saved="$LIBS"
-               LIBS="$LIBS $PHONENUMBER_LIBS"
+               evo_libphonenumber_usable=no
 
                AC_MSG_CHECKING([if libphonenumber is usable])
-               AC_LINK_IFELSE(
-                       [AC_LANG_PROGRAM(
-                               [[#include <phonenumbers/phonenumberutil.h>]],
-                               [[i18n::phonenumbers::PhoneNumberUtil::GetInstance();]])],
-                       [with_phonenumber=yes],
-                       [AS_VAR_IF([with_phonenumber], [check], [with_phonenumber=no], [
-                               AC_MSG_ERROR([libphonenumber cannot be used. Use --with-phonenumber to 
specify the library prefix.])])
-                       ])
 
+               for lib in boost_thread-mt boost_thread; do
+                       LIBS="$evo_libs_saved $PHONENUMBER_LIBS -l$lib"
+
+                       AC_LINK_IFELSE(
+                               [AC_LANG_PROGRAM(
+                                       [[#include <phonenumbers/phonenumberutil.h>]],
+                                       [[i18n::phonenumbers::PhoneNumberUtil::GetInstance();]])],
+                               [with_phonenumber=yes
+                                evo_libphonenumber_usable=yes
+                                PHONENUMBER_LIBS="$PHONENUMBER_LIBS -l$lib"
+                                break])
+               done
+
+               AS_VAR_IF([evo_libphonenumber_usable], [no],
+                       [AS_VAR_IF(
+                               [with_phonenumber], [check], [with_phonenumber=no],
+                               [AC_MSG_ERROR([libphonenumber cannot be used. Use --with-phonenumber to 
specify the library prefix.])])
+                       ])
 
                AS_VAR_IF([evo_phonenumber_prefix],,
                          [msg_phonenumber=$with_phonenumber],


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]