Fix LDFLAGS location in linker line.

With gcc, libs need to be at the end of the line otherwise we get crappy
undefined references to symbols coming from these libs.