]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: support unshare.static
authorGeorg Schiesser <georg.schiesser@opentech.at>
Tue, 5 May 2015 11:19:51 +0000 (13:19 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 18 May 2015 09:46:05 +0000 (11:46 +0200)
This patch adds support for building a static version of unshare.
We need to add unshare to the list of possible static programs, and
provide build flags for the compiler and linker, which are equivalent to
the flags of the non-static program, except additional static linking.
See also: commit 2fa60c5 build-sys: support nsenter.static

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
configure.ac
sys-utils/Makemodule.am

index 3377094e1fb2d877f388e3e014074161919d0cc3..de20245dba60163b4b526fdd40c09fa4c1f06da1 100644 (file)
@@ -448,7 +448,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
           AC_MSG_RESULT([no]))
 
 dnl Static compilation
-m4_define([UL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid, nsenter])
+m4_define([UL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid, nsenter, unshare])
 
 AC_ARG_ENABLE([static-programs],
   [AS_HELP_STRING([--enable-static-programs=LIST],
index 08bb6cea08e302e61a804a525e7885b7ffeef63e..fcc5c53efe793186c70b50f052aae65c6f6a8d8f 100644 (file)
@@ -357,6 +357,14 @@ dist_man_MANS += sys-utils/unshare.1
 unshare_SOURCES = sys-utils/unshare.c
 unshare_LDADD = $(LDADD) libcommon.la
 unshare_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
+
+if HAVE_STATIC_UNSHARE
+usrbin_exec_PROGRAMS += unshare.static
+unshare_static_SOURCES = $(unshare_SOURCES)
+unshare_static_LDFLAGS = -all-static
+unshare_static_LDADD = $(unshare_LDADD)
+unshare_static_CFLAGS = $(unshare_CFLAGS)
+endif
 endif
 
 if BUILD_NSENTER