bswap.m4 2.8 KB

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