summaryrefslogtreecommitdiff
path: root/m4/clang.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/clang.m4')
-rw-r--r--m4/clang.m419
1 files changed, 19 insertions, 0 deletions
diff --git a/m4/clang.m4 b/m4/clang.m4
new file mode 100644
index 00000000..11911ce2
--- /dev/null
+++ b/m4/clang.m4
@@ -0,0 +1,19 @@
+# _AC_LANG_COMPILER_CLANG
+# ---------------------
+# Check whether the compiler for the current language is clang.
+# Adapted from standard autoconf function: _AC_LANG_COMPILER_GNU
+#
+# Note: clang also identifies itself as a GNU compiler (gcc 4.2.1)
+# for compatibility reasons, so that cannot be used to determine
+m4_define([_AC_LANG_COMPILER_CLANG],
+[AC_CACHE_CHECK([whether we are using the clang _AC_LANG compiler],
+ [ac_cv_[]_AC_LANG_ABBREV[]_compiler_clang],
+[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __clang__
+ choke me
+#endif
+]])],
+ [ac_compiler_clang=yes],
+ [ac_compiler_clang=no])
+ac_cv_[]_AC_LANG_ABBREV[]_compiler_clang=$ac_compiler_clang
+])])# _AC_LANG_COMPILER_CLANG
+