~ubuntu-branches/ubuntu/raring/consolekit/raring

« back to all changes in this revision

Viewing changes to .pc/82-hurd_support.patch/configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2010-11-20 18:17:28 UTC
  • mfrom: (0.1.16 sid)
  • Revision ID: james.westby@ubuntu.com-20101120181728-8e5bwe4ttgmk4j41
Tags: 0.4.3-2
Add 01-retry-console-open-on-EIO.patch: As reported in LP: #544139,
ConsoleKit sometimes fails to track the active VT. This particular case
was tracked down to a race condition that happens if you try to open
/dev/console while the current TTY is currently being closed. This yields
an -EIO error, in which case CK should just try again. Thanks Colin Watson
for the patch!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
AC_PREREQ(2.59c)
 
3
AC_INIT([ConsoleKit],
 
4
        [0.4.3],
 
5
        [https://bugs.freedesktop.org/enter_bug.cgi?product=ConsoleKit],
 
6
        [ConsoleKit])
 
7
 
 
8
AC_CONFIG_SRCDIR([src/ck-manager.c])
 
9
 
 
10
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2])
 
11
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
12
AM_MAINTAINER_MODE
 
13
 
 
14
# for O_NOFOLLOW support
 
15
AC_GNU_SOURCE
 
16
 
 
17
AC_ISC_POSIX
 
18
AC_PROG_CC
 
19
AC_STDC_HEADERS
 
20
AC_DISABLE_STATIC
 
21
AC_PROG_LIBTOOL
 
22
 
 
23
AC_HEADER_STDC
 
24
 
 
25
AC_SUBST(VERSION)
 
26
 
 
27
# Save flags to aclocal
 
28
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
 
29
 
 
30
GETTEXT_PACKAGE=ConsoleKit
 
31
AC_SUBST(GETTEXT_PACKAGE)
 
32
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain])
 
33
 
 
34
AM_GLIB_GNU_GETTEXT
 
35
 
 
36
# Dependencies
 
37
 
 
38
DBUS_REQUIRED_VERSION=0.82
 
39
GLIB_REQUIRED_VERSION=2.14
 
40
X11_REQUIRED_VERSION=1.0.0
 
41
POLKIT_REQUIRED_VERSION=0.92
 
42
 
 
43
AC_CHECK_HEADERS(unistd.h)
 
44
AC_CHECK_HEADERS(paths.h)
 
45
AC_CHECK_HEADERS(sys/vt.h)
 
46
AC_CHECK_HEADERS(sys/consio.h)
 
47
 
 
48
AC_CHECK_FUNCS(getpeerucred getpeereid)
 
49
 
 
50
AC_TYPE_UID_T
 
51
 
 
52
PKG_CHECK_MODULES(CONSOLE_KIT,
 
53
  dbus-glib-1 >= $DBUS_REQUIRED_VERSION
 
54
  gobject-2.0 >= $GLIB_REQUIRED_VERSION
 
55
  gthread-2.0 >= $GLIB_REQUIRED_VERSION
 
56
)
 
57
 
 
58
PKG_CHECK_MODULES(POLKIT,
 
59
  polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION,
 
60
  have_polkit=yes,
 
61
  have_polkit=no)
 
62
if test "x$have_polkit" = "xyes" ; then
 
63
       AC_DEFINE(HAVE_POLKIT, [], [Define if we have polkit])
 
64
fi
 
65
AM_CONDITIONAL(HAVE_POLKIT, test x$have_polkit = xyes)
 
66
AC_SUBST(HAVE_POLKIT)
 
67
 
 
68
PKG_CHECK_MODULES(LIBDBUS,
 
69
  dbus-1 >= $DBUS_REQUIRED_VERSION
 
70
)
 
71
PKG_CHECK_MODULES(TOOLS,
 
72
  x11 >= $X11_REQUIRED_VERSION
 
73
  glib-2.0 >= $GLIB_REQUIRED_VERSION
 
74
)
 
75
 
 
76
PKG_CHECK_MODULES(HISTORY,
 
77
  glib-2.0 >= $GLIB_REQUIRED_VERSION
 
78
)
 
79
 
 
80
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
 
81
 
 
82
EXTRA_COMPILE_WARNINGS(yes)
 
83
 
 
84
# Solaris requires libresolv for daemon()
 
85
case "$host" in
 
86
        *-*-solaris*)
 
87
                AC_CHECK_LIB(resolv, daemon, [CONSOLE_KIT_LIBS="$CONSOLE_KIT_LIBS -lresolv"])
 
