summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 42ac01e718b4bf6df1aec05ae4d12d6143785d45 (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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#
# Copyright (C) 2010 - 2011, Robert Ancell <robert.ancell@canonical.com>
# Copyright (C) 2012 - 2013, Lionel Le Folgoc <mrpouit@ubuntu.com>
# Copyright (C) 2013 - 2020, Sean Davis <sean@bluesabre.org>
# Copyright (C) 2014, Andrew P. <pan.pav.7c5@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version. See http://www.gnu.org/copyleft/gpl.html the full text of the
# license.
#

dnl Process this file with autoconf to produce a configure script.

AC_PREREQ([2.64])
AC_INIT([lightdm-gtk-greeter],[2.0.8],[https://github.com/xubuntu/lightdm-gtk-greeter])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/lightdm-gtk-greeter.c])
AC_CONFIG_MACRO_DIR([m4])

LT_INIT
AM_INIT_AUTOMAKE([1.11 tar-ustar foreign -Wall -Wno-portability])
AM_MAINTAINER_MODE([enable])

# Use AM_SILENT_RULES if present
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])

AC_PROG_CC

GOBJECT_INTROSPECTION_CHECK(0.9.5)

dnl ###########################################################################
dnl Standard headers
dnl ###########################################################################

AC_CHECK_HEADERS([stdlib.h])

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

PKG_CHECK_MODULES([GTK], [gtk+-3.0])
PKG_CHECK_MODULES([GMODULE], [gmodule-export-2.0])
PKG_CHECK_MODULES([LIGHTDMGOBJECT], [liblightdm-gobject-1 >= 1.19.2],
  [AC_DEFINE([HAVE_LIBLIGHTDMGOBJECT_1_19_2], [1], [Building with liblightdmgobject 1.19.2])],
  [PKG_CHECK_MODULES([LIGHTDMGOBJECT], [liblightdm-gobject-1 >= 1.3.5])]
)
PKG_CHECK_MODULES([LIBX11], [x11])

dnl ###########################################################################
dnl Optional dependencies
dnl ###########################################################################

AYATANA_INDICATOR_REQUIRED_VERSION=0.6.0
AYATANA_INDICATOR_PKG=ayatana-indicator3-0.4
AYATANA_IDO_REQUIRED_VERSION=0.4.0
AYATANA_IDO_PKG=libayatana-ido3-0.4

UNITY_INDICATOR_REQUIRED_VERSION=0.3.92
UNITY_INDICATOR_PKG=indicator3-0.4
UNITY_IDO_REQUIRED_VERSION=13.10
UNITY_IDO_PKG=libido3-0.1

dnl ###########################################################################

AC_ARG_ENABLE([libindicator],
    AC_HELP_STRING([--enable-libindicator], [Enable libindicator support])
    AC_HELP_STRING([--disable-libindicator], [Disable libindicator support]),
            [], [enable_libindicator=yes])

AC_ARG_WITH([libindicator], AS_HELP_STRING([--with-libindicator=ayatana|unity], [Preferred indicator backend [default=ayatana]]))
have_indicator_ng=no

AS_IF([test "x$enable_libindicator" = "xyes"], [
    AS_IF([test "x$with_libindicator" != "xunity" && $PKG_CONFIG --exists "$AYATANA_INDICATOR_PKG >= $AYATANA_INDICATOR_REQUIRED_VERSION" >/dev/null 2>&1], [
        PKG_CHECK_MODULES([AYATANA_LIBINDICATOR], [$AYATANA_INDICATOR_PKG >= $AYATANA_INDICATOR_REQUIRED_VERSION], [
            have_ayatana_libindicator=yes
            have_libindicator=yes
            INDICATORDIR=`$PKG_CONFIG --variable=indicatordir $AYATANA_INDICATOR_PKG`
            AC_SUBST(INDICATORDIR)
            AYATANA_INDICATORDIR="${prefix}/share/ayatana/indicators"
            AC_SUBST(AYATANA_INDICATORDIR)
            AC_DEFINE([HAVE_LIBINDICATOR], [1], [Define if "$AYATANA_INDICATOR_PKG" is present])
            AC_DEFINE([HAVE_AYATANA_LIBINDICATOR], [1], [Define if "$AYATANA_INDICATOR_PKG" is present])

            CPPFLAGS_OLD="$CPPFLAGS"
            CPPFLAGS=`$PKG_CONFIG --cflags ${AYATANA_INDICATOR_PKG}`
            AC_CHECK_HEADER([libayatana-indicator/indicator-ng.h], [
                have_indicator_ng=yes
                AC_DEFINE([HAVE_LIBINDICATOR_NG], [1], [Define if "libayatana-indicator/indicator-ng.h" is present])
                AC_DEFINE([HAVE_AYATANA_LIBINDICATOR_NG], [1], [Define if "libayatana-indicator/indicator-ng.h" is present])
            ], [], [-])
            CPPFLAGS="$CPPFLAGS_OLD"
        ])
    ], [
        AS_IF([test "x$with_libindicator" != "xunity"], [
            AC_MSG_CHECKING([for optional package $AYATANA_INDICATOR_PKG])
            AC_MSG_RESULT([not found])
        ], [])
        AS_IF([$PKG_CONFIG --exists "$UNITY_INDICATOR_PKG >= $UNITY_INDICATOR_REQUIRED_VERSION" >/dev/null 2>&1], [
            PKG_CHECK_MODULES([UNITY_LIBINDICATOR], [$UNITY_INDICATOR_PKG >= $UNITY_INDICATOR_REQUIRED_VERSION], [
                have_unity_libindicator=yes
                have_libindicator=yes
                INDICATORDIR=`$PKG_CONFIG --variable=indicatordir $UNITY_INDICATOR_PKG`
                AC_SUBST(INDICATORDIR)
                UNITY_INDICATORDIR="${prefix}/share/unity/indicators"
                AC_SUBST(UNITY_INDICATORDIR)
                AC_DEFINE([HAVE_LIBINDICATOR], [1], [Define if "$UNITY_INDICATOR_PKG" is present])
                AC_DEFINE([HAVE_UNITY_LIBINDICATOR], [1], [Define if "$UNITY_INDICATOR_PKG" is present])

                CPPFLAGS_OLD="$CPPFLAGS"
                CPPFLAGS=`$PKG_CONFIG --cflags ${UNITY_INDICATOR_PKG}`
                AC_CHECK_HEADER([libindicator/indicator-ng.h], [
                    have_indicator_ng=yes
                    AC_DEFINE([HAVE_LIBINDICATOR_NG], [1], [Define if "libindicator/indicator-ng.h" is present])
                    AC_DEFINE([HAVE_UNITY_LIBINDICATOR_NG], [1], [Define if "libindicator/indicator-ng.h" is present])
                ], [], [-])
                CPPFLAGS="$CPPFLAGS_OLD"
            ])
        ], [
            AC_MSG_CHECKING([for optional package $UNITY_INDICATOR_PKG])
            AC_MSG_RESULT([not found])
        ])
    ])
], [
    AC_MSG_CHECKING([for optional package $AYATANA_INDICATOR_PKG or $UNITY_INDICATOR_PKG])
    AC_MSG_RESULT([disabled])
])

AM_CONDITIONAL([HAVE_UNITY_LIBINDICATOR], [test "x$have_unity_libindicator" = "xyes"])

AC_ARG_WITH([systemd-service-dir], AS_HELP_STRING([--with-systemd-service-dir=path], [Path where systemd indicator service units are stored]))
AS_IF([test "x$with_systemd_service_dir" = "x" || test "x$with_systemd_service_dir" = "x"], [
    with_systemd_service_dir="/usr/lib/systemd/user"
], [])
SYSTEMD_SERVICE_DIR="$with_systemd_service_dir"
AC_SUBST(SYSTEMD_SERVICE_DIR)

dnl ###########################################################################

AC_ARG_ENABLE([libido],
    AC_HELP_STRING([--enable-libido], [Enable libido support])
    AC_HELP_STRING([--disable-libido], [Disable libido support]),
            [], [enable_libido=yes])

have_ido=no

AS_IF([test "x$enable_libido" = "xyes" && test "x$have_libindicator" = "xyes"], [
    AS_IF([test "x$have_ayatana_libindicator" = "xyes" && $PKG_CONFIG --exists "$AYATANA_IDO_PKG" >/dev/null 2>&1], [
        PKG_CHECK_MODULES([AYATANA_LIBIDO], [$AYATANA_IDO_PKG >= $AYATANA_IDO_REQUIRED_VERSION], [
            have_ido=yes
            AC_DEFINE([HAVE_LIBIDO], [1], [Define if "$AYATANA_IDO_PKG" is present])
            AC_DEFINE([HAVE_AYATANA_LIBIDO], [1], [Define if "$AYATANA_IDO_PKG" is present])
        ])
    ], [
        AS_IF([test "x$have_ayatana_libindicator" = "xyes"], [
            AC_MSG_CHECKING([for optional package $AYATANA_IDO_PKG])
            AC_MSG_RESULT([not found])
        ], [])
        AS_IF([$PKG_CONFIG --exists "$UNITY_IDO_PKG" >/dev/null 2>&1], [
            PKG_CHECK_MODULES([UNITY_LIBIDO], [$UNITY_IDO_PKG >= $UNITY_IDO_REQUIRED_VERSION], [
                have_ido=yes
                AC_DEFINE([HAVE_LIBIDO], [1], [Define if "$UNITY_IDO_PKG" is present])
                AC_DEFINE([HAVE_UNITY_LIBIDO], [1], [Define if "$UNITY_IDO_PKG" is present])
            ])
        ], [
            AC_MSG_CHECKING([for optional package $UNITY_IDO_PKG])
            AC_MSG_RESULT([not found])
        ])
    ])
], [
    AC_MSG_CHECKING([for optional package $AYATANA_IDO_PKG or $UNITY_IDO_PKG])
    AC_MSG_RESULT([disabled])
])

dnl ###########################################################################

AC_ARG_WITH([libxklavier], AS_HELP_STRING([--with-libxklavier], [Use libxklavier to manage layouts (instead of LightDM API)]))

AS_IF([test "x$with_libxklavier" = "xyes"],
[
    PKG_CHECK_MODULES([LIBXKLAVIER], [libxklavier], [have_xklavier=yes])
    AC_DEFINE([HAVE_LIBXKLAVIER], [1], [Define if "libxklavier" is present])
],
[
    with_libxklavier=no
])

dnl ###########################################################################

AC_ARG_ENABLE([at-spi-command],
    AC_HELP_STRING([--enable-at-spi-command[=command]], [Try to start at-spi service]])
    AC_HELP_STRING([--disable-at-spi-command], [Do not start at-spi service]),
    [], [])

