[yelp] Fixing the build stuff for bz2



commit e430718640b5bea306f55f4b696d884c2b4a5270
Author: Shaun McCance <shaunm gnome org>
Date:   Thu May 6 16:17:07 2010 -0500

    Fixing the build stuff for bz2

 configure.in                      |   49 ++++++++++++++----------------------
 docs/libyelp/Makefile.am          |    3 --
 libyelp/Makefile.am               |    7 ++++-
 libyelp/yelp-magic-decompressor.c |    4 +++
 src/Makefile.am                   |    3 --
 tests/Makefile.am                 |   17 +++++++------
 6 files changed, 38 insertions(+), 45 deletions(-)
---
diff --git a/configure.in b/configure.in
index 8140a41..f7ededd 100644
--- a/configure.in
+++ b/configure.in
@@ -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}
 
 "
diff --git a/docs/libyelp/Makefile.am b/docs/libyelp/Makefile.am
index a2eb9d8..945dbfc 100644
--- a/docs/libyelp/Makefile.am
+++ b/docs/libyelp/Makefile.am
@@ -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
diff --git a/libyelp/Makefile.am b/libyelp/Makefile.am
index 36e0448..3af8fbe 100644
--- a/libyelp/Makefile.am
+++ b/libyelp/Makefile.am
@@ -1,7 +1,6 @@
 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)"\"		\
diff --git a/libyelp/yelp-magic-decompressor.c b/libyelp/yelp-magic-decompressor.c
index 7cf0704..89fa2be 100644
--- a/libyelp/yelp-magic-decompressor.c
+++ b/libyelp/yelp-magic-decompressor.c
@@ -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') {
diff --git a/src/Makefile.am b/src/Makefile.am
index 5775595..12153a1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c4b9c54..449be5b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]