configure.ac 14 KB
Newer Older
1
AC_INIT([gnome-session],
Ray Strode's avatar
Ray Strode committed
2
        [3.21.3],
3
        [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-session])
4

5
AC_CONFIG_SRCDIR([gnome-session])
6
AC_CONFIG_HEADERS([config.h])
7
AC_CONFIG_MACRO_DIR([m4])
8

Vincent Untz's avatar
Vincent Untz committed
9
AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz tar-ustar])
10

11
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
12

13
# Check for programs
14
AC_PROG_CC
Matthias Clasen's avatar
Matthias Clasen committed
15
AM_PROG_CC_C_O
16
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
17
PKG_PROG_PKG_CONFIG()
18

19 20 21
# Initialize libtool
LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])
22

23
GNOME_MAINTAINER_MODE_DEFINES
24
GNOME_COMPILE_WARNINGS([maximum])
Vincent Untz's avatar
Vincent Untz committed
25

26
AC_ARG_ENABLE(deprecation_flags,
27
              [AS_HELP_STRING([--enable-deprecation-flags],
28 29
                              [use *_DISABLE_DEPRECATED flags @<:@default=no@:>@])],,
              [enable_deprecation_flags=no])
Mark McLoughlin's avatar
Mark McLoughlin committed
30

31
if test "x$enable_deprecation_flags" = "xyes"; then
32
   DISABLE_DEPRECATED_CFLAGS=$DISABLE_DEPRECATED
33
   AC_SUBST([DISABLE_DEPRECATED_CFLAGS])
Mark McLoughlin's avatar
Mark McLoughlin committed
34 35
fi

36 37
GLIB_REQUIRED=2.46.0
GTK3_REQUIRED=3.18.0
38
DBUS_GLIB_REQUIRED=0.76
39
UPOWER_REQUIRED=0.9.0
40
JSON_GLIB_REQUIRED=0.10
41
GNOME_DESKTOP_REQUIRED=3.18.0
Elliot Lee's avatar
Elliot Lee committed
42

43 44 45 46 47 48 49 50
AC_ARG_ENABLE(session-selector, AS_HELP_STRING([--enable-session-selector],
                                               [enable building a custom session selector dialog]),
                                                enable_session_selector=$enableval,enable_session_selector=no)

AM_CONDITIONAL(BUILD_SESSION_SELECTOR,
               [test "$enable_session_selector" = yes])

if test "$enable_session_selector" = yes; then
51
        PKG_CHECK_MODULES(SESSION_SELECTOR, gtk+-3.0 gio-2.0)
52 53
fi

Lucas Rocha's avatar
Lucas Rocha committed
54
dnl ====================================================================
55
dnl Dependency Checks
Lucas Rocha's avatar
Lucas Rocha committed
56
dnl ====================================================================
57

58 59
dnl Standard vertical stacks
PKG_CHECK_MODULES(GIO, gio-2.0)
60
PKG_CHECK_MODULES(GIOUNIX, gio-unix-2.0 >= $GLIB_REQUIRED)
61 62
PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= $GTK3_REQUIRED)

63 64 65
PKG_CHECK_MODULES(GNOME_SESSION,
        glib-2.0 >= $GLIB_REQUIRED
        gio-2.0 >= $GLIB_REQUIRED
66
        json-glib-1.0 >= $JSON_GLIB_REQUIRED
67
        gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
68 69
)

Colin Walters's avatar
Colin Walters committed
70 71
dnl We can only support old upower
dnl https://bugzilla.gnome.org/show_bug.cgi?id=710383
72
PKG_CHECK_MODULES(UPOWER, upower-glib < 0.99.0, have_old_upower=yes, have_old_upower=no)
Colin Walters's avatar
Colin Walters committed
73 74 75 76 77
AS_IF([test x$have_old_upower = xyes], [
  AC_DEFINE([HAVE_OLD_UPOWER], [1], [Define if we have an older upower])
])
AM_CONDITIONAL(HAVE_OLD_UPOWER, test x$have_old_upower = xyes)

78 79
PKG_CHECK_MODULES(SESSION_PROPERTIES,
        glib-2.0 >= $GLIB_REQUIRED
80
        gtk+-3.0 >= $GTK3_REQUIRED
81
)
82

83
PKG_CHECK_MODULES(X11, x11)
84 85
PKG_CHECK_MODULES(SM, sm)
PKG_CHECK_MODULES(ICE, ice)
86
PKG_CHECK_MODULES(XEXT, xext xau)
87

