1 # Copyright © 2015 Rémi Denis-Courmont
2 # This file (c11.m4) is free software; unlimited permission to
3 # copy and/or distribute it , with or without modifications, as long
4 # as this notice is preserved.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
8 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 AC_DEFUN([VLC_PROG_CC_C11], [
15 for opt in "" -std=gnu11 -std=c11 -c11
17 cachevar=AS_TR_SH([ax_cv_c_compile_c11_$opt])
18 AC_CACHE_CHECK([whether $CC $opt supports C11], [$cachevar], [
21 dnl PREPROC is not enough due to CFLAGS usage
22 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
23 [#ifndef __STDC_VERSION__
24 # error Not a C compiler!
26 #if (__STDC_VERSION__ < 201112L)
27 # error Too old C compiler!
29 _Static_assert(1, "Not C11!");
30 const int varname = _Generic(1, int: 1, default: 0);
38 if eval test "\$$cachevar" = "yes"