[SSSD] [PATCH] BUILD: Make samba4 libraries optional

Lukas Slebodnik lslebodn at redhat.com
Thu May 8 21:12:56 UTC 2014


ehlo,

Samba 4 libraries are necessary for building {ad, ipa} provider,
but samba4 needn't be available on older distributions.
This patch add possibility to build SSSD without {ad, ipa} provider
and thus without Samba 4 libraries.
The script configure have new argument --with-samba with default value yes.

How to test this patch on fedora >=19 ?
--remove package samba-devel
--run configure script with argument "--with-samba"

The other option is to build srpm with mock/koji with small change in spec.
   --sssd should be build without libsss_{ipa,ad}.so and pac plugin
   --all test shoudl pass
   --there will be error athe end of mock build with
RPM build errors:
    File not found: ....

diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in
index 9292451..88f5994 100644
--- a/contrib/sssd.spec.in
+++ b/contrib/sssd.spec.in
@@ -126,11 +126,6 @@ BuildRequires: libnl3-devel
 BuildRequires: libnl-devel
 %endif
 
-# RHEL 5 is too old to support samba4 and the PAC responder
-%if !0%{?is_rhel5}
-BuildRequires: samba4-devel
-%endif
-
 %description
 Provides a set of daemons to manage access to remote directories and
 authentication mechanisms. It provides an NSS and PAM interface toward
@@ -402,6 +397,7 @@ autoreconf -ivf
     --with-pipe-path=%{pipepath} \
     --with-pubconf-path=%{pubconfpath} \
     --with-init-dir=%{_initrddir} \
+    --without-samba \
     --with-krb5-rcache-dir=%{_localstatedir}/cache/krb5rcache \
     --enable-nsslibdir=/%{_lib} \
     --enable-pammoddir=/%{_lib}/security \


Attached are patches for master and 1.11 branch. There was conflict in
conf_macros.m4 and configure.ac

LS
-------------- next part --------------
>From da166b55acddce55782601855a8468794fdefa8b Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 4 Mar 2014 16:40:36 +0100
Subject: [PATCH 1/4] BUILD: Make samba4 libraries optional

Samba 4 libraries are necessary for building {ad, ipa} provider,
but samba4 needn't be available on older distributions.
This patch add possibility to build SSSD without {ad, ipa} provider
and thus without Samba 4 libraries.
The script configure have new argument --with-samba with default value yes.
---
 Makefile.am                |  8 ++++++--
 configure.ac               |  1 +
 src/conf_macros.m4         | 16 ++++++++++++++++
 src/external/libndr_nbt.m4 | 11 +++++++++--
 src/tests/dlopen-tests.c   |  2 ++
 5 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4f9c11f47ce49751e585a174b15d8f30d14e1877..62e10a66aa3a31876dd7baf76089126357b95bea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -202,10 +202,14 @@ sssdlib_LTLIBRARIES = \
     libsss_ldap.la \
     libsss_krb5.la \
     libsss_proxy.la \
-    libsss_ipa.la \
-    libsss_ad.la \
     libsss_simple.la
 
+if BUILD_SAMBA
+sssdlib_LTLIBRARIES += \
+    libsss_ipa.la \
+    libsss_ad.la
+endif
+
 ldblib_LTLIBRARIES = \
     memberof.la
 
diff --git a/configure.ac b/configure.ac
index eb7e376a07c1984c53d5714aac06564908a0a8d6..5395360a1dcc4e079a5c45bf8d744121f2280704 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,6 +127,7 @@ WITH_SSH
 WITH_IFP
 WITH_CRYPTO
 WITH_SYSLOG
+WITH_SAMBA
 
 m4_include([src/external/pkg.m4])
 m4_include([src/external/libpopt.m4])
diff --git a/src/conf_macros.m4 b/src/conf_macros.m4
index 1c316266886051e4841d3eef4c3e594ea7ccd144..2c834031958e261689a84db6662cd108eb1eada3 100644
--- a/src/conf_macros.m4
+++ b/src/conf_macros.m4
@@ -651,3 +651,19 @@ AC_DEFUN([WITH_IFP],
     fi
     AM_CONDITIONAL([BUILD_IFP], [test x"$with_infopipe" = xyes])
   ])
