Merge pull request #61 from kraj/master

Musl inspired general fixes
pull/69/head
Christian Krause 8 years ago
commit d2d7203969

@ -69,12 +69,17 @@ AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memchr memmove memset strerror strtol])
AC_CHECK_DECLS([htole64, le64toh],
[],
AC_CHECK_HEADER([sys/endian.h],
[
AC_CHECK_DECLS([htole64, le64toh], [], [], [#include <endian.h>])
AC_CHECK_DECLS([htole64, le64toh], [], [], [#define _GNU_SOURCE 1 #include <sys/endian.h>])
],
[#include <sys/endian.h>])
[], [])
AC_CHECK_HEADER([endian.h],
[
AC_CHECK_DECLS([htole64, le64toh], [], [], [#define _GNU_SOURCE 1 #include <endian.h>])
],
[], [])
AC_CONFIG_FILES([Makefile
src/Makefile

@ -15,6 +15,7 @@ void xle64enc(uint8_t *d, uint64_t n) {
#include <stdint.h>
#ifdef __linux__
#include <endian.h>
#include <byteswap.h>
#else
#include <sys/endian.h>
#endif
@ -23,7 +24,7 @@ void xle64enc(uint8_t *d, uint64_t n) {
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define htole64(x) (x)
# else
# define htole64(x) __bswap_64 (x)
# define htole64(x) bswap_64 (x)
# endif
#endif
@ -31,7 +32,7 @@ void xle64enc(uint8_t *d, uint64_t n) {
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define le64toh(x) (x)
# else
# define le64toh(x) __bswap_64 (x)
# define le64toh(x) bswap_64 (x)
# endif
#endif

Loading…
Cancel
Save