meson: Don't use strndup() unless it's prototyped

A workaround for https://github.com/mesonbuild/meson/issues/3672

MinGW-w64 gcc has a built-in strndup, but it's not in the C library and
MinGW-w64 headers don't prototype it.

Don't try to use it, as that will cause an undefined reference if gcc
decides that an out-of-line call is appropriate.
4 jobs for meson-fixes-windows in 6 minutes and 46 seconds
Status Job ID Name Coverage
  Docker Image
passed #271427
debian-testing

00:00:21

 
  Build And Test
passed #271428
autotools-build-and-test

00:06:24

passed #271429
meson-build-and-test

00:02:18

 
  External
passed continuous-integration/appveyor/branch