~ubuntu-branches/ubuntu/saucy/gnome-screensaver/saucy-updates

« back to all changes in this revision

Viewing changes to .pc/32_input_sources_switcher.patch/configure.ac

  • Committer: Package Import Robot
  • Author(s): William Hua
  • Date: 2013-10-29 11:21:38 UTC
  • Revision ID: package-import@ubuntu.com-20131029112138-qe63ta682q9ayqn5
Tags: 3.6.1-0ubuntu7
* debian/patches/32_input_sources_switcher.patch:
  - Use input sources instead of XKB layouts. (lp: #1225514)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl -*- mode: m4 -*-
 
2
 
 
3
AC_PREREQ(2.60)
 
4
AC_INIT([gnome-screensaver],
 
5
        [3.6.1],
 
6
        [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-screensaver])
 
7
 
 
8
AC_CONFIG_SRCDIR(src/gnome-screensaver.c)
 
9
 
 
10
AM_INIT_AUTOMAKE([1.10 no-dist-gzip dist-xz tar-ustar])
 
11
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
12
 
 
13
AM_CONFIG_HEADER(config.h)
 
14
 
 
15
AM_MAINTAINER_MODE([enable])
 
16
 
 
17
IT_PROG_INTLTOOL([0.35.0])
 
18
AC_ISC_POSIX
 
19
AC_PROG_CC
 
20
AM_PROG_CC_C_O
 
21
AC_STDC_HEADERS
 
22
AC_PROG_LIBTOOL
 
23
AC_CANONICAL_HOST
 
24
 
 
25
AC_HEADER_STDC
 
26
 
 
27
AC_SUBST(VERSION)
 
28
 
 
29
# Save flags to aclocal
 
30
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
 
31
 
 
32
GETTEXT_PACKAGE=gnome-screensaver
 
33
AC_SUBST(GETTEXT_PACKAGE)
 
34
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain])
 
35
 
 
36
AM_GLIB_GNU_GETTEXT
 
37
GLIB_GSETTINGS
 
38
 
 
39
# Dependencies
 
40
 
 
41
DBUS_REQUIRED_VERSION=0.30
 
42
GLIB_REQUIRED_VERSION=2.25.6
 
43
GTK_REQUIRED_VERSION=2.99.3
 
44
X11_REQUIRED_VERSION=1.0
 
45
GNOME_DESKTOP_REQUIRED_VERSION=3.1.91
 
46
GSETTINGS_DESKTOP_SCHEMAS_REQUIRED_VERSION=0.1.7
 
47
 
 
48
LIBGNOMEKBDUI_REQUIRED_VERSION=0.1
 
49
 
 
50
AC_CHECK_HEADERS(unistd.h)
 
51
AC_CHECK_HEADERS(crypt.h sys/select.h)
 
52
AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv sbrk)
 
53
AC_CHECK_FUNCS(sigaction syslog realpath setrlimit)
 
54
AC_CHECK_FUNCS(getresuid)
 
55
AC_TYPE_UID_T
 
56
 
 
57
AC_CHECK_FUNCS([setresuid setenv unsetenv clearenv])
 
58
PKG_CHECK_MODULES(GNOME_SCREENSAVER,
 
59
        x11 >= $X11_REQUIRED_VERSION
 
60
        gtk+-3.0 >= $GTK_REQUIRED_VERSION
 
61
        dbus-glib-1 >= $DBUS_REQUIRED_VERSION
 
62
        gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
 
63
        gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED_VERSION)
 
64
AC_SUBST(GNOME_SCREENSAVER_CFLAGS)
 
65
AC_SUBST(GNOME_SCREENSAVER_LIBS)
 
66
 
 
67
PKG_CHECK_MODULES(GNOME_SCREENSAVER_DIALOG,
 
68
        gthread-2.0
 
69
        gtk+-3.0 >= $GTK_REQUIRED_VERSION)
 
70
AC_SUBST(GNOME_SCREENSAVER_DIALOG_CFLAGS)
 
71
AC_SUBST(GNOME_SCREENSAVER_DIALOG_LIBS)
 
72
 
 
73
PKG_CHECK_MODULES(GNOME_SCREENSAVER_CAPPLET,
 
74
        gio-2.0 >= $GLIB_REQUIRED_VERSION
 
75
        gtk+-3.0 >= $GTK_REQUIRED_VERSION
 
76
        gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED_VERSION)
 
77
AC_SUBST(GNOME_SCREENSAVER_CAPPLET_CFLAGS)
 
78
AC_SUBST(GNOME_SCREENSAVER_CAPPLET_LIBS)
 
79
 
 
80
PKG_CHECK_MODULES(GNOME_SCREENSAVER_COMMAND,
 
81
        gio-2.0 >= $GLIB_REQUIRED_VERSION
 
82
        gobject-2.0 >= $GLIB_REQUIRED_VERSION)
 