88
        ;;
 
89
esac
 
90
 
 
91
# Find out the version of DBUS we're using
 
92
 
 
93
dbus_version=`pkg-config --modversion dbus-1`
 
94
DBUS_VERSION_MAJOR=`echo $dbus_version | awk -F. '{print $1}'`
 
95
DBUS_VERSION_MINOR=`echo $dbus_version | awk -F. '{print $2}'`
 
96
DBUS_VERSION_MICRO=`echo $dbus_version | awk -F. '{print $3}'`
 
97
if test "z$DBUS_VERSION_MAJOR" = "z"; then
 
98
        DBUS_VERSION_MAJOR="0"
 
99
fi
 
100
if test "z$DBUS_VERSION_MINOR" = "z"; then
 
101
        DBUS_VERSION_MINOR="0"
 
102
fi
 
103
if test "z$DBUS_VERSION_MICRO" = "z"; then
 
104
        DBUS_VERSION_MICRO="0"
 
105
fi
 
106
 
 
107
if test "z$DBUS_VERSION_MAJOR" = "z0" -a "z$DBUS_VERSION_MINOR" = "z0" -a "z$DBUS_VERSION_MICRO" = "z0"; then        echo "Error: Couldn't determine the version of your DBUS package."
 
108
        echo "  This is probably an error in this script, please report it"
 
109
        echo "  along with the following information:"
 
110
        echo "      Base DBUS version ='$dbus_version'"
 
111
        echo "      DBUS_VERSION_MAJOR='$DBUS_VERSION_MAJOR'"
 
112
        echo "      DBUS_VERSION_MINOR='$DBUS_VERSION_MINOR'"
 
113
        echo "      DBUS_VERSION_MICRO='$DBUS_VERSION_MICRO'"
 
114
        exit 1
 
115
else
 
116
 
 
117
        echo "Your dbus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
 
118
        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
 
119
        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
 
120
        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
 
121
 
 
122
        AC_SUBST(DBUS_CFLAGS)
 
123
fi
 
124
 
 
125
dnl ---------------------------------------------------------------------------
 
126
dnl - Are we specifying a different dbus root ?
 
127
dnl ---------------------------------------------------------------------------
 
128
 
 
129
AC_ARG_WITH(dbus-sys,
 
130
        [AC_HELP_STRING([--with-dbus-sys=<dir>],
 
131
        [where D-BUS system.d directory is])])
 
132
AC_ARG_WITH(dbus-services,
 
133
        [AC_HELP_STRING([--with-dbus-services=<dir>],
 
134
        [where D-BUS services directory is])])
 
135
if ! test -z "$with_dbus_sys" ; then
 
136
        DBUS_SYS_DIR="$with_dbus_sys"
 
137
else
 
138
        DBUS_SYS_DIR="$sysconfdir/dbus-1/system.d"
 
139
fi
 
140
AC_SUBST(DBUS_SYS_DIR)
 
141
 
 
142
 
 
143
dnl ---------------------------------------------------------------------------
 
144
dnl - Check for libz
 
145
dnl ---------------------------------------------------------------------------
 
146
 
 
147
have_libz=no
 
148
AC_CHECK_LIB(z, compress,
 
149
  [AC_CHECK_HEADER(zlib.h, [have_libz=yes], [])], [])
 
150
if test "x$have_libz" != "xyes"; then
 
151
  AC_MSG_ERROR([Unable to find libz])
 
152
fi
 
153
Z_LIBS="${Z_LIBS} -lz"
 
154
AC_SUBST(Z_LIBS)
 
155
 
 
156
dnl ---------------------------------------------------------------------------
 
157
dnl - PID file
 
158
dnl ---------------------------------------------------------------------------
 
159
 
 
160
AC_ARG_WITH(pid-file,
 
161
        [AC_HELP_STRING([--with-pid-file=<file>],
 
162
        [pid file location])])
 
163
 
 
164
if ! test -z "$with_pid_file"; then
 
165
   CONSOLE_KIT_PID_FILE=$with_pid_file
 
166
else
 
167
   CONSOLE_KIT_PID_FILE=${localstatedir}/run/ConsoleKit/pid
 
168
fi
 
169
 
 
170
AC_SUBST(CONSOLE_KIT_PID_FILE)
 
171
 
 
172
dnl ---------------------------------------------------------------------------
 
173
dnl Figure out what tools backend to build
 
174
dnl ---------------------------------------------------------------------------
 
175
 
 
176
CK_BACKEND=""
 
