Add more guards around zlib-dependent code
authorAlexey Samsonov <samsonov@google.com>
Tue, 23 Apr 2013 08:57:30 +0000 (08:57 +0000)
committerAlexey Samsonov <samsonov@google.com>
Tue, 23 Apr 2013 08:57:30 +0000 (08:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180084 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Config/config.h.cmake
lib/Support/Compression.cpp
unittests/Support/CompressionTest.cpp

index 408c590bebb082f5c477895fa1f6f306059bea57..97af6955d9edd6c9b201c39ec459217a4c04bd34 100644 (file)
 /* Define to 1 if you have the `udis86' library (-ludis86). */
 #undef HAVE_LIBUDIS86
 
+/* Define to 1 if you have the 'z' library (-lz). */
+#cmakedefine HAVE_LIBZ ${HAVE_LIBZ}
+
 /* Define to 1 if you have the <limits.h> header file. */
 #cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H}
 
index d0adf79ec7805e9e7b86c57a8e8816d7a1cbc723..497b17ec92b06b167a10d3c17aaed33f38b626a7 100644 (file)
@@ -23,7 +23,7 @@
 
 using namespace llvm;
 
-#if LLVM_ENABLE_ZLIB == 1
+#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
 static int encodeZlibCompressionLevel(zlib::CompressionLevel Level) {
   switch (Level) {
     case zlib::NoCompression: return 0;
index aad7ed0e89a185c0911b091ed7e0f62f9db23fc9..c8e2cd9f02b62e59bab085ec8b00bb3d4ff566f7 100644 (file)
@@ -22,7 +22,7 @@ using namespace llvm;
 
 namespace {
 
-#if LLVM_ENABLE_ZLIB == 1
+#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
 
 void TestZlibCompression(StringRef Input, zlib::CompressionLevel Level) {
   OwningPtr<MemoryBuffer> Compressed;