build: fix indirect linking vs rpath by linking --as-needed
libtotem_pg links against libnss/nspr and correctly sets RPATH
corosync links against libtotem_pg, but libtool (via .la) enforces
an extra layer of linking against libnss/nspr without setting RPATH.
corosync final binary can't resolve the second linking and fails
to load.
This issue is visible only on NetBSD that enforces a much stricter
use of rpath (vs other OS/distros). Using --as-needed avoids that
and it's generally safe to use on other OS'es.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>