blob: 1c1159f2c90f3388b12f97cc1c893277cb04ede3 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From 01256c61ba126449c46dd4ab5d5e145488b981fa Mon Sep 17 00:00:00 2001
2From: Amarnath Valluri <amarnath.valluri@intel.com>
3Date: Mon, 23 Jan 2017 13:25:13 +0200
4Subject: [PATCH] Added configure option to enable/disable static library
5
6Create static library archive only in case of --enable-static.
7
8Upstream-Status: Pending
9
10Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
11---
12 configure.ac | 6 ++++++
13 include/builddefs.in | 1 +
14 include/buildmacros | 3 +++
15 3 files changed, 10 insertions(+)
16
17diff --git a/configure.ac b/configure.ac
18index b966d0e..e48268b 100644
19--- a/configure.ac
20+++ b/configure.ac
21@@ -26,6 +26,12 @@ AC_ARG_ENABLE(shared,
22 enable_shared=yes)
23 AC_SUBST(enable_shared)
24
25+AC_ARG_ENABLE(static,
26+[ --enable-static=[yes/no] Enable use of static libraries [default=yes]],,
27+ enable_static=yes)
28+AC_SUBST(enable_static)
29+
30+
31 AC_ARG_ENABLE(gettext,
32 [ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],,
33 enable_gettext=yes)
34diff --git a/include/builddefs.in b/include/builddefs.in
35index d9931db..3b3dbd2 100644
36--- a/include/builddefs.in
37+++ b/include/builddefs.in
38@@ -71,6 +71,7 @@ RPMBUILD = @rpmbuild@
39 RPM_VERSION = @rpm_version@
40
41 ENABLE_SHARED = @enable_shared@
42+ENABLE_STATIC = @enable_static@
43 ENABLE_GETTEXT = @enable_gettext@
44
45 HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
46diff --git a/include/buildmacros b/include/buildmacros
47index 39fa7e2..b0f25c5 100644
48--- a/include/buildmacros
49+++ b/include/buildmacros
50@@ -80,6 +80,7 @@ endif
51 # /usr/lib.
52 ifeq ($(ENABLE_SHARED),yes)
53 INSTALL_LTLIB_DEV = \
54+ set -x; \
55 cd $(TOPDIR)/$(LIBNAME)/.libs; \
56 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
57 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR); \
58@@ -88,7 +89,9 @@ INSTALL_LTLIB_DEV = \
59 ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \
60 if test "x$(PKG_DEVLIB_DIR)" != "x$(PKG_LIB_DIR)" ; then \
61 rel_lib_prefix=$$(echo $(PKG_LIB_DIR) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \
62+ if test "$(ENABLE_STATIC)" = "yes" ; then \
63 ../$(INSTALL) -S $$rel_lib_prefix$(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
64+ fi ;\
65 ../$(INSTALL) -S $$rel_lib_prefix$(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
66 rel_devlib_prefix=$$(echo $(PKG_DEVLIB_DIR) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \
67 ../$(INSTALL) -S $$rel_devlib_prefix$(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so; \
68--
692.7.4
70