From 01256c61ba126449c46dd4ab5d5e145488b981fa Mon Sep 17 00:00:00 2001
From: Amarnath Valluri <amarnath.valluri@intel.com>
Date: Mon, 23 Jan 2017 13:25:13 +0200
Subject: [PATCH] Added configure option to enable/disable static library

Create static library archive only in case of --enable-static.

Upstream-Status: Pending

Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
---
 configure.ac         | 6 ++++++
 include/builddefs.in | 1 +
 include/buildmacros  | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/configure.ac b/configure.ac
index b966d0e..e48268b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,12 @@ AC_ARG_ENABLE(shared,
 	enable_shared=yes)
 AC_SUBST(enable_shared)
 
+AC_ARG_ENABLE(static,
+[ --enable-static=[yes/no] Enable use of static libraries [default=yes]],,
+	enable_static=yes)
+AC_SUBST(enable_static)
+
+
 AC_ARG_ENABLE(gettext,
 [ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],,
 	enable_gettext=yes)
diff --git a/include/builddefs.in b/include/builddefs.in
index d9931db..3b3dbd2 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -71,6 +71,7 @@ RPMBUILD	= @rpmbuild@
 RPM_VERSION	= @rpm_version@
 
 ENABLE_SHARED	= @enable_shared@
+ENABLE_STATIC 	= @enable_static@
 ENABLE_GETTEXT	= @enable_gettext@
 
 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
diff --git a/include/buildmacros b/include/buildmacros
index 39fa7e2..b0f25c5 100644
--- a/include/buildmacros
+++ b/include/buildmacros
@@ -80,6 +80,7 @@ endif
 # /usr/lib.
 ifeq ($(ENABLE_SHARED),yes)
 INSTALL_LTLIB_DEV = \
+	set -x; \
 	cd $(TOPDIR)/$(LIBNAME)/.libs; \
 	../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
 	../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR); \
@@ -88,7 +89,9 @@ INSTALL_LTLIB_DEV = \
 	../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \
 	if test "x$(PKG_DEVLIB_DIR)" != "x$(PKG_LIB_DIR)" ; then \
 	rel_lib_prefix=$$(echo $(PKG_LIB_DIR) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \
+	if test "$(ENABLE_STATIC)" = "yes" ; then \
 	../$(INSTALL) -S $$rel_lib_prefix$(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
+	fi ;\
 	../$(INSTALL) -S $$rel_lib_prefix$(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
 	rel_devlib_prefix=$$(echo $(PKG_DEVLIB_DIR) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \
 	../$(INSTALL) -S $$rel_devlib_prefix$(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so; \
-- 
2.7.4

