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