Re: Improve Autoconf MSVC support

Nick Bowler <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
Hi Antonin,

On 2024-06-03 12:05, Antonin Décimo wrote:
> Dear maintainers,
> 
> I've listed three little problems I've had using MSVC and Autoconf.
> They stem from MSVC not accepting the same parameters from the usual
> unix tools. I wonder if these could be fixed. I'm happy to help with
> testing.
> 
> Note that MSVC supports both `/param` and `-param` styles; the former
> being used in documentation, but I think we should prefer the latter
> for Unix compatibility (compilers might interpret the `/param` style
> as paths).

Yes, using the slash form of the options is fraught with peril (in
particular, MSYS looks for command line arguments that look like
UNIX-style absolute filenames and modifies them by prepending
drive letters).  Fortunately the hyphen form works fine.

> - `AC_SEARCH_LIBS`: the macro prepends `-llibrary` to `LIBS` to look
>   for a function in a library. MSVC doesn't recognize these arguments,
>   and expects `library.lib` at the end of its invocation.
>   Also applies to `{AC,AH}_CHECK_LIB`.
> 
> - Output file
> 
>   MSVC will stop supporting `/o`/`-o` to select its output file and is
>   already warning about it.
[...]

I guess you are not using Automake, because both of these problems
should be solved automatically by Automake.  Automake replaces $CC
with invocations through a wrapper script that knows how to translate
-l and -o options into MSVC equivalents (such as -Fo/-Fe).

If you don't want to use Automake I suggest at least using this
wrapper script in your project.

The combination of -c with -o is not even portable amongst POSIX
hosts (the POSIX-standard compiler commands leave the results of
this combination explicitly unspecified).

> - Version flag
> 
>   MSVC doesn't have a version flag but will report its version if
>   called directly.

I don't understand why this is important.

Cheers,
  Nick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.