[FFmpeg-devel] [PATCH] configure: Check build with some header not just preprocessing for testing --std=c11

Moritz Barsnick barsnick at gmx.net
Fri Dec 30 03:15:55 EET 2016

On Thu, Dec 29, 2016 at 11:06:12 +0100, Michael Niedermayer wrote:
> On Thu, Dec 29, 2016 at 12:12:13AM -0300, James Almer wrote:
> > On 12/28/2016 7:41 PM, Michael Niedermayer wrote:
> > > Fixes build failure on FreeBSD with gcc 4.7
> > 
> > Does this also fix ticket #6049? If so, please mention it.
> I dont have ICC, so i dont know

I checked, it does not fix that.

ICC fails the C11 test (fine, as it should, I believe):

test_cflags_cc -std=c11 __STDC_VERSION__ >= 201112L
check_cc -std=c11
BEGIN /tmp/ffconf.6i1t5Drn.c
    1   #include <ctype.h>
    2   #if !(__STDC_VERSION__ >= 201112L)
    3   #error "unsatisfied condition: __STDC_VERSION__ >= 201112L"
    4   #endif
END /tmp/ffconf.6i1t5Drn.c
icc -D_ISOC99_SOURCE -std=c11 -c -o /tmp/ffconf.YqpQplj6.o /tmp/ffconf.6i1t5Drn.c
/tmp/ffconf.6i1t5Drn.c(3): catastrophic error: #error directive: "unsatisfied condition: __STDC_VERSION__ >= 201112L"
  #error "unsatisfied condition: __STDC_VERSION__ >= 201112L"

compilation aborted for /tmp/ffconf.6i1t5Drn.c (code 4)

but still passes the builtin-stdatomic test:

check_builtin stdatomic_h stdatomic.h atomic_int foo; atomic_store(&foo, 0)
check_code ld stdatomic.h atomic_int foo; atomic_store(&foo, 0) cc
check_ld cc
BEGIN /tmp/ffconf.6i1t5Drn.c
    1   #include <stdatomic.h>
    2   int main(void) { atomic_int foo; atomic_store(&foo, 0); return 0; }
END /tmp/ffconf.6i1t5Drn.c
icc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.YqpQplj6.o /tmp/ffconf.6i1t5Drn.c
icc -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.VfzybuCl /tmp/ffconf.YqpQplj6.o -lrt

which causes the macro still not to be defined:

icc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DOPJ_STATIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -std=c99 -fomit-frame-pointer -pthread  -I/usr/include/fribidi -I/usr/include/freetype2  -I/usr/include/freetype2 -I/usr/kerberos/include  -I/usr/include/tesseract -I/usr/include/leptonica       -I/usr/new/tools/video/install/x264/20160703/include  -D_REENTRANT -I/usr/include/SDL2  -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -O3 -fno-math-errno -fno-signed-zeros -w1 -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203 -falign-stack=maintain-16-byte  -MMD -c -o libavutil/cpu.o libavutil/cpu.c
libavutil/cpu.c(48): error: identifier "ATOMIC_VAR_INIT" is undefined
  static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);

libavutil/cpu.c(48): error: function call is not allowed in a constant expression
  static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);

compilation aborted for libavutil/cpu.c (code 2)
make: *** [libavutil/cpu.o] Error 2


More information about the ffmpeg-devel mailing list