freebsd-ports/audio/gramofile/files/post-patch-bplay.c
Shaun Amott aa91eaa570 Fix build on sparc64.
PR:		ports/106168
Submitted by:	Juergen Lock <nox@jelal.kn-bremen.de> (maintainer)
2006-12-09 21:29:37 +00:00

32 lines
727 B
C

Index: bplaysrc/bplay.c
@@ -33,23 +33,30 @@
/* Needed for BYTE_ORDER and BIG/LITTLE_ENDIAN macros. */
#ifndef _BSD_SOURCE
# define _BSD_SOURCE
-# include <endian.h>
+# include <sys/endian.h>
# undef _BSD_SOURCE
#else
# include <endian.h>
#endif
#include <sys/types.h>
+#ifndef __FreeBSD__
#include <byteswap.h>
+#endif
/* Adapted from the byteorder macros in the Linux kernel. */
#if BYTE_ORDER == LITTLE_ENDIAN
#define cpu_to_le32(x) (x)
#define cpu_to_le16(x) (x)
#else
+#ifdef __FreeBSD__
+#define cpu_to_le32(x) bswap32((x))
+#define cpu_to_le16(x) bswap16((x))
+#else
#define cpu_to_le32(x) bswap_32((x))
#define cpu_to_le16(x) bswap_16((x))
+#endif
#endif
#define le32_to_cpu(x) cpu_to_le32((x))