File: x_ac_pam.m4

package info (click to toggle)
slurm-wlm 24.11.5-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 51,508 kB
  • sloc: ansic: 529,598; exp: 64,795; python: 17,051; sh: 10,365; javascript: 6,528; makefile: 4,116; perl: 3,762; pascal: 131
file content (78 lines) | stat: -rw-r--r-- 2,058 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
##*****************************************************************************
#  AUTHOR:
#    Morris Jette <jette1@llnl.gov>
#
#  SYNOPSIS:
#    X_AC_PAM
#
#  DESCRIPTION:
#    Test for PAM (Pluggable Authentication Module) support.
#
#  WARNINGS:
#    This macro must be placed after AC_PROG_CC or equivalent.
##*****************************************************************************

AC_DEFUN([X_AC_PAM], [
  AC_MSG_CHECKING([whether to enable PAM support])
  AC_ARG_ENABLE(
    [pam],
    AS_HELP_STRING(--enable-pam,enable PAM (Pluggable Authentication Modules) support),
    [ case "$enableval" in
        yes) x_ac_pam=yes ;;
         no) x_ac_pam=no ;;
          *) AC_MSG_RESULT([doh!])
             AC_MSG_ERROR([bad value "$enableval" for --enable-pam]) ;;
      esac
    ],
    [x_ac_pam=yes]
  )

  if test "$x_ac_pam" = yes; then
    AC_MSG_RESULT([yes])
    AC_CHECK_LIB([pam],
        [pam_get_user],
        [ac_have_pam=yes; PAM_LIBS="-lpam"])

    AC_CHECK_LIB([pam_misc],
        [misc_conv],
        [ac_have_pam_misc=yes; PAM_LIBS="$PAM_LIBS -lpam_misc"])

    AC_SUBST(PAM_LIBS)
    if test "x$ac_have_pam" = "xyes" -a "x$ac_have_pam_misc" = "xyes"; then
      AC_DEFINE(HAVE_PAM,, [define if you have the PAM library])
    else
      if test -z "$enable_pam"; then
        AC_MSG_WARN([unable to locate PAM libraries])
      else
        AC_MSG_ERROR([unable to locate PAM libraries])
      fi
    fi
  else
    AC_MSG_RESULT([no])
  fi
  AM_CONDITIONAL(HAVE_PAM,
      test "x$x_ac_pam" = "xyes" -a "x$ac_have_pam" = "xyes" -a "x$ac_have_pam_misc" = "xyes")


  AC_ARG_WITH(pam_dir,
    AS_HELP_STRING(--with-pam_dir=PATH,Specify path to PAM module installation),
    [
	if test -d $withval ; then
	  PAM_DIR="$withval"
	else
	  AC_MSG_ERROR([bad value "$withval" for --with-pam_dir])
	fi
    ],
    [
	if test -d /lib64/security ; then
	  PAM_DIR="/lib64/security"
	else
	  PAM_DIR="/lib/security"
	fi
     ]
  )
  AC_SUBST(PAM_DIR)
  AC_DEFINE_UNQUOTED(PAM_DIR, "$pam_dir", [Define PAM module installation directory.])

])