direct3d11: fix the bits per channel
[vlc.git] / m4 / c11.m4
blob228860280561943811fac131726621965fdff519
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
9 # PARTICULAR PURPOSE.
12 AC_DEFUN([VLC_PROG_CC_C11], [
13   AC_LANG_ASSERT(C)
15     for opt in "" -std=gnu11 -std=c11 -c11
16     do
17       cachevar=AS_TR_SH([ax_cv_c_compile_c11_$opt])
18       AC_CACHE_CHECK([whether $CC $opt supports C11], [$cachevar], [
19         CFLAGS_save="$CFLAGS"
20         CFLAGS="$CFLAGS $opt"
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!
25 #endif
26 #if (__STDC_VERSION__ < 201112L)
27 # error Too old C compiler!
28 #endif
29 _Static_assert(1, "Not C11!");
30 const int varname = _Generic(1, int: 1, default: 0);
31 ]])], [
32           eval $cachevar="yes"
33         ], [
34           eval $cachevar="no"
35         ])
36         CFLAGS="$CFLAGS_save"
37       ])
38       if eval test "\$$cachevar" = "yes"
39       then
40         CFLAGS="$CFLAGS $opt"
41         break
42       fi
43     done