+
+AC_DEFUN([WITH_SAMBA],
+  [ AC_ARG_WITH([samba],
+                [AC_HELP_STRING([--with-samba],
+                                [Whether to build with samba4 libraries [yes]]
+                               )
+                ],
+                [with_samba=$withval],
+                [with_samba=yes]
+               )
+
+    if test x"$with_samba" = xyes; then
+        AC_DEFINE(BUILD_SAMBA, 1, [whether to build with samba support])
+    fi
+    AM_CONDITIONAL([BUILD_SAMBA], [test x"$with_samba" = xyes])
+  ])
diff --git a/src/external/libndr_nbt.m4 b/src/external/libndr_nbt.m4
index d4d94f2d608454e1df855ab2d2c8396189c0d428..bb4f89f13b119a0eeb95d9304386d1d2f65e6bfa 100644
--- a/src/external/libndr_nbt.m4
+++ b/src/external/libndr_nbt.m4
@@ -1,5 +1,12 @@
 AC_SUBST(NDR_NBT_CFLAGS)
 AC_SUBST(NDR_NBT_LIBS)
 
-PKG_CHECK_MODULES(NDR_NBT, ndr_nbt, ,
-                  AC_MSG_ERROR("Please install Samba 4 development libraries"))
\ No newline at end of file
+if test x"$with_samba" = xyes; then
+    PKG_CHECK_MODULES(NDR_NBT, ndr_nbt, ,
+        AC_MSG_ERROR([[Please install Samba 4 development libraries.
+Samba 4 libraries are necessary for building ad and ipa provider.
+If you do not want to build these providers it is possible to build SSSD
+without them. In this case, you will need to execute configure script
+with argument --without-samba
+    ]]))
+fi
diff --git a/src/tests/dlopen-tests.c b/src/tests/dlopen-tests.c
index 7a218c70ad5ccc640388ac6b933299ceaae384ca..afc70131e554ac91cf8575acf5c05c56716e2a27 100644
--- a/src/tests/dlopen-tests.c
+++ b/src/tests/dlopen-tests.c
@@ -74,10 +74,12 @@ struct so {
                            LIBPFX"libsss_util.so", NULL } },
     { "libsss_simple.so", { LIBPFX"libdlopen_test_providers.so",
                             LIBPFX"libsss_simple.so", NULL } },
+#ifdef BUILD_SAMBA
     { "libsss_ad.so", { LIBPFX"libdlopen_test_providers.so",
                         LIBPFX"libsss_ad.so", NULL } },
     { "libsss_ipa.so", { LIBPFX"libdlopen_test_providers.so",
                          LIBPFX"libsss_ipa.so", NULL } },
