configure: Add --with-pam-dir option for configurable PAM directory

The PAM configuration directory was hardcoded to /etc/pam.d (or
/usr/local/etc/pam.d on FreeBSD), which prevented non-root installations.

This change:
- Adds --with-pam-dir configure option to specify PAM config location
- Defaults to /etc/pam.d for system installs (prefix=/usr or /usr/local)
- Defaults to PREFIX/etc/pam.d for local/user installs
- Updates dtlogin/config/Makefile.am to use the PAM_CONFDIR variable

Examples:
  # User installation (PAM config goes to ~/cde/etc/pam.d)
  ./configure --prefix=$HOME/cde

  # System install with standard PAM location
  ./configure --prefix=/usr  # PAM goes to /etc/pam.d

  # Explicit PAM directory
  ./configure --prefix=/opt/cde --with-pam-dir=/etc/pam.d
This commit is contained in:
Trung Lê 2026-01-29 15:56:55 +11:00
parent f0154141b1
commit 2e0c32e11c
2 changed files with 17 additions and 5 deletions

View File

@ -550,11 +550,25 @@ AM_ICONV
dnl figure out pam support
dnl Right now this only works on linux and netbsd (9.2 tested)
dnl PAM configuration directory - configurable for non-root installs
AC_ARG_WITH([pam-dir],
AS_HELP_STRING([--with-pam-dir=DIR],
[directory for PAM configuration files (default: /etc/pam.d, or PREFIX/etc/pam.d if prefix is not /usr)]),
[PAM_CONFDIR="$withval"],
[if test "x$cde_prefix" = "x/usr" -o "x$cde_prefix" = "x/usr/local"; then
PAM_CONFDIR="/etc/pam.d"
else
PAM_CONFDIR="${cde_prefix}/etc/pam.d"
fi])
AC_SUBST(PAM_CONFDIR)
if test "$supports_pam" = "yes"
then
AC_CHECK_LIB(pam, pam_start,
[SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DHAS_PAM_LIBRARY";
PAMLIB="-lpam"])
PAMLIB="-lpam";
AC_MSG_NOTICE([PAM configuration directory: $PAM_CONFDIR])])
AC_SUBST(PAMLIB)
else
AC_CHECK_LIB(pam, NOTSUPPORTED)

View File

@ -18,18 +18,16 @@ CPP_TARGETS = 0060.dtsysenv Dtlogin Xaccess Xconfig Xconfig.con \
if HAS_PAM_LIBRARY
CPP_TARGETS += dtlogin
dist_pam_DATA = dtlogin
pamdir = $(PAM_CONFDIR)
if FREEBSD
pamdir = /usr/local/etc/pam.d
PAM_AUTHENTICATION_MODULE = /usr/local/lib/security/pam_pwauth_suid.so
AM_CPPFLAGS += -DPAM_AUTHENTICATION_MODULE=$(PAM_AUTHENTICATION_MODULE)
else
pamdir = /etc/pam.d
endif
if NETBSD
PAM_AUTHENTICATION_MODULE = /usr/pkg/lib/security/pam_pwauth_suid.so
AM_CPPFLAGS += -DPAM_AUTHENTICATION_MODULE=$(PAM_AUTHENTICATION_MODULE)
endif
endif
endif
if LINUX
AM_CPPFLAGS += -DXPROJECTROOT="/usr" -Dlinux -D__linux__