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

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.  Bug added in ee15a2a.

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