88
PKG_CHECK_MODULES(GL_TEST, xcomposite gl glib-2.0)
89
PKG_CHECK_MODULES(GLES_TEST, egl glesv2)
90

91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
dnl ====================================================================
dnl Check for gconf
dnl ====================================================================
AC_ARG_ENABLE([gconf],
              AS_HELP_STRING([--enable-gconf], [Support gconf-based autostart]),
              [enable_gconf=$enableval],
              [enable_gconf=auto])

PKG_CHECK_MODULES(GCONF, gconf-2.0, [have_gconf=yes], [have_gconf=no])

if test x$enable_gconf = xauto ; then
        enable_gconf=$have_gconf
elif test x$enable_gconf = xyes -a x$have_gconf = xno ; then
        AC_MSG_ERROR([GConf support explicitly required, but gconf not found])
fi

if test x$enable_gconf = xyes ; then
        AC_DEFINE([HAVE_GCONF], [1], [Define if we support gconf-based autostart])
fi

111 112 113 114 115 116 117 118 119
dnl ====================================================================
dnl Check for systemd
dnl ====================================================================
AC_ARG_ENABLE([systemd],
              AS_HELP_STRING([--enable-systemd], [Use systemd]),
              [enable_systemd=$enableval],
              [enable_systemd=auto])

PKG_CHECK_MODULES(SYSTEMD,
120 121 122 123 124
                  [gio-unix-2.0 libsystemd >= 209],
                  [have_systemd=yes],
                  [PKG_CHECK_MODULES([SYSTEMD],
                                     [gio-unix-2.0 libsystemd-login >= 183 libsystemd-daemon libsystemd-journal],
                                     [have_systemd=yes],[have_systemd=no])])
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147

AC_MSG_CHECKING([whether to use systemd])

if test x$enable_systemd = xauto ; then
        if test x$have_systemd = xno ; then
                enable_systemd=no
        else
                enable_systemd=yes
        fi
fi

AC_MSG_RESULT($enable_systemd)

if test x$enable_systemd = xyes; then
        if test x$have_systemd = xno; then
                AC_MSG_ERROR([Systemd support explicitly required, but systemd not found])
        fi
        AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used for session tracking])
fi

AC_SUBST(SYSTEMD_CFLAGS)
AC_SUBST(SYSTEMD_LIBS)

148
AM_CONDITIONAL(HAVE_SYSTEMD, [test "$enable_systemd" = "yes"], [Using systemd])
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
dnl ====================================================================
dnl Check for ConsoleKit
dnl ====================================================================

AC_ARG_ENABLE([consolekit],
              AS_HELP_STRING([--enable-consolekit], [Use consolekit]),
              [enable_consolekit=$enableval],
              [enable_consolekit=no])

AC_MSG_CHECKING([whether to use consolekit])
AC_MSG_RESULT($enable_consolekit)

if test x$enable_consolekit = xyes; then
        PKG_CHECK_MODULES(CONSOLEKIT, [dbus-glib-1 >= $DBUS_GLIB_REQUIRED],
                          [have_consolekit=yes], [have_consolekit=no])
        if test x$have_consolekit = xno; then
                AC_MSG_ERROR([ConsoleKit support explicitly required, but dbus-glib not found])
        fi
        AC_DEFINE(HAVE_CONSOLEKIT, 1, [Define if ConsoleKit is used for session tracking])
fi

AC_SUBST(CONSOLEKIT_CFLAGS)
AC_SUBST(CONSOLEKIT_LIBS)

AM_CONDITIONAL(HAVE_CONSOLEKIT, [test "$enable_consolekit" = "yes"], [Using ConsoleKit])

if test x$enable_systemd = xyes; then
        if test x$enable_consolekit = xyes; then
                session_tracking="systemd (with fallback to ConsoleKit)"
        else
                session_tracking="systemd"
        fi
else
        if test x$enable_consolekit = xyes; then
                session_tracking="ConsoleKit"
        else
                session_tracking="null backend"
        fi
fi

William Jon McCann's avatar
William Jon McCann committed
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
dnl ====================================================================
dnl Check for XSync extension
dnl ====================================================================

