source: box/trunk/infrastructure/m4/ax_bswap64.m4 @ 2327

Revision 2327, 1.7 KB checked in by jamesog, 4 years ago (diff)

Update autoconf to silence warnings on autoconf >= 2.62

  • AC_SUBST now only works with one variable per call
  • When using AC_CACHE the variable must contain the string '_cv_', thus prefix all cache variables with box_cv_
Line 
1dnl @synopsis AX_BSWAP64
2dnl
3dnl This macro will check for a built in way of endian reversing an int64_t.
4dnl If one is found then HAVE_BSWAP64 is set to 1 and BSWAP64 will be defined
5dnl to the name of the endian swap function.
6dnl
7dnl @category C
8dnl @author Martin Ebourne
9dnl @version 2006/02/02
10dnl @license AllPermissive
11
12AC_DEFUN([AX_BSWAP64], [
13  bswap64_function=""
14  AC_CHECK_HEADERS([sys/endian.h asm/byteorder.h])
15  if test "x$ac_cv_header_sys_endian_h" = "xyes"; then
16    AC_CACHE_CHECK([for htobe64], [box_cv_have_htobe64],
17      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
18          $ac_includes_default
19          #include <sys/endian.h>
20          ]], [[
21          htobe64(0);
22          return 1;
23        ]])],
24        [box_cv_have_htobe64=yes], [box_cv_have_htobe64=no]
25      )])
26    if test "x$box_cv_have_htobe64" = "xyes"; then
27      bswap64_function=htobe64
28    fi
29  fi
30  if test "x$bswap64_function" = "x" && \
31     test "x$ac_cv_header_asm_byteorder_h" = "xyes"; then
32    AC_CACHE_CHECK([for __cpu_to_be64], [box_cv_have___cpu_to_be64],
33      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
34          $ac_includes_default
35          #include <asm/byteorder.h>
36          ]], [[
37          __cpu_to_be64(0);
38          return 1;
39        ]])],
40        [box_cv_have___cpu_to_be64=yes], [box_cv_have___cpu_to_be64=no]
41      )])
42    if test "x$box_cv_have___cpu_to_be64" = "xyes"; then
43      bswap64_function=__cpu_to_be64
44    fi
45  fi
46
47  if test "x$bswap64_function" != "x"; then
48    AC_DEFINE([HAVE_BSWAP64], 1,
49              [Define to 1 if BSWAP64 is defined to the name of a valid 64 bit endian swapping function])
50    AC_DEFINE_UNQUOTED([BSWAP64], [$bswap64_function], [Name of the 64 bit endian swapping function])
51  fi
52  ])dnl
Note: See TracBrowser for help on using the repository browser.