sbin_PROGRAMS = faultd
faultd_SOURCES = \
src/action/action_executor.c \
- src/action/service_recover.c \
- src/action/service_restart.c \
- src/action/system_reboot.c \
- src/action/system_reboot_to_recovery.c \
src/core/action.c \
src/core/database.c \
src/core/event.c \
src/core/module.c \
src/core/service.c \
src/core/faultd-config.c \
- src/decision_makers/rv_dm.c \
- src/decision_makers/standard_fault_dm.c \
- src/decision_makers/vip_fault_dm.c \
src/event_types/action_executed_event.c \
src/event_types/decision_made_event.c \
src/event_types/resource_violation_event.c \
src/event_types/faultd_started_event.c \
src/event_types/system_booted_event.c \
src/faultd.c \
- src/listeners/audit.c \
- src/listeners/systemd.c \
src/util/common.c \
- src/listeners/startup.c \
src/util/log.c \
src/util/notify_queue.c \
src/util/systemd_dbus.c
-faultd_LDADD = $(LIBSYSTEMD_LIBS) $(AUDIT_LIBS) $(LIBEJDB_LIBS) $(JSON_C_LIBS)
+
+# Add here source files of modules that must have ability to enable/disable during build
+# This variable is parsed by Autoconf
+EXTRA_faultd_SOURCES = \
+ src/listeners/audit.c \
+ src/listeners/systemd.c \
+ src/listeners/startup.c \
+ src/decision_makers/vip_fault_dm.c \
+ src/decision_makers/rv_dm.c \
+ src/decision_makers/standard_fault_dm.c \
+ src/action/service_restart.c \
+ src/action/system_reboot.c \
+ src/action/system_reboot_to_recovery.c \
+ src/action/service_recover.c
+
+faultd_LDADD = $(ENABLED_MODULES) $(LIBSYSTEMD_LIBS) $(AUDIT_LIBS) $(LIBEJDB_LIBS) $(JSON_C_LIBS)
+faultd_DEPENDENCIES = $(ENABLED_MODULES)
%.pc: %.pc.in Makefile
$(SED_PROCESS)
])
AM_CONDITIONAL(ENABLE_TESTS, [test "x$enable_tests" = xyes])
+all_modules=`./modules.list path`
+
+AC_ARG_ENABLE([modules],
+ AS_HELP_STRING([--enable-modules=MODULES],
+ [comma-separated list of modules to enable, available:]
+ m4_split(m4_esyscmd([./modules.list name]), ' ')),
+[
+# Enable only given modules
+modules_to_enable="`echo $enableval | sed 's/,/ /g'`"
+
+for i in $modules_to_enable
+do
+ invalid=yes
+ for modpath in $all_modules
+ do
+ modname=${modpath##*/}
+ if test "x$modname" = "x$i"; then
+ ENABLED_MODULES="$ENABLED_MODULES ${modpath}.o"
+ invalid=
+ break
+ fi
+ done
+
+ if test "x$invalid" = "xyes"; then
+ AC_MSG_ERROR([invalid module $i])
+ fi
+done
+],
+[
+# No --enable-modules specified, enable all modules
+for modpath in $all_modules
+do
+ ENABLED_MODULES="$ENABLED_MODULES ${modpath}.o"
+done
+])
+
+AC_SUBST([ENABLED_MODULES])
+
PKG_CHECK_MODULES(LIBSYSTEMD,
[libsystemd >= 231],
have_libsystemd=yes,
ldflags: ${LDFLAGS}
libsystemd: ${have_libsystemd}
-])
+ modules: ${ENABLED_MODULES/ /}
+])
--- /dev/null
+#!/bin/sh
+
+sed -ne '/EXTRA_faultd_SOURCES/,/^ *$/ { s,\(\.c.*$\|^EXTRA.*\),,; p }' < Makefile.am | \
+while read path
+do
+ if test "x$1" = "xname"; then
+ printf "%s\n" "${path##*/}"
+ elif test "x$1" = "xpath"; then
+ printf "%s\n" "$path"
+ else
+ printf "%-32s %s\n" "${path##*/}" "$path"
+ fi
+done