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

A workaround for

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