Fix the calculation of TARGET_IOS/OSX in configure. Fixes #10726.