AS_IF([test "x$enable_at_spi_command" != "xno"],
[
    if test "x$enable_at_spi_command" = "xyes" || test "x$enable_at_spi_command" = "x"; then
        enable_at_spi_command="/usr/libexec/at-spi-bus-launcher --launch-immediately"
    fi
    AC_DEFINE_UNQUOTED([AT_SPI_COMMAND], ["$enable_at_spi_command"], [Command to start at-spi service])
])

dnl ###########################################################################

AC_ARG_ENABLE([indicator-services-command],
    AC_HELP_STRING([--enable-indicator-services-command[=command]], [Try to start indicators service]])
    AC_HELP_STRING([--disable-indicator-services-command], [Do not start indicators service]),
    [], [])

AS_IF([test "x$enable_indicator_services_command" != "xno"],
[
    if test "x$enable_indicator_services_command" = "xyes" || test "x$enable_indicator_services_command" = "x"; then
        enable_indicator_services_command="systemd --user indicator-services-start"
    fi
    AC_DEFINE_UNQUOTED([INDICATOR_SERVICES_COMMAND], ["$enable_indicator_services_command"], [Command to start indicators service])
])

dnl ###########################################################################

AC_ARG_ENABLE([kill-on-sigterm],
    AC_HELP_STRING([--enable-kill-on-sigterm], [Kill greeter instance on SIGTERM, see LP1445461])
    AC_HELP_STRING([--disable-kill-on-sigterm], [Don't kill greeter on SIGTERM, see LP1445461']),
            [], [enable_kill_on_sigterm=no])

AS_IF([test "x$enable_kill_on_sigterm" = "xyes"],
[
    AC_DEFINE([KILL_ON_SIGTERM], [1], [Kill greeter in SIGTERM handler, see LP1445461])
],
[])

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

GETTEXT_PACKAGE="lightdm-gtk-greeter"
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
AM_GNU_GETTEXT_VERSION([0.19.7])
AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.7])
AM_GNU_GETTEXT([external])

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

AC_CONFIG_FILES([
Makefile
data/Makefile
data/badges/Makefile
po/Makefile.in
src/Makefile
])
AC_OUTPUT

AS_IF([test "x$have_libindicator" = "xyes"], [
    AS_IF([test "x$have_ayatana_libindicator" = "xyes"], [
        indicator_backend="ayatana"
    ], [
        indicator_backend="unity"
    ])
], [
    indicator_backend="disabled"
])

echo "
------------------------------------------------------
            LightDM GTK Greeter $VERSION
        ====================================

        Installation:
        =============
        Prefix:                         $prefix
        AT-SPI Service:                 $enable_at_spi_command
        Use libxklavier:                $with_libxklavier
        Enable SIGTERM Handler:         $enable_kill_on_sigterm

        Indicators:
        ===========
        Indicator Support:              $indicator_backend
        Indicator Services Command:     $enable_indicator_services_command
        systemd Services:               $with_systemd_service_dir
        Indicator NG:                   $have_indicator_ng
        IDO:                            $have_ido

------------------------------------------------------

Configuration finished, type make to compile"