diff --git a/components/cluster/clusterlistener.cpp b/components/cluster/clusterlistener.cpp index 20fe633ec..e81fc0b03 100644 --- a/components/cluster/clusterlistener.cpp +++ b/components/cluster/clusterlistener.cpp @@ -348,11 +348,11 @@ void ClusterListener::OpenLogFile(void) } StdioStream::Ptr logStream = boost::make_shared(fp, true); -#ifdef ZLIB +#ifdef HAVE_BIOZLIB m_LogFile = boost::make_shared(logStream); -#else /* ZLIB */ +#else /* HAVE_BIOZLIB */ m_LogFile = logStream; -#endif /* ZLIB */ +#endif /* HAVE_BIOZLIB */ m_LogMessageCount = 0; m_LogMessageTimestamp = 0; } @@ -435,11 +435,11 @@ void ClusterListener::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Ptr std::fstream *fp = new std::fstream(path.CStr(), std::fstream::in); StdioStream::Ptr logStream = boost::make_shared(fp, true); -#ifdef ZLIB +#ifdef HAVE_BIOZLIB ZlibStream::Ptr lstream = boost::make_shared(logStream); -#else /* ZLIB */ +#else /* HAVE_BIOZLIB */ Stream::Ptr lstream = logStream; -#endif /* ZLIB */ +#endif /* HAVE_BIOZLIB */ String message; while (true) { diff --git a/configure.ac b/configure.ac index a330f8a40..0c01ab3b0 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,14 @@ AC_CHECK_LIB(ws2_32, getsockname) AC_CHECK_LIB(shlwapi, PathRemoveFileSpecA) AC_CHECK_FUNCS([backtrace_symbols execvpe pipe2 pthread_set_name_np pthread_setname_np]) +AC_TRY_LINK([#include +#include +#include ], [BIO_f_zlib();], ac_cv_lib_biozlib="yes") +if test "$ac_cv_lib_biozlib" = "yes"; then + AC_DEFINE(HAVE_BIOZLIB, 1, + [Define if BIO_f_zlib is available]) +fi + CFLAGS="$CFLAGS -Wall -Wextra" CXXFLAGS="$CXXFLAGS -Wall -Wextra" diff --git a/lib/base/zlibstream.cpp b/lib/base/zlibstream.cpp index 0159db118..fd43423c5 100644 --- a/lib/base/zlibstream.cpp +++ b/lib/base/zlibstream.cpp @@ -21,7 +21,7 @@ #include "base/objectlock.h" #include -#ifdef ZLIB +#ifdef HAVE_BIOZLIB using namespace icinga; @@ -79,4 +79,4 @@ bool ZlibStream::IsEof(void) const return BIO_eof(m_BIO); } -#endif /* ZLIB */ +#endif /* HAVE_BIOZLIB */ diff --git a/lib/base/zlibstream.h b/lib/base/zlibstream.h index f08688a9f..c59606630 100644 --- a/lib/base/zlibstream.h +++ b/lib/base/zlibstream.h @@ -24,7 +24,7 @@ #include "base/stream_bio.h" #include -#ifdef ZLIB +#ifdef HAVE_BIOZLIB namespace icinga { @@ -50,6 +50,6 @@ private: } -#endif /* ZLIB */ +#endif /* HAVE_BIOZLIB */ #endif /* ZLIBSTREAM_H */