systemd.m4 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # BEGIN COPYRIGHT BLOCK
  2. # Copyright (C) 2015 Red Hat, Inc.
  3. # All rights reserved.
  4. #
  5. # License: GPL (version 3 or any later version).
  6. # See LICENSE for details.
  7. # END COPYRIGHT BLOCK
  8. AC_CHECKING(for Systemd)
  9. # check for --with-systemd
  10. AC_MSG_CHECKING(for --with-systemd)
  11. AC_ARG_WITH(systemd, AS_HELP_STRING([--with-systemd],[Enable Systemd native integration.]),
  12. [
  13. if test "$withval" = yes
  14. then
  15. AC_MSG_RESULT([using systemd native features])
  16. with_systemd=yes
  17. else
  18. AC_MSG_RESULT(no)
  19. fi
  20. ],
  21. AC_MSG_RESULT(no))
  22. if test "$with_systemd" = yes; then
  23. AC_MSG_CHECKING(for --with-journald)
  24. AC_ARG_WITH(journald, AS_HELP_STRING([--with-journald],[Enable Journald native integration. WARNING, this may cause system instability]),
  25. [
  26. if test "$withval" = yes
  27. then
  28. AC_MSG_RESULT([using journald logging: WARNING, this may cause system instability])
  29. with_systemd=yes
  30. else
  31. AC_MSG_RESULT(no)
  32. fi
  33. ],
  34. AC_MSG_RESULT(no))
  35. PKG_CHECK_MODULES([SYSTEMD], [libsystemd])
  36. if test "$with_journald" = yes; then
  37. systemd_defs="-DWITH_SYSTEMD -DHAVE_JOURNALD"
  38. else
  39. systemd_defs="-DWITH_SYSTEMD"
  40. fi
  41. # Check for the pkg config provided unit paths
  42. if test -n "$PKG_CONFIG" ; then
  43. default_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
  44. default_systemdsystemconfdir=`$PKG_CONFIG --variable=systemdsystemconfdir systemd`
  45. fi
  46. AC_MSG_CHECKING(for --with-systemdsystemunitdir)
  47. AC_ARG_WITH([systemdsystemunitdir],
  48. AS_HELP_STRING([--with-systemdsystemunitdir=PATH],
  49. [Directory for systemd service files (default: $with_systemdsystemunitdir)])
  50. )
  51. if test "$with_systemdsystemunitdir" = yes ; then
  52. if test -n "$default_systemdsystemunitdir" ; then
  53. with_systemdsystemunitdir=$default_systemdsystemunitdir
  54. AC_MSG_RESULT([$with_systemdsystemunitdir])
  55. else
  56. AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
  57. fi
  58. elif test "$with_systemdsystemunitdir" = no ; then
  59. with_systemdsystemunitdir=
  60. else
  61. AC_MSG_RESULT([$with_systemdsystemunitdir])
  62. fi
  63. AC_SUBST(with_systemdsystemunitdir)
  64. AC_MSG_CHECKING(for --with-systemdsystemconfdir)
  65. AC_ARG_WITH([systemdsystemconfdir],
  66. AS_HELP_STRING([--with-systemdsystemconfdir=PATH],
  67. [Directory for systemd service files (default: $with_systemdsystemconfdir)])
  68. )
  69. if test "$with_systemdsystemconfdir" = yes ; then
  70. if test -n "$default_systemdsystemconfdir" ; then
  71. with_systemdsystemconfdir=$default_systemdsystemconfdir
  72. AC_MSG_RESULT([$with_systemdsystemconfdir])
  73. else
  74. AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
  75. fi
  76. elif test "$with_systemdsystemconfdir" = no ; then
  77. with_systemdsystemconfdir=
  78. else
  79. AC_MSG_RESULT([$with_systemdsystemconfdir])
  80. fi
  81. AC_SUBST(with_systemdsystemconfdir)
  82. if test -z "$with_systemdgroupname" ; then
  83. with_systemdgroupname=$PACKAGE_NAME.target
  84. fi
  85. AC_MSG_CHECKING(for --with-systemdgroupname)
  86. AC_ARG_WITH([systemdgroupname],
  87. AS_HELP_STRING([--with-systemdgroupname=NAME],
  88. [Name of group target for all instances (default: $with_systemdgroupname)])
  89. )
  90. if test "$with_systemdgroupname" = yes ; then
  91. AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
  92. elif test "$with_systemdgroupname" = no ; then
  93. AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
  94. else
  95. AC_MSG_RESULT([$with_systemdgroupname])
  96. fi
  97. AC_SUBST(with_systemdgroupname)
  98. if test -z "$with_tmpfiles_d" ; then
  99. if test -d $sysconfdir/tmpfiles.d ; then
  100. tmpfiles_d='$(sysconfdir)/tmpfiles.d'
  101. fi
  102. fi
  103. AC_MSG_CHECKING(for --with-tmpfiles-d)
  104. AC_ARG_WITH(tmpfiles-d,
  105. AS_HELP_STRING([--with-tmpfiles-d=PATH],
  106. [system uses tmpfiles.d to handle temp files/dirs (default: $tmpfiles_d)])
  107. )
  108. if test "$with_tmpfiles_d" = yes ; then
  109. AC_MSG_ERROR([You must specify --with-tmpfiles-d=/full/path/to/tmpfiles.d directory])
  110. elif test "$with_tmpfiles_d" = no ; then
  111. tmpfiles_d=
  112. else
  113. tmpfiles_d=$with_tmpfiles_d
  114. AC_MSG_RESULT([$tmpfiles_d])
  115. fi
  116. fi
  117. # End of with_systemd
  118. AM_CONDITIONAL([SYSTEMD],[test -n "$with_systemd"])
  119. AM_CONDITIONAL([with_systemd],[test -n "$with_systemd"])
  120. AM_CONDITIONAL([JOURNALD],[test -n "$with_journald"])
  121. AM_CONDITIONAL([with_systemd_journald],[test -n "$with_journald"])
  122. AC_SUBST(systemd_defs)
  123. AC_SUBST(tmpfiles_d)