freebsd-ports/lang/moscow_ml/files/patch-config::auto_aux::endian.c
Pav Lucistnik cece986586 - Fix build on sparc64: rework endianness autodetection
PR:		ports/76828
Submitted by:	Johan van Selst <johans@stack.nl>
2005-01-30 13:30:53 +00:00

22 lines
437 B
C

--- config/auto-aux/endian.c.orig Fri Jan 21 11:07:13 2000
+++ config/auto-aux/endian.c Sat Jan 29 21:40:20 2005
@@ -1,3 +1,5 @@
+#include <sys/endian.h>
+
main()
{
long n[2];
@@ -6,9 +8,11 @@
n[0] = 0x41424344;
n[1] = 0;
p = (char *) n;
- if (strcmp(p, "ABCD") == 0)
+#if BYTE_ORDER == BIG_ENDIAN
exit(0);
- if (strcmp(p, "DCBA") == 0)
+#elif BYTE_ORDER == LITTLE_ENDIAN
exit(1);
+#else
exit(2);
+#endif
}