[libav-devel] [PATCH] configure: Check whether MSVC supports C99

Martin Storsjö martin at martin.st
Mon Nov 4 15:00:48 CET 2013

MSVC does support most of C99 since the 2013 version. Try to
detect whether the compiler in the path needs to run the C99
converter or not. When the converter is omitted, the compilation
time is reduced quite drastically.

Prior to this, users could still use --cc="c99conv -noconv cl"
to run MSVC 2013 to achieve the same.

Since this only affects the value of cc_default, long before the
compiler itself is detected and set up, we can't use the normal
check_cc/TMPC/TMPO macros.
 configure |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/configure b/configure
index 4aa66c0..013f380 100755
--- a/configure
+++ b/configure
@@ -2279,6 +2279,16 @@ case "$toolchain" in
         cc_default="c99wrap cl"
+        # Check whether cl.exe supports C99 or not. From MSVC 2013 onwards,
+        # it does support C99, but we still need to use c99wrap for passing
+        # command line parameters with a space (for avoiding msys path
+        # mangling/conversion issues).
+        cat <<EOF > $TMPDIR/c99test.c
+            struct s { int a, b; } a = { .b = 42 };
+        check_cmd c99wrap -noconv cl -c -Fo $TMPDIR/c99test.o $TMPDIR/c99test.c &&
+            cc_default="c99wrap -noconv cl"
+        rm -f $TMPDIR/c99test.{c,o}
         ld_default="c99wrap link"
         nm_default="dumpbin -symbols"

More information about the libav-devel mailing list