Skip to content

Commit

Permalink
configure.ac: fix cross-compilation with protobuf-c
Browse files Browse the repository at this point in the history
Try to retrieve the version from pkg-config to avoid the following
error:

checking protobuf-c version... configure: error: in `/home/fabrice/buildroot/output/build/postgis-3.1.1':
configure: error: cannot run test program while cross compiling

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  • Loading branch information
ffontaine committed Apr 17, 2021
1 parent f6e6939 commit 8b80c4b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion configure.ac
Expand Up @@ -1004,6 +1004,7 @@ if test "$CHECK_PROTOBUF" != "no"; then
PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c >= 1.1.0], [
PROTOBUF_CPPFLAGS="$PROTOBUFC_CFLAGS";
PROTOBUF_LDFLAGS="$PROTOBUFC_LIBS";
PROTOC_VERSION=`$PKG_CONFIG libprotobuf-c --modversion | sed 's/\([[0-9]]\).*\([[0-9]]\).*\([[0-9]]\)/\100\200\3/'`
], [
AC_MSG_RESULT([libprotobuf-c not found in pkg-config])
])
Expand Down Expand Up @@ -1054,7 +1055,10 @@ if test "$CHECK_PROTOBUF" != "no"; then
[])

AC_MSG_CHECKING([protobuf-c version])
AC_PROTOBUFC_VERSION([PROTOC_VERSION])
dnl Return the protobuf-c version number if not detected by pkg-config
if test "x$PROTOC_VERSION" = "x"; then
AC_PROTOBUFC_VERSION([PROTOC_VERSION])
fi
if test ! "$PROTOC_VERSION" -ge 1001000; then
AC_MSG_ERROR("Old protobuf-c release found but 1.1.0 is required. You can disable MVT and Geobuf support using --without-protobuf")
fi
Expand Down

0 comments on commit 8b80c4b

Please sign in to comment.