build: Make build/installation of su and its support files optional

Enabled by default
This is necessary because coreutils and util-linux can also provide su

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
This commit is contained in:
Lars Wendler 2019-11-19 10:57:06 +01:00
parent b49712ed32
commit 19bac44dde
No known key found for this signature in database
GPG Key ID: 571DD2D0343C6039
4 changed files with 24 additions and 5 deletions

View File

@ -286,6 +286,9 @@ AC_ARG_WITH(sssd,
AC_ARG_WITH(group-name-max-length, AC_ARG_WITH(group-name-max-length,
[AC_HELP_STRING([--with-group-name-max-length], [set max group name length @<:@default=16@:>@])], [AC_HELP_STRING([--with-group-name-max-length], [set max group name length @<:@default=16@:>@])],
[with_group_name_max_length=$withval], [with_group_name_max_length=yes]) [with_group_name_max_length=$withval], [with_group_name_max_length=yes])
AC_ARG_WITH(su,
[AC_HELP_STRING([--with-su], [build and install su program and man page @<:@default=yes@:>@])],
[with_su=$withval], [with_su=yes])
if test "$with_group_name_max_length" = "no" ; then if test "$with_group_name_max_length" = "no" ; then
with_group_name_max_length=0 with_group_name_max_length=0
@ -313,6 +316,9 @@ if test "$with_sssd" = "yes"; then
[AC_MSG_ERROR([posix_spawn is needed for sssd support])]) [AC_MSG_ERROR([posix_spawn is needed for sssd support])])
fi fi
AS_IF([test "$with_su" != "no"], AC_DEFINE(WITH_SU, 1, [Build with su])])
AM_CONDITIONAL([WITH_SU], [test "x$with_su" != "xno"])
dnl Check for some functions in libc first, only if not found check for dnl Check for some functions in libc first, only if not found check for
dnl other libraries. This should prevent linking libnsl if not really dnl other libraries. This should prevent linking libnsl if not really
dnl needed (Linux glibc, Irix), but still link it if needed (Solaris). dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
@ -730,4 +736,5 @@ echo " nscd support: $with_nscd"
echo " sssd support: $with_sssd" echo " sssd support: $with_sssd"
echo " subordinate IDs support: $enable_subids" echo " subordinate IDs support: $enable_subids"
echo " use file caps: $with_fcaps" echo " use file caps: $with_fcaps"
echo " install su: $with_su"
echo echo

View File

@ -6,8 +6,7 @@ pamd_files = \
chsh \ chsh \
groupmems \ groupmems \
login \ login \
passwd \ passwd
su
pamd_acct_tools_files = \ pamd_acct_tools_files = \
chage \ chage \
@ -29,4 +28,8 @@ pamd_DATA += $(pamd_acct_tools_files)
endif endif
endif endif
if WITH_SU
pamd_files += su
endif
EXTRA_DIST = $(pamd_files) $(pamd_acct_tools_files) EXTRA_DIST = $(pamd_files) $(pamd_acct_tools_files)

View File

@ -41,7 +41,6 @@ man_MANS = \
man1/sg.1 \ man1/sg.1 \
man3/shadow.3 \ man3/shadow.3 \
man5/shadow.5 \ man5/shadow.5 \
man1/su.1 \
man5/suauth.5 \ man5/suauth.5 \
man8/useradd.8 \ man8/useradd.8 \
man8/userdel.8 \ man8/userdel.8 \
@ -54,6 +53,10 @@ man_nopam = \
man5/login.access.5 \ man5/login.access.5 \
man5/porttime.5 man5/porttime.5
if WITH_SU
man_MANS += man1/su.1
endif
if !USE_PAM if !USE_PAM
man_MANS += $(man_nopam) man_MANS += $(man_nopam)
endif endif

View File

@ -23,12 +23,15 @@ AM_CPPFLAGS = \
# and installation would be much simpler (just two directories, # and installation would be much simpler (just two directories,
# $prefix/bin and $prefix/sbin, no install-data hacks...) # $prefix/bin and $prefix/sbin, no install-data hacks...)
bin_PROGRAMS = groups login su bin_PROGRAMS = groups login
sbin_PROGRAMS = nologin sbin_PROGRAMS = nologin
ubin_PROGRAMS = faillog lastlog chage chfn chsh expiry gpasswd newgrp passwd ubin_PROGRAMS = faillog lastlog chage chfn chsh expiry gpasswd newgrp passwd
if ENABLE_SUBIDS if ENABLE_SUBIDS
ubin_PROGRAMS += newgidmap newuidmap ubin_PROGRAMS += newgidmap newuidmap
endif endif
if WITH_SU
bin_PROGRAMS += su
endif
usbin_PROGRAMS = \ usbin_PROGRAMS = \
chgpasswd \ chgpasswd \
chpasswd \ chpasswd \
@ -53,8 +56,11 @@ usbin_PROGRAMS = \
noinst_PROGRAMS = id sulogin noinst_PROGRAMS = id sulogin
suidusbins = suidusbins =
suidbins = su suidbins =
suidubins = chage chfn chsh expiry gpasswd newgrp suidubins = chage chfn chsh expiry gpasswd newgrp
if WITH_SU
suidbins += su
endif
if !WITH_TCB if !WITH_TCB
suidubins += passwd suidubins += passwd
endif endif