endianess 828 B

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