/pidgin/main: f1c54a78d896: Better check for libgadu GPL complia...

Tomasz Wasilczyk twasilczyk at pidgin.im
Mon Jun 16 18:04:09 EDT 2014


Changeset: f1c54a78d89656ae608615fc799c5d4f17ac01ff
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-06-17 00:03 +0200
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/f1c54a78d896

Description:

Better check for libgadu GPL compliance, some tidying up

diffstat:

 configure.ac                       |  139 ++++++------------------------------
 libpurple/protocols/gg/Makefile.am |   29 ++++---
 libpurple/protocols/gg/gg.c        |   12 ++-
 pidgin/gtkdialogs.c                |   10 +-
 4 files changed, 55 insertions(+), 135 deletions(-)

diffs (285 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1023,127 +1023,36 @@ elif test "x$silc10client" = "xyes"; the
 fi
 
 dnl #######################################################################
-dnl # Check for Gadu-Gadu client includes and libraries
+dnl # Check for Gadu-Gadu protocol library (libgadu)
 dnl #######################################################################
-AC_ARG_WITH(gadu-includes, [AC_HELP_STRING([--with-gadu-includes=DIR], [compile the Gadu-Gadu plugin against includes in DIR])], [ac_gadu_includes="$withval"], [ac_gadu_includes="no"])
-AC_ARG_WITH(gadu-libs, [AC_HELP_STRING([--with-gadu-libs=DIR], [compile the Gadu-Gadu plugin against the libs in DIR])], [ac_gadu_libs="$withval"], [ac_gadu_libs="no"])
-GADU_CFLAGS=""
-GADU_LIBS=""
-if test -n "$with_gadu_includes" || test -n "$with_gadu_libs"; then
-	gadu_manual_check="yes"
-else
-	gadu_manual_check="no"
-fi
-if test "x$gadu_manual_check" = "xno"; then
-	PKG_CHECK_MODULES(GADU, [libgadu >= 1.12.0], [
-		gadu_includes="yes"
-		gadu_libs="yes"
-	], [
-		gadu_includes="no"
+
+PKG_CHECK_MODULES(LIBGADU, [libgadu >= 1.12.0], [have_libgadu=yes], [have_libgadu=no])
+
+if test "x$have_libgadu" = "xyes"; then
+	AC_CHECK_LIB(gadu, gg_is_gpl_compliant, , [
+		LIBGADU_LIBS=""
+		LIBGADU_CFLAGS=""
+		have_libgadu=no
+		AC_MSG_WARN([
+libgadu is not compatible with the GPL when compiled with OpenSSL support.
+
+To compile against system libgadu, please recompile libgadu using:
+./configure --with-openssl=no
+Then rerun this ./configure
+
+Falling back to using our own copy of libgadu.
+		])
 	])
-else
-	if test "$ac_gadu_includes" != "no"; then
-		GADU_CFLAGS="-I$ac_gadu_includes"
-	fi
-	CPPFLAGS_save="$CPPFLAGS"
-	CPPFLAGS="$CPPFLAGS $GADU_CFLAGS"
-	AC_CHECK_HEADER(libgadu.h, [gadu_includes=yes])
-	CPPFLAGS="$CPPFLAGS_save"
-
-	if test "$ac_gadu_libs" != "no"; then
-		GADU_LIBS="-L$ac_gadu_libs"
-	fi
-	GADU_LIBS="$GADU_LIBS -lgadu"
-	AC_CHECK_LIB(gadu, gg_libgadu_version, [gadu_libs=yes], , $GADU_LIBS)
-fi
-GADU_CFLAGS=`echo $GADU_CFLAGS |$sedpath 's/-Wall//'`
-
-if test "x$gadu_libs" = "xyes"; then
-	AC_MSG_CHECKING(for libgadu GPL compatibility)
-	CPPFLAGS_save="$CPPFLAGS"
-	CPPFLAGS="$CPPFLAGS $GADU_CFLAGS"
-	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libgadu.h>]], [[
-#if defined(__GG_LIBGADU_HAVE_OPENSSL) || defined(GG_CONFIG_HAVE_OPENSSL)
-#error "libgadu is not compatible with the GPL when compiled with OpenSSL support."
-#endif
-	]])], [
-		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libgadu.h>]], [[
-#if GG_DEFAULT_PROTOCOL_VERSION < 0x2e
-#error "Your libgadu version is too old. libpurple requires 1.12.0 or higher."
-#endif
-		]])], [
-			AC_MSG_RESULT(yes)
-			AC_DEFINE([HAVE_LIBGADU], [1],
-				[Define to 1 if you have libgadu.])
-		], [
-			AC_MSG_RESULT(no)
-			echo
-			echo
-			echo "Your supplied copy of libgadu is too old."
-			echo "Install version 1.12.0 or newer."
-			echo "Then rerun this ./configure"
-			echo
-			echo "Falling back to using our own copy of libgadu"
-			echo
-			GADU_LIBS=""
-			GADU_CFLAGS=""
-			gadu_libs=no
-		])
-	], [
-		AC_MSG_RESULT(no)
-		echo
-		echo
-		echo "libgadu is not compatible with the GPL when compiled with OpenSSL support."
-		echo "To compile against system libgadu, please recompile libgadu using:"
-		echo "./autogen.sh --disable-libgadu-openssl --disable-static --enable-shared"
-		echo "Then rerun this ./configure"
-		echo
-		echo "Falling back to using our own copy of libgadu"
-		echo
-		GADU_LIBS=""
-		GADU_CFLAGS=""
-		gadu_libs=no
-	])
-	CPPFLAGS="$CPPFLAGS_save"
 fi
 