83
AC_SUBST(GNOME_SCREENSAVER_COMMAND_CFLAGS)
 
84
AC_SUBST(GNOME_SCREENSAVER_COMMAND_LIBS)
 
85
 
 
86
AC_PATH_XTRA
 
87
 
 
88
ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
 
89
SAVER_LIBS="$ALL_X_LIBS"
 
90
 
 
91
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
 
92
 
 
93
GNOME_COMPILE_WARNINGS(yes)
 
94
 
 
95
# Optional dependencies for the theme engines
 
96
 
 
97
SAVER_MODULES="gthread-2.0 gtk+-3.0 >= $GTK_REQUIRED_VERSION"
 
98
 
 
99
PKG_CHECK_MODULES(GNOME_SCREENSAVER_SAVER, $SAVER_MODULES)
 
100
AC_SUBST(GNOME_SCREENSAVER_SAVER_CFLAGS)
 
101
AC_SUBST(GNOME_SCREENSAVER_SAVER_LIBS)
 
102
 
 
103
# Find out the version of DBUS we're using
 
104
 
 
105
dbus_version=`pkg-config --modversion dbus-1`
 
106
DBUS_VERSION_MAJOR=`echo $dbus_version | awk -F. '{print $1}'`
 
107
DBUS_VERSION_MINOR=`echo $dbus_version | awk -F. '{print $2}'`
 
108
DBUS_VERSION_MICRO=`echo $dbus_version | awk -F. '{print $3}'`
 
109
if test "z$DBUS_VERSION_MAJOR" = "z"; then
 
110
        DBUS_VERSION_MAJOR="0"
 
111
fi
 
112
if test "z$DBUS_VERSION_MINOR" = "z"; then
 
113
        DBUS_VERSION_MINOR="0"
 
114
fi
 
115
if test "z$DBUS_VERSION_MICRO" = "z"; then
 
116
        DBUS_VERSION_MICRO="0"
 
117
fi
 
118
 
 
119
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."
 
120
        echo "  This is probably an error in this script, please report it"
 
121
        echo "  along with the following information:"
 
122
        echo "      Base DBUS version ='$dbus_version'"
 
123
        echo "      DBUS_VERSION_MAJOR='$DBUS_VERSION_MAJOR'"
 
124
        echo "      DBUS_VERSION_MINOR='$DBUS_VERSION_MINOR'"
 
125
        echo "      DBUS_VERSION_MICRO='$DBUS_VERSION_MICRO'"
 
126
        exit 1
 
127
else
 
128
 
 
129
        echo "Your dbus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
 
130
        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
 
131
        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
 
132
        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
 
133
 
 
134
        AC_SUBST(DBUS_CFLAGS)
 
135
fi
 
136
 
 
137
# Find out where the session service file goes
 
138
# The sad sed hack is recomended by section 27.10 of the automake manual.
 
139
DBUS_SESSION_SERVICE_DIR=`pkg-config --variable session_bus_services_dir dbus-1 | sed -e 's,/usr/share,${datarootdir},g'`
 
140
AC_SUBST(DBUS_SESSION_SERVICE_DIR)
 
141
 
 
142
dnl ---------------------------------------------------------------------------
 
143
dnl - Where should we put documentation ?
 
144
dnl ---------------------------------------------------------------------------
 
145
AC_ARG_WITH(doc-dir,
 
146
              [AC_HELP_STRING([--with-doc-dir=<dir>],
 
147
              [directory to install documentation])])
 
148
if ! test -z "$with_doc_dir"; then
 
149
   DOCDIR="$with_doc_dir/gnome-screensaver-$VERSION"
 
150
else
 
151
   DOCDIR="$datadir/doc/gnome-screensaver-$VERSION"
 
152
fi
 
153
AC_SUBST(DOCDIR)
 
154
 
 
155
dnl ---------------------------------------------------------------------------
 
156
dnl - DocBook Documentation
 
157
dnl ---------------------------------------------------------------------------
 
158
AC_ARG_ENABLE(docbook-docs, [  --enable-docbook-docs   build documentation (requires xmlto)],enable_docbook_docs=$enableval,enable_docbook_docs=no)
 
159
AC_PATH_PROG(XMLTO, xmlto, no)
 
160
AC_MSG_CHECKING([whether to build DocBook documentation])
 
161
if test x$XMLTO = xno ; then
 
162
    have_docbook=no
 
163
else
 
164
    have_docbook=yes
 
165
fi
 
166
if test x$enable_docbook_docs = xauto ; then
 
167
    if test x$have_docbook = xno ; then
 
168
        enable_docbook_docs=no
 
169
    else
 
170
        enable_docbook_docs=yes
 
171
    fi
 
172
fi
 
173
if test x$enable_docbook_docs = xyes; then
 
174
    if test x$have_docbook = xno; then
 
175
        AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found])
 
