]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Add LDAP lib detection to configure
authorRadoslaw Korzeniewski <radekk@inteos.pl>
Thu, 24 Sep 2020 15:00:46 +0000 (17:00 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:57 +0000 (09:02 +0100)
bacula/autoconf/config.h.in
bacula/autoconf/configure.in

index 3be2873d49e6fd178388a83a59b2cf3b30da1b2c..5b057b119701c08a65c7b3f01df6e13ee36a6b90 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (C) 2000-2020 Kern Sibbald
  * License: BSD 2-Clause; see file LICENSE-FOSS
  */
-   
+
 /* Define if you want to use MySQL as Catalog database */
 #undef USE_MYSQL_DB
 
 #undef HAVE_U_INT64_T
 #undef HAVE_INTMAX_T
 #undef HAVE_U_INTMAX_T
+
 /* Define if you want TCP Wrappers support */
 #undef HAVE_LIBWRAP
 
 /* Define if you have sys/bitypes.h */
 #undef HAVE_SYS_BITYPES_H
+
 /* Directory for PID files */
 #undef _PATH_BACULA_PIDDIR
 
 #undef lld
 #undef llu
 
-#undef HAVE_READLINE 
+#undef HAVE_READLINE
 
 #undef HAVE_GMP
 
 
 #undef HAVE_OLD_SOCKOPT
 #undef USE_THR_SETCONCURRENCY
+
 /* Defined if Gtk+-2.4 or greater is present */
 #undef HAVE_GTK_2_4
 
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H
 
+/* Define to 1 if you have working ldap libraries */
+#undef HAVE_LDAP
+
+/* Define to 1 if you have ldap_start_tls() in ldap libraries */
+#undef HAVE_LDAP_START_TLS
+
 /* Define to 1 if you have the `__argz_count' function. */
 #undef HAVE___ARGZ_COUNT
 
index 8fffc1f2218f502dc26c4e8c1e3234811070ed81..a780e0b9ccdf181fb5767bf2f023e5d91010f26c 100644 (file)
@@ -210,6 +210,7 @@ if test x$use_libtool != xno; then
    LIBTOOL_CLEAN_TARGET="libtool-clean"
    QMAKE_LIBTOOL="${BUILD_DIR}/libtool"
    FD_PLUGIN_DIR="src/plugins/fd"
+   DIR_PLUGIN_DIR="src/plugins/dir"
    have_plugins=yes
 else
    DEFAULT_OBJECT_TYPE=".o"
@@ -221,6 +222,7 @@ else
    LIBTOOL_CLEAN_TARGET=""
    QMAKE_LIBTOOL="# ${BUILD_DIR}/libtool"
    FD_PLUGIN_DIR=""
+   DIR_PLUGIN_DIR=""
    have_plugins=no
 fi
 
@@ -618,9 +620,19 @@ AC_ARG_ENABLE(build-dird,
 
 DIRD_DIR="src/dird"
 DIR_TOOLS="DIRTOOLS"
+DIR_PLUGIN_DIR="src/plugins/dir"
+
+if test x$build_dird = xyes; then
+   DIRD_DIR="src/dird"
+   DIR_TOOLS="DIRTOOLS"
+else
+   DIRD_DIR=""
+   DIR_TOOLS="NODIRTOOLS"
+fi
 
 AC_SUBST(DIRD_DIR)
 AC_SUBST(DIR_TOOLS)
+AC_SUBST(DIR_PLUGIN_DIR)
 
 dnl -------------------------------------------
 dnl stored  (default on)
@@ -3256,6 +3268,108 @@ fi
 AC_SUBST(FD_PLUGIN_DIR)
 
 dnl
+dnl Check for LDAP libraries
+dnl
+LDAP_LIBS=""
+LDAP_LDFLAGS=""
+LDAP_INC=""
+LDAP_TARGET=""
+LDAP_TARGET_INSTALL=""
+ldap_support=no
+ldap_start_tls_support=no
+AC_ARG_WITH(ldap,
+   AC_HELP_STRING([--with-ldap@<:@=DIR@:>@], [enable LDAP support]),
+   [
+      case "$with_ldap" in
+      no)
+         :
+         ;;
+      yes|*)
+         if test -f ${with_ldap}/include/ldap.h; then
+            LDAP_INC="-I${with_ldap}/include"
+            LDAP_LDFLAGS="-L${with_ldap}/lib"
+            with_ldap="${with_ldap}/include"
+         else
+            with_ldap="/usr/include"
+         fi
+         AC_CHECK_HEADER(${with_ldap}/ldap.h,
+         [
+            AC_DEFINE(HAVE_LDAP, 1, [Define to 1 if you have ldap])
+            AC_CHECK_LIB(ldap, ldap_init,
+               [ AC_CHECK_LIB(lber, ber_bvfree,
+                  [
+                     ldap_support=yes
+                     LDAP_LIBS="-lldap -llber"
+                  ],
+                  [ AC_CHECK_FUNC(ber_bvfree,
+                     [
+                        ldap_support=yes
+                        LDAP_LIBS="-lldap -llber"
+                     ]
+                  )]
+               )], [ AC_CHECK_FUNC(ldap_init) ])
+            AC_CHECK_FUNC(ldap_start_tls,
+               [ ldap_start_tls_support=yes ],
+               [ AC_CHECK_LIB(ldap, ldap_start_tls,
+                  [
+                     ldap_start_tls_support=yes
+                     AC_DEFINE(HAVE_LDAP_START_TLS, 1, [Define to 1 if you have ldap_start_tls])
+                  ])
+               ])
+         ], [ AC_MSG_NOTICE("ldap.h not found. LDAP turned off ...") ])
+         ;;
+      esac
+   ]
+)
+AC_SUBST(LDAP_LDFLAGS)
+AC_SUBST(LDAP_INC)
+AC_SUBST(LDAP_LIBS)
+
+dnl
+
+dnl Enable/Disable plugin support
+dnl
+
+PLUGCONFILES=""
+
+dnl
+dnl Bacula Pluggable Authentication Modules - Director Plugins
+dnl
+
+dnl Director LDAP Auth Plugin
+support_ldap_bpam=auto
+AC_ARG_ENABLE(ldap-bpam,
+   AC_HELP_STRING([--disable-ldap-bpam], [disable LDAP BPAM support @<:@default=auto@:>@]),
+   [
+      if test x$enableval = xyes; then
+         support_ldap_bpam=yes
+      elif test x$enableval = xno; then
+         support_ldap_bpam=disabled
+      fi
+   ]
+)
+if test x$support_ldap_bpam = xyes -o x$support_ldap_bpam = xauto; then
+   if test x$ldap_support = xyes; then
+      support_ldap_bpam=yes
+      BPAM_LDAP_TARGET="ldap-dir.la ldaptest"
+      BPAM_LDAP_TARGET_INSTALL="all install-ldap install-ldaptest"
+   else
+      if test x$support_ldap_bpam = xyes; then
+         AC_MSG_ERROR("Director LDAP Plugin enabled but no required libraries found. Please check for LDAP library support and set a proper --with-ldap=... parameter.")
+      fi
+      support_ldap_bpam=no
+   fi
+fi
+if test x$support_ldap_bpam = xyes; then
+   DIR_PLUGIN_DIR="$DIR_PLUGIN_DIR src/plugins/dir/ldap/src"
+   PLUGCONFILES="${PLUGCONFILES} src/plugins/dir/ldap/src/Makefile"
+fi
+
+AC_SUBST(BPAM_LDAP_TARGET)
+AC_SUBST(BPAM_LDAP_TARGET_INSTALL)
+
+AC_SUBST(DIR_PLUGIN_DIR)
+
 dnl Check for headers, functions and libraries required to support
 dnl keeping readall capabilities
 dnl
@@ -3949,6 +4063,8 @@ Configuration on `date`:
    build-dird:                ${build_dird}
    build-stored:              ${build_stored}
    Plugin support:            ${have_plugins}
+   LDAP support:             ${ldap_support}
+   LDAP StartTLS support:    ${ldap_start_tls_support}
    AFS support:               ${have_afs}
    ACL support:               ${have_acl}
    XATTR support:             ${have_xattr}
@@ -3958,7 +4074,7 @@ Configuration on `date`:
 
    Plugins:
    - Docker:                  ${support_docker}
-
+   - LDAP BPAM:               ${support_ldap_bpam}
   " > config.out
 
 # create a small shell script useful for support with