cabal checks PATH before extra-prog-path
Describe the bug
When you have a program that's both on your PATH and in extra-prog-path you can't steer cabal to which one you want locally without modifying your PATH.
This is an issue with pkg-config on Windows because by default global installs of msys2 (such as on appveyor) put the wrong version on your path.
$ cabal v2-build ...
Expected behavior
I expect cabal to use the paths I manually specified in extra-prog-path before the ones in PATH. This allows the use more control over which program they wanted used.
For simple builds it looks like we already prepend the program path:
https://github.com/haskell/cabal/blob/0abbe37187f708e0a5daac8d388167f72ca0db7e/Cabal/src/Distribution/Simple.hs#L692
However, for configure we postpend it: https://github.com/haskell/cabal/blob/ba45b8e6d5a0220fc97bc9779d173b9dc91f731f/Cabal/src/Distribution/Simple/Configure.hs#L852
And ditto for v2 configuration: https://github.com/haskell/cabal/blob/1d4491fb3dbad3deb55cbe8922e448d0cd467ba3/cabal-install/src/Distribution/Client/ProjectPlanning.hs#L444
As such I'm going to try to change it in the latter two spots.
We have a pr including tests for non windows systems. However there is no evidence it works for windows: there is no integration test neither a manual test (@Mistuke tried the pr with no success, see https://github.com/haskell/cabal/pull/8506#issuecomment-1312839177) Reopening until we have a test for windows