8 # Checks for tuklib_integer.h:
10 # - Does operating system provide byte swapping macros
11 # - Does the hardware support fast unaligned access to 16-bit
16 # Author: Lasse Collin
18 # This file has been put into the public domain.
19 # You can do whatever you want with this file.
22 AC_DEFUN_ONCE([TUKLIB_INTEGER], [
23 AC_REQUIRE([TUKLIB_COMMON])
24 AC_REQUIRE([AC_C_BIGENDIAN])
25 AC_CHECK_HEADERS([byteswap.h sys/endian.h sys/byteorder.h], [break])
27 # Even if we have byteswap.h, we may lack the specific macros/functions.
28 if test x$ac_cv_header_byteswap_h = xyes ; then
29 m4_foreach([FUNC], [bswap_16,bswap_32,bswap_64], [
30 AC_MSG_CHECKING([if FUNC is available])
31 AC_LINK_IFELSE([AC_LANG_SOURCE([
40 AC_DEFINE(HAVE_[]m4_toupper(FUNC), [1],
41 [Define to 1 if] FUNC [is available.])
43 ], [AC_MSG_RESULT([no])])
48 AC_MSG_CHECKING([if unaligned memory access should be used])
49 AC_ARG_ENABLE([unaligned-access], AC_HELP_STRING([--enable-unaligned-access],
50 [Enable if the system supports *fast* unaligned memory access
51 with 16-bit and 32-bit integers. By default, this is enabled
52 only on x86, x86_64, and big endian PowerPC.]),
53 [], [enable_unaligned_access=auto])
54 if test "x$enable_unaligned_access" = xauto ; then
55 # TODO: There may be other architectures, on which unaligned access
58 i?86|x86_64|powerpc|powerpc64)
59 enable_unaligned_access=yes
62 enable_unaligned_access=no
66 if test "x$enable_unaligned_access" = xyes ; then
67 AC_DEFINE([TUKLIB_FAST_UNALIGNED_ACCESS], [1], [Define to 1 if
68 the system supports fast unaligned access to 16-bit and