Removing lxsession from Recommends, it doesn't related to lxdm in any way.
[debian/lxdm.git] / configure.ac
index e952473..865d779 100644 (file)
@@ -2,8 +2,8 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.63])
-AC_INIT([lxdm], [0.4.1], [http://lxde.org/])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AC_INIT([lxdm], [0.5.1], [http://lxde.org/])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects no-dist-gzip dist-xz])
 
 AC_CONFIG_SRCDIR([src/lxdm.c])
 AC_CONFIG_HEADERS([config.h])
@@ -16,10 +16,19 @@ AM_PROG_CC_C_O
 # Checks for libraries.
 AC_CHECK_LIB([crypt], [crypt])
 
-AC_ARG_WITH(pam,AC_HELP_STRING([--without-pam],[build without pam]),
-[],[AC_CHECK_LIB([pam], [pam_open_session])])
-
-AC_CHECK_LIB([ck-connector],[ck_connector_open_session])
+# Check for PAM support
+AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam],[Use PAM for authentication]),
+       [USE_PAM=$withval], [USE_PAM=$use_pam_default])
+if test "x$USE_PAM" != "xno" ; then
+       AC_SEARCH_LIBS(pam_open_session,[pam])
+       AC_CHECK_FUNC(pam_open_session, 
+               [USE_PAM=1
+                       AC_DEFINE(USE_PAM,1,[Use PAM for authentication])],
+               [if test "x$USE_PAM" != "xtry" ; then
+                       AC_MSG_ERROR(["PAM support requested, but pam_open_session not found."])
+                fi])
+fi
+AM_CONDITIONAL(HAVE_PAM, [test -n "$USE_PAM" -a "x$USE_PAM" != xno ])
 
 # Checks for header files.
 AC_PATH_X
@@ -80,11 +89,22 @@ PKG_CHECK_MODULES(GTK, [$pkg_modules])
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
-PKG_CHECK_MODULES(CONSOLEKIT, "ck-connector",[
+
+AC_ARG_ENABLE(consolekit,
+       AC_HELP_STRING([--disable-consolekit],[disable ConsoleKit support]),
+       [enable_consolekit=$enableval],
+       [enable_consolekit=yes]
+)
+
+if test "x$enable_consolekit" = "xyes" ; then
+  PKG_CHECK_MODULES(CONSOLEKIT, "ck-connector",[
        AC_SUBST(CONSOLEKIT_CFLAGS)
        AC_SUBST(CONSOLEKIT_LIBS)],[
        echo "ConsoleKit devel package not found"
        ])
+  AC_CHECK_LIB([ck-connector],[ck_connector_open_session])
+fi
+
 
 AC_ARG_ENABLE(password,
 AC_HELP_STRING([--enable-password],[enable to load autologin password store at config file]),
@@ -118,7 +138,7 @@ if test "x$enable_debug" = "x$yes" ; then
 fi
 
 AC_ARG_WITH(xconn,
-       [AC_HELP_STRING([-with-xconn=@<:@xlib/xcb@:>@],[use xlib or xcb to use])],
+       [AC_HELP_STRING([--with-xconn=@<:@xlib/xcb@:>@],[use xlib or xcb to use])],
        [if test "x$with_xconn" = "xxlib"; then
                PKG_CHECK_MODULES(XCONN,"x11")
                AC_SUBST(XCONN_CFLAGS)
@@ -138,16 +158,55 @@ AC_ARG_WITH(xconn,
        ]
 )
 
+AC_ARG_WITH([systemdsystemunitdir],
+        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+        [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+if test "x$with_systemdsystemunitdir" != xno; then
+        AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+
 GETTEXT_PACKAGE=lxdm
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
 
+AC_DEFUN([AS_AC_EXPAND],[
+       EXP_VAR=[$1]
+       FROM_VAR=[$2]
+       dnl first expand prefix and exec_prefix if necessary
+       prefix_save=$prefix
+       exec_prefix_save=$exec_prefix
+       dnl if no prefix given, then use /usr/local, the default prefix
+       if test "x$prefix" = "xNONE"; then
+       prefix="$ac_default_prefix"
+       fi
+       dnl if no exec_prefix given, then use prefix
+       if test "x$exec_prefix" = "xNONE"; then
+       exec_prefix=$prefix
+       fi
+       full_var="$FROM_VAR"
+       dnl loop until it doesn not change anymore
+       while true; do
+       new_full_var="`eval echo $full_var`"
+       if test "x$new_full_var" = "x$full_var"; then break; fi
+       full_var=$new_full_var
+       done
+       dnl clean up
+       full_var=$new_full_var
+       AC_SUBST([$1], "$full_var")
+       dnl restore prefix and exec_prefix
+       prefix=$prefix_save
+       exec_prefix=$exec_prefix_save
+])
+AS_AC_EXPAND(FULL_LIBEXECDIR, $libexecdir)
+
 AC_CONFIG_FILES([
        Makefile
        lxdm.spec
        src/Makefile
        po/Makefile.in
        pam/Makefile
+       systemd/Makefile
        data/Makefile
        data/PostLogin
        data/PostLogout
@@ -155,6 +214,7 @@ AC_CONFIG_FILES([
        data/PreReboot
        data/PreShutdown
        data/LoginReady
+       data/lxdm.conf
 ])
 AC_CONFIG_FILES([data/lxdm], [chmod +x data/lxdm])
 AC_OUTPUT