aboutsummaryrefslogtreecommitdiff
path: root/m4/clang.m4
diff options
context:
space:
mode:
authorRuss Allbery <rra@dropbox.com>2016-02-03 12:44:33 -0800
committerRuss Allbery <rra@dropbox.com>2016-02-03 12:44:33 -0800
commit2a53df4444cb8a931e82c584288025e315f40121 (patch)
tree7c8b9bfa69cf613a22ba6be616a0d3fdb4146e4e /m4/clang.m4
parent294d46a917b6aa3af305c3d50b8d83a1f3fb5694 (diff)
parente64d4e31146b87046916c377557f8ea789da3f0a (diff)
Merge branch 'debian/master' into ubuntu/precise
Diffstat (limited to 'm4/clang.m4')
-rw-r--r--m4/clang.m426
1 files changed, 26 insertions, 0 deletions
diff --git a/m4/clang.m4 b/m4/clang.m4
new file mode 100644
index 0000000..0659d82
--- /dev/null
+++ b/m4/clang.m4
@@ -0,0 +1,26 @@
+dnl Determine whether the current compiler is Clang.
+dnl
+dnl If the current compiler is Clang, set the shell variable CLANG to yes.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Copyright 2015 Russ Allbery <eagle@eyrie.org>
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+dnl Source used by RRA_PROG_CC_CLANG.
+AC_DEFUN([_RRA_PROG_CC_CLANG_SOURCE], [[
+#if ! __clang__
+#error
+#endif
+]])
+
+AC_DEFUN([RRA_PROG_CC_CLANG],
+[AC_CACHE_CHECK([if the compiler is Clang], [rra_cv_prog_cc_clang],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_PROG_CC_CLANG_SOURCE])],
+ [rra_cv_prog_cc_clang=yes],
+ [rra_cv_prog_cc_clang=no])])
+ AS_IF([test x"$rra_cv_prog_cc_clang" = xyes], [CLANG=yes])])