Adding upstream version 0.4.1.
[debian/lxdm.git] / configure.ac
CommitLineData
9931e273
DB
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.63])
5AC_INIT([lxdm], [0.4.1], [http://lxde.org/])
6AM_INIT_AUTOMAKE([-Wall -Werror foreign])
7
8AC_CONFIG_SRCDIR([src/lxdm.c])
9AC_CONFIG_HEADERS([config.h])
10
11# Checks for programs.
12AC_PROG_CC
13AC_PROG_INSTALL
14AM_PROG_CC_C_O
15
16# Checks for libraries.
17AC_CHECK_LIB([crypt], [crypt])
18
19AC_ARG_WITH(pam,AC_HELP_STRING([--without-pam],[build without pam]),
20[],[AC_CHECK_LIB([pam], [pam_open_session])])
21
22AC_CHECK_LIB([ck-connector],[ck_connector_open_session])
23
24# Checks for header files.
25AC_PATH_X
26AC_CHECK_HEADERS([shadow.h stdlib.h string.h unistd.h utmpx.h])
27
28# Checks for typedefs, structures, and compiler characteristics.
29AC_TYPE_PID_T
30
31# Checks for library functions.
32AC_FUNC_FORK
33AC_CHECK_FUNCS([atexit endpwent getspnam getusershell memset putenv strstr])
34
35PKG_CONFIG=pkg-config # FIXME: is this OK?
36# Check for ISO Codes, this is taken from gdm
37AC_MSG_CHECKING([whether iso-codes has iso-639 domain])
38if $PKG_CONFIG --variable=domains iso-codes | grep 639 >/dev/null ; then
39 AC_MSG_RESULT([yes])
40else
41 AC_MSG_RESULT([no])
42fi
43AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
44ISO_CODES=iso-codes
45
46IT_PROG_INTLTOOL([0.40.0])
47
48PKG_CHECK_MODULES(XLIB,x11)
49AC_SUBST(XLIB_CFLAGS)
50AC_SUBST(XLIB_LIBS)
51
52PKG_CHECK_MODULES(GLIB,glib-2.0)
53AC_SUBST(GLIB_CFLAGS)
54AC_SUBST(GLIB_LIBS)
55
56AC_ARG_ENABLE(gtk3,
57AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
58[case "${enableval}" in
59 yes) enable_gtk3=yes ;;
60 no) enable_gtk3=no ;;
61 *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
62esac],[])
63
64if test "x$enable_gtk3" = "xyes" ; then
65 pkg_modules="gdk-3.0"
66else
67 pkg_modules="gdk-2.0"
68fi
69PKG_CHECK_MODULES(GDK,[$pkg_modules])
70AC_SUBST(GDK_CFLAGS)
71AC_SUBST(GDK_LIBS)
72
73if test "x$enable_gtk3" = "xyes" ; then
74 CFLAGS="$CFLAGS -DENABLE_GTK3"
75 pkg_modules="gtk+-3.0 >= 3.0.0"
76else
77 pkg_modules="gtk+-2.0 >= 2.12.0"
78fi
79PKG_CHECK_MODULES(GTK, [$pkg_modules])
80AC_SUBST(GTK_CFLAGS)
81AC_SUBST(GTK_LIBS)
82
83PKG_CHECK_MODULES(CONSOLEKIT, "ck-connector",[
84 AC_SUBST(CONSOLEKIT_CFLAGS)
85 AC_SUBST(CONSOLEKIT_LIBS)],[
86 echo "ConsoleKit devel package not found"
87 ])
88
89AC_ARG_ENABLE(password,
90AC_HELP_STRING([--enable-password],[enable to load autologin password store at config file]),
91[case "${enableval}" in
92 yes) enable_password=yes ;;
93 no) enable_password=no ;;
94 *) AC_MSG_ERROR([bad value "${enableval}" for --enable-password, use "yes" (default) or "no".]) ;;
95esac],[])
96
97if test "x$enable_password" = "xyes" ; then
98 CFLAGS="$CFLAGS -DENABLE_PASSWORD"
99fi
100
101AC_ARG_ENABLE(xauth,
102 AC_HELP_STRING([--disable-xauth],[disable the xauth support ]),
103 [enable_xauth=$enablevar],
104 [enable_xauth=yes]
105)
106
107if test "x$enable_xauth" = "x$no" ; then
108 CFLAGS="$CFLAGS -DDISABLE_XAUTH"
109fi
110
111AC_ARG_ENABLE(debug,
112 AC_HELP_STRING([--enable-debug],[enable detailed debug]),
113 [enable_debug=$enablevar],
114 [enable_debug=yes]
115)
116if test "x$enable_debug" = "x$yes" ; then
117 CFLAGS="$CFLAGS -DLXDM_DEBUG"
118fi
119
120AC_ARG_WITH(xconn,
121 [AC_HELP_STRING([-with-xconn=@<:@xlib/xcb@:>@],[use xlib or xcb to use])],
122 [if test "x$with_xconn" = "xxlib"; then
123 PKG_CHECK_MODULES(XCONN,"x11")
124 AC_SUBST(XCONN_CFLAGS)
125 AC_SUBST(XCONN_LIBS)
126 CFLAGS="$CFLAGS -DLXDM_XCONN_XLIB"
127
128 else
129 PKG_CHECK_MODULES(XCONN,"xcb")
130 AC_SUBST(XCONN_CFLAGS)
131 AC_SUBST(XCONN_LIBS)
132 CFLAGS="$CFLAGS -DLXDM_XCONN_XCB"
133 fi],
134 [PKG_CHECK_MODULES(XCONN,"xcb")
135 AC_SUBST(XCONN_CFLAGS)
136 AC_SUBST(XCONN_LIBS)
137 CFLAGS="$CFLAGS -DLXDM_XCONN_XCB"
138 ]
139)
140
141GETTEXT_PACKAGE=lxdm
142AC_SUBST(GETTEXT_PACKAGE)
143AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
144
145AC_CONFIG_FILES([
146 Makefile
147 lxdm.spec
148 src/Makefile
149 po/Makefile.in
150 pam/Makefile
151 data/Makefile
152 data/PostLogin
153 data/PostLogout
154 data/PreLogin
155 data/PreReboot
156 data/PreShutdown
157 data/LoginReady
158])
159AC_CONFIG_FILES([data/lxdm], [chmod +x data/lxdm])
160AC_OUTPUT
161
162dnl sanity checks
163if test "$sysconfdir" != "/etc"; then
164 AC_MSG_WARN(sysconfdir is not /etc.)
165 AC_MSG_WARN(Please consider passing --sysconfdir=/etc to configure.)
166fi