system-controller: only override dst rectangle for apps.
[profile/ivi/murphy.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.59)
5
6 AC_INIT([murphy], m4_esyscmd([build-aux/git-version-gen .tarball-version]))
7
8 AC_CONFIG_SRCDIR([src])
9 AC_CONFIG_MACRO_DIR([m4])
10 AC_CONFIG_HEADER([src/config.h])
11 AM_INIT_AUTOMAKE([-Wno-portability])
12
13 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
14
15 m4_define(version_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
16 m4_define(version_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
17 m4_define(version_patch, `echo $VERSION | cut -d. -f3 | cut -d- -f1`)
18
19 AC_SUBST(VERSION)
20 AC_SUBST(VERSION_MAJOR, version_major)
21 AC_SUBST(VERSION_MINOR, version_minor)
22 AC_SUBST(VERSION_PATCH, version_patch)
23 AC_SUBST(VERSION_FULL, version_major.version_minor.version_patch)
24
25 MURPHY_VERSION_INFO="0:0:0"
26 AC_SUBST(MURPHY_VERSION_INFO)
27
28 # Disable static libraries.
29 AC_DISABLE_STATIC
30
31 # Checks for programs.
32 AC_PROG_CC
33 AC_PROG_CC_C99
34 # We need AC_PROG_CXX if Qt support is enabled but (at least some
35 # versions of autotools) cannot handle conditional use of this.
36 AC_PROG_CXX
37 AC_PROG_AWK
38 AC_PROG_INSTALL
39 AM_PROG_CC_C_O
40 AM_PROG_LIBTOOL
41 AC_PROG_LEX
42 AC_PROG_YACC
43 AM_PROG_LEX
44 AC_SUBST(LEXLIB)
45
46 # Check that we have flex/bison and not lex/yacc.
47 AC_MSG_CHECKING([for flex vs. lex])
48 case $LEX in
49     *missing\ flex*)
50         AC_MSG_ERROR([looks like you're missing flex])
51         ;;
52     *flex*)
53         AC_MSG_RESULT([ok, looks like we have flex])
54         ;;
55     *)
56         AC_MSG_ERROR([flex is required])
57         ;;
58 esac
59
60 AC_MSG_CHECKING([for bison vs. yacc])
61 case $YACC in
62     *missing\ *)
63         AC_MSG_ERROR([looks like you're missing bison])
64         ;;
65     *bison*)
66         AC_MSG_RESULT([ok, looks like we have bison])
67         ;;
68     *)
69         AC_MSG_ERROR([bison is required])
70         ;;
71 esac
72
73 # Guesstimate native compiler if we're cross-compiling.
74 if test "$cross_compiling" != "no"; then
75     AC_MSG_NOTICE([Looks like we're being cross-compiled...])
76     if test -z "$CC_FOR_BUILD"; then
77         CC_FOR_BUILD=cc
78     fi
79 else
80     AC_MSG_NOTICE([Looks like we're doing a native compilation...])
81     CC_FOR_BUILD='$(CC)'
82 fi
83 AC_SUBST(CC_FOR_BUILD)
84 UNSHAVED_CC_FOR_BUILD="$CC_FOR_BUILD"
85
86 # Make first invocation of PKG_CHECK_MODULES 'if-then-else-fi'-safe.
87 PKG_PROG_PKG_CONFIG
88
89 # Checks for libraries.
90 AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
91
92 # Checks for header files.
93 AC_PATH_X
94 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
95
96 # Checks for typedefs, structures, and compiler characteristics.
97 AC_HEADER_STDBOOL
98 AC_C_INLINE
99 AC_TYPE_INT16_T
100 AC_TYPE_INT32_T
101 AC_TYPE_INT64_T
102 AC_TYPE_MODE_T
103 AC_TYPE_PID_T
104 AC_TYPE_SIZE_T
105 AC_TYPE_SSIZE_T
106 AC_CHECK_MEMBERS([struct stat.st_rdev])
107 AC_TYPE_UINT16_T
108 AC_TYPE_UINT32_T
109 AC_TYPE_UINT64_T
110 AC_TYPE_UINT8_T
111 AC_CHECK_TYPES([ptrdiff_t])
112
113 # Checks for library functions.
114 AC_FUNC_ERROR_AT_LINE
115 AC_HEADER_MAJOR
116 if test "$cross_compiling" = "no"; then
117     AC_FUNC_MALLOC
118 fi
119 AC_FUNC_STRTOD
120 AC_CHECK_FUNCS([clock_gettime memmove memset regcomp strcasecmp strchr strdup strrchr strtol strtoul])
121
122 # Check and enable extra compiler warnings if they are supported.
123 AC_ARG_ENABLE(extra-warnings,
124               [  --enable-extra-warnings enable extra compiler warnings],
125               [extra_warnings=$enableval], [extra_warnings=auto])
126
127 WARNING_CFLAGS=""
128 warncflags="-Wall -Wextra"
129 if test "$extra_warnings" != "no"; then
130     save_CPPFLAGS="$CPPFLAGS"
131     for opt in $warncflags; do
132         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
133                           [WARNING_CFLAGS="$WARNING_CFLAGS $opt"])
134     done
135     CPPFLAGS="$save_CPPFLAGS"
136 fi
137
138 AC_SUBST(WARNING_CFLAGS)
139
140 # By default try to find the system default Lua (assumed to be
141 # called lua(.pc). If that is not found, try to look for
142 # packages lua5.2 and lua5.1, which can be found in Debian-based
143 # distributions.
144 #
145 # You can override this using the --with-lua option. For instance
146 # to use Lua 5.1 on Ubuntu while having 5.2 installed, you'd use
147 # --with-lua=lua5.1.
148 AC_ARG_WITH(lua,
149             [  --with-lua                build with specified Lua (pkgconfig filename without .pc suffix)],
150             [with_lua=$withval], [with_lua=default])
151
152 if test "x$with_lua" = "xdefault"; then
153     # Check for "lua" first, then "lua5.2" and finally for "lua5.1"
154     AC_MSG_NOTICE([Checking for an installed Lua...])
155     PKG_CHECK_MODULES([LUA], [lua >= 5.1.1],
156         [with_lua=lua],
157         [PKG_CHECK_MODULES([LUA52], [lua5.2],
158             [with_lua=lua5.2
159              LUA_CFLAGS=$LUA52_CFLAGS
160              LUA_LIBS=$LUA52_LIBS],
161             [PKG_CHECK_MODULES([LUA51], [lua5.1 >= 5.1.1],
162                 [with_lua=lua5.1
163                  LUA_CFLAGS=$LUA51_CFLAGS
164                  LUA_LIBS=$LUA51_LIBS],
165                 [AC_MSG_ERROR(Package requirement (lua >= 5.1.1) was not met!)])
166          ])
167     ])
168 else
169     # Check for pre-defined Lua.
170     AC_MSG_NOTICE([Compiling with Lua package $with_lua.])
171     PKG_CHECK_MODULES(LUA, $with_lua >= 5.1.1)
172 fi
173
174 AC_SUBST(LUA_CFLAGS)
175 AC_SUBST(LUA_LIBS)
176
177 # Check if potentially GPL bits are allowed to be enabled.
178 AC_ARG_ENABLE(gpl,
179               [  --enable-gpl            enable linking against GPL code],
180               [enable_gpl=$enableval], [enable_gpl=no])
181
182 # Check if original libdbus-based DBUS support was enabled.
183 AC_ARG_ENABLE(libdbus,
184               [  --enable-libdbus        enable libdbus-based D-BUS support],
185               [enable_libdbus=$enableval], [enable_libdbus=no])
186
187 if test "$enable_libdbus" = "yes"; then
188     if test "$enable_gpl" = "no"; then
189         AC_MSG_ERROR([libdbus D-Bus support requires the --enable-gpl option.])
190     fi
191     PKG_CHECK_MODULES(LIBDBUS, dbus-1 >= 0.70)
192
193     DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
194     AC_SUBST(DBUS_SESSION_DIR)
195
196     AC_DEFINE([LIBDBUS_ENABLED], 1, [Enable libdbus D-Bus support ?])
197 else
198     AC_MSG_NOTICE([libdbus-based D-Bus support is disabled.])
199 fi
200
201 AM_CONDITIONAL(LIBDBUS_ENABLED, [test "$enable_libdbus" = "yes"])
202 AC_SUBST(LIBDBUS_ENABLED)
203 AC_SUBST(LIBDBUS_CFLAGS)
204 AC_SUBST(LIBDBUS_LIBS)
205
206 # Check if systemd-bus-based D-Bus support was enabled.
207 AC_ARG_ENABLE(sdbus,
208               [  --enable-sdbus         enable systemd-based D-BUS support],
209               [enable_sdbus=$enableval], [enable_sdbus=no])
210
211 if test "$enable_sdbus" = "yes"; then
212     PKG_CHECK_MODULES(SDBUS, libsystemd-bus)
213     AC_DEFINE([SDBUS_ENABLED], 1, [Enable systemd-bus support ?])
214
215     if test -z "$DBUS_SESSION_DIR"; then
216         # Try to determine the session bus service directory.
217         DBUS_SESSION_DIR="`pkg-config --variable \
218                                session_bus_services_dir dbus-1`"
219         if test "$?" != "0" -o -z "$DBUS_SESSION_DIR"; then
220             DBUS_SESSION_DIR="/usr/share/dbus-1/services"
221         fi
222         AC_SUBST(DBUS_SESSION_DIR)
223     fi
224 else
225     AC_MSG_NOTICE([libsystemd-bus based D-Bus support is disabled.])
226 fi
227
228 AM_CONDITIONAL(SDBUS_ENABLED, [test "$enable_sdbus" = "yes"])
229 AC_SUBST(SDBUS_ENABLED)
230 AC_SUBST(SDBUS_CFLAGS)
231 AC_SUBST(SDBUS_LIBS)
232
233 # Check if PulseAudio mainloop support was enabled.
234 AC_ARG_ENABLE(pulse,
235               [  --enable-pulse          enable PulseAudio mainloop support],
236               [enable_pulse=$enableval], [enable_pulse=auto])
237
238 if test "$enable_pulse" != "no"; then
239     PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.22,
240                              [have_pulse=yes], [have_pulse=no])
241     if test "$have_pulse" = "no" -a "$enable_pulse" = "yes"; then
242         AC_MSG_ERROR([PulseAudio development libraries not found.])
243     fi
244
245     if test "$enable_gpl" = "no"; then
246         if test "$enable_pulse" = "yes"; then
247            AC_MSG_ERROR([PulseAudio support requires the --enable-gpl option.])
248         else
249            enable_pulse="no"
250         fi
251     else
252         enable_pulse="$have_pulse"
253     fi
254 else
255     AC_MSG_NOTICE([PulseAudio mainloop support is disabled.])
256 fi
257
258 if test "$enable_pulse" = "yes"; then
259     AC_DEFINE([PULSE_ENABLED], 1, [Enable PulseAudio mainloop support ?])
260 fi
261 AM_CONDITIONAL(PULSE_ENABLED, [test "$enable_pulse" = "yes"])
262 AC_SUBST(PULSE_ENABLED)
263 AC_SUBST(PULSE_CFLAGS)
264 AC_SUBST(PULSE_LIBS)
265
266 # Check if EFL/ecore mainloop support was enabled.
267 AC_ARG_ENABLE(ecore,
268               [  --enable-ecore          enable EFL/ecore mainloop support],
269               [enable_ecore=$enableval], [enable_ecore=auto])
270
271
272 if test "$enable_ecore" != "no"; then
273     # We are using features which are present only at ecore 1.2 onwards.
274     PKG_CHECK_MODULES(ECORE, ecore >= 1.2,
275                       [have_ecore=yes], [have_ecore=no])
276     if test "$have_ecore" = "no" -a "$enable_ecore" = "yes"; then
277         AC_MSG_ERROR([EFL/ecore development libraries not found.])
278     fi
279
280     enable_ecore="$have_ecore"
281 else
282     AC_MSG_NOTICE([EFL/ecore mainloop support is disabled.])
283 fi
284
285 if test "$enable_ecore" = "yes"; then
286     AC_DEFINE([ECORE_ENABLED], 1, [Enable EFL/ecore mainloop support ?])
287 fi
288 AM_CONDITIONAL(ECORE_ENABLED, [test "$enable_ecore" = "yes"])
289 AC_SUBST(ECORE_ENABLED)
290 AC_SUBST(ECORE_CFLAGS)
291 AC_SUBST(ECORE_LIBS)
292
293 # Check if glib mainloop support was enabled.
294 AC_ARG_ENABLE(glib,
295               [  --enable-glib           enable glib mainloop support],
296               [enable_glib=$enableval], [enable_glib=auto])
297
298 if test "$enable_glib" != "no"; then
299     PKG_CHECK_MODULES(GLIB, glib-2.0,
300                       [have_glib=yes], [have_glib=no])
301     if test "$have_glib" = "no" -a "$enable_glib" = "yes"; then
302         AC_MSG_ERROR([glib development libraries not found.])
303     fi
304
305     enable_glib="$have_glib"
306 else
307     AC_MSG_NOTICE([glib mainloop support is disabled.])
308 fi
309
310 if test "$enable_glib" = "yes"; then
311     AC_DEFINE([GLIB_ENABLED], 1, [Enable glib mainloop support ?])
312 fi
313 AM_CONDITIONAL(GLIB_ENABLED, [test "$enable_glib" = "yes"])
314 AC_SUBST(GLIB_ENABLED)
315 AC_SUBST(GLIB_CFLAGS)
316 AC_SUBST(GLIB_LIBS)
317
318 # Check if qt mainloop support was enabled.
319 AC_ARG_ENABLE(qt,
320               [  --enable-qt             enable qt mainloop support],
321               [enable_qt=$enableval], [enable_qt=auto])
322
323 if test "$enable_qt" != "no"; then
324     PKG_CHECK_MODULES(QTCORE, QtCore,
325                       [have_qt=yes], [have_qt=no])
326     if test "$have_qt" = "no" -a "$enable_qt" = "yes"; then
327         AC_MSG_ERROR([Qt(Core) development libraries not found.])
328     fi
329
330     enable_qt="$have_qt"
331 else
332     AC_MSG_NOTICE([Qt mainloop support is disabled.])
333 fi
334
335 if test "$enable_qt" = "yes"; then
336     AC_DEFINE([QT_ENABLED], 1, [Enable qt mainloop support ?])
337     QT_MOC="`pkg-config --variable moc_location QtCore`"
338     AC_SUBST(QT_MOC)
339 fi
340 AM_CONDITIONAL(QT_ENABLED, [test "$enable_qt" = "yes"])
341 AC_SUBST(QT_ENABLED)
342 AC_SUBST(QTCORE_CFLAGS)
343 AC_SUBST(QTCORE_LIBS)
344
345 # Check if building murphy-console was enabled.
346 AC_ARG_ENABLE(console,
347               [  --enable-console        build Murphy console],
348               [enable_console=$enableval], [enable_console=yes])
349
350 if test "$enable_console" = "no"; then
351     AC_MSG_NOTICE([Murphy console binary is disabled.])
352 else
353     AC_MSG_NOTICE([Murphy console binary is enabled.])
354 fi
355
356 if test "$enable_console" = "yes"; then
357     AC_DEFINE([CONSOLE_ENABLED], 1, [Build Murphy console ?])
358 fi
359 AM_CONDITIONAL(CONSOLE_ENABLED, [test "$enable_console" = "yes"])
360 AC_SUBST(CONSOLE_ENABLED)
361 AC_SUBST(READLINE_CFLAGS)
362 AC_SUBST(READLINE_LIBS)
363
364 # Check for json(-c).
365 PKG_CHECK_MODULES(JSON, [json], [have_json=yes], [have_json=no])
366
367 if test "$have_json" = "no"; then
368     PKG_CHECK_MODULES(JSON, [json-c >= 0.11])
369 fi
370
371 AC_MSG_CHECKING([if json-c has headers under json-c include path])
372 saved_CFLAGS="$CFLAGS"
373 saved_LIBS="$LIBS"
374 CFLAGS="${JSON_CFLAGS}"
375 LIBS="${JSON_LIBS}"
376 AC_LINK_IFELSE(
377    [AC_LANG_PROGRAM(
378          [[#include <../json-c/json.h>]],
379          [[return 0;]])],
380     [json_include_jsonc=yes],
381     [json_include_jsonc=no])
382 AC_MSG_RESULT([$json_include_jsonc])
383 CFLAGS="$saved_CFLAGS"
384 LIBS="$saved_LIBS"
385
386 if test "$json_include_jsonc" = "yes"; then
387     AC_DEFINE([JSON_INCLUDE_PATH_JSONC], 1, [json headers under json-c ?])
388 fi
389
390 AC_MSG_CHECKING([for json_tokener_get_error()])
391 saved_CFLAGS="$CFLAGS"
392 saved_LIBS="$LIBS"
393 CFLAGS="${JSON_CFLAGS}"
394 LIBS="${JSON_LIBS}"
395 AC_LINK_IFELSE(
396    [AC_LANG_PROGRAM(
397          [[#include <json.h>]],
398          [[json_tokener *tok = NULL;
399            if (json_tokener_get_error(tok) != json_tokener_success)
400               return 0;
401            else
402                return 1;]])],
403     [have_json_tokener_get_error=yes],
404     [have_json_tokener_get_error=no])
405 AC_MSG_RESULT([$have_json_tokener_get_error])
406 CFLAGS="$saved_CFLAGS"
407 LIBS="$saved_LIBS"
408
409 if test "$have_json_tokener_get_error" = "yes"; then
410     AC_DEFINE([HAVE_JSON_TOKENER_GET_ERROR], 1, [json_tokener_get_error ?])
411 fi
412
413 # Check if websocket support was/can be enabled.
414 CHECK_WEBSOCKETS()
415
416 # Check if SMACK support should be enabled.
417 AC_ARG_ENABLE(smack,
418               [  --enable-smack          enable SMACK support],
419               [enable_smack=$enableval], [enable_smack=auto])
420
421 if test "$enable_smack" != "no"; then
422     PKG_CHECK_MODULES(SMACK, libsmack, [have_smack=yes], [have_smack=no])
423     if test "$have_smack" = "no" -a "$enable_smack" = "yes"; then
424         AC_MSG_ERROR([SMACK development libraries not found.])
425     fi
426
427     enable_smack="$have_smack"
428 else
429     AC_MSG_NOTICE([SMACK support is disabled.])
430 fi
431
432 if test "$enable_smack" = "yes"; then
433     AC_DEFINE([SMACK_ENABLED], 1, [Enable SMACK support ?])
434 fi
435 AM_CONDITIONAL(SMACK_ENABLED, [test "$enable_smack" = "yes"])
436 AC_SUBST(SMACK_ENABLED)
437 AC_SUBST(SMACK_CFLAGS)
438 AC_SUBST(SMACK_LIBS)
439
440 # Check if systemd support should be enabled.
441 AC_ARG_ENABLE(systemd,
442               [  --enable-systemd          enable systemd support],
443               [enable_systemd=$enableval], [enable_systemd=auto])
444
445 if test "$enable_systemd" != "no"; then
446     PKG_CHECK_MODULES(SYSTEMD, libsystemd-journal libsystemd-daemon,
447                       [have_systemd=yes], [have_systemd=no])
448     if test "$have_systemd" = "no" -a "$enable_systemd" = "yes"; then
449         AC_MSG_ERROR([systemd development libraries not found.])
450     fi
451
452     enable_systemd="$have_systemd"
453 else
454     AC_MSG_NOTICE([systemd support is disabled.])
455 fi
456
457 if test "$enable_systemd" = "yes"; then
458     AC_DEFINE([SYSTEMD_ENABLED], 1, [Enable systemd support ?])
459 fi
460 AM_CONDITIONAL(SYSTEMD_ENABLED, [test "$enable_systemd" = "yes"])
461 AC_SUBST(SYSTEMD_ENABLED)
462 AC_SUBST(SYSTEMD_CFLAGS)
463 AC_SUBST(SYSTEMD_LIBS)
464
465 # Check if telephony was enabled.
466 AC_ARG_ENABLE(telephony,
467               [  --enable-telephony           enable telephony support],
468               [enable_telephony=$enableval], [enable_telephony=no])
469
470 if test "$enable_telephony" = "yes"; then
471     if test "$enable_gpl" = "no"; then
472         AC_MSG_ERROR([Telephony support requires the --enable-gpl option.])
473     fi
474     PKG_CHECK_MODULES(OFONO, ofono >= 1.1)
475 else
476     AC_MSG_NOTICE([Telephony support is disabled.])
477 fi
478
479 if test "$enable_telephony" = "yes"; then
480     AC_DEFINE([TELEPHONY_ENABLED], 1, [Enable D-BUS support ?])
481 fi
482
483 AM_CONDITIONAL(TELEPHONY_ENABLED, [test "$enable_telephony" = "yes"])
484 AC_SUBST(TELEPHONY_ENABLED)
485 AC_SUBST(TELEPHONY_CFLAGS)
486 AC_SUBST(TELEPHONY_LIBS)
487
488 PKG_CHECK_MODULES(AUL, aul,
489            [have_aul=yes], [have_aul=no])
490 enable_aul="$have_aul"
491 if test "$enable_aul" = "yes"; then
492     AC_DEFINE([AUL_ENABLED], 1, [Enable Application Utility Library support ?])
493 fi
494 AM_CONDITIONAL(AUL_ENABLED, [test "$enable_aul" = "yes"])
495 AC_SUBST(AUL_ENABLED)
496 AC_SUBST(AUL_CFLAGS)
497 AC_SUBST(AUL_LIBS)
498
499 PKG_CHECK_MODULES(TZCONFIG, libtzplatform-config,
500            [have_tzconfig=yes], [have_tzconfig=no])
501 enable_tzconfig="$have_tzconfig"
502 if test "$enable_tzconfig" = "yes"; then
503     AC_DEFINE([TZCONFIG_ENABLED], 1, [Enable Tizen configuration support ?])
504 fi
505 AM_CONDITIONAL(TZCONFIG_ENABLED, [test "$enable_tzconfig" = "yes"])
506 AC_SUBST(TZCONFIG_ENABLED)
507 AC_SUBST(TZCONFIG_CFLAGS)
508 AC_SUBST(TZCONFIG_LIBS)
509
510 # Check if system-controller (plugin) support should be enabled.
511 AC_ARG_ENABLE(system-controller,
512               [  --enable-system-controller enable system-controller support],
513               [enable_systemctl=$enableval], [enable_systemctl=no])
514
515 if test "$enable_systemctl" = "yes"; then
516     if test "$enable_websockets" != "yes"; then
517         AC_MSG_ERROR([System controller requires websocket support.])
518     fi
519     if test "$have_aul" != "yes"; then
520         AC_MSG_ERROR([System controller requires AUL support.])
521     fi
522     AC_MSG_NOTICE([System-controller support is enabled.])
523     AC_DEFINE([SYSTEMCTL_ENABLED], 1, [Enable system-controller support ?])
524     PKG_CHECK_MODULES(WAYLAND_CLIENT, wayland-client)
525     PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
526     PKG_CHECK_MODULES(
527         IVI_EXTENSION_PROTOCOL, ivi-extension-protocol,
528         [weston_ico_plugins=no], [weston_ico_plugins=yes]
529     )
530     AC_CHECK_HEADER([ico-uxf-weston-plugin/ico_input_mgr-client-protocol.h])
531     if test "$weston_ico_plugins" != "yes"; then
532         AC_MSG_NOTICE([System-controller uses GENIVI shell.])
533     fi
534     PKG_CHECK_MODULES(AIL, ail)
535 else
536     AC_MSG_NOTICE([System-controller support is disabled.])
537 fi
538
539 AM_CONDITIONAL(SYSTEMCTL_ENABLED, [test "$enable_systemctl" = "yes"])
540 AM_CONDITIONAL(WESTON_ICO_PLUGINS,[test "$weston_ico_plugins" = "yes"])
541 AC_SUBST(SYSTEMCTL_ENABLED)
542 AC_SUBST(WESTON_ICO_PLUGINS)
543 AC_SUBST(WAYLAND_CLIENT_CFLAGS)
544 AC_SUBST(WAYLAND_CLIENT_LIBS)
545 AC_SUBST(IVI_EXTENSION_PROTOCOL_CFLAGS)
546 AC_SUBST(IVI_EXTENSION_PROTOCOL_LIBS)
547 AC_SUBST(LIBXML2_CFLAGS)
548 AC_SUBST(LIBXML2_LIBS)
549 AC_SUBST(AIL_CFLAGS)
550 AC_SUBST(AIL_LIBS)
551
552 # Check if system-monitor (plugin) support should be enabled.
553 AC_ARG_ENABLE(system-monitor,
554               [  --enable-system-monitor enable system-monitor support],
555               [enable_sysmon=$enableval], [enable_sysmon=yes])
556
557 if test "$enable_sysmon" = "yes"; then
558     AC_MSG_NOTICE([System-monitor support is enabled.])
559     AC_DEFINE([SYSMON_ENABLED], 1, [Enable system-monitor support ?])
560 else
561     AC_MSG_NOTICE([System-monitor support is disabled.])
562 fi
563
564 AM_CONDITIONAL(SYSMON_ENABLED, [test "$enable_sysmon" = "yes"])
565 AC_SUBST(SYSMON_ENABLED)
566
567
568 # Check if dlog support was enabled.
569 AC_ARG_ENABLE(dlog,
570               [  --enable-dlog           enable dlog support],
571               [enable_dlog=$enableval], [enable_dlog=auto])
572
573 if test "$enable_dlog" != "no"; then
574     PKG_CHECK_MODULES(DLOG, dlog,
575                       [have_dlog=yes], [have_dlog=no])
576     if test "$have_dlog" = "no" -a "$enable_dlog" = "yes"; then
577         AC_MSG_ERROR([dlog development libraries not found.])
578     fi
579
580     enable_dlog="$have_dlog"
581 else
582     AC_MSG_NOTICE([dlog support is disabled.])
583 fi
584
585 if test "$enable_dlog" = "yes"; then
586     AC_DEFINE([DLOG_ENABLED], 1, [Enable dlog support ?])
587 fi
588 AM_CONDITIONAL(DLOG_ENABLED, [test "$enable_dlog" = "yes"])
589 AC_SUBST(DLOG_ENABLED)
590 AC_SUBST(DLOG_CFLAGS)
591 AC_SUBST(DLOG_LIBS)
592
593 # Check if Audio Session Manager plugin was enabled.
594 AC_ARG_ENABLE(resource-asm,
595               [  --enable-resource-asm        build Murphy Audio Session Manager plugin],
596               [enable_resource_asm=$enableval], [enable_resource_asm=no])
597
598 if test "$enable_resource_asm" != "no"; then
599     PKG_CHECK_MODULES(AUDIO_SESSION_MANAGER, audio-session-mgr,
600                       [have_resource_asm=yes], [have_resource_asm=no])
601     if test "$have_resource_asm" = "no" -a "$enable_resource_asm" = "yes"; then
602         AC_MSG_ERROR([Audio Session Manager development libraries not found.])
603     fi
604     AC_SUBST(AUDIO_SESSION_MANAGER_CFLAGS)
605     AC_SUBST(AUDIO_SESSION_MANAGER_LIBS)
606
607     enable_resource_asm="$have_resource_asm"
608 else
609     AC_MSG_NOTICE([Audio Session Manager support is disabled.])
610 fi
611 if test "$enable_resource_asm" = "yes"; then
612     AC_DEFINE([RESOURCE_ASM_ENABLED], 1, [Enable Audio Session Manager support ?])
613 fi
614 AM_CONDITIONAL(RESOURCE_ASM_ENABLED, [test "$enable_resource_asm" = "yes"])
615 AC_SUBST(RESOURCE_ASM_ENABLED)
616
617 # Set up murphy CFLAGS and LIBS.
618 MURPHY_CFLAGS=""
619 MURPHY_LIBS=""
620 AC_SUBST(MURPHY_CFLAGS)
621 AC_SUBST(MURPHY_LIBS)
622
623 # Allow substitution for LIBDIR and SYSCONFDIR.
624 AC_MSG_CHECKING([libdir])
625 AC_MSG_RESULT([$libdir])
626 AC_SUBST(LIBDIR, [$libdir])
627 AC_MSG_CHECKING([sysconfdir])
628 AC_MSG_RESULT([$sysconfdir])
629 AC_SUBST(SYSCONFDIR, [$sysconfdir])
630
631 #Check whether we build resources or not
632 AC_ARG_WITH(resources,
633             [  --with-resources wheter to build resource management support],
634             [with_resources=$withval],[with_resources=yes])
635
636 AM_CONDITIONAL(BUILD_RESOURCES,  [ test x$with_resources = "xyes" ])
637
638
639 # Check which plugins should be disabled.
640 AC_ARG_WITH(disabled-plugins,
641             [  --with-disabled-plugins=<plugin-list> specify which plugins to disable],
642             [disabled_plugins=$withval],[disabled_plugins=none])
643
644 # Check which plugins should be compiled as standalone DSOs.
645 AC_ARG_WITH(dynamic-plugins,
646             [  --with-dynamic-plugins=<plugin-list>  specify which plugins compile as DSOs],
647             [dynamic_plugins=$withval],[dynamic_plugins=none])
648
649 all_plugins=$(find src/plugins/. -name plugin-*.c 2>/dev/null | \
650               sed 's#^.*/plugin-##g;s#\.c$##g' | tr '\n' ' ')
651
652 #echo "all plugins: [$all_plugins]"
653
654 case $dynamic_plugins in
655     all)  dynamic_plugins="$all_plugins";;
656     none) dynamic_plugins="";;
657 esac
658
659 internal=""; it=""
660 external=""; et=""
661 disabled=""; dt=""
662 for plugin in $all_plugins; do
663     type=internal
664
665     for p in ${dynamic_plugins//,/ }; do
666         if test "$plugin" = "$p"; then
667             type=external
668         fi
669     done
670
671     for p in ${disabled_plugins//,/ }; do
672         if test "$plugin" = "$p"; then
673             type=disabled
674         fi
675     done
676
677     case $type in
678         internal) internal="$internal$it$plugin"; it=" ";;
679         external) external="$external$et$plugin"; et=" ";;
680         disabled) disabled="$disabled$dt$plugin"; dt=" ";;
681     esac
682 done
683
684 DISABLED_PLUGINS="$disabled"
685 INTERNAL_PLUGINS="$internal"
686 EXTERNAL_PLUGINS="$external"
687
688
689 function check_if_disabled() {
690     for p in $DISABLED_PLUGINS; do
691         if test "$1" = "$p"; then
692             return 0
693         fi
694     done
695
696     return 1
697 }
698
699 function check_if_internal() {
700     for p in $INTERNAL_PLUGINS; do
701         if test "$1" = "$p"; then
702             return 0
703         fi
704     done
705
706     return 1
707 }
708
709 AM_CONDITIONAL(DISABLED_PLUGIN_TEST,     [check_if_disabled test])
710 AM_CONDITIONAL(DISABLED_PLUGIN_DBUS,     [check_if_disabled dbus])
711 AM_CONDITIONAL(DISABLED_PLUGIN_GLIB,     [check_if_disabled glib])
712 AM_CONDITIONAL(DISABLED_PLUGIN_CONSOLE,  [check_if_disabled console])
713 AM_CONDITIONAL(DISABLED_PLUGIN_DLOG,     [check_if_disabled dlog])
714 AM_CONDITIONAL(DISABLED_PLUGIN_RESOURCE_DBUS, [check_if_disabled resource-dbus])
715 AM_CONDITIONAL(DISABLED_PLUGIN_RESOURCE_WRT, [check_if_disabled resource-wrt])
716 AM_CONDITIONAL(DISABLED_PLUGIN_AMB, [check_if_disabled amb])
717 AM_CONDITIONAL(DISABLED_PLUGIN_DOMAIN_CONTROL,
718                [check_if_disabled domain-control])
719 AM_CONDITIONAL(DISABLED_PLUGIN_SYSTEMD,  [check_if_disabled systemd])
720 AM_CONDITIONAL(DISABLED_PLUGIN_TELEPHONY, [check_if_disabled telephony])
721 AM_CONDITIONAL(DISABLED_PLUGIN_RESOURCE_ASM,     [check_if_disabled resource-asm])
722 AM_CONDITIONAL(DISABLED_PLUGIN_SYSTEMCTL,  [test $enable_systemctl != yes])
723 AM_CONDITIONAL(DISABLED_PLUGIN_SYSMON,  [test $enable_sysmon != yes])
724
725 AM_CONDITIONAL(BUILTIN_PLUGIN_TEST,     [check_if_internal test])
726 AM_CONDITIONAL(BUILTIN_PLUGIN_DBUS,     [check_if_internal dbus])
727 AM_CONDITIONAL(BUILTIN_PLUGIN_GLIB,     [check_if_internal glib])
728 AM_CONDITIONAL(BUILTIN_PLUGIN_CONSOLE,  [check_if_internal console])
729 AM_CONDITIONAL(BUILTIN_PLUGIN_DLOG,     [check_if_internal dlog])
730 AM_CONDITIONAL(BUILTIN_PLUGIN_RESOURCE_DBUS, [check_if_internal resource-dbus])
731 AM_CONDITIONAL(BUILTIN_PLUGIN_RESOURCE_WRT, [check_if_internal resource-wrt])
732 AM_CONDITIONAL(BUILTIN_PLUGIN_AMB, [check_if_internal amb])
733 AM_CONDITIONAL(BUILTIN_PLUGIN_DOMAIN_CONTROL,
734                [check_if_internal domain-control])
735 AM_CONDITIONAL(BUILTIN_PLUGIN_LUA,      [check_if_internal lua])
736 AM_CONDITIONAL(BUILTIN_PLUGIN_SYSTEMD,  [check_if_internal systemd])
737 AM_CONDITIONAL(BUILTIN_PLUGIN_TELEPHONY, [check_if_internal telephony])
738 AM_CONDITIONAL(BUILTIN_PLUGIN_RESOURCE_ASM,      [check_if_internal resource-asm])
739 AM_CONDITIONAL(BUILTIN_PLUGIN_SYSTEMCTL, [check_if_internal system-controller])
740 AM_CONDITIONAL(BUILTIN_PLUGIN_SYSMON, [check_if_internal system-monitor])
741
742 # Check for Check (unit test framework).
743 PKG_CHECK_MODULES(CHECK,
744                   check >= 0.9.4,
745                   [has_check="yes"], [has_check="no"])
746 AM_CONDITIONAL(HAVE_CHECK, test "x$has_check" = "xyes")
747
748 AC_SUBST(CHECK_CFLAGS)
749 AC_SUBST(CHECK_LIBS)
750
751 if test "x$has_check" = "xno"; then
752     AC_MSG_WARN([Check framework not found, unit tests are DISABLED.])
753 fi
754
755 # Check for documentation tools
756 AC_ARG_WITH([documentation],
757             [AS_HELP_STRING([--with-documentation],
758                             [generate pdf, html and other doc files])],
759             [],
760             [with_documentation=auto]
761 )
762
763 AS_IF( [ test x$with_documentation = xno ],
764        [ has_doc_tools="no" ],
765        [ AC_PATH_TOOL([MRP_DOXYGEN], doxygen)
766          AC_PATH_TOOL([MRP_LYX], lyx)
767          AC_PATH_TOOL([MRP_INKSCAPE], inkscape)
768          AC_PATH_TOOL([MRP_PYTHON], python)
769          AC_PATH_TOOL([MRP_TOUCH], touch)
770          AC_PATH_TOOL([MRP_DBLATEX], dblatex)
771          AC_PATH_TOOL([MRP_XMLTO], xmlto)
772
773          AS_IF( [ test x$MRP_DOXYGEN = x -o x$MRP_LYX = x -o \
774                        x$MRP_INKSCAPE = x -o x$MRP_PYTHON = x -o \
775                        x$MRP_TOUCH = x],
776                 [ has_doc_tools="no";
777                   AC_MSG_WARN([Some essential doc-tool is missing]) ],
778                 [ has_doc_tools="yes";
779                   MRP_DOCINIT() ]
780          ) ]
781 )
782
783 AS_IF( [ test x$has_doc_tools == "xno" -o x$MRP_DBLATEX = x ],
784        [ can_make_pdfs="no";
785          AC_WARN([No PDF documentation will be generated]) ],
786        [ can_make_pdfs="yes"]
787 )
788
789 AS_IF([ test x$has_doc_tools == "xno" -o x$MRP_XMLTO = x ],
790       [ can_make_html="no";
791         AC_WARN([No HTML documentation will be generated]) ],
792       [ can_make_html="yes" ]
793 )
794
795
796 AM_CONDITIONAL(BUILD_DOCUMENTATION,  [ test x$has_doc_tools = "xyes" ])
797 AM_CONDITIONAL(BUILD_PDF_DOCUMENTS,  [ test x$can_make_pdfs = "xyes" ])
798 AM_CONDITIONAL(BUILD_HTML_DOCUMENTS, [ test x$can_make_html = "xyes" ])
799
800 AC_SUBST(MRP_DOCDIR, [`pwd`/doc])
801 AC_SUBST(MRP_FIGDIR, [$MRP_DOCDIR/common/figures])
802 AC_SUBST(MRP_MAKE_DOCRULES, [$MRP_DOCDIR/Makefile.rules])
803 AC_SUBST(MRP_DOCSCRIPT_DIR, [$MRP_DOCDIR/scripts])
804 AC_SUBST(MRP_ABNF, [$MRP_DOCSCRIPT_DIR/abnf.py])
805 AC_SUBST(MRP_DBLYXFIX, [$MRP_DOCSCRIPT_DIR/dblyxfix.py])
806 AC_SUBST(MRP_DOXML2DB, [$MRP_DOCSCRIPT_DIR/doxml2db.py])
807 AC_SUBST(MRP_DOXYDEPS, [$MRP_DOCSCRIPT_DIR/doxydeps.py])
808
809
810 # Shave by default.
811 SHAVE_INIT([build-aux], [enable])
812
813 # Create murphy symlink to match domain controller's
814 # placing with how it is installed.
815 if test ! -L murphy/domain-control; then
816     AC_MSG_NOTICE([Symlinking src/plugins/domain-control to src/domain-control...])
817     cd src
818     ln -s plugins/domain-control domain-control
819     cd ..
820 fi
821
822 # Create murphy symlink to src.
823 if test ! -L murphy; then
824     AC_MSG_NOTICE([Symlinking src to murphy...])
825     ln -s src murphy
826 fi
827
828 # Generate output.
829 AC_CONFIG_FILES([build-aux/shave
830                  build-aux/shave-libtool
831                  Makefile
832                  utils/Makefile
833                  src/Makefile
834                  src/common/tests/Makefile
835                  src/core/tests/Makefile
836                  src/core/lua-decision/tests/Makefile
837                  src/daemon/tests/Makefile
838                  src/plugins/tests/Makefile
839                  src/common/murphy-common.pc
840                  src/common/murphy-libdbus.pc
841                  src/common/murphy-dbus-libdbus.pc
842                  src/common/murphy-dbus-sdbus.pc
843                  src/common/murphy-pulse.pc
844                  src/common/murphy-ecore.pc
845                  src/common/murphy-glib.pc
846                  src/common/murphy-qt.pc
847                  src/core/murphy-core.pc
848                  src/core/lua-utils/murphy-lua-utils.pc
849                  src/core/lua-decision/murphy-lua-decision.pc
850                  src/breedline/breedline.pc
851                  src/breedline/breedline-murphy.pc
852                  src/breedline/breedline-glib.pc
853                  src/breedline/tests/Makefile
854                  src/murphy-db/Makefile
855                  src/murphy-db/mdb/Makefile
856                  src/murphy-db/mqi/Makefile
857                  src/murphy-db/mql/Makefile
858                  src/murphy-db/include/Makefile
859                  src/murphy-db/tests/Makefile
860                  src/resolver/murphy-resolver.pc
861                  src/resolver/tests/Makefile
862                  src/plugins/domain-control/murphy-domain-controller.pc
863                  src/plugins/resource-asm/Makefile
864                  doc/Makefile
865                  doc/plugin-developer-guide/Makefile
866                  doc/plugin-developer-guide/db/Makefile
867                  doc/plugin-developer-guide/doxml/Makefile
868                  src/plugins/resource-native/libmurphy-resource/murphy-resource.pc
869                  packaging.in/org.Murphy.conf
870                  ])
871 AC_OUTPUT
872
873
874 # Display the configuration.
875 echo "----- configuration -----"
876 echo "Extra C warnings flags: $WARNING_CFLAGS"
877 echo "Cross-compiling: $cross_compiling"
878 if test "$cross_compiling" != "no"; then
879     echo "     * native compiler: $UNSHAVED_CC_FOR_BUILD"
880 fi
881 echo "Lua (pkgconfig file) to use: $with_lua"
882 echo "    * cflags: $LUA_CFLAGS"
883 echo "    * libs: $LUA_LIBS"
884 echo "D-Bus (libdbus) support: $enable_libdbus"
885 echo "D-Bus (systemd-bus) support: $enable_sdbus"
886 echo "PulseAudio mainloop support: $enable_pulse"
887 echo "EFL/ecore mainloop support: $enable_ecore"
888 echo "glib mainloop support: $enable_glib"
889 echo "Qt mainloop support: $enable_qt"
890 echo "Murphy console plugin and client: $enable_console"
891 echo "Resource management support: $with_resources"
892 echo "Websockets support: $enable_websockets"
893 echo "systemd support: $enable_systemd"
894 echo "Telephony support: $enable_telephony"
895 echo "System controller support: $enable_systemctl"
896 echo "System monitor support: $enable_sysmon"
897 echo "Plugins:"
898 echo "  - linked-in:"
899 for plugin in ${INTERNAL_PLUGINS:-none}; do
900     echo "      $plugin"
901 done
902 echo "  - dynamic:"
903 for plugin in ${EXTERNAL_PLUGINS:-none}; do
904     echo "      $plugin"
905 done
906 echo "  - disabled:"
907 for plugin in ${DISABLED_PLUGINS:-none}; do
908     echo "      $plugin"
909 done