Below is a patch that adds pkg-config support to configure for locating protobuf in unusual places (like /usr/local/lib/sparcv9/ of solaris 64 bit)
It attempts to use the old code to detect protobuf and just falls back to pkg-config if AC_LINK_IFELSE fails.
Note: this doesn't mean that the enforcer-ng branch builds on solaris 64 yet.
run configure like this:
PKG_CONFIG_PATH=/usr/local/lib/sparcv9/pkgconfig/ ../configure ...
Index: m4/acx_protobuf.m4
===================================================================
— m4/acx_protobuf.m4 (revision 7073)
+++ m4/acx_protobuf.m4 (working copy)
@@ -33,13 +33,20 @@
DoNothing();])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
- AC_MSG_ERROR([Missing the protobuf library])]
+ AC_MSG_NOTICE([Missing the protobuf library when using --with-protobuf])
+ AC_MSG_NOTICE([Trying again with pkg-config])
+ PKG_CHECK_MODULES([PROTOBUF],[protobuf >= $1.$2.$3],[PROTOBUF_INCLUDES=`pkg-config --cflags-only-I protobuf` PROTOBUF_LIBS=`pkg-config --libs protobuf`])
+ CPPFLAGS="$CPPFLAGS $PROTOBUF_INCLUDES"
+ LIBS="$LIBS $PROTOBUF_LIBS"
+ AC_MSG_RESULT([PROTOBUF_INCLUDES=$PROTOBUF_INCLUDES PROTOBUF_LIBS=$PROTOBUF_LIBS])
+ ]
)
LIBS=$tmp_LIBS
- AC_MSG_CHECKING([for protobuf version])
- CHECK_PROTOBUF_VERSION=m4_eval($1 * 1000000 + $2 * 1000 + $3)
- AC_RUN_IFELSE([
+ if test -z "$PROTOBUF_CFLAGS" ; then
+ AC_MSG_CHECKING([for protobuf version])
+ CHECK_PROTOBUF_VERSION=m4_eval($1 * 1000000 + $2 * 1000 + $3)
+ AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include <google/protobuf/stubs/common.h>
int main()
@@ -53,17 +60,19 @@
return 1;
}
]]) - ],[
+ ],[
AC_MSG_RESULT([>= $1.$2.$3]) - ],[
+ ],[
AC_MSG_RESULT([< $1.$2.$3])
AC_MSG_ERROR([protobuf library too old ($1.$2.$3 or later required)]) - ],[])
+ ],[])
- AC_LANG_POP([C++])
-
+ AC_LANG_POP([C++])
+ fi
CPPFLAGS=$tmp_CPPFLAGS
-
+ if test -n "$PROTOBUF_CFLAGS" ; then
+ PATH=$PATH:`pkg-config --variable=prefix protobuf`/bin
+ fi
AC_PATH_PROG(PROTOC, protoc)
if test -z "$PROTOC"; then
AC_MSG_ERROR([protoc not found])