soc.2008.masterpassword: 4dc32d75: Add KWallet autotools magic. It's a litt...

qulogic at pidgin.im qulogic at pidgin.im
Mon Nov 7 02:37:31 EST 2011


----------------------------------------------------------------------
Revision: 4dc32d75690d83a07dcc7a4bcac5c06520e4a708
Parent:   b3723db1f85781f6d0a7af8c04759b3dba1ca6da
Author:   qulogic at pidgin.im
Date:     11/07/11 01:22:07
Branch:   im.pidgin.soc.2008.masterpassword
URL: http://d.pidgin.im/viewmtn/revision/info/4dc32d75690d83a07dcc7a4bcac5c06520e4a708

Changelog: 

Add KWallet autotools magic. It's a little annoying that KDE switched
to CMake and there are neither autotools macros nor any pkg-config
files for things. Also, I don't really like requiring a C++ compiler,
even when not building the KWallet plugin, but I can't really figure
out how to make it conditional.

Changes against parent b3723db1f85781f6d0a7af8c04759b3dba1ca6da

  patched  configure.ac
  patched  libpurple/plugins/keyrings/Makefile.am

-------------- next part --------------
============================================================
--- configure.ac	f9b40e854dc99fcfbe3e1f567f8441d4f4a12806
+++ configure.ac	ea61bd285c7c4a413640cccad49a527ac47cf9ec
@@ -110,6 +110,7 @@ AM_PROG_CC_C_O
 dnl Checks for programs.
 AC_PROG_CC
 AM_PROG_CC_C_O
+AC_PROG_CXX
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 LIBTOOL="$LIBTOOL --silent"
@@ -1361,6 +1362,85 @@ dnl ####################################
 AM_CONDITIONAL(ENABLE_GNOMEKEYRING, test "x$enable_gnome_keyring" = "xyes")
 
 dnl #######################################################################
