1AC_PREREQ([2.60])
2
3m4_define([msd_api_version_major],[1])
4m4_define([msd_api_version_minor],[26])
5m4_define([msd_api_version_micro],[0])
6m4_define([msd_api_version],
7	[msd_api_version_major.msd_api_version_minor.msd_api_version_micro])
8
9AC_INIT([mate-settings-daemon],
10	[msd_api_version_major.msd_api_version_minor.msd_api_version_micro],
11	[https://mate-desktop.org/])
12
13AC_CONFIG_SRCDIR([mate-settings-daemon/mate-settings-manager.c])
14AC_CONFIG_MACRO_DIR([m4])
15
16MATE_DEBUG_CHECK
17MATE_COMPILE_WARNINGS
18
19AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz tar-ustar check-news])
20AM_MAINTAINER_MODE([enable])
21
22m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
23
24AC_STDC_HEADERS
25AC_PROG_CXX
26AM_PROG_CC_C_O
27AC_PROG_LIBTOOL
28
29AC_HEADER_STDC
30
31AC_SUBST(VERSION)
32
33AC_CONFIG_HEADERS([config.h])
34
35AM_GNU_GETTEXT_VERSION([0.19.8])
36AM_GNU_GETTEXT([external])
37
38GETTEXT_PACKAGE=AC_PACKAGE_NAME
39AC_SUBST(GETTEXT_PACKAGE)
40AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain])
41
42AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
43
44MSD_INTLTOOL_PLUGIN_RULE='%.mate-settings-plugin:   %.mate-settings-plugin.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
45AC_SUBST([MSD_INTLTOOL_PLUGIN_RULE])
46
47dnl Unconditionally use this dir to avoid a circular dep with matecc
48MATE_KEYBINDINGS_KEYSDIR="${datadir}/mate-control-center/keybindings"
49AC_SUBST(MATE_KEYBINDINGS_KEYSDIR)
50
51dnl ---------------------------------------------------------------------------
52dnl - Dependencies
53dnl ---------------------------------------------------------------------------
54
55DBUS_GLIB_REQUIRED_VERSION=0.74
56GLIB_REQUIRED_VERSION=2.58.0
57GIO_REQUIRED_VERSION=2.50.0
58GTK_REQUIRED_VERSION=3.22.0
59MATE_DESKTOP_REQUIRED_VERSION=1.25.0
60LIBMATEKBD_REQUIRED_VERSION=1.17.0
61LIBNOTIFY_REQUIRED_VERSION=0.7.0
62LIBATSPI_REQUIRED_VERSION=2.0
63LIBMATEMIXER_REQUIRED_VERSION=1.10.0
64
65PKG_CHECK_MODULES(SETTINGS_DAEMON,
66	glib-2.0 >= $GLIB_REQUIRED_VERSION
67	gtk+-3.0 >= $GTK_REQUIRED_VERSION
68	gio-2.0 >= $GIO_REQUIRED_VERSION
69	gmodule-2.0
70	gthread-2.0
71	dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
72)
73
74PKG_CHECK_MODULES(SETTINGS_PLUGIN,
75	gtk+-3.0 >= $GTK_REQUIRED_VERSION
76	gio-2.0 >= $GIO_REQUIRED_VERSION
77	dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
78)
79
80MSD_PLUGIN_LDFLAGS="-export_dynamic -module -avoid-version -no-undefined"
81case $host_os in
82  darwin*)
83    MSD_PLUGIN_LDFLAGS="${MSD_PLUGIN_LDFLAGS} -Wl,-bundle_loader,\$(top_builddir)/mate-settings-daemon/mate-settings-daemon"
84    ;;
85esac
86AC_SUBST([MSD_PLUGIN_LDFLAGS])
87
88PKG_CHECK_MODULES(DCONF, dconf >= 0.13.4)
89
90AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
91
92GLIB_GSETTINGS
93
94dnl ---------------------------------------------------------------------------
95dnl - Check for mate-desktop
96dnl ---------------------------------------------------------------------------
97PKG_CHECK_MODULES(MATE_DESKTOP, mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED_VERSION)
98
99dnl ---------------------------------------------------------------------------
100dnl - Check for libnotify
101dnl ---------------------------------------------------------------------------
102
103have_libnotify=no
104AC_ARG_WITH(libnotify,
105	AC_HELP_STRING([--without-libnotify], [Disable notifications (default: auto)]),
106	with_libnotify=$withval, with_libnotify=auto)
107
108if test "x$with_libnotify" != "xno"; then
109	PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED_VERSION,
110			  [AC_DEFINE(HAVE_LIBNOTIFY, 1, [Define if libnotify is available])
111			  have_libnotify=yes], have_libnotify=no)
112	if test "x$have_libnotify" = xno -a "x$with_libnotify" = xyes; then
113		AC_MSG_ERROR([libnotify support requested but libraries not found])
114	fi
115fi
116AC_SUBST(LIBNOTIFY_CFLAGS)
117AC_SUBST(LIBNOTIFY_LIBS)
118
119dnl ---------------------------------------------------------------------------
120dnl - Check for libatspi
121dnl ---------------------------------------------------------------------------
122
123AC_ARG_WITH([libatspi],
124            [AS_HELP_STRING([--without-libatspi], [Disable key monitoring support (default: auto)])],
125            [with_libatspi=$withval], [with_libatspi=auto])
126
127have_libatspi=no
128AS_IF([test "x$with_libatspi" != xno],
129      [PKG_CHECK_MODULES([LIBATSPI], [atspi-2 >= $LIBATSPI_REQUIRED_VERSION],
130                         [AC_DEFINE([HAVE_LIBATSPI], [1], [Define if libatspi is available])
131                          have_libatspi=yes], [have_libatspi=no])
132       AS_IF([test "x$have_libatspi" = xno -a "x$with_libatspi" = xyes],
133             [AC_MSG_ERROR([libatspi support requested but libraries not found])])
134       PKG_CHECK_EXISTS([atspi-2 > 2.36.0],
135                        [AC_DEFINE([DESTROYING_ATSPI_LISTENER_DOES_NOT_CRASH], [1], [Define if libatspi does not have bug 22])],
136                        [])])
137AM_CONDITIONAL([HAVE_LIBATSPI], [test "x$have_libatspi" = xyes])
138
139dnl ---------------------------------------------------------------------------
140dnl - Check for D-Bus
141dnl ---------------------------------------------------------------------------
142
143dnl - Are we specifying a different dbus root ?
144AC_ARG_WITH(dbus-sys,
145        [AC_HELP_STRING([--with-dbus-sys=<dir>],
146        [where D-BUS system.d directory is])])
147AC_ARG_WITH(dbus-services,
148        [AC_HELP_STRING([--with-dbus-services=<dir>],
149        [where D-BUS services directory is])])
150if ! test -z "$with_dbus_sys" ; then
151        DBUS_SYS_DIR="$with_dbus_sys"
152else
153        DBUS_SYS_DIR='${datadir}/dbus-1/system.d'
154fi
155AC_SUBST(DBUS_SYS_DIR)
156
157dnl ---------------------------------------------------------------------------
158dnl - X11 stuff
159dnl ---------------------------------------------------------------------------
160
161# Like AC_CHECK_HEADERS, but it uses the already-computed -I directories.
162#
163AC_DEFUN([AC_CHECK_X_HEADERS], [
164  ac_save_CPPFLAGS="$CPPFLAGS"
165  if test \! -z "$includedir" ; then
166    CPPFLAGS="$CPPFLAGS -I$includedir"
167  fi
168  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
169  AC_CHECK_HEADERS([$1],[$2],[$3],[$4])
170  CPPFLAGS="$ac_save_CPPFLAGS"])
171
172# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
173# Use this sparingly; it probably doesn't work very well on X programs.
174#
175AC_DEFUN([AC_CHECK_X_LIB], [
176  ac_save_CPPFLAGS="$CPPFLAGS"
177  ac_save_LDFLAGS="$LDFLAGS"
178#  ac_save_LIBS="$LIBS"
179
180  if test \! -z "$includedir" ; then
181    CPPFLAGS="$CPPFLAGS -I$includedir"
182  fi
183  # note: $X_CFLAGS includes $x_includes
184  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
185
186  if test \! -z "$libdir" ; then
187    LDFLAGS="$LDFLAGS -L$libdir"
188  fi
189  # note: $X_LIBS includes $x_libraries
190  LDFLAGS="$LDFLAGS $ALL_X_LIBS"
191
192  AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
193  CPPFLAGS="$ac_save_CPPFLAGS"
194  LDFLAGS="$ac_save_LDFLAGS"
195#  LIBS="$ac_save_LIBS"
196  ])
197
198AC_PATH_XTRA
199
200ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
201
202X11_LIBS="$ALL_X_LIBS"
203AC_SUBST(X11_LIBS)
204
205dnl ---------------------------------------------------------------------------
206dnl - XInput
207dnl ---------------------------------------------------------------------------
208
209PKG_CHECK_MODULES(XINPUT, xi)
210
211dnl ---------------------------------------------------------------------------
212dnl - Fontconfig
213dnl ---------------------------------------------------------------------------
214
215PKG_CHECK_MODULES(FONTCONFIG, fontconfig)
216
217dnl ---------------------------------------------------------------------------
218dnl - Keyboard plugin stuff
219dnl ---------------------------------------------------------------------------
220
221AC_CHECK_X_HEADERS([X11/extensions/XKB.h])
222
223PKG_CHECK_MODULES(LIBMATEKBDUI, [libmatekbdui >= $LIBMATEKBD_REQUIRED_VERSION libmatekbd >= $LIBMATEKBD_REQUIRED_VERSION libxklavier >= 5.2])
224AC_SUBST(LIBMATEKBDUI_CFLAGS)
225AC_SUBST(LIBMATEKBDUI_LIBS)
226
227dnl ---------------------------------------------------------------------------
228dnl - Check for sound & mixer libraries
229dnl ---------------------------------------------------------------------------
230
231have_pulse=false
232AC_ARG_ENABLE(pulse,
233  AC_HELP_STRING([--disable-pulse], [Disable PulseAudio support]),
234       [case "${enableval}" in
235               yes) WANT_PULSE=yes ;;
236               no)  WANT_PULSE=no ;;
237               *) AC_MSG_ERROR(bad value ${enableval} for --disable-pulse) ;;
238       esac],
239       [WANT_PULSE=no]) dnl Default value
240
241if test x$WANT_PULSE = xyes ; then
242       PA_REQUIRED_VERSION=0.9.16
243       PKG_CHECK_MODULES(PULSE, libpulse >= $PA_REQUIRED_VERSION,
244             [have_pulse=true
245              AC_DEFINE(HAVE_PULSE, 1, [Define if PulseAudio support is available])],
246             [have_pulse=false])
247fi
248AM_CONDITIONAL(HAVE_PULSE, test "x$have_pulse" = "xtrue")
249
250AC_SUBST(PULSE_CFLAGS)
251AC_SUBST(PULSE_LIBS)
252
253have_libcanberra=no
254AC_ARG_WITH(libcanberra,
255    AC_HELP_STRING([--without-libcanberra], [Disable sound events (default: auto)]),
256    with_libcanberra=$withval, with_libcanberra=auto)
257
258if test "x$with_libcanberra" != "xno"; then
259    PKG_CHECK_MODULES(LIBCANBERRA, libcanberra-gtk3,
260              [AC_DEFINE(HAVE_LIBCANBERRA, 1, [Define if libcanberra-gtk3 is available])
261              have_libcanberra=yes], have_libcanberra=no)
262    if test "x$have_libcanberra" = xno -a "x$with_libcanberra" = xyes; then
263        AC_MSG_ERROR([libcanberra support requested but library not found])
264    fi
265fi
266AC_SUBST(LIBCANBERRA_CFLAGS)
267AC_SUBST(LIBCANBERRA_LIBS)
268
269have_libmatemixer=no
270AC_ARG_WITH(libmatemixer,
271    AC_HELP_STRING([--without-libmatemixer], [Disable volume event handling (default: auto)]),
272    with_libmatemixer=$withval, with_libmatemixer=auto)
273
274if test "x$with_libmatemixer" != "xno"; then
275    PKG_CHECK_MODULES(LIBMATEMIXER, libmatemixer >= $LIBMATEMIXER_REQUIRED_VERSION,
276              [AC_DEFINE(HAVE_LIBMATEMIXER, 1, [Define if libmatemixer is available])
277              have_libmatemixer=yes], have_libmatemixer=no)
278    if test "x$have_libmatemixer" = xno -a "x$with_libmatemixer" = xyes; then
279        AC_MSG_ERROR([libmatemixer support requested but library not found])
280    fi
281fi
282AC_SUBST(LIBMATEMIXER_CFLAGS)
283AC_SUBST(LIBMATEMIXER_LIBS)
284
285dnl ---------------------------------------------------------------------------
286dnl - Housekeeping plugin stuff
287dnl ---------------------------------------------------------------------------
288
289PKG_CHECK_MODULES(GIOUNIX, [gio-unix-2.0])
290AC_SUBST(GIOUNIX_CFLAGS)
291AC_SUBST(GIOUNIX_LIBS)
292
293dnl ==============================================
294dnl smartcard section
295dnl ==============================================
296have_smartcard_support=false
297AC_ARG_ENABLE(smartcard-support,
298  AC_HELP_STRING([--disable-smartcard-support],
299                 [turn off smartcard support]),
300       [case "${enableval}" in
301               yes) WANT_SMARTCARD_SUPPORT=yes ;;
302               no)  WANT_SMARTCARD_SUPPORT=no ;;
303               *) AC_MSG_ERROR(bad value ${enableval} for --disable-smartcard-support) ;;
304       esac],
305       [WANT_SMARTCARD_SUPPORT=yes])
306
307if test x$WANT_SMARTCARD_SUPPORT = xyes ; then
308       NSS_REQUIRED_VERSION=3.11.2
309       PKG_CHECK_MODULES(NSS, nss >= $NSS_REQUIRED_VERSION,
310             [have_smartcard_support=true
311              AC_DEFINE(SMARTCARD_SUPPORT, 1, [Define if smartcard support should be enabled])],
312             [have_smartcard_support=false])
313fi
314AM_CONDITIONAL(SMARTCARD_SUPPORT, test "x$have_smartcard_support" = "xtrue")
315
316AC_SUBST(NSS_CFLAGS)
317AC_SUBST(NSS_LIBS)
318
319AC_ARG_WITH(nssdb,
320  AC_HELP_STRING([--with-nssdb],
321                 [where system NSS database is]))
322
323NSS_DATABASE=""
324if test "x$have_smartcard_support" = "xtrue"; then
325        if ! test -z "$with_nssdb" ; then
326                NSS_DATABASE="$with_nssdb"
327        else
328                NSS_DATABASE="${sysconfdir}/pki/nssdb"
329        fi
330else
331        if ! test -z "$with_nssdb" ; then
332                AC_MSG_WARN([nssdb specified when smartcard support is disabled])
333        fi
334fi
335
336AC_SUBST(NSS_DATABASE)
337
338# ---------------------------------------------------------------------------
339# PolicyKit
340# ---------------------------------------------------------------------------
341
342POLKIT_REQUIRED=0.97
343DBUS_REQUIRED=1.10.0
344
345# PolicyKit detection; defaults to 'auto' (use it if it's available)
346#
347POLKIT_CFLAGS=
348POLKIT_LIBS=
349AC_ARG_ENABLE(polkit,
350              AS_HELP_STRING([--enable-polkit],
351                             [Enable PolicyKit support (auto)]),
352              enable_polkit=$enableval,
353              enable_polkit=auto)
354
355if test "x$enable_polkit" = "xno" ; then
356  HAVE_POLKIT=no
357else
358  HAVE_POLKIT=no
359  PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-1 >= $DBUS_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no)
360
361  if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno" ; then
362    AC_MSG_ERROR(PolicyKit support explicity enabled but not available)
363  fi
364
365  if test "x$HAVE_POLKIT" = "xyes" ; then
366    AC_DEFINE(HAVE_POLKIT, 1, [Defined if PolicyKit support is enabled])
367  fi
368fi
369AM_CONDITIONAL(HAVE_POLKIT, test "x$HAVE_POLKIT" = "xyes")
370AC_SUBST(POLKIT_CFLAGS)
371AC_SUBST(POLKIT_LIBS)
372
373# ---------------------------------------------------------------------------
374# Rfkill
375# ---------------------------------------------------------------------------
376
377AC_ARG_ENABLE(rfkill,
378              AS_HELP_STRING([--disable-rfkill], [disable rfkill support (default: enabled)]),,
379              enable_rfkill=yes, enabled_rfkill=no)
380
381if test x"$enable_rfkill" != x"no" ; then
382  AC_CHECK_HEADERS([linux/rfkill.h],,
383                   AC_MSG_ERROR([RFKill headers not found but rfkill support requested]))
384fi
385
386AM_CONDITIONAL(BUILD_RFKILL, [test x"$enable_rfkill" = x"yes"])
387
388# ---------------------------------------------------------------------------
389# Enable Profiling
390# ---------------------------------------------------------------------------
391AC_ARG_ENABLE(profiling,
392	[AC_HELP_STRING([--enable-profiling],
393	[turn on profiling])],
394	, enable_profiling=no)
395if test "x$enable_profiling" = "xyes"; then
396    AC_DEFINE(ENABLE_PROFILING,1,[enable profiling])
397fi
398
399# ---------------------------------------------------------------------------
400# Plugins
401# ---------------------------------------------------------------------------
402
403plugindir='$(libdir)/mate-settings-daemon'
404AC_SUBST([plugindir])
405
406dnl ---------------------------------------------------------------------------
407dnl - Finish
408dnl ---------------------------------------------------------------------------
409
410AC_OUTPUT([
411Makefile
412mate-settings-daemon/Makefile
413plugins/Makefile
414plugins/a11y-keyboard/Makefile
415plugins/a11y-settings/Makefile
416plugins/background/Makefile
417plugins/clipboard/Makefile
418plugins/common/Makefile
419plugins/datetime/Makefile
420plugins/dummy/Makefile
421plugins/housekeeping/Makefile
422plugins/keybindings/Makefile
423plugins/keyboard/Makefile
424plugins/media-keys/Makefile
425plugins/mpris/Makefile
426plugins/mouse/Makefile
427plugins/rfkill/Makefile
428plugins/smartcard/Makefile
429plugins/sound/Makefile
430plugins/typing-break/Makefile
431plugins/xrandr/Makefile
432plugins/xrdb/Makefile
433plugins/xrdb/data/Makefile
434plugins/xsettings/Makefile
435data/Makefile
436data/mate-settings-daemon.desktop.in
437data/mate-settings-daemon.pc
438data/mate-settings-daemon-uninstalled.pc
439data/org.mate.applications-at.gschema.xml
440data/org.mate.font-rendering.gschema.xml
441data/org.mate.peripherals-keyboard.gschema.xml
442data/org.mate.peripherals-mouse.gschema.xml
443data/org.mate.peripherals-smartcard.gschema.xml
444data/org.mate.peripherals-touchpad.gschema.xml
445data/org.mate.SettingsDaemon.plugins.a11y-keyboard.gschema.xml
446data/org.mate.SettingsDaemon.plugins.a11y-settings.gschema.xml
447data/org.mate.SettingsDaemon.plugins.background.gschema.xml
448data/org.mate.SettingsDaemon.plugins.clipboard.gschema.xml
449data/org.mate.SettingsDaemon.plugins.datetime.gschema.xml
450data/org.mate.SettingsDaemon.plugins.housekeeping.gschema.xml
451data/org.mate.SettingsDaemon.plugins.keybindings.gschema.xml
452data/org.mate.SettingsDaemon.plugins.keyboard.gschema.xml
453data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml
454data/org.mate.SettingsDaemon.plugins.mpris.gschema.xml
455data/org.mate.SettingsDaemon.plugins.mouse.gschema.xml
456data/org.mate.SettingsDaemon.plugins.rfkill.gschema.xml
457data/org.mate.SettingsDaemon.plugins.smartcard.gschema.xml
458data/org.mate.SettingsDaemon.plugins.sound.gschema.xml
459data/org.mate.SettingsDaemon.plugins.typing-break.gschema.xml
460data/org.mate.SettingsDaemon.plugins.xrandr.gschema.xml
461data/org.mate.SettingsDaemon.plugins.xrdb.gschema.xml
462data/org.mate.SettingsDaemon.plugins.xsettings.gschema.xml
463data/org.mate.SettingsDaemon.plugins.gschema.xml
464po/Makefile.in
465])
466
467dnl ---------------------------------------------------------------------------
468dnl - Show summary
469dnl ---------------------------------------------------------------------------
470
471echo "
472                mate-settings-daemon $VERSION
473                =============================
474
475    prefix:                   ${prefix}
476    exec_prefix:              ${exec_prefix}
477    libdir:                   ${libdir}
478    bindir:                   ${bindir}
479    sbindir:                  ${sbindir}
480    sysconfdir:               ${sysconfdir}
481    sysconfsubdir:            ${sysconfsubdir}
482    localstatedir:            ${localstatedir}
483    plugindir:                ${plugindir}
484    datadir:                  ${datadir}
485    source code location:     ${srcdir}
486    compiler:                 ${CC}
487    cflags:                   ${CFLAGS}
488    warning cflags:           ${WARN_CFLAGS}
489    Maintainer mode:          ${USE_MAINTAINER_MODE}
490
491    dbus-1 system.d dir:      ${DBUS_SYS_DIR}
492    PolicyKit support:        ${HAVE_POLKIT}
493
494    PulseAudio support:       ${have_pulse}
495    Libnotify support:        ${have_libnotify}
496    Libatspi support:         ${have_libatspi}
497    Libcanberra support:      ${have_libcanberra}
498    Libmatemixer support:     ${have_libmatemixer}
499    Smartcard support:        ${have_smartcard_support}
500    RFKill support:           ${enable_rfkill}
501${NSS_DATABASE:+\
502    System nssdb:             ${NSS_DATABASE}
503}\
504    Profiling support:        ${enable_profiling}
505"
506