summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Compressor.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-11-19 15:56:28 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-11-19 15:56:28 +0000
commitdc23fe9ded32a09b86531cb162b18186fb1c37a6 (patch)
tree2fa6fc6a70f9c78ff4c778bde39c8ff6c294eb4f /llvm/lib/Support/Compressor.cpp
parentd215992b354e7bf9c35809341c8a91ec2f761857 (diff)
downloadbcm5719-llvm-dc23fe9ded32a09b86531cb162b18186fb1c37a6.tar.gz
bcm5719-llvm-dc23fe9ded32a09b86531cb162b18186fb1c37a6.zip
Allow this to compile even on machines that HAVE the bzlib library but do
NOT have the bzlib.h header file. Go figure. llvm-svn: 17989
Diffstat (limited to 'llvm/lib/Support/Compressor.cpp')
-rw-r--r--llvm/lib/Support/Compressor.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Support/Compressor.cpp b/llvm/lib/Support/Compressor.cpp
index ecadf283fe3..ba5cb7c85ed 100644
--- a/llvm/lib/Support/Compressor.cpp
+++ b/llvm/lib/Support/Compressor.cpp
@@ -19,11 +19,17 @@
#include <string>
#ifdef HAVE_BZIP2
+#ifdef HAVE_BZLIB_H
#include <bzlib.h>
-#endif
+#define BZIP2_GOOD
+#endif
+#endif
#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
#include <zlib.h>
+#define ZLIB_GOOD
+#endif
#endif
namespace {
@@ -250,7 +256,7 @@ uint64_t Compressor::compress(const char* in, unsigned size,
switch (hint) {
case COMP_TYPE_BZIP2: {
-#if defined(HAVE_BZIP2)
+#if defined(BZIP2_GOOD)
// Set up the bz_stream
bz_stream bzdata;
bzdata.bzalloc = 0;
@@ -307,7 +313,7 @@ uint64_t Compressor::compress(const char* in, unsigned size,
}
case COMP_TYPE_ZLIB: {
-#if defined(HAVE_ZLIB)
+#if defined(ZLIB_GOOD)
z_stream zdata;
zdata.zalloc = Z_NULL;
zdata.zfree = Z_NULL;
@@ -414,7 +420,7 @@ uint64_t Compressor::decompress(const char *in, unsigned size,
switch (*in++) {
case COMP_TYPE_BZIP2: {
-#if !defined(HAVE_BZIP2)
+#if !defined(BZIP2_GOOD)
throw std::string("Can't decompress BZIP2 data");
#else
// Set up the bz_stream
@@ -469,7 +475,7 @@ uint64_t Compressor::decompress(const char *in, unsigned size,
}
case COMP_TYPE_ZLIB: {
-#if !defined(HAVE_ZLIB)
+#if !defined(ZLIB_GOOD)
throw std::string("Can't decompress ZLIB data");
#else
z_stream zdata;
OpenPOWER on IntegriCloud