Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoo-systemd-integration:master commit in: m4/
Date: Sun, 03 Nov 2019 15:50:22
Message-Id: 1572796204.6db2c6295b31185a0ab5e5a41bea1a67be5b27bb.mgorny@gentoo
1 commit: 6db2c6295b31185a0ab5e5a41bea1a67be5b27bb
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 3 15:49:53 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 3 15:50:04 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/gentoo-systemd-integration.git/commit/?id=6db2c629
7
8 Inline systemd.m4
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 m4/.keep | 0
13 m4/systemd.m4 | 478 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 478 insertions(+)
15
16 diff --git a/m4/.keep b/m4/.keep
17 deleted file mode 100644
18 index e69de29..0000000
19
20 diff --git a/m4/systemd.m4 b/m4/systemd.m4
21 new file mode 100644
22 index 0000000..ee7ebdf
23 --- /dev/null
24 +++ b/m4/systemd.m4
25 @@ -0,0 +1,478 @@
26 +# Copyright (c) 2011-2013, Michał Górny
27 +# All rights reserved.
28 +#
29 +# Redistribution and use in source and binary forms, with or without
30 +# modification, are permitted provided that the following conditions are met:
31 +#
32 +# 1. Redistributions of source code must retain the above copyright notice,
33 +# this list of conditions and the following disclaimer.
34 +# 2. Redistributions in binary form must reproduce the above copyright
35 +# notice, this list of conditions and the following disclaimer in the
36 +# documentation and/or other materials provided with the distribution.
37 +#
38 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41 +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
42 +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
43 +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
44 +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
45 +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
46 +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47 +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
48 +# POSSIBILITY OF SUCH DAMAGE.
49 +
50 +
51 +# SYSTEMD_DIRECTORY_AC(directory-variable, directory-description)
52 +# ---------------------------------------------------------------
53 +#
54 +# A generic macro that obtains one of the systemd directories defined
55 +# in systemd.pc. It adds --with-$1 configure option and tries to
56 +# obtain the default from pkg-config.
57 +#
58 +# If any location was found or given, the name given as $1 will be
59 +# substituted with it. Otherwise, $with_[$1] will be set to 'no'.
60 +
61 +AC_DEFUN([SYSTEMD_DIRECTORY_AC], [
62 + AC_REQUIRE([PKG_PROG_PKG_CONFIG])
63 +
64 + AC_ARG_WITH([$1],
65 + AS_HELP_STRING([--with-$1=DIR],
66 + [Directory for $2 (default: auto-detect through pkg-config)]))
67 +
68 + AC_MSG_CHECKING([$2 directory])
69 +
70 + AS_IF([test x"$with_$1" = x"yes" -o x"$with_$1" = x""], [
71 + ac_systemd_pkgconfig_dir=`$PKG_CONFIG --variable=$1 systemd`
72 +
73 + AS_IF([test x"$ac_systemd_pkgconfig_dir" = x""], [
74 + AS_IF([test x"$with_$1" = x"yes"], [
75 + AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])
76 + ])
77 + with_$1=no
78 + ], [
79 + with_$1=$ac_systemd_pkgconfig_dir
80 + ])
81 + ])
82 +
83 + AC_MSG_RESULT([$with_$1])
84 +
85 + AS_IF([test x"$with_$1" != x"no"], [
86 + AC_SUBST([$1], [$with_$1])
87 + ])
88 +])
89 +
90 +# SYSTEMD_DIRECTORY_AM(directory-variable)
91 +# ---------------------------------------------------------------
92 +#
93 +# Defines WITH_$1 automake macro if directory was set through
94 +# --with-$1 or obtained from pkg-config.
95 +
96 +AC_DEFUN([SYSTEMD_DIRECTORY_AM], [
97 + m4_pushdef([AM_MACRO], WITH_[]m4_toupper([$1]))
98 + AM_CONDITIONAL(AM_MACRO,
99 + [test x"$with_$1" != x"no"])
100 + m4_popdef([AM_MACRO])
101 +])
102 +
103 +# SYSTEMD_SYSTEMUNITDIR_AC
104 +# ------------------------
105 +#
106 +# A macro grabbing all information necessary to install systemd system
107 +# units. It adds --with-systemdsystemunitdir (with defaults from
108 +# pkg-config) and either gets the correct location for systemd system
109 +# units or the request not to install them.
110 +#
111 +# If installing system units was requested, systemdsystemunitdir will be
112 +# substituted with a correct location; otherwise,
113 +# $with_systemdsystemunitdir will be set to 'no'.
114 +#
115 +# This macro is intended for use only in specific projects not using
116 +# automake. Projects using automake should use the non-AC variant
117 +# instead.
118 +
119 +AC_DEFUN([SYSTEMD_SYSTEMUNITDIR_AC], [
120 + SYSTEMD_DIRECTORY_AC([systemdsystemunitdir], [systemd system unit])
121 +])
122 +
123 +# SYSTEMD_SYSTEMUNITDIR
124 +# ---------------------
125 +#
126 +# An extended version of SYSTEMD_SYSTEMUNITDIR_AC with automake support.
127 +#
128 +# In addition to substituting systemdsystemunitdir, it creates
129 +# an automake conditional called WITH_SYSTEMDSYSTEMUNITDIR.
130 +#
131 +# Example use:
132 +# - configure.ac:
133 +# SYSTEMD_SYSTEMUNITDIR
134 +# - Makefile.am:
135 +# if WITH_SYSTEMDSYSTEMUNITDIR
136 +# dist_systemdsystemunit_DATA = foo.service
137 +# endif
138 +
139 +AC_DEFUN([SYSTEMD_SYSTEMUNITDIR], [
140 + AC_REQUIRE([SYSTEMD_SYSTEMUNITDIR_AC])
141 + SYSTEMD_DIRECTORY_AM([systemdsystemunitdir])
142 +])
143 +
144 +# SYSTEMD_SYSTEMPRESETDIR_AC
145 +# --------------------------
146 +#
147 +# A macro grabbing all information necessary to install systemd system
148 +# presets. It adds --with-systemdsystempresetdir (with defaults from
149 +# pkg-config) and either gets the correct location for systemd system
150 +# presets or the request not to install them.
151 +#
152 +# If installing system presets was requested, systemdsystempresetdir
153 +# will be substituted with a correct location; otherwise,
154 +# $with_systemdsystempresetdir will be set to 'no'.
155 +#
156 +# This macro is intended for use only in specific projects not using
157 +# automake. Projects using automake should use the non-AC variant
158 +# instead.
159 +
160 +AC_DEFUN([SYSTEMD_SYSTEMPRESETDIR_AC], [
161 + SYSTEMD_DIRECTORY_AC([systemdsystempresetdir], [systemd system preset])
162 +])
163 +
164 +# SYSTEMD_SYSTEMPRESETDIR
165 +# -----------------------
166 +#
167 +# An extended version of SYSTEMD_SYSTEMPRESETDIR_AC with automake
168 +# support.
169 +#
170 +# In addition to substituting systemdsystempresetdir, it creates
171 +# an automake conditional called WITH_SYSTEMDSYSTEMPRESETDIR.
172 +
173 +AC_DEFUN([SYSTEMD_SYSTEMPRESETDIR], [
174 + AC_REQUIRE([SYSTEMD_SYSTEMPRESETDIR_AC])
175 + SYSTEMD_DIRECTORY_AM([systemdsystempresetdir])
176 +])
177 +
178 +# SYSTEMD_SYSTEMCONFDIR_AC
179 +# ------------------------
180 +#
181 +# A macro grabbing all information necessary to install systemd system
182 +# configuration. It adds --with-systemdsystemconfdir (with defaults from
183 +# pkg-config) and either gets the correct location for systemd system
184 +# configuration or the request not to install them.
185 +#
186 +# If installing to the systemconfdir was requested, systemdsystemconfdir
187 +# will be substituted with a correct location; otherwise,
188 +# $with_systemdsystemconfdir will be set to 'no'.
189 +#
190 +# This macro is intended for use only in specific projects not using
191 +# automake. Projects using automake should use the non-AC variant
192 +# instead.
193 +
194 +AC_DEFUN([SYSTEMD_SYSTEMCONFDIR_AC], [
195 + SYSTEMD_DIRECTORY_AC([systemdsystemconfdir], [systemd system configuration])
196 +])
197 +
198 +# SYSTEMD_SYSTEMCONFDIR
199 +# ---------------------
200 +#
201 +# An extended version of SYSTEMD_SYSTEMCONFDIR_AC with automake
202 +# support.
203 +#
204 +# In addition to substituting systemdsystemconfdir, it creates
205 +# an automake conditional called WITH_SYSTEMDSYSTEMCONFDIR.
206 +
207 +AC_DEFUN([SYSTEMD_SYSTEMCONFDIR], [
208 + AC_REQUIRE([SYSTEMD_SYSTEMCONFDIR_AC])
209 + SYSTEMD_DIRECTORY_AM([systemdsystemconfdir])
210 +])
211 +
212 +# SYSTEMD_USERUNITDIR_AC
213 +# ----------------------
214 +#
215 +# A macro grabbing all information necessary to install systemd user
216 +# units. It adds --with-systemduserunitdir (with defaults from
217 +# pkg-config) and either gets the correct location for systemd user
218 +# units or the request not to install them.
219 +#
220 +# If installing user units was requested, systemduserunitdir will be
221 +# substituted with a correct location; otherwise,
222 +# $with_systemduserunitdir will be set to 'no'.
223 +#
224 +# This macro is intended for use only in specific projects not using
225 +# automake. Projects using automake should use the non-AC variant
226 +# instead.
227 +
228 +AC_DEFUN([SYSTEMD_USERUNITDIR_AC], [
229 + SYSTEMD_DIRECTORY_AC([systemduserunitdir], [systemd user unit])
230 +])
231 +
232 +# SYSTEMD_USERUNITDIR
233 +# -------------------
234 +#
235 +# An extended version of SYSTEMD_USERUNITDIR_AC with automake support.
236 +#
237 +# In addition to substituting systemduserunitdir, it creates
238 +# an automake conditional called WITH_SYSTEMDUSERUNITDIR.
239 +#
240 +# Example use:
241 +# - configure.ac:
242 +# SYSTEMD_USERUNITDIR
243 +# - Makefile.am:
244 +# if WITH_SYSTEMDUSERUNITDIR
245 +# dist_systemduserunit_DATA = foo.service
246 +# endif
247 +
248 +AC_DEFUN([SYSTEMD_USERUNITDIR], [
249 + AC_REQUIRE([SYSTEMD_USERUNITDIR_AC])
250 + SYSTEMD_DIRECTORY_AM([systemduserunitdir])
251 +])
252 +
253 +# SYSTEMD_USERPRESETDIR_AC
254 +# ------------------------
255 +#
256 +# A macro grabbing all information necessary to install systemd user
257 +# presets. It adds --with-systemduserpresetdir (with defaults from
258 +# pkg-config) and either gets the correct location for systemd user
259 +# presets or the request not to install them.
260 +#
261 +# If installing user presets was requested, systemduserpresetdir
262 +# will be substituted with a correct location; otherwise,
263 +# $with_systemduserpresetdir will be set to 'no'.
264 +#
265 +# This macro is intended for use only in specific projects not using
266 +# automake. Projects using automake should use the non-AC variant
267 +# instead.
268 +
269 +AC_DEFUN([SYSTEMD_USERPRESETDIR_AC], [
270 + SYSTEMD_DIRECTORY_AC([systemduserpresetdir], [systemd user preset])
271 +])
272 +
273 +# SYSTEMD_USERPRESETDIR
274 +# ---------------------
275 +#
276 +# An extended version of SYSTEMD_USERPRESETDIR_AC with automake
277 +# support.
278 +#
279 +# In addition to substituting systemduserpresetdir, it creates
280 +# an automake conditional called WITH_SYSTEMDUSERPRESETDIR.
281 +
282 +AC_DEFUN([SYSTEMD_USERPRESETDIR], [
283 + AC_REQUIRE([SYSTEMD_USERPRESETDIR_AC])
284 + SYSTEMD_DIRECTORY_AM([systemduserpresetdir])
285 +])
286 +
287 +# SYSTEMD_USERCONFDIR_AC
288 +# ----------------------
289 +#
290 +# A macro grabbing all information necessary to install systemd user
291 +# configuration. It adds --with-systemduserconfdir (with defaults from
292 +# pkg-config) and either gets the correct location for systemd user
293 +# configuration or the request not to install them.
294 +#
295 +# If installing to the userconfdir was requested, systemduserconfdir
296 +# will be substituted with a correct location; otherwise,
297 +# $with_systemduserconfdir will be set to 'no'.
298 +#
299 +# This macro is intended for use only in specific projects not using
300 +# automake. Projects using automake should use the non-AC variant
301 +# instead.
302 +
303 +AC_DEFUN([SYSTEMD_USERCONFDIR_AC], [
304 + SYSTEMD_DIRECTORY_AC([systemduserconfdir], [systemd user configuration])
305 +])
306 +
307 +# SYSTEMD_USERCONFDIR
308 +# -------------------
309 +#
310 +# An extended version of SYSTEMD_USERCONFDIR_AC with automake
311 +# support.
312 +#
313 +# In addition to substituting systemduserconfdir, it creates
314 +# an automake conditional called WITH_SYSTEMDUSERCONFDIR.
315 +
316 +AC_DEFUN([SYSTEMD_USERCONFDIR], [
317 + AC_REQUIRE([SYSTEMD_USERCONFDIR_AC])
318 + SYSTEMD_DIRECTORY_AM([systemduserconfdir])
319 +])
320 +
321 +# SYSTEMD_UTILDIR_AC
322 +# ------------------
323 +#
324 +# A macro grabbing all information necessary to obtain systemd utility
325 +# directory. It adds --with-systemdutildir (with defaults from
326 +# pkg-config) and either gets the correct location for systemd
327 +# utility programs or the request not to install them.
328 +#
329 +# If installing to the utildir was requested, systemdutildir
330 +# will be substituted with a correct location; otherwise,
331 +# $with_systemdutildir will be set to 'no'.
332 +#
333 +# This macro is intended for use only in specific projects not using
334 +# automake. Projects using automake should use the non-AC variant
335 +# instead.
336 +
337 +AC_DEFUN([SYSTEMD_UTILDIR_AC], [
338 + SYSTEMD_DIRECTORY_AC([systemdutildir], [systemd utility])
339 +])
340 +
341 +# SYSTEMD_UTILDIR
342 +# ---------------
343 +#
344 +# An extended version of SYSTEMD_UTILDIR_AC with automake
345 +# support.
346 +#
347 +# In addition to substituting systemdutildir, it creates
348 +# an automake conditional called WITH_SYSTEMDUTILDIR.
349 +
350 +AC_DEFUN([SYSTEMD_UTILDIR], [
351 + AC_REQUIRE([SYSTEMD_UTILDIR_AC])
352 + SYSTEMD_DIRECTORY_AM([systemdutildir])
353 +])
354 +
355 +# SYSTEMD_SYSTEMGENERATORDIR_AC
356 +# -----------------------------
357 +#
358 +# A macro grabbing all information necessary to install systemd system
359 +# generators. It adds --with-systemdsystemgeneratordir (with defaults from
360 +# pkg-config) and either gets the correct location for systemd system
361 +# generators or the request not to install them.
362 +#
363 +# If installing system generators was requested, systemdsystemgeneratordir
364 +# will be substituted with a correct location; otherwise,
365 +# $with_systemdsystemgeneratordir will be set to 'no'.
366 +#
367 +# This macro is intended for use only in specific projects not using
368 +# automake. Projects using automake should use the non-AC variant
369 +# instead.
370 +
371 +AC_DEFUN([SYSTEMD_SYSTEMGENERATORDIR_AC], [
372 + SYSTEMD_DIRECTORY_AC([systemdsystemgeneratordir], [systemd system generator])
373 +])
374 +
375 +# SYSTEMD_SYSTEMGENERATORDIR
376 +# --------------------------
377 +#
378 +# An extended version of SYSTEMD_SYSTEMGENERATORDIR_AC with automake
379 +# support.
380 +#
381 +# In addition to substituting systemdsystemgeneratordir, it creates
382 +# an automake conditional called WITH_SYSTEMDSYSTEMGENERATORDIR.
383 +
384 +AC_DEFUN([SYSTEMD_SYSTEMGENERATORDIR], [
385 + AC_REQUIRE([SYSTEMD_SYSTEMGENERATORDIR_AC])
386 + SYSTEMD_DIRECTORY_AM([systemdsystemgeneratordir])
387 +])
388 +
389 +# SYSTEMD_USERGENERATORDIR_AC
390 +# ---------------------------
391 +#
392 +# A macro grabbing all information necessary to install systemd user
393 +# generators. It adds --with-systemdusergeneratordir (with defaults from
394 +# pkg-config) and either gets the correct location for systemd user
395 +# generators or the request not to install them.
396 +#
397 +# If installing user generators was requested, systemdusergeneratordir
398 +# will be substituted with a correct location; otherwise,
399 +# $with_systemdusergeneratordir will be set to 'no'.
400 +#
401 +# This macro is intended for use only in specific projects not using
402 +# automake. Projects using automake should use the non-AC variant
403 +# instead.
404 +
405 +AC_DEFUN([SYSTEMD_USERGENERATORDIR_AC], [
406 + SYSTEMD_DIRECTORY_AC([systemdusergeneratordir], [systemd user generator])
407 +])
408 +
409 +# SYSTEMD_USERGENERATORDIR
410 +# ------------------------
411 +#
412 +# An extended version of SYSTEMD_USERGENERATORDIR_AC with automake
413 +# support.
414 +#
415 +# In addition to substituting systemdusergeneratordir, it creates
416 +# an automake conditional called WITH_SYSTEMDUSERGENERATORDIR.
417 +
418 +AC_DEFUN([SYSTEMD_USERGENERATORDIR], [
419 + AC_REQUIRE([SYSTEMD_USERGENERATORDIR_AC])
420 + SYSTEMD_DIRECTORY_AM([systemdusergeneratordir])
421 +])
422 +
423 +# SYSTEMD_CATALOGDIR_AC
424 +# ---------------------
425 +#
426 +# A macro grabbing all information necessary to install Journal
427 +# catalogs. It adds --with-catalogdir (with defaults from pkg-config)
428 +# and either gets the correct location for catalogs or the request
429 +# not to install them.
430 +#
431 +# If installing catalogs was requested, catalogdir will be substituted
432 +# with a correct location; otherwise, $with_catalogdir will be set
433 +# to 'no'.
434 +#
435 +# This macro is intended for use only in specific projects not using
436 +# automake. Projects using automake should use the non-AC variant
437 +# instead.
438 +
439 +AC_DEFUN([SYSTEMD_CATALOGDIR_AC], [
440 + SYSTEMD_DIRECTORY_AC([catalogdir], [Journal catalog])
441 +])
442 +
443 +# SYSTEMD_CATALOGDIR
444 +# ------------------
445 +#
446 +# An extended version of SYSTEMD_CATALOGDIR_AC with automake
447 +# support.
448 +#
449 +# In addition to substituting catalogdir, it creates an automake
450 +# conditional called WITH_CATALOGDIR.
451 +
452 +AC_DEFUN([SYSTEMD_CATALOGDIR], [
453 + AC_REQUIRE([SYSTEMD_CATALOGDIR_AC])
454 + SYSTEMD_DIRECTORY_AM([catalogdir])
455 +])
456 +
457 +# SYSTEMD_MISC
458 +# ------------
459 +#
460 +# Declare miscellaneous (unconditional) directories used by systemd,
461 +# and possibly other init systems.
462 +#
463 +# Declared directories:
464 +# - binfmtdir (binfmt.d for binfmt_misc decl files),
465 +# - modulesloaddir (modules-load.d for module loader).
466 +# - sysctldir (sysctl.d for /proc/sys settings),
467 +# - tmpfilesdir (tmpfiles.d for temporary file setup).
468 +#
469 +# Example use:
470 +# - configure.ac:
471 +# SYSTEMD_MISC
472 +# - Makefile.am:
473 +# dist_binfmt_DATA = binfmt/foo.conf
474 +#
475 +# TODO: systemd only supports /usr and /usr/local
476 +
477 +AC_DEFUN([SYSTEMD_MISC], [
478 + AS_IF([test x"$prefix" = x"/"], [
479 + AC_SUBST([binfmtdir], [/usr/lib/binfmt.d])
480 + AC_SUBST([modulesloaddir], [/usr/lib/modules-load.d])
481 + AC_SUBST([sysctldir], [/usr/lib/sysctl.d])
482 + AC_SUBST([tmpfilesdir], [/usr/lib/tmpfiles.d])
483 + AC_SUBST([kernelinstalldir], [/usr/lib/kernel/install.d])
484 + AC_SUBST([ntpunitsdir], [/usr/lib/systemd/ntp-units.d])
485 + ], [
486 + AC_SUBST([binfmtdir], ['${prefix}/lib/binfmt.d'])
487 + AC_SUBST([modulesloaddir], ['${prefix}/lib/modules-load.d'])
488 + AC_SUBST([sysctldir], ['${prefix}/lib/sysctl.d'])
489 + AC_SUBST([tmpfilesdir], ['${prefix}/lib/tmpfiles.d'])
490 + AC_SUBST([kernelinstalldir], ['${prefix}/lib/kernel/install.d'])
491 + AC_SUBST([ntpunitsdir], ['${prefix}/lib/systemd/ntp-units.d'])
492 + ])
493 +])
494 +
495 +
496 +# Obsolete macros.
497 +AU_ALIAS([SYSTEMD_SYSTEM_UNITS_AC], [SYSTEMD_SYSTEMUNITDIR_AC])
498 +AU_DEFUN([SYSTEMD_SYSTEM_UNITS], [
499 + SYSTEMD_SYSTEMUNITDIR
500 +
501 + AM_CONDITIONAL([WITH_SYSTEMD_SYSTEM_UNITS],
502 + [test x"$with_systemdsystemunitdir" != x"no"])
503 +], [Please replace WITH_SYSTEMD_SYSTEM_UNITS automake conditionals with WITH_SYSTEMDSYSTEMUNITDIR and drop the definition of the former.])