From bcb6ecf8cbf91f47de613503a76662ab8cbe5b76 Mon Sep 17 00:00:00 2001
From: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
Date: Mon, 11 Aug 2003 18:37:13 +0000
Subject: [PATCH] resolv.h may require netinet/in.h, so try to #include that
 when checking for the former.

---
 configure    | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 configure.ac | 11 +++++++++-
 2 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index fa9716ef64e..b3fc46d2b7f 100755
--- a/configure
+++ b/configure
@@ -13931,8 +13931,63 @@ done
 
 
 
+for ac_header in net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+     #if HAVE_SYS_SOCKET_H
+     # include <sys/socket.h>
+     #endif
 
-for ac_header in net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h resolv.h
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in resolv.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -13951,6 +14006,9 @@ cat >>conftest.$ac_ext <<_ACEOF
      #if HAVE_SYS_SOCKET_H
      # include <sys/socket.h>
      #endif
+     #if HAVE_NETINET_IN_H
+     # include <netinet/in.h>
+     #endif
 
 #include <$ac_header>
 _ACEOF
diff --git a/configure.ac b/configure.ac
index e9aa3d5bde6..e9e378b8008 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1072,12 +1072,21 @@ AC_CHECK_HEADERS(sys/mount.h sys/user.h,,,
      # include <sys/param.h>
      #endif])
 
-AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h resolv.h],,,
+AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h],,,
     [#include <sys/types.h>
      #if HAVE_SYS_SOCKET_H
      # include <sys/socket.h>
      #endif])
 
+AC_CHECK_HEADERS([resolv.h],,,
+    [#include <sys/types.h>
+     #if HAVE_SYS_SOCKET_H
+     # include <sys/socket.h>
+     #endif
+     #if HAVE_NETINET_IN_H
+     # include <netinet/in.h>
+     #endif])
+
 AC_CHECK_HEADERS(netinet/ip.h,,,
     [#include <sys/types.h>
      #if HAVE_SYS_SOCKET_H
-- 
GitLab