Improve Autoconf MSVC support

Antonin Décimo <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <CACCWBSDmgY7LJaThCyEt74v8PT7r2n8xQYZbWK+M0yetjWvOeg@mail.gmail.com>
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).


- `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.

  > cl : Command line warning D9035 : option 'o' has been deprecated
and will be removed in a future release

  MSVC uses the `/Fo` option to specify the object file name (in
  conjunction with the `/c` option), and the `/Fe` option to specify
  the executable file name.

  https://learn.microsoft.com/en-us/cpp/build/reference/fo-object-file-name?view=msvc-170
  https://learn.microsoft.com/en-us/cpp/build/reference/fe-name-exe-file?view=msvc-170

- Version flag

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

  > cl
  Microsoft (R) C/C++ Optimizing Compiler Version 19.41.33901 for x64
  Copyright (C) Microsoft Corporation.  All rights reserved.

  usage: cl [ option... ] filename... [ /link linkoption... ]

Best regards,
-- Antonin
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.