177
KVM_LIBS=""
 
178
case "$host" in
 
179
        *-*-freebsd* | *-*-kfreebsd*-gnu)
 
180
        CK_BACKEND="freebsd"
 
181
        AC_CHECK_LIB(kvm, kvm_openfiles, have_kvm=yes,
 
182
                AC_MSG_ERROR([Unable to find libkvm which is needed on FreeBSD]))
 
183
        if test "x$have_kvm" = "xyes"; then
 
184
                KVM_LIBS="-lkvm"
 
185
        fi
 
186
        ;;
 
187
        *-*-linux*)
 
188
        CK_BACKEND="linux"
 
189
        ;;
 
190
        *-*-solaris*)
 
191
        CK_BACKEND="solaris"
 
192
        ;;
 
193
        *)
 
194
        AC_MSG_ERROR([No sysdeps back-end implemented for host $host])
 
195
        ;;
 
196
esac
 
197
 
 
198
AC_SUBST(KVM_LIBS)
 
199
 
 
200
AM_CONDITIONAL(CK_COMPILE_LINUX, test x$CK_BACKEND = xlinux, [Compiling for Linux])
 
201
AM_CONDITIONAL(CK_COMPILE_FREEBSD, test x$CK_BACKEND = xfreebsd, [Compiling for FreeBSD])
 
202
AM_CONDITIONAL(CK_COMPILE_SOLARIS, test x$CK_BACKEND = xsolaris, [Compiling for Solaris])
 
203
AC_SUBST(CK_BACKEND)
 
204
 
 
205
dnl ---------------------------------------------------------------------------
 
206
dnl Check for PAM
 
207
dnl ---------------------------------------------------------------------------
 
208
 
 
209
have_pam=no
 
210
AC_CHECK_LIB(pam, pam_getenv, have_pam=yes)
 
211
AM_CONDITIONAL(HAVE_PAM, test x$have_pam = xyes)
 
212
if test "x$have_pam" = "xyes"; then
 
213
        PAM_LIBS="${PAM_LIBS} -lpam"
 
214
fi
 
215
AC_SUBST(HAVE_PAM)
 
216
AC_SUBST(PAM_LIBS)
 
217
 
 
218
AC_CHECK_HEADERS([security/pam_modutil.h security/pam_ext.h])
 
219
AC_CHECK_LIB(pam, pam_syslog, [AC_DEFINE(HAVE_PAM_SYSLOG, [], [Define to 1 if you have the pam_syslog function])])
 
220
 
 
221
# Check if we should build the PAM module
 
222
msg_pam_module=no
 
223
AC_ARG_ENABLE(pam-module,
 
224
        [AC_HELP_STRING([--enable-pam-module],
 
225
        [build PAM module])],
 
226
        , enable_pam_module=no)
 
227
if test "x$enable_pam_module" = "xyes"; then
 
228
        if test "x$have_pam" = "xno"; then
 
229
                AC_MSG_ERROR([--enable-pam-module requires PAM but PAM was not found])
 
230
        fi
 
231
        AC_DEFINE(ENABLE_PAM_MODULE, [], [Set if we build PAM module])
 
232
        msg_pam_module=yes
 
233
fi
 
234
AM_CONDITIONAL(ENABLE_PAM_MODULE, test "x$enable_pam_module" = "xyes")
 
235
 
 
236
dnl ---------------------------------------------------------------------------
 
237
dnl - Install directory for PAM security module
 
238
dnl ---------------------------------------------------------------------------
 
239
 
 
240
AC_ARG_WITH(pam-module-dir,
 
241
        [AC_HELP_STRING([--with-pam-module-dir=<dir>],
 
242
        [directory to install PAM security module])])
 
243
if ! test -z "$with_pam_module_dir"; then
 
244
        PAM_MODULE_DIR="$with_pam_module_dir"
 
245
else
 
246
        PAM_MODULE_DIR="/lib/security"
 
247
fi
 
248
AC_SUBST(PAM_MODULE_DIR)
 
249
 
 
250
dnl ---------------------------------------------------------------------------
 
251
dnl - DocBook Documentation
 
252
dnl ---------------------------------------------------------------------------
 
253
 
 
254
AC_ARG_ENABLE(docbook-docs,
 
255
        [AC_HELP_STRING([--enable-docbook-docs],
 
256
        [build documentation (requires xmlto)])],
 
257
        enable_docbook_docs=$enableval,enable_docbook_docs=no)
 
258
AC_PATH_PROG(XMLTO, xmlto, no)
 
