Properly escape paths to executables. Fixes #18632.
Correct building documenation with Pandoc and TeX on Windows.
Do not put double quotes around empty variables.
auto merge of #18673 : VHaravy/rust/issue-18632, r=alexcrichton

1. Introduce `putpathvar` function that prints variable shell-quoted by using `%q` format specifier. This function is used within `probe` to save the result into `config.tmp`.
2. Removes search-and-replace pattern that transforms `\` into `/` as it messes up shell-quoted strings.