15.3.6.2 Native MinGW File Name Conversion

MSYS is a Unix emulation environment for Windows, and is specifically designed such that in normal usage it pretends to be MinGW or native Windows, but understands Unix-style file names and paths, and supports standard Unix tools and shells. Thus, “native” MinGW builds are actually an odd sort of cross-compile, from an MSYS Unix emulation environment “pretending” to be MinGW, to actual native Windows.

When an MSYS shell launches a native Windows executable (as opposed to other MSYS executables), it uses a system of heuristics to detect any command-line arguments that contain file names or paths. It automatically converts these file names from the MSYS (Unix-like) format, to the corresponding Windows file name, before launching the executable. However, this auto-conversion facility is only available when using the MSYS runtime library. The wrapper executable itself is a MinGW application (that is, it does not use the MSYS runtime library). The wrapper executable must set PATH to, and call _spawnv with, values that have already been converted from MSYS format to Windows. Thus, when libtool writes the source code for the wrapper executable, it must manually convert MSYS paths to Windows format, so that the Windows values can be hard-coded into the wrapper executable.