diff options
author | lloyd <[email protected]> | 2008-09-24 11:51:13 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-24 11:51:13 +0000 |
commit | caebef52b255130a3d7fa88e312b2d0891b90a45 (patch) | |
tree | 80790ed1f5bfcb7aedb6c19be1b79e458ce5cbff /doc/examples | |
parent | 199b2ec469bc707a68f1dac19b83623b7a1363a9 (diff) |
Fail at runtime if bzip2 is not compiled in, instead of compile time
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/bzip.cpp | 12 |
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); |