[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
---
 lib/iniparser/config.m4 |   40 ++++++++++++++++++++++++++++++++++++++++
 nsswitch/config.m4      |   24 ++++++++++++++++++++++++
 source4/configure.ac    |    1 +
 3 files changed, 65 insertions(+), 0 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..39b2f08
--- /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, iniparser_load,
+    INCLUDED_INIPARSER=no, INCLUDED_INIPARSER=yes)
+fi
+
+AC_MSG_CHECKING(whether to use included iniparser)
+if test x"$INCLUDED_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"
+      AC_SUBST(iniparserdir)
+      break;
+    fi
+  done
+  if test x"$iniparserdir" = "x"; then
+     AC_MSG_ERROR([cannot find iniparser source in $iniparserpaths])
+  fi
+  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..ef5d5f6 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,26 @@ case "$host_os" in
 	*)
 	;;
 esac
+#####
+
+#####
+AC_CHECK_HEADERS(security/pam_appl.h)
+AC_CHECK_LIB_EXT(pam, PAM_LIBS, pam_start)
+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],-DLOCALEDIR=\\\"${datarootdir}/locale\\\" )
+fi
+
+
+
+#####
diff --git a/source4/configure.ac b/source4/configure.ac
index eab1be6..6c5f6fd 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -130,6 +130,7 @@ m4_include(../lib/uid_wrapper/config.m4)
 m4_include(auth/config.m4)
 m4_include(kdc/config.m4)
 m4_include(ntvfs/sysdep/config.m4)
+m4_include(../lib/iniparser/config.m4)
 m4_include(../nsswitch/config.m4)
 
 #################################################
-- 
1.6.3.3


--------------050305040403020304050702--


More information about the samba-technical mailing list