[dpkg] 126/187: build: Pass --as-needed to the linker for dselect to avoid libstdc++
Reiner Herrmann
reiner at reiner-h.de
Sun Nov 6 12:46:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
deki-guest pushed a commit to branch master
in repository dpkg.
commit 44cfbc4b31de7d3dc3c6471aeaf21768b4dc015a
Author: Guillem Jover <guillem at debian.org>
Date: Wed Sep 7 04:56:32 2016 +0200
build: Pass --as-needed to the linker for dselect to avoid libstdc++
We are not really using anything from libstdc++, so let's avoid the
dependency entirely. This makes this the only frontend not to pull
in the C++ run-time.
---
configure.ac | 1 +
debian/changelog | 2 ++
dselect/Makefile.am | 4 ++++
m4/dpkg-linker.m4 | 19 +++++++++++++++++++
4 files changed, 26 insertions(+)
diff --git a/configure.ac b/configure.ac
index 248d0a6..5804498 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,7 @@ DPKG_DIST_CHECK([test "$GMSGFMT" = ":" && test "$USE_NLS" = "yes"],
AM_PROG_AR
LT_INIT([disable-shared])
DPKG_BUILD_SHARED_LIBS
+DPKG_LINKER_AS_NEEDED
DPKG_LINKER_VERSION_SCRIPT
# Allow compilation without optional programs
diff --git a/debian/changelog b/debian/changelog
index e3535da..5ee6b9e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -178,6 +178,8 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
marked as deprecated by POSIX).
- Print an actual newline instead of a literal \n in lcov output.
- Do not honor DPKG_DATADIR on the installed Dpkg module.
+ - Pass --as-needed to the linker for dselect to avoid libstdc++ dependency.
+ Which makes of dselect the only front-end not pulling the C++ run-time.
[ Updated man pages translations ]
* German (Helge Kreutzmann).
diff --git a/dselect/Makefile.am b/dselect/Makefile.am
index 9c14f86..3c0817c 100644
--- a/dselect/Makefile.am
+++ b/dselect/Makefile.am
@@ -17,6 +17,10 @@ AM_CXXFLAGS = \
-fno-rtti \
-fno-exceptions \
$(nil)
+if HAVE_LINKER_AS_NEEDED
+AM_LDFLAGS = \
+ -Wl,--as-needed
+endif
bin_PROGRAMS = dselect
diff --git a/m4/dpkg-linker.m4 b/m4/dpkg-linker.m4
index e068a38..1bb6435 100644
--- a/m4/dpkg-linker.m4
+++ b/m4/dpkg-linker.m4
@@ -23,6 +23,25 @@ AC_DEFUN([DPKG_LINKER_OPTIMIZATIONS], [
])
])
+# DPKG_LINKER_AS_NEEDED
+# ---------------------
+AC_DEFUN([DPKG_LINKER_AS_NEEDED], [
+ AC_CACHE_CHECK([for --as-needed linker flag], [dpkg_cv_linker_as_needed], [
+ save_LDFLAGS=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([], [])
+ ], [
+ dpkg_cv_linker_as_needed=yes
+ ], [
+ dpkg_cv_linker_as_needed=no
+ ])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+ AM_CONDITIONAL([HAVE_LINKER_AS_NEEDED],
+ [test "x$dpkg_cv_linker_as_needed" = "xyes"])
+])
+
# DPKG_LINKER_VERSION_SCRIPT
# --------------------------
AC_DEFUN([DPKG_LINKER_VERSION_SCRIPT], [
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list