Fixed Mesos protobuf library detection.

Review: https://reviews.apache.org/r/39775


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/73cd7958
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/73cd7958
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/73cd7958

Branch: refs/heads/master
Commit: 73cd79584ae6378b42e46777bcec9bcb889b51e2
Parents: 6dbc99a
Author: James Peach <[email protected]>
Authored: Thu Nov 5 23:25:50 2015 +0100
Committer: Till Toenshoff <[email protected]>
Committed: Thu Nov 5 23:25:50 2015 +0100

----------------------------------------------------------------------
 configure.ac | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/73cd7958/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 6567664..8b28ac7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1419,12 +1419,21 @@ if test "x$without_bundled_protobuf" = "xyes" || \
   fi
 
   # Check for protobuf.
-  # TODO(jieyu): Symbol _init is not available for libs on OS X.
-  # Consider checking lib using AX_CXX_CHECK_LIB.
-  AC_CHECK_HEADERS([google/protobuf/message.h],
-                   [AC_CHECK_LIB([protobuf],
-                                 [_init],
-                                 [found_protobuf=yes])])
+
+  AC_CHECK_HEADERS([google/protobuf/message.h], [found_protobuf=yes],
+                   [found_protobuf=no])
+
+  if test "x$found_protobuf" = "xyes"; then
+    saved_LIBS="$LIBS"
+    LIBS="-lprotobuf $LIBS"
+    AC_LANG_PUSH([C++])
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include 
<google/protobuf/stubs/common.h>],
+                    [ google::protobuf::ShutdownProtobufLibrary(); ])],
+            [ found_protobuf=yes ],
+            [ found_protobuf=no ])
+    AC_LANG_POP()
+    LIBS="$saved_LIBS"
+  fi
 
   if test "x$found_protobuf" = "xyes"; then
     with_bundled_protobuf=no

Reply via email to