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



commit 05edf956ec151c9a3606b4fab564d0794aa65f82
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 Boost.Thread but somehow fails to let their
    shared library to express that dependency. Therefore we must manually
    link with Boost.Thread. Now Fedora only installs libboost_thread-mt, but
    not libboost_thread. This patch checks for both build variants of the
    library and prefers libboost_thread-mt. The change in preference is
    because it doesn't make much sense to use a Boost.Thread variant that
    isn't thread-safe, does it?

 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 8aa2db0..71cb2b9 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]