summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2015-03-04 16:21:52 +0100
committerPavel Raiskup <praiskup@redhat.com>2015-03-04 16:38:57 +0100
commit610bb619cc5e00860c6846fa36a03609aaea3595 (patch)
treeeece7bb2555e3a6dafd6494bc8b928a7b5295617
parent834c0e34d7828f96550c7a7bbb94f3dcaacd2029 (diff)
downloadpostgresql-setup-610bb619cc5e00860c6846fa36a03609aaea3595.zip
postgresql-setup-610bb619cc5e00860c6846fa36a03609aaea3595.tar.gz
postgresql-setup-610bb619cc5e00860c6846fa36a03609aaea3595.tar.xz
configury: detect systemd/sysvinit systems
Fix the AC_ARG_WITH misuse. If WANT_SYSVINIT is unset, guess correct value. Don't treat intermediate files as those to be checked for correct syntax errors (or unexpanded @variables@). * Makefile.am: Move readme_* intermediate files into separate variable. * configure.ac: If WANT_SYSVINIT is empty (no explicit request), try to detect systemd's presence by checking for systemctl command. Print out after AC_OUTPUT information what init system will be used.
-rw-r--r--Makefile.am7
-rw-r--r--configure.ac17
2 files changed, 19 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am
index 68717c9..bad62ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,7 @@ readme_dist_sed = README.rpm-dist.sed
readme_template = README.rpm-dist.template
EXTRA_DIST =
+INTERMEDIATE_FILES =
GENERATED_FILES =
CLEANFILES =
@@ -105,12 +106,14 @@ GENERATED_FILES += \
$(pkgsysconf_DATA) \
$(systemdunits_DATA) \
$(initscripts_DATA) \
- $(legacyscripts_SCRIPTS) \
+ $(legacyscripts_SCRIPTS)
+
+INTERMEDIATE_FILES += \
$(readme_dist_m4) \
$(readme_dist_sed) \
$(readme_dist_db)
-CLEANFILES += $(GENERATED_FILES) $(TEST_GEN_FILES_LIST)
+CLEANFILES += $(GENERATED_FILES) $(TEST_GEN_FILES_LIST) $(INTERMEDIATE_FILES)
$(TEST_GEN_FILES_LIST): $(GENERATED_FILES)
$(AM_V_GEN)rm -rf $(TEST_GEN_FILES_LIST) && \
diff --git a/configure.ac b/configure.ac
index c8c67c5..51f20d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,11 +20,21 @@ AC_SUBST([TEST_GEN_FILES_LIST], [.generated_files])
AC_ARG_WITH([sysvinit],
AS_HELP_STRING([--with-sysvinit],
[prepares sys v init script]),
- [WANT_SYSVINIT=1],
- [WANT_SYSVINIT=0]
+ [WANT_SYSVINIT=0
+ test x"$withval" = xyes && WANT_SYSVINIT=1]
)
-test -z "$WANT_SYSVINIT" && WANT_SYSVINIT=0
+if test x = x"$WANT_SYSVINIT"
+then
+ WANT_SYSVINIT=0
+ # Try to detect system running systemd
+ AC_PATH_PROG([SYSTEMCTL], [systemctl])
+ test -z "$ac_cv_path_SYSTEMCTL" && WANT_SYSVINIT=1
+fi
+
+INIT_SYSTEM=systemd
+test x"$WANT_SYSVINIT" = x1 && INIT_SYSTEM=sysvinit
+
AM_CONDITIONAL([WANT_SYSVINIT], [test "$WANT_SYSVINIT" -eq 1])
AC_SUBST([WANT_SYSVINIT])
@@ -212,4 +222,5 @@ AC_MSG_NOTICE([Configured the folowing way:
PostgreSQL service: $NAME_SERVICE
PostgreSQL package: $NAME_PACKAGE
PostgreSQL bin_pfx: $NAME_BINARYBASE
+ Init system: $INIT_SYSTEM
])