Move --with LDFLAGS options into LIBS to fix ordering issues.