[PATCH 4/7] Add m4 macro to check for C __attribute__ features

Anton Blanchard <[email protected]>
Newsgroups gmane.comp.audio.compression.flac.devel
Message-ID <[email protected]>
From: Amitay Isaacs <[email protected]>

Signed-off-by: Amitay Isaacs <[email protected]>
---
 m4/c_attribute.m4 | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 m4/c_attribute.m4

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
-- 
2.17.1

_______________________________________________
flac-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/flac-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.