summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@ozlabs.org>2018-07-10 14:38:50 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2018-08-20 18:16:34 +1000
commit08d9d985daf51644755c77185996501c1b386574 (patch)
tree37b0c3b95a83511ee77943ad511d81b6627c9d10
parentf301518c5288d495cff463ec7f1e3972918f285b (diff)
downloadflac-08d9d985daf51644755c77185996501c1b386574.tar.gz
Add m4 macro to check for C __attribute__ features
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
-rw-r--r--m4/c_attribute.m418
1 files changed, 18 insertions, 0 deletions
diff --git a/m4/c_attribute.m4 b/m4/c_attribute.m4
new file mode 100644
index 00000000..48aa6223
--- /dev/null
+++ b/m4/c_attribute.m4
@@ -0,0 +1,18 @@
+#
+# Check for supported __attribute__ features
+#
+# AC_C_ATTRIBUTE(FEATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+AC_DEFUN([AC_C_ATTRIBUTE],
+[AS_VAR_PUSHDEF([CACHEVAR], [ax_cv_c_attribute_$1])dnl
+AC_CACHE_CHECK([for __attribute__ (($1))],
+ CACHEVAR,[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+ [[ void foo(void) __attribute__ (($1)); ]])],
+ [AS_VAR_SET(CACHEVAR, [yes])],
+ [AS_VAR_SET(CACHEVAR, [no])])])
+AS_VAR_IF(CACHEVAR,yes,
+ [m4_default([$2], :)],
+ [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl