Added HAVE_ENDIAN_H to config.h
reworked preprocessor code to fit in with style of other configuration options