From: Aurelien Jacobs Date: Sat, 21 May 2016 17:46:14 +0000 (+0200) Subject: detect the appropriate link flag for retaining all objects of static lib X-Git-Tag: libsigrok-0.5.0~370 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d268866d294f8ab94e14881caf5d0126e5b77a91;p=libsigrok.git detect the appropriate link flag for retaining all objects of static lib This closes bug #802. --- diff --git a/configure.ac b/configure.ac index c5089f1d..a089c9aa 100644 --- a/configure.ac +++ b/configure.ac @@ -174,6 +174,18 @@ AM_CONDITIONAL([NEED_RPC], [test "x$sr_cv_have_rpc" = xyes]) # Check for compiler support of 128 bit integers AC_CHECK_TYPES([__int128_t, __uint128_t], [], [], []) +# Linker flag to retain the objects of a static lib that are not referenced +AX_CHECK_LINK_FLAG([-Wl,--whole-archive -Wl,--no-whole-archive], + [SR_LINK_BEFORE_LIB=-Wl,--whole-archive + SR_LINK_AFTER_LIB=-Wl,--no-whole-archive], [ +AX_CHECK_LINK_FLAG([-Wl,-force_load], + [SR_LINK_BEFORE_LIB=-Wl,-force_load + SR_LINK_AFTER_LIB=], + [SR_LINK_BEFORE_LIB= + SR_LINK_AFTER_LIB=])]) +AC_SUBST(SR_LINK_BEFORE_LIB) +AC_SUBST(SR_LINK_AFTER_LIB) + ######################## ## Hardware drivers ## ######################## diff --git a/libsigrok.pc.in b/libsigrok.pc.in index eb4b7cf8..47ac8801 100644 --- a/libsigrok.pc.in +++ b/libsigrok.pc.in @@ -9,6 +9,6 @@ URL: http://www.sigrok.org Requires: glib-2.0 Requires.private: @SR_PKGLIBS@ Version: @SR_PACKAGE_VERSION@ -Libs: -L${libdir} -Wl,--whole-archive -lsigrok -Wl,--no-whole-archive +Libs: -L${libdir} @SR_LINK_BEFORE_LIB@ -lsigrok @SR_LINK_AFTER_LIB@ Libs.private: @SR_EXTRA_LIBS@ Cflags: -I${includedir}