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

Revision 2327, 2.2 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_
  • Property svn:eol-style set to native
Line 
1dnl @synopsis AX_CHECK_NONALIGNED_ACCESS
2dnl
3dnl This macro will see if non-aligned memory accesses will fail. The following
4dnl defines will be made as appropriate:
5dnl HAVE_ALIGNED_ONLY_INT16
6dnl HAVE_ALIGNED_ONLY_INT32
7dnl HAVE_ALIGNED_ONLY_INT64
8dnl
9dnl @category C
10dnl @author Martin Ebourne
11dnl @version 2005/07/12
12dnl @license AllPermissive
13
14AC_DEFUN([AX_CHECK_NONALIGNED_ACCESS], [
15  AC_CACHE_CHECK([if non-aligned 16 bit word accesses fail], [box_cv_have_aligned_only_int16],
16    [AC_RUN_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default]], [[
17        #ifndef HAVE_UINT16_T
18          #define uint16_t u_int16_t;
19        #endif
20        uint16_t scratch[2];
21        memset(scratch, 0, sizeof(scratch));
22        return *(uint16_t*)((char*)scratch+1);
23      ]])],
24      [box_cv_have_aligned_only_int16=no], [box_cv_have_aligned_only_int16=yes]
25    )])
26  if test "x$box_cv_have_aligned_only_int16" = "xyes"; then
27    AC_DEFINE([HAVE_ALIGNED_ONLY_INT16], 1, [Define to 1 if non-aligned int16 access will fail])
28  fi
29  AC_CACHE_CHECK([if non-aligned 32 bit word accesses fail], [box_cv_have_aligned_only_int32],
30    [AC_RUN_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default]], [[
31        #ifndef HAVE_UINT32_T
32          #define uint32_t u_int32_t;
33        #endif
34        uint32_t scratch[2];
35        memset(scratch, 0, sizeof(scratch));
36        return *(uint32_t*)((char*)scratch+1);
37      ]])],
38      [box_cv_have_aligned_only_int32=no], [box_cv_have_aligned_only_int32=yes]
39    )])
40  if test "x$box_cv_have_aligned_only_int32" = "xyes"; then
41    AC_DEFINE([HAVE_ALIGNED_ONLY_INT32], 1, [Define to 1 if non-aligned int32 access will fail])
42  fi
43  AC_CACHE_CHECK([if non-aligned 64 bit word accesses fail], [box_cv_have_aligned_only_int64],
44    [AC_RUN_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default]], [[
45        #ifndef HAVE_UINT64_T
46          #define uint64_t u_int64_t;
47        #endif
48        uint64_t scratch[2];
49        memset(scratch, 0, sizeof(scratch));
50        return *(uint64_t*)((char*)scratch+1);
51      ]])],
52      [box_cv_have_aligned_only_int64=no], [box_cv_have_aligned_only_int64=yes]
53    )])
54  if test "x$box_cv_have_aligned_only_int64" = "xyes"; then
55    AC_DEFINE([HAVE_ALIGNED_ONLY_INT64], 1, [Define to 1 if non-aligned int64 access will fail])
56  fi
57  ])dnl
Note: See TracBrowser for help on using the repository browser.