configure.ac: Empty LDFLAGS before checking for libnl3
diff mbox

Message ID cd038c1af2c50026e5b34ef1a815fe365ce32073.1523368442.git.tredaelli@redhat.com
State New
Headers show

Commit Message

Timothy Redaelli April 10, 2018, 1:54 p.m. UTC
Currently since CFLAGS are dropped if you have LDFLAGS=-pie (default on RHEL)
the rtnl_link_get_phys_port_id, rtnl_link_set_carrier and rtnl_link_get_carrier
tests always fails:

/usr/bin/ld: /tmp/ccv5GdFD.o: relocation R_X86_64_PC32 against undefined symbol
`rtnl_link_get_carrier@@libnl_3' can not be used when making a shared object;
recompile with -fPIC

This commits empty LDFLAGS before launching the 3 tests and restores it
after the tests.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>

---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.14.3

Comments

Jiri Pirko April 19, 2018, 2:35 p.m. UTC | #1
Tue, Apr 10, 2018 at 03:54:02PM CEST, tredaelli@redhat.com wrote:
>Currently since CFLAGS are dropped if you have LDFLAGS=-pie (default on RHEL)

>the rtnl_link_get_phys_port_id, rtnl_link_set_carrier and rtnl_link_get_carrier

>tests always fails:

>

>/usr/bin/ld: /tmp/ccv5GdFD.o: relocation R_X86_64_PC32 against undefined symbol

>`rtnl_link_get_carrier@@libnl_3' can not be used when making a shared object;

>recompile with -fPIC

>

>This commits empty LDFLAGS before launching the 3 tests and restores it

>after the tests.

>

>Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>


applied. Thanks

Patch
diff mbox

diff --git a/configure.ac b/configure.ac
index 60657bb..f27c15c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,8 +39,10 @@  LT_INIT
 
 PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0 libnl-route-3.0 libnl-cli-3.0])
 	TMP_CFLAGS="$CFLAGS"
+	TMP_LDFLAGS="$LDFLAGS"
 	TMP_LIBS="$LIBS"
 	CFLAGS="$CPPFLAGS $LIBNL_CFLAGS"
+	LDFLAGS=""
 	LIBS="$LIBS $LIBNL_LIBS"
 	AC_CHECK_LIB([nl-route-3], [rtnl_link_get_phys_port_id],
 		     AC_DEFINE(HAVE_RTNL_LINK_GET_PHYS_ID, [1], [Define to 1 if you have rtnl_link_get_phys_port_id function.]))
@@ -49,6 +51,7 @@  PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0 libnl-route-3.0 libnl-cli-3
 	AC_CHECK_LIB([nl-route-3], [rtnl_link_get_carrier],
 		     AC_DEFINE(HAVE_RTNL_LINK_GET_CARRIER, [1], [Define to 1 if you have rtnl_link_get_carrier.]))
 	CFLAGS="$TMP_CFLAGS"
+	LDFLAGS="$TMP_LDFLAGS"
 	LIBS="$TMP_LIBS"
 
 PKG_CHECK_MODULES([LIBDAEMON], [libdaemon])