Merging upstream version 0.5.3 (Closes: #805659 CVE-2015-8308).
[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])
37f5420c 5AC_INIT([lxdm], [0.5.3], [http://lxde.org/])
d6ba7c28 6AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects no-dist-gzip dist-xz])
9931e273
DB
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
d6ba7c28
AG
19# Check for PAM support
20AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam],[Use PAM for authentication]),
21 [USE_PAM=$withval], [USE_PAM=$use_pam_default])
22if test "x$USE_PAM" != "xno" ; then
23 AC_SEARCH_LIBS(pam_open_session,[pam])
24 AC_CHECK_FUNC(pam_open_session,
25 [USE_PAM=1
26 AC_DEFINE(USE_PAM,1,[Use PAM for authentication])],
27 [if test "x$USE_PAM" != "xtry" ; then
28 AC_MSG_ERROR(["PAM support requested, but pam_open_session not found."])
29 fi])
30fi
31AM_CONDITIONAL(HAVE_PAM, [test -n "$USE_PAM" -a "x$USE_PAM" != xno ])
9931e273
DB
32
33# Checks for header files.
34AC_PATH_X
35AC_CHECK_HEADERS([shadow.h stdlib.h string.h unistd.h utmpx.h])
36
37# Checks for typedefs, structures, and compiler characteristics.
38AC_TYPE_PID_T
39
40# Checks for library functions.
41AC_FUNC_FORK
42AC_CHECK_FUNCS([atexit endpwent getspnam getusershell memset putenv strstr])
43
44PKG_CONFIG=pkg-config # FIXME: is this OK?
45# Check for ISO Codes, this is taken from gdm
46AC_MSG_CHECKING([whether iso-codes has iso-639 domain])
47if $PKG_CONFIG --variable=domains iso-codes | grep 639 >/dev/null ; then
48 AC_MSG_RESULT([yes])
49else
50 AC_MSG_RESULT([no])
51fi
52AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
53ISO_CODES=iso-codes
54
55IT_PROG_INTLTOOL([0.40.0])
56
57PKG_CHECK_MODULES(XLIB,x11)
58AC_SUBST(XLIB_CFLAGS)
59AC_SUBST(XLIB_LIBS)
60
61PKG_CHECK_MODULES(GLIB,glib-2.0)
62AC_SUBST(GLIB_CFLAGS)
63AC_SUBST(GLIB_LIBS)
64
65AC_ARG_ENABLE(gtk3,
66AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
67[case "${enableval}" in
68 yes) enable_gtk3=yes ;;
69 no) enable_gtk3=no ;;
70 *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
71esac],[])
72
73if test "x$enable_gtk3" = "xyes" ; then
74 pkg_modules="gdk-3.0"
75else
76 pkg_modules="gdk-2.0"
77fi
78PKG_CHECK_MODULES(GDK,[$pkg_modules])
79AC_SUBST(GDK_CFLAGS)
80AC_SUBST(GDK_LIBS)
81
82if test "x$enable_gtk3" = "xyes" ; then
83 CFLAGS="$CFLAGS -DENABLE_GTK3"
84 pkg_modules="gtk+-3.0 >= 3.0.0"
85else
86 pkg_modules="gtk+-2.0 >= 2.12.0"
87fi
88PKG_CHECK_MODULES(GTK, [$pkg_modules])
89AC_SUBST(GTK_CFLAGS)
90AC_SUBST(GTK_LIBS)
91
d6ba7c28
AG
92
93AC_ARG_ENABLE(consolekit,
94 AC_HELP_STRING([--disable-consolekit],[disable ConsoleKit support]),
95 [enable_consolekit=$enableval],
96 [enable_consolekit=yes]
97)
98
99if test "x$enable_consolekit" = "xyes" ; then
100 PKG_CHECK_MODULES(CONSOLEKIT, "ck-connector",[
9931e273
DB
101 AC_SUBST(CONSOLEKIT_CFLAGS)
102 AC_SUBST(CONSOLEKIT_LIBS)],[
103 echo "ConsoleKit devel package not found"
104 ])
d6ba7c28
AG
105 AC_CHECK_LIB([ck-connector],[ck_connector_open_session])
106fi
107
9931e273
DB
108
109AC_ARG_ENABLE(password,
110AC_HELP_STRING([--enable-password],[enable to load autologin password store at config file]),
111[case "${enableval}" in
112 yes) enable_password=yes ;;
113 no) enable_password=no ;;
114 *) AC_MSG_ERROR([bad value "${enableval}" for --enable-password, use "yes" (default) or "no".]) ;;
115esac],[])
116
117if test "x$enable_password" = "xyes" ; then
118 CFLAGS="$CFLAGS -DENABLE_PASSWORD"
119fi
120
121AC_ARG_ENABLE(xauth,
122 AC_HELP_STRING([--disable-xauth],[disable the xauth support ]),
123 [enable_xauth=$enablevar],
124 [enable_xauth=yes]
125)
126
127if test "x$enable_xauth" = "x$no" ; then
128 CFLAGS="$CFLAGS -DDISABLE_XAUTH"
129fi
130
131AC_ARG_ENABLE(debug,
132 AC_HELP_STRING([--enable-debug],[enable detailed debug]),
133 [enable_debug=$enablevar],
134 [enable_debug=yes]
135)
136if test "x$enable_debug" = "x$yes" ; then
137 CFLAGS="$CFLAGS -DLXDM_DEBUG"
138fi
139
140AC_ARG_WITH(xconn,
d6ba7c28 141 [AC_HELP_STRING([--with-xconn=@<:@xlib/xcb@:>@],[use xlib or xcb to use])],
9931e273
DB
142 [if test "x$with_xconn" = "xxlib"; then
143 PKG_CHECK_MODULES(XCONN,"x11")
144 AC_SUBST(XCONN_CFLAGS)
145 AC_SUBST(XCONN_LIBS)
146 CFLAGS="$CFLAGS -DLXDM_XCONN_XLIB"
147
148 else
149 PKG_CHECK_MODULES(XCONN,"xcb")
150 AC_SUBST(XCONN_CFLAGS)
151 AC_SUBST(XCONN_LIBS)
152 CFLAGS="$CFLAGS -DLXDM_XCONN_XCB"
153 fi],
154 [PKG_CHECK_MODULES(XCONN,"xcb")
155 AC_SUBST(XCONN_CFLAGS)
156 AC_SUBST(XCONN_LIBS)
157 CFLAGS="$CFLAGS -DLXDM_XCONN_XCB"
158 ]
159)
160
d6ba7c28
AG
161AC_ARG_WITH([systemdsystemunitdir],
162 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
163 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
164if test "x$with_systemdsystemunitdir" != xno; then
165 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
166fi
167AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
168
9931e273
DB
169GETTEXT_PACKAGE=lxdm
170AC_SUBST(GETTEXT_PACKAGE)
171AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
172
c8e553a1
AG
173AC_DEFUN([AS_AC_EXPAND],[
174 EXP_VAR=[$1]
175 FROM_VAR=[$2]
176 dnl first expand prefix and exec_prefix if necessary
177 prefix_save=$prefix
178 exec_prefix_save=$exec_prefix
179 dnl if no prefix given, then use /usr/local, the default prefix
180 if test "x$prefix" = "xNONE"; then
181 prefix="$ac_default_prefix"
182 fi
183 dnl if no exec_prefix given, then use prefix
184 if test "x$exec_prefix" = "xNONE"; then
185 exec_prefix=$prefix
186 fi
187 full_var="$FROM_VAR"
188 dnl loop until it doesn not change anymore
189 while true; do
190 new_full_var="`eval echo $full_var`"
191 if test "x$new_full_var" = "x$full_var"; then break; fi
192 full_var=$new_full_var
193 done
194 dnl clean up
195 full_var=$new_full_var
196 AC_SUBST([$1], "$full_var")
197 dnl restore prefix and exec_prefix
198 prefix=$prefix_save
199 exec_prefix=$exec_prefix_save
200])
201AS_AC_EXPAND(FULL_LIBEXECDIR, $libexecdir)
202
9931e273
DB
203AC_CONFIG_FILES([
204 Makefile
205 lxdm.spec
206 src/Makefile
207 po/Makefile.in
208 pam/Makefile
d6ba7c28 209 systemd/Makefile
9931e273
DB
210 data/Makefile
211 data/PostLogin
212 data/PostLogout
213 data/PreLogin
214 data/PreReboot
215 data/PreShutdown
216 data/LoginReady
c8e553a1 217 data/lxdm.conf
9931e273
DB
218])
219AC_CONFIG_FILES([data/lxdm], [chmod +x data/lxdm])
220AC_OUTPUT
221
222dnl sanity checks
223if test "$sysconfdir" != "/etc"; then
224 AC_MSG_WARN(sysconfdir is not /etc.)
225 AC_MSG_WARN(Please consider passing --sysconfdir=/etc to configure.)
226fi