Commit e4307186 authored by Shaun McCance's avatar Shaun McCance

Fixing the build stuff for bz2

parent e546849e
......@@ -79,6 +79,24 @@ if test x"$enable_lzma" = "xyes"; then
fi
AM_CONDITIONAL([ENABLE_LZMA],[test x"$enable_lzma" != "xno"])
AC_ARG_ENABLE(bz2,
AS_HELP_STRING([--enable-bz2],[Enable bz2 decoder support [[default=yes]]]),
[enable_bz2=$enableval],
[enable_bz2="auto"])
if test x"$enable_bz2" = "xauto"; then
AC_CHECK_LIB(bz2,
BZ2_bzread,
enable_bz2=yes,
enable_bz2=no)
elif test x"$enable_bz2" = "xyes"; then
AC_CHECK_LIB(bz2, BZ2_bzread)
fi
if test x"$enable_bz2" = "xyes"; then
YELP_LIBS="-lbz2 $YELP_LIBS";
AC_DEFINE(ENABLE_BZ2, 1, [Enable bz2 decoder support])
fi
AM_CONDITIONAL([ENABLE_BZ2],[test x"$enable_bz2" != "xno"])
AC_SUBST([YELP_CFLAGS])
AC_SUBST([YELP_LIBS])
......@@ -151,36 +169,6 @@ fi
AC_SUBST(X_LIBS)
dnl ====================================
dnl = zlib for help converters
dnl ====================================
AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz
AC_SUBST(Z_LIBS)], AC_MSG_ERROR([*** zlib is required]))
dnl ====================================
dnl = Bzip2, for the help converters
dnl ====================================
BZ_LIBS=
AC_CHECK_LIB(bz2, bzread, [AC_DEFINE(HAVE_LIBBZ2, 1, [Compile with libbz2 suppot])
BZ_LIBS="-lbz2"])
dnl <= Check for bzip2 > 1.0.0
AC_CHECK_LIB(bz2, BZ2_bzread, [AC_DEFINE(HAVE_LIBBZ2, 1, [Compile with libbz2 support])
BZ_LIBS="-lbz2"
dnl <= define the wrapper-functions to get the Bzip2 stuff working .. =>
AC_DEFINE(bzread,BZ2_bzread, [Needed to get Bzip2 working])
AC_DEFINE(bzopen,BZ2_bzopen, [Needed to get Bzip2 working])
AC_DEFINE(bzdopen,BZ2_bzdopen, [Needed to get Bzip2 working])
AC_DEFINE(bzwrite,BZ2_bzwrite, [Needed to get Bzip2 working])
AC_DEFINE(bzerror,BZ2_bzerror, [Needed to get Bzip2 working])
AC_DEFINE(bzclose,BZ2_bzclose, [Needed to get Bzip2 working])
AC_DEFINE(bzflush,BZ2_bzflush, [Needed to get Bzip2 working])
AC_DEFINE(bzCompress,BZ2_bzCompress, [Needed to get Bzip2 working])
AC_DEFINE(bzCompressInit,BZ2_bzCompressInit, [Needed to get Bzip2 working])
AC_DEFINE(bzDecompress,BZ2_bzDecompress, [Needed to get Bzip2 working])
AC_DEFINE(bzDecompressInit,BZ2_bzDecompressInit, [Needed to get Bzip2 working])
])
dnl =>
AC_SUBST(BZ_LIBS)
# *****
# SMClient
......@@ -257,6 +245,7 @@ yelp-$VERSION:
Debug enabled: ${enable_debug}
Search backend: ${search_backend}
Using SMClient: ${with_smclient}
Enable BZ2: ${enable_bz2}
Enable LZMA: ${enable_lzma}
"
......@@ -16,9 +16,6 @@ GTKDOC_CFLAGS = \
GTKDOC_LIBS = \
$(YELP_LIBS) \
$(Z_LIBS) \
$(BZ_LIBS) \
$(LZMADEC_LIBS) \
$(top_builddir)/libyelp/libyelp.la
HFILE_GLOB = $(top_srcdir)/libyelp/*.h
......
lib_LTLIBRARIES = libyelp.la
libyelp_la_SOURCES = \
yelp-bz2-decompressor.c \
yelp-debug.c \
yelp-error.c \
yelp-docbook-document.c \
......@@ -36,6 +35,12 @@ else
EXTRA_DIST += yelp-lzma-decompressor.c
endif
if ENABLE_BZ2
libyelp_la_SOURCES += yelp-bz2-decompressor.c
else
EXTRA_DIST += yelp-bz2-decompressor.c
endif
libyelp_la_CFLAGS = \
$(YELP_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
......
......@@ -27,7 +27,9 @@
#include "yelp-magic-decompressor.h"
#ifdef ENABLE_BZ2
#include "yelp-bz2-decompressor.h"
#endif
#ifdef ENABLE_LZMA
#include "yelp-lzma-decompressor.h"
......@@ -123,10 +125,12 @@ yelp_magic_decompressor_convert (GConverter *converter,
*/
if (inbuf_size <= 2)
;
#ifdef ENABLE_BZ2
else if (((gchar *) inbuf)[0] == 'B' &&
((gchar *) inbuf)[1] == 'Z') {
decompressor->magic_decoder_ring = (GConverter *) yelp_bz2_decompressor_new ();
}
#endif
#ifdef ENABLE_LZMA
else if (((gchar *) inbuf)[0] == ']' &&
((gchar *) inbuf)[1] == '\0') {
......
......@@ -35,9 +35,6 @@ yelp_LDADD = \
$(top_builddir)/libyelp/libyelp.la \
$(YELP_LIBS) \
$(POPT_LIBS) \
$(Z_LIBS) \
$(BZ_LIBS) \
$(LZMADEC_LIBS) \
$(X_LIBS)
yelp_LDFLAGS = $(AM_LDFLAGS)
......
......@@ -6,24 +6,28 @@ YELP_COMMON_CFLAGS = \
-I$(top_srcdir)/libyelp
YELP_COMMON_LDADD = \
$(YELP_LIBS) \
$(Z_LIBS) \
$(BZ_LIBS) \
$(LZMADEC_LIBS) \
$(top_builddir)/libyelp/libyelp.la
check_PROGRAMS = \
test-bz2 \
test-io-channel \
test-location-entry \
test-lzma \
test-magic \
test-settings \
test-transform \
test-uri \
test-view
if ENABLE_LZMA
check_PROGRAMS += test-lzma
test_lzma_CFLAGS = $(YELP_COMMON_CFLAGS)
test_lzma_LDADD = $(YELP_COMMON_LDADD)
endif
if ENABLE_BZ2
check_PROGRAMS += test-bz2
test_bz2_CFLAGS = $(YELP_COMMON_CFLAGS)
test_bz2_LDADD = $(YELP_COMMON_LDADD)
endif
test_io_channel_CFLAGS = $(YELP_COMMON_CFLAGS)
test_io_channel_LDADD = $(YELP_COMMON_LDADD)
......@@ -31,9 +35,6 @@ test_io_channel_LDADD = $(YELP_COMMON_LDADD)
test_location_entry_CFLAGS = $(YELP_COMMON_CFLAGS)
test_location_entry_LDADD = $(YELP_COMMON_LDADD)
test_lzma_CFLAGS = $(YELP_COMMON_CFLAGS)
test_lzma_LDADD = $(YELP_COMMON_LDADD)
test_magic_CFLAGS = $(YELP_COMMON_CFLAGS)
test_magic_LDADD = $(YELP_COMMON_LDADD)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment