]> granicus.if.org Git - pdns/commitdiff
Move ldap check to separate macro
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 6 Jan 2014 13:07:25 +0000 (14:07 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 6 Jan 2014 13:27:09 +0000 (14:27 +0100)
configure.ac
m4/pdns_check_ldap.m4 [new file with mode: 0644]

index 6c3cd10f18f9caa1b6f3ae7fdc85206fcbe08caa..73b2f3d06e8ce1b9b67b84eda620ded316d160ba 100644 (file)
@@ -261,26 +261,7 @@ do
                        needmysql=yes
                ;;
                ldap)
-                       AC_CHECK_HEADERS([ldap.h], , [AC_MSG_ERROR([ldap header (ldap.h) not found])])
-                       AC_CHECK_HEADERS([lber.h], , [AC_MSG_ERROR([ldap header (lber.h) not found])])
-                       AC_SUBST([LIBLDAP])
-                       AC_CHECK_LIB(
-                               [ldap_r], [ldap_set_option],
-                               [AC_DEFINE([HAVE_LIBLDAP_R], 1, [Have -lldap_r]) LIBLDAP="ldap_r"],
-                               [AC_CHECK_LIB(
-                                       [ldap], [ldap_set_option],
-                                       [AC_DEFINE([HAVE_LIBLDAP], 1, [Have -lldap]) LIBLDAP="ldap"],
-                                       [AC_MSG_ERROR([ldap library (libldap) not found])]
-                               )]
-                       )
-                       AC_CHECK_LIB(
-                               [$LIBLDAP], [ldap_initialize],
-                               [AC_DEFINE([HAVE_LDAP_INITIALIZE], 1, [Define to 1 if you have ldap_initialize])]
-                       )
-                       AC_CHECK_LIB(
-                               [$LIBLDAP], [ldap_sasl_bind],
-                               [AC_DEFINE([HAVE_LDAP_SASL_BIND], 1, [Define to 1 if you have ldap_sasl_bind])]
-                       )
+                       PDNS_CHECK_LDAP
                ;;
                opendbx)
                        AC_CHECK_HEADERS([odbx.h], , [AC_MSG_ERROR([opendbx header (odbx.h) not found])])
diff --git a/m4/pdns_check_ldap.m4 b/m4/pdns_check_ldap.m4
new file mode 100644 (file)
index 0000000..d102277
--- /dev/null
@@ -0,0 +1,36 @@
+AC_DEFUN([PDNS_CHECK_LDAP],[
+  AC_CHECK_HEADERS([ldap.h],
+    [],
+    [AC_MSG_ERROR([ldap header (ldap.h) not found])]
+  )
+
+  AC_CHECK_HEADERS([lber.h],
+    [],
+    [AC_MSG_ERROR([ldap header (lber.h) not found])]
+  )
+  AC_SUBST([LIBLDAP])
+
+  AC_CHECK_LIB([ldap_r], [ldap_set_option],
+    [
+      AC_DEFINE([HAVE_LIBLDAP_R], [1], [Have -lldap_r])
+      LIBLDAP="ldap_r"
+    ],
+    [
+      AC_CHECK_LIB([ldap], [ldap_set_option],
+        [
+          AC_DEFINE([HAVE_LIBLDAP], 1, [Have -lldap])
+          LIBLDAP="ldap"
+        ],
+        [AC_MSG_ERROR([ldap library (libldap) not found])]
+      )
+    ]
+  )
+
+  AC_CHECK_LIB([$LIBLDAP], [ldap_initialize],
+    [AC_DEFINE([HAVE_LDAP_INITIALIZE], 1, [Define to 1 if you have ldap_initialize])]
+  )
+
+  AC_CHECK_LIB([$LIBLDAP], [ldap_sasl_bind],
+    [AC_DEFINE([HAVE_LDAP_SASL_BIND], 1, [Define to 1 if you have ldap_sasl_bind])]
+  )
+])