Source: https://src.fedoraproject.org/rpms/libgda5/blob/f43/f/libgda5-configure-c99.patch

Avoid calling the undeclared printf function in configure checks
by including <stdio.h>.  Implicit function declarations have been
removed from the C language in 1999.

No need to upstream this because upstream has switched to Meson.

diff --git a/m4/ldap.m4 b/m4/ldap.m4
index 032533192f71c450..2bf8704d5e367a53 100644
--- a/m4/ldap.m4
+++ b/m4/ldap.m4
@@ -121,6 +121,7 @@ m4_define([_LDAP_CHECK_INTERNAL],
   	        save_LIBS="$LIBS"
 	        LIBS="$LIBS -L$d/$ldap_loclibdir -lldap -llber"
    	        AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <stdio.h>
 #include <ldap.h>
 #include <lber.h>
 #include <ldap_schema.h>
diff --git a/m4/mysql.m4 b/m4/mysql.m4
index 535a081a915292cc..d93230e1009f4cba 100644
--- a/m4/mysql.m4
+++ b/m4/mysql.m4
@@ -132,6 +132,7 @@ m4_define([_MYSQL_CHECK_INTERNAL],
   	                save_LIBS="$LIBS"
 	                LIBS="$LIBS -L$d/$mysql_loclibdir -lmysql"
    	                AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <stdio.h>
 #include <winsock.h>
 #include <mysql.h>
 int main() {
@@ -176,6 +177,7 @@ int main() {
 	    LIBS="$LIBS $MYSQL_LIBS"
 
             AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <stdio.h>
 #include <mysql.h>
 int main() {
     printf("%p", mysql_real_connect);
