From 9635fa62f9a1199174d957eab4560e433a4b15aa Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Sat, 28 Jun 2014 10:08:25 +0800
Subject: [PATCH 08/18] Cygwin: fix some implicit declaration warnings

---
 libiberty/aclocal.m4 | 6 +++++-
 libiberty/configure  | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
index 34c0a5bab62..fd1be08c886 100644
--- a/libiberty/aclocal.m4
+++ b/libiberty/aclocal.m4
@@ -17,6 +17,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
 /* Test by Jim Wilson and Kaveh Ghazi.
    Check whether strncmp reads past the end of its string parameters. */
 #include <sys/types.h>
+#include <string.h>
+#include <stdlib.h>
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
@@ -149,7 +151,9 @@ if test $ac_cv_os_cray = yes; then
 fi
 
 AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
-[AC_TRY_RUN([find_stack_direction ()
+[AC_TRY_RUN([
+#include <stdlib.h>
+find_stack_direction ()
 {
   static char *addr = 0;
   auto char dummy;
diff --git a/libiberty/configure b/libiberty/configure
index 3f82c5bb865..ff05f4f14ba 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -6711,6 +6711,7 @@ else
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <stdlib.h>
 find_stack_direction ()
 {
   static char *addr = 0;
@@ -7545,6 +7546,8 @@ else
 /* Test by Jim Wilson and Kaveh Ghazi.
    Check whether strncmp reads past the end of its string parameters. */
 #include <sys/types.h>
+#include <string.h>
+#include <stdlib.h>
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
-- 
2.28.0

