Adding upstream version 0.4.1.
[debian/lxdm.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.63])
5 AC_INIT([lxdm], [0.4.1], [http://lxde.org/])
6 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
7
8 AC_CONFIG_SRCDIR([src/lxdm.c])
9 AC_CONFIG_HEADERS([config.h])
10
11 # Checks for programs.
12 AC_PROG_CC
13 AC_PROG_INSTALL
14 AM_PROG_CC_C_O
15
16 # Checks for libraries.
17 AC_CHECK_LIB([crypt], [crypt])
18
19 AC_ARG_WITH(pam,AC_HELP_STRING([--without-pam],[build without pam]),
20 [],[AC_CHECK_LIB([pam], [pam_open_session])])
21
22 AC_CHECK_LIB([ck-connector],[ck_connector_open_session])
23
24 # Checks for header files.
25 AC_PATH_X
26 AC_CHECK_HEADERS([shadow.h stdlib.h string.h unistd.h utmpx.h])
27
28 # Checks for typedefs, structures, and compiler characteristics.
29 AC_TYPE_PID_T
30
31 # Checks for library functions.
32 AC_FUNC_FORK
33 AC_CHECK_FUNCS([atexit endpwent getspnam getusershell memset putenv strstr])
34
35 PKG_CONFIG=pkg-config # FIXME: is this OK?
36 # Check for ISO Codes, this is taken from gdm
37 AC_MSG_CHECKING([whether iso-codes has iso-639 domain])
38 if $PKG_CONFIG --variable=domains iso-codes | grep 639 >/dev/null ; then
39         AC_MSG_RESULT([yes])
40 else
41         AC_MSG_RESULT([no])
42 fi
43 AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
44 ISO_CODES=iso-codes
45
46 IT_PROG_INTLTOOL([0.40.0])
47
48 PKG_CHECK_MODULES(XLIB,x11)
49 AC_SUBST(XLIB_CFLAGS)
50 AC_SUBST(XLIB_LIBS)
51
52 PKG_CHECK_MODULES(GLIB,glib-2.0)
53 AC_SUBST(GLIB_CFLAGS)
54 AC_SUBST(GLIB_LIBS)
55
56 AC_ARG_ENABLE(gtk3,
57 AC_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".]) ;;
62 esac],[])
63
64 if test "x$enable_gtk3" = "xyes" ; then
65   pkg_modules="gdk-3.0"
66 else
67   pkg_modules="gdk-2.0"
68 fi
69 PKG_CHECK_MODULES(GDK,[$pkg_modules])
70 AC_SUBST(GDK_CFLAGS)
71 AC_SUBST(GDK_LIBS)
72
73 if test "x$enable_gtk3" = "xyes" ; then
74   CFLAGS="$CFLAGS -DENABLE_GTK3"
75   pkg_modules="gtk+-3.0 >= 3.0.0"
76 else
77   pkg_modules="gtk+-2.0 >= 2.12.0"
78 fi
79 PKG_CHECK_MODULES(GTK, [$pkg_modules])
80 AC_SUBST(GTK_CFLAGS)
81 AC_SUBST(GTK_LIBS)
82
83 PKG_CHECK_MODULES(CONSOLEKIT, "ck-connector",[
84         AC_SUBST(CONSOLEKIT_CFLAGS)
85         AC_SUBST(CONSOLEKIT_LIBS)],[
86         echo "ConsoleKit devel package not found"
87         ])
88
89 AC_ARG_ENABLE(password,
90 AC_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".]) ;;
95 esac],[])
96
97 if test "x$enable_password" = "xyes" ; then
98   CFLAGS="$CFLAGS -DENABLE_PASSWORD"
99 fi
100
101 AC_ARG_ENABLE(xauth,
102         AC_HELP_STRING([--disable-xauth],[disable the xauth support ]),
103         [enable_xauth=$enablevar],
104         [enable_xauth=yes]
105 )
106
107 if test "x$enable_xauth" = "x$no" ; then
108   CFLAGS="$CFLAGS -DDISABLE_XAUTH"
109 fi
110
111 AC_ARG_ENABLE(debug,
112     AC_HELP_STRING([--enable-debug],[enable detailed debug]),
113     [enable_debug=$enablevar],
114     [enable_debug=yes]
115 )
116 if test "x$enable_debug" = "x$yes" ; then
117         CFLAGS="$CFLAGS -DLXDM_DEBUG"
118 fi
119
120 AC_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
141 GETTEXT_PACKAGE=lxdm
142 AC_SUBST(GETTEXT_PACKAGE)
143 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
144
145 AC_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 ])
159 AC_CONFIG_FILES([data/lxdm], [chmod +x data/lxdm])
160 AC_OUTPUT
161
162 dnl sanity checks
163 if test "$sysconfdir" != "/etc"; then
164    AC_MSG_WARN(sysconfdir is not /etc.)
165    AC_MSG_WARN(Please consider passing --sysconfdir=/etc to configure.)
166 fi