As a possible workaround, you could try updating your msys2, judging by the GCC version, it's rather out of date.
Done.
I added realpath to AC_CHECK_FUNCS in the referenced pull but it doesn't define HAVE_REALPATH in config.h, what am I doing wrong?