dbusconf_DATA = src/connman.conf
-dbusdatadir = @DBUS_DATADIR@
+if SYSTEMD
+systemdunitdir = @SYSTEMD_UNITDIR@
-dbusdata_DATA = src/connman.service
+systemdunit_DATA = src/connman.service
+endif
endif
plugin_LTLIBRARIES =
fi
AC_SUBST(DBUS_DATADIR)
+AC_ARG_ENABLE(systemd, AC_HELP_STRING([--enable-systemd],
+ [enable systemd support]), [enable_systemd=${enableval}])
+if (test "${enable_systemd}" = "yes"); then
+ PKG_CHECK_MODULES(SYSTEMD, systemd, dummy=yes,
+ AC_MSG_ERROR(systemd is required))
+ SYSTEMD_UNITDIR="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
+ if (test -z "${SYSTEM_UNITDIR}"); then
+ SYSTEMD_UNITDIR="/lib/systemd/system"
+ fi
+ AC_SUBST(SYSTEMD_UNITDIR)
+fi
+AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" = "yes")
+
AC_ARG_ENABLE(polkit,
AC_HELP_STRING([--enable-polkit], [enable PolicyKit support]),
[enable_polkit=${enableval}], [enable_polkit="no"])
-[D-BUS Service]
-Name=org.moblin.connman
-Exec=@prefix@/sbin/connmand
-User=root
+[Unit]
+Description=Connection service
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=org.moblin.connman
+ExecStart=@prefix@/sbin/connmand -n
+
+[Install]
+WantedBy=multi-user.target