Merge branch '2067_ruler'
[kaloumi3.git] / m4.include / mc-mcserver.m4
blob6fd02bc3d72ceba3bb0cfd3db1d0b6fadea2b0b8
1 dnl MC_MCSERVER_CHECKS
2 dnl    Check how mcserver should check passwords.
3 dnl    Possible methods are PAM, pwdauth and crypt.
4 dnl    The later works with both /etc/shadow and /etc/passwd.
5 dnl    If PAM is found, other methods are not checked.
7 AC_DEFUN([MC_MCSERVER_CHECKS], [
9     dnl
10     dnl mcfs server support
11     dnl
12     AC_ARG_ENABLE([mcserver],
13         [  --enable-mcserver       Support mc-specific networking file system server [[no]]],
14         [enable_mcserver="$enableval"]
15       )
17     if test x"$enable_mcserver" = "xyes"; then
18         AC_DEFINE(ENABLE_MCSERVER, 1, [Define to enable mc-specific networking file system server])
19         AC_REQUIRE_SOCKET
20         AC_CHECK_RPC
21         use_net_code=true
23         dnl Check if PAM can be used for mcserv
24         AC_CHECK_LIB(dl, dlopen, [LIB_DL="-ldl"])
25         AC_CHECK_LIB(pam, pam_start, [
26             AC_DEFINE(HAVE_PAM, 1,
27                   [Define if PAM (Pluggable Authentication Modules) is available])
28             MCSERVLIBS="-lpam $LIB_DL"
29             mcserv_pam=yes], [], [$LIB_DL])
31         dnl Check for crypt() - needed for both /etc/shadow and /etc/passwd.
32         if test x"$mcserv_pam" = x; then
34             dnl Check for pwdauth() - used on SunOS.
35             AC_CHECK_FUNCS([pwdauth])
37             dnl Check for crypt()
38             AC_CHECK_HEADERS([crypt.h], [crypt_header=yes])
39             if test -n "$crypt_header"; then
40                 save_LIBS="$LIBS"
41                 LIBS=
42                 AC_SEARCH_LIBS(crypt, [crypt crypt_i], [mcserv_auth=crypt])
43                 MCSERVLIBS="$LIBS"
44                 LIBS="$save_LIBS"
45                 if test -n "$mcserv_auth"; then
46                     AC_DEFINE(HAVE_CRYPT, 1,
47                           [Define to use crypt function in mcserv])
49                     dnl Check for shadow passwords
50                     AC_CHECK_HEADERS([shadow.h shadow/shadow.h],
51                                  [shadow_header=yes; break])
52                     if test -n "$shadow_header"; then
53                         save_LIBS="$LIBS"
54                         LIBS="$MCSERVLIBS"
55                         AC_SEARCH_LIBS(getspnam, [shadow], [mcserv_auth=shadow])
56                         MCSERVLIBS="$LIBS"
57                         LIBS="$save_LIBS"
58                         if test -n "$mcserv_auth"; then
59                             AC_DEFINE(HAVE_SHADOW, 1,
60                                   [Define to use shadow passwords for mcserv])
61                         fi
62                     fi
63                 fi
64             fi
65         fi
66     fi
67     AM_CONDITIONAL(ENABLE_MCSERVER, [test x"$enable_mcserver" = "xyes"])
68     AC_SUBST(MCSERVLIBS)