Merge branch '1533_german_date_broken'
[midnight-commander.git] / m4.include / mc-mcserver.m4
blobff59982e8dc41c8565a0164a8e5b03c4254f2cb6
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 support
11     dnl
12     AC_ARG_ENABLE([mcserver],
13         [  --enable-mcserver       Support mc-specific networking file system server [[no]]],
14         [if test "x$enableval" != "xno"; then
15             AC_DEFINE(ENABLE_MCSERVER, 1, [Define to enable mc-specific networking file system server])
16             AC_MC_VFS_ADDNAME([mcfs])
17             enable_mcserver=yes
18         fi]
19       )
21     if test x"$enable_mcserver" = "xyes"; then
22         AC_MC_VFS_MCFS_SET
24         dnl Check if PAM can be used for mcserv
25         AC_CHECK_LIB(dl, dlopen, [LIB_DL="-ldl"])
26         AC_CHECK_LIB(pam, pam_start, [
27             AC_DEFINE(HAVE_PAM, 1,
28                   [Define if PAM (Pluggable Authentication Modules) is available])
29             MCSERVLIBS="-lpam $LIB_DL"
30             mcserv_pam=yes], [], [$LIB_DL])
32         dnl Check for crypt() - needed for both /etc/shadow and /etc/passwd.
33         if test x"$mcserv_pam" = x; then
35             dnl Check for pwdauth() - used on SunOS.
36             AC_CHECK_FUNCS([pwdauth])
38             dnl Check for crypt()
39             AC_CHECK_HEADERS([crypt.h], [crypt_header=yes])
40             if test -n "$crypt_header"; then
41                 save_LIBS="$LIBS"
42                 LIBS=
43                 AC_SEARCH_LIBS(crypt, [crypt crypt_i], [mcserv_auth=crypt])
44                 MCSERVLIBS="$LIBS"
45                 LIBS="$save_LIBS"
46                 if test -n "$mcserv_auth"; then
47                     AC_DEFINE(HAVE_CRYPT, 1,
48                           [Define to use crypt function in mcserv])
50                     dnl Check for shadow passwords
51                     AC_CHECK_HEADERS([shadow.h shadow/shadow.h],
52                                  [shadow_header=yes; break])
53                     if test -n "$shadow_header"; then
54                         save_LIBS="$LIBS"
55                         LIBS="$MCSERVLIBS"
56                         AC_SEARCH_LIBS(getspnam, [shadow], [mcserv_auth=shadow])
57                         MCSERVLIBS="$LIBS"
58                         LIBS="$save_LIBS"
59                         if test -n "$mcserv_auth"; then
60                             AC_DEFINE(HAVE_SHADOW, 1,
61                                   [Define to use shadow passwords for mcserv])
62                         fi
63                     fi
64                 fi
65             fi
66         fi
67     fi
68     AC_SUBST(MCSERVLIBS)