Put libraries in LDLIBS to work with Ubuntu

The linker configuration on Ubuntu requires libraries to be listed in a
specific order on the command line and after the objects that depend on
them, so put libraries in LDLIBS instead of LDFLAGS to make this happen.