#202 autoconf and gnutls

2.9.0
closed-fixed
5
2014-03-16
2014-02-23
No

The pkg-config string to check, if gnutls is installed is "gnutls", not "libgnutls", the corresponding line in configure.ac:629, has to be updated to
PKG_CHECK_MODULES([GNUTLS], [gnutls >= 2.11.7], ...)

However, then the workarounds for missing pkg-config fail, and the linking parameters for gnutls are added to the GNUTLS_LIBS/GNUTLS_CFLAGS variables, but this variables are not used, so fixing PKG_CHECK_MODULE disables the workarounds for missing pkg-config, and the system does not find the correct linking flags anymore.

Suggestion:
-- fix PKG_CHECK_MODULES to search for gnutls (instead of libgnutls), and
-- when pkg-config is not installed, fill in the lines afterwards (configure.ac:634-716) the variables GNUTLS_LIB and GNUTLS_CFLAGS, rather than appending to LIBS
-- use the variables GNUTLS_LIBS and GNUTLS_CFLAGS constistanly, and don't polute LIBS and CFLAGS

But even with broken PGK_CHECK_MODULES line, running just "./configure --with-gnutls", when libgnutls is on my default LDFLAGS-path (I set in /usr/local/etc/config.site export LDFLAGS="-L/usr/lib64 -L/lib64"), then the linker can link with -lgnutls without adding any additional flags. However, configure.ac in opendkim, tries to add -L/usr/local (in the line 'gcdirs="/usr/local /usr"'), and when the linking succeeds, it prints out, that -lgnutls was found in /usr/local . But it is in /usr/lib64 !

The linking succeeds here, because LDFLAGS was set correctly, not because after adding "-L/usr/local/lib" the linker finds -lgnutls.

That said, the workarounds for finding where gnutls are, shall try to insert additional paths (like -L/usr/local/lib), only if the paths contained in LDFLAGS are insufficient to link with -lgnutls.

1 Attachments

Discussion

  • The change from libgnutls to gnutls in the pkg-config check is fine, but it looks to me like the rest of what you're asking for is already there except that it uses LIBCRYPTO_ as the variable names instead of GNUTLS_.

     
    Attachments
    • status: open --> pending
     
  • Commit 2fce5277 breaks the build, as it helps to put -lgnutls only in ${GNUTLS_LIBS}, and ${GNUTLS_LIBS} is nowhere used. That said, linking with libopendkim leaves unreasolved symbols, which would be found if -lgnutls was passed) and cannot work.

    So you have to use GNUTLS_LIBS anyway, as it is filed by pkg-config.

    That said, the work arounds for missing gnutls.pc, shall but their outcome in GNUTLS_LIBS and GNUTLS_CLFAGS, as this is what is done, when gnutls.pc is not missing.

    Also ${GNUTLS_CFLAGS} needs to be passed, when compiling.

    As of discussion on http://lists.freedesktop.org/archives/pkg-config/ from February and March 2014 , if I was in chage of opendkim, I would drop the work arounds for missing .pc files and pkg-config and instead insist, that the one who wants to compile opendkim, also provides .pc files and pkg-config.

     
  • Try the attached patch.

     
    Attachments
  • The patch works for me.

     
  • It'll be in 2.9.1.

     
    • status: pending --> open
    • assigned_to: Murray S. Kucherawy
     
  • v2.9.1 released.

     
    • status: open --> closed-fixed