Find the target gcc when cross-compiling
Find the target gcc when cross-compiling

Summary:
"./configure --target=TARGET" was broken; it would use the host gcc.
(So you had to explicitly specify "--with-gcc=TARGET-gcc" also,
as a workaround.)

This was broken by commit fc4856f9e811d9a23ae9212f43a09ddf5ef12b26
for #8148. A comment claimed that FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL
was the same as FP_ARG_WITH_PATH_GNU_PROG except for not raising
an error when the program isn't found; but that wasn't true --
the former didn't prepend the target name when cross-compiling.

We actually need three versions of FP_ARG_WITH_PATH_GNU_PROG since
the LLVM tools are usually not prefixed with the target name even
when cross-compiling. So I generalized the logic in a single macro.

Test Plan:
Built with "./configure --target=i386-unknown-linux"
and BuildFlavour=quick, successfully

Reviewers: ezyang, austin

Reviewed By: ezyang, austin

Subscribers: simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D204

TomMD/ghc,fmthoma/ghc,mettekou/ghc,mcschroeder/ghc,sgillespie/ghc,spacekitteh/smcghc,fmthoma/ghc,TomMD/ghc,oldmanmike/ghc,elieux/ghc,vTurbine/ghc,jstolarek/ghc,siddhanathan/ghc,jstolarek/ghc,GaloisInc/halvm-ghc,gridaphobe/ghc,da-x/ghc,anton-dessiatov/ghc,vTurbine/ghc,mcschroeder/ghc,wxwxwwxxx/ghc,TomMD/ghc,nkaretnikov/ghc,nkaretnikov/ghc,gridaphobe/ghc,nushio3/ghc,ml9951/ghc,elieux/ghc,elieux/ghc,siddhanathan/ghc,ezyang/ghc,vikraman/ghc,TomMD/ghc,sdiehl/ghc,anton-dessiatov/ghc,TomMD/ghc,forked-upstream-packages-for-ghcjs/ghc,gridaphobe/ghc,ezyang/ghc,tjakway/ghcjvm,nushio3/ghc,forked-upstream-packages-for-ghcjs/ghc,olsner/ghc,wxwxwwxxx/ghc,fmthoma/ghc,mfine/ghc,da-x/ghc,fmthoma/ghc,nkaretnikov/ghc,nushio3/ghc,sdiehl/ghc,da-x/ghc,mettekou/ghc,sdiehl/ghc,green-haskell/ghc,christiaanb/ghc,gcampax/ghc,gridaphobe/ghc,elieux/ghc,ezyang/ghc,wxwxwwxxx/ghc,urbanslug/ghc,vikraman/ghc,urbanslug/ghc,vTurbine/ghc,ezyang/ghc,AlexanderPankiv/ghc,nkaretnikov/ghc,jstolarek/ghc,green-haskell/ghc,gridaphobe/ghc,bitemyapp/ghc,acowley/ghc,ezyang/ghc,sgillespie/ghc,acowley/ghc,mfine/ghc,spacekitteh/smcghc,tjakway/ghcjvm,mettekou/ghc,mfine/ghc,ghc-android/ghc,tjakway/ghcjvm,green-haskell/ghc,mcschroeder/ghc,mettekou/ghc,tjakway/ghcjvm,siddhanathan/ghc,ghc-android/ghc,sdiehl/ghc,anton-dessiatov/ghc,oldmanmike/ghc,AlexanderPankiv/ghc,ml9951/ghc,shlevy/ghc,mettekou/ghc,urbanslug/ghc,GaloisInc/halvm-ghc,christiaanb/ghc,shlevy/ghc,GaloisInc/halvm-ghc,vTurbine/ghc,spacekitteh/smcghc,tjakway/ghcjvm,olsner/ghc,bitemyapp/ghc,gcampax/ghc,ghc-android/ghc,GaloisInc/halvm-ghc,mfine/ghc,mcschroeder/ghc,elieux/ghc,shlevy/ghc,AlexanderPankiv/ghc,snoyberg/ghc,ml9951/ghc,ezyang/ghc,AlexanderPankiv/ghc,sgillespie/ghc,tjakway/ghcjvm,snoyberg/ghc,olsner/ghc,mcschroeder/ghc,anton-dessiatov/ghc,mettekou/ghc,fmthoma/ghc,siddhanathan/ghc,olsner/ghc,gcampax/ghc,ezyang/ghc,ml9951/ghc,forked-upstream-packages-for-ghcjs/ghc,snoyberg/ghc,christiaanb/ghc,wxwxwwxxx/ghc,oldmanmike/ghc,vikraman/ghc,oldmanmike/ghc,nathyong/microghc-ghc,fmthoma/ghc,mfine/ghc,ml9951/ghc,mettekou/ghc,nkaretnikov/ghc,forked-upstream-packages-for-ghcjs/ghc,acowley/ghc,olsner/ghc,christiaanb/ghc,oldmanmike/ghc,forked-upstream-packages-for-ghcjs/ghc,sdiehl/ghc,nathyong/microghc-ghc,nathyong/microghc-ghc,ghc-android/ghc,urbanslug/ghc,shlevy/ghc,mfine/ghc,ml9951/ghc,oldmanmike/ghc,vikraman/ghc,vTurbine/ghc,nushio3/ghc,anton-dessiatov/ghc,vTurbine/ghc,gcampax/ghc,acowley/ghc,vikraman/ghc,urbanslug/ghc,shlevy/ghc,nushio3/ghc,acowley/ghc,ml9951/ghc,gridaphobe/ghc,forked-upstream-packages-for-ghcjs/ghc,green-haskell/ghc,sgillespie/ghc,gcampax/ghc,ml9951/ghc,sdiehl/ghc,ghc-android/ghc,shlevy/ghc,mfine/ghc,green-haskell/ghc,TomMD/ghc,anton-dessiatov/ghc,mcschroeder/ghc,olsner/ghc,TomMD/ghc,nathyong/microghc-ghc,sgillespie/ghc,bitemyapp/ghc,snoyberg/ghc,GaloisInc/halvm-ghc,urbanslug/ghc,spacekitteh/smcghc,vikraman/ghc,anton-dessiatov/ghc,GaloisInc/halvm-ghc,gridaphobe/ghc,nathyong/microghc-ghc,snoyberg/ghc,jstolarek/ghc,jstolarek/ghc,christiaanb/ghc,christiaanb/ghc,spacekitteh/smcghc,wxwxwwxxx/ghc,urbanslug/ghc,forked-upstream-packages-for-ghcjs/ghc,shlevy/ghc,oldmanmike/ghc,vTurbine/ghc,snoyberg/ghc,vikraman/ghc,ghc-android/ghc,elieux/ghc,nathyong/microghc-ghc,bitemyapp/ghc,da-x/ghc,tjakway/ghcjvm,fmthoma/ghc,GaloisInc/halvm-ghc,da-x/ghc,sgillespie/ghc,elieux/ghc,wxwxwwxxx/ghc,nkaretnikov/ghc,gcampax/ghc,siddhanathan/ghc,sdiehl/ghc,da-x/ghc,mcschroeder/ghc,acowley/ghc,AlexanderPankiv/ghc,snoyberg/ghc,AlexanderPankiv/ghc,acowley/ghc,nushio3/ghc,siddhanathan/ghc,nathyong/microghc-ghc,ghc-android/ghc,olsner/ghc,sgillespie/ghc,wxwxwwxxx/ghc,AlexanderPankiv/ghc,siddhanathan/ghc,da-x/ghc,gcampax/ghc,bitemyapp/ghc,nkaretnikov/ghc,nushio3/ghc,christiaanb/ghc