>> If you add ACLOCAL_FLAGS="-I m4" to znc.cygport, does it fix for you? > > Yes. So why didn't your build require that?
I have a hypothesis, but can't prove it without digging autotools sources. My guess is that you have AX_PTHREAD installed in /usr/share/aclocal (or in some other directory which is considered by default), and with bigger #serial than what local m4/ax_pthread.m4 has (17). That's why it doesn't work for you. But probably aclocal still tries local m4/ directory as last resort even if "-I m4" is not provided? That's why it could work for me. By explicitly adding m4/ to include dirs, it looks there earlier. But this is just a guess.