summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2019-07-18 11:20:05 +0300
committerPaul Emm. Katsoulakis <34388743+paulkatsoulakis@users.noreply.github.com>2019-07-18 10:20:05 +0200
commit6daa4b72d516dd2a71f3bf1b3bb19dc7406a5e55 (patch)
tree5d96f505fae9a70eb300bf80c127c4982f7c3f26 /configure.ac
parente588f9608d8e23b001c117a09a39990d001f390f (diff)
Fix the snappy library check (#6479)
* Fix the snappy library check * Fix code style * Maintain compatibility with PKG_CHECK_MODULES
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac64
1 files changed, 46 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac
index b922ad5bfe..d77a0b0734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -816,17 +816,17 @@ if test "${have_libaws_cpp_sdk_core}" = "yes" -a "${have_libcrypto}" = "yes" -a
CXXFLAGS="${CXXFLAGS} -std=c++11"
AC_TRY_LINK(
- [
- #include <aws/core/Aws.h>
- #include <aws/core/client/ClientConfiguration.h>
- #include <aws/core/auth/AWSCredentials.h>
- #include <aws/core/utils/Outcome.h>
- #include <aws/kinesis/KinesisClient.h>
- #include <aws/kinesis/model/PutRecordRequest.h>
- ],
- [Aws::Kinesis::Model::PutRecordRequest request;],
- [have_libaws_cpp_sdk_kinesis=yes],
- [have_libaws_cpp_sdk_kinesis=no]
+ [
+ #include <aws/core/Aws.h>
+ #include <aws/core/client/ClientConfiguration.h>
+ #include <aws/core/auth/AWSCredentials.h>
+ #include <aws/core/utils/Outcome.h>
+ #include <aws/kinesis/KinesisClient.h>
+ #include <aws/kinesis/model/PutRecordRequest.h>
+ ],
+ [Aws::Kinesis::Model::PutRecordRequest request;],
+ [have_libaws_cpp_sdk_kinesis=yes],
+ [have_libaws_cpp_sdk_kinesis=no]
)
LIBS="${save_LIBS}"
@@ -879,12 +879,40 @@ PKG_CHECK_MODULES(
[have_libprotobuf=no]
)
-PKG_CHECK_MODULES(
- [SNAPPY],
- [snappy],
- [have_libsnappy=yes],
- [have_libsnappy=no]
-)
+AC_MSG_CHECKING([for snappy::RawCompress in -lsnappy])
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ save_LIBS="${LIBS}"
+ LIBS="-lsnappy"
+ save_CXXFLAGS="${CXXFLAGS}"
+ CXXFLAGS="${CXXFLAGS} -std=c++11"
+
+ AC_TRY_LINK(
+ [
+ #include <stdlib.h>
+ #include <snappy.h>
+ ],
+ [
+ const char *input = "test";
+ size_t compressed_length;
+ char *buffer = (char *)malloc(5 * sizeof(char));
+ snappy::RawCompress(input, 4, buffer, &compressed_length);
+ free(buffer);
+ ],
+ [
+ have_libsnappy=yes
+ SNAPPY_CFLAGS=""
+ SNAPPY_LIBS="-lsnappy"
+ ],
+ [have_libsnappy=no]
+ )
+
+ LIBS="${save_LIBS}"
+ CXXFLAGS="${save_CXXFLAGS}"
+ AC_LANG_RESTORE
+
+AC_MSG_RESULT([${have_libsnappy}])
AC_PATH_PROG([PROTOC], [protoc], [no])
AS_IF(
@@ -919,7 +947,7 @@ if test "${enable_backend_prometeus_remote_write}" != "no" -a "${have_libprotobu
AC_DEFINE([ENABLE_PROMETHEUS_REMOTE_WRITE], [1], [Prometheus remote write API usability])
OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS="${PROTOBUF_CFLAGS} ${SNAPPY_CFLAGS}"
CXX11FLAG="-std=c++11"
- OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS="${PROTOBUF_LIBS} ${SNAPPY_LIBS} "
+ OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS="${PROTOBUF_LIBS} ${SNAPPY_LIBS}"
else
enable_backend_prometheus_remote_write="no"
fi