1 # wm_prog_cc_c11.m4 - Macros to see if compiler may support STD C11
3 # Copyright (c) 2013 Christophe CURIS
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 # ---------------------
22 # Check if the compiler supports C11 standard natively, or if any
23 # option may help enabling the support
24 # This is (in concept) similar to AC_PROG_CC_C11, which is unfortunately
25 # not yet available in autotools; as a side effect we only check for
26 # compiler's acknowledgement and a few features instead of full support
27 AC_DEFUN_ONCE([WM_PROG_CC_C11],
28 [AC_CACHE_CHECK([for C11 standard support], [wm_cv_prog_cc_c11],
30 wm_save_CFLAGS="$CFLAGS"
35 CFLAGS="$wm_save_CFLAGS `echo $wm_arg | sed -e 's,%.*,,' `"
37 [AC_LANG_PROGRAM([], [dnl
38 #if __STDC_VERSION__ < 201112L
39 fail_because_stdc_version_is_older_than_C11;
42 [wm_cv_prog_cc_c11="`echo $wm_arg | sed -e 's,.*% *,,' `" ; break])
44 CFLAGS="$wm_save_CFLAGS"])
45 AS_CASE([$wm_cv_prog_cc_c11],
47 [CFLAGS="$CFLAGS $wm_cv_prog_cc_c11"])