Dmitry V. Levin | 916aded | 2010-09-09 17:36:36 +0000 | [diff] [blame] | 1 | dnl ### A macro to determine endianness of long long |
| 2 | AC_DEFUN([AC_LITTLE_ENDIAN_LONG_LONG], |
| 3 | [AC_MSG_CHECKING(for little endian long long) |
| 4 | AC_CACHE_VAL(ac_cv_have_little_endian_long_long, |
| 5 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
| 6 | int main () { |
| 7 | union { |
| 8 | long long ll; |
| 9 | int l [2]; |
| 10 | } u; |
| 11 | u.ll = 0x12345678; |
| 12 | if (u.l[0] == 0x12345678) |
| 13 | return 0; |
| 14 | return 1; |
| 15 | } |
Mike Frysinger | 6d12afd | 2010-09-12 03:39:55 -0400 | [diff] [blame] | 16 | ]])],[ac_cv_have_little_endian_long_long=yes],[ac_cv_have_little_endian_long_long=no],[ |
| 17 | if test "x$ac_cv_c_bigendian" = "xyes"; then |
| 18 | ac_cv_have_little_endian_long_long=no |
| 19 | else |
| 20 | ac_cv_have_little_endian_long_long=yes |
| 21 | fi |
Dmitry V. Levin | 916aded | 2010-09-09 17:36:36 +0000 | [diff] [blame] | 22 | ])]) |
| 23 | AC_MSG_RESULT($ac_cv_have_little_endian_long_long) |
| 24 | if test "$ac_cv_have_little_endian_long_long" = yes |
| 25 | then |
| 26 | AC_DEFINE([HAVE_LITTLE_ENDIAN_LONG_LONG], 1, |
| 27 | [Define if long long is little-endian.]) |
| 28 | fi |
| 29 | ]) |