summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorRalph Giles <giles@thaumas.net>2014-11-04 11:57:28 -0800
committerErik de Castro Lopo <erikd@mega-nerd.com>2014-11-04 21:18:48 -0800
commit1f30b3e7117bb41fbb9dc61fb345f1321f9e0330 (patch)
treee34a211118b973024e687d517e8f56a4d28a149a /m4
parente0fbe7193569badcbcd72f33fd39e9e31b55ecf0 (diff)
downloadflac-1f30b3e7117bb41fbb9dc61fb345f1321f9e0330.tar.gz
Add autoconf macro to check for the bswap16 intrinsic.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/bswap.m429
1 files changed, 28 insertions, 1 deletions
diff --git a/m4/bswap.m4 b/m4/bswap.m4
index 926f820e..72af3333 100644
--- a/m4/bswap.m4
+++ b/m4/bswap.m4
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2012 Xiph.org Foundation
+dnl Copyright (C) 2012-2014 Xiph.org Foundation
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
@@ -53,3 +53,30 @@ AC_DEFUN([XIPH_C_BSWAP32],
)]
)# XIPH_C_BSWAP32
+
+
+dnl @synopsis XIPH_C_BSWAP16
+dnl
+dnl @author Erik de Castro Lopo <erikd@mega-nerd.com>
+dnl
+dnl Dtermine whether the compiler has the __builtin_bswap16() intrinsic which
+dnl is likely to be present for most versions of GCC as well as Clang.
+
+AC_DEFUN([XIPH_C_BSWAP16],
+[AC_CACHE_CHECK(for bswap16 instrinsic,
+ ac_cv_c_bswap16,
+
+ # Initialize to no
+ ac_cv_c_bswap16=no
+ HAVE_BSWAP16=0
+
+ [AC_TRY_LINK([],
+ return __builtin_bswap16 (0) ;,
+ ac_cv_c_bswap16=yes
+ HAVE_BSWAP16=1
+ )]
+ AC_DEFINE_UNQUOTED(HAVE_BSWAP16, ${HAVE_BSWAP16},
+ [Compiler has the __builtin_bswap16 intrinsic])
+
+ )]
+)# XIPH_C_BSWAP16