Use %m instead of strerror

%m is thread safe.
Use O_CLOEXEC where adequate
Misc autotools fixes

- Ensure "config.h" is always included as the first file
- Use -std=gnu++0x instead of -std=c++0x
- Use AC_SYS_LARGEFILE to support largefiles on targets that need it
- Use AC_USE_SYSTEM_EXTENSIONS so all GNU extensions and optimizations
  are enabled.
- Use -fvisibility-inlines-hidden, this reduces the library size
  in around 100kb and the symbol table in around 1000 entries, possible
  allowing faster loading and runtime performance improvements.