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_MACRO_DIR([m4])
12 AC_CONFIG_SRCDIR([src])
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.
46 # Don't require ctags (we keep linker scripts and debug files in the repo now).
47 #AC_CHECK_PROG(CTAGS, ctags, "ctags")
48 #if test "$CTAGS" != "ctags" ; then
49 # AC_MSG_ERROR([ctags is required])
52 if test "$LEX" != "flex" ; then
53 AC_MSG_ERROR([flex is required])
56 if test "$YACC" != "bison -y" ; then
57 AC_MSG_ERROR([bison is required])
60 # Checks for libraries.
61 AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
63 # Checks for header files.
65 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
67 # Checks for typedefs, structures, and compiler characteristics.
77 AC_CHECK_MEMBERS([struct stat.st_rdev])
82 AC_CHECK_TYPES([ptrdiff_t])
84 # Checks for library functions.
89 AC_CHECK_FUNCS([clock_gettime memmove memset regcomp strcasecmp strchr strdup strrchr strtol strtoul])
91 # Check and enable extra compiler warnings if they are supported.
92 AC_ARG_ENABLE(extra-warnings,
93 [ --enable-extra-warnings enable extra compiler warnings],
94 [extra_warnings=$enableval], [extra_warnings=auto])
97 warncflags="-Wall -Wextra"
98 if test "$extra_warnings" != "no"; then
99 save_CPPFLAGS="$CPPFLAGS"
100 for opt in $warncflags; do
101 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
102 [WARNING_CFLAGS="$WARNING_CFLAGS $opt"])
104 CPPFLAGS="$save_CPPFLAGS"
107 AC_SUBST(WARNING_CFLAGS)
110 PKG_CHECK_MODULES(LUA, lua >= 5.1.1)
114 # Check if potentially GPL bits are allowed to be enabled.
116 [ --enable-gpl enable linking against GPL code],
117 [enable_gpl=$enableval], [enable_gpl=no])
119 # Check if DBUS was enabled.
121 [ --enable-dbus enable D-BUS support],
122 [enable_dbus=$enableval], [enable_dbus=no])
124 if test "$enable_dbus" = "yes"; then
125 if test "$enable_gpl" = "no"; then
126 AC_MSG_ERROR([D-Bus support requires the --enable-gpl option.])
128 PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.70)
130 DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
131 AC_SUBST(DBUS_SESSION_DIR)
133 AC_MSG_NOTICE([D-Bus support is disabled.])
136 if test "$enable_dbus" = "yes"; then
137 AC_DEFINE([DBUS_ENABLED], 1, [Enable D-BUS support ?])
140 AM_CONDITIONAL(DBUS_ENABLED, [test "$enable_dbus" = "yes"])
141 AC_SUBST(DBUS_ENABLED)
142 AC_SUBST(DBUS_CFLAGS)
145 # Check if PulseAudio mainloop support was enabled.
147 [ --enable-pulse enable PulseAudio mainloop support],
148 [enable_pulse=$enableval], [enable_pulse=auto])
150 if test "$enable_pulse" != "no"; then
151 PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.22,
152 [have_pulse=yes], [have_pulse=no])
153 if test "$have_pulse" = "no" -a "$enable_pulse" = "yes"; then
154 AC_MSG_ERROR([PulseAudio development libraries not found.])
157 if test "$enable_gpl" = "no"; then
158 if test "$enable_pulse" = "yes"; then
159 AC_MSG_ERROR([PulseAudio support requires the --enable-gpl option.])
164 enable_pulse="$have_pulse"
167 AC_MSG_NOTICE([PulseAudio mainloop support is disabled.])
170 if test "$enable_pulse" = "yes"; then
171 AC_DEFINE([PULSE_ENABLED], 1, [Enable PulseAudio mainloop support ?])
173 AM_CONDITIONAL(PULSE_ENABLED, [test "$enable_pulse" = "yes"])
174 AC_SUBST(PULSE_ENABLED)
175 AC_SUBST(PULSE_CFLAGS)
178 # Check if EFL/ecore mainloop support was enabled.
180 [ --enable-ecore enable EFL/ecore mainloop support],
181 [enable_ecore=$enableval], [enable_ecore=auto])
183 if test "$enable_ecore" != "no"; then
184 PKG_CHECK_MODULES(ECORE, ecore,
185 [have_ecore=yes], [have_ecore=no])
186 if test "$have_ecore" = "no" -a "$enable_ecore" = "yes"; then
187 AC_MSG_ERROR([EFL/ecore development libraries not found.])
190 enable_ecore="$have_ecore"
192 AC_MSG_NOTICE([EFL/ecore mainloop support is disabled.])
195 if test "$enable_ecore" = "yes"; then
196 AC_DEFINE([ECORE_ENABLED], 1, [Enable EFL/ecore mainloop support ?])
198 AM_CONDITIONAL(ECORE_ENABLED, [test "$enable_ecore" = "yes"])
199 AC_SUBST(ECORE_ENABLED)
200 AC_SUBST(ECORE_CFLAGS)
203 # Check if glib mainloop support was enabled.
205 [ --enable-glib enable glib mainloop support],
206 [enable_glib=$enableval], [enable_glib=auto])
208 if test "$enable_glib" != "no"; then
209 PKG_CHECK_MODULES(GLIB, glib-2.0,
210 [have_glib=yes], [have_glib=no])
211 if test "$have_glib" = "no" -a "$enable_glib" = "yes"; then
212 AC_MSG_ERROR([glib development libraries not found.])
215 enable_glib="$have_glib"
217 AC_MSG_NOTICE([glib mainloop support is disabled.])
220 if test "$enable_glib" = "yes"; then
221 AC_DEFINE([GLIB_ENABLED], 1, [Enable glib mainloop support ?])
223 AM_CONDITIONAL(GLIB_ENABLED, [test "$enable_glib" = "yes"])
224 AC_SUBST(GLIB_ENABLED)
225 AC_SUBST(GLIB_CFLAGS)
228 # Check if building murphy-console was enabled.
229 AC_ARG_ENABLE(console,
230 [ --enable-console build Murphy console],
231 [enable_console=$enableval], [enable_console=auto])
233 if test "$enable_console" != "no"; then
234 AC_HAVE_LIBRARY([readline], [have_readline=yes], [have_readline=no])
235 if test "$have_readline" = "no" -a "$enable_console" = "yes"; then
236 AC_MSG_ERROR([Readline development libraries not found.])
239 if test "$enable_gpl" = "no"; then
240 if test "$enable_console" = "yes"; then
241 AC_MSG_ERROR([Console support requires the --enable-gpl option.])
246 enable_console="$have_readline"
249 AC_MSG_NOTICE([Murphy console binary is disabled.])
252 if test "$enable_console" = "yes"; then
253 AC_DEFINE([CONSOLE_ENABLED], 1, [Build Murphy console ?])
255 READLINE_LIBS="-lreadline"
257 AM_CONDITIONAL(CONSOLE_ENABLED, [test "$enable_console" = "yes"])
258 AC_SUBST(CONSOLE_ENABLED)
259 AC_SUBST(READLINE_CFLAGS)
260 AC_SUBST(READLINE_LIBS)
262 # Set up murphy CFLAGS and LIBS.
265 AC_SUBST(MURPHY_CFLAGS)
266 AC_SUBST(MURPHY_LIBS)
268 # Add LIBDIR to config.h.
269 AC_MSG_CHECKING([libdir])
270 AC_MSG_RESULT([$libdir])
271 AC_SUBST(LIBDIR, [$libdir])
273 #Check whether we build resources or not
274 AC_ARG_WITH(resources,
275 [ --with-resources wheter to build resource management support],
276 [with_resources=$withval],[with_resources=yes])
278 AM_CONDITIONAL(BUILD_RESOURCES, [ test x$with_resources = "xyes" ])
281 # Check which plugins should be disabled.
282 AC_ARG_WITH(disabled-plugins,
283 [ --with-disabled-plugins=<plugin-list> specify which plugins to disable],
284 [disabled_plugins=$withval],[disabled_plugins=none])
286 # Check which plugins should be compiled as standalone DSOs.
287 AC_ARG_WITH(dynamic-plugins,
288 [ --with-dynamic-plugins=<plugin-list> specify which plugins compile as DSOs],
289 [dynamic_plugins=$withval],[dynamic_plugins=none])
291 all_plugins=$(find src/plugins/. -name plugin-*.c 2>/dev/null | \
292 sed 's#^.*/plugin-##g;s#\.c$##g' | tr '\n' ' ')
294 #echo "all plugins: [$all_plugins]"
296 case $dynamic_plugins in
297 all) dynamic_plugins="$all_plugins";;
298 none) dynamic_plugins="";;
304 for plugin in $all_plugins; do
307 for p in ${dynamic_plugins//,/ }; do
308 if test "$plugin" = "$p"; then
313 for p in ${disabled_plugins//,/ }; do
314 if test "$plugin" = "$p"; then
320 internal) internal="$internal$it$plugin"; it=" ";;
321 external) external="$external$et$plugin"; et=" ";;
322 disabled) disabled="$disabled$dt$plugin"; dt=" ";;
326 DISABLED_PLUGINS="$disabled"
327 INTERNAL_PLUGINS="$internal"
328 EXTERNAL_PLUGINS="$external"
331 function check_if_disabled() {
332 for p in $DISABLED_PLUGINS; do
333 if test "$1" = "$p"; then
341 function check_if_internal() {
342 for p in $INTERNAL_PLUGINS; do
343 if test "$1" = "$p"; then
351 AM_CONDITIONAL(DISABLED_PLUGIN_TEST, [check_if_disabled test])
352 AM_CONDITIONAL(DISABLED_PLUGIN_DBUS, [check_if_disabled dbus])
353 AM_CONDITIONAL(DISABLED_PLUGIN_GLIB, [check_if_disabled glib])
354 AM_CONDITIONAL(DISABLED_PLUGIN_CONSOLE, [check_if_disabled console])
355 AM_CONDITIONAL(DISABLED_PLUGIN_SIGNALLING, [check_if_disabled signalling])
356 AM_CONDITIONAL(DISABLED_PLUGIN_RESOURCE_DBUS, [check_if_disabled resource-dbus])
357 AM_CONDITIONAL(DISABLED_PLUGIN_DOMAIN_CONTROL,
358 [check_if_disabled domain-control])
360 AM_CONDITIONAL(BUILTIN_PLUGIN_TEST, [check_if_internal test])
361 AM_CONDITIONAL(BUILTIN_PLUGIN_DBUS, [check_if_internal dbus])
362 AM_CONDITIONAL(BUILTIN_PLUGIN_GLIB, [check_if_internal glib])
363 AM_CONDITIONAL(BUILTIN_PLUGIN_CONSOLE, [check_if_internal console])
364 AM_CONDITIONAL(BUILTIN_PLUGIN_SIGNALLING, [check_if_internal signalling])
365 AM_CONDITIONAL(BUILTIN_PLUGIN_RESOURCE_DBUS, [check_if_internal resource-dbus])
366 AM_CONDITIONAL(BUILTIN_PLUGIN_DOMAIN_CONTROL,
367 [check_if_internal domain-control])
368 AM_CONDITIONAL(BUILTIN_PLUGIN_LUA, [check_if_internal lua])
370 # Check for Check (unit test framework).
371 PKG_CHECK_MODULES(CHECK,
373 [has_check="yes"], [has_check="no"])
374 AM_CONDITIONAL(HAVE_CHECK, test "x$has_check" = "xyes")
376 AC_SUBST(CHECK_CFLAGS)
379 if test "x$has_check" = "xno"; then
380 AC_MSG_WARN([Check framework not found, unit tests are DISABLED.])
383 # Check for documentation tools
384 AC_ARG_WITH([documentation],
385 [AS_HELP_STRING([--with-documentation],
386 [generate pdf, html and other doc files])],
388 [with_documentation=auto]
391 AS_IF( [ test x$with_documentation = xno ],
392 [ has_doc_tools="no" ],
393 [ AC_PATH_TOOL([MRP_DOXYGEN], doxygen)
394 AC_PATH_TOOL([MRP_LYX], lyx)
395 AC_PATH_TOOL([MRP_INKSCAPE], inkscape)
396 AC_PATH_TOOL([MRP_PYTHON], python)
397 AC_PATH_TOOL([MRP_TOUCH], touch)
398 AC_PATH_TOOL([MRP_DBLATEX], dblatex)
399 AC_PATH_TOOL([MRP_XMLTO], xmlto)
401 AS_IF( [ test x$MRP_DOXYGEN = x -o x$MRP_LYX = x -o \
402 x$MRP_INKSCAPE = x -o x$MRP_PYTHON = x -o \
404 [ has_doc_tools="no";
405 AC_MSG_WARN([Some essential doc-tool is missing]) ],
406 [ has_doc_tools="yes";
411 AS_IF( [ test x$has_doc_tools == "xno" -o x$MRP_DBLATEX = x ],
412 [ can_make_pdfs="no";
413 AC_WARN([No PDF documentation will be generated]) ],
414 [ can_make_pdfs="yes"]
417 AS_IF([ test x$has_doc_tools == "xno" -o x$MRP_XMLTO = x ],
418 [ can_make_html="no";
419 AC_WARN([No HTML documentation will be generated]) ],
420 [ can_make_html="yes" ]
424 AM_CONDITIONAL(BUILD_DOCUMENTATION, [ test x$has_doc_tools = "xyes" ])
425 AM_CONDITIONAL(BUILD_PDF_DOCUMENTS, [ test x$can_make_pdfs = "xyes" ])
426 AM_CONDITIONAL(BUILD_HTML_DOCUMENTS, [ test x$can_make_html = "xyes" ])
428 AC_SUBST(MRP_DOCDIR, [`pwd`/doc])
429 AC_SUBST(MRP_FIGDIR, [$MRP_DOCDIR/common/figures])
430 AC_SUBST(MRP_MAKE_DOCRULES, [$MRP_DOCDIR/Makefile.rules])
431 AC_SUBST(MRP_DOCSCRIPT_DIR, [$MRP_DOCDIR/scripts])
432 AC_SUBST(MRP_ABNF, [$MRP_DOCSCRIPT_DIR/abnf.py])
433 AC_SUBST(MRP_DBLYXFIX, [$MRP_DOCSCRIPT_DIR/dblyxfix.py])
434 AC_SUBST(MRP_DOXML2DB, [$MRP_DOCSCRIPT_DIR/doxml2db.py])
435 AC_SUBST(MRP_DOXYDEPS, [$MRP_DOCSCRIPT_DIR/doxydeps.py])
439 SHAVE_INIT([build-aux], [enable])
441 # Create murphy symlink to src.
442 if test ! -L murphy; then
443 AC_MSG_NOTICE([Symlinking src to murphy...])
448 AC_CONFIG_FILES([build-aux/shave
449 build-aux/shave-libtool
452 src/common/tests/Makefile
453 src/core/tests/Makefile
454 src/core/lua-decision/tests/Makefile
455 src/daemon/tests/Makefile
456 src/plugins/tests/Makefile
457 src/common/murphy-common.pc
458 src/common/murphy-dbus.pc
459 src/common/murphy-pulse.pc
460 src/common/murphy-ecore.pc
461 src/common/murphy-glib.pc
462 src/core/murphy-core.pc
463 src/core/lua-utils/murphy-lua-utils.pc
464 src/core/lua-decision/murphy-lua-decision.pc
465 src/murphy-db/Makefile
466 src/murphy-db/mdb/Makefile
467 src/murphy-db/mqi/Makefile
468 src/murphy-db/mql/Makefile
469 src/murphy-db/include/Makefile
470 src/murphy-db/tests/Makefile
471 src/resolver/murphy-resolver.pc
472 src/resolver/tests/Makefile
473 src/resource/murphy-resource.pc
475 doc/plugin-developer-guide/Makefile
476 doc/plugin-developer-guide/db/Makefile
477 doc/plugin-developer-guide/doxml/Makefile
482 # Display the configuration.
483 echo "----- configuration -----"
484 echo "Extra C warnings flags: $WARNING_CFLAGS"
485 echo "D-Bus support: $enable_dbus"
486 echo "PulseAudio mainloop support: $enable_pulse"
487 echo "EFL/ecore mainloop support: $enable_ecore"
488 echo "glib mainloop support: $enable_glib"
489 echo "Murphy console plugin and client: $enable_console"
490 echo "Resource management support: $with_resources"
493 for plugin in ${INTERNAL_PLUGINS:-none}; do
497 for plugin in ${EXTERNAL_PLUGINS:-none}; do
501 for plugin in ${DISABLED_PLUGINS:-none}; do