[gnutls-dev] Re: pkg-config support for opencdk

Simon Josefsson jas at extundo.com
Fri Aug 18 10:41:15 CEST 2006

Martin Lambers <marlam at marlam.de> writes:

> On Tue, 08. Aug 2006, 14:47:39 +0200, Simon Josefsson wrote:
>> I think Bruno's AC_LIB_HAVE_LINKFLAGS is the best choice.  It works
>> for cross-compilations, can check for particular versions through the
>> gnutls.h LIBGNUTLS_VERSION* symbols, and doesn't add unnecessary
>> libraries to the link line, and works with and without libtool.
> How does the check for particular versions work with
> AC_LIB_HAVE_LINKFLAGS? Can you give an example?

In gsasl I use:

  AC_LIB_HAVE_LINKFLAGS(gnutls,, [#include <gnutls/gnutls.h>],
    [gnutls_certificate_verify_peers2 (0, 0);])

You could modify it into:

    [#include <gnutls/gnutls.h>
     #if LIBGNUTLS_VERSION_NUMBER < 0x010500
     error too old gnutls
    [gnutls_certificate_verify_peers2 (0, 0);])

I didn't test this, but something like it should work.

Note that the test for gnutls_certificate_verify_peers2() is an
implicit version test -- gsasl need a gnutls version that have that
particular feature.  That is the best approach: test the GnuTLS
library for the properties (e.g., APIs) that your application actually
needs.  Doing so will work even if someone has back-ported a feature
to an older version, for example.


More information about the Gnutls-devel mailing list