about summary refs log tree commit diff
path: root/configure
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-12-13 08:39:23 +0000
committerLaurent Bercot <ska@appnovation.com>2023-12-13 08:39:23 +0000
commit65ee731b75c4fc24b2a73b32cc081704fc0b6063 (patch)
tree1c1c0be50841d271de95d389f3eec4d64c73e71c /configure
parent370bdd3c5739aa8d94753e841aecf71fa04d9400 (diff)
downloadskalibs-65ee731b75c4fc24b2a73b32cc081704fc0b6063.tar.gz
skalibs-65ee731b75c4fc24b2a73b32cc081704fc0b6063.tar.xz
skalibs-65ee731b75c4fc24b2a73b32cc081704fc0b6063.zip
Better endianness detection for Solaris
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure18
1 files changed, 16 insertions, 2 deletions
diff --git a/configure b/configure
index 823899a..db92f46 100755
--- a/configure
+++ b/configure
@@ -196,7 +196,7 @@ trybasic () {
 tryendianness () {
   echo "Checking endianness..."
   if iscached endianness ; then return ; fi
-  for i in endian.h sys/endian.h machine/endian.h arpa/nameser_compat.h ; do
+  for i in endian.h sys/endian.h machine/endian.h ; do
     cat > "$tmpc" <<EOF
 #undef _POSIX_C_SOURCE
 #undef _XOPEN_SOURCE
@@ -216,7 +216,7 @@ int c = BYTE_ORDER ;
 EOF
     trybasic "$tmpc" || continue
     for j in little big pdp ; do
-      k=`echo $j | tr a-z A-Z`
+      k=`echo $j | tr '[:lower:]' '[:upper:]'`
       cat > "$tmpc" <<EOF
 #undef _POSIX_C_SOURCE
 #undef _XOPEN_SOURCE
@@ -242,6 +242,20 @@ EOF
     rm -f "$tmpc"
     fail "$0: error: unable to determine endianness according to $i"
   done
+
+  for j in little big ; do
+    k=`echo $j | tr '[:lower:]' '[:upper:]'`
+    cat > "$tmpc" <<EOF
+#include <sys/isa_defs.h>
+int a = _${k}_ENDIAN ;
+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: no suitable endian.h found"
 }