summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2012-03-30 13:24:18 -0700
committerAuke Kok <auke-jan.h.kok@intel.com>2012-03-30 13:24:18 -0700
commitb05acd30569e15f25448fbcf59766fcf1d6b6ce9 (patch)
treed39f90b447b77c493475d9dd1c5a044d176bd9f8
parent44d9195cb5730f2745b3461e4bc958b352db2ed7 (diff)
downloadxorg-launch-helper-b05acd30569e15f25448fbcf59766fcf1d6b6ce9.tar.gz
xorg-launch-helper-b05acd30569e15f25448fbcf59766fcf1d6b6ce9.tar.bz2
xorg-launch-helper-b05acd30569e15f25448fbcf59766fcf1d6b6ce9.zip
Build code to install the service file and changes in the previous commit.
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac27
-rw-r--r--src/main.c2
-rw-r--r--src/user-session.h2
4 files changed, 29 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 0a7ddb8..bdea291 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,3 +2,7 @@ SUBDIRS = src
EXTRA_DIST = AUTHORS COPYING INSTALL
+DISTCHECK_CONFIGURE_FLAGS = "--with-default-username=user"
+
+systemdunitdir = @SYSTEMD_UNITDIR@
+systemdunit_DATA = user-session.service
diff --git a/configure.ac b/configure.ac
index 963d3ef..efa2913 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,8 +4,8 @@
AC_PREREQ([2.68])
AC_INIT([user-session], [0], [auke-jan.h.kok@intel.com])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
-AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_FILES([Makefile src/Makefile])
+AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
@@ -19,12 +19,31 @@ AC_CHECK_LIB([Xau], [main], ,
AC_CHECK_LIB([pam], [main], ,
AC_MSG_ERROR([libpam is required but was not found]))
# FIXME: Replace `main' with a function in `-lpthread':
-#AC_CHECK_LIB([pthread], [main], ,
-# AC_MSG_ERROR([libpthread is required but was not found]))
+AC_CHECK_LIB([pthread], [main], ,
+ AC_MSG_ERROR([libpthread is required but was not found]))
# FIXME: Replace `main' with a function in `-lrt':
AC_CHECK_LIB([rt], [main], ,
AC_MSG_ERROR([librt is required but was not found]))
+PKG_CHECK_MODULES([SYSTEMD], [systemd])
+
+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)
+AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
+fi
+
+echo "checking for default username to logon... "
+AC_ARG_WITH([default_username], AC_HELP_STRING([--with-default-username=USER],
+ [default username to logon (default: unset)]), [default_username=${withval}],)
+if (test -n "${default_username}"); then
+ AC_DEFINE_UNQUOTED([DEFAULT_USERNAME], ["$default_username"], [Which user to logon])
+else
+ AC_ERROR([Required value for --with-default-username=<USER> is missing.])
+fi
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/ioctl.h sys/time.h syslog.h unistd.h])
@@ -37,5 +56,5 @@ AC_FUNC_CHOWN
AC_FUNC_FORK
AC_CHECK_FUNCS([clock_gettime gettimeofday memset mkdir setenv strchr strdup strstr uname])
-AC_OUTPUT
+AC_OUTPUT(user-session.service)
diff --git a/src/main.c b/src/main.c
index 750423c..19161c1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,8 +20,6 @@
#include "user-session.h"
-#define DEFAULT_USERNAME "app"
-
int tty = 1;
char username[256] = DEFAULT_USERNAME;
char dpinum[256] = "auto";
diff --git a/src/user-session.h b/src/user-session.h
index a56bc62..a130865 100644
--- a/src/user-session.h
+++ b/src/user-session.h
@@ -5,6 +5,8 @@
#include <sys/types.h>
#include <pwd.h>
+#include "../config.h"
+
/*
* Target user information
*/