[PATCH] s4: allow pam_winbind.so to be build on samba4
Matthieu Patou
mat at matws.net
Wed Mar 3 01:38:51 MST 2010
* Modify the nsswitch/config.m4 to add tests and build that will be put in configure by the autoconf/autoheader
We test if there is pam headers and pam library to be able to build the pam module
We add s4 build directive (that are normaly in standalone config.mk) this is due to the fact that we need
to rely on path that are guessed during configure.
Add tests not to build pam_winbind if pam dev files is not present
* create ../lib/iniparser/config.m4 to add tests and build options that will be put in configure by the autoconf/autoheader
Propose the choice between using a libiniparser present on the system or use the one bundled in samba source code.
Check for the presence of the bundled in different path (same path as it was in s3)
Define LIBINIPARSER to be included in the dependencies of pam_winbind.so
Done like this to respect the usual way of naming external dependencies
* Modify configure.ac to include ../lib/iniparser/config.m4 so that thoses rules are parsed by autoconf
* Modify auth/config.m4 to move pam tests to nsswitch.m4 so that we tests things in one place
---
lib/iniparser/config.m4 | 40 ++++++++++++++++++++++++++++++++++++++++
nsswitch/config.m4 | 27 +++++++++++++++++++++++++++
source4/auth/config.m4 | 4 ++--
source4/configure.ac | 6 +++++-
4 files changed, 74 insertions(+), 3 deletions(-)
create mode 100644 lib/iniparser/config.m4
diff --git a/lib/iniparser/config.m4 b/lib/iniparser/config.m4
new file mode 100644
index 0000000..96c45a7
--- /dev/null
+++ b/lib/iniparser/config.m4
@@ -0,0 +1,40 @@
+AC_ARG_WITH(included-iniparser,
+[AS_HELP_STRING([--with-included-iniparser], [use bundled iniparser library, not from system])],
+[
+ case "$withval" in
+ yes)
+ INCLUDED_INIPARSER=yes
+ ;;
+ no)
+ INCLUDED_INIPARSER=no
+ ;;
+ esac ],
+)
+if test x"$INCLUDED_INIPARSER" != x"yes"; then
+ AC_CHECK_LIB_EXT(iniparser, LIBINIPARSER_LIBS, iniparser_load)
+
+fi
+
+AC_MSG_CHECKING(whether to use included iniparser)
+if test x"$ac_cv_lib_ext_iniparser" != x"yes"; then
+
+ iniparserpaths=". lib/iniparser iniparser ../iniparser ../lib/iniparser"
+ for d in $iniparserpaths; do
+ if test -f "$srcdir/$d/src/iniparser.c"; then
+ iniparserdir="$d"
+ break;
+ fi
+ done
+ if test x"$iniparserdir" = "x"; then
+ AC_MSG_ERROR([cannot find iniparser source in $iniparserpaths])
+ fi
+ INIPARSERCFLAGS="-I$srcdir/$iniparserdir/src"
+ AC_MSG_RESULT(yes)
+
+ SMB_SUBSYSTEM(LIBINIPARSER,[$srcdir/$iniparserdir/../iniparser_build/iniparser.o $srcdir/$iniparserdir/../iniparser_build/dictionary.o $srcdir/$iniparserdir/../iniparser_build/strlib.o],[],"$INIPARSERCFLAGS")
+else
+ AC_MSG_RESULT(no)
+ SMB_EXT_LIB(LIBINIPARSER,,,,${LIBINIPARSER_LIBS})
+ SMB_ENABLE(LIBINIPARSER,YES)
+fi
+
diff --git a/nsswitch/config.m4 b/nsswitch/config.m4
index 680ee5d..e2c4491 100644
--- a/nsswitch/config.m4
+++ b/nsswitch/config.m4
@@ -1,3 +1,4 @@
+######
AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h )
case "$host_os" in
@@ -9,3 +10,29 @@ case "$host_os" in
*)
;;
esac
+#####
+
+#####
+#All the pam requirement tests are regrouped here
+#It is mandatory not to remove them otherwise it will break badly the source4/auth part
+AC_CHECK_HEADERS(security/pam_appl.h)
+AC_CHECK_LIB_EXT(pam, PAM_LIBS, pam_start)
+# This part is need for the compilation
+AC_CHECK_HEADERS(security/pam_modules.h pam/pam_modules.h,,,[[
+ #if HAVE_SECURITY_PAM_APPL_H
+ #include <security/pam_appl.h>
+ #endif
+ #if HAVE_PAM_PAM_APPL_H
+ #include <pam/pam_appl.h>
+ #endif
+ ]])
+
+if test x"$ac_cv_header_security_pam_appl_h" = x"yes" -a x"$ac_cv_lib_ext_pam_pam_start" = x"yes";then
+ SMB_BUILD_LIBRARY(pam_winbind,
+ [../nsswitch/pam_winbind.o ],
+ [LIBWBCLIENT LIBWINBIND-CLIENT LIBINIPARSER PAM],-DLOCALEDIR=\\\"${datarootdir}/locale\\\" )
+fi
+
+
+
+#####
diff --git a/source4/auth/config.m4 b/source4/auth/config.m4
index 9735b17..b6cedf4 100644
--- a/source4/auth/config.m4
+++ b/source4/auth/config.m4
@@ -1,8 +1,8 @@
###############################
# start SMB_EXT_LIB_PAM
# check for security/pam_appl.h and -lpam
-AC_CHECK_HEADERS(security/pam_appl.h)
-AC_CHECK_LIB_EXT(pam, PAM_LIBS, pam_start)
+# Tests are now moved in ../nsswitch/config.m4 because winbind stuff require more pam tests
+# and it has been decided to regroup them there
if test x"$ac_cv_header_security_pam_appl_h" = x"yes" -a x"$ac_cv_lib_ext_pam_pam_start" = x"yes";then
SMB_ENABLE(PAM,YES)
fi
diff --git a/source4/configure.ac b/source4/configure.ac
index eab1be6..5b7a482 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -127,10 +127,14 @@ m4_include(ntvfs/unixuid/config.m4)
m4_include(../lib/socket_wrapper/config.m4)
m4_include(../lib/nss_wrapper/config.m4)
m4_include(../lib/uid_wrapper/config.m4)
+dnl nsswitch must be before auth as it sets some variable
+dnl tested by auth/config.m4, libiiniparser must be even before
+dnl because nsswitch depend also on it
+m4_include(../lib/iniparser/config.m4)
+m4_include(../nsswitch/config.m4)
m4_include(auth/config.m4)
m4_include(kdc/config.m4)
m4_include(ntvfs/sysdep/config.m4)
-m4_include(../nsswitch/config.m4)
#################################################
# add *_CFLAGS only for the real build
--
1.6.3.3
--------------020005090508020100030702--
More information about the samba-technical
mailing list