Install YAML files

Install YAML files when installing the package.

Change-Id: I7a086be5098dd1473f60cfe9cdbd7d4574400065
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 105f33a..c5627da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
 AM_DEFAULT_SOURCE_EXT = .cpp
 
+if WANT_LIBOPENPOWER_DBUS
 nobase_include_HEADERS = ## These get filled in by Makefile.interfaces
 
 libopenpower_dbusdir = ${libdir}
@@ -16,3 +17,9 @@
 clean-local: clean-dbus
 
 -include Makefile.interfaces
+endif
+
+yamldir = ${pkgdatadir}/yaml
+nobase_yaml_DATA = ## Filled in by Makefile.yaml
+
+-include Makefile.yaml
diff --git a/Makefile.yaml.in b/Makefile.yaml.in
new file mode 100644
index 0000000..964f971
--- /dev/null
+++ b/Makefile.yaml.in
@@ -0,0 +1 @@
+# Empty file so that 'configure' attempts to generate Makefile.yaml
diff --git a/configure.ac b/configure.ac
index 35f80a2..d74c185 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,23 +16,32 @@
 AC_CHECK_PROG([BASENAME], basename, basename)
 AC_CHECK_PROG([DIRNAME], dirname, dirname)
 
-AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
-AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
-    AC_MSG_ERROR([Cannot find sdbus++]))
+AC_ARG_ENABLE([libopenpower_dbus],
+    AS_HELP_STRING([--disable-libopenpower_dbus], [Disable libopenpower_dbus]))
 
-# Check for baseline language coverage in the compiler for the C++14 standard
-AX_CXX_COMPILE_STDCXX_14([noext])
-AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
-AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
+AM_CONDITIONAL([WANT_LIBOPENPOWER_DBUS], [test "x$enable_libopenpower_dbus" != "xno"])
 
-# Checks for library functions.
-LT_INIT([dlopen disable-static shared])
-LT_LIB_DLLOAD
+AS_IF([test "x$enable_libopenpower_dbus" != "xno"], [
+    AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
+    AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
+        AC_MSG_ERROR([Cannot find sdbus++]))
 
-# Create configured output
-AC_CONFIG_FILES([Makefile.interfaces],
-    [${srcdir}/generate_makefile.sh ${srcdir} > Makefile.interfaces])
+    # Check for baseline language coverage in the compiler for the C++14 standard
+    AX_CXX_COMPILE_STDCXX_14([noext])
+    AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
+    AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
+
+    # Checks for library functions.
+    LT_INIT([dlopen disable-static shared])
+    LT_LIB_DLLOAD
+
+    # Create configured output
+    AC_CONFIG_FILES([Makefile.interfaces],
+        [${srcdir}/generate_makefile.sh ${srcdir} > Makefile.interfaces])
+    AC_CONFIG_FILES([openpower-dbus-interfaces.pc])
+])
+AC_CONFIG_FILES([Makefile.yaml],
+    [${srcdir}/generate_yaml_makefile.sh ${srcdir} > Makefile.yaml])
 
 AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([openpower-dbus-interfaces.pc])
 AC_OUTPUT
diff --git a/generate_yaml_makefile.sh b/generate_yaml_makefile.sh
new file mode 100755
index 0000000..e2197d9
--- /dev/null
+++ b/generate_yaml_makefile.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+cd $1
+
+toplevel_dirs=org
+all_yaml=`find $toplevel_dirs -name "*.yaml"`
+
+echo "nobase_yaml_DATA = \\"
+for i in ${all_yaml};
+do
+    echo "	${i} \\"
+done
+echo