diff --git a/Makefile.am b/Makefile.am index 9ea4094..7cedca9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,4 @@ time_daemon_LDADD = $(requiredlibs) time_daemon_LDFLAGS = -lpthread @GLIB_LIBS@ # Systemd service file installation -if HAVE_SYSTEMD systemdsystemunit_DATA = time-daemon.service -endif diff --git a/build_script.sh b/build_script.sh index 23fc85f..7a92f12 100755 --- a/build_script.sh +++ b/build_script.sh @@ -50,7 +50,12 @@ echo "Running configure.." echo "Running make.." make || { echo "make failed"; exit 1; } -make install || { echo "make install failed"; exit 1; } +# Use sudo only if not running as root +if [ "$(id -u)" -eq 0 ]; then + make install || { echo "make install failed"; exit 1; } +else + sudo make install || { echo "make install failed"; exit 1; } +fi FILES_TO_CLEAN=( aclocal.m4 configure ar-lib config.h config.h.in config.log config.status libtool diff --git a/configure.ac b/configure.ac index b1e554b..74e7801 100644 --- a/configure.ac +++ b/configure.ac @@ -3,8 +3,8 @@ # Requires autoconf tool later than 2.61 AC_PREREQ(2.61) -# Initialize the qmi-framework package version 1.0.0 -AC_INIT([time-services],1.0.0) +# Initialize the qmi-framework package version 0.1.1 +AC_INIT([time-services],0.1.1) # Does not strictly follow GNU Coding standards AM_INIT_AUTOMAKE([foreign]) # Disables auto rebuilding of configure, Makefile.ins @@ -41,25 +41,14 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, AC_MSG_ERROR(GLib >= 2.16 i GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" AC_SUBST(GLIB_LIBS) -# Check for systemd +# Systemd service file installation directory (no systemd dependency required) AC_ARG_WITH([systemdsystemunitdir], - [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])], - [], - [with_systemdsystemunitdir=auto]) + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], + [Directory for systemd service files (default: ${prefix}/lib/systemd/system)])], + [systemdsystemunitdir=$withval], + [systemdsystemunitdir='${prefix}/lib/systemd/system']) -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_SUBST([systemdsystemunitdir]) AC_CONFIG_FILES([ \ Makefile \