author | Olivier Brunel
<jjk@jjacky.com> 2023-02-28 19:06:16 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-02-28 19:06:16 UTC |
parent | 18795956546aeceb944cfd49e3d7a58c29ba4e59 |
configure | +19 | -3 |
diff --git a/configure b/configure index c49710e..870dd9d 100755 --- a/configure +++ b/configure @@ -375,6 +375,7 @@ trycmd AR "ar" trycmd RANLIB "$RANLIB" trycmd RANLIB "ranlib" +ENDIAN=0 if test $has_skalibs -eq 1; then echo " => Checking sysdeps... $sysdeps" echon " -> Checking target.." @@ -386,12 +387,22 @@ if test $has_skalibs -eq 1; then *x86_64*) BITS=64 ;; esac echo ".. $target [${BITS}bit]" - if test ! -d $sysdeps || test ! -f $sysdeps/target; then + if test ! -d "$sysdeps" || test ! -f "$sysdeps/target"; then error 2 "$sysdeps is not a valid sysdeps directory" fi - if test "x$target" != "x$(cat $sysdeps/target)"; then - error 2 "target $target does not match the contents of $sysdeps/target ($(cat $sysdeps/target))" + if test "x$target" != "x$(cat "$sysdeps/target")"; then + error 2 "target $target does not match the contents of $sysdeps/target ($(cat "$sysdeps/target"))" fi + + echon " -> Checking endianness.." + case "$(grep ^endianness: "$sysdeps/sysdeps" | cut -d' ' -f2)" in + little) ENDIAN=LITTLE; echo ".. little" ;; + big) ENDIAN=BIG; echo ".. big" ;; + pdp) ENDIAN=PDP; echo ".. pdp" ;; + *) echo ".. unsupported"; + error 2 "unsupported endianness ($(grep ^endianness: "$sysdeps/sysdeps"))" + ;; + esac fi echo " => Testing C compiler..." @@ -603,6 +614,11 @@ cat <<EOF #define ${prefix}_SHAREDIR "$sharedir/$name" $CVARS +#define ${prefix}_LITTLE 1234 +#define ${prefix}_BIG 4321 +#define ${prefix}_PDP 3412 +#define ${prefix}_ENDIAN ${prefix}_$ENDIAN + #endif /* ${prefix}_CONFIG_H */ EOF