]> xenbits.xensource.com Git - libvirt.git/commitdiff
Check for --no-copy-dt-needed linker flag
authorGuido Günther <agx@sigxcpu.org>
Tue, 13 Aug 2013 11:49:05 +0000 (13:49 +0200)
committerGuido Günther <agx@sigxcpu.org>
Thu, 22 Aug 2013 14:17:36 +0000 (16:17 +0200)
and use it when available

configure.ac
daemon/Makefile.am
m4/virt-linker-no-indirect.m4 [new file with mode: 0644]
src/Makefile.am
tests/Makefile.am
tools/Makefile.am

index c52f212438596909db66d8d9d54afcf482d75942..94a2e19a121284f2e6aa24cd7a229195f39c5c68 100644 (file)
@@ -160,6 +160,7 @@ AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
 LIBVIRT_COMPILE_WARNINGS
 LIBVIRT_COMPILE_PIE
 LIBVIRT_LINKER_RELRO
+LIBVIRT_LINKER_NO_INDIRECT
 
 LIBVIRT_CHECK_APPARMOR
 LIBVIRT_CHECK_ATTR
index 5cd95aac5929980d60b9a6c779c946902315c7b8..e34868b0738d96c9aea3bd379eaef49b0f54bc67 100644 (file)
@@ -129,6 +129,7 @@ libvirtd_LDFLAGS =                                  \
        $(PIE_LDFLAGS)                                  \
        $(RELRO_LDFLAGS)                                \
        $(COVERAGE_LDFLAGS)                             \
+       $(NO_INDIRECT_LDFLAGS)                          \
        $(NULL)
 
 libvirtd_LDADD =                                       \
diff --git a/m4/virt-linker-no-indirect.m4 b/m4/virt-linker-no-indirect.m4
new file mode 100644 (file)
index 0000000..b344f70
--- /dev/null
@@ -0,0 +1,32 @@
+dnl
+dnl Check for --no-copy-dt-needed-entries
+dnl
+dnl Copyright (C) 2013 Guido Günther <agx@sigxcpu.org>
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library.  If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_LINKER_NO_INDIRECT],[
+    AC_MSG_CHECKING([for how to avoid indirect lib deps])
+
+    NO_INDIRECT_LDFLAGS=
+    case `$LD --help 2>&1` in
+        *"--no-copy-dt-needed-entries"*)
+               NO_INDIRECT_LDFLAGS="-Wl,--no-copy-dt-needed-entries" ;;
+    esac
+    AC_SUBST([NO_INDIRECT_LDFLAGS])
+
+    AC_MSG_RESULT([$NO_INDIRECT_LDFLAGS])
+])
index 7c3d8a1ae373ea8f8db7ce2540dfd382c1a55d76..faa2cd6e81e0e082327ab1fc07d5f34b9721c8ff 100644 (file)
@@ -35,6 +35,7 @@ AM_CFLAGS =   $(LIBXML_CFLAGS)                                \
 AM_LDFLAGS =   $(DRIVER_MODULE_LDFLAGS)                        \
                $(COVERAGE_LDFLAGS)                             \
                $(RELRO_LDFLAGS)                                \
+               $(NO_INDIRECT_LDFLAGS)                          \
                $(NULL)
 
 EXTRA_DIST = $(conf_DATA) util/keymaps.csv
index 2fb8f373d94fd0409015a629207d555825648dae..c399dcb0e4abaf93b9d57b4e5196a22f5d8ae377 100644 (file)
@@ -50,6 +50,7 @@ endif
 
 LDADDS = \
         $(WARN_CFLAGS) \
+       $(NO_INDIRECT_LDFLAGS) \
        $(PROBES_O) \
        ../src/libvirt.la \
        ../gnulib/lib/libgnu.la
index 3712287f1cefbde8e66b8433a17dcec602c690e6..74fae2dc017990b92aae76a9befdb37d965ffaee 100644 (file)
@@ -24,6 +24,7 @@ INCLUDES = \
 
 AM_LDFLAGS = \
        $(RELRO_LDFLAGS)                                        \
+       $(NO_INDIRECT_LDFLAGS)                                  \
        $(NULL)
 
 POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"