Fix ordering issues with LDFLAGS and LIBS.