From 6f3a2f0650fb897d10a3b29dca4810845eaf7028 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 6 May 2011 14:31:30 +0200 Subject: [PATCH] Add support for openldap24 package on RHEL 5.7 --- Makefile.am | 5 +++-- contrib/sssd.spec.in | 8 ++++++++ src/external/ldap.m4 | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 014293d..767e675 100644 --- a/Makefile.am +++ b/Makefile.am @@ -181,6 +181,7 @@ AM_CPPFLAGS = \ $(INI_CONFIG_CFLAGS) \ $(DHASH_CFLAGS) \ $(LIBNL_CFLAGS) \ + $(OPENLDAP_CFLAGS) \ -DLIBDIR=\"$(libdir)\" \ -DVARDIR=\"$(localstatedir)\" \ -DSHLIBEXT=\"$(SHLIBEXT)\" \ @@ -286,8 +287,8 @@ TOOLS_LIBS = \ $(INI_CONFIG_LIBS) \ $(COLLECTION_LIBS) \ $(DHASH_LIBS) \ - $(OPENLDAP_LIBS) \ - $(TDB_LIBS) \ + $(OPENLDAP_LIBS) \ + $(TDB_LIBS) \ libsss_crypt.la if BUILD_SELINUX diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in index d534369..2bd6774 100644 --- a/contrib/sssd.spec.in +++ b/contrib/sssd.spec.in @@ -3,6 +3,10 @@ %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif +%if (0%{?rhel} == 5) +%{!?is_rhel57: %global is_rhel57 %(%{__grep} -c "5\.[^0-6]" /etc/redhat-release)} +%endif + # Determine the location of the LDB modules directory %global ldb_modulesdir %(pkg-config --variable=modulesdir ldb) @@ -57,7 +61,11 @@ BuildRequires: libcollection-devel BuildRequires: libini_config-devel BuildRequires: dbus-devel BuildRequires: dbus-libs +%if 0%{?is_rhel57} > 0 +BuildRequires: openldap24-libs-devel +%else BuildRequires: openldap-devel +%endif BuildRequires: pam-devel BuildRequires: nss-devel BuildRequires: nspr-devel diff --git a/src/external/ldap.m4 b/src/external/ldap.m4 index 87d95fa..b56eb34 100644 --- a/src/external/ldap.m4 +++ b/src/external/ldap.m4 @@ -9,11 +9,31 @@ dnl --------------------------------------------------------------------------- dnl - Check for Mozilla LDAP or OpenLDAP SDK dnl --------------------------------------------------------------------------- +for p in /usr/include/openldap24; do + if test -f "${p}/ldap.h"; then + OPENLDAP_CFLAGS="${OPENLDAP_CFLAGS} -I${p}" + break; + fi +done + +for p in /usr/lib64/openldap24 /usr/lib/openldap24; do + if test -f "${p}/libldap.so"; then + OPENLDAP_LIBS="${OPENLDAP_LIBS} -L${p}" + break; + fi +done + +SAVE_CFLAGS=$CFLAGS +SAVE_LIBS=$LIBS +CFLAGS="$CFLAGS $OPENLDAP_CFLAGS" +LIBS="$LIBS $OPENLDAP_LIBS" AC_CHECK_LIB(ldap, ldap_search, with_ldap=yes) dnl Check for other libraries we need to link with to get the main routines. test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes], , -llber) } test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes with_ldap_krb=yes], , -llber -lkrb) } test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes with_ldap_krb=yes with_ldap_des=yes], , -llber -lkrb -ldes) } +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS dnl Recently, we need -lber even though the main routines are elsewhere, dnl because otherwise be get link errors w.r.t. ber_pvt_opt_on. So just dnl check for that (it's a variable not a fun but that doesn't seem to @@ -38,6 +58,7 @@ else fi AC_SUBST(OPENLDAP_LIBS) +AC_SUBST(OPENLDAP_CFLAGS) SAVE_CFLAGS=$CFLAGS SAVE_LIBS=$LIBS -- 1.7.4.2