Use --dep-libs instead of listing (some) of the dependencies manually

The immediate problem is that `-lagg` is missing from the link command, which means the test fails to link on systems that don't allow implicit linking against shared libraries.  It seemed more sensible to use `--dep-libs` rather than explicitly add another library to the link.