I would just leave it as it is - this is not something worth ifdefs or any extra code IMO.
Too late, I already created follow-up #2618, which puts it in a self-contained utils function, making the main code flow cleaner than in this PR and allowing support for older GLibs and MacOS/others. There was already `#ifdef` in there, now there's some more, which eventually will be able to mostly be removed. One could argue it's overkill for such a trivial "feature", but Geany's issue tracker has a chronic problem of people not reporting OS/version, so making that easier is, IMO, worth the extra `#ifdef`-ed code.