diff --git a/configure.ac b/configure.ac index 8f834a1..84f178f 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,8 @@ if test $ac_cv_header_endian_h = "no" -a $ac_cv_header_sys_endian_h = "no"; then AC_MSG_ERROR(["Can't locate header endian.h."]); fi +AC_CHECK_HEADERS([byteswap.h]) + AC_DEFINE([_XOPEN_SOURCE], [600], [Define to 500 if Single Unix conformance is wanted, 600 for sixth revision.]) CFLAGS="$CFLAGS -std=c99" diff --git a/libfreefare/freefare_internal.h b/libfreefare/freefare_internal.h index 4a9f5f8..4abe4f2 100644 --- a/libfreefare/freefare_internal.h +++ b/libfreefare/freefare_internal.h @@ -20,8 +20,11 @@ #ifndef __FREEFARE_INTERNAL_H__ #define __FREEFARE_INTERNAL_H__ +#include "config.h" + +#if defined(HAVE_BYTESWAP_H) +#include #if !defined(le32toh) || !defined(htole32) - #include #if BYTE_ORDER == LITTLE_ENDIAN #define le32toh(x) (x) #define htole32(x) bswap_32(x) @@ -30,6 +33,7 @@ #define htole32(x) (x) #endif #endif +#endif struct mad_sector_0x00;