plugins: removed decision-proto plugin.
[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],
8         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
9         [krisztian.litkey at intel.com])
10
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)
15
16 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
17
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`)
21
22 AC_SUBST(VERSION)
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)
27
28 MURPHY_VERSION_INFO="0:0:0"
29 AC_SUBST(MURPHY_VERSION_INFO)
30
31 # Disable static libraries.
32 AC_DISABLE_STATIC
33
34 # Checks for programs.
35 AC_PROG_CC
36 AC_PROG_CC_C99
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 # 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])
50 #fi
51
52 if test "$LEX" != "flex" ; then
53    AC_MSG_ERROR([flex is required])
54 fi
55
56 if test "$YACC" != "bison -y" ; then
57    AC_MSG_ERROR([bison is required])
58 fi
59
60 # Checks for libraries.
61 AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
62
63 # Checks for header files.
64 AC_PATH_X
65 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
66
67 # Checks for typedefs, structures, and compiler characteristics.
68 AC_HEADER_STDBOOL
69 AC_C_INLINE
70 AC_TYPE_INT16_T
71 AC_TYPE_INT32_T
72 AC_TYPE_INT64_T
73 AC_TYPE_MODE_T
74 AC_TYPE_PID_T
75 AC_TYPE_SIZE_T
76 AC_TYPE_SSIZE_T
77 AC_CHECK_MEMBERS([struct stat.st_rdev])
78 AC_TYPE_UINT16_T
79 AC_TYPE_UINT32_T
80 AC_TYPE_UINT64_T
81 AC_TYPE_UINT8_T
82 AC_CHECK_TYPES([ptrdiff_t])
83
84 # Checks for library functions.
85 AC_FUNC_ERROR_AT_LINE
86 AC_HEADER_MAJOR
87 AC_FUNC_MALLOC
88 AC_FUNC_STRTOD
89 AC_CHECK_FUNCS([clock_gettime memmove memset regcomp strcasecmp strchr strdup strrchr strtol strtoul])
90
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])
95
96 WARNING_CFLAGS=""
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"])
103     done
104     CPPFLAGS="$save_CPPFLAGS"
105 fi
106
107 AC_SUBST(WARNING_CFLAGS)
108
109 # Check if potentially GPL bits are allowed to be enabled.
110 AC_ARG_ENABLE(gpl,
111               [  --enable-gpl            enable linking against GPL code],
112               [enable_gpl=$enableval], [enable_gpl=no])
113
114 # Check if DBUS was enabled.
115 AC_ARG_ENABLE(dbus,
116               [  --enable-dbus           enable D-BUS support],
117               [enable_dbus=$enableval], [enable_dbus=no])
118
119 if test "$enable_dbus" = "yes"; then
120     if test "$enable_gpl" = "no"; then
121         AC_MSG_ERROR([D-Bus support requires the --enable-gpl option.])
122     fi
123     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.70)
124
125     DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
126     AC_SUBST(DBUS_SESSION_DIR)
127 else
128     AC_MSG_NOTICE([D-Bus support is disabled.])
129 fi
130
131 if test "$enable_dbus" = "yes"; then
132     AC_DEFINE([DBUS_ENABLED], 1, [Enable D-BUS support ?])
133 fi
134
135 AM_CONDITIONAL(DBUS_ENABLED, [test "$enable_dbus" = "yes"])
136 AC_SUBST(DBUS_ENABLED)
137 AC_SUBST(DBUS_CFLAGS)
138 AC_SUBST(DBUS_LIBS)
139
140 # Check if PulseAudio mainloop support was enabled.
141 AC_ARG_ENABLE(pulse,
142               [  --enable-pulse          enable PulseAudio mainloop support],
143               [enable_pulse=$enableval], [enable_pulse=auto])
144
145 if test "$enable_pulse" != "no"; then
146     PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.22,
147                              [have_pulse=yes], [have_pulse=no])
148     if test "$have_pulse" = "no" -a "$enable_pulse" != "yes"; then
149         AC_MSG_ERROR([PulseAudio development libraries not found.])
150     fi
151
152     if test "$enable_gpl" = "no"; then
153         if test "$enable_pulse" = "yes"; then
154            AC_MSG_ERROR([PulseAudio support requires the --enable-gpl option.])
155         else
156            enable_pulse="no"
157         fi
158     else
159         enable_pulse="$have_pulse"
160     fi
161 else
162     AC_MSG_NOTICE([PulseAudio mainloop support is disabled.])
163 fi
164
165 if test "$enable_pulse" = "yes"; then
166     AC_DEFINE([PULSE_ENABLED], 1, [Enable PulseAudio mainloop support ?])
167 fi
168 AM_CONDITIONAL(PULSE_ENABLED, [test "$enable_pulse" = "yes"])
169 AC_SUBST(PULSE_ENABLED)
170 AC_SUBST(PULSE_CFLAGS)
171 AC_SUBST(PULSE_LIBS)
172
173 # Check if EFL/ecore mainloop support was enabled.
174 AC_ARG_ENABLE(ecore,
175               [  --enable-ecore          enable EFL/ecore mainloop support],
176               [enable_ecore=$enableval], [enable_ecore=auto])
177
178 if test "$enable_ecore" != "no"; then
179     PKG_CHECK_MODULES(ECORE, ecore,
180                       [have_ecore=yes], [have_ecore=no])
181     if test "$have_ecore" = "no" -a "$enable_ecore" != "yes"; then
182         AC_MSG_ERROR([EFL/ecore development libraries not found.])
183     fi
184
185     enable_ecore="$have_ecore"
186 else
187     AC_MSG_NOTICE([EFL/ecore mainloop support is disabled.])
188 fi
189
190 if test "$enable_ecore" = "yes"; then
191     AC_DEFINE([ECORE_ENABLED], 1, [Enable EFL/ecore mainloop support ?])
192 fi
193 AM_CONDITIONAL(ECORE_ENABLED, [test "$enable_ecore" = "yes"])
194 AC_SUBST(ECORE_ENABLED)
195 AC_SUBST(ECORE_CFLAGS)
196 AC_SUBST(ECORE_LIBS)
197
198 # Check if glib mainloop support was enabled.
199 AC_ARG_ENABLE(glib,
200               [  --enable-glib          enable glib mainloop support],
201               [enable_glib=$enableval], [enable_glib=auto])
202
203 if test "$enable_glib" != "no"; then
204     PKG_CHECK_MODULES(GLIB, glib-2.0,
205                       [have_glib=yes], [have_glib=no])
206     if test "$have_glib" = "no" -a "$enable_glib" != "yes"; then
207         AC_MSG_ERROR([glib development libraries not found.])
208     fi
209
210     enable_glib="$have_glib"
211 else
212     AC_MSG_NOTICE([glib mainloop support is disabled.])
213 fi
214
215 if test "$enable_glib" = "yes"; then
216     AC_DEFINE([GLIB_ENABLED], 1, [Enable glib mainloop support ?])
217 fi
218 AM_CONDITIONAL(GLIB_ENABLED, [test "$enable_glib" = "yes"])
219 AC_SUBST(GLIB_ENABLED)
220 AC_SUBST(GLIB_CFLAGS)
221 AC_SUBST(GLIB_LIBS)
222
223 # Check if building murphy-console was enabled.
224 AC_ARG_ENABLE(console,
225               [  --enable-console        build Murphy console],
226               [enable_console=$enableval], [enable_console=auto])
227
228 if test "$enable_console" != "no"; then
229     AC_HAVE_LIBRARY([readline], [have_readline=yes], [have_readline=no])
230     if test "$have_readline" = "no" -a "$enable_console" = "yes"; then
231         AC_MSG_ERROR([Readline development libraries not found.])
232     fi
233
234     if test "$enable_gpl" = "no"; then
235         if test "$enable_console" = "yes"; then
236            AC_MSG_ERROR([Console support requires the --enable-gpl option.])
237         else
238            enable_console="no"
239         fi
240     else
241         enable_console="$have_readline"
242     fi
243 else
244     AC_MSG_NOTICE([Murphy console binary is disabled.])
245 fi
246
247 if test "$enable_console" = "yes"; then
248     AC_DEFINE([CONSOLE_ENABLED], 1, [Build Murphy console ?])
249     READLINE_CFLAGS=""
250     READLINE_LIBS="-lreadline"
251 fi
252 AM_CONDITIONAL(CONSOLE_ENABLED, [test "$enable_console" = "yes"])
253 AC_SUBST(CONSOLE_ENABLED)
254 AC_SUBST(READLINE_CFLAGS)
255 AC_SUBST(READLINE_LIBS)
256
257 # Set up murphy CFLAGS and LIBS.
258 MURPHY_CFLAGS=""
259 MURPHY_LIBS=""
260 AC_SUBST(MURPHY_CFLAGS)
261 AC_SUBST(MURPHY_LIBS)
262
263 # Add LIBDIR to config.h.
264 AC_MSG_CHECKING([libdir])
265 AC_MSG_RESULT([$libdir])
266 AC_SUBST(LIBDIR, [$libdir])
267
268 # Check which plugins should be disabled.
269 AC_ARG_WITH(disabled-plugins,
270             [  --with-disabled-plugins=<plugin-list> specify which plugins to disable],
271             [disabled_plugins=$withval],[disabled_plugins=none])
272
273 # Check which plugins should be compiled as standalone DSOs.
274 AC_ARG_WITH(dynamic-plugins,
275             [  --with-dynamic-plugins=<plugin-list>  specify which plugins compile as DSOs],
276             [dynamic_plugins=$withval],[dynamic_plugins=none])
277
278 all_plugins=$(find src/plugins/. -name plugin-*.c 2>/dev/null | \
279               sed 's#^.*/plugin-##g;s#\.c$##g' | tr '\n' ' ')
280
281 #echo "all plugins: [$all_plugins]"
282
283 case $dynamic_plugins in
284     all)  dynamic_plugins="$all_plugins";;
285     none) dynamic_plugins="";;
286 esac
287
288 internal=""; it=""
289 external=""; et=""
290 disabled=""; dt=""
291 for plugin in $all_plugins; do 
292     type=internal
293
294     for p in ${dynamic_plugins//,/ }; do
295         if test "$plugin" = "$p"; then
296             type=external
297         fi
298     done
299
300     for p in ${disabled_plugins//,/ }; do
301         if test "$plugin" = "$p"; then
302             type=disabled
303         fi
304     done
305
306     case $type in
307         internal) internal="$internal$it$plugin"; it=" ";;
308         external) external="$external$et$plugin"; et=" ";;
309         disabled) disabled="$disabled$dt$plugin"; dt=" ";;
310     esac
311 done
312
313 DISABLED_PLUGINS="$disabled"
314 INTERNAL_PLUGINS="$internal"
315 EXTERNAL_PLUGINS="$external"
316
317
318 function check_if_disabled() {
319     for p in $DISABLED_PLUGINS; do
320         if test "$1" = "$p"; then
321             return 0
322         fi
323     done
324
325     return 1
326 }
327
328 function check_if_internal() {
329     for p in $INTERNAL_PLUGINS; do
330         if test "$1" = "$p"; then
331             return 0
332         fi
333     done
334
335     return 1
336 }
337
338 AM_CONDITIONAL(DISABLED_PLUGIN_TEST,     [check_if_disabled test])
339 AM_CONDITIONAL(DISABLED_PLUGIN_DBUS,     [check_if_disabled dbus])
340 AM_CONDITIONAL(DISABLED_PLUGIN_GLIB,     [check_if_disabled glib])
341 AM_CONDITIONAL(DISABLED_PLUGIN_CONSOLE,  [check_if_disabled console])
342 AM_CONDITIONAL(DISABLED_PLUGIN_SIGNALLING, [check_if_disabled signalling])
343 AM_CONDITIONAL(DISABLED_PLUGIN_RESOURCE_DBUS, [check_if_disabled resource-dbus])
344 AM_CONDITIONAL(DISABLED_PLUGIN_DOMAIN_CONTROL,
345                [check_if_disabled domain-control])
346
347 AM_CONDITIONAL(BUILTIN_PLUGIN_TEST,     [check_if_internal test])
348 AM_CONDITIONAL(BUILTIN_PLUGIN_DBUS,     [check_if_internal dbus])
349 AM_CONDITIONAL(BUILTIN_PLUGIN_GLIB,     [check_if_internal glib])
350 AM_CONDITIONAL(BUILTIN_PLUGIN_CONSOLE,  [check_if_internal console])
351 AM_CONDITIONAL(BUILTIN_PLUGIN_SIGNALLING, [check_if_internal signalling])
352 AM_CONDITIONAL(BUILTIN_PLUGIN_RESOURCE_DBUS, [check_if_internal resource-dbus])
353 AM_CONDITIONAL(BUILTIN_PLUGIN_DOMAIN_CONTROL,
354                [check_if_internal domain-control])
355
356 # Check for Check (unit test framework).
357 PKG_CHECK_MODULES(CHECK, 
358                   check >= 0.9.4,
359                   [has_check="yes"], [has_check="no"])
360 AM_CONDITIONAL(HAVE_CHECK, test "x$has_check" = "xyes")
361
362 AC_SUBST(CHECK_CFLAGS)
363 AC_SUBST(CHECK_LIBS)
364
365 if test "x$has_check" = "xno"; then
366     AC_MSG_WARN([Check framework not found, unit tests are DISABLED.])
367 fi
368
369 # Check for documentation tools
370 AC_ARG_WITH([documentation],
371             [AS_HELP_STRING([--with-documentation],
372                             [generate pdf, html and other doc files])],
373             [],
374             [with_documentation=auto]
375 )
376
377 AS_IF( [ test x$with_documentation = xno ],
378        [ has_doc_tools="no" ],
379        [ AC_PATH_TOOL([MRP_DOXYGEN], doxygen)
380          AC_PATH_TOOL([MRP_LYX], lyx)
381          AC_PATH_TOOL([MRP_INKSCAPE], inkscape)
382          AC_PATH_TOOL([MRP_PYTHON], python)
383          AC_PATH_TOOL([MRP_TOUCH], touch)
384          AC_PATH_TOOL([MRP_DBLATEX], dblatex)
385          AC_PATH_TOOL([MRP_XMLTO], xmlto)
386
387          AS_IF( [ test x$MRP_DOXYGEN = x -o x$MRP_LYX = x -o \
388                        x$MRP_INKSCAPE = x -o x$MRP_PYTHON = x -o \
389                        x$MRP_TOUCH = x],
390                 [ has_doc_tools="no";
391                   AC_MSG_WARN([Some essential doc-tool is missing]) ],
392                 [ has_doc_tools="yes";
393                   MRP_DOCINIT() ]
394          ) ]
395 )
396
397 AS_IF( [ test x$has_doc_tools == "xno" -o x$MRP_DBLATEX = x ],
398        [ can_make_pdfs="no";
399          AC_WARN([No PDF documentation will be generated]) ],
400        [ can_make_pdfs="yes"]
401 )
402
403 AS_IF([ test x$has_doc_tools == "xno" -o x$MRP_XMLTO = x ],
404       [ can_make_html="no";
405         AC_WARN([No HTML documentation will be generated]) ],
406       [ can_make_html="yes" ]
407 )
408
409
410 AM_CONDITIONAL(BUILD_DOCUMENTATION,  [ test x$has_doc_tools = "xyes" ])
411 AM_CONDITIONAL(BUILD_PDF_DOCUMENTS,  [ test x$can_make_pdfs = "xyes" ])
412 AM_CONDITIONAL(BUILD_HTML_DOCUMENTS, [ test x$can_make_html = "xyes" ])
413
414 AC_SUBST(MRP_DOCDIR, [`pwd`/doc])
415 AC_SUBST(MRP_FIGDIR, [$MRP_DOCDIR/common/figures])
416 AC_SUBST(MRP_MAKE_DOCRULES, [$MRP_DOCDIR/Makefile.rules])
417 AC_SUBST(MRP_DOCSCRIPT_DIR, [$MRP_DOCDIR/scripts])
418 AC_SUBST(MRP_ABNF, [$MRP_DOCSCRIPT_DIR/abnf.py])
419 AC_SUBST(MRP_DBLYXFIX, [$MRP_DOCSCRIPT_DIR/dblyxfix.py])
420 AC_SUBST(MRP_DOXML2DB, [$MRP_DOCSCRIPT_DIR/doxml2db.py])
421 AC_SUBST(MRP_DOXYDEPS, [$MRP_DOCSCRIPT_DIR/doxydeps.py])
422
423
424 # Shave by default.
425 SHAVE_INIT([build-aux], [enable])
426
427 # Create murphy symlink to src.
428 if test ! -L murphy; then
429     AC_MSG_NOTICE([Symlinking src to murphy...])
430     ln -s src murphy
431 fi
432
433 # Generate output.
434 AC_CONFIG_FILES([build-aux/shave
435                  build-aux/shave-libtool
436                  Makefile
437                  src/Makefile
438                  src/common/tests/Makefile
439                  src/core/tests/Makefile
440                  src/daemon/tests/Makefile
441                  src/plugins/tests/Makefile
442                  src/common/murphy-common.pc
443                  src/common/murphy-dbus.pc
444                  src/common/murphy-pulse.pc
445                  src/common/murphy-ecore.pc
446                  src/common/murphy-glib.pc
447                  src/core/murphy-core.pc
448                  src/murphy-db/Makefile
449                  src/murphy-db/mdb/Makefile
450                  src/murphy-db/mqi/Makefile
451                  src/murphy-db/mql/Makefile
452                  src/murphy-db/include/Makefile
453                  src/murphy-db/tests/Makefile
454                  src/resolver/murphy-resolver.pc
455                  src/resolver/tests/Makefile
456                  src/resource/murphy-resource.pc
457                  doc/Makefile
458                  doc/plugin-developer-guide/Makefile
459                  doc/plugin-developer-guide/db/Makefile
460                  doc/plugin-developer-guide/doxml/Makefile
461                  ])
462 AC_OUTPUT
463
464
465 # Display the configuration.
466 echo "----- configuration -----"
467 echo "Extra C warnings flags: $WARNING_CFLAGS"
468 echo "D-Bus support: $enable_dbus"
469 echo "PulseAudio mainloop support: $enable_pulse"
470 echo "EFL/ecore mainloop support: $enable_ecore"
471 echo "glib mainloop support: $enable_glib"
472 echo "Murphy console plugin and client: $enable_console"
473 echo "Plugins:"
474 echo "  - linked-in:"
475 for plugin in ${INTERNAL_PLUGINS:-none}; do
476     echo "      $plugin"
477 done
478 echo "  - dynamic:"
479 for plugin in ${EXTERNAL_PLUGINS:-none}; do
480     echo "      $plugin"
481 done
482 echo "  - disabled:"
483 for plugin in ${DISABLED_PLUGINS:-none}; do
484     echo "      $plugin"
485 done