File: c11.m4

package info (click to toggle)
vlc 3.0.22-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 208,324 kB
  • sloc: ansic: 443,399; cpp: 111,127; objc: 36,399; sh: 6,737; makefile: 6,623; javascript: 4,902; xml: 1,611; asm: 1,355; yacc: 644; python: 321; lex: 88; perl: 77; sed: 16
file content (44 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright © 2015 Rémi Denis-Courmont
# This file (c11.m4) is free software; unlimited permission to
# copy and/or distribute it , with or without modifications, as long
# as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.


AC_DEFUN([VLC_PROG_CC_C11], [
  AC_LANG_ASSERT(C)

    for opt in "" -std=gnu11 -std=c11 -c11
    do
      cachevar=AS_TR_SH([ax_cv_c_compile_c11_$opt])
      AC_CACHE_CHECK([whether $CC $opt supports C11], [$cachevar], [
        CFLAGS_save="$CFLAGS"
        CFLAGS="$CFLAGS $opt"
        dnl PREPROC is not enough due to CFLAGS usage
        AC_COMPILE_IFELSE([AC_LANG_SOURCE([
[#ifndef __STDC_VERSION__
# error Not a C compiler!
#endif
#if (__STDC_VERSION__ < 201112L)
# error Too old C compiler!
#endif
_Static_assert(1, "Not C11!");
const int varname = _Generic(1, int: 1, default: 0);
]])], [
          eval $cachevar="yes"
        ], [
          eval $cachevar="no"
        ])
        CFLAGS="$CFLAGS_save"
      ])
      if eval test "\$$cachevar" = "yes"
      then
        CFLAGS="$CFLAGS $opt"
        break
      fi
    done
])