systemd.m4 4.2 KB

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