diff --git a/srcpkgs/m4/template b/srcpkgs/m4/template
index af7b62ecaa..ad0d585a26 100644
--- a/srcpkgs/m4/template
+++ b/srcpkgs/m4/template
@@ -14,6 +14,11 @@ maintainer="Enno Boland <gottox@voidlinux.org>"
 distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.xz"
 checksum=f2c1e86ca0a404ff281631bdc8377638992744b175afb806e25871a24a934e07
 
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	export ac_cv_lib_error_at_line=no
+	export ac_cv_header_sys_cdefs_h=no
+fi
+
 if [ -z "$CHROOT_READY" ]; then
 	# Disable makeinfo unconditionally
 	# texinfo is defaulted to utf-8 now and the file is in iso-8859-1