Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/10893


Change subject: Install systemd services with autotools
......................................................................

Install systemd services with autotools

Change-Id: I563559f5b501eded44efafc60bb0c9ffdea20b3e
---
M Makefile.am
M configure.ac
A contrib/Makefile.am
A contrib/systemd/Makefile.am
R contrib/systemd/osmo-ggsn.service
M debian/osmo-ggsn.install
D debian/osmo-ggsn.service
M debian/rules
8 files changed, 35 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/93/10893/1

diff --git a/Makefile.am b/Makefile.am
index f9849c0..be378be 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-SUBDIRS = lib gtp ggsn sgsnemu doc tests
+SUBDIRS = lib gtp ggsn sgsnemu doc contrib tests

 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgtp.pc
@@ -12,4 +12,7 @@

 EXTRA_DIST = git-version-gen .version README.md README.FreeBSD README.MacOSX

+DISTCHECK_CONFIGURE_FLAGS = \
+       --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
 @RELMAKE@
diff --git a/configure.ac b/configure.ac
index 62812ae..bfa1364 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,9 +38,9 @@


 case "${host}" in
-  i*86-*-linux-gnu*)
+  i*86-*-linux-gnu*)
     EXEC_LDADD="" ;;
-  *solaris*)
+  *solaris*)
     EXEC_LDADD="-lresolv -lsocket -lnsl" ;;
 esac

@@ -126,7 +126,7 @@
 # Checks for library functions.
 AC_PROG_GCC_TRADITIONAL
 # AC_FUNC_MALLOC
-# AC_FUNC_MEMCMP
+# AC_FUNC_MEMCMP
 AC_CHECK_FUNCS([gethostbyname inet_ntoa memset select socket strdup strerror 
strtol])
 AC_CHECK_FUNCS(inet_aton inet_addr, break)

@@ -169,6 +169,22 @@
        CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
 fi

+# https://www.freedesktop.org/software/systemd/man/daemon.html
+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"])
+
 AC_MSG_RESULT([CFLAGS="$CFLAGS"])
 AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])

@@ -181,6 +197,8 @@
                  intl/Makefile
                  po/Makefile
                  sgsnemu/Makefile
+                 contrib/Makefile
+                 contrib/systemd/Makefile
                  tests/Makefile
                  tests/lib/Makefile
                  tests/gtp/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 0000000..3439c97
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = systemd
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 0000000..e6ad299
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,5 @@
+if HAVE_SYSTEMD
+EXTRA_DIST = osmo-ggsn.service
+systemdsystemunit_DATA = \
+  osmo-ggsn.service
+endif
diff --git a/contrib/osmo-ggsn.service b/contrib/systemd/osmo-ggsn.service
similarity index 100%
rename from contrib/osmo-ggsn.service
rename to contrib/systemd/osmo-ggsn.service
diff --git a/debian/osmo-ggsn.install b/debian/osmo-ggsn.install
index 522a3d1..17caef7 100644
--- a/debian/osmo-ggsn.install
+++ b/debian/osmo-ggsn.install
@@ -1,3 +1,4 @@
+/lib/systemd/system/osmo-ggsn.service
 /usr/bin/osmo-ggsn
 /usr/bin/sgsnemu
 /usr/share/man/man8/*
diff --git a/debian/osmo-ggsn.service b/debian/osmo-ggsn.service
deleted file mode 120000
index 3bc7d3d..0000000
--- a/debian/osmo-ggsn.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/osmo-ggsn.service
\ No newline at end of file
diff --git a/debian/rules b/debian/rules
index 5db7886..fa087ed 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,3 +17,6 @@
 override_dh_strip:
        dh_strip -posmo-ggsn --dbg-package=osmo-ggsn-dbg
        dh_strip -plibgtp3 --dbg-package=libgtp-dbg
+
+override_dh_auto_configure:
+       dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system

--
To view, visit https://gerrit.osmocom.org/10893
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I563559f5b501eded44efafc60bb0c9ffdea20b3e
Gerrit-Change-Number: 10893
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>

Reply via email to