build: build qt tests after qt libs/executable

Autotools defaults to a depth-first recursion which causes the qt tests
to be built before the executables and libraries.

This is inconvenient as make needs to be called twice to make sure the
tests are up to date after changing a source file.

Update the Makefile.am to change this order.
build: allow correct tools to be used for dmg creation.

These come from the enironment, which will be properly setup by Make with
the paths gleaned from configure.
Also don't crash if plugins are static.
build: fix qt.conf case-sensitivity in the deployed dmg

For qt5.2 on osx, the qcocoa plugin is mandatory. However, it fails to load
when qt.conf specifies the "plugin" path instead of the expected "Plugin". This
is in line with the documentation:
https://qt-project.org/doc/qt-5.0/qtdoc/qt-conf.html

I'm not sure how the plugins were loading before, unless the case-sensitivity
for OSX is new.
build: if cross-compiling for an apple host, locate some additional tools

This should be safe to do for native builds too, but for now it's
specific to cross-builds to avoid possible regressions.
build: ensure the correct strip is used for osx/win32
build: hook up "make deploy" for cross osx builds
Merge pull request #3885

01e5327 build: hook up "make deploy" for cross osx builds (Cory Fields)
c4a10db build: ensure the correct strip is used for osx/win32 (Cory Fields)
b62bbb1 build: if cross-compiling for an apple host, locate some additional tools (Cory Fields)
0f21d39 build: fix qt.conf case-sensitivity in the deployed dmg (Cory Fields)
275d6a3 build: allow correct tools to be used for dmg creation. (Cory Fields)
Merge pull request #3917

5c80b9a build: build qt tests after qt libs/executable (Wladimir J. van der Laan)