From 410e9e3c86d7f1bc7458a0950854b99980abc744 Mon Sep 17 00:00:00 2001 From: sgerwk Date: Wed, 27 Oct 2021 18:01:49 +0200 Subject: [PATCH] include the case where runstate is undefined --- configure.ac | 2 ++ src/Makemodule.am | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 210be21..1f9f182 100644 --- a/configure.ac +++ b/configure.ac @@ -266,6 +266,8 @@ AS_IF([test "$enable_anacron" != no && test "$have_obstack" = no], [ CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/obstack" ]) +AM_CONDITIONAL(HAS_RUNSTATE, [test x$runstatedir != x]) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/src/Makemodule.am b/src/Makemodule.am index e2f1f0d..1744c6a 100644 --- a/src/Makemodule.am +++ b/src/Makemodule.am @@ -61,6 +61,13 @@ src_crontab_LDADD = $(LIBSELINUX) $(LIBPAM) $(LIBAUDIT) # Depends on this Makefile, because it uses make variables. # CCD 2010/09/10 added CRON_HOSTNAME for clustered-cron. CLEANFILES += cron-paths.h +if HAS_RUNSTATE +cronpidcomment=/* directory of cron pid file */ +cronpiddir=\#define CRON_PID_DIR "$(runstatedir)" +else +cronpidcomment= +cronpiddir= +endif cron-paths.h: Makefile @echo 'creating $@' @sed >$@ 's/ *\\$$//' <<\END #\ @@ -96,8 +103,8 @@ cron-paths.h: Makefile #define CRON_ALLOW "$(sysconfdir)/cron.allow" \ #define CRON_DENY "$(sysconfdir)/cron.deny" \ \ - /* directory of cron pid file */ \ - #define CRON_PID_DIR "$(runstatedir)" \ + $(cronpidcomment) \ + $(cronpiddir) \ \ /* 4.3BSD-style crontab f.e. /etc/crontab */ \ #define SYSCRONTAB "$(SYSCRONTAB)" \