176
    fi
 
177
fi
 
178
AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes)
 
179
AC_MSG_RESULT(yes)
 
180
 
 
181
dnl ---------------------------------------------------------------------------
 
182
dnl - Some utility functions to make checking for X things easier.
 
183
dnl ---------------------------------------------------------------------------
 
184
 
 
185
# Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
 
186
#
 
187
AC_DEFUN([AC_CHECK_X_HEADER], [
 
188
  ac_save_CPPFLAGS="$CPPFLAGS"
 
189
  if test \! -z "$includedir" ; then 
 
190
    CPPFLAGS="$CPPFLAGS -I$includedir"
 
191
  fi
 
192
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 
193
  AC_CHECK_HEADER([$1],[$2],[$3],[$4])
 
194
  CPPFLAGS="$ac_save_CPPFLAGS"])
 
195
 
 
196
# Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
 
197
#
 
198
AC_DEFUN([AC_TRY_X_COMPILE], [
 
199
  ac_save_CPPFLAGS="$CPPFLAGS"
 
200
  if test \! -z "$includedir" ; then 
 
201
    CPPFLAGS="$CPPFLAGS -I$includedir"
 
202
  fi
 
203
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 
204
  AC_TRY_COMPILE([$1], [$2], [$3], [$4])
 
205
  CPPFLAGS="$ac_save_CPPFLAGS"])
 
206
 
 
207
 
 
208
# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
 
209
# Use this sparingly; it probably doesn't work very well on X programs.
 
210
#
 
211
AC_DEFUN([AC_CHECK_X_LIB], [
 
212
  ac_save_CPPFLAGS="$CPPFLAGS"
 
213
  ac_save_LDFLAGS="$LDFLAGS"
 
214
#  ac_save_LIBS="$LIBS"
 
215
 
 
216
  if test \! -z "$includedir" ; then 
 
217
    CPPFLAGS="$CPPFLAGS -I$includedir"
 
218
  fi
 
219
  # note: $X_CFLAGS includes $x_includes
 
220
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 
221
 
 
222
  if test \! -z "$libdir" ; then
 
223
    LDFLAGS="$LDFLAGS -L$libdir"
 
224
  fi
 
225
  # note: $X_LIBS includes $x_libraries
 
226
  LDFLAGS="$LDFLAGS $ALL_X_LIBS"
 
227
 
 
228
  AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
 
229
  CPPFLAGS="$ac_save_CPPFLAGS"
 
230
  LDFLAGS="$ac_save_LDFLAGS"
 
231
#  LIBS="$ac_save_LIBS"
 
232
  ])
 
233
 
 
234
 
 
235
# Usage: HANDLE_X_PATH_ARG([variable_name],
 
236
#                          [--command-line-option],
 
237
#                          [descriptive string])
 
238
#
 
239
# All of the --with options take three forms:
 
240
#
 
241
#   --with-foo (or --with-foo=yes)
 
242
#   --without-foo (or --with-foo=no)
 
243
#   --with-foo=/DIR
 
244
#
 
245
# This function, HANDLE_X_PATH_ARG, deals with the /DIR case.  When it sees
 
246
# a directory (string beginning with a slash) it checks to see whether
 
247
# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
 
248
# as appropriate.
 
249
#
 
250
AC_DEFUN([HANDLE_X_PATH_ARG], [
 
251
   case "$[$1]" in
 
252
    yes) ;;
 
253
    no)  ;;
 
