configure: fix the -ldl check for openssl, add -lpthread check #1427
The check for if -ldl is needed to build with (a statically built)
Reported-by: Jay Satiro
The check for if -ldl is needed to build with (a statically built) openssl was broken. This repairs the check, and adds a check for -lpthread as well since OpenSSL 1.1.0+ does in fact require -lpthread so only adding -ldl for a static openssl build is no longer enough. Reported-by: Jay Satiro Fixes #1426
jay left a comment
I'm not sure I follow this, it looks like you've changed the -ldl check to only occur when HMAC_Init_ex link fails. Also at this point there may already be -lssl -lcrypto from pkg-config which seems like we could skip these crypto checks then, like in other words imagine
Yes. When building with a static openssl that requires -ldl, trying to link the library to use HMAC_Init_ex fails. The previous (current) way to check for -ldl is pointless since it will fail to detect openssl completely before even considering the -ldl issue.
Maybe, but I would prefer to have the -ldl and -lpthread checks only get tried when it fails without those libs and I only want to add those specific libs to try to fix the build and not make conclusions or guesses about the other libs that are used or not used.
Hence the flow with this patch goes like this:
I've tested this with a static openssl from their git master and with this fix, it works without any custom LIBS set, but without this patch it will fail to detect a static only openssl completely.