259
AC_MSG_CHECKING([whether to build DocBook documentation])
 
260
if test x$XMLTO = xno ; then
 
261
        have_docbook=no
 
262
else
 
263
        have_docbook=yes
 
264
fi
 
265
if test x$enable_docbook_docs = xauto ; then
 
266
         if test x$have_docbook = xno ; then
 
267
                enable_docbook_docs=no
 
268
        else
 
269
                enable_docbook_docs=yes
 
270
        fi
 
271
fi
 
272
if test x$enable_docbook_docs = xyes; then
 
273
        if test x$have_docbook = xno; then
 
274
                AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found])
 
275
        fi
 
276
fi
 
277
AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes)
 
278
AC_MSG_RESULT(yes)
 
279
 
 
280
AC_ARG_VAR([XMLTO],[Define/override the `xmlto' location.])
 
281
AC_ARG_VAR([XMLTO_FLAGS],[Define/override `xmlto' options, like `--skip-validation'.])
 
282
 
 
283
dnl ---------------------------------------------------------------------------
 
284
dnl Check for xsltproc
 
285
dnl ---------------------------------------------------------------------------
 
286
AC_PATH_PROG([XSLTPROC], [xsltproc])
 
287
 
 
288
dnl ---------------------------------------------------------------------------
 
289
dnl check for inotify
 
290
dnl ---------------------------------------------------------------------------
 
291
 
 
292
enable_inotify=no
 
293
AC_CHECK_FUNC(inotify_init,
 
294
        [AC_CHECK_HEADER([sys/inotify.h],
 
295
                [enable_inotify=yes],
 
296
                [])],
 
297
                [])
 
298
 
 
299
AM_CONDITIONAL(ENABLE_INOTIFY, test "x$enable_inotify" = "xyes")
 
300
 
 
301
if test "x$enable_inotify" = "xyes" ; then
 
302
        AC_DEFINE(ENABLE_INOTIFY, [], [Define if we have inotify])
 
303
fi
 
304
 
 
305
dnl ---------------------------------------------------------------------------
 
306
dnl check for RBAC
 
307
dnl ---------------------------------------------------------------------------
 
308
 
 
309
msg_rbac_shutdown=no
 
310
AC_ARG_ENABLE(rbac-shutdown,
 
311
        [AC_HELP_STRING([--enable-rbac-shutdown=<key>],
 
312
        [Build with RBAC support specifying shutdown/reboot RBAC authentication key])],
 
313
        enable_rbac_shutdown=$enableval,enable_rbac_shutdown=no)
 
314
if test "x$enable_rbac_shutdown" != "xno"; then
 
315
        RBAC_LIBS="-lsecdb -lsocket -lnsl"
 
316
        AC_DEFINE(ENABLE_RBAC_SHUTDOWN, [], [Set if we build with RBAC support])
 
317
        AC_DEFINE_UNQUOTED(RBAC_SHUTDOWN_KEY, "$enable_rbac_shutdown", [Set if we build with RBAC support])
 
318
        msg_rbac_shutdown="yes, using key $enable_rbac_shutdown"
 
319
fi
 
320
AC_SUBST(RBAC_LIBS)
 
321
 
 
322
dnl ---------------------------------------------------------------------------
 
323
dnl Finish
 
324
dnl ---------------------------------------------------------------------------
 
325
 
 
326
# Turn on the additional warnings last, so -Werror doesn't affect other tests.
 
327
 
 
328
AC_ARG_ENABLE(more-warnings,
 
329
        [AC_HELP_STRING([--enable-more-warnings],
 
330
        [Maximum compiler warnings])],
 
331
        set_more_warnings="$enableval",[
 
332
                if test -d $srcdir/.git; then
 
333
                        set_more_warnings=yes
 
334
                else
 
335
                        set_more_warnings=no
 
336
                fi
 
337
        ])
 
338
AC_MSG_CHECKING(for more warnings)
 
339
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
 
340
        AC_MSG_RESULT(yes)
 
341
        CFLAGS="\
 
342
        -Wall \
 
343
        -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
 
344
        -Wnested-externs -Wpointer-arith \
 
345
        -Wcast-align -Wsign-compare -Wp,-D_FORTIFY_SOURCE=2 \
 
346
        $CFLAGS"
 
347
 
 
348
        for option in -Wno-strict-aliasing -Wno-sign-compare; do
 
349
                SAVE_CFLAGS="$CFLAGS"
 
350
                CFLAGS="$CFLAGS $option"
 
