ghc-toolchain: Validating ghc-toolchain against configure in CI

Closed Matthew Pickering requested to merge wip/ghc-toolchain-fixes into master

Closes #23744 #23720 (closed) #23689 (closed) #23681 (closed) #23676 (closed) Subsumes !10901 (closed) and !10903 (closed)

ghc-toolchain: Match CPP args with configure script

At the moment we need ghc-toolchain to precisely match the output as
provided by the normal configure script. The normal configure script
(FP_HSCPP_CMD_WITH_ARGS) branches on whether we are using clang or gcc
so we match that logic exactly in ghc-toolchain.

The old implementation (which checks if certain flags are supported) is
better but for now we have to match to catch any potential errors in the
configuration.

Ticket: #23720

and

configure: Fix `-Wl,--no-as-needed` check

The check was failing because the args supplied by $$1 were quoted which
failed because then the C compiler thought they were an input file.

Fixes #23720
Edited by Rodrigo Mesquita

Merge request reports