NLnetLabs / ldns

LDNS is a DNS library that facilitates DNS tool programming
https://nlnetlabs.nl/ldns
BSD 3-Clause "New" or "Revised" License
295 stars 99 forks source link

use pkg-config for OpenSSL configuration #124

Closed fcelda closed 2 years ago

fcelda commented 3 years ago

This is a proposal to switch OpenSSL build configuration to pkgconfig.

I'm trying to get ldns to build with Conan and also get it into the official package registry. However, my package doesn't build in all configurations. There are some cases where custom code to detect OpenSSL doesn't work. For instance, when OpenSSL is linked statically, it requires a few extra static libraries to be linked (pthread and rt) and while I see some detection for that in acx_nlnetlabs.m4 it doesn't seem to work always.

In case pkg-config is not available, the implementation allows specifying the OpenSSL configuration manually:

$ ./configure --help
...
Some influential environment variables:
...
  PKG_CONFIG  path to pkg-config utility
  PKG_CONFIG_PATH
              directories to add to pkg-config's search path
  PKG_CONFIG_LIBDIR
              path overriding pkg-config's built-in search path
  openssl_CFLAGS
              C compiler flags for openssl, overriding pkg-config
  openssl_LIBS
              linker flags for openssl, overriding pkg-config
  ssldir      value of prefix for openssl, overriding pkg-config
...

Please, let me know what you think.