emboss/siphash-c

Compilation fails on FreeBSD

Opened this issue · 2 comments

fasf commented

endian.h is specific to glibc, you shouldn't try to include it unless GLIBC is defined.
I suggest doing hardware check, f.e. like
https://code.google.com/p/xxhash/source/browse/trunk/xxhash.c
and if it fails, do it in endianess-neutral way (and drop a warning).

Sorry for my late response! You're right, some changes addressing this issue were made in the version that is being used in Ruby now - I should backport those!

fasf commented

Not sure if you did the backport already, but it doesn't work.

#ifdef _WIN32
  #define BYTE_ORDER __LITTLE_ENDIAN
#elif defined BYTE_ORDER
/* do nothing */
#elif defined(__GLIBC__)
  #include <endian.h>
#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__minix)
  #include <sys/endian.h>
#endif#ifdef _WIN32
  #define BYTE_ORDER __LITTLE_ENDIAN
#elif defined BYTE_ORDER
/* do nothing */
#elif defined(__GLIBC__)
  #include <endian.h>
#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__minix)
  #include <sys/endian.h>
#endif

does.