summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 428485eb08fdbecaf1d2c043b33feece383e81e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
dnl Process this file with autoconf to produce a configure script.

AC_INIT(lightdm, 1.28.0)
AC_CONFIG_MACRO_DIR(m4)
AC_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz foreign])
AM_SILENT_RULES(yes)
AC_PROG_CC_C99
LT_INIT
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_MKDIR_P
AM_MAINTAINER_MODE

dnl Check if the compiler really supports `-std=c99`.
if test "x$ac_cv_prog_cc_c99" = xno; then
    AC_MSG_ERROR([$CC does not support '-std=c99'.])
fi

dnl Enable compile warnings (only supporting GCC)
if test "x$GCC" = xyes; then
    WARN_CFLAGS="-Wall \
                 -Wstrict-prototypes \
                 -Wnested-externs \
                 -Werror=missing-prototypes \
                 -Werror=implicit-function-declaration \
                 -Werror=pointer-arith \
                 -Werror=init-self \
                 -Werror=format-security \
                 -Werror=format=2 \
                 -Werror=missing-include-dirs"
    WARN_CXXFLAGS="-Wall"
fi
AC_SUBST(WARN_CFLAGS)
AC_SUBST(WARN_CXXFLAGS)

GOBJECT_INTROSPECTION_CHECK(0.9.5)

VAPIGEN_CHECK([0.16])

dnl ###########################################################################
dnl Dependencies
dnl ###########################################################################

AC_CHECK_HEADERS(security/pam_appl.h, [], AC_MSG_ERROR(PAM not found))

AC_CHECK_HEADERS(gcrypt.h, [], AC_MSG_ERROR(libgcrypt not found))

AC_CHECK_FUNCS(setresgid setresuid clearenv)

PKG_CHECK_MODULES(LIGHTDM, [
    glib-2.0 >= 2.44
    gio-2.0 >= 2.26
    gio-unix-2.0
    xdmcp
    xcb
])

PKG_CHECK_MODULES(GLIB, [
    glib-2.0
])

PKG_CHECK_MODULES(GIO, [
    gio-2.0
])

PKG_CHECK_MODULES(GIO_UNIX, [
    gio-unix-2.0
])

PKG_CHECK_MODULES(GOBJECT, [
    gobject-2.0
])

PKG_CHECK_MODULES(XCB, [
    xcb
])    

PKG_CHECK_MODULES(LIBLIGHTDM_GOBJECT, [
    glib-2.0 >= 2.44
    gio-2.0 >= 2.26
    gio-unix-2.0
    gobject-2.0
    libxklavier
    x11
])

AC_ARG_ENABLE(liblightdm-qt,
	AS_HELP_STRING([--enable-liblightdm-qt],[Enable LightDM client Qt4 libraries [[default=auto]]]),
	[enable_liblightdm_qt4=$enableval],
	[enable_liblightdm_qt4="auto"])
compile_liblightdm_qt4=no
if test x"$enable_liblightdm_qt4" != "xno" ; then
    PKG_CHECK_MODULES(LIBLIGHTDM_QT4, [
        QtCore
        QtDBus
        QtGui
    ],
    [compile_liblightdm_qt4=yes],
    [if test "x$enable_liblightdm_qt4" != xauto; then
        AC_MSG_FAILURE(
          [--enable-liblightdm-qt was given, but test for Qt4 failed])
      fi
    ])

    AC_CHECK_TOOLS(MOC4, [moc-qt4 moc])
    if test x$MOC4 = x; then
        compile_liblightdm_qt4=no
        if test "x$enable_liblightdm_qt4" != xauto; then
            AC_MSG_FAILURE(
              [--enable-liblightdm-qt4 was given, but MOC not found])
        fi
    fi
    if test x"$MOC4" = xmoc; then
        if test x"$(readlink $(which $MOC4))" = xqtchooser; then
            MOC4="$MOC4 --qt=4"
        fi
    fi
fi
AM_CONDITIONAL(COMPILE_LIBLIGHTDM_QT4, test x"$compile_liblightdm_qt4" != "xno")

AC_ARG_ENABLE(liblightdm-qt5,
	AS_HELP_STRING([--enable-liblightdm-qt5],[Enable LightDM client Qt5 libraries [[default=auto]]]),
	[enable_liblightdm_qt5=$enableval],
	[enable_liblightdm_qt5="auto"])
