summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-10-26 07:10:33 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-10-26 07:10:33 +0000
commitd6169d90477a1b467545408f4ea9570ed4f36bf9 (patch)
tree9d3e5542cedeccd167e4a9f7a8301df6780e8ceb
parent28bfd386f2e8046c7b1cfb4b796ea1347e6a42b0 (diff)
downloadskalibs-d6169d90477a1b467545408f4ea9570ed4f36bf9.tar.xz
Simplify endianness test
-rwxr-xr-xconfigure45
1 files changed, 14 insertions, 31 deletions
diff --git a/configure b/configure
index 189a047..13c460b 100755
--- a/configure
+++ b/configure
@@ -203,30 +203,14 @@ tryendianness () {
#define _DEFAULT_SOURCE
#endif
#include <$i>
-int a = 1 ;
-EOF
- if trybasic "$tmpc" ; then
- cat > "$tmpc" <<EOF
-#undef _POSIX_C_SOURCE
-#undef _XOPEN_SOURCE
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#ifndef _DEFAULT_SOURCE
-#define _DEFAULT_SOURCE
-#endif
-#include <$i>
int a = LITTLE_ENDIAN ;
int b = BIG_ENDIAN ;
int c = BYTE_ORDER ;
EOF
- trybasic "$tmpc" || continue
- for j in little big pdp ; do
- k=`echo $j | tr a-z A-Z`
- cat > "$tmpc" <<EOF
+ trybasic "$tmpc" || continue
+ for j in little big pdp ; do
+ k=`echo $j | tr a-z A-Z`
+ cat > "$tmpc" <<EOF
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
#ifndef _BSD_SOURCE
@@ -241,19 +225,18 @@ EOF
#include <$i>
int a[BYTE_ORDER == ${k}_ENDIAN ? 1 : -1] ;
EOF
- if trybasic "$tmpc" ; then
- echo "endianness: $j" >> "$sysdeps/sysdeps"
- echo " ... $j"
- rm -f "$tmpc"
- return
- fi
- done
- rm -f "$tmpc"
- fail "$0: error: unable to determine endianness according to $i"
- fi
+ if trybasic "$tmpc" ; then
+ echo "endianness: $j" >> "$sysdeps/sysdeps"
+ echo " ... $j"
+ rm -f "$tmpc"
+ return
+ fi
+ done
+ rm -f "$tmpc"
+ fail "$0: error: unable to determine endianness according to $i"
done
rm -f "$tmpc"
- fail "$0: error: unable to determine endianness: no endian.h found"
+ fail "$0: error: unable to determine endianness: no suitable endian.h found"
}
trysigned () {