--- ./demos/unsupported/xmform/xmform.c.orig	2016-03-16 02:10:08.000000000 +0000
+++ ./demos/unsupported/xmform/xmform.c	2020-09-03 10:45:32.000000000 +0100
@@ -50,6 +50,7 @@
 xmform*bottomShadowColor:        black
 ***-------------------------------------------------------------------*/
 
+#include <stdlib.h>
 #include <Xm/Xm.h>
 #include <Xm/Form.h>
 #include <Xm/PushB.h>



See https://sourceforge.net/p/motif/code/merge-requests/2/
and https://sourceforge.net/p/motif/code/merge-requests/3/

# Commented out acinclude.m4 patch to avoid the build trying to run aclocal-1.15
#--- acinclude.m4.orig
#+++ acinclude.m4
#@@ -18,6 +18,9 @@
# CFLAGS="$X_CFLAGS $CFLAGS"
# CPPFLAGS="$X_CFLAGS $CPPFLAGS"
# AC_TRY_RUN([
#+#ifdef HAVE_STDLIB_H
#+#include <stdlib.h>
#+#endif
# #include <X11/Intrinsic.h>
# int main() {
# Boolean brc;
#@@ -50,7 +53,7 @@
# AC_DEFUN([AM_FUNC_VOID_SPRINTF],
# [AC_CACHE_CHECK(whether sprintf returns void, ac_cv_func_void_sprintf,
# [AC_TRY_RUN([#include <stdio.h>
#-int sprintf(); main() { exit(sprintf(".")); }],
#+int main() { char buf[1]; int i = sprintf(buf, ""); return 0; }
#   ac_cv_func_void_sprintf=no, ac_cv_func_void_sprintf=yes, ac_cv_func_void_sprintf=yes)])
# if test $ac_cv_func_void_sprintf = no; then
#   AC_DEFINE(VOID_SPRINTF,1,
--- configure.orig
+++ configure
@@ -13172,6 +13172,9 @@
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 #include <X11/Intrinsic.h>
 int main() {
 Boolean brc;
@@ -14655,7 +14658,7 @@
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdio.h>
-int sprintf(); main() { exit(sprintf(".")); }
+int main() { char buf[1]; int i = sprintf(buf, ""); return 0; }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_void_sprintf=no