have_xsync=no
AC_CHECK_HEADER(X11/extensions/sync.h, [have_xsync=yes],,
                    [#include <X11/Xlib.h>])
if test "$have_xsync" = yes; then
  AC_DEFINE(HAVE_XSYNC, 1, [Have the SYNC extension library])
fi

dnl ====================================================================
dnl Check for XTest extension
dnl ====================================================================

have_xtest=no
PKG_CHECK_MODULES(XTEST, xtst, have_xtest=yes, have_xtest=no)
if test "$have_xtest" = yes; then
    AC_DEFINE(HAVE_XTEST, 1, [Have the XTest extension library])
fi
AC_SUBST(HAVE_XTEST)
AC_SUBST(XTEST_CFLAGS)
AC_SUBST(XTEST_LIBS)

214 215 216 217 218 219 220 221 222 223 224 225 226
dnl ====================================================================
dnl XRender checks
dnl ====================================================================

PKG_CHECK_MODULES(XRENDER, xrender, have_xrender=yes, have_xrender=no)
AM_CONDITIONAL(HAVE_XRENDER, test x$have_xrender = xyes)
if test $have_xrender=yes; then
    AC_DEFINE(HAVE_XRENDER, 1, [Have the Render X extension])
fi
AC_SUBST(HAVE_XRENDER)
AC_SUBST(XRENDER_CFLAGS)
AC_SUBST(XRENDER_LIBS)

227 228 229 230 231
dnl ====================================================================
dnl - DocBook Documentation
dnl ====================================================================

AC_ARG_ENABLE(docbook-docs,
232 233 234 235
              [AS_HELP_STRING([--enable-docbook-docs],
                              [build documentation (requires xmlto)])],
              [enable_docbook_docs=$enableval],
              [enable_docbook_docs=auto])
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
AC_PATH_PROG(XMLTO, xmlto, no)
AC_MSG_CHECKING([whether to build DocBook documentation])
if test x$XMLTO = xno ; then
	have_docbook=no
else
	have_docbook=yes
fi
if test x$enable_docbook_docs = xauto ; then
	if test x$have_docbook = xno ; then
        	enable_docbook_docs=no
	else
		enable_docbook_docs=yes
	fi
fi
if test x$enable_docbook_docs = xyes; then
	if test x$have_docbook = xno; then
		AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found])
	fi
fi
AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes)
AC_MSG_RESULT($enable_docbook_docs)
257 258 259 260 261 262 263 264 265 266 267
AC_ARG_ENABLE(man,
              [AS_HELP_STRING([--enable-man],
                              [generate man pages [default=yes]])],,
              enable_man=yes)
if test "$enable_man" != no; then
  AC_PATH_PROG([XSLTPROC], [xsltproc])
  if test -z "$XSLTPROC"; then
    AC_MSG_ERROR([xsltproc is required for --enable-man])
  fi
fi
AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no)
268 269 270 271 272 273

dnl ====================================================================
dnl Check for xsltproc
dnl ====================================================================
AC_PATH_PROG([XSLTPROC], [xsltproc])

Lucas Rocha's avatar
Lucas Rocha committed
274
dnl ====================================================================
275
dnl Language Support
Lucas Rocha's avatar
Lucas Rocha committed
276
dnl ====================================================================
277
IT_PROG_INTLTOOL([0.40.6])
278

279
GETTEXT_PACKAGE=gnome-session-3.0
280 281
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
                   [The gettext translation domain])
282 283
AC_SUBST(GETTEXT_PACKAGE)

284
AM_GLIB_GNU_GETTEXT
285
GLIB_GSETTINGS
286

Lucas Rocha's avatar
Lucas Rocha committed
287
dnl ====================================================================
288
dnl Headers
Lucas Rocha's avatar
Lucas Rocha committed
289
dnl ====================================================================
290 291
AC_HEADER_STDC
AC_CHECK_HEADERS(syslog.h tcpd.h sys/param.h)
292

293 294 295 296 297
dnl ====================================================================
dnl check for backtrace support
dnl ====================================================================

AC_CHECK_HEADERS(execinfo.h)
298 299 300 301 302
AC_CHECK_LIB(execinfo, backtrace, [have_backtrace="yes"], [have_backtrace="no"])
EXECINFO_LIBS=""
if test "x$have_backtrace" = "xyes"; then
        EXECINFO_LIBS="-lexecinfo"
fi
303 304
AC_SUBST(EXECINFO_LIBS)

