Environment detection improvments in Qt makefile

Tested on:

- ubuntu (me)
- windows (me)
- raspberry pi (me)
- macos (billotronic)

I hope it's final fix ;)