254
 
 
255
    /*)
 
256
     AC_MSG_CHECKING([for [$3] headers])
 
257
     d=$[$1]/include
 
258
     if test -d $d; then
 
259
       X_CFLAGS="-I$d $X_CFLAGS"
 
260
       AC_MSG_RESULT($d)
 
261
     else
 
262
       AC_MSG_RESULT(not found ($d: no such directory))
 
263
     fi
 
264
 
 
265
     AC_MSG_CHECKING([for [$3] libs])
 
266
     d=$[$1]/lib
 
267
     if test -d $d; then
 
268
       X_LIBS="-L$d $X_LIBS"
 
269
       AC_MSG_RESULT($d)
 
270
     else
 
271
       AC_MSG_RESULT(not found ($d: no such directory))
 
272
     fi
 
273
 
 
274
     # replace the directory string with "yes".
 
275
     [$1]_req="yes"
 
276
     [$1]=$[$1]_req
 
277
     ;;
 
278
 
 
279
    *)
 
280
     echo ""
 
281
     echo "error: argument to [$2] must be \"yes\", \"no\", or a directory."
 
282
     echo "       If it is a directory, then \`DIR/include' will be added to"
 
283
     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
 
284
     exit 1
 
285
     ;;
 
286
   esac
 
287
  ])
 
288
 
 
289
dnl ---------------------------------------------------------------------------
 
290
dnl - Check for shaped window extension
 
291
dnl ---------------------------------------------------------------------------
 
292
 
 
293
have_shape=no
 
294
AC_CHECK_X_HEADER(X11/extensions/shape.h, [have_shape=yes],,
 
295
                    [#include <X11/Xlib.h>])
 
296
if test "$have_shape" = yes; then
 
297
  AC_DEFINE(HAVE_SHAPE_EXT, 1, [Define if shape extension is available])
 
298
fi
 
299
 
 
300
dnl ---------------------------------------------------------------------------
 
301
dnl - Check for the MIT-SCREEN-SAVER server extension.
 
302
dnl ---------------------------------------------------------------------------
 
303
 
 
304
have_mit=no
 
305
with_mit_req=unspecified
 
306
AC_ARG_WITH(mit-ext,
 
307
[  --with-mit-ext          Include support for the MIT-SCREEN-SAVER extension.],
 
308
  [with_mit="$withval"; with_mit_req="$withval"],[with_mit=yes])
 
309
 
 
310
HANDLE_X_PATH_ARG(with_mit, --with-mit-ext, MIT-SCREEN-SAVER)
 
311
 
 
312
if test "$with_mit" = yes; then
 
313
  AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes],,
 
314
                    [#include <X11/Xlib.h>])
 
315
 
 
316
  # Now check to see if it's really in the library; XF86Free-3.3 ships
 
317
  # scrnsaver.h, but doesn't include the code in libXext.a
 
318
  if test "$have_mit" = yes; then
 
319
    AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [true], [have_mit=no], -lm)
 
320
 
 
321
    if test "$have_mit" = no; then
 
322
      # Looks like XF86Free-3.3 actually puts it in XExExt instead
 
323
      # of in Xext.
 
324
      AC_CHECK_X_LIB(XExExt, XScreenSaverRegister,
 
325
                     [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"],
 
326
                     [true], -lX11 -lXext -lm)
 
327
    fi
 
328
 
 
329
    if test "$have_mit" = no; then
 
330
      # Looks like some versions of XFree86 (whichever version
 
331
      # it is that comes with RedHat Linux 2.0 -- I can't find a version 
 
332
      # number) put this in Xss instead of Xext.
 
333
      AC_CHECK_X_LIB(Xss, XScreenSaverRegister,
 
334
                     [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"],
 
335
                     [true], -lX11 -lXext -lm)
 
336
    fi
 
337
 
 
338
  if test "$have_mit" = yes; then
 
339
    AC_DEFINE(HAVE_MIT_SAVER_EXTENSION, 1, [Define if the MIT screensaver extension is available])
 
340
  fi
 
341
 
 
342
  fi
 
343
 
 
344
elif test "$with_mit" != no; then
 
345
  echo "error: must be yes or no: --with-mit-ext=$with_mit"
 
346
  exit 1
 
347
fi
 
348
 
 
349
dnl ---------------------------------------------------------------------------
 
350
dnl - Check for the XF86VMODE server extension (for gamma fading.)
 
351
dnl ---------------------------------------------------------------------------
 
352
 
 
353
have_xf86vmode=no
 
354
have_xf86gamma=no
 
355
have_xf86gamma_ramp=no
 
356
with_xf86gamma_req=unspecified
 
357
AC_ARG_WITH(xf86gamma-ext,
 
358
[  --with-xf86gamma-ext    Include support for XFree86 gamma fading.],
 
359
  [with_xf86gamma="$withval"; with_xf86gamma_req="$withval"],
 
360
  [with_xf86gamma=yes])
 
361
 
 
362
HANDLE_X_PATH_ARG(with_xf86gamma, --with-xf86gamma-ext, xf86gamma)
 
363
 
 
364
if test "$with_xf86gamma" = yes; then
 
365
 
 
366
  # first check for xf86vmode.h, if we haven't already
 
367
  if test "$have_xf86vmode" = yes; then
 
368
    have_xf86gamma=yes
 
369
  else
 
370
    AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86gamma=yes],,
 
371
                      [#include <X11/Xlib.h>])
 
372
  fi
 
373
 
 
374
  # if that succeeded, then check for the -lXxf86vm
 
375
  if test "$have_xf86gamma" = yes; then
 
376
    have_xf86gamma=no
 
377
    AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGamma,
 
378
                  [have_xf86gamma=yes],
 
379
                   [true], -lXext -lX11)
 
380
  fi
 
381
 
 
382
  # check for the Ramp versions of the functions too.
 
383
  if test "$have_xf86gamma" = yes; then
 
384
    have_xf86gamma_ramp=no
 
385
    AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGammaRamp,
 
386
                  [have_xf86gamma_ramp=yes],
 
387
                   [true], -lXext -lX11)
 
388
  fi
 
389
 
 
390
  # if those tests succeeded, then we've really got the functions.
 
391
  if test "$have_xf86gamma" = yes; then
 
392
    AC_DEFINE(HAVE_XF86VMODE_GAMMA, 1, [Define if XF86VMODE Gamma is available])
 
393
  fi
 
394
 
 
395
  if test "$have_xf86gamma_ramp" = yes; then
 
396
    AC_DEFINE(HAVE_XF86VMODE_GAMMA_RAMP, 1, [Define if XF86VMODE Gamma Ramp is available])
 
397
  fi
 
398
 
 
399
  # pull in the lib, if we haven't already
 
400
  if test "$have_xf86gamma" = yes -a "$have_xf86vmode" = no; then
 
401
    SAVER_LIBS="$SAVER_LIBS -lXxf86vm"
 
402
  fi
 
403
 
 
404
elif test "$with_xf86gamma" != no; then
 
405
  echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode"
 
406
  exit 1
 
407
fi
 
408
 
 
409
dnl ---------------------------------------------------------------------------
 
410
dnl - Check for XF86MiscSetGrabKeysState (but only bother if we are already
 
411
dnl - using other XF86 stuff.)
 
412
dnl ---------------------------------------------------------------------------
 
413
 
 
414
 
 
415
have_xf86miscsetgrabkeysstate=no
 
416
if test "$have_xf86gamma" = yes -o "$have_xf86vmode" = yes; then
 
417
  AC_CHECK_X_LIB(Xxf86misc, XF86MiscSetGrabKeysState,
 
418
                [have_xf86miscsetgrabkeysstate=yes],
 
419
                [true], -lXext -lX11)
 
420
  if test "$have_xf86miscsetgrabkeysstate" = yes ; then
 
421
    SAVER_LIBS="$SAVER_LIBS -lXxf86misc"
 
422
    AC_DEFINE(HAVE_XF86MISCSETGRABKEYSSTATE, , [Define this if you have the XF86MiscSetGrabKeysState function])
 
423
  fi
 
424
fi
 
425
 
 
426
dnl ---------------------------------------------------------------------------
 
427
dnl - The --enable-locking option
 
428
dnl ---------------------------------------------------------------------------
 
429
 
 
430
AC_ARG_ENABLE(locking,[
 
431
Screen locking options:
 
432
 
 
433
  --enable-locking        Compile in support for locking the display.
 
434
  --disable-locking       Do not allow locking at all.],
 
435
  [enable_locking="$enableval"],[enable_locking=yes])
 
436
if test "$enable_locking" = yes; then
 
437
  true
 
438
elif test "$enable_locking" = no; then
 
439
  AC_DEFINE(NO_LOCKING, 1, [Define if screen locking support is disabled])
 
440
else
 
441
  echo "error: must be yes or no: --enable-locking=$enable_locking"
 
442
  exit 1
 
443
fi
 
444
 
 
445
# We can't lock on MacOS X, so don't compile in support for it.
 
446
#
 
447
if test "$ac_macosx" = yes; then
 
448
  if test "$enable_locking" = yes; then
 
449
    AC_MSG_RESULT(locking disabled: it doesn't work on MacOS X)
 
450
    enable_locking=no
 
451
    AC_DEFINE(NO_LOCKING, 1, [Define if screen locking support is disabled])
 
452
  fi
 
453
fi
 
454
 
 
455
dnl ---------------------------------------------------------------------------
 
456
dnl - Check for bsd_auth(3) (OpenBSD)
 
457
dnl ---------------------------------------------------------------------------
 
458
 
 
459
have_bsdauth=no
 
460
with_bsdauth_req=unspecified
 
461
NEED_SETUID=no
 
462
 
 
463
case "$host" in                                                                                       
 
464
  *-openbsd*)                                                                                         
 
465
    with_bsdauth=yes
 
466
    AUTH_SCHEME=bsdauth
 
467
    NEED_SETUID=no
 
468
    if test "x$enable_locking" = "xyes"; then
 
469
      with_bsdauth_req=yes
 
470
      NEED_SETUID=yes
 
471
    fi
 
472
esac  
 
473
 
 
474
if test "$with_bsdauth" = yes ; then
 
475
  AC_CACHE_CHECK([for BSD Authentication], ac_cv_bsdauth,
 
476
    [AC_TRY_X_COMPILE([#include <stdlib.h>
 
477
                       #include <unistd.h>
 
478
                       #include <sys/types.h>
 
479
                       #include <bsd_auth.h>],
 
480
      [int ok = auth_userokay("x", 0, "x", "x");],
 
481
      [ac_cv_bsdauth=yes],
 
482
      [ac_cv_bsdauth=no])])
 
483
  if test "$ac_cv_bsdauth" = yes; then
 
484
    have_bsdauth=yes
 
485
  fi
 
486
fi
 
487
 
 
488
if test "$have_bsdauth" = yes; then
 
489
  AC_DEFINE(HAVE_BSDAUTH, 1, [Define to 1 if using bsd_auth(3) authentication])
 
490
fi
 
491
 
 
492
AC_SUBST(NEED_SETUID)
 
493
 
 
494
dnl ---------------------------------------------------------------------------
 
495
dnl - Check for PAM
 
496
dnl ---------------------------------------------------------------------------
 
497
 
 
498
withval=""
 
499
AC_ARG_WITH(pam-prefix,
 
500
            AS_HELP_STRING([--with-pam-prefix=<prefix>],
 
501
                           [specify where pam files go]),
 
502
            [if test x$withval != x; then
 
503
               AC_MSG_RESULT("PAM files will be installed in prefix ${withval}.")
 
504
             fi])
 
505
 
 
506
if test x$withval != x; then
 
507
        PAM_PREFIX="$withval"
 
508
else
 
509
        PAM_PREFIX='${sysconfdir}'
 
510
fi
 
511
AC_SUBST(PAM_PREFIX)
 
512
 
 
513
have_pam=no
 
514
if test "x$enable_locking" = "xyes" -a "x$have_bsdauth" = "xno"; then
 
515
AC_CHECK_LIB(pam, pam_start, have_pam=yes)
 
516
fi
 
517
 
 
518
if test "x$have_pam" = "xyes"; then
 
519
        AUTH_LIBS="${AUTH_LIBS} -lpam"
 
520
        AUTH_SCHEME=pam
 
521
        # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt.
 
522
        have_timedwait=no
 
523
        AC_CHECK_LIB(c, sigtimedwait, [have_timedwait=yes])
 
524
        if test "$have_timedwait" = no ; then
 
525
                AC_CHECK_LIB(rt, sigtimedwait, [AUTH_LIBS="${AUTH_LIBS} -lrt"])
 
526
        fi
 
527
 
 
528
        AC_MSG_CHECKING(how to call pam_strerror)
 
529
        AC_CACHE_VAL(ac_cv_pam_strerror_args,
 
530
         [AC_TRY_COMPILE([#include <stdio.h>
 
531
                          #include <stdlib.h>
 
532
                          #include <security/pam_appl.h>],
 
533
                         [pam_handle_t *pamh = 0;
 
534
                          char *s = pam_strerror(pamh, PAM_SUCCESS);],
 
535
                         [ac_pam_strerror_args=2],
 
536
                         [AC_TRY_COMPILE([#include <stdio.h>
 
537
                                          #include <stdlib.h>
 
538
                                          #include <security/pam_appl.h>],
 
539
                                         [char *s =
 
540
                                           pam_strerror(PAM_SUCCESS);],
 
541
                                         [ac_pam_strerror_args=1],
 
542
                                         [ac_pam_strerror_args=0])])
 
543
          ac_cv_pam_strerror_args=$ac_pam_strerror_args])
 
544
        ac_pam_strerror_args=$ac_cv_pam_strerror_args
 
545
        if test "$ac_pam_strerror_args" = 1 ; then
 
546
          AC_MSG_RESULT(one argument)
 
547
        elif test "$ac_pam_strerror_args" = 2 ; then
 
548
          AC_DEFINE(PAM_STRERROR_TWO_ARGS, 1, [Define if pam_strerror takes two arguments])
 
549
          AC_MSG_RESULT(two arguments)
 
550
        else
 
551
          AC_MSG_RESULT(unknown)
 
552
        fi
 
553
 
 
554
elif test "x$have_bsdauth" = "xno"; then
 
555
        AC_MSG_ERROR("PAM libraries not found")
 
556
fi
 
557
AC_SUBST(HAVE_PAM)
 
558
AC_SUBST(AUTH_LIBS)
 
559
AC_SUBST(AUTH_SCHEME)
 
560
 
 
561
if test "x$have_pam" = "xyes"; then
 
562
  AC_CHECK_HEADERS([security/pam_modutil.h security/pam_ext.h])
 
563
  AC_CHECK_LIB(pam, pam_syslog, [AC_DEFINE(HAVE_PAM_SYSLOG, [], [Define to 1 if you have the pam_syslog function])])
 
564
fi
 
565
 
 
566
dnl test whether struct pam_message is const (Linux) or not (Sun)
 
567
if test "x$have_pam" = "xyes"; then
 
568
   pam_appl_h="$ac_pam_includes/security/pam_appl.h"
 
569
   AC_MSG_CHECKING(for const pam_message)
 
570
   AC_EGREP_HEADER([struct pam_message],
 
571
      $pam_appl_h,
 
572
      [ AC_EGREP_HEADER([const struct pam_message],
 
573
                        $pam_appl_h,
 
574
                        [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
 
575
                        [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
 
576
                        AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
 
577
                        )],
 
578
       [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
 
579
       )
 
580
fi
 
581
 
 
582
dnl ---------------------------------------------------------------------------
 
583
dnl ConsoleKit
 
584
dnl ---------------------------------------------------------------------------
 
585
 
 
586
AC_ARG_WITH(console-kit,
 
587
            AS_HELP_STRING([--with-console-kit],
 
588
                           [Add ConsoleKit support]),,
 
589
            with_console_kit=auto)
 
590
 
 
591
use_console_kit=no
 
592
if test "x$with_console_kit" != "xno" ; then
 
593
        use_console_kit=yes
 
594
        AC_DEFINE(WITH_CONSOLE_KIT, 1, [ConsoleKit support])
 
595
fi
 
596
AM_CONDITIONAL(WITH_CONSOLE_KIT, test x$use_console_kit = xyes)
 
597
AC_SUBST(WITH_CONSOLE_KIT)
 
598
 
 
599
dnl ---------------------------------------------------------------------------
 
600
dnl systemd
 
601
dnl ---------------------------------------------------------------------------
 
602
 
 
603
AC_ARG_WITH(systemd,
 
604
            AS_HELP_STRING([--with-systemd],
 
605
                           [Add systemd support]),
 
606
            [with_systemd=$withval], [with_systemd=auto])
 
607
 
 
608
PKG_CHECK_MODULES(SYSTEMD,
 
609
                  [libsystemd-login],
 
610
                  [have_systemd=yes], [have_systemd=no])
 
611
 
 
612
if test "x$with_systemd" = "xauto" ; then
 
613
        if test x$have_systemd = xno ; then
 
614
                use_systemd=no
 
615
        else
 
616
                use_systemd=yes
 
617
        fi
 
618
else
 
619
        use_systemd=$with_systemd
 
620
fi
 
621
 
 
622
if test "x$use_systemd" = "xyes"; then
 
623
        if test "x$have_systemd" = "xno"; then
 
624
                AC_MSG_ERROR([Systemd support explicitly required, but systemd not found])
 
625
        fi
 
626
 
 
627
        AC_DEFINE(WITH_SYSTEMD, 1, [systemd support])
 
628
fi
 
629
AC_SUBST(SYSTEMD_CFLAGS)
 
630
AC_SUBST(SYSTEMD_LIBS)
 
631
 
 
632
dnl ---------------------------------------------------------------------------
 
633
dnl libgnomekbd
 
634
dnl ---------------------------------------------------------------------------
 
635
 
 
636
have_libgnomekbdui=no
 
637
AC_ARG_WITH(kbd-layout-indicator,[  --without-kbd-layout-indicator         disable keyboard layout indicator],
 
638
            [with_kbd_layout_indicator="$withval"],[with_kbd_layout_indicator=yes])
 
639
if test x$with_kbd_layout_indicator != xno; then
 
640
  PKG_CHECK_MODULES(LIBGNOMEKBDUI, libgnomekbdui >= $LIBGNOMEKBDUI_REQUIRED_VERSION libxklavier, have_libgnomekbdui=yes, have_libgnomekbdui=no)
 
641
fi
 
642
if test "x$have_libgnomekbdui" = "xyes"; then
 
643
  AC_SUBST(LIBGNOMEKBDUI_CFLAGS)
 
644
  AC_SUBST(LIBGNOMEKBDUI_LIBS)
 
645
  AC_DEFINE(WITH_KBD_LAYOUT_INDICATOR, 1, [Define if keyboard layout indicator should be built])
 
646
fi
 
647
 
 
648
dnl ---------------------------------------------------------------------------
 
649
dnl Finish
 
650
dnl ---------------------------------------------------------------------------
 
651
 
 
652
AC_SUBST(AUTH_LIBS)
 
653
AC_SUBST(SAVER_LIBS)
 
654
 
 
655
 
 
656
REAL_PREFIX=
 
657
if test "x$prefix" = "xNONE"; then
 
658
  REAL_PREFIX=$ac_default_prefix
 
659
else
 
660
  REAL_PREFIX=$prefix
 
661
fi
 
662
 
 
663
## temporarily change prefix and exec_prefix
 
664
old_prefix=$prefix
 
665
prefix=$REAL_PREFIX
 
666
 
 
667
if test "x$exec_prefix" = xNONE ; then
 
668
   REAL_EXEC_PREFIX=$REAL_PREFIX
 
669
else
 
670
   REAL_EXEC_PREFIX=$exec_prefix
 
671
fi
 
672
old_exec_prefix=$exec_prefix
 
673
exec_prefix=$REAL_EXEC_PREFIX
 
674
 
 
675
## eval everything
 
676
LOCALSTATEDIR_TMP="$localstatedir"
 
677
EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
 
678
AC_SUBST(EXPANDED_LOCALSTATEDIR)
 
679
 
 
680
SYSCONFDIR_TMP="$sysconfdir"
 
681
EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
 
682
AC_SUBST(EXPANDED_SYSCONFDIR)
 
683
 
 
684
BINDIR_TMP="$bindir"
 
685
EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
 
686
AC_SUBST(EXPANDED_BINDIR)
 
687
 
 
688
LIBDIR_TMP="$libdir"
 
689
EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
 
690
AC_SUBST(EXPANDED_LIBDIR)
 
691
 
 
692
DATADIR_TMP="$datadir"
 
693
EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
 
694
AC_SUBST(EXPANDED_DATADIR)
 
695
 
 
696
## put prefix and exec_prefix back
 
697
prefix=$old_prefix
 
698
exec_prefix=$old_exec_prefix
 
699
 
 
700
# Turn on the additional warnings last, so -Werror doesn't affect other tests.
 
701
 
 
702
AC_ARG_ENABLE(more-warnings,
 
703
  AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]),
 
704
set_more_warnings="$enableval",[
 
705
if test -d $srcdir/.git; then
 
706
        is_cvs_version=true
 
707
        set_more_warnings=yes
 
708
else
 
709
        set_more_warnings=no
 
710
fi
 
711
])
 
712
AC_MSG_CHECKING(for more warnings)
 
713
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
 
714
        AC_MSG_RESULT(yes)
 
715
        CFLAGS="\
 
716
        -Wall \
 
717
        -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
 
718
        -Wnested-externs -Wpointer-arith \
 
719
        -Wcast-align -Wsign-compare \
 
720
        $CFLAGS"
 
721
 
 
722
        for option in -Wno-strict-aliasing -Wno-sign-compare; do
 
723
                SAVE_CFLAGS="$CFLAGS"
 
724
                CFLAGS="$CFLAGS $option"
 
725
                AC_MSG_CHECKING([whether gcc understands $option])
 
726
                AC_TRY_COMPILE([], [],
 
727
                        has_option=yes,
 
728
                        has_option=no,)
 
729
                if test $has_option = no; then
 
730
                        CFLAGS="$SAVE_CFLAGS"
 
731
                fi
 
732
                AC_MSG_RESULT($has_option)
 
733
                unset has_option
 
734
                unset SAVE_CFLAGS
 
735
        done
 
736
        unset option
 
737
else
 
738
        AC_MSG_RESULT(no)
 
739
fi
 
740
 
 
741
#
 
742
# Enable Debug
 
743
#
 
744
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug=[no/yes]], [turn on debugging])],, enable_debug=yes)
 
745
if test "$enable_debug" = "yes"; then
 
746
  DEBUG_CFLAGS="-DG_ENABLE_DEBUG"
 
747
else
 
748
  if test "x$enable_debug" = "xno"; then
 
749
    DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
 
750
  else
 
751
    DEBUG_CFLAGS=""
 
752
  fi
 
753
fi
 
754
AC_SUBST(DEBUG_CFLAGS)
 
755
 
 
756
# Flags
 
757
 
 
758
AC_SUBST(CFLAGS)
 
759
AC_SUBST(CPPFLAGS)
 
760
AC_SUBST(LDFLAGS)
 
761
 
 
762
# Files
 
763
 
 
764
AC_OUTPUT([
 
765
Makefile
 
766
po/Makefile.in
 
767
src/Makefile
 
768
src/gnome-screensaver.desktop.in
 
769
data/Makefile
 
770
data/org.gnome.ScreenSaver.service
 
771
doc/Makefile
 
772
doc/gnome-screensaver.xml
 
773
])
 
774
 
 
775
echo "
 
776
                    gnome-screensaver $VERSION
 
777
                    ========================
 
778
 
 
779
        prefix:                   ${prefix}
 
780
        exec_prefix:              ${exec_prefix}
 
781
        libdir:                   ${EXPANDED_LIBDIR}
 
782
        bindir:                   ${EXPANDED_BINDIR}
 
783
        sysconfdir:               ${EXPANDED_SYSCONFDIR}
 
784
        localstatedir:            ${EXPANDED_LOCALSTATEDIR}
 
785
        datadir:                  ${EXPANDED_DATADIR}
 
786
        source code location:     ${srcdir}
 
787
        compiler:                 ${CC}
 
788
        cflags:                   ${CFLAGS}
 
789
        Base libs:                ${GNOME_SCREENSAVER_LIBS}
 
790
        Extension libs:           ${SAVER_LIBS}
 
791
        Maintainer mode:          ${USE_MAINTAINER_MODE}
 
792
        Docs enabled:             ${enable_docbook_docs}
 
793
 
 
794
        Screen locking enabled:   ${enable_locking}
 
795
        Show keyboard indicator:  ${with_kbd_layout_indicator}
 
796
 
 
797
        systemd:                  ${use_systemd}
 
798
        ConsoleKit:               ${use_console_kit}
 
799
"
 
800
 
 
801
if test "x$have_pam" = "xyes" ; then
 
802
echo "\
 
803
        PAM prefix:               ${PAM_PREFIX}
 
804
 
 
805
"
 
806
fi
 
807