systemd.m4 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. AC_PATH_PROG(PKG_CONFIG, pkg-config)
  36. AC_MSG_CHECKING(for Systemd with pkg-config)
  37. if test "$with_journald" = yes; then
  38. if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists systemd libsystemd-journal libsystemd-daemon ; then
  39. systemd_inc=`$PKG_CONFIG --cflags-only-I systemd libsystemd-journal libsystemd-daemon`
  40. systemd_lib=`$PKG_CONFIG --libs-only-l systemd libsystemd-journal libsystemd-daemon`
  41. systemd_defs="-DWITH_SYSTEMD -DHAVE_JOURNALD"
  42. else
  43. AC_MSG_ERROR([no Systemd / Journald pkg-config files])
  44. fi
  45. else
  46. if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists systemd libsystemd-daemon ; then
  47. systemd_inc=`$PKG_CONFIG --cflags-only-I systemd libsystemd-daemon`
  48. systemd_lib=`$PKG_CONFIG --libs-only-l systemd libsystemd-daemon`
  49. systemd_defs="-DWITH_SYSTEMD"
  50. else
  51. AC_MSG_ERROR([no Systemd pkg-config files])
  52. fi
  53. fi
  54. # Check for the pkg config provided unit paths
  55. if test -n "$PKG_CONFIG" ; then
  56. default_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
  57. default_systemdsystemconfdir=`$PKG_CONFIG --variable=systemdsystemconfdir systemd`
  58. fi
  59. AC_MSG_CHECKING(for --with-systemdsystemunitdir)
  60. AC_ARG_WITH([systemdsystemunitdir],
  61. AS_HELP_STRING([--with-systemdsystemunitdir=PATH],
  62. [Directory for systemd service files (default: $with_systemdsystemunitdir)])
  63. )
  64. if test "$with_systemdsystemunitdir" = yes ; then
  65. if test -n "$default_systemdsystemunitdir" ; then
  66. with_systemdsystemunitdir=$default_systemdsystemunitdir
  67. AC_MSG_RESULT([$with_systemdsystemunitdir])
  68. else
  69. AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
  70. fi
  71. elif test "$with_systemdsystemunitdir" = no ; then
  72. with_systemdsystemunitdir=
  73. else
  74. AC_MSG_RESULT([$with_systemdsystemunitdir])
  75. fi
  76. AC_SUBST(with_systemdsystemunitdir)
  77. AC_MSG_CHECKING(for --with-systemdsystemconfdir)
  78. AC_ARG_WITH([systemdsystemconfdir],
  79. AS_HELP_STRING([--with-systemdsystemconfdir=PATH],
  80. [Directory for systemd service files (default: $with_systemdsystemconfdir)])
  81. )
  82. if test "$with_systemdsystemconfdir" = yes ; then
  83. if test -n "$default_systemdsystemconfdir" ; then
  84. with_systemdsystemconfdir=$default_systemdsystemconfdir
  85. AC_MSG_RESULT([$with_systemdsystemconfdir])
  86. else
  87. AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
  88. fi
  89. elif test "$with_systemdsystemconfdir" = no ; then
  90. with_systemdsystemconfdir=
  91. else
  92. AC_MSG_RESULT([$with_systemdsystemconfdir])
  93. fi
  94. AC_SUBST(with_systemdsystemconfdir)
  95. if test -z "$with_systemdgroupname" ; then
  96. with_systemdgroupname=$PACKAGE_NAME.target
  97. fi
  98. AC_MSG_CHECKING(for --with-systemdgroupname)
  99. AC_ARG_WITH([systemdgroupname],
  100. AS_HELP_STRING([--with-systemdgroupname=NAME],
  101. [Name of group target for all instances (default: $with_systemdgroupname)])
  102. )
  103. if test "$with_systemdgroupname" = yes ; then
  104. AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
  105. elif test "$with_systemdgroupname" = no ; then
  106. AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
  107. else
  108. AC_MSG_RESULT([$with_systemdgroupname])
  109. fi
  110. AC_SUBST(with_systemdgroupname)
  111. fi
  112. # End of with_systemd
  113. AM_CONDITIONAL([SYSTEMD],[test -n "$with_systemd"])
  114. AM_CONDITIONAL([JOURNALD],[test -n "$with_journald"])