Push service file into repo

Per systemd daemon guidelines, store the service file in the repository
and install it via the bitbake recipe.

Change-Id: I7da6f7a4d69513bb3358bb23a5ca63db789a9bab
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/configure.ac b/configure.ac
index 42e73c3..c9a2591 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,28 @@
 # Checks for library functions.
 LT_INIT # Required for systemd linking
 
+AC_ARG_VAR(SNOOP_DEVICE, "Path to snoop device")
+AC_ARG_VAR(POST_CODE_BYTES, "Post code byte size")
+AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service")
+AC_ARG_VAR(sbindir, "sbin full path")
+AS_IF([test "x$sbindir" == "x"], [sbindir="/usr/sbin"])
+
+PKG_PROG_PKG_CONFIG
+AC_ARG_WITH([systemdsystemunitdir],
+     [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
+     [with_systemdsystemunitdir=auto])
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
+     def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+
+     AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+   [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
+    [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
+    with_systemdsystemunitdir=no],
+   [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
+      [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
+AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
+
 # Check/set gtest specific functions.
 PKG_CHECK_MODULES([GTEST], [gtest_main], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
 PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])])
@@ -57,4 +79,5 @@
 
 # Create configured output
 AC_CONFIG_FILES([Makefile test/Makefile])
+AC_CONFIG_FILES([lpcsnoop.service])
 AC_OUTPUT