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.
44 if test "$LEX" != "flex" ; then
45 AC_MSG_ERROR([flex is required])
48 if test "$YACC" != "bison -y" ; then
49 AC_MSG_ERROR([bison is required])
52 # Checks for libraries.
53 AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
55 # Checks for header files.
57 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
59 # Checks for typedefs, structures, and compiler characteristics.
69 AC_CHECK_MEMBERS([struct stat.st_rdev])
74 AC_CHECK_TYPES([ptrdiff_t])
76 # Checks for library functions.
81 AC_CHECK_FUNCS([clock_gettime memmove memset regcomp strcasecmp strchr strdup strrchr strtol strtoul])
84 PKG_CHECK_MODULES(GLIB, glib-2.0)
88 # Check for low-level DBUS libs.
89 PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.70)
93 DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
94 AC_SUBST(DBUS_SESSION_DIR)
97 # Check and enable extra compiler warnings if they are supported.
98 AC_ARG_ENABLE(extra-warnings,
99 [ --enable-extra-warnings enable extra compiler warnings],
100 [extra_warnings=$enableval], [extra_warnings=auto])
103 warncflags="-Wall -Wextra"
104 if test "$extra_warnings" != "no"; then
105 save_CPPFLAGS="$CPPFLAGS"
106 for opt in $warncflags; do
107 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
108 [WARNING_CFLAGS="$WARNING_CFLAGS $opt"])
110 CPPFLAGS="$save_CPPFLAGS"
113 AC_SUBST(WARNING_CFLAGS)
116 # Set up murphy CFLAGS and LIBS.
117 MURPHY_CFLAGS="$GLIB_CFLAGS $DBUS_CFLAGS"
118 MURPHY_LIBS="$GLIB_LIBS $DBUS_LIBS"
119 AC_SUBST(MURPHY_CFLAGS)
120 AC_SUBST(MURPHY_LIBS)
122 # Add LIBDIR to config.h.
123 AC_MSG_CHECKING([libdir])
124 AC_MSG_RESULT([$libdir])
125 AC_SUBST(LIBDIR, [$libdir])
128 # Check which plugins should be built in.
129 AC_ARG_WITH(builtin-plugins,
130 [ --with-builtin-plugins=<plugin-list> specify which plugins to link in],
131 [builtin_plugins=$withval],[builtin_plugins=all])
133 all_plugins=$(ls src/plugins/*.c 2>/dev/null | \
134 sed 's#src/plugins/plugin-##g;s#\.c$##g' | tr '\n' ' ')
136 case $builtin_plugins in
137 all) builtin_plugins="$all_plugins";;
138 none) builtin_plugins="";;
143 for plugin in $all_plugins; do
146 for p in ${builtin_plugins//,/ }; do
147 if test "$plugin" = "$p"; then
148 internal="$internal$it$plugin"
154 if test "$type" = "external"; then
155 external="$external$et$plugin"
160 INTERNAL_PLUGINS="$internal"
161 EXTERNAL_PLUGINS="$external"
163 function check_if_internal() {
164 for p in $INTERNAL_PLUGINS; do
165 if test "$1" = "$p"; then
173 AM_CONDITIONAL(BUILTIN_PLUGIN_TEST, [check_if_internal test])
174 AM_CONDITIONAL(BUILTIN_PLUGIN_DBUS, [check_if_internal dbus])
175 AM_CONDITIONAL(BUILTIN_PLUGIN_GLIB, [check_if_internal glib])
176 AM_CONDITIONAL(BUILTIN_PLUGIN_CONSOLE, [check_if_internal console])
178 # Check for Check (unit test framework).
179 PKG_CHECK_MODULES(CHECK,
181 [has_check="yes"], [has_check="no"])
182 AM_CONDITIONAL(HAVE_CHECK, test "x$has_check" = "xyes")
184 AC_SUBST(CHECK_CFLAGS)
187 if test "x$has_check" = "xno"; then
188 AC_MSG_WARN([Check framework not found, unit tests are DISABLED.])
191 # Check for documentation tools
192 AC_ARG_WITH([documentation],
193 [AS_HELP_STRING([--with-documentation],
194 [generate pdf, html and other doc files])],
196 [with_documentation=auto]
199 AS_IF( [ test x$with_documentation = xno ],
200 [ has_doc_tools="no" ],
201 [ AC_PATH_TOOL([MRP_DOXYGEN], doxygen)
202 AC_PATH_TOOL([MRP_LYX], lyx)
203 AC_PATH_TOOL([MRP_INKSCAPE], inkscape)
204 AC_PATH_TOOL([MRP_PYTHON], python)
205 AC_PATH_TOOL([MRP_TOUCH], touch)
206 AC_PATH_TOOL([MRP_DBLATEX], dblatex)
207 AC_PATH_TOOL([MRP_XMLTO], xmlto)
209 AS_IF( [ test x$MRP_DOXYGEN = x -o x$MRP_LYX = x -o \
210 x$MRP_INKSCAPE = x -o x$MRP_PYTHON = x -o \
212 [ has_doc_tools="no";
213 AC_MSG_WARN([Some essential doc-tool is missing]) ],
214 [ has_doc_tools="yes";
219 AS_IF( [ test x$has_doc_tools == "xno" -o x$MRP_DBLATEX = x ],
220 [ can_make_pdfs="no";
221 AC_WARN([No PDF documentation will be generated]) ],
222 [ can_make_pdfs="yes"]
225 AS_IF([ test x$has_doc_tools == "xno" -o x$MRP_XMLTO = x ],
226 [ can_make_html="no";
227 AC_WARN([No HTML documentation will be generated]) ],
228 [ can_make_html="yes" ]
232 AM_CONDITIONAL(BUILD_DOCUMENTATION, [ test x$has_doc_tools = "xyes" ])
233 AM_CONDITIONAL(BUILD_PDF_DOCUMENTS, [ test x$can_make_pdfs = "xyes" ])
234 AM_CONDITIONAL(BUILD_HTML_DOCUMENTS, [ test x$can_make_html = "xyes" ])
236 AC_SUBST(MRP_DOCDIR, [`pwd`/doc])
237 AC_SUBST(MRP_FIGDIR, [$MRP_DOCDIR/common/figures])
238 AC_SUBST(MRP_MAKE_DOCRULES, [$MRP_DOCDIR/Makefile.rules])
239 AC_SUBST(MRP_DOCSCRIPT_DIR, [$MRP_DOCDIR/scripts])
240 AC_SUBST(MRP_ABNF, [$MRP_DOCSCRIPT_DIR/abnf.py])
241 AC_SUBST(MRP_DBLYXFIX, [$MRP_DOCSCRIPT_DIR/dblyxfix.py])
242 AC_SUBST(MRP_DOXML2DB, [$MRP_DOCSCRIPT_DIR/doxml2db.py])
243 AC_SUBST(MRP_DOXYDEPS, [$MRP_DOCSCRIPT_DIR/doxydeps.py])
247 SHAVE_INIT([build-aux], [enable])
249 # Create murphy symlink to src.
250 if test ! -L murphy; then
251 AC_MSG_NOTICE([Symlinking src to murphy...])
256 AC_CONFIG_FILES([build-aux/shave
257 build-aux/shave-libtool
260 src/common/tests/Makefile
261 src/core/tests/Makefile
262 src/daemon/tests/Makefile
263 src/common/murphy-common.pc
264 src/core/murphy-core.pc
265 src/murphy-db/Makefile
266 src/murphy-db/mdb/Makefile
267 src/murphy-db/mqi/Makefile
268 src/murphy-db/mql/Makefile
269 src/murphy-db/include/Makefile
270 src/murphy-db/tests/Makefile
272 doc/plugin-developer-guide/Makefile
273 doc/plugin-developer-guide/db/Makefile
274 doc/plugin-developer-guide/doxml/Makefile
279 # Display the configuration.
280 echo "----- configuration -----"
281 echo "Extra C warnings flags: $WARNING_CFLAGS"
284 for plugin in ${INTERNAL_PLUGINS:-none}; do
289 for plugin in ${EXTERNAL_PLUGINS:-none}; do