]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Add --disable-syslog configure option
authorDmitry Sakhonchik <frezidok1@gmail.com>
Tue, 28 Apr 2026 11:29:29 +0000 (14:29 +0300)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Sun, 3 May 2026 21:26:10 +0000 (23:26 +0200)
It allows build systems like Yocto to disable syslog calls during native builds, preventing log spam on the build host.

Closes: <https://github.com/shadow-maint/shadow/issues/1610>
Signed-off-by: Dmitry Sakhonchik <frezidok1@gmail.com>
configure.ac
lib/io/syslog.h

index c01264c004694f86ba36708569bc3b1032caec93..f87c0a7b24d024b9a2ffdaa4be23756c7ea91c63 100644 (file)
@@ -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
 
 ])
index 73fcfe26e9658f2eadcff34864b5007e382259f5..84c65c74ff65e5b29ab576a0d0c5340802a870ee 100644 (file)
 #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,