Skip to content

Commit 6672de1

Browse files
committed
build: detect systemd/sysvinit
The detection is now very trivial, basically if the directory /usr/lib/systemd/system exists, we build for systemd. * configure.a (--with-sysvinit): Drop the explicit option. (systemdunitsdir, systemduserunitsdir, systemdlegacyscriptsdir) (initscripts): Point directly to / directory, not ${prefix}. * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Add systemdunitsdir, systemduserunitsdir, systemdlegacyscriptsdir, initscriptsdir to pass make distcheck.
1 parent 639a6f7 commit 6672de1

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

Makefile.am

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ GENERATED_FILES =
2727
CLEANFILES =
2828
_AX_TEXT_ADDITIONAL_SED_SUBSTITUTIONS =
2929

30-
DISTCHECK_CONFIGURE_FLAGS = rpmmacrosdir=$$dc_install_base/etc/rpm
30+
DISTCHECK_CONFIGURE_FLAGS = \
31+
rpmmacrosdir=$$dc_install_base/etc/rpm \
32+
systemdunitsdir=$$dc_install_base/lib/systemd/system \
33+
systemdunitsdir=$$dc_install_base/var/lib/systemd/system \
34+
systemduserunitsdir=$$dc_install_base/etc/systemd/system \
35+
systemdlegacyscriptsdir=$$dc_install_base/usr/libexec/initscripts/legacy-actions \
36+
initscriptsdir=$$dc_install_base=/etc/rc.d/init.d \
37+
initscriptsconfdir=$$dc_install_base/etc/sysconfig/pgsql
3138

3239
# include $(srcdir)/build-helpers/Makefile.inc
3340

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Bugfixes in 5.1 version
44

55
* The rpm macro directory is automatically detected.
66

7+
* the sysvinit/systemd systems are now detected
8+
79
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
810

911
Bugfixes in 5.0 version

configure.ac

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,12 @@ _AX_TEXT_TPL_INIT
1818

1919
_AX_TEXT_TPL_SUBST([TEST_GEN_FILES_LIST], [.generated_files])
2020

21-
# TODO: detect systemd/sysvinit. Also, we should probably be able to install
22-
# both configuration at once when needed.
23-
AC_ARG_WITH([sysvinit],
24-
AS_HELP_STRING([--with-sysvinit],
25-
[prepares sys v init script]),
26-
[WANT_SYSVINIT=0
27-
test x"$withval" = xyes && WANT_SYSVINIT=1]
28-
)
29-
30-
if test x = x"$WANT_SYSVINIT"
31-
then
32-
WANT_SYSVINIT=0
33-
# Try to detect system running systemd
34-
AC_PATH_PROG([SYSTEMCTL], [systemctl])
35-
test -z "$ac_cv_path_SYSTEMCTL" && WANT_SYSVINIT=1
36-
fi
37-
21+
WANT_SYSVINIT=0
3822
INIT_SYSTEM=systemd
39-
test x"$WANT_SYSVINIT" = x1 && INIT_SYSTEM=sysvinit
40-
23+
test -d /usr/lib/systemd/system/ || {
24+
INIT_SYSTEM=sysvinit
25+
WANT_SYSVINIT=1
26+
}
4127
AM_CONDITIONAL([WANT_SYSVINIT], [test "$WANT_SYSVINIT" -eq 1])
4228
_AX_TEXT_TPL_SUBST([WANT_SYSVINIT])
4329

@@ -62,10 +48,10 @@ AC_CACHE_CHECK(
6248
)
6349

6450
conf_dir([rpmmacrosdir], [$my_cv_macrosdir])
65-
conf_dir([systemdunitsdir], ['${prefix}/lib/systemd/system'])
66-
conf_dir([systemduserunitsdir], ['${prefix}/etc/systemd/system'])
67-
conf_dir([systemdlegacyscriptsdir], ['${libexecdir}/initscripts/legacy-actions'])
68-
conf_dir([initscriptsdir], ['${sysconfdir}/rc.d/init.d'])
51+
conf_dir([systemdunitsdir], ['/usr/lib/systemd/system'])
52+
conf_dir([systemduserunitsdir], ['/etc/systemd/system'])
53+
conf_dir([systemdlegacyscriptsdir], ['/usr/libexec/initscripts/legacy-actions'])
54+
conf_dir([initscriptsdir], ['/etc/rc.d/init.d'])
6955
conf_dir([initscriptsconfdir], ['/etc/sysconfig/pgsql'])
7056
conf_dir([rawpkgdatadir], ['${datadir}/postgresql-setup'])
7157
# Those two should be specified explicitly.
File renamed without changes.

0 commit comments

Comments
 (0)