Rework byteswap.h inclusion.
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.
This commit is contained in:
parent
8b2de449c7
commit
62ddf57c53
2 changed files with 7 additions and 1 deletions
|
@ -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"
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
#ifndef __FREEFARE_INTERNAL_H__
|
||||
#define __FREEFARE_INTERNAL_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_BYTESWAP_H)
|
||||
#include <byteswap.h>
|
||||
#if !defined(le32toh) || !defined(htole32)
|
||||
#include <byteswap.h>
|
||||
#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;
|
||||
|
|
Loading…
Reference in a new issue