On Mon, 4 Nov 2013, Diego Biurrun wrote:

On Mon, Nov 04, 2013 at 04:00:48PM +0200, Martin Storsjö wrote:
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

s/the compilation/compilation/

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

s/to run/when running/

--- a/configure
+++ b/configure
@@ -2279,6 +2279,16 @@ case "$toolchain" in
     ;;
     msvc)
         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 };
+EOF
+        check_cmd c99wrap -noconv cl -c -Fo $TMPDIR/c99test.o $TMPDIR/c99test.c 
&&
+            cc_default="c99wrap -noconv cl"
+        rm -f $TMPDIR/c99test.{c,o}

You absolutely must not create a temporary file with a predictable name.
This is a security risk.

Right, that can be fixed.

Overall the patch feels hackish due to the fact that you run the test so
early and configure is not yet prepared to properly run compilation tests.

I suggest you try detecting the msvc version in probe_cc() and adding
-noconv to the compiler _flags there.  If I am not mistaken, that should
work just as well and be cleaner.

You indeed are mistaken, that won't work. -noconv must be passed before the actual command within $CC. So $CC is either "c99wrap cl" or "c99wrap -noconv cl", but anywhere later in the command line won't work.

And we can't do this in the probe_cc() stage, because this isn't about probing what the chosen $CC is and what it can do, but determining what cc_default should be overall. Yes, it feels hackish, but making probe_cc able to override what the $CC command is in itself would be even worse.

The point is that this is only the default for the cases when the user hasn't set the cc manually. Advanced users might still want to do --cc="c99wrap cl" or something else if they feel they want to override what the default is.

// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to