This header is not available on e.g. FreeBSD so detect it's presence in configure.ac and only include it if appropriate. Then, if byte order manipulation macros are not defined (old glibc like the one provided by Debian GNU/Linux) define them.
Endianness fun is not provided by the same header file on GNU/Linux (endian.h) and FreeBSD (sys/endian.h). Add some magic for the autotools to detect the correct header file. While here, add AC_C_INLINE: it's reported as missing by autoscan(1).