2 # Process this file with autoconf to produce a configure script.
7 m4_esyscmd([build-aux/git-version-gen .tarball-version]),
8 [krisztian.litkey at intel.com])
10 AC_CONFIG_MACRO_DIR([m4])
11 AC_CONFIG_SRCDIR([src])
12 AC_CONFIG_HEADER([src/config.h])
13 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
15 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
17 m4_define(version_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
18 m4_define(version_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
19 m4_define(version_patch, `echo $VERSION | cut -d. -f3 | cut -d- -f1`)
22 AC_SUBST(VERSION_MAJOR, version_major)
23 AC_SUBST(VERSION_MINOR, version_minor)
24 AC_SUBST(VERSION_PATCH, version_patch)
25 AC_SUBST(VERSION_FULL, version_major.version_minor.version_patch)
27 MURPHY_VERSION_INFO="0:0:0"
28 AC_SUBST(MURPHY_VERSION_INFO)
30 # Disable static libraries.
33 # Checks for programs.
41 # Checks for libraries.
42 AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror])
44 # Checks for header files.
46 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h])
48 # Checks for typedefs, structures, and compiler characteristics.
58 AC_CHECK_MEMBERS([struct stat.st_rdev])
63 AC_CHECK_TYPES([ptrdiff_t])
65 # Checks for library functions.
70 AC_CHECK_FUNCS([clock_gettime memmove memset regcomp strcasecmp strchr strdup strrchr strtol strtoul])
73 PKG_CHECK_MODULES(GLIB, glib-2.0)
77 # Check for low-level DBUS libs.
78 PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70 dbus-1 >= 0.70)
82 DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
83 AC_SUBST(DBUS_SESSION_DIR)
85 # Check and enable extra compiler warnings if they are supported.
86 AC_ARG_ENABLE(extra-warnings,
87 [ --enable-extra-warnings enable extra compiler warnings],
88 [extra_warnings=$enableval], [extra_warnings=auto])
91 warncflags="-Wall -Wextra"
92 if test "$extra_warnings" != "no"; then
93 save_CPPFLAGS="$CPPFLAGS"
94 for opt in $warncflags; do
95 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
96 [WARNING_CFLAGS="$WARNING_CFLAGS $opt"])
98 CPPFLAGS="$save_CPPFLAGS"
101 AC_SUBST(WARNING_CFLAGS)
104 # Set up murphy CFLAGS and LIBS.
105 MURPHY_CFLAGS="$GLIB_CFLAGS $DBUS_CFLAGS"
106 MURPHY_LIBS="$GLIB_LIBS $DBUS_LIBS"
107 AC_SUBST(MURPHY_CFLAGS)
108 AC_SUBST(MURPHY_LIBS)
110 # Add LIBDIR to config.h.
111 AC_MSG_CHECKING([libdir])
112 AC_MSG_RESULT([$libdir])
113 AC_SUBST(LIBDIR, [$libdir])
115 # Check which plugins should be built in.
116 AC_ARG_WITH(builtin-plugins,
117 [ --with-builtin-plugins=<plugin-list> specify which plugins to link in],
118 [builtin_plugins=$withval],[builtin_plugins=all])
120 all_plugins=$(ls src/plugins/*.c 2>/dev/null | \
121 sed 's#src/plugins/plugin-##g;s#\.c$##g' | tr '\n' ' ')
123 case $builtin_plugins in
124 all) builtin_plugins="$all_plugins";;
125 none) builtin_plugins="";;
130 for plugin in $all_plugins; do
133 for p in ${builtin_plugins//,/ }; do
134 if test "$plugin" = "$p"; then
135 internal="$internal$it$plugin"
141 if test "$type" = "external"; then
142 external="$external$et$plugin"
147 INTERNAL_PLUGINS="$internal"
148 EXTERNAL_PLUGINS="$external"
150 function check_if_internal() {
151 for p in $INTERNAL_PLUGINS; do
152 if test "$1" = "$p"; then
160 AM_CONDITIONAL(BUILTIN_PLUGIN_TEST, [check_if_internal test])
161 AM_CONDITIONAL(BUILTIN_PLUGIN_DBUS, [check_if_internal dbus])
162 AM_CONDITIONAL(BUILTIN_PLUGIN_GLIB, [check_if_internal glib])
163 #AM_CONDITIONAL(BUILTIN_PLUGIN_STORAGE, [check_if_internal storage])
164 #AM_CONDITIONAL(BUILTIN_PLUGIN_SYSFS, [check_if_internal sysfs ])
165 #AM_CONDITIONAL(BUILTIN_PLUGIN_DISPLAY, [check_if_internal display])
166 #AM_CONDITIONAL(BUILTIN_PLUGIN_NETWORK, [check_if_internal network])
167 #AM_CONDITIONAL(BUILTIN_PLUGIN_BATTERY, [check_if_internal battery])
168 #AM_CONDITIONAL(BUILTIN_PLUGIN_XFS, [check_if_internal xfs])
170 # Check for Check (unit test framework).
171 PKG_CHECK_MODULES(CHECK,
173 [has_check="yes"], [has_check="no"])
174 AM_CONDITIONAL(HAVE_CHECK, test "x$has_check" = "xyes")
176 if test "x$has_check" = "xno"; then
177 AC_MSG_WARN([Check framework not found, unit tests are DISABLED.])
181 SHAVE_INIT([build-aux], [enable])
183 # Create murphy symlink to src.
184 if test ! -L murphy; then
185 AC_MSG_NOTICE([Symlinking src to murphy...])
190 AC_CONFIG_FILES([build-aux/shave
191 build-aux/shave-libtool
194 src/common/tests/Makefile
195 src/core/tests/Makefile
196 src/daemon/tests/Makefile
197 src/common/murphy-common.pc
198 src/core/murphy-core.pc
203 # Display the configuration.
204 echo "----- configuration -----"
205 echo "Extra C warnings flags: $WARNING_CFLAGS"
208 for plugin in ${INTERNAL_PLUGINS:-none}; do
213 for plugin in ${EXTERNAL_PLUGINS:-none}; do