endianess 800 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright (C) Igor Sysoev
  2. echo $ngx_n "checking for system endianess ...$ngx_c"
  3. echo >> $NGX_ERR
  4. echo "checking for system endianess" >> $NGX_ERR
  5. cat << END > $NGX_AUTOTEST.c
  6. int main() {
  7. int i = 0x11223344;
  8. char *p;
  9. p = (char *) &i;
  10. if (*p == 0x44) return 0;
  11. return 1;
  12. }
  13. END
  14. ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
  15. -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
  16. eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
  17. if [ -x $NGX_AUTOTEST ]; then
  18. if $NGX_AUTOTEST >/dev/null 2>&1; then
  19. echo " little endianess"
  20. have=NGX_HAVE_LITTLE_ENDIAN . auto/have
  21. else
  22. echo " big endianess"
  23. fi
  24. rm $NGX_AUTOTEST*
  25. else
  26. rm $NGX_AUTOTEST*
  27. echo
  28. echo "$0: error: can not detect system endianess"
  29. exit 1
  30. fi