M4 does not build "as is" on DragonFly BSD. However, the fix we found and used for a while at DragonFly is actually fairly simple:
--- lib/fpending.h.orig 2013-11-05 16:23:53.676412000 +0100 +++ lib/fpending.h 2013-11-05 16:25:14.837659000 +0100 @@ -24,6 +24,8 @@ # include <stdio_ext.h> #endif +#ifndef __DragonFly__ #ifndef __fpending size_t __fpending (FILE *); #endif +#endif This patch is against release 1.4.17 as I was not successful at bootstraping against master from a git clone of M4 repository. However, it is fairly simple to apply anyway. DragonFly BSD and pkgsrc teams would be pleased to have this merged into M4 to avoid subsequent patching.