[llvm] r180084 - Add more guards around zlib-dependent code

Alexey Samsonov samsonov at google.com
Tue Apr 23 01:57:30 PDT 2013


Author: samsonov
Date: Tue Apr 23 03:57:30 2013
New Revision: 180084

URL: http://llvm.org/viewvc/llvm-project?rev=180084&view=rev
Log:
Add more guards around zlib-dependent code

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

Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=180084&r1=180083&r2=180084&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Tue Apr 23 03:57:30 2013
@@ -230,6 +230,9 @@
 /* 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}
 

Modified: llvm/trunk/lib/Support/Compression.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Compression.cpp?rev=180084&r1=180083&r2=180084&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Compression.cpp (original)
+++ llvm/trunk/lib/Support/Compression.cpp Tue Apr 23 03:57:30 2013
@@ -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;

Modified: llvm/trunk/unittests/Support/CompressionTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CompressionTest.cpp?rev=180084&r1=180083&r2=180084&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/CompressionTest.cpp (original)
+++ llvm/trunk/unittests/Support/CompressionTest.cpp Tue Apr 23 03:57:30 2013
@@ -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;





More information about the llvm-commits mailing list