1dnl Copyright (C) 2012-2014 Xiph.org Foundation
2dnl
3dnl Redistribution and use in source and binary forms, with or without
4dnl modification, are permitted provided that the following conditions
5dnl are met:
6dnl
7dnl - Redistributions of source code must retain the above copyright
8dnl notice, this list of conditions and the following disclaimer.
9dnl
10dnl - Redistributions in binary form must reproduce the above copyright
11dnl notice, this list of conditions and the following disclaimer in the
12dnl documentation and/or other materials provided with the distribution.
13dnl
14dnl - Neither the name of the Xiph.org Foundation nor the names of its
15dnl contributors may be used to endorse or promote products derived from
16dnl this software without specific prior written permission.
17dnl
18dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19dnl ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21dnl A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
22dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30
31dnl @synopsis XIPH_C_BSWAP32
32dnl
33dnl @author Erik de Castro Lopo <erikd@mega-nerd.com>
34dnl
35dnl Dtermine whether the compiler has the __builtin_bswap32() intrinsic which
36dnl is likely to be present for most versions of GCC as well as Clang.
37
38AC_DEFUN([XIPH_C_BSWAP32],
39[AC_CACHE_CHECK(for bswap32 intrinsic,
40  ac_cv_c_bswap32,
41
42  # Initialize to no
43  ac_cv_c_bswap32=no
44  HAVE_BSWAP32=0
45
46  [AC_TRY_LINK([],
47    return __builtin_bswap32 (0) ;,
48    ac_cv_c_bswap32=yes
49    HAVE_BSWAP32=1
50  )]
51  AC_DEFINE_UNQUOTED(HAVE_BSWAP32, ${HAVE_BSWAP32},
52    [Compiler has the __builtin_bswap32 intrinsic])
53
54  )]
55)# XIPH_C_BSWAP32
56
57
58dnl @synopsis XIPH_C_BSWAP16
59dnl
60dnl @author Erik de Castro Lopo <erikd@mega-nerd.com>
61dnl
62dnl Dtermine whether the compiler has the __builtin_bswap16() intrinsic which
63dnl is likely to be present for most versions of GCC as well as Clang.
64
65AC_DEFUN([XIPH_C_BSWAP16],
66[AC_CACHE_CHECK(for bswap16 intrinsic,
67  ac_cv_c_bswap16,
68
69  # Initialize to no
70  ac_cv_c_bswap16=no
71  HAVE_BSWAP16=0
72
73  [AC_TRY_LINK([],
74    return __builtin_bswap16 (0) ;,
75    ac_cv_c_bswap16=yes
76    HAVE_BSWAP16=1
77  )]
78  AC_DEFINE_UNQUOTED(HAVE_BSWAP16, ${HAVE_BSWAP16},
79    [Compiler has the __builtin_bswap16 intrinsic])
80
81  )]
82)# XIPH_C_BSWAP16
83