summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2016-09-07 04:56:32 +0200
committerGuillem Jover <guillem@debian.org>2016-10-30 06:29:50 +0100
commit44cfbc4b31de7d3dc3c6471aeaf21768b4dc015a (patch)
tree7717aa65ea55a8bf54b907374b41c1ab41107187 /m4
parented6cbcf7a1706523580a91491adb9ecd55098f9c (diff)
downloaddpkg-44cfbc4b31de7d3dc3c6471aeaf21768b4dc015a.tar.gz
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.
Diffstat (limited to 'm4')
-rw-r--r--m4/dpkg-linker.m419
1 files changed, 19 insertions, 0 deletions
diff --git a/m4/dpkg-linker.m4 b/m4/dpkg-linker.m4
index e068a38bf..1bb64350d 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], [