-AM_CONDITIONAL(USE_INTERNAL_LIBGADU, test "x$gadu_libs" != "xyes")
-if test "x$gadu_libs" != "xyes"; then
-	AC_CHECK_LIB(gnutls, gnutls_certificate_set_x509_system_trust, [gg_have_gnutls_csxst=yes], [gg_have_gnutls_csxst=no])
-
-	gg_gnutls_sts=""
-	if test "x$gg_have_gnutls_csxst" = "xno"; then
-		for i in /etc/ssl/ca-bundle.pem \
-			/etc/ssl/certs/ca-certificates.crt \
-			/etc/pki/tls/cert.pem \
-			/usr/local/share/certs/ca-root-nss.crt \
-			/etc/ssl/cert.pem
-		do
-			if test -e $i; then
-				gg_gnutls_sts="$i"
-				break
-			fi
-		done
-	fi
-
-	if test "x$gg_have_gnutls_csxst" = "xyes"; then
-		AC_DEFINE(HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST, 1, [gnutls contains the gnutls_certificate_set_x509_system_trust function])
-	fi
-	if test "x$gg_gnutls_sts" != "x"; then
-		AC_DEFINE_UNQUOTED(GG_CONFIG_GNUTLS_SYSTEM_TRUST_STORE, ["$gg_gnutls_sts"], [use the given file as GnuTLS default trust store])
-	fi
-
-	PKG_CHECK_MODULES([GNUTLS_2_10], [gnutls >= 2.10.0], [
-		AC_DEFINE([HAVE_GNUTLS_2_10], [], [Defined if GnuTLS >= 2.10.0 is available.])
-	],:)
+AM_CONDITIONAL(HAVE_LIBGADU, test "x$have_libgadu" = "xyes")
+if test "x$have_libgadu" = "xyes"; then
+	AC_DEFINE(HAVE_LIBGADU, 1, [Linked with external libgadu])
 fi
 
-if test "x$gadu_libs" = "x"; then
-	gadu_libs=no
-fi
+AC_SUBST(LIBGADU_LIBS)
+AC_SUBST(LIBGADU_CFLAGS)
 
-AC_SUBST(GADU_LIBS)
-AC_SUBST(GADU_CFLAGS)
 
 AC_ARG_ENABLE(distrib,,,enable_distrib=no)
 AM_CONDITIONAL(DISTRIB, test "x$enable_distrib" = "xyes")
@@ -2682,7 +2591,7 @@ fi
 echo Build with Cyrus SASL support. : $enable_cyrus_sasl
 echo Use kerberos 4 with zephyr.... : $kerberos
 echo Use external libzephyr........ : $zephyr
-echo Use external libgadu.......... : $gadu_libs
+echo Use external libgadu.......... : $have_libgadu
 echo Install pixmaps............... : $enable_pixmaps
 echo Old tray icon compatibility... : $enable_traycompat
 echo Install translations.......... : $enable_i18n
diff --git a/libpurple/protocols/gg/Makefile.am b/libpurple/protocols/gg/Makefile.am
--- a/libpurple/protocols/gg/Makefile.am
+++ b/libpurple/protocols/gg/Makefile.am
@@ -45,8 +45,8 @@ EXTRA_DIST = \
 
 pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION)
 
