Patch #2167 2007-09-07 12:55

horakdan

use system zlib and bzip2 for help_plugin
Download
2167-use_system_zli.patch (2.3 KB)
Category
Plugin::Refinement
Status
Accepted
Close date
2007-09-07 22:19
Assigned to
 
Index: configure.in
===================================================================
--- configure.in    (revision 4437)
+++ configure.in    (working copy)
@@ -49,6 +49,15 @@
 AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF,,snprintf))
 AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF,,vsnprintf))
 
+save_LIBS=$LIBS
+AC_SEARCH_LIBS(gzopen, z, [HAVE_ZLIB=yes], [HAVE_ZLIB=no])
+LIBS=$save_LIBS
+AC_SEARCH_LIBS(BZ2_bzopen, bz2, [HAVE_BZIP2=yes], [HAVE_BZIP2=no])
+LIBS=$save_LIBS
+
+AM_CONDITIONAL([HAVE_ZLIB], [test "$HAVE_ZLIB" = yes])
+AM_CONDITIONAL([HAVE_BZIP2], [test "$HAVE_BZIP2" = yes])
+
 dnl versioning info for libtool
 dnl Note this is the ABI version which is not the same as our actual library version
 CODEBLOCKS_CURRENT=0
Index: src/plugins/contrib/help_plugin/Makefile.am
===================================================================
--- src/plugins/contrib/help_plugin/Makefile.am    (revision 4437)
+++ src/plugins/contrib/help_plugin/Makefile.am    (working copy)
@@ -1,4 +1,11 @@
-SUBDIRS = bzip2 zlib
+DIST_SUBDIRS = bzip2 zlib
+SUBDIRS =
+if ! HAVE_BZIP2
+SUBDIRS += bzip2
+endif
+if ! HAVE_ZLIB
+SUBDIRS += zlib
+endif
 
 INCLUDES = $(WX_CXXFLAGS) \
         -I$(top_srcdir)/src/include \
@@ -11,9 +18,19 @@
 
 libhelp_plugin_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
 
-libhelp_plugin_la_LIBADD = $(PLUGIN_WX_LIBS) ../../../sdk/libcodeblocks.la \
-                bzip2/libbzip2.la \
-                zlib/libz.la
+libhelp_plugin_la_LIBADD = $(PLUGIN_WX_LIBS) ../../../sdk/libcodeblocks.la
+if ! HAVE_BZIP2
+libhelp_plugin_la_LIBADD += bzip2/libbzip2.la
+INCLUDES += -Ibzip2
+else
+libhelp_plugin_la_LIBADD += -lbz2
+endif
+if ! HAVE_ZLIB
+libhelp_plugin_la_LIBADD += zlib/libz.la
+INCLUDES += -Izlib
+else
+libhelp_plugin_la_LIBADD += -lz
+endif
 
 libhelp_plugin_la_SOURCES = help_common.cpp \
             HelpConfigDialog.cpp \
Index: src/plugins/contrib/help_plugin/help_plugin.cpp
===================================================================
--- src/plugins/contrib/help_plugin/help_plugin.cpp    (revision 4437)
+++ src/plugins/contrib/help_plugin/help_plugin.cpp    (working copy)
@@ -25,9 +25,10 @@
 
 #include "help_plugin.h"
 #include "man2html.h"
-#include "bzip2/bzlib.h"
-#include "zlib/zlib.h"
 
+#include <bzlib.h>
+#include <zlib.h>
+
 #include <wx/process.h>
 #include <wx/intl.h>
 #include <wx/textdlg.h>
horakdan 2007-09-07 13:08

updated to fix #include