Remove bashisms from configure
More portable configure and fix LDFLAGS getting overwritten