build: Handle systemd system and user unit directories

This commit is contained in:
Marcel Holtmann 2012-12-11 14:52:23 +01:00
parent 225f6a4257
commit c7476c4e65
2 changed files with 35 additions and 12 deletions

View File

@ -42,12 +42,12 @@ conf_DATA =
statedir = $(localstatedir)/lib/bluetooth
state_DATA =
endif
if SYSTEMD
systemdunitdir = @SYSTEMD_UNITDIR@
systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@
systemdunit_DATA = src/bluetooth.service
endif
systemdsystemunit_DATA = src/bluetooth.service
endif
EXTRA_DIST += src/bluetooth.service.in

View File

@ -80,15 +80,6 @@ else
fi
AC_SUBST(DBUS_DATADIR)
AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
[path to systemd service directory]), [path_systemdunit=${withval}],
[path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
if (test -n "${path_systemdunit}"); then
SYSTEMD_UNITDIR="${path_systemdunit}"
AC_SUBST(SYSTEMD_UNITDIR)
fi
AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
AC_ARG_ENABLE(library, AC_HELP_STRING([--enable-library],
[install Bluetooth library]), [enable_library=${enableval}])
AM_CONDITIONAL(LIBRARY, test "${enable_library}" = "yes")
@ -175,6 +166,38 @@ AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no" &&
test "${enable_readline}" != "no")
AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
[disable systemd integration]), [enable_systemd=${enableval}])
AC_ARG_WITH([systemdsystemunitdir],
AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
[path to systemd system unit directory]),
[path_systemunitdir=${withval}])
if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
AC_MSG_CHECKING([sytemd system unit dir])
path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
if (test -z "${path_systemunitdir}"); then
AC_MSG_ERROR(systemd system unit directory is required)
fi
AC_MSG_RESULT([${path_systemunitdir}])
SYSTEMD_SYSTEMUNITDIR="${path_systemunitdir}"
AC_SUBST(SYSTEMD_SYSTEMUNITDIR)
fi
AC_ARG_WITH([systemduserunitdir],
AC_HELP_STRING([--with-systemduserunitdir=DIR],
[path to systemd user unit directory]),
[path_userunitdir=${withval}])
if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
AC_MSG_CHECKING([sytemd user unit dir])
path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
if (test -z "${path_userunitdir}"); then
AC_MSG_ERROR(systemd user unit directory is required)
fi
SYSTEMD_USERUNITDIR="${path_userunitdir}"
AC_MSG_RESULT([${path_userunitdir}])
AC_SUBST(SYSTEMD_USERUNITDIR)
fi
AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
[do not install configuration and data files]),
[enable_datafiles=${enableval}])