compile_liblightdm_qt5=no
if test x"$enable_liblightdm_qt5" != "xno"; then
    PKG_CHECK_MODULES(LIBLIGHTDM_QT5, [
        Qt5Core
        Qt5DBus
        Qt5Gui
    ],
    [compile_liblightdm_qt5=yes],
    [if test "x$enable_liblightdm_qt5" != xauto; then
        AC_MSG_FAILURE(
          [--enable-liblightdm-qt5 was given, but test for Qt5 failed])
      fi
    ])

    AC_CHECK_TOOLS(MOC5, [moc-qt5 moc])
    if test x$MOC5 = x; then
        compile_liblightdm_qt5=no
        if test "x$enable_liblightdm_qt5" != xauto; then
            AC_MSG_FAILURE(
              [--enable-liblightdm-qt5 was given, but MOC not found])
        fi
    fi
    if test x"$MOC5" = xmoc; then
        if test x"$(readlink $(which $MOC5))" = xqtchooser; then
            MOC5="$MOC5 --qt=5"
        fi
    fi
fi
AM_CONDITIONAL(COMPILE_LIBLIGHTDM_QT5, test x"$compile_liblightdm_qt5" != "xno")

AC_ARG_ENABLE([libaudit],
    AS_HELP_STRING([--enable-libaudit],
                   [Enable libaudit logging of login and logout events [[default=auto]]]),
    [enable_libaudit=$enableval],
    [enable_libaudit=auto])
use_libaudit=no    
if test x"$enable_libaudit" != "xno"; then
    AC_CHECK_LIB([audit], [audit_log_user_message],
                 [use_libaudit=yes
                  AC_DEFINE(HAVE_LIBAUDIT, 1, [libaudit support])
                  LIGHTDM_LIBS="${LIGHTDM_LIBS} -laudit"
                 ],
                 [if test "x$enable_libaudit" != xauto; then
                    AC_MSG_FAILURE(
                      [--enable-libaudit was given, but test for libaudit failed])
                  fi
                 ])
fi

AC_MSG_CHECKING(whether to build tests)
AC_ARG_ENABLE(tests,
        AS_HELP_STRING([--disable-tests], [Disable tests building]),
        [], [enable_tests="yes"])
AM_CONDITIONAL(COMPILE_TESTS, test x"$enable_tests" != "xno")

dnl ###########################################################################
dnl Configurable values
dnl ###########################################################################

DEFAULT_USER_SESSION=default
AC_ARG_WITH(user-session,
            AS_HELP_STRING(--with-user-session=<name>,
                           Session to use for user accounts),
    if test x$withval != x; then
        DEFAULT_USER_SESSION="$withval"
    fi
)
AC_SUBST(DEFAULT_USER_SESSION)
AC_DEFINE_UNQUOTED(DEFAULT_USER_SESSION, "$DEFAULT_USER_SESSION", User session)

DEFAULT_GREETER_SESSION=default
AC_ARG_WITH(greeter-session,
            AS_HELP_STRING(--with-greeter-session=<session>,
                           Greeter session),
    if test x$withval != x; then
        DEFAULT_GREETER_SESSION="$withval"
    fi
)
AC_SUBST(DEFAULT_GREETER_SESSION)
AC_DEFINE_UNQUOTED(DEFAULT_GREETER_SESSION, "$DEFAULT_GREETER_SESSION", Greeter session)

GREETER_USER=lightdm
AC_ARG_WITH(greeter-user,
            AS_HELP_STRING(--with-greeter-user=<username>,
                           User to run greeter as),
    if test x$withval != x; then
        GREETER_USER="$withval"
    fi
)
AC_SUBST(GREETER_USER)
AC_DEFINE_UNQUOTED(GREETER_USER, "$GREETER_USER", User to run greeter as)

dnl ###########################################################################
dnl Documentation
dnl ###########################################################################

GTK_DOC_CHECK
YELP_HELP_INIT

dnl ###########################################################################
dnl Internationalization
dnl ###########################################################################

IT_PROG_INTLTOOL(0.35.0)
AC_SUBST(GETTEXT_PACKAGE, lightdm)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", Gettext package)

dnl ###########################################################################
dnl Files to generate
dnl ###########################################################################

AC_CONFIG_FILES([
Makefile
common/Makefile
data/Makefile
doc/Makefile
help/Makefile
liblightdm-gobject/liblightdm-gobject-1.pc
liblightdm-gobject/Makefile
liblightdm-qt/Makefile
liblightdm-qt/liblightdm-qt-3.pc
liblightdm-qt/liblightdm-qt5-3.pc
po/Makefile.in
src/Makefile
tests/Makefile
tests/src/Makefile
])
AC_OUTPUT

dnl ###########################################################################
dnl Summary
dnl ###########################################################################

echo "
                    Light Display Manager $VERSION
                    ===========================

        prefix:                   $prefix
        Greeter session:          $DEFAULT_GREETER_SESSION
        Greeter user:             $GREETER_USER
        User session:             $DEFAULT_USER_SESSION
        GObject introspection:    $found_introspection
        Vala bindings:            $enable_vala
        liblightdm-qt:            $compile_liblightdm_qt4
        liblightdm-qt5:           $compile_liblightdm_qt5
        libaudit support:         $use_libaudit
        Enable tests:             $enable_tests
"