diff --git a/src/aclocal.m4 b/src/aclocal.m4
index de6fa5df160810cfa5457c542df6aeaa5ab5fd8e..49db4ebd888a70bbdafff6d7b4acfcb2f77c5ee5 100644
--- a/src/aclocal.m4
+++ b/src/aclocal.m4
@@ -19,6 +19,7 @@ dnl autoconf-wrapper if it is used.  dnl can't be used since the wrapper
 dnl checks for it, so just store it in a dummy define.
 define([require_autoconf_2_50],[AC_PREREQ(2.50)])
 
+dnl major, minor, on_ge, on_lt
 define([if_autoconf],
 [ifelse(ifelse(index(AC_ACVERSION,.),-1,0,[m4_eval(
   translit(substr(AC_ACVERSION, 0, index(AC_ACVERSION,.)),[A-Za-z])-0 >= $1 &&
@@ -28,6 +29,21 @@ define([if_autoconf],
   )
 )]),1,$3,$4)])
 
+dnl Autoconf 2.60 is the first version that supports C99.
+dnl C99-compilers complain about implicit declarations.
+dnl For autoconf 2.59 and earlier: Make sure at least
+dnl exit(3C) is declared by always including <stdlib.h>.
+if_autoconf(2,60,,[
+  m4_copy([AC_LANG_SOURCE(C)], [ORIG_AC_LANG_SOURCE_C])
+  m4_define([AC_LANG_SOURCE(C)], [
+    ORIG_AC_LANG_SOURCE_C([
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+]$1)
+  ])
+])
+
 pushdef([AC_PROG_CC_WORKS],
 [
   popdef([AC_PROG_CC_WORKS])