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