File: systemd.m4

package info (click to toggle)
389-ds-base 2.3.1%2Bdfsg1-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 37,536 kB
  • sloc: ansic: 306,972; python: 96,937; cpp: 10,257; perl: 2,854; makefile: 2,046; sh: 925; yacc: 806; xml: 379; lex: 366; javascript: 148; java: 50
file content (138 lines) | stat: -rw-r--r-- 4,790 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2022 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details. 
# END COPYRIGHT BLOCK

AC_MSG_CHECKING(for Systemd)

# check for --with-systemd
AC_MSG_CHECKING(for --with-systemd)
AC_ARG_WITH(systemd, AS_HELP_STRING([--with-systemd],[Enable Systemd native integration.]),
[
    if test "$withval" = yes
    then
        AC_MSG_RESULT([using systemd native features])
        with_systemd=yes
    else
        AC_MSG_RESULT(no)
    fi
],
AC_MSG_RESULT(no))

if test "$with_systemd" = yes; then

    AC_MSG_CHECKING(for --with-journald)
    AC_ARG_WITH(journald, AS_HELP_STRING([--with-journald],[Enable Journald native integration. WARNING, this may cause system instability]),
    [
        if test "$withval" = yes
        then
            AC_MSG_RESULT([using journald logging: WARNING, this may cause system instability])
            with_systemd=yes
        else
            AC_MSG_RESULT(no)
        fi
    ],
    AC_MSG_RESULT(no))

    PKG_CHECK_MODULES([SYSTEMD], [libsystemd])

    if test "$with_journald" = yes; then
        systemd_defs="-DWITH_SYSTEMD -DHAVE_JOURNALD"
    else
        systemd_defs="-DWITH_SYSTEMD"
    fi

    # Check for the pkg config provided unit paths
    if test -n "$PKG_CONFIG" ; then
       default_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
       default_systemdsystemconfdir=`$PKG_CONFIG --variable=systemdsystemconfdir systemd`
    fi

    AC_MSG_CHECKING(for --with-systemdsystemunitdir)
    AC_ARG_WITH([systemdsystemunitdir],
       AS_HELP_STRING([--with-systemdsystemunitdir=PATH],
                      [Directory for systemd service files (default: $with_systemdsystemunitdir)])
    )
    if test "$with_systemdsystemunitdir" = yes ; then
      if test -n "$default_systemdsystemunitdir" ; then
        with_systemdsystemunitdir=$default_systemdsystemunitdir
        AC_MSG_RESULT([$with_systemdsystemunitdir])
      else
        AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
      fi
    elif test "$with_systemdsystemunitdir" = no ; then
      with_systemdsystemunitdir=
    else
      AC_MSG_RESULT([$with_systemdsystemunitdir])
    fi
    AC_SUBST(with_systemdsystemunitdir)

    AC_MSG_CHECKING(for --with-systemdsystemconfdir)
    AC_ARG_WITH([systemdsystemconfdir],
       AS_HELP_STRING([--with-systemdsystemconfdir=PATH],
                      [Directory for systemd service files (default: $with_systemdsystemconfdir)])
    )
    if test "$with_systemdsystemconfdir" = yes ; then
      if test -n "$default_systemdsystemconfdir" ; then
        with_systemdsystemconfdir=$default_systemdsystemconfdir
        AC_MSG_RESULT([$with_systemdsystemconfdir])
      else
        AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
      fi
    elif test "$with_systemdsystemconfdir" = no ; then
      with_systemdsystemconfdir=
    else
      AC_MSG_RESULT([$with_systemdsystemconfdir])
    fi
    AC_SUBST(with_systemdsystemconfdir)

    if test -z "$with_systemdgroupname" ; then
       with_systemdgroupname=$PACKAGE_NAME.target
    fi
    AC_MSG_CHECKING(for --with-systemdgroupname)
    AC_ARG_WITH([systemdgroupname],
         AS_HELP_STRING([--with-systemdgroupname=NAME],
                        [Name of group target for all instances (default: $with_systemdgroupname)])
    )
    if test "$with_systemdgroupname" = yes ; then
       AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
    elif test "$with_systemdgroupname" = no ; then
       AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
    else
       AC_MSG_RESULT([$with_systemdgroupname])
    fi
    AC_SUBST(with_systemdgroupname)

    if test -z "$with_tmpfiles_d" ; then
       if test -d $sysconfdir/tmpfiles.d ; then
          tmpfiles_d='$(sysconfdir)/tmpfiles.d'
       fi
    fi
    AC_MSG_CHECKING(for --with-tmpfiles-d)
    AC_ARG_WITH(tmpfiles-d,
       AS_HELP_STRING([--with-tmpfiles-d=PATH],
                      [system uses tmpfiles.d to handle temp files/dirs (default: $tmpfiles_d)])
    )
    if test "$with_tmpfiles_d" = yes ; then
      AC_MSG_ERROR([You must specify --with-tmpfiles-d=/full/path/to/tmpfiles.d directory])
    elif test "$with_tmpfiles_d" = no ; then
      tmpfiles_d=
    else
      tmpfiles_d=$with_tmpfiles_d
      AC_MSG_RESULT([$tmpfiles_d])
    fi

fi
# End of with_systemd

AM_CONDITIONAL([SYSTEMD],[test -n "$with_systemd"])
AM_CONDITIONAL([with_systemd],[test -n "$with_systemd"])
AM_CONDITIONAL([JOURNALD],[test -n "$with_journald"])
AM_CONDITIONAL([with_systemd_journald],[test -n "$with_journald"])

AC_SUBST(systemd_defs)
AC_SUBST(tmpfiles_d)