configure.ac: search the pkg-config exec_prefix for the protobuf compiler

protoc may not be on the default PATH, so augment $PATH with the
executable path registered by pkg-config for the protobuf package.

additionally declare PROTOC as a precious variable, thus allowing it to
be explicitly set by the user at ./configure time.

based on a patch from Andrei Nigmatulin.
This commit is contained in:
Robert Edmonds 2014-03-28 13:23:37 -04:00
parent e633dda6e4
commit e1e044da01

View File

@ -47,7 +47,9 @@ if test "x$enable_protoc" != "xno"; then
[AC_MSG_ERROR([required protobuf header file not found])]) [AC_MSG_ERROR([required protobuf header file not found])])
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
AC_PATH_PROG(PROTOC, protoc) AC_ARG_VAR([PROTOC], [protobuf compiler command])
AC_PATH_PROG([PROTOC], [protoc], [],
[`$PKG_CONFIG --variable=exec_prefix protobuf`/bin:$PATH])
if test -z "$PROTOC"; then if test -z "$PROTOC"; then
AC_MSG_ERROR([Please install the protobuf compiler from https://code.google.com/p/protobuf/.]) AC_MSG_ERROR([Please install the protobuf compiler from https://code.google.com/p/protobuf/.])
fi fi