summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJonathan Lennox <jonathan@vidyo.com>2015-08-03 17:04:20 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2015-09-01 17:21:31 -0400
commitb4aa5dc858c905d9b09e70794584c44f7f4d2f7a (patch)
tree51e9425b9ffb925071d92f43e511f6856a604476 /m4
parent56d850412a2fc40bedb162de5e4b506bda2a5f4e (diff)
downloadopus-b4aa5dc858c905d9b09e70794584c44f7f4d2f7a.tar.gz
Reorganize configure's detection of intrinsics functions:
Actually try to compile intrinsics rather than using the output of --help. Allow caller of configure script to set custom compiler options to enable intrinsics. Detect when intrinsics are always available, without needing special compiler options. Make naming of #defines for detected intrinsics support more systematic.
Diffstat (limited to 'm4')
-rw-r--r--m4/opus-intrinsics.m429
1 files changed, 29 insertions, 0 deletions
diff --git a/m4/opus-intrinsics.m4 b/m4/opus-intrinsics.m4
new file mode 100644
index 00000000..b93ddd38
--- /dev/null
+++ b/m4/opus-intrinsics.m4
@@ -0,0 +1,29 @@
+dnl opus-intrinsics.m4
+dnl macro for testing for support for compiler intrinsics, either by default or with a compiler flag
+
+dnl OPUS_CHECK_INTRINSICS(NAME-OF-INTRINSICS, COMPILER-FLAG-FOR-INTRINSICS, VAR-IF-PRESENT, VAR-IF-DEFAULT, TEST-PROGRAM-HEADER, TEST-PROGRAM-BODY)
+AC_DEFUN([OPUS_CHECK_INTRINSICS],
+[
+ AC_MSG_CHECKING([if compiler supports $1 intrinsics])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM($5, $6)],
+ [
+ $3=1
+ $4=1
+ AC_MSG_RESULT([yes])
+ ],[
+ $4=0
+ AC_MSG_RESULT([no])
+ AC_MSG_CHECKING([if compiler supports $1 intrinsics with $2])
+ save_CFLAGS="$CFLAGS"; CFLAGS="$2 $CFLAGS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM($5, $6)],
+ [
+ AC_MSG_RESULT([yes])
+ $3=1
+ ],[
+ AC_MSG_RESULT([no])
+ $3=0
+ ])
+ CFLAGS="$save_CFLAGS"
+ ])
+])