Conditionalize the bzip2/gzip compression/decompression

code on the existence of the relevant libraries (actually,
the existence of the include files).

This will allow the library to be easily ported to systems
that don't have these libraries.  (Of course, it also means
that clients using the library on such systems will not be
able to take advantage of the automatic compression format
detection.)
This commit is contained in:
Tim Kientzle 2004-07-30 04:14:47 +00:00
parent 92371d176f
commit 769756525d
5 changed files with 29 additions and 0 deletions

View File

@ -32,8 +32,13 @@ __FBSDID("$FreeBSD$");
int
archive_read_support_compression_all(struct archive *a)
{
#if HAVE_BZLIB_H
archive_read_support_compression_bzip2(a);
#endif
/* The decompress code doesn't use an outside library. */
archive_read_support_compression_compress(a);
#if HAVE_ZLIB_H
archive_read_support_compression_gzip(a);
#endif
return (ARCHIVE_OK);
}

View File

@ -25,6 +25,10 @@
*/
#include "archive_platform.h"
/* Don't compile this if we don't have bzlib. */
#if HAVE_BZLIB_H
__FBSDID("$FreeBSD$");
#include <err.h>
@ -361,3 +365,5 @@ fatal:
a->compression_name);
return (ARCHIVE_FATAL);
}
#endif /* HAVE_BZLIB_H */

View File

@ -25,6 +25,10 @@
*/
#include "archive_platform.h"
/* Don't compile this if we don't have zlib. */
#if HAVE_ZLIB_H
__FBSDID("$FreeBSD$");
#include <errno.h>
@ -496,3 +500,5 @@ fatal:
a->compression_name);
return (ARCHIVE_FATAL);
}
#endif /* HAVE_ZLIB_H */

View File

@ -25,6 +25,10 @@
*/
#include "archive_platform.h"
/* Don't compile this if we don't have bzlib. */
#if HAVE_BZLIB_H
__FBSDID("$FreeBSD$");
#include <errno.h>
@ -326,3 +330,5 @@ drive_compressor(struct archive *a, struct private_data *state, int finishing)
}
}
}
#endif /* HAVE_BZLIB_H */

View File

@ -25,6 +25,10 @@
*/
#include "archive_platform.h"
/* Don't compile this if we don't have zlib. */
#if HAVE_ZLIB_H
__FBSDID("$FreeBSD$");
#include <errno.h>
@ -381,3 +385,5 @@ drive_compressor(struct archive *a, struct private_data *state, int finishing)
}
}
}
#endif /* HAVE_ZLIB_H */