https://bugs.gentoo.org/870004

Fixed upstream, hopefully (it's hard to keep track of 1.7.x branch churn):
- https://bz.apache.org/bugzilla/show_bug.cgi?id=64753
- https://bz.apache.org/bugzilla/show_bug.cgi?id=65087
--- a/build/apr_common.m4
+++ b/build/apr_common.m4
@@ -467,6 +467,7 @@ changequote([, ])dnl
 AC_MSG_CHECKING(size of $2)
 AC_CACHE_VAL(AC_CV_NAME,
 [AC_TRY_RUN([#include <stdio.h>
+#include <stdlib.h>
 $1
 #ifdef WIN32
 #define binmode "b"
@@ -531,7 +532,8 @@ AC_TRY_RUN([
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
-main()
+#include <stdlib.h>
+int main()
 {
   char buf[1024];
   if (strerror_r(ERANGE, buf, sizeof buf) < 1) {
--- a/build/apr_network.m4
+++ b/build/apr_network.m4
@@ -63,6 +63,10 @@ AC_DEFUN([APR_CHECK_WORKING_GETADDRINFO], [
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#include <stdlib.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 int main(void) {
     struct addrinfo hints, *ai;
@@ -136,6 +140,11 @@ dnl
 AC_DEFUN([APR_CHECK_WORKING_GETNAMEINFO], [
   AC_CACHE_CHECK(for working getnameinfo, ac_cv_working_getnameinfo,[
   AC_TRY_RUN( [
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
@@ -195,6 +204,8 @@ AC_DEFUN([APR_CHECK_NEGATIVE_EAI], [
 #include <netdb.h>
 #endif
 
+#include <stdlib.h>
+
 int main(void) {
     if (EAI_ADDRFAMILY < 0) {
         exit(0);
@@ -388,9 +399,14 @@ AC_DEFUN([APR_CHECK_TCP_NODELAY_INHERITED], [
   AC_CACHE_CHECK(if TCP_NODELAY setting is inherited from listening sockets, ac_cv_tcp_nodelay_inherited,[
   AC_TRY_RUN( [
 #include <stdio.h>
+#include <stdlib.h>
+
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
-#endif
+#end
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endifif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -734,6 +750,9 @@ AC_TRY_COMPILE([
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
+
+#include <sys/socket.h>
+#include <netinet/in.h>
 ],[
 inet_addr("127.0.0.1");
 ],[
@@ -754,6 +773,9 @@ fi
 AC_DEFUN([APR_CHECK_INET_NETWORK], [
 AC_CACHE_CHECK(for inet_network, ac_cv_func_inet_network,[
 AC_TRY_COMPILE([
+#include <sys/socket.h>
+#include <netinet/in.h>
+
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
--- a/configure.in
+++ b/configure.in
@@ -1440,8 +1440,6 @@ AC_CHECK_FUNCS(sigaction, [ have_sigaction="1" ], [ have_sigaction="0" ])
 AC_DECL_SYS_SIGLIST
 
 AC_CHECK_FUNCS(fork, [ fork="1" ], [ fork="0" ])
-APR_CHECK_INET_ADDR
-APR_CHECK_INET_NETWORK
 AC_SUBST(apr_inaddr_none)
 AC_CHECK_FUNC(_getch)
 AC_CHECK_FUNCS(strerror_r, [ strerror_r="1" ], [ strerror_r="0" ])
@@ -1547,6 +1545,9 @@ APR_FLAG_HEADERS(
     sys/un.h		\
     sys/wait.h)
 
+APR_CHECK_INET_ADDR
+APR_CHECK_INET_NETWORK
+
 # IRIX 6.5 has a problem in <netinet/tcp.h> which prevents it from
 # being included by itself.  Check for <netinet/tcp.h> manually,
 # including another header file first.
@@ -2208,7 +2209,8 @@ AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/resource.h>
-main()
+#include <stdlib.h>
+int main()
 {
     struct rlimit limit;
     limit.rlim_cur = 0;
@@ -2247,7 +2249,7 @@ AC_TRY_RUN([
 #ifndef SEM_FAILED
 #define SEM_FAILED (-1)
 #endif
-main()
+int main()
 {
     sem_t *psem;
     const char *sem_name = "/apr_autoconf";
@@ -2307,6 +2309,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;
@@ -2435,6 +2438,8 @@ int fd;
 struct flock proc_mutex_lock_it = {0};
 const char *fname = "conftest.fcntl";
 
+int lockit();
+
 int main()
 {
     int rc, status;;
--- a/poll/os2/pollset.c
+++ b/poll/os2/pollset.c
@@ -308,7 +308,7 @@ APR_DECLARE(apr_status_t) apr_pollset_wakeup(apr_pollset_t *pollset)
 
 
 
-APR_DECLARE(const char *) apr_poll_method_defname()
+APR_DECLARE(const char *) apr_poll_method_defname(void)
 {
     return "select";
 }
--- a/poll/unix/pollset.c
+++ b/poll/unix/pollset.c
@@ -188,7 +188,7 @@ APR_DECLARE(const char *) apr_pollset_method_name(apr_pollset_t *pollset)
     return pollset->provider->name;
 }
 
-APR_DECLARE(const char *) apr_poll_method_defname()
+APR_DECLARE(const char *) apr_poll_method_defname(void)
 {
     const apr_pollset_provider_t *provider = NULL;
 
