Fix LDFLAGS=-Wl,--as-needed support broken by -R versus -rpath test added in ee15a2a9.

Uses LIBS instead of LDFLAGS for -l flags in the tests as appropriate
to ensure proper linker flag ordering in the test comparing -R and
-rpath.

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>