351
                AC_MSG_CHECKING([whether gcc understands $option])
 
352
                AC_TRY_COMPILE([], [],
 
353
                        has_option=yes,
 
354
                        has_option=no,)
 
355
                if test $has_option = no; then
 
356
                        CFLAGS="$SAVE_CFLAGS"
 
357
                fi
 
358
                AC_MSG_RESULT($has_option)
 
359
                unset has_option
 
360
                unset SAVE_CFLAGS
 
361
        done
 
362
        unset option
 
363
else
 
364
        AC_MSG_RESULT(no)
 
365
fi
 
366
 
 
367
#
 
368
# Enable Debug
 
369
#
 
370
AC_ARG_ENABLE(debug,
 
371
        [AC_HELP_STRING([--enable-debug],
 
372
        [turn on debugging])],
 
373
        , enable_debug=yes)
 
374
if test "$enable_debug" = "yes"; then
 
375
        DEBUG_CFLAGS="-DG_ENABLE_DEBUG"
 
376
else
 
377
        if test "x$enable_debug" = "xno"; then
 
378
                DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
 
379
        else
 
380
                DEBUG_CFLAGS=""
 
381
        fi
 
382
fi
 
383
AC_SUBST(DEBUG_CFLAGS)
 
384
 
 
385
# Flags
 
386
 
 
387
AC_SUBST(CONSOLE_KIT_CFLAGS)
 
388
AC_SUBST(CONSOLE_KIT_LIBS)
 
389
 
 
390
AC_SUBST(CFLAGS)
 
391
AC_SUBST(CPPFLAGS)
 
392
AC_SUBST(LDFLAGS)
 
393
 
 
394
# systemd
 
395
 
 
396
AC_ARG_WITH([systemdsystemunitdir],
 
397
        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
 
398
        [],
 
399
        [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
 
400
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
 
401
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
 
402
 
 
403
# Files
 
404
 
 
405
AC_CONFIG_FILES([
 
406
Makefile
 
407
src/Makefile
 
408
tools/Makefile
 
409
tools/linux/Makefile
 
410
tools/freebsd/Makefile
 
411
tools/solaris/Makefile
 
412
data/Makefile
 
413
doc/Makefile
 
414
doc/dbus/ConsoleKit.xml
 
415
doc/dbus/Makefile
 
416
libck-connector/Makefile
 
417
libck-connector/ck-connector.pc
 
418
pam-ck-connector/Makefile
 
419
])
 
420
 
 
421
AC_CONFIG_HEADERS([config.h])
 
422
 
 
423
AC_OUTPUT
 
424
 
 
425
echo "
 
426
                    ConsoleKit $VERSION
 
427
                    ========================
 
428
 
 
429
        prefix:                   ${prefix}
 
430
        exec_prefix:              ${exec_prefix}
 
431
        libdir:                   ${libdir}
 
432
        bindir:                   ${bindir}
 
433
        sbindir:                  ${sbindir}
 
434
        sysconfdir:               ${sysconfdir}
 
435
        localstatedir:            ${localstatedir}
 
436
        datadir:                  ${datadir}
 
437
        source code location:     ${srcdir}
 
438
        compiler:                 ${CC}
 
439
        cflags:                   ${CFLAGS}
 
440
        Base libs:                ${CONSOLE_KIT_LIBS}
 
441
        Tools libs:               ${TOOLS_LIBS}
 
442
        Maintainer mode:          ${USE_MAINTAINER_MODE}
 
443
 
 
444
        dbus-1 system.d dir:      ${DBUS_SYS_DIR}
 
445
        Build backend:            ${CK_BACKEND}
 
446
        PAM module dir:           ${PAM_MODULE_DIR}
 
447
        Build PAM module:         ${msg_pam_module}
 
448
        Build docs:               ${enable_docbook_docs}
 
449
 
 
450
        PolicyKit support         ${have_polkit}
 
451
        RBAC (Solaris) support:   ${msg_rbac_shutdown}
 
452
"
 
453
if test x${have_polkit} = xno -a x${msg_rbac_shutdown} = xno; then
 
454
   echo "WARNING: PolicyKit and RBAC are disabled. You need to manually edit the ConsoleKit.conf"
 
455
   echo "         file to lock down the service. Failure to do so may be"
 
456
   echo "         a huge SECURITY HOLE. I repeat: YOU NEED TO EDIT THE FILE"
 
457
   echo "         ConsoleKit.conf to match your distro/site to avoid NASTY SECURITY HOLES."
 
458
   echo ""
 
459
fi
 
460