NLnetLabs / ldns

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

Use pkg-config for SSL detection #136

Open kallisti5 opened 3 years ago

kallisti5 commented 3 years ago

There's a long complex set of build system code to detect OpenSSL on systems. It's failing under Haiku as nothing is within includes.

checking for SSL... configure: error: Cannot find the SSL libraries in /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/local/opt/openssl /usr/sfw /usr
./configure --with-ssl=/packages/openssl-1.1.1k-1/.self/develop/lib/
checking for SSL... configure: error: Cannot find the SSL libraries in /packages/openssl-1.1.1k-1/.self/develop/lib/

ls -la /packages/openssl-1.1.1k-1/.self/develop/lib/*ssl*
lr-xr-xr-x 1 user root      27 Jun  7 10:46 /packages/openssl-1.1.1k-1/.self/develop/lib/libgnutls-openssl.so -> libgnutls-openssl.so.27.0.2
lr-xr-xr-x 1 user root      27 Jun  7 10:46 /packages/openssl-1.1.1k-1/.self/develop/lib/libgnutls-openssl.so.27 -> libgnutls-openssl.so.27.0.2
lr-xr-xr-x 1 user root      37 Jun  7 10:46 /packages/openssl-1.1.1k-1/.self/develop/lib/libgnutls-openssl.so.27.0.2 -> ../../lib/libgnutls-openssl.so.27.0.2
-r--r--r-- 1 user root 6141304 Apr  1 05:19 /packages/openssl-1.1.1k-1/.self/develop/lib/libssl.a
lr-xr-xr-x 1 user root      13 Apr  1 05:19 /packages/openssl-1.1.1k-1/.self/develop/lib/libssl.so -> libssl.so.1.1
lr-xr-xr-x 1 user root      23 Apr  1 05:21 /packages/openssl-1.1.1k-1/.self/develop/lib/libssl.so.1.1 -> ../../lib/libssl.so.1.1

Why isn't ldns just using pkg-config? That's what it is for.

kallisti5 commented 3 years ago
$ pkg-config --cflags openssl
-I/packages/openssl-1.1.1k-1/.self/develop/headers
$ pkg-config --libs openssl
-L/packages/openssl-1.1.1k-1/.self/develop/lib -lssl -lcrypto
wcawijngaards commented 3 years ago

You need to pass the configure option ./configure --with-ssl=/packages/openssl-1.1.1k-1/.self/develop

This is because the configure script then appends include and lib for those parts it needs.

pkg-config is not something that we need as a build dependency. Because then it is harder to build the software. But I see from pkg-config output that you pasted that the headers are in headers and not in the include directory. That is going to be hard to configure. Maybe edit the Makefile after running configure, or pass CFLAGS and LDFLAGS and LIBS on the commandline to configure with the settings that you want.