From 01072fc8f2833e9316f534875c75714803384377 Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Oct 18 2016 08:47:59 +0000 Subject: Build: modernize crypto library detection Use package config instead of checking headers. Package config is faster because it does not invoke compiler and guarantees proper linking flags because these are provided by package maintainer instead of hardcoded into build system. Reviewed-By: Martin Basti Reviewed-By: Alexander Bokovoy --- diff --git a/daemons/configure.ac b/daemons/configure.ac index 34773f9..958f01c 100644 --- a/daemons/configure.ac +++ b/daemons/configure.ac @@ -125,12 +125,7 @@ AC_SUBST(LDAP_LIBS) dnl --------------------------------------------------------------------------- dnl - Check for OpenSSL Crypto library dnl --------------------------------------------------------------------------- -dnl This is a very simple check, we should probably check also for MD4_Init and -dnl probably also the version we are using is recent enough -SSL_LIBS= -AC_CHECK_HEADER(openssl/md4.h, [], [AC_MSG_ERROR([openssl/md4.h not found])]) -AC_CHECK_LIB(crypto, MD4_Init, [SSL_LIBS="-lcrypto"]) -AC_SUBST(SSL_LIBS) +PKG_CHECK_MODULES([CRYPTO], [libcrypto], [], [AC_MSG_ERROR([libcrypto not found])]) dnl --------------------------------------------------------------------------- dnl - Check for UUID library @@ -381,6 +376,6 @@ echo " LDAP libs: ${LDAP_LIBS} KRB5 libs: ${KRB5_LIBS} KRAD libs: ${KRAD_LIBS} - OpenSSL libs: ${SSL_LIBS} + OpenSSL crypto libs: ${CRYPTO_LIBS} Maintainer mode: ${USE_MAINTAINER_MODE} " diff --git a/daemons/ipa-sam/Makefile.am b/daemons/ipa-sam/Makefile.am index ea14661..c321493 100644 --- a/daemons/ipa-sam/Makefile.am +++ b/daemons/ipa-sam/Makefile.am @@ -23,6 +23,7 @@ AM_CPPFLAGS = \ -DLDAPIDIR=\""$(localstatedir)/run"\" \ -DHAVE_LDAP \ -I $(KRB5_UTIL_DIR) \ + $(CRYPTO_CFLAGS) \ $(LDAP_CFLAGS) \ $(KRB5_CFLAGS) \ $(WARN_CFLAGS) \ @@ -48,10 +49,10 @@ ipasam_la_LDFLAGS = \ $(NULL) ipasam_la_LIBADD = \ + $(CRYPTO_LIBS) \ $(LDAP_LIBS) \ $(KRB5_LIBS) \ $(TALLOC_LIBS) \ - $(SSL_LIBS) \ $(SAMBAUTIL_LIBS) \ $(NDR_LIBS) \ $(SAMBA40EXTRA_LIBS) \ diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am b/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am index 46a6491..048e8bd 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am @@ -19,16 +19,16 @@ AM_CPPFLAGS = \ -DLIBDIR=\""$(libdir)"\" \ -DLIBEXECDIR=\""$(libexecdir)"\" \ -DDATADIR=\""$(datadir)"\" \ + $(CRYPTO_CFLAGS) \ $(LDAP_CFLAGS) \ $(KRB5_CFLAGS) \ - $(SSL_CFLAGS) \ $(NSS_CFLAGS) \ $(WARN_CFLAGS) \ $(NULL) AM_LDFLAGS = \ + $(CRYPTO_LIBS) \ $(KRB5_LIBS) \ - $(SSL_LIBS) \ $(LDAP_LIBS) \ $(NSPR_LIBS) \ $(NSS_LIBS) \