[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.
* 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 INIPARSERLIBS and INIPARSERFLAGS to know how to link  to the lib and build things that depends on it
* Modify configure.ac to include ../lib/iniparser/config.m4 so that thoses rules are parsed by autoconf
---
 lib/iniparser/config.m4 |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 nsswitch/config.m4      |   20 ++++++++++++++++++++
 source4/configure.ac    |    1 +
 3 files changed, 67 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..fe46261
--- /dev/null
+++ b/lib/iniparser/config.m4
@@ -0,0 +1,46 @@
+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(iniparser, 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)
+  INIPARSERLIBS=""
+  INIPARSERCFLAGS="-I$srcdir/$iniparserdir/src"
+
+  SMB_SUBSYSTEM(INIPARSER,[$srcdir/$iniparserdir/../iniparser_build/iniparser.o $srcdir/$iniparserdir/../iniparser_build/dictionary.o $srcdir/$iniparserdir/../iniparser_build/strlib.o],[],"$INIPARSERCFLAGS")
+else
+  AC_MSG_RESULT(no)
+  BUILD_INIPARSER=""
+  INIPARSERLIBS="-liniparser"
+  INIPARSERCFLAGS=""
+fi
+AC_SUBST(BUILD_INIPARSER)
+AC_SUBST(INIPARSERLIBS)
+AC_SUBST(INIPARSERCFLAGS)
+
diff --git a/nsswitch/config.m4 b/nsswitch/config.m4
index 680ee5d..108fa67 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,22 @@ case "$host_os" in
 	*)
 	;;
 esac
+#####
+
+#####
+AC_CHECK_HEADERS(pam/pam_appl.h security/pam_appl.h)
+AC_CHECK_LIB_EXT(pam, PAM_LIBS, pam_get_data)
+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
+  ]])
+SMB_BUILD_LIBRARY(pam_winbind,
+			    [../nsswitch/pam_winbind.o \$(INIPARSER_OBJ_FILES)],
+			    [LIBWBCLIENT LIBWINBIND-CLIENT],-DLOCALEDIR=\\\"${datarootdir}/locale\\\" -I../locale/include \$(INIPARSERCFLAGS),\$(INIPARSERLIBS))
+
+
+#####
diff --git a/source4/configure.ac b/source4/configure.ac
index eab1be6..e25059f 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -131,6 +131,7 @@ m4_include(auth/config.m4)
 m4_include(kdc/config.m4)
 m4_include(ntvfs/sysdep/config.m4)
 m4_include(../nsswitch/config.m4)
+m4_include(../lib/iniparser/config.m4)
 
 #################################################
 # add *_CFLAGS only for the real build
-- 
1.6.3.3


--------------070605080501020900040406--


More information about the samba-technical mailing list