-if USE_INTERNAL_LIBGADU
-INTGGSOURCES = \
+if ! HAVE_LIBGADU
+INTGG_SOURCES = \
 	lib/common.c \
 	lib/config.h \
 	lib/dcc7.c \
@@ -89,16 +89,21 @@ INTGGSOURCES = \
 	lib/tvbuilder.c \
 	lib/tvbuilder.h
 
-INTGG_CFLAGS = -I$(top_srcdir)/libpurple/protocols/gg/lib -DGG_IGNORE_DEPRECATED -DUSE_INTERNAL_LIBGADU
+INTGG_LIBS = $(ZLIB_LIBS)
+INTGG_CFLAGS = \
+	-I$(top_srcdir)/libpurple/protocols/gg/lib \
+	$(ZLIB_CFLAGS) \
+	-DGG_IGNORE_DEPRECATED
+
+if USE_GNUTLS
+	INTGG_LIBS += $(GNUTLS_LIBS)
+	INTGG_CFLAGS += $(GNUTLS_CFLAGS)
 endif
 
-if USE_GNUTLS
-GADU_LIBS += $(GNUTLS_LIBS)
-GADU_CFLAGS += $(GNUTLS_CFLAGS)
 endif
 
 GGSOURCES = \
-	$(INTGGSOURCES) \
+	$(INTGG_SOURCES) \
 	gg-utils.h \
 	gg-utils.c \
 	confer.h \
@@ -116,25 +121,25 @@ libgg_la_LDFLAGS = -module -avoid-versio
 
 if STATIC_GG
 
-st = -DPURPLE_STATIC_PRPL $(GADU_CFLAGS)
+st = -DPURPLE_STATIC_PRPL
 noinst_LTLIBRARIES = libgg.la
 libgg_la_SOURCES = $(GGSOURCES)
 libgg_la_CFLAGS  = $(AM_CFLAGS)
-libgg_la_LIBADD  = $(GADU_LIBS)
+libgg_la_LIBADD  = $(LIBGADU_LIBS) $(INTGG_LIBS)
 
 else
 
-st = $(GADU_CFLAGS)
+st =
 pkg_LTLIBRARIES = libgg.la
 libgg_la_SOURCES = $(GGSOURCES)
-libgg_la_LIBADD  = $(GLIB_LIBS) $(GADU_LIBS)
+libgg_la_LIBADD  = $(GLIB_LIBS) $(LIBGADU_LIBS) $(INTGG_LIBS)
 
 endif
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/libpurple \
 	-I$(top_builddir)/libpurple \
+	$(LIBGADU_CFLAGS) \
 	$(INTGG_CFLAGS) \
 	$(GLIB_CFLAGS) \
 	$(DEBUG_CFLAGS)
-
diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -2242,6 +2242,16 @@ static gboolean ggp_offline_message(cons
 	return TRUE;
 }
 
+static gboolean ggp_load(PurplePlugin *plugin)
+{
+	purple_debug_info("gg", "Loading Gadu-Gadu protocol plugin with "
+		"libgadu %s...\n", gg_libgadu_version());
+
+	gg_is_gpl_compliant();
+
+	return TRUE;
+}
+
 static PurplePluginProtocolInfo prpl_info =
 {
 	OPT_PROTO_IM_IMAGE,
@@ -2339,7 +2349,7 @@ static PurplePluginInfo info = {
 	"boler at sourceforge.net",		/* author */
 	PURPLE_WEBSITE,				/* homepage */
 
-	NULL,					/* load */
+	ggp_load,				/* load */
 	NULL,					/* unload */
 	NULL,					/* destroy */
 
diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c
--- a/pidgin/gtkdialogs.c
+++ b/pidgin/gtkdialogs.c
@@ -633,14 +633,10 @@ g_string_append(str, "<br/>  <b>Library 
 #endif
 #endif
 
-#if defined(_WIN32) || defined(USE_INTERNAL_LIBGADU)
+#ifdef HAVE_LIBGADU
+	g_string_append(str, "    <b>Gadu-Gadu library (libgadu):</b> External<br/>");
+#else
 	g_string_append(str, "    <b>Gadu-Gadu library (libgadu):</b> Internal<br/>");
-#else
-#ifdef HAVE_LIBGADU
-	g_string_append(str, "    <b>Gadu-Gadu library (libgadu):</b> Enabled<br/>");
-#else
-	g_string_append(str, "    <b>Gadu-Gadu library (libgadu):</b> Disabled<br/>");
-#endif
 #endif
 
 #ifdef USE_GTKSPELL



More information about the Commits mailing list