r174: Win95 registry files (like USER.DAT) can now be partially parsed
[kai/samba.git] / source / nsswitch / config.m4
1 #################################################
2 # Check whether winbind is supported on this platform.  If so we need to
3 # build and install client programs, sbin programs and shared libraries
4
5 AC_MSG_CHECKING(whether to build winbind)
6
7 # Initially, the value of $host_os decides whether winbind is supported
8
9 case "$host_os" in
10         *linux*|*irix*)
11                 HAVE_WINBIND=yes
12                 ;;
13         *solaris*)
14                 HAVE_WINBIND=yes
15                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
16                 WINBIND_NSS_EXTRA_LIBS="-lsocket"
17                 ;;
18         *hpux11*)
19                 HAVE_WINBIND=yes
20                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
21                 ;;
22         *)
23                 HAVE_WINBIND=no
24                 winbind_no_reason=", unsupported on $host_os"
25                 ;;
26 esac
27
28 AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
29 AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
30
31 # Check the setting of --with-winbindd
32
33 AC_ARG_WITH(winbind,
34 [  --with-winbind          Build winbind (default, if supported by OS)],
35
36   case "$withval" in
37         yes)
38                 HAVE_WINBIND=yes
39                 ;;
40         no)
41                 HAVE_WINBIND=no
42                 winbind_reason=""
43                 ;;
44   esac ],
45 )
46
47 # We need unix domain sockets for winbind
48 if test x"$HAVE_WINBIND" = x"yes"; then
49         if test x"$samba_cv_unixsocket" = x"no"; then
50                 winbind_no_reason=", no unix domain socket support on $host_os"
51                 HAVE_WINBIND=no
52         fi
53 fi
54
55 # Display test results
56
57 if test x"$HAVE_WINBIND" = x"yes"; then
58         AC_MSG_RESULT(yes)
59         AC_DEFINE(WITH_WINBIND,1,[Whether to build winbind])
60
61         EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
62         EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/winbindd\$(EXEEXT)"
63         if test x"$BLDSHARED" = x"true"; then
64                 case "$host_os" in
65                 *irix*)
66                         SHLIB_PROGS="$SHLIB_PROGS nsswitch/libns_winbind.so"
67                         ;;
68                 *)
69                         SHLIB_PROGS="$SHLIB_PROGS nsswitch/libnss_winbind.so"
70                         ;;
71                 esac
72                 if test x"$with_pam" = x"yes"; then
73                         SHLIB_PROGS="$SHLIB_PROGS nsswitch/pam_winbind.so"
74                 fi
75         fi
76 else
77         AC_MSG_RESULT(no$winbind_no_reason)
78 fi
79
80 # Solaris has some extra fields in struct passwd that need to be
81 # initialised otherwise nscd crashes.  Unfortunately autoconf < 2.50
82 # doesn't have the AC_CHECK_MEMBER macro which would be handy for checking
83 # this. 
84
85 #AC_CHECK_MEMBER(struct passwd.pw_comment,
86 #               AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),
87 #               [#include <pwd.h>])
88
89 AC_CACHE_CHECK([whether struct passwd has pw_comment],samba_cv_passwd_pw_comment, [
90     AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_comment;],
91         samba_cv_passwd_pw_comment=yes,samba_cv_passwd_pw_comment=no)])
92 if test x"$samba_cv_passwd_pw_comment" = x"yes"; then
93    AC_DEFINE(HAVE_PASSWD_PW_COMMENT,1,[Whether struct passwd has pw_comment])
94 fi
95
96 #AC_CHECK_MEMBER(struct passwd.pw_age,
97 #               AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),
98 #               [#include <pwd.h>])
99
100 AC_CACHE_CHECK([whether struct passwd has pw_age],samba_cv_passwd_pw_age, [
101     AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_age;],
102         samba_cv_passwd_pw_age=yes,samba_cv_passwd_pw_age=no)])
103 if test x"$samba_cv_passwd_pw_age" = x"yes"; then
104    AC_DEFINE(HAVE_PASSWD_PW_AGE,1,[Whether struct passwd has pw_age])
105 fi