aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/bzip.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-24 11:51:13 +0000
committerlloyd <[email protected]>2008-09-24 11:51:13 +0000
commitcaebef52b255130a3d7fa88e312b2d0891b90a45 (patch)
tree80790ed1f5bfcb7aedb6c19be1b79e458ce5cbff /doc/examples/bzip.cpp
parent199b2ec469bc707a68f1dac19b83623b7a1363a9 (diff)
Fail at runtime if bzip2 is not compiled in, instead of compile time
Diffstat (limited to 'doc/examples/bzip.cpp')
-rw-r--r--doc/examples/bzip.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/examples/bzip.cpp b/doc/examples/bzip.cpp
index 82bc3100a..a16d4f8fe 100644
--- a/doc/examples/bzip.cpp
+++ b/doc/examples/bzip.cpp
@@ -14,8 +14,6 @@ This file is in the public domain
#if defined(BOTAN_EXT_COMPRESSOR_BZIP2)
#include <botan/bzip2.h>
-#else
- #error "You didn't compile the bzip module into Botan"
#endif
const std::string SUFFIX = ".bz2";
@@ -52,11 +50,19 @@ int main(int argc, char* argv[])
try {
- Botan::Filter* bzip;
+ Botan::Filter* bzip = 0;
+#ifdef BOTAN_EXT_COMPRESSOR_BZIP2
if(decompress)
bzip = new Botan::Bzip_Decompression(small);
else
bzip = new Botan::Bzip_Compression(level);
+#endif
+
+ if(!bzip)
+ {
+ std::cout << "Sorry, support for bzip2 not compiled into Botan\n";
+ return 1;
+ }
Botan::Pipe pipe(bzip);