systemd.m4 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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_PATH_PROG(PKG_CONFIG, pkg-config)
  24. AC_MSG_CHECKING(for Systemd with pkg-config)
  25. if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists systemd libsystemd-journal libsystemd-daemon ; then
  26. systemd_inc=`$PKG_CONFIG --cflags-only-I systemd libsystemd-journal libsystemd-daemon`
  27. systemd_lib=`$PKG_CONFIG --libs-only-l systemd libsystemd-journal libsystemd-daemon`
  28. systemd_defs="-DWITH_SYSTEMD"
  29. else
  30. AC_MSG_ERROR([no Systemd / Journald pkg-config files])
  31. fi
  32. # Check for the pkg config provided unit paths
  33. if test -n "$PKG_CONFIG" ; then
  34. default_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
  35. default_systemdsystemconfdir=`$PKG_CONFIG --variable=systemdsystemconfdir systemd`
  36. fi
  37. AC_MSG_CHECKING(for --with-systemdsystemunitdir)
  38. AC_ARG_WITH([systemdsystemunitdir],
  39. AS_HELP_STRING([--with-systemdsystemunitdir=PATH],
  40. [Directory for systemd service files (default: $with_systemdsystemunitdir)])
  41. )
  42. if test "$with_systemdsystemunitdir" = yes ; then
  43. if test -n "$default_systemdsystemunitdir" ; then
  44. with_systemdsystemunitdir=$default_systemdsystemunitdir
  45. AC_MSG_RESULT([$with_systemdsystemunitdir])
  46. else
  47. AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
  48. fi
  49. elif test "$with_systemdsystemunitdir" = no ; then
  50. with_systemdsystemunitdir=
  51. else
  52. AC_MSG_RESULT([$with_systemdsystemunitdir])
  53. fi
  54. AC_SUBST(with_systemdsystemunitdir)
  55. AC_MSG_CHECKING(for --with-systemdsystemconfdir)
  56. AC_ARG_WITH([systemdsystemconfdir],
  57. AS_HELP_STRING([--with-systemdsystemconfdir=PATH],
  58. [Directory for systemd service files (default: $with_systemdsystemconfdir)])
  59. )
  60. if test "$with_systemdsystemconfdir" = yes ; then
  61. if test -n "$default_systemdsystemconfdir" ; then
  62. with_systemdsystemconfdir=$default_systemdsystemconfdir
  63. AC_MSG_RESULT([$with_systemdsystemconfdir])
  64. else
  65. AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
  66. fi
  67. elif test "$with_systemdsystemconfdir" = no ; then
  68. with_systemdsystemconfdir=
  69. else
  70. AC_MSG_RESULT([$with_systemdsystemconfdir])
  71. fi
  72. AC_SUBST(with_systemdsystemconfdir)
  73. if test -n "$with_systemdsystemunitdir" -o -n "$with_systemdsystemconfdir" ; then
  74. if test -z "$with_systemdgroupname" ; then
  75. with_systemdgroupname=$PACKAGE_NAME.target
  76. fi
  77. AC_MSG_CHECKING(for --with-systemdgroupname)
  78. AC_ARG_WITH([systemdgroupname],
  79. AS_HELP_STRING([--with-systemdgroupname=NAME],
  80. [Name of group target for all instances (default: $with_systemdgroupname)])
  81. )
  82. if test "$with_systemdgroupname" = yes ; then
  83. AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
  84. elif test "$with_systemdgroupname" = no ; then
  85. AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
  86. else
  87. AC_MSG_RESULT([$with_systemdgroupname])
  88. fi
  89. AC_SUBST(with_systemdgroupname)
  90. fi
  91. fi
  92. # End of with_systemd
  93. AM_CONDITIONAL([SYSTEMD],[test -n "$with_systemd"])