+dnl # Check for KWallet headers
+dnl #######################################################################
+
+AC_ARG_ENABLE(kwallet, [AC_HELP_STRING([--enable-kwallet], [enable KWallet support])], enable_kwallet=$enableval, enable_kwallet=no)
+AC_ARG_WITH(kwallet-includes, [AC_HELP_STRING([--with-kwallet-includes=DIR], [compile the KWallet plugin against includes in DIR])], [ac_kwallet_includes="$withval"], [ac_kwallet_includes="no"])
+AC_ARG_WITH(kwallet-libs, [AC_HELP_STRING([--with-kwallet-libs=DIR], [compile the KWallet plugin against the KWallet libs in DIR])], [ac_kwallet_libs="$withval"], [ac_kwallet_libs="no"])
+AC_ARG_WITH(qt4-libs, [AC_HELP_STRING([--with-qt4-libs=DIR], [compile the KWallet plugin against the Qt4 libs in DIR])], [ac_qt4_libs="$withval"], [ac_qt4_libs="no"])
+
+if test "x$enable_kwallet" = "xyes"; then
+	KWALLET_CXXFLAGS=""
+	KWALLET_LIBS=""
+	if test -z "$with_kwallet_includes" || test -z "$with_kwallet_libs"; then
+		AC_CHECK_PROG(KDE4_CONFIG, kde4-config, kde4-config, no)
+		if test "x$KDE4_CONFIG" = "xno"; then
+			if test "x$force_deps" = "xyes"; then
+				AC_MSG_ERROR([
+kde4-config not found. $KDE4_CONFIG
+Use --disable-kwallet if you do not need KWallet support.
+])
+			fi
+		fi
+	fi
+			
+	AC_LANG_PUSH([C++])
+	CPPFLAGS_save="$CPPFLAGS"
+	LDFLAGS_save="$LDFLAGS"
+
+	dnl Check for kwallet.h; if we don't have it, oh well
+	if test "$ac_kwallet_includes" != "no"; then
+		KWALLET_CXXFLAGS="-I$ac_kwallet_includes"
+	elif test "x$KDE4_CONFIG" != "xno"; then
+		KWALLET_CXXFLAGS="-I`$KDE4_CONFIG --path include`"
+	fi
+	CPPFLAGS="$CPPFLAGS $KWALLET_CXXFLAGS"
+	AC_CHECK_HEADER([kwallet.h], [true], [if test "x$force_deps" = "xyes"; then
+AC_MSG_ERROR([
+KWallet development headers not found.
+Use --disable-kwallet if you do not need KWallet support.
+])
+fi
+])
+
+	AC_MSG_CHECKING([for KWallet libraries])
+	if test "$ac_kwallet_libs" != "no"; then
+		KWALLET_LIBS="-L$ac_kwallet_libs -lkdeui"
+	elif test "x$KDE4_CONFIG" != "xno"; then
+		KWALLET_LIBS="-L`$KDE4_CONFIG --install lib`/kde4/devel -lkdeui"
+	else
+		KWALLET_LIBS="-lkdeui"
+	fi
+	if test "$ac_qt4_libs" != "no"; then
+		KWALLET_LIBS="$KWALLET_LIBS -L$ac_qt4_libs -lQtCore"
+	elif test "x$KDE_CONFIG" != "xno"; then
+		KWALLET_LIBS="$KWALLET_LIBS -L`$KDE4_CONFIG --qt-libraries` -lQtCore"
+	else
+		KWALLET_LIBS="$KWALLET_LIBS -lQtCore"
+	fi
+	LDFLAGS="$LDFLAGS $KWALLET_LIBS"
+	AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <kwallet.h>],
+		[KWallet::Wallet::LocalWallet();])], [AC_MSG_RESULT([yes])],
+		[if test "x$force_deps" = "xyes"; then
+AC_MSG_ERROR([
+KWallet development libraries not found.
+Use --disable-kwallet if you do not need KWallet support.
+])
+fi
+])
+
+	CPPFLAGS="$CPPFLAGS_save"
+	LDFLAGS="$LDFLAGS_save"
+	AC_LANG_POP
+fi
+
+AC_SUBST(KWALLET_LIBS)
+AC_SUBST(KWALLET_CXXFLAGS)
+
+AM_CONDITIONAL(ENABLE_KWALLET, test "x$enable_kwallet" = "xyes")
+
+dnl #######################################################################
 dnl # Check for Python
 dnl #######################################################################
 
@@ -2596,6 +2676,7 @@ echo Build with GNOME Keyring...... : $e
 echo Build with GNU Libidn......... : $enable_idn
 echo Build with NetworkManager..... : $enable_nm
 echo Build with GNOME Keyring...... : $enable_gnome_keyring
+echo Build with KWallet............ : $enable_kwallet
 echo SSL Library/Libraries......... : $msg_ssl
 if test "x$SSL_CERTIFICATES_DIR" != "x" ; then
 	eval eval echo SSL CA certificates directory. : $SSL_CERTIFICATES_DIR
============================================================
--- libpurple/plugins/keyrings/Makefile.am	beca4dc612ae16f8ee63b4ad26e901c289f14a9e
+++ libpurple/plugins/keyrings/Makefile.am	f829c2ca193b59cf63f7512ab42c134cc4830a54
@@ -17,16 +17,28 @@ endif
 
 endif
 
+if ENABLE_KWALLET
+
+kwallet_la_CXXFLAGS  = $(KWALLET_CXXFLAGS)
+kwallet_la_LDFLAGS = -module -avoid-version
+kwallet_la_SOURCES = kwallet.cpp
+kwallet_la_LIBADD  = $(GLIB_LIBS) $(KWALLET_LIBS)
+
+endif
+
 if PLUGINS
 
 plugin_LTLIBRARIES = \
 	internalkeyring.la
 
 if ENABLE_GNOMEKEYRING
-
 plugin_LTLIBRARIES += \
 	gnomekeyring.la
+endif
 
+if ENABLE_KWALLET
+plugin_LTLIBRARIES += \
+	kwallet.la
 endif
 
 endif


More information about the Commits mailing list