xref: /freebsd/contrib/pam-krb5/m4/clang.m4 (revision 7e97c6adffde3bd6f60f042ed2603335c005c6a7)
1dnl Determine whether the current compiler is Clang.
2dnl
3dnl If the current compiler is Clang, set the shell variable CLANG to yes.
4dnl
5dnl The canonical version of this file is maintained in the rra-c-util
6dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
7dnl
8dnl Copyright 2015 Russ Allbery <eagle@eyrie.org>
9dnl
10dnl This file is free software; the authors give unlimited permission to copy
11dnl and/or distribute it, with or without modifications, as long as this
12dnl notice is preserved.
13dnl
14dnl SPDX-License-Identifier: FSFULLR
15
16dnl Source used by RRA_PROG_CC_CLANG.
17AC_DEFUN([_RRA_PROG_CC_CLANG_SOURCE], [[
18#if ! __clang__
19#error
20#endif
21]])
22
23AC_DEFUN([RRA_PROG_CC_CLANG],
24[AC_CACHE_CHECK([if the compiler is Clang], [rra_cv_prog_cc_clang],
25    [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_PROG_CC_CLANG_SOURCE])],
26        [rra_cv_prog_cc_clang=yes],
27        [rra_cv_prog_cc_clang=no])])
28 AS_IF([test x"$rra_cv_prog_cc_clang" = xyes], [CLANG=yes])])
29