--- a/acinclude.m4
+++ b/acinclude.m4
@@ -563,17 +563,26 @@
 # __builtin_alloca is not available everywhere, check it exists before
 # seeing that it works
 GMP_PROG_CC_WORKS_PART_TEST([$1],[__builtin_alloca availability],
-[int k; int foo () { __builtin_alloca (k); }],
+[
+#include <alloca.h>
+int k;
+int foo ();
+int foo () { __builtin_alloca (k); return 0; }
+int main () { return 0; }
+],
   [GMP_PROG_CC_WORKS_PART([$1], [alloca array],
 [/* The following provokes an internal compiler error from Itanium HP-UX cc
     under +O2 or higher.  We use this sort of code in mpn/generic/mul_fft.c. */
+#include <alloca.h>
 int k;
+int foo ();
 int foo ()
 {
   int i, **a;
   a = __builtin_alloca (k);
   for (i = 0; i <= k; i++)
     a[i] = __builtin_alloca (1 << i);
+  return 0;
 }
 ])])
 
@@ -587,6 +596,9 @@
 #if defined(__GNUC_STDC_INLINE__)  /* e.g. GCC 5.x defaults to this, not __GNUC_GNU_INLINE__ */
 extern
 #endif
+t1 e (t2, t2, int, t1);
+void g();
+void h();
 __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
 {t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
 f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
@@ -603,8 +615,10 @@
    1666 to get an ICE with -O1 -mpowerpc64.  */
 
 #ifdef __GNUC__
-f(int u){int i;long long x;x=u?~0:0;if(x)for(i=0;i<9;i++);x&=g();if(x)g();}
-g(){}
+void f (int);
+long long g ();
+void f(int u){int i;long long x;x=u?~0:0;if(x)for(i=0;i<9;i++);x&=g();if(x)g();}
+long long g(){ return 0; }
 #else
 int dummy;
 #endif
@@ -620,6 +634,7 @@
    but that's fine, the offending cc is a native-only compiler so we don't
    have to worry about cross compiling.  */
 
+unsigned long lshift_com (unsigned long *, unsigned long *, long, unsigned);
 unsigned long
 lshift_com (rp, up, n, cnt)
   unsigned long *rp;
@@ -663,6 +678,7 @@
     native-only compiler so we don't have to worry about cross compiling.  */
 
 #include <stdlib.h>
+void lshift_com (unsigned long *, unsigned long *, long, unsigned);
 void
 lshift_com (rp, up, n, cnt)
   unsigned long *rp;
@@ -814,6 +830,7 @@
 [AC_MSG_CHECKING([compiler $1 has long long])
 cat >conftest.c <<EOF
 long long  foo;
+long long  bar ();
 long long  bar () { return foo; }
 int main () { return 0; }
 EOF
@@ -958,6 +975,7 @@
 [echo "Testing gcc GOT with eax emitted" >&AC_FD_CC
 cat >conftest.c <<\EOF
 [int foo;
+int bar ();
 int bar () { return foo; }
 ]EOF
 tmp_got_emitted=no
@@ -1149,7 +1167,7 @@
 [AC_MSG_CHECKING([assembler $1 $2])
 result=no
 cat >conftest.c <<EOF
-int main () {}
+int main () { return 0; }
 EOF
 gmp_compile="$1 $2 -c conftest.c >conftest.out 2>&1"
 if AC_TRY_EVAL(gmp_compile); then
@@ -2508,6 +2526,8 @@
 AC_REQUIRE([AC_PROG_LIBTOOL])
 AC_MSG_CHECKING([how to call x86 mcount])
 cat >conftest.c <<EOF
+void foo ();
+void bar ();
 foo(){bar();}
 EOF
 
@@ -2703,6 +2723,7 @@
 [gmp_cv_asm_powerpc_pic=yes
 cat >conftest.c <<EOF
 int foo;
+int *bar();
 int *bar() { return &foo; }
 EOF
 echo "Test program:" >&AC_FD_CC
@@ -3293,6 +3314,7 @@
      AC_TRY_RUN([
 #include <string.h>  /* for strcmp */
 #include <stdio.h>   /* for vsnprintf */
+#include <stdlib.h>  /* for exit */
 
 #if HAVE_STDARG
 #include <stdarg.h>
@@ -3337,6 +3359,7 @@
 {
 $i
   exit (0);
+  return 0;
 }
 ],
       [:],
@@ -3398,7 +3421,7 @@
   yes) tmp_inline=inline ;;
   *)   tmp_inline=$ac_cv_c_inline ;;
   esac    
-  AC_MSG_WARN([mpir.h doesnt recognise compiler "$tmp_inline", inlines will be unavailable])])
+  AC_MSG_WARN([mpir.h doesn't recognise compiler "$tmp_inline", inlines will be unavailable])])
   ;;
 esac
 ])
@@ -3466,10 +3489,12 @@
 # remove anything that might look like compiler output to our "||" expression
 rm -f conftest* a.out b.out a.exe a_out.exe
 cat >conftest.c <<EOF
+#include <stdlib.h>
 int
 main ()
 {
   exit(0);
+  return 0;
 }
 EOF
 gmp_compile="$1 conftest.c"
@@ -3540,10 +3565,12 @@
 AC_CACHE_CHECK([for build system executable suffix],
                gmp_cv_prog_exeext_for_build,
 [cat >conftest.c <<EOF
+#include <stdlib.h>
 int
 main ()
 {
   exit (0);
+  return 0;
 }
 EOF
 for i in .exe ,ff8 ""; do
@@ -3574,10 +3601,12 @@
 AC_CACHE_CHECK([whether build system compiler is ANSI],
                gmp_cv_c_for_build_ansi,
 [cat >conftest.c <<EOF
+#include <stdlib.h>
 int
-main (int argc, char *argv[])
+main (int argc, char **argv)
 {
   exit(0);
+  return 0;
 }
 EOF
 gmp_compile="$CC_FOR_BUILD conftest.c"
@@ -3608,10 +3637,13 @@
 AC_CACHE_CHECK([for build system compiler math library],
                gmp_cv_check_libm_for_build,
 [cat >conftest.c <<EOF
+#include <math.h>
+#include <stdlib.h>
 int
 main ()
 {
   exit(0);
+  return 0;
 }
 double d;
 double
