aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/target/samba-gplv3/configureEndian.patch
blob: 999b71836989fec38101fbb23f09c8e63f4eb297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- a/lib/ccan/libccan.m4
+++ b/lib/ccan/libccan.m4
@@ -121,16 +121,9 @@
 	     [whether we can compile with __attribute__((used))])
 fi
 
-# FIXME: We could use endian.h or sys/endian.h here, and __BYTE_ORDER for
-# cross-compiling.
-AC_CACHE_CHECK([whether we are big endian],samba_cv_big_endian,[
-AC_TRY_RUN([int main(void) {
-union { int i; char c[sizeof(int)]; } u;
-	  u.i = 0x01020304;
-	  return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;
-}],
-samba_cv_big_endian=yes,
-samba_cv_big_endian=no)])
+AC_C_BIGENDIAN(
+	samba_cv_big_endian=yes,
+	samba_cv_big_endian=no)
 if test x"$samba_cv_big_endian" = xyes ; then
    AC_DEFINE(HAVE_BIG_ENDIAN, 1,
 	     [whether we are big endian])
@@ -300,16 +293,9 @@
 	     [whether we have isblank])
 fi
 
-# FIXME: We could use endian.h or sys/endian.h here, and __BYTE_ORDER for
-# cross-compiling.
-AC_CACHE_CHECK([whether we are little endian],samba_cv_little_endian,[
-AC_TRY_RUN([int main(void) {
-union { int i; char c[sizeof(int)]; } u;
-	  u.i = 0x01020304;
-	  return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;
-}],
-samba_cv_little_endian=yes,
-samba_cv_little_endian=no)])
+AC_C_BIGENDIAN(
+	samba_cv_little_endian=no,
+	samba_cv_little_endian=yes)
 if test x"$samba_cv_little_endian" = xyes ; then
    AC_DEFINE(HAVE_LITTLE_ENDIAN, 1,
 	     [whether we are little endian])