python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / skalibs / 0001-No-runtime-tests-for-endianness.patch
blob4390d449dd57cfdbd56edbad59948fb2c574f4e7
1 From 1e6f0b094c6ce6454be572704b866d2ce0962e59 Mon Sep 17 00:00:00 2001
2 From: Eric Le Bihan <eric.le.bihan.dev@free.fr>
3 Date: Sun, 4 Dec 2016 19:10:40 +0100
4 Subject: [PATCH] No runtime tests for endianness
6 Replace build and execution of runtime test programs for determining
7 the endianness of the target with compile time test programs.
9 This improves support for cross-compilation.
11 Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
12 ---
13 configure | 15 +++++++++++----
14 src/sysdeps/trybigendian.c | 16 ++++++++++++++++
15 src/sysdeps/trylittleendian.c | 16 ++++++++++++++++
16 3 files changed, 43 insertions(+), 4 deletions(-)
17 create mode 100644 src/sysdeps/trybigendian.c
18 create mode 100644 src/sysdeps/trylittleendian.c
20 diff --git a/configure b/configure
21 index 1579025..4da9c5e 100755
22 --- a/configure
23 +++ b/configure
24 @@ -463,13 +463,20 @@ EOF
26 exec 3>&-
28 - echo "Checking system endianness..."
29 - $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -o tryendianness src/sysdeps/tryendianness.c
30 - endianness=$(./tryendianness) || fail "$0: unable to determine endianness"
31 + echo "Checking system endianness..."
32 + if $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -o trybigendian src/sysdeps/trybigendian.c 2>/dev/null; then
33 + endianness=big
34 + else
35 + if $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -o trylittleendian src/sysdeps/trylittleendian.c 2>/dev/null; then
36 + endianness=little
37 + else
38 + fail "$0: unable to determine endianness"
39 + fi
40 + fi
41 echo "endianness: $endianness" >> $sysdeps/sysdeps
42 echo "#define ${package_macro_name}_ENDIANNESS \"$endianness\"" >> $sysdeps/sysdeps.h
43 echo " ... $endianness"
44 - rm -f tryendianness
45 + rm -f trybigendian trylittleendian
47 trytypesize ushort USHORT "unsigned short"
48 trytypesize uint UINT "unsigned int"
49 diff --git a/src/sysdeps/trybigendian.c b/src/sysdeps/trybigendian.c
50 new file mode 100644
51 index 0000000..d857572
52 --- /dev/null
53 +++ b/src/sysdeps/trybigendian.c
54 @@ -0,0 +1,16 @@
55 +#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) || \
56 + defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || \
57 + defined(__BIG_ENDIAN) || \
58 + defined(__ARMEB__) || \
59 + defined(__THUMBEB__) || \
60 + defined(__AARCH64EB__) || \
61 + defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
62 +#define YEAH
63 +#else
64 +#error "not big endian"
65 +#endif
67 +int main(void)
69 + return 0;
71 diff --git a/src/sysdeps/trylittleendian.c b/src/sysdeps/trylittleendian.c
72 new file mode 100644
73 index 0000000..eba065a
74 --- /dev/null
75 +++ b/src/sysdeps/trylittleendian.c
76 @@ -0,0 +1,16 @@
77 +#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) || \
78 + defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
79 + defined(__LITTLE_ENDIAN) || \
80 + defined(__ARMEL__) || \
81 + defined(__THUMBEL__) || \
82 + defined(__AARCH64EL__) || \
83 + defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
84 +#define YEAH
85 +#else
86 +#error "not little endian"
87 +#endif
89 +int main(void)
91 + return 0;
93 --
94 2.5.5