Enable configure of just sdbus++
Change-Id: I9910ef3c8d632ea4ed71dbf49c48c0cd798441f7
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/Makefile.am b/Makefile.am
index 5b39bc1..c60ff10 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+if WANT_LIBSDBUSPLUS
+
nobase_include_HEADERS = \
mapbox/recursive_wrapper.hpp \
mapbox/variant.hpp \
@@ -16,4 +18,5 @@
sdbusplus/utility/type_traits.hpp \
sdbusplus/vtable.hpp
+endif
SUBDIRS = test tools
diff --git a/configure.ac b/configure.ac
index 35fde11..cb613b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,14 +25,23 @@
AM_CONDITIONAL([WANT_SDBUSPP], [test "x$enable_sdbuspp" != "xno"])
-# Checks for libraries.
-PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
+# setup libsdbusplus
+PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [have_systemd=yes], [have_systemd=no])
+AC_ARG_ENABLE([libsdbusplus],
+ AS_HELP_STRING([--disable-libsdbusplus], [Disable libsdbusplus]))
+
+AS_IF([test "x$enable_libsdbusplus" != "xno"],
+ [AS_IF([test "x$have_systemd" = "xno"], [AC_MSG_ERROR([libsdbusplus requires systemd])])])
+
+AM_CONDITIONAL([WANT_LIBSDBUSPLUS], [test "x$enable_libsdbusplus" != "xno"])
# Checks for header files.
-AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])
+AS_IF([test "x$enable_libsdbusplus" = "xyes"],
+ [AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])])
# Checks for typedefs, structures, and compiler characteristics.
-AX_CXX_COMPILE_STDCXX_14([noext])
+AS_IF([test "x$enable_libsdbusplus" = "xyes"],
+ [AX_CXX_COMPILE_STDCXX_14([noext])])
AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
diff --git a/test/Makefile.am b/test/Makefile.am
index 15e8f72..e89fea1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,3 +1,5 @@
+if WANT_LIBSDBUSPLUS
+
AM_CPPFLAGS = -I$(top_srcdir)
check_PROGRAMS =
@@ -25,3 +27,4 @@
check_PROGRAMS += vtable_vtable
vtable_vtable_SOURCES = vtable/vtable.cpp vtable/vtable_c.c
+endif