3 # Process this file with autoconf to produce a configure script.
8 m4_esyscmd([build-aux/git-version-gen .tarball-version]),
9 [krisztian.litkey at intel.com])
11 AC_CONFIG_SRCDIR([src])
12 AC_CONFIG_MACRO_DIR([m4])
13 AC_CONFIG_HEADER([src/config.h])
14 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
16 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
18 m4_define(version_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
19 m4_define(version_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
20 m4_define(version_patch, `echo $VERSION | cut -d. -f3 | cut -d- -f1`)
23 AC_SUBST(VERSION_MAJOR, version_major)
24 AC_SUBST(VERSION_MINOR, version_minor)
25 AC_SUBST(VERSION_PATCH, version_patch)
26 AC_SUBST(VERSION_FULL, version_major.version_minor.version_patch)
28 MURPHY_VERSION_INFO="0:0:0"
29 AC_SUBST(MURPHY_VERSION_INFO)
31 # Disable static libraries.
34 # Checks for programs.
37 # We need AC_PROG_CXX if Qt support is enabled but (at least some
38 # versions of autotools) cannot handle conditional use of this.
49 # Don't require ctags (we keep linker scripts and debug files in the repo now).
50 #AC_CHECK_PROG(CTAGS, ctags, "ctags")
51 #if test "$CTAGS" != "ctags" ; then
52 # AC_MSG_ERROR([ctags is required])
55 if test "$LEX" != "flex" ; then
56 AC_MSG_ERROR([flex is required])
59 if test "$YACC" != "bison -y" ; then
60 AC_MSG_ERROR([bison is required])
63 # Checks for libraries.
64 AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
66 # Checks for header files.
68 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
70 # Checks for typedefs, structures, and compiler characteristics.
80 AC_CHECK_MEMBERS([struct stat.st_rdev])
85 AC_CHECK_TYPES([ptrdiff_t])
87 # Checks for library functions.
92 AC_CHECK_FUNCS([clock_gettime memmove memset regcomp strcasecmp strchr strdup strrchr strtol strtoul])
94 # Check and enable extra compiler warnings if they are supported.
95 AC_ARG_ENABLE(extra-warnings,
96 [ --enable-extra-warnings enable extra compiler warnings],
97 [extra_warnings=$enableval], [extra_warnings=auto])
100 warncflags="-Wall -Wextra"
101 if test "$extra_warnings" != "no"; then
102 save_CPPFLAGS="$CPPFLAGS"
103 for opt in $warncflags; do
104 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
105 [WARNING_CFLAGS="$WARNING_CFLAGS $opt"])
107 CPPFLAGS="$save_CPPFLAGS"
110 AC_SUBST(WARNING_CFLAGS)
113 PKG_CHECK_MODULES(LUA, lua >= 5.1.1, [try_lua51=no], [try_lua51=yes])
115 # At least Ubuntu packages lua 5.1 as lua5.1... try that if needed.
116 if test "$try_lua51" = "yes"; then
117 PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1.1)
122 # Check if potentially GPL bits are allowed to be enabled.
124 [ --enable-gpl enable linking against GPL code],
125 [enable_gpl=$enableval], [enable_gpl=no])
127 # Check if DBUS was enabled.
129 [ --enable-dbus enable D-BUS support],
130 [enable_dbus=$enableval], [enable_dbus=no])
132 if test "$enable_dbus" = "yes"; then
133 if test "$enable_gpl" = "no"; then
134 AC_MSG_ERROR([D-Bus support requires the --enable-gpl option.])
136 PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.70)
138 DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
139 AC_SUBST(DBUS_SESSION_DIR)
141 AC_MSG_NOTICE([D-Bus support is disabled.])
144 if test "$enable_dbus" = "yes"; then
145 AC_DEFINE([DBUS_ENABLED], 1, [Enable D-BUS support ?])
148 AM_CONDITIONAL(DBUS_ENABLED, [test "$enable_dbus" = "yes"])
149 AC_SUBST(DBUS_ENABLED)
150 AC_SUBST(DBUS_CFLAGS)
153 # Check if PulseAudio mainloop support was enabled.
155 [ --enable-pulse enable PulseAudio mainloop support],
156 [enable_pulse=$enableval], [enable_pulse=auto])
158 if test "$enable_pulse" != "no"; then
159 PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.22,
160 [have_pulse=yes], [have_pulse=no])
161 if test "$have_pulse" = "no" -a "$enable_pulse" = "yes"; then
162 AC_MSG_ERROR([PulseAudio development libraries not found.])
165 if test "$enable_gpl" = "no"; then
166 if test "$enable_pulse" = "yes"; then
167 AC_MSG_ERROR([PulseAudio support requires the --enable-gpl option.])
172 enable_pulse="$have_pulse"
175 AC_MSG_NOTICE([PulseAudio mainloop support is disabled.])
178 if test "$enable_pulse" = "yes"; then
179 AC_DEFINE([PULSE_ENABLED], 1, [Enable PulseAudio mainloop support ?])
181 AM_CONDITIONAL(PULSE_ENABLED, [test "$enable_pulse" = "yes"])
182 AC_SUBST(PULSE_ENABLED)
183 AC_SUBST(PULSE_CFLAGS)
186 # Check if EFL/ecore mainloop support was enabled.
188 [ --enable-ecore enable EFL/ecore mainloop support],
189 [enable_ecore=$enableval], [enable_ecore=auto])
192 if test "$enable_ecore" != "no"; then
193 # We are using features which are present only at ecore 1.2 onwards.
194 PKG_CHECK_MODULES(ECORE, ecore >= 1.2,
195 [have_ecore=yes], [have_ecore=no])
196 if test "$have_ecore" = "no" -a "$enable_ecore" = "yes"; then
197 AC_MSG_ERROR([EFL/ecore development libraries not found.])
200 enable_ecore="$have_ecore"
202 AC_MSG_NOTICE([EFL/ecore mainloop support is disabled.])
205 if test "$enable_ecore" = "yes"; then
206 AC_DEFINE([ECORE_ENABLED], 1, [Enable EFL/ecore mainloop support ?])
208 AM_CONDITIONAL(ECORE_ENABLED, [test "$enable_ecore" = "yes"])
209 AC_SUBST(ECORE_ENABLED)
210 AC_SUBST(ECORE_CFLAGS)
213 # Check if glib mainloop support was enabled.
215 [ --enable-glib enable glib mainloop support],
216 [enable_glib=$enableval], [enable_glib=auto])
218 if test "$enable_glib" != "no"; then
219 PKG_CHECK_MODULES(GLIB, glib-2.0,
220 [have_glib=yes], [have_glib=no])
221 if test "$have_glib" = "no" -a "$enable_glib" = "yes"; then
222 AC_MSG_ERROR([glib development libraries not found.])
225 enable_glib="$have_glib"
227 AC_MSG_NOTICE([glib mainloop support is disabled.])
230 if test "$enable_glib" = "yes"; then
231 AC_DEFINE([GLIB_ENABLED], 1, [Enable glib mainloop support ?])
233 AM_CONDITIONAL(GLIB_ENABLED, [test "$enable_glib" = "yes"])
234 AC_SUBST(GLIB_ENABLED)
235 AC_SUBST(GLIB_CFLAGS)
238 # Check if qt mainloop support was enabled.
240 [ --enable-qt enable qt mainloop support],
241 [enable_qt=$enableval], [enable_qt=auto])
243 if test "$enable_qt" != "no"; then
244 PKG_CHECK_MODULES(QTCORE, QtCore,
245 [have_qt=yes], [have_qt=no])
246 if test "$have_qt" = "no" -a "$enable_qt" = "yes"; then
247 AC_MSG_ERROR([Qt(Core) development libraries not found.])
252 AC_MSG_NOTICE([Qt mainloop support is disabled.])
255 if test "$enable_qt" = "yes"; then
256 AC_DEFINE([QT_ENABLED], 1, [Enable qt mainloop support ?])
257 QT_MOC="`pkg-config --variable moc_location QtCore`"
260 AM_CONDITIONAL(QT_ENABLED, [test "$enable_qt" = "yes"])
262 AC_SUBST(QTCORE_CFLAGS)
263 AC_SUBST(QTCORE_LIBS)
265 # Check if building murphy-console was enabled.
266 AC_ARG_ENABLE(console,
267 [ --enable-console build Murphy console],
268 [enable_console=$enableval], [enable_console=yes])
270 if test "$enable_console" = "no"; then
271 AC_MSG_NOTICE([Murphy console binary is disabled.])
273 AC_MSG_NOTICE([Murphy console binary is enabled.])
276 if test "$enable_console" = "yes"; then
277 AC_DEFINE([CONSOLE_ENABLED], 1, [Build Murphy console ?])
279 AM_CONDITIONAL(CONSOLE_ENABLED, [test "$enable_console" = "yes"])
280 AC_SUBST(CONSOLE_ENABLED)
281 AC_SUBST(READLINE_CFLAGS)
282 AC_SUBST(READLINE_LIBS)
284 # Check for json(-c).
285 PKG_CHECK_MODULES(JSON, [json], [have_json=yes], [have_json=no])
287 if test "$have_json" = "no"; then
288 PKG_CHECK_MODULES(JSON, [json-c >= 0.11])
291 AC_MSG_CHECKING([for json_tokener_get_error()])
292 saved_CFLAGS="$CFLAGS"
294 CFLAGS="${JSON_CFLAGS}"
298 [[#include <json.h>]],
299 [[json_tokener *tok = NULL;
300 if (json_tokener_get_error(tok) != json_tokener_success)
304 [have_json_tokener_get_error=yes],
305 [have_json_tokener_get_error=no])
306 AC_MSG_RESULT([$have_json_tokener_get_error])
307 CFLAGS="$saved_CFLAGS"
310 if test "$have_json_tokener_get_error" = "yes"; then
311 AC_DEFINE([HAVE_JSON_TOKENER_GET_ERROR], 1, [json_tokener_get_error ?])
314 # Check if websocket support was/can be enabled.
317 # Check if SMACK support should be enabled.
319 [ --enable-smack enable SMACK support],
320 [enable_smack=$enableval], [enable_smack=auto])
322 if test "$enable_smack" != "no"; then
323 PKG_CHECK_MODULES(SMACK, libsmack, [have_smack=yes], [have_smack=no])
324 if test "$have_smack" = "no" -a "$enable_smack" = "yes"; then
325 AC_MSG_ERROR([SMACK development libraries not found.])
328 enable_smack="$have_smack"
330 AC_MSG_NOTICE([SMACK support is disabled.])
333 if test "$enable_smack" = "yes"; then
334 AC_DEFINE([SMACK_ENABLED], 1, [Enable SMACK support ?])
336 AM_CONDITIONAL(SMACK_ENABLED, [test "$enable_smack" = "yes"])
337 AC_SUBST(SMACK_ENABLED)
338 AC_SUBST(SMACK_CFLAGS)
341 # Check if systemd support should be enabled.
342 AC_ARG_ENABLE(systemd,
343 [ --enable-systmed enable systemd support],
344 [enable_systemd=$enableval], [enable_systemd=auto])
346 if test "$enable_systemd" != "no"; then
347 PKG_CHECK_MODULES(SYSTEMD, libsystemd-journal libsystemd-daemon,
348 [have_systemd=yes], [have_systemd=no])
349 if test "$have_systemd" = "no" -a "$enable_systemd" = "yes"; then
350 AC_MSG_ERROR([systemd development libraries not found.])
353 enable_systemd="$have_systemd"
355 AC_MSG_NOTICE([systemd support is disabled.])
358 if test "$enable_systemd" = "yes"; then
359 AC_DEFINE([SYSTEMD_ENABLED], 1, [Enable systemd support ?])
361 AM_CONDITIONAL(SYSTEMD_ENABLED, [test "$enable_systemd" = "yes"])
362 AC_SUBST(SYSTEMD_ENABLED)
363 AC_SUBST(SYSTEMD_CFLAGS)
364 AC_SUBST(SYSTEMD_LIBS)
366 # Set up murphy CFLAGS and LIBS.
369 AC_SUBST(MURPHY_CFLAGS)
370 AC_SUBST(MURPHY_LIBS)
372 # Add LIBDIR to config.h.
373 AC_MSG_CHECKING([libdir])
374 AC_MSG_RESULT([$libdir])
375 AC_SUBST(LIBDIR, [$libdir])
377 #Check whether we build resources or not
378 AC_ARG_WITH(resources,
379 [ --with-resources wheter to build resource management support],
380 [with_resources=$withval],[with_resources=yes])
382 AM_CONDITIONAL(BUILD_RESOURCES, [ test x$with_resources = "xyes" ])
385 # Check which plugins should be disabled.
386 AC_ARG_WITH(disabled-plugins,
387 [ --with-disabled-plugins=<plugin-list> specify which plugins to disable],
388 [disabled_plugins=$withval],[disabled_plugins=none])
390 # Check which plugins should be compiled as standalone DSOs.
391 AC_ARG_WITH(dynamic-plugins,
392 [ --with-dynamic-plugins=<plugin-list> specify which plugins compile as DSOs],
393 [dynamic_plugins=$withval],[dynamic_plugins=none])
395 all_plugins=$(find src/plugins/. -name plugin-*.c 2>/dev/null | \
396 sed 's#^.*/plugin-##g;s#\.c$##g' | tr '\n' ' ')
398 #echo "all plugins: [$all_plugins]"
400 case $dynamic_plugins in
401 all) dynamic_plugins="$all_plugins";;
402 none) dynamic_plugins="";;
408 for plugin in $all_plugins; do
411 for p in ${dynamic_plugins//,/ }; do
412 if test "$plugin" = "$p"; then
417 for p in ${disabled_plugins//,/ }; do
418 if test "$plugin" = "$p"; then
424 internal) internal="$internal$it$plugin"; it=" ";;
425 external) external="$external$et$plugin"; et=" ";;
426 disabled) disabled="$disabled$dt$plugin"; dt=" ";;
430 DISABLED_PLUGINS="$disabled"
431 INTERNAL_PLUGINS="$internal"
432 EXTERNAL_PLUGINS="$external"
435 function check_if_disabled() {
436 for p in $DISABLED_PLUGINS; do
437 if test "$1" = "$p"; then
445 function check_if_internal() {
446 for p in $INTERNAL_PLUGINS; do
447 if test "$1" = "$p"; then
455 AM_CONDITIONAL(DISABLED_PLUGIN_TEST, [check_if_disabled test])
456 AM_CONDITIONAL(DISABLED_PLUGIN_DBUS, [check_if_disabled dbus])
457 AM_CONDITIONAL(DISABLED_PLUGIN_GLIB, [check_if_disabled glib])
458 AM_CONDITIONAL(DISABLED_PLUGIN_CONSOLE, [check_if_disabled console])
459 AM_CONDITIONAL(DISABLED_PLUGIN_RESOURCE_DBUS, [check_if_disabled resource-dbus])
460 AM_CONDITIONAL(DISABLED_PLUGIN_RESOURCE_WRT, [check_if_disabled resource-wrt])
461 AM_CONDITIONAL(DISABLED_PLUGIN_DOMAIN_CONTROL,
462 [check_if_disabled domain-control])
463 AM_CONDITIONAL(DISABLED_PLUGIN_SYSTEMD, [check_if_disabled systemd])
465 AM_CONDITIONAL(BUILTIN_PLUGIN_TEST, [check_if_internal test])
466 AM_CONDITIONAL(BUILTIN_PLUGIN_DBUS, [check_if_internal dbus])
467 AM_CONDITIONAL(BUILTIN_PLUGIN_GLIB, [check_if_internal glib])
468 AM_CONDITIONAL(BUILTIN_PLUGIN_CONSOLE, [check_if_internal console])
469 AM_CONDITIONAL(BUILTIN_PLUGIN_RESOURCE_DBUS, [check_if_internal resource-dbus])
470 AM_CONDITIONAL(BUILTIN_PLUGIN_RESOURCE_WRT, [check_if_internal resource-wrt])
471 AM_CONDITIONAL(BUILTIN_PLUGIN_DOMAIN_CONTROL,
472 [check_if_internal domain-control])
473 AM_CONDITIONAL(BUILTIN_PLUGIN_LUA, [check_if_internal lua])
474 AM_CONDITIONAL(BUILTIN_PLUGIN_SYSTEMD, [check_if_internal systemd])
476 # Check for Check (unit test framework).
477 PKG_CHECK_MODULES(CHECK,
479 [has_check="yes"], [has_check="no"])
480 AM_CONDITIONAL(HAVE_CHECK, test "x$has_check" = "xyes")
482 AC_SUBST(CHECK_CFLAGS)
485 if test "x$has_check" = "xno"; then
486 AC_MSG_WARN([Check framework not found, unit tests are DISABLED.])
489 # Check for documentation tools
490 AC_ARG_WITH([documentation],
491 [AS_HELP_STRING([--with-documentation],
492 [generate pdf, html and other doc files])],
494 [with_documentation=auto]
497 AS_IF( [ test x$with_documentation = xno ],
498 [ has_doc_tools="no" ],
499 [ AC_PATH_TOOL([MRP_DOXYGEN], doxygen)
500 AC_PATH_TOOL([MRP_LYX], lyx)
501 AC_PATH_TOOL([MRP_INKSCAPE], inkscape)
502 AC_PATH_TOOL([MRP_PYTHON], python)
503 AC_PATH_TOOL([MRP_TOUCH], touch)
504 AC_PATH_TOOL([MRP_DBLATEX], dblatex)
505 AC_PATH_TOOL([MRP_XMLTO], xmlto)
507 AS_IF( [ test x$MRP_DOXYGEN = x -o x$MRP_LYX = x -o \
508 x$MRP_INKSCAPE = x -o x$MRP_PYTHON = x -o \
510 [ has_doc_tools="no";
511 AC_MSG_WARN([Some essential doc-tool is missing]) ],
512 [ has_doc_tools="yes";
517 AS_IF( [ test x$has_doc_tools == "xno" -o x$MRP_DBLATEX = x ],
518 [ can_make_pdfs="no";
519 AC_WARN([No PDF documentation will be generated]) ],
520 [ can_make_pdfs="yes"]
523 AS_IF([ test x$has_doc_tools == "xno" -o x$MRP_XMLTO = x ],
524 [ can_make_html="no";
525 AC_WARN([No HTML documentation will be generated]) ],
526 [ can_make_html="yes" ]
530 AM_CONDITIONAL(BUILD_DOCUMENTATION, [ test x$has_doc_tools = "xyes" ])
531 AM_CONDITIONAL(BUILD_PDF_DOCUMENTS, [ test x$can_make_pdfs = "xyes" ])
532 AM_CONDITIONAL(BUILD_HTML_DOCUMENTS, [ test x$can_make_html = "xyes" ])
534 AC_SUBST(MRP_DOCDIR, [`pwd`/doc])
535 AC_SUBST(MRP_FIGDIR, [$MRP_DOCDIR/common/figures])
536 AC_SUBST(MRP_MAKE_DOCRULES, [$MRP_DOCDIR/Makefile.rules])
537 AC_SUBST(MRP_DOCSCRIPT_DIR, [$MRP_DOCDIR/scripts])
538 AC_SUBST(MRP_ABNF, [$MRP_DOCSCRIPT_DIR/abnf.py])
539 AC_SUBST(MRP_DBLYXFIX, [$MRP_DOCSCRIPT_DIR/dblyxfix.py])
540 AC_SUBST(MRP_DOXML2DB, [$MRP_DOCSCRIPT_DIR/doxml2db.py])
541 AC_SUBST(MRP_DOXYDEPS, [$MRP_DOCSCRIPT_DIR/doxydeps.py])
545 SHAVE_INIT([build-aux], [enable])
547 # Create murphy symlink to src.
548 if test ! -L murphy; then
549 AC_MSG_NOTICE([Symlinking src to murphy...])
554 AC_CONFIG_FILES([build-aux/shave
555 build-aux/shave-libtool
559 src/common/tests/Makefile
560 src/core/tests/Makefile
561 src/core/lua-decision/tests/Makefile
562 src/daemon/tests/Makefile
563 src/plugins/tests/Makefile
564 src/common/murphy-common.pc
565 src/common/murphy-dbus.pc
566 src/common/murphy-pulse.pc
567 src/common/murphy-ecore.pc
568 src/common/murphy-glib.pc
569 src/common/murphy-qt.pc
570 src/core/murphy-core.pc
571 src/core/lua-utils/murphy-lua-utils.pc
572 src/core/lua-decision/murphy-lua-decision.pc
573 src/breedline/breedline.pc
574 src/breedline/breedline-murphy.pc
575 src/breedline/breedline-glib.pc
576 src/breedline/tests/Makefile
577 src/murphy-db/Makefile
578 src/murphy-db/mdb/Makefile
579 src/murphy-db/mqi/Makefile
580 src/murphy-db/mql/Makefile
581 src/murphy-db/include/Makefile
582 src/murphy-db/tests/Makefile
583 src/resolver/murphy-resolver.pc
584 src/resolver/tests/Makefile
585 src/plugins/domain-control/murphy-domain-controller.pc
587 doc/plugin-developer-guide/Makefile
588 doc/plugin-developer-guide/db/Makefile
589 doc/plugin-developer-guide/doxml/Makefile
590 src/plugins/resource-native/libmurphy-resource/murphy-resource.pc
595 # Display the configuration.
596 echo "----- configuration -----"
597 echo "Extra C warnings flags: $WARNING_CFLAGS"
598 echo "D-Bus support: $enable_dbus"
599 echo "PulseAudio mainloop support: $enable_pulse"
600 echo "EFL/ecore mainloop support: $enable_ecore"
601 echo "glib mainloop support: $enable_glib"
602 echo "Qt mainloop support: $enable_qt"
603 echo "Murphy console plugin and client: $enable_console"
604 echo "Resource management support: $with_resources"
605 echo "Websockets support: $enable_websockets"
606 echo "systemd support: $enable_systemd"
609 for plugin in ${INTERNAL_PLUGINS:-none}; do
613 for plugin in ${EXTERNAL_PLUGINS:-none}; do
617 for plugin in ${DISABLED_PLUGINS:-none}; do