Re: PATCH 2/5: Use pkg-config for gnutls

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

 



On Tue, Sep 18, 2007 at 03:33:22AM -0400, Daniel Veillard wrote:
> On Tue, Sep 18, 2007 at 02:32:59AM +0100, Daniel P. Berrange wrote:
> > 
> > The current GNU TLS tests in the configure script just use CHECK_HEADER and
> > CHECK_LIB to try and locate gnutls. This is fine if its in /usr, but no so
> > useful if it is installed elsewhere. There are also no Makefile.am vars set
> > to let you specify an alternate install location. gnutls already comes with
> > support for pkg-config, so this patch just switches our configure script 
> > and Makefiles over to use that. Building against a different GNU TLS install
> > is now just a matter of setting PKG_CONFIG_PATH, or the GNUTLS_LIBS and
> > GNUTLS_CFLAGS vars.
> 
>   Same worry about pkg-config portability as for 1/5,

Here's an updated version which uses pkg-config by default, but if that's
not present uses the existing logic for CHECK_LIB. 

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
diff -r ab34ed80a056 configure.in
--- a/configure.in	Tue Sep 18 20:34:47 2007 -0400
+++ b/configure.in	Tue Sep 18 20:35:33 2007 -0400
@@ -23,6 +23,7 @@ AC_SUBST(LIBVIRT_VERSION_NUMBER)
 
 dnl Required minimum versions of all libs we depend on
 LIBXML_REQUIRED="2.5.0"
+GNUTLS_REQUIRED="1.2.0"
 AVAHI_REQUIRED="0.6.0"
 
 dnl Checks for programs.
@@ -292,20 +293,38 @@ LDFLAGS="$old_ldflags"
 LDFLAGS="$old_ldflags"
 
 dnl GnuTLS library
