From 2b842b038fe86a1f43341254f6f86edce37352f9 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Mon, 15 Aug 2022 16:05:44 +1200
Subject: [PATCH 3/6] Remove configure probe for net/if.h.

<net/if.h> is in SUSv3 and all targeted Unixes have it.  It's used in a
region that is already ifdef'd out for Windows.  According to the
standard it's for the if_nameindex facilities, which we aren't using
directly, but AIX needs it for a related non-standard ioctl.
---
 configure                  | 2 +-
 configure.ac               | 1 -
 src/backend/libpq/ifaddr.c | 3 ---
 src/include/pg_config.h.in | 3 ---
 src/tools/msvc/Solution.pm | 1 -
 5 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/configure b/configure
index 8178f290a9..dd27cc4f85 100755
--- a/configure
+++ b/configure
@@ -13761,7 +13761,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
 fi
 
 
-for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h net/if.h netinet/tcp.h sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/signalfd.h sys/sockio.h sys/ucred.h termios.h ucred.h
+for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h netinet/tcp.h sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/signalfd.h sys/sockio.h sys/ucred.h termios.h ucred.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/configure.ac b/configure.ac
index ee45d856c7..d04372e29d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1450,7 +1450,6 @@ AC_CHECK_HEADERS(m4_normalize([
 	ifaddrs.h
 	langinfo.h
 	mbarrier.h
-	net/if.h
 	netinet/tcp.h
 	sys/epoll.h
 	sys/event.h
diff --git a/src/backend/libpq/ifaddr.c b/src/backend/libpq/ifaddr.c
index 876a1dac08..eb4de5ec2f 100644
--- a/src/backend/libpq/ifaddr.c
+++ b/src/backend/libpq/ifaddr.c
@@ -312,10 +312,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
 #else							/* !HAVE_GETIFADDRS && !WIN32 */
 
 #include <sys/ioctl.h>
-
-#ifdef HAVE_NET_IF_H
 #include <net/if.h>
-#endif
 
 #ifdef HAVE_SYS_SOCKIO_H
 #include <sys/sockio.h>
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 2bc962ca2f..4a2914a780 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -322,9 +322,6 @@
 /* Define to 1 if you have the <netinet/tcp.h> header file. */
 #undef HAVE_NETINET_TCP_H
 
-/* Define to 1 if you have the <net/if.h> header file. */
-#undef HAVE_NET_IF_H
-
 /* Define to 1 if you have the `OPENSSL_init_ssl' function. */
 #undef HAVE_OPENSSL_INIT_SSL
 
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 2c4b888266..26217e6d19 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -304,7 +304,6 @@ sub GenerateFiles
 		HAVE_MEMSET_S               => undef,
 		HAVE_MKDTEMP                => undef,
 		HAVE_NETINET_TCP_H          => undef,
-		HAVE_NET_IF_H               => undef,
 		HAVE_OPENSSL_INIT_SSL       => undef,
 		HAVE_OSSP_UUID_H            => undef,
 		HAVE_PAM_PAM_APPL_H         => undef,
-- 
2.35.1

