summaryrefslogtreecommitdiff
blob: dbaca69bb7d33cd33d380936d9c1712a20477408 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
commit 1d9542df5d2ae5c21a1e96d100f899b3d7b2f27c
Author: Jan Kara <jack@suse.cz>
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ř <petrp@users.sf.net>
    Signed-off-by: Jan Kara <jack@suse.cz>

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"
 ])