+#endif /* BUILD_SAMBA */
     { "libsss_krb5.so", { LIBPFX"libdlopen_test_providers.so",
                           LIBPFX"libsss_krb5.so", NULL } },
     { "libsss_krb5_common.so", { LIBPFX"libdlopen_test_providers.so",
-- 
1.9.0

-------------- next part --------------
>From 3861d69213207d29c4e891c6dca2c4b3b240ba26 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 4 Mar 2014 16:40:36 +0100
Subject: [PATCH] BUILD: Make samba4 libraries optional

Samba 4 libraries are necessary for building {ad, ipa} provider,
but samba4 needn't be available on older distributions.
This patch add possibility to build SSSD without {ad, ipa} provider
and thus without Samba 4 libraries.
The script configure have new argument --with-samba with default value yes.
---
 Makefile.am                |  8 ++++++--
 configure.ac               |  1 +
 src/conf_macros.m4         | 16 ++++++++++++++++
 src/external/libndr_nbt.m4 | 11 +++++++++--
 src/tests/dlopen-tests.c   |  2 ++
 5 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index cbd549a7731a582753843bc7ab21ad825e4b0056..154bf38a437d8c8024a992cb980ea61c6b8a9fe6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -181,10 +181,14 @@ sssdlib_LTLIBRARIES = \
     libsss_ldap.la \
     libsss_krb5.la \
     libsss_proxy.la \
-    libsss_ipa.la \
-    libsss_ad.la \
     libsss_simple.la
 
+if BUILD_SAMBA
+sssdlib_LTLIBRARIES += \
+    libsss_ipa.la \
+    libsss_ad.la
+endif
+
 ldblib_LTLIBRARIES = \
     memberof.la
 
diff --git a/configure.ac b/configure.ac
index b7601317d7788d69519691385c6407945e54de24..57829b7c82dd9622ec0fa96479cdd8f4ff9a3bbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,7 @@ WITH_SUDO_LIB_PATH
 WITH_AUTOFS
 WITH_SSH
 WITH_CRYPTO
+WITH_SAMBA
 
 m4_include([src/external/pkg.m4])
 m4_include([src/external/libpopt.m4])
diff --git a/src/conf_macros.m4 b/src/conf_macros.m4
index b4db0b4a2b34e69734402f2f4a4c2ccadbf94fb8..554e303b6879eb8c7caa879b8ea2c70f8747c051 100644
--- a/src/conf_macros.m4
+++ b/src/conf_macros.m4
@@ -592,3 +592,19 @@ AC_DEFUN([WITH_SSH],
     fi
     AM_CONDITIONAL([BUILD_SSH], [test x"$with_ssh" = xyes])
   ])
+
+AC_DEFUN([WITH_SAMBA],
+  [ AC_ARG_WITH([samba],
+                [AC_HELP_STRING([--with-samba],
+                                [Whether to build with samba4 libraries [yes]]
+                               )
+                ],
+                [with_samba=$withval],
+                [with_samba=yes]
+               )
+
+    if test x"$with_samba" = xyes; then
+        AC_DEFINE(BUILD_SAMBA, 1, [whether to build with samba support])
+    fi
+    AM_CONDITIONAL([BUILD_SAMBA], [test x"$with_samba" = xyes])
+  ])
diff --git a/src/external/libndr_nbt.m4 b/src/external/libndr_nbt.m4
index d4d94f2d608454e1df855ab2d2c8396189c0d428..bb4f89f13b119a0eeb95d9304386d1d2f65e6bfa 100644
--- a/src/external/libndr_nbt.m4
+++ b/src/external/libndr_nbt.m4
@@ -1,5 +1,12 @@
 AC_SUBST(NDR_NBT_CFLAGS)
 AC_SUBST(NDR_NBT_LIBS)
 
-PKG_CHECK_MODULES(NDR_NBT, ndr_nbt, ,
-                  AC_MSG_ERROR("Please install Samba 4 development libraries"))
\ No newline at end of file
+if test x"$with_samba" = xyes; then
+    PKG_CHECK_MODULES(NDR_NBT, ndr_nbt, ,
+        AC_MSG_ERROR([[Please install Samba 4 development libraries.
+Samba 4 libraries are necessary for building ad and ipa provider.
+If you do not want to build these providers it is possible to build SSSD
+without them. In this case, you will need to execute configure script
+with argument --without-samba
+    ]]))
+fi
diff --git a/src/tests/dlopen-tests.c b/src/tests/dlopen-tests.c
index 71b79f9e221a21eae9a1b5b92fe94de544d43f15..d80f0b1bcc4bdfb53060ee9e5c336d5abc6ca09c 100644
--- a/src/tests/dlopen-tests.c
+++ b/src/tests/dlopen-tests.c
@@ -71,10 +71,12 @@ struct so {
                            LIBPFX"libsss_util.so", NULL } },
     { "libsss_simple.so", { LIBPFX"libdlopen_test_providers.so",
                             LIBPFX"libsss_simple.so", NULL } },
+#ifdef BUILD_SAMBA
     { "libsss_ad.so", { LIBPFX"libdlopen_test_providers.so",
                         LIBPFX"libsss_ad.so", NULL } },
     { "libsss_ipa.so", { LIBPFX"libdlopen_test_providers.so",
                          LIBPFX"libsss_ipa.so", NULL } },
+#endif /* BUILD_SAMBA */
     { "libsss_krb5.so", { LIBPFX"libdlopen_test_providers.so",
                           LIBPFX"libsss_krb5.so", NULL } },
     { "libsss_ldap.so", { LIBPFX"libdlopen_test_providers.so",
-- 
1.9.0



More information about the sssd-devel mailing list