1# macros for configuring systemd 2# Copyright 2015, Sami Kerola, CloudFlare. 3# BSD licensed. 4AC_ARG_ENABLE([systemd], 5 [AS_HELP_STRING([--enable-systemd], [compile with systemd support (requires libsystemd, pkg-config)])], 6 [], [enable_systemd=no]) 7have_systemd=no 8AS_IF([test "x$enable_systemd" != xno], [ 9 if test -n "$PKG_CONFIG"; then 10 dnl systemd v209 or newer 11 have_systemd=no 12 PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], []) 13 dnl old systemd library 14 AS_IF([test "x$have_systemd" != "xyes"], [ 15 have_systemd_daemon=no 16 PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon], 17 [have_systemd_daemon=yes], []) 18 AS_IF([test "x$have_systemd_daemon" = "xyes"], 19 [have_systemd=yes]) 20 ]) 21 AS_CASE([$enable_systemd:$have_systemd], 22 [yes:no], 23 [AC_MSG_ERROR([systemd enabled but libsystemd not found])], 24 [*:yes], 25 [AC_DEFINE([HAVE_SYSTEMD], [1], [Define to 1 if systemd should be used]) 26 LIBS="$LIBS $SYSTEMD_LIBS" 27 ] 28 ) 29 else 30 AC_MSG_ERROR([systemd enabled but need pkg-config to configure for it]) 31 fi 32]) 33AM_CONDITIONAL([USE_SYSTEMD], [test "x$have_systemd" = xyes]) 34