-AC_CHECK_HEADER([gnutls/gnutls.h],
+GNUTLS_CFLAGS=
+GNUTLS_LIBS=
+if test "x$PKG_CONFIG" != "x" ; then
+  PKG_CHECK_MODULES(GNUTLS, gnutls >= $GNUTLS_REQUIRED)
+else
+  AC_CHECK_HEADER([gnutls/gnutls.h],
        [],
        AC_MSG_ERROR([You must install the GnuTLS development package in order to compile libvirt]))
-AC_CHECK_LIB(gnutls, gnutls_handshake,
+  old_libs="$LIBS"
+  AC_CHECK_LIB(gnutls, gnutls_handshake,
        [],
        [AC_MSG_ERROR([You must install the GnuTLS library in order to compile and run libvirt])])
+  GNUTLS_LIBS=$LIBS
+  LIBS="$old_libs"
+fi
+
+AC_SUBST(GNUTLS_CFLAGS)
+AC_SUBST(GNUTLS_LIBS)
 
 dnl Old versions of GnuTLS uses types like 'gnutls_session' instead
 dnl of 'gnutls_session_t'.  Try to detect this type if defined so
 dnl that we can offer backwards compatibility.
+old_cflags="$CFLAGS"
+old_ldflags="$LDFLAGS"
+CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
+LDFLAGS="$LDFLAGS $GNUTLS_LIBS"
 AC_CHECK_TYPE(gnutls_session,
 	AC_DEFINE(GNUTLS_1_0_COMPAT,[],
 		[enable GnuTLS 1.0 compatibility macros]),,
 	[#include <gnutls/gnutls.h>])
+CFLAGS="$old_cflags"
+LDFLAGS="$old_ldflags"
 
 
 dnl Avahi library
@@ -513,6 +532,7 @@ AC_MSG_NOTICE([Libraries])
 AC_MSG_NOTICE([Libraries])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([  libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
+AC_MSG_NOTICE([  gnutls: $GNUTLS_CFLAGS $GNUTLS_LIBS])
 if test "$with_avahi" = "yes" ; then
 AC_MSG_NOTICE([   avahi: $AVAHI_CFLAGS $AVAHI_LIBS])
 else
diff -r ab34ed80a056 qemud/Makefile.am
--- a/qemud/Makefile.am	Tue Sep 18 20:34:47 2007 -0400
+++ b/qemud/Makefile.am	Tue Sep 18 20:35:33 2007 -0400
@@ -1,6 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-INCLUDES = @LIBXML_CFLAGS@
 UUID=$(shell uuidgen)
 
 sbin_PROGRAMS = libvirtd
@@ -26,14 +25,15 @@ libvirtd_SOURCES = \
 
 #-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
 libvirtd_CFLAGS = \
-        -I$(top_srcdir)/include -I$(top_builddir)/include $(LIBXML_CFLAGS) \
+        -I$(top_srcdir)/include -I$(top_builddir)/include \
+        $(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) \
         $(WARN_CFLAGS) -DLOCAL_STATE_DIR="\"$(localstatedir)\"" \
         -DSYSCONF_DIR="\"$(sysconfdir)\"" \
 	-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\"" \
 	-DREMOTE_PID_FILE="\"$(REMOTE_PID_FILE)\"" \
         -DGETTEXT_PACKAGE=\"$(PACKAGE)\"
 
-libvirtd_LDFLAGS = $(WARN_CFLAGS) $(LIBXML_LIBS)
+libvirtd_LDFLAGS = $(WARN_CFLAGS) $(LIBXML_LIBS) $(GNUTLS_LIBS)
 libvirtd_DEPENDENCIES = ../src/libvirt.la
 libvirtd_LDADD = ../src/libvirt.la
 
diff -r ab34ed80a056 src/Makefile.am
--- a/src/Makefile.am	Tue Sep 18 20:34:47 2007 -0400
+++ b/src/Makefile.am	Tue Sep 18 20:35:33 2007 -0400
@@ -3,7 +3,8 @@ INCLUDES = -I$(top_builddir)/include \
 INCLUDES = -I$(top_builddir)/include \
 	   -I@top_srcdir@/include \
 	   -I@top_srcdir@/qemud \
-	   @LIBXML_CFLAGS@ \
+	   $(LIBXML_CFLAGS) \
+	   $(GNUTLS_CFLAGS) \
 	   -DBINDIR=\""$(libexecdir)"\" \
 	   -DSBINDIR=\""$(sbindir)"\" \
 	   -DSYSCONF_DIR="\"$(sysconfdir)\"" \
@@ -19,7 +20,7 @@ EXTRA_DIST = libvirt_sym.version
 EXTRA_DIST = libvirt_sym.version
 
 lib_LTLIBRARIES = libvirt.la
-libvirt_la_LIBADD = @LIBXML_LIBS@
+libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS)
 libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
                     -version-info @LIBVIRT_VERSION_INFO@ \
                     $(COVERAGE_CFLAGS:-f%=-Wc,-f%)
diff -r ab34ed80a056 tests/Makefile.am
--- a/tests/Makefile.am	Tue Sep 18 20:34:47 2007 -0400
+++ b/tests/Makefile.am	Tue Sep 18 20:35:33 2007 -0400
@@ -15,7 +15,8 @@ INCLUDES = \
 	-I$(top_builddir)/src \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src \
-	@LIBXML_CFLAGS@ \
+	$(LIBXML_CFLAGS) \
+	$(GNUTLS_CFLAGS) \
         -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L \
         -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
          $(COVERAGE_CFLAGS) \
@@ -24,7 +25,8 @@ INCLUDES = \
 
 LDADDS = \
 	@STATIC_BINARIES@ \
-	@LIBXML_LIBS@ \
+	$(LIBXML_LIBS) \
+        $(GNUTLS_LIBS) \
         $(WARN_CFLAGS) \
 	$(LIBVIRT) \
         $(COVERAGE_LDFLAGS)
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]