305
dnl ====================================================================
306 307
dnl Check for X transport interface - allows to disable ICE Transports
dnl See also https://bugzilla.gnome.org/show_bug.cgi?id=725100
308
dnl ====================================================================
309 310 311 312 313 314 315 316 317
AC_ARG_WITH([xtrans],
	    [AS_HELP_STRING([--without-xtrans],
			   [Build without xtrans support (results in ICE listening on remote TCP ports)])],
	    [],
	    [with_xtrans=yes])
AS_IF([test "$with_xtrans" != "no"],
      [PKG_CHECK_MODULES(XTRANS, xtrans,
      [AC_DEFINE(HAVE_XTRANS, 1, [Have the X Transport library])])])
AC_SUBST(HAVE_XTRANS)
Miguel de Icaza's avatar
Miguel de Icaza committed
318

319 320 321 322
dnl ====================================================================
dnl Code for checking whether IPv6 is enabled on the system....
dnl ====================================================================
AC_MSG_CHECKING([whether to enable ipv6])
323
AC_ARG_ENABLE(ipv6,
324 325
              [AS_HELP_STRING([--enable-ipv6],
                              [enable IPv6 extensions])],,
326
              [enable_ipv6=yes])
327
have_full_ipv6=no
328 329 330 331 332
if test $enable_ipv6 = yes; then

  dnl ====================================================================
  dnl Code for checking presence of AF_INET6 on the system....
  dnl ====================================================================
333
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
334
    #include <sys/types.h>
335
    #include <sys/socket.h>]], [[
336
    socket(AF_INET6, SOCK_STREAM, 0)
337 338 339
    ]])],
    [have_ipv6=yes],
    [have_ipv6=no]
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
  )
  AC_MSG_RESULT($have_ipv6)

  dnl =================================================================
  dnl Now we would check for specific function like getaddrinfo.
  dnl =================================================================
  have_getaddrinfo=no
  if test $have_ipv6=yes; then
    AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
    if test $have_getaddrinfo != yes; then
      # getaddrinfo is not in the default libraries.  See if it's in some other.
      for lib in bsd socket inet; do
        AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes; break])
      done
    fi
    if test $have_getaddrinfo=yes; then
356
      AC_DEFINE(ENABLE_IPV6, 1, [Define if IPV6 is supported])
357
      have_full_ipv6=yes
358 359 360 361 362 363 364
    fi
  fi
fi
dnl ==============================================================================
dnl End of IPv6 checks
dnl ==============================================================================

365
AC_CONFIG_FILES([
366
Makefile
367
doc/Makefile
368 369
doc/dbus/Makefile
doc/dbus/gnome-session.xml
370
doc/man/Makefile
371
data/Makefile
372
data/org.gnome.SessionManager.gschema.xml
373 374
gnome-session/Makefile
tools/Makefile
375
po/Makefile.in
376
])
377
AC_OUTPUT
378 379 380 381 382 383 384

dnl ---------------------------------------------------------------------------
dnl - Show summary
dnl ---------------------------------------------------------------------------

echo "
              gnome-session $VERSION
385
              `echo gnome-session $VERSION | sed "s/./=/g"`
386 387 388 389 390 391 392 393 394 395

        prefix:                   ${prefix}
        exec_prefix:              ${exec_prefix}
        libdir:                   ${libdir}
        bindir:                   ${bindir}
        sbindir:                  ${sbindir}
        sysconfdir:               ${sysconfdir}
        localstatedir:            ${localstatedir}
        datadir:                  ${datadir}
        source code location:     ${srcdir}
396 397
        compiler:                 ${CC}
        cflags:                   ${CFLAGS}
398
        Maintainer mode:          ${USE_MAINTAINER_MODE}
399
        Use *_DISABLE_DEPRECATED: ${enable_deprecation_flags}
400

401
        GConf support:            ${enable_gconf}
402
        Session tracking:         ${session_tracking}
403 404
        IPv6 support:             ${have_full_ipv6}
        Backtrace support:        ${have_backtrace}
405
        XRender support:          ${have_xrender}
William Jon McCann's avatar
William Jon McCann committed
406 407
        XSync support:            ${have_xsync}
        XTest support:            ${have_xtest}
Colin Walters's avatar
Colin Walters committed
408
	Legacy UPower backend:    ${have_old_upower}
409 410
        Build Docbook:            ${enable_docbook_docs}
        Build manpages:           ${enable_man}
411

412
"