From 9d9c6990afaa7ad8eea0be524481bb48a5dd1b09
From: Jim Jagielski <jim@apache.org>
Date: Thu, 29 Oct 2020 20:16:55 +0000
Subject: [PATCH] calls to exit() require stdlib.h or else we get
 -Werror,-Wimplicit-function-declaration

git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1882979 13f79535-47bb-0310-9956-ffa450edef68
---
 build/apr_common.m4  |  3 +++
 build/apr_network.m4 | 15 +++++++++++++++
 configure.in         |  6 +++++-
 3 files changed, 23 insertions(+), 1 deletion(-)

--- a/build/apr_common.m4
+++ b/build/apr_common.m4
@@ -495,6 +495,9 @@ AC_CACHE_CHECK([whether return code from
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 main()
 {
   char buf[1024];
--- a/build/apr_network.m4
+++ b/build/apr_network.m4
@@ -63,6 +63,9 @@ AC_DEFUN([APR_CHECK_WORKING_GETADDRINFO]
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 int main(void) {
     struct addrinfo hints, *ai;
@@ -151,6 +154,9 @@ AC_DEFUN([APR_CHECK_WORKING_GETNAMEINFO]
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 int main(void) {
     struct sockaddr_in sa;
@@ -194,6 +200,9 @@ AC_DEFUN([APR_CHECK_NEGATIVE_EAI], [
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 int main(void) {
     if (EAI_ADDRFAMILY < 0) {
@@ -403,6 +412,9 @@ AC_DEFUN([APR_CHECK_TCP_NODELAY_INHERITE
 #ifndef HAVE_SOCKLEN_T
 typedef int socklen_t;
 #endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 int main(void) {
     int listen_s, connected_s, client_s;
     int listen_port, rc;
@@ -588,6 +600,9 @@ typedef int socklen_t;
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 int main(void) {
     int listen_s, connected_s, client_s;
     int listen_port, rc;
--- a/configure.in
+++ b/configure.in
@@ -2208,6 +2208,7 @@ AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/resource.h>
+#include <stdlib.h>
 main()
 {
     struct rlimit limit;
@@ -2307,6 +2308,7 @@ if test "$threads" = "1"; then
       AC_TRY_RUN([
 #include <sys/types.h>
 #include <pthread.h>
+#include <stdlib.h>
         int main()
         {
             pthread_mutex_t mutex;
@@ -2430,7 +2432,9 @@ AC_TRY_RUN([
 #endif
 #include <fcntl.h>
 #include <errno.h>
-
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 int fd;
 struct flock proc_mutex_lock_it = {0};
 const char *fname = "conftest.fcntl";
