commit 1d9542df5d2ae5c21a1e96d100f899b3d7b2f27c Author: Jan Kara Date: Tue Jan 19 11:40:15 2016 +0100 Don't link all binaries with ldap library The default action-if-found of AC_CHECK_LIB() is to append checked library to LIBS. Thus check for ldap library resulted in unwanted addition of -lldap to LIBS as [] is an empty string in M4 and the default action is used. Fix the problem by providing proper action-if-found which was currently just hidden behind the check. Also do similar cleanup for AC_CHECK_HEADER check although there it didn't have any undesired side-effect. Reported-by: Petr Písař Signed-off-by: Jan Kara diff --git a/configure.ac b/configure.ac index 68d5924..d17b18c 100644 --- a/configure.ac +++ b/configure.ac @@ -72,18 +72,17 @@ AC_ARG_ENABLE([ldapmail], [enable_ldapmail=auto] ) AS_IF([test "x$enable_ldapmail" != "xno"], [ - build_ldap="yes" - AC_CHECK_LIB([ldap], [ldap_initialize], [], [ + AC_CHECK_LIB([ldap], [ldap_initialize], [ + build_ldap="yes" + LDAP_LIBS="-lldap -llber" + AC_DEFINE([USE_LDAP_MAIL_LOOKUP], 1, [Lookup email address using LDAP]) + COMPILE_OPTS="$COMPILE_OPTS USE_LDAP_MAIL_LOOKUP" + ], [ build_ldap="no" AS_IF([test "x$enable_ldapmail" = "xyes"], [ AC_MSG_ERROR([LDAP support required but library not found.]); ]) ]) - AS_IF([test "x$build_ldap" = "xyes"], [ - LDAP_LIBS="-lldap -llber" - AC_DEFINE([USE_LDAP_MAIL_LOOKUP], 1, [Lookup email address using LDAP]) - COMPILE_OPTS="$COMPILE_OPTS USE_LDAP_MAIL_LOOKUP" - ]) ], [ build_ldap="no" ]) @@ -163,8 +162,12 @@ AC_ARG_ENABLE([libwrap], [enable_libwrap=auto] ) AS_IF([test "x$enable_libwrap" != "xno"], [ - build_libwrap="yes" - AC_CHECK_HEADER([tcpd.h],[], [ + AC_CHECK_HEADER([tcpd.h], [ + build_libwrap="yes" + WRAP_LIBS="-lwrap" + AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad]) + COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS" + ], [ build_libwrap="no" AS_IF([test "x$enable_libwrap" = "xyes"] , [ AC_MSG_ERROR([tcpd.h not found and requested]) @@ -172,11 +175,6 @@ AS_IF([test "x$enable_libwrap" != "xno"], [ AC_MSG_WARN([tcpd.h not found]) ]) ]) - AS_IF([test "x$build_libwrap" != "xno"], [ - WRAP_LIBS="-lwrap" - AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad]) - COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS" - ]) ], [ build_libwrap="no" ])