This PR removes code that repeats three times. Also currently on master (8830cb58abc888144a1edb9b2fba427716cc45d8) some parts are brittle:
Also there is a little change that fixes a warning:
0$ cat config.log | grep -A 2 'extra tokens'
1conftest.cpp:76:28: warning: extra tokens at end of #ifndef directive
2 #ifndef QT_VERSION OR QT_VERSION_STR
3 ^~