Add check for pkg-config
authorSandro Santilli <strk@kbt.io>
Tue, 7 Feb 2017 21:42:32 +0000 (21:42 +0000)
committerSandro Santilli <strk@kbt.io>
Tue, 7 Feb 2017 21:42:32 +0000 (21:42 +0000)
Patch by Björn Harrtell

References #3661

git-svn-id: http://svn.osgeo.org/postgis/trunk@15307 b70326c6-7e19-0410-871a-916f4a2858ee

configure.ac

index 3bcd97bbd1b65d75e96bde951a42bc7fb9324a10..19204c97ce34918ebde358c9a10731a378feb1cd 100644 (file)
@@ -897,6 +897,15 @@ AC_SUBST([HAVE_JSON])
 fi dnl }
 
 
+dnl ===========================================================================
+dnl Detect if pkg-config installed
+dnl ===========================================================================
+# check for pkg-config
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+if test "$PKG_CONFIG" = "no"; then
+   AC_MSG_WARN([Cannot find pkg-config, make sure it is installed in your PATH])
+fi
+
 
 dnl ===========================================================================
 dnl Detect if protobuf-c installed
@@ -940,8 +949,13 @@ LIBS="$PROTOBUF_LDFLAGS"
 AC_CHECK_LIB([protobuf-c], [protobuf_c_message_check], [HAVE_PROTOBUF=yes; PROTOBUF_LDFLAGS="${PROTOBUF_LDFLAGS} -lprotobuf-c"], [HAVE_PROTOBUF=no])
 LIBS="$LIBS_SAVE"
 
-dnl Ensure libprotobuf-c is of minimum required version
-PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c >= 1.1.0], [HAVE_PROTOBUF=yes], [HAVE_PROTOBUF=no])
+if test "$PKG_CONFIG" = "no"; then
+       AC_MSG_WARN([Cannot find pkg-config, disabling protobuf support.])
+       HAVE_PROTOBUF=no
+else
+       dnl Ensure libprotobuf-c is of minimum required version
+       PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c >= 1.1.0], [HAVE_PROTOBUF=yes], [HAVE_PROTOBUF=no])
+fi
 
 if test "$HAVE_PROTOBUF" = "yes"; then
        AC_PATH_PROG(PROTOCC, protoc-c)