From: Dmitry Sakhonchik Date: Tue, 28 Apr 2026 11:29:29 +0000 (+0300) Subject: Add --disable-syslog configure option X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2acdec87fcb50b2cb1dfc904d84a38eb17fa3524;p=thirdparty%2Fshadow.git Add --disable-syslog configure option It allows build systems like Yocto to disable syslog calls during native builds, preventing log spam on the build host. Closes: Signed-off-by: Dmitry Sakhonchik --- diff --git a/configure.ac b/configure.ac index c01264c00..f87c0a7b2 100644 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,17 @@ AC_ARG_ENABLE([logind], [enable_logind="yes"] ) +AC_ARG_ENABLE([syslog], + [AS_HELP_STRING([--disable-syslog], [disable logging via syslog() calls])], + [ + AS_CASE([${enableval}], + [yes|no],[], + [AC_MSG_ERROR([bad parameter value for --enable-syslog=${enableval}])] + ) + ], + [enable_syslog="yes"] +) + AC_ARG_WITH([audit], [AS_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])], [with_audit=$withval], [with_audit=maybe]) @@ -200,6 +211,7 @@ AC_DEFINE_UNQUOTED([GROUP_NAME_MAX_LENGTH], [$with_group_name_max_length], [max AC_SUBST([GROUP_NAME_MAX_LENGTH]) GROUP_NAME_MAX_LENGTH="$with_group_name_max_length" +AS_VAR_IF([enable_syslog],["yes"],[AC_DEFINE([USE_SYSLOG], [1], [Define to use syslog])]) AM_CONDITIONAL([USE_BCRYPT], [test "x$with_bcrypt" = "xyes"]) if test "X$with_bcrypt" = "Xyes"; then @@ -630,5 +642,6 @@ AC_MSG_NOTICE([shadow ${PACKAGE_VERSION} has been configured with the following use file caps: $with_fcaps install su: $with_su enabled vendor dir: $enable_vendordir + enable syslog: $enable_syslog ]) diff --git a/lib/io/syslog.h b/lib/io/syslog.h index 73fcfe26e..84c65c74f 100644 --- a/lib/io/syslog.h +++ b/lib/io/syslog.h @@ -24,10 +24,12 @@ #define LOG_AUTHPRIV LOG_AUTH #endif -#ifdef ENABLE_NLS -#define SYSLOG(...) SYSLOG_C(__VA_ARGS__) +#if !USE_SYSLOG +# define SYSLOG(...) +#elif defined(ENABLE_NLS) +# define SYSLOG(...) SYSLOG_C(__VA_ARGS__) #else -#define SYSLOG(...) syslog(__VA_ARGS__) +# define SYSLOG(...) syslog(__VA_ARGS__) #endif /* The default syslog settings can now be changed here,