Test for "vanilla" lib/exe that uses TH.
When possible, use -dynamic-too for exes that use TH.
Make the code a bit more readable.
Rename and rearrange some variables.

Based on discussion with @dcoutts.
Merge pull request #1386 from 23Skidoo/ghc-head-fixes

Fix building of executables that use TH with dyn-by-default GHC.
Initialise all subfields of 'install-dirs' in 'sandbox init'.

Inheriting e.g. 'libsubdir' from '~/.cabal/config' can break things if it set to
an empty string.

Fixes #1389.
Don't change the types of 'withTemp[File,Directory]' in 1.18.

Add new functions 'withTempFileEx' and 'withTempDirectoryEx' instead.

Fixes #1387.
Pass '--libdir' etc to 'setup configure' when installing.

Otherwise libs with 'build-type: Custom' get installed under
'$prefix/lib/$pkgname' instead of '$prefix/lib/$arch-$compiler-$os/$pkgname' if
the setup script is compiled against Cabal < 1.17.
Merge pull request #1388 from 23Skidoo/with-temp-file-ex

Don't change the types of 'withTemp[File,Directory]' in 1.18.
Merge pull request #1390 from 23Skidoo/install-dirs-fix

Pass '--libdir' etc to 'setup configure' when installing.
Use absolute paths when passing install dirs to the setup script.

Before: '--libsubdir=$arch-$os-$compiler/$pkgid'.
After:  '--libsubdir=i386-linux-ghc-7.4.2/lifted-base-0.2.1.0'.
Distribution/Client/Tar.hs: make clearer error message when tar fails to unpack source

Patch improves error reporting to give a clue what broke
when unpacking:
    $ dist/build/cabal/cabal unpack hackport
    Unpacking to hackport-0.3.2/
    cabal: File in tar archive is not in the expected directory "hackport-0.3.2"
    but got the following hierarchy: [".",".","@LongLink"]

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Merge pull request #1395 from trofi/master

Distribution/Client/Tar.hs: make clearer error message when tar fails to...
Tweak an error message.
Typo.
Improve an error message.

See #1397.
Show the error message only if the error actually occurred.
Improve an error message.

See #1362.
If we can't list sources, assume that the dependency hasn't changed.

Fixes #1397.
Tweak an error message.