autoconf check for locale.h, code tidying