Install elog parser and mako script for native processing

Installed elog parser and mako scripts are used by repositories
to build elog-errors.hpp for local application specific errors

Change-Id: I2353185d28db59b052d2167d6f37f1b385978bb3
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 1e2106e..dad2319 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+# For target build
+if !INSTALL_SCRIPTS
 # export these headers
 nobase_include_HEADERS = \
 	phosphor-logging/log.hpp \
@@ -108,3 +110,11 @@
 pkgconfiglib_DATA = phosphor-logging.pc
 
 SUBDIRS = test
+else
+# For native build
+# Export elog-gen parser and mako script
+elogdir = ${datadir}/phosphor-logging/elog
+nobase_elog_DATA =  \
+	tools/elog-gen.py \
+	tools/phosphor-logging/templates/elog-gen-template.mako.hpp
+endif
diff --git a/configure.ac b/configure.ac
index f912e14..b8af0cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,10 +5,6 @@
 AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
 AM_SILENT_RULES([yes])
 
-# Checks for typedefs, structures, and compiler characteristics.
-AX_CXX_COMPILE_STDCXX_14([noext])
-AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
-
 # Checks for programs
 AC_PROG_CXX
 AM_PROG_AR
@@ -16,25 +12,40 @@
 AC_PROG_MAKE_SET
 AC_PROG_MKDIR_P
 AC_CHECK_PROG([DIRNAME], dirname, dirname)
-# Python
-AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR(
-    [Could not find python-2.7 installed...python-2.7 is required])])
 
-# Surpress the --with-libtool-sysroot error
-LT_INIT
+# Check for compiler, packages only during target build.
+# As the packages are not available on the host do not
+# perform checks during native build.
+AC_ARG_ENABLE([install_scripts],
+    AS_HELP_STRING([--enable-install_scripts],
+        [Enable installing parser and mako script]),
+    [], [install_scripts=yes])
+AM_CONDITIONAL([INSTALL_SCRIPTS], [test "x$enable_install_scripts" != "xno"])
+AS_IF([test "x$enable_install_scripts" != "xyes"], [
+    # Checks for typedefs, structures, and compiler characteristics.
+    AX_CXX_COMPILE_STDCXX_14([noext])
+    AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
 
-# Checks for libraries.
-AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found."])])
+    # Python
+    AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR(
+        [Could not find python-2.7 installed...python-2.7 is required])])
 
-# sdbusplus is non-private because we have no library to link.
-# If we ever have a library, move this to private.
-AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], [], [AC_MSG_ERROR(["sdbusplus required and not found."])])
-AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
+    # Surpress the --with-libtool-sysroot error
+    LT_INIT
 
-# Check for sdbus++
-AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
-AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
-    AC_MSG_ERROR(["Requires sdbus++"]))
+    # Checks for libraries.
+    AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found."])])
+
+    # sdbusplus is non-private because we have no library to link.
+    # If we ever have a library, move this to private.
+    AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], [], [AC_MSG_ERROR(["sdbusplus required and not found."])])
+    AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
+
+    # Check for sdbus++
+    AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
+    AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
+        AC_MSG_ERROR(["Requires sdbus++"]))
+])
 
 # Check/set gtest specific functions.
 AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])