Hi,

Here's another set patches for cruft I discovered going line-by-line through
the autoconf vs meson test differences. They'd all be simple to port to meson
too, but I think it's better to clean them up.

0001: __func__ is C99, so we don't need to support fallbacks

0002: windows: We've unconditionally defined HAVE_MINIDUMP_TYPE for msvc 
forever, we
  can rely on it for mingw too

0003: aix: aix3.2.5, aix4.1 are not even of historical interest at this point
  - 4.1 was released before the first commit in our commit history

0004: solaris: these gcc & gnu ld vs sun stuff differences seem unnecessary or
  outdated

  I started this because I wanted to get rid of with_gnu_ld, but there's still
  a necessary reference left unfortunately. But it still seems worth doing?

  I checked and the relevant options (-shared, -Wl,-Bsymbolic, -Wl,-soname)
  work even on solaris 10 with developerstudio12.5 (not the latest)

0005: those broken system headers look to have been repaired a good while ago,
 or, in the case of irix, we don't support the platform anymore

Greetings,

Andres Freund
>From f69c4e34d82c9441402d939e39575fa0afc949e8 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Fri, 5 Aug 2022 17:25:49 -0700
Subject: [PATCH 1/5] Rely on __func__ being supported

Previously we fell back to __FUNCTION__ and then NULL. As __func__ is in C99
that shouldn't be necessary anymore.

For some reason Solution.pm defined HAVE_FUNCNAME__FUNCTION instead of
HAVE_FUNCNAME__FUNC (originating in 4164e6636e2), there doesn't seem to be a
reason to continue with that as __func__ is supported by msvc.
---
 src/include/c.h                   | 11 ------
 src/include/pg_config.h.in        |  6 ---
 src/include/storage/s_lock.h      |  4 +-
 src/include/utils/elog.h          |  4 +-
 config/c-compiler.m4              | 26 -------------
 src/backend/storage/lmgr/s_lock.c |  2 +-
 configure                         | 61 -------------------------------
 configure.ac                      |  1 -
 src/tools/msvc/Solution.pm        |  2 -
 9 files changed, 5 insertions(+), 112 deletions(-)

diff --git a/src/include/c.h b/src/include/c.h
index 8c4baeb0ec3..de9ec04d494 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -360,17 +360,6 @@ typedef void (*pg_funcptr_t) (void);
  */
 #define FLEXIBLE_ARRAY_MEMBER	/* empty */
 
-/* Which __func__ symbol do we have, if any? */
-#ifdef HAVE_FUNCNAME__FUNC
-#define PG_FUNCNAME_MACRO	__func__
-#else
-#ifdef HAVE_FUNCNAME__FUNCTION
-#define PG_FUNCNAME_MACRO	__FUNCTION__
-#else
-#define PG_FUNCNAME_MACRO	NULL
-#endif
-#endif
-
 
 /* ----------------------------------------------------------------
  *				Section 2:	bool, true, false
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 2d9a1cdc8ab..5ec31e532e3 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -158,12 +158,6 @@
 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
 #undef HAVE_FSEEKO
 
-/* Define to 1 if your compiler understands __func__. */
-#undef HAVE_FUNCNAME__FUNC
-
-/* Define to 1 if your compiler understands __FUNCTION__. */
-#undef HAVE_FUNCNAME__FUNCTION
-
 /* Define to 1 if you have __atomic_compare_exchange_n(int *, int *, int). */
 #undef HAVE_GCC__ATOMIC_INT32_CAS
 
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 1c9f6f08954..0877cf65b0b 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -768,7 +768,7 @@ extern int	tas_sema(volatile slock_t *lock);
 
 #if !defined(S_LOCK)
 #define S_LOCK(lock) \
-	(TAS(lock) ? s_lock((lock), __FILE__, __LINE__, PG_FUNCNAME_MACRO) : 0)
+	(TAS(lock) ? s_lock((lock), __FILE__, __LINE__, __func__) : 0)
 #endif	 /* S_LOCK */
 
 #if !defined(S_LOCK_FREE)
@@ -855,7 +855,7 @@ init_spin_delay(SpinDelayStatus *status,
 	status->func = func;
 }
 
-#define init_local_spin_delay(status) init_spin_delay(status, __FILE__, __LINE__, PG_FUNCNAME_MACRO)
+#define init_local_spin_delay(status) init_spin_delay(status, __FILE__, __LINE__, __func__)
 extern void perform_spin_delay(SpinDelayStatus *status);
 extern void finish_spin_delay(SpinDelayStatus *status);
 
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 68ead8e8736..56398176901 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -140,7 +140,7 @@
 		if (__builtin_constant_p(elevel) && (elevel) >= ERROR ? \
 			errstart_cold(elevel, domain) : \
 			errstart(elevel, domain)) \
-			__VA_ARGS__, errfinish(__FILE__, __LINE__, PG_FUNCNAME_MACRO); \
+			__VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \
 		if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \
 			pg_unreachable(); \
 	} while(0)
@@ -150,7 +150,7 @@
 		const int elevel_ = (elevel); \
 		pg_prevent_errno_in_scope(); \
 		if (errstart(elevel_, domain)) \
-			__VA_ARGS__, errfinish(__FILE__, __LINE__, PG_FUNCNAME_MACRO); \
+			__VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \
 		if (elevel_ >= ERROR) \
 			pg_unreachable(); \
 	} while(0)
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index d3562d6feee..69efc5bb10a 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -165,32 +165,6 @@ if (q != holder)
 fi])# PGAC_TYPE_128BIT_INT
 
 
-# PGAC_C_FUNCNAME_SUPPORT
-# -----------------------
-# Check if the C compiler understands __func__ (C99) or __FUNCTION__ (gcc).
-# Define HAVE_FUNCNAME__FUNC or HAVE_FUNCNAME__FUNCTION accordingly.
-AC_DEFUN([PGAC_C_FUNCNAME_SUPPORT],
-[AC_CACHE_CHECK(for __func__, pgac_cv_funcname_func_support,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
-[printf("%s\n", __func__);])],
-[pgac_cv_funcname_func_support=yes],
-[pgac_cv_funcname_func_support=no])])
-if test x"$pgac_cv_funcname_func_support" = xyes ; then
-AC_DEFINE(HAVE_FUNCNAME__FUNC, 1,
-          [Define to 1 if your compiler understands __func__.])
-else
-AC_CACHE_CHECK(for __FUNCTION__, pgac_cv_funcname_function_support,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
-[printf("%s\n", __FUNCTION__);])],
-[pgac_cv_funcname_function_support=yes],
-[pgac_cv_funcname_function_support=no])])
-if test x"$pgac_cv_funcname_function_support" = xyes ; then
-AC_DEFINE(HAVE_FUNCNAME__FUNCTION, 1,
-          [Define to 1 if your compiler understands __FUNCTION__.])
-fi
-fi])# PGAC_C_FUNCNAME_SUPPORT
-
-
 
 # PGAC_C_STATIC_ASSERT
 # --------------------
diff --git a/src/backend/storage/lmgr/s_lock.c b/src/backend/storage/lmgr/s_lock.c
index 2a658ff594c..4e473ec27ec 100644
--- a/src/backend/storage/lmgr/s_lock.c
+++ b/src/backend/storage/lmgr/s_lock.c
@@ -304,7 +304,7 @@ main()
 	printf("             if S_LOCK() and TAS() are working.\n");
 	fflush(stdout);
 
-	s_lock(&test_lock.lock, __FILE__, __LINE__, PG_FUNCNAME_MACRO);
+	s_lock(&test_lock.lock, __FILE__, __LINE__, __func__);
 
 	printf("S_LOCK_TEST: failed, lock not locked\n");
 	return 1;
diff --git a/configure b/configure
index 0e73edb9ffa..3891ae61d31 100755
--- a/configure
+++ b/configure
@@ -14937,67 +14937,6 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __func__" >&5
-$as_echo_n "checking for __func__... " >&6; }
-if ${pgac_cv_funcname_func_support+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-printf("%s\n", __func__);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_funcname_func_support=yes
-else
-  pgac_cv_funcname_func_support=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_funcname_func_support" >&5
-$as_echo "$pgac_cv_funcname_func_support" >&6; }
-if test x"$pgac_cv_funcname_func_support" = xyes ; then
-
-$as_echo "#define HAVE_FUNCNAME__FUNC 1" >>confdefs.h
-
-else
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __FUNCTION__" >&5
-$as_echo_n "checking for __FUNCTION__... " >&6; }
-if ${pgac_cv_funcname_function_support+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-printf("%s\n", __FUNCTION__);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_funcname_function_support=yes
-else
-  pgac_cv_funcname_function_support=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_funcname_function_support" >&5
-$as_echo "$pgac_cv_funcname_function_support" >&6; }
-if test x"$pgac_cv_funcname_function_support" = xyes ; then
-
-$as_echo "#define HAVE_FUNCNAME__FUNCTION 1" >>confdefs.h
-
-fi
-fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Static_assert" >&5
 $as_echo_n "checking for _Static_assert... " >&6; }
 if ${pgac_cv__static_assert+:} false; then :
diff --git a/configure.ac b/configure.ac
index efd3be91cd4..d96066e3803 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1635,7 +1635,6 @@ m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
 AC_C_BIGENDIAN
 AC_C_INLINE
 PGAC_PRINTF_ARCHETYPE
-PGAC_C_FUNCNAME_SUPPORT
 PGAC_C_STATIC_ASSERT
 PGAC_C_TYPEOF
 PGAC_C_TYPES_COMPATIBLE
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 4916a86f5cf..7615a228aa9 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -250,8 +250,6 @@ sub GenerateFiles
 		HAVE_EXECINFO_H                             => undef,
 		HAVE_EXPLICIT_BZERO                         => undef,
 		HAVE_FSEEKO                                 => 1,
-		HAVE_FUNCNAME__FUNC                         => undef,
-		HAVE_FUNCNAME__FUNCTION                     => 1,
 		HAVE_GCC__ATOMIC_INT32_CAS                  => undef,
 		HAVE_GCC__ATOMIC_INT64_CAS                  => undef,
 		HAVE_GCC__SYNC_CHAR_TAS                     => undef,
-- 
2.37.0.3.g30cc8d0f14

>From fd0b114540cbd5950a4c6e01131d8b73e1e01c98 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Fri, 5 Aug 2022 17:35:47 -0700
Subject: [PATCH 2/5] windows: Remove HAVE_MINIDUMP_TYPE test

We've relied on it being present for msvc for ages...
---
 src/include/pg_config.h.in      |  3 ---
 src/backend/main/main.c         |  2 +-
 src/backend/port/win32/Makefile |  4 +---
 configure                       | 26 --------------------------
 configure.ac                    | 11 -----------
 src/Makefile.global.in          |  3 ---
 src/tools/msvc/Solution.pm      |  1 -
 7 files changed, 2 insertions(+), 48 deletions(-)

diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 5ec31e532e3..63c17c77a5c 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -325,9 +325,6 @@
 /* Define to 1 if you have the `memset_s' function. */
 #undef HAVE_MEMSET_S
 
-/* Define to 1 if the system has the type `MINIDUMP_TYPE'. */
-#undef HAVE_MINIDUMP_TYPE
-
 /* Define to 1 if you have the `mkdtemp' function. */
 #undef HAVE_MKDTEMP
 
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index bb782fa1ec6..5a964a0db67 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -63,7 +63,7 @@ main(int argc, char *argv[])
 	 * If supported on the current platform, set up a handler to be called if
 	 * the backend/postmaster crashes with a fatal signal or exception.
 	 */
-#if defined(WIN32) && defined(HAVE_MINIDUMP_TYPE)
+#if defined(WIN32)
 	pgwin32_install_crashdump_handler();
 #endif
 
diff --git a/src/backend/port/win32/Makefile b/src/backend/port/win32/Makefile
index 90126f634ac..61e0369d621 100644
--- a/src/backend/port/win32/Makefile
+++ b/src/backend/port/win32/Makefile
@@ -13,11 +13,9 @@ top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
 
 OBJS = \
+	crashdump.o \
 	signal.o \
 	socket.o \
 	timer.o
-ifeq ($(have_win32_dbghelp), yes)
-OBJS += crashdump.o
-endif
 
 include $(top_srcdir)/src/backend/common.mk
diff --git a/configure b/configure
index 3891ae61d31..c60c827a3c8 100755
--- a/configure
+++ b/configure
@@ -648,7 +648,6 @@ MSGFMT
 PG_CRC32C_OBJS
 CFLAGS_ARMV8_CRC32C
 CFLAGS_SSE42
-have_win32_dbghelp
 LIBOBJS
 ZSTD
 LZ4
@@ -16911,32 +16910,7 @@ esac
  ;;
 esac
 
-  ac_fn_c_check_type "$LINENO" "MINIDUMP_TYPE" "ac_cv_type_MINIDUMP_TYPE" "
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
-#include <dbghelp.h>
-"
-if test "x$ac_cv_type_MINIDUMP_TYPE" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_MINIDUMP_TYPE 1
-_ACEOF
-
-pgac_minidump_type=yes
-else
-  pgac_minidump_type=no
 fi
-
-fi
-if test x"$pgac_minidump_type" = x"yes" ; then
-  have_win32_dbghelp=yes
-
-else
-  have_win32_dbghelp=no
-
-fi
-
 # Cygwin needs only a bit of that
 if test "$PORTNAME" = "cygwin"; then
   case " $LIBOBJS " in
diff --git a/configure.ac b/configure.ac
index d96066e3803..8593c50575f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1939,18 +1939,7 @@ if test "$PORTNAME" = "win32"; then
   AC_LIBOBJ(win32security)
   AC_LIBOBJ(win32setlocale)
   AC_LIBOBJ(win32stat)
-  AC_CHECK_TYPES(MINIDUMP_TYPE, [pgac_minidump_type=yes], [pgac_minidump_type=no], [
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
-#include <dbghelp.h>])
 fi
-if test x"$pgac_minidump_type" = x"yes" ; then
-  AC_SUBST(have_win32_dbghelp,yes)
-else
-  AC_SUBST(have_win32_dbghelp,no)
-fi
-
 # Cygwin needs only a bit of that
 if test "$PORTNAME" = "cygwin"; then
   AC_LIBOBJ(dirmod)
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 14fdd4ef7b1..0625b60c434 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -547,9 +547,6 @@ host_cpu = @host_cpu@
 # Backend stack size limit has to be hard-wired on Windows (it's in bytes)
 WIN32_STACK_RLIMIT=4194304
 
-# Set if we have a working win32 crashdump header
-have_win32_dbghelp = @have_win32_dbghelp@
-
 DLSUFFIX = @DLSUFFIX@
 
 # Pull in platform-specific magic
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 7615a228aa9..ab8f4b24dba 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -305,7 +305,6 @@ sub GenerateFiles
 		HAVE_MBSTOWCS_L             => 1,
 		HAVE_MEMORY_H               => 1,
 		HAVE_MEMSET_S               => undef,
-		HAVE_MINIDUMP_TYPE          => 1,
 		HAVE_MKDTEMP                => undef,
 		HAVE_NETINET_TCP_H          => undef,
 		HAVE_NET_IF_H               => undef,
-- 
2.37.0.3.g30cc8d0f14

>From ad73df7c9779cdb7e68fccd78bf79f445ae7059f Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Sat, 6 Aug 2022 13:22:49 -0700
Subject: [PATCH 3/5] aix: Remove checks for very old OS versions

---
 src/makefiles/Makefile.aix | 14 ++------------
 src/template/aix           |  3 ---
 src/backend/Makefile       |  8 --------
 3 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
index 84f26b49b87..4cf2cc52d45 100644
--- a/src/makefiles/Makefile.aix
+++ b/src/makefiles/Makefile.aix
@@ -8,19 +8,9 @@ AROPT = crs
 # -blibpath must contain ALL directories where we should look for libraries
 libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
 
-ifeq ($(host_os), aix3.2.5)
-	rpath = -L'$(rpathdir)'
-else
-	rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
-endif
+rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
 
-ifeq ($(host_os), aix3.2.5)
-ifneq ($(GCC), yes)
-	LDFLAGS_SL += -e _nostart -H512 -bM:SRE
-endif
-else
-	LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE
-endif
+LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE
 
 # env var name to use in place of LD_LIBRARY_PATH
 ld_library_path_var = LIBPATH
diff --git a/src/template/aix b/src/template/aix
index cec240d27b9..47fa8990a7c 100644
--- a/src/template/aix
+++ b/src/template/aix
@@ -6,9 +6,6 @@
 # non-default CFLAGS setting.
 if test "$GCC" != yes ; then
   case $host_os in
-    aix3.2.5 | aix4.1*)
-      CFLAGS="-O -qmaxmem=16384"
-      ;;
     *)
       CFLAGS="-O2 -qmaxmem=16384"
       ;;
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 953c80db5ab..7262861b12a 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -101,15 +101,7 @@ postgres: $(POSTGRES_IMP)
 
 $(POSTGRES_IMP): $(OBJS)
 	$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(call expand_subsys,$^)
-ifeq ($(host_os), aix3.2.5)
 	$(MKLDEXPORT) SUBSYS.o $(bindir)/postgres > $@
-else
-ifneq (,$(findstring aix4.1, $(host_os)))
-	$(MKLDEXPORT) SUBSYS.o $(bindir)/postgres > $@
-else
-	$(MKLDEXPORT) SUBSYS.o . > $@
-endif
-endif
 	@rm -f SUBSYS.o
 
 endif # aix
-- 
2.37.0.3.g30cc8d0f14

>From d6582d4aed8779fcb903f5eb3ad5d802289a0cf5 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Sat, 6 Aug 2022 13:23:43 -0700
Subject: [PATCH 4/5] solaris: Remove unnecessary gcc / gnu ld vs sun studio
 differences

Unfortunately one with_gnu_ld reference remains, otherwise we could remove the
configure support for determining with_gnu_ld.
---
 src/makefiles/Makefile.solaris |  9 +--------
 src/Makefile.shlib             | 12 ++----------
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/src/makefiles/Makefile.solaris b/src/makefiles/Makefile.solaris
index 5496edcafc1..acdf44cc0f2 100644
--- a/src/makefiles/Makefile.solaris
+++ b/src/makefiles/Makefile.solaris
@@ -1,21 +1,14 @@
 # src/makefiles/Makefile.solaris
 
 AROPT = crs
+rpath = -Wl,-rpath,'$(rpathdir)'
 
 ifeq ($(with_gnu_ld), yes)
 export_dynamic = -Wl,-E
-rpath = -Wl,-rpath,'$(rpathdir)'
-else
-rpath = -Wl,-R'$(rpathdir)'
 endif
 
-
 # Rule for building a shared library from a single .o file
 %.so: %.o
-ifeq ($(GCC), yes)
 	$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
-else
-	$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -G -o $@
-endif
 
 sqlmansect = 5sql
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 2396bc247e5..2af6192f0f3 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -188,17 +188,9 @@ ifeq ($(PORTNAME), linux)
 endif
 
 ifeq ($(PORTNAME), solaris)
-  ifeq ($(GCC), yes)
-    LINK.shared		= $(COMPILER) -shared -Wl,-Bsymbolic
-  else
-    LINK.shared		= $(COMPILER) -G -Bsymbolic
-  endif
+  LINK.shared		= $(COMPILER) -shared -Wl,-Bsymbolic
   ifdef soname
-    ifeq ($(with_gnu_ld), yes)
-      LINK.shared	+= -Wl,-soname,$(soname)
-    else
-      LINK.shared	+= -h $(soname)
-    endif
+    LINK.shared	+= -Wl,-soname,$(soname)
   endif
 endif
 
-- 
2.37.0.3.g30cc8d0f14

>From d886e115887fa7e30a40d9265caae1cba32bd747 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Sat, 6 Aug 2022 17:04:56 -0700
Subject: [PATCH 5/5] Trust a few system headers to stand on their own

At some point in the past some headers (net/if.h on some BSDs in 2009,
netinet/tcp.h on IRIX in 2000, sys/ucred.h in 2013 on then older openbsd),
only compiled if other heades were included first, complicating configure
tests. More recent tests indicate that that's not required anymore.

Discussion: https://postgr.es/m/
---
 configure    | 56 +---------------------------------------------------
 configure.ac | 24 +++-------------------
 2 files changed, 4 insertions(+), 76 deletions(-)

diff --git a/configure b/configure
index c60c827a3c8..e71c0c4c2d5 100755
--- a/configure
+++ b/configure
@@ -13874,7 +13874,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 sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/uio.h sys/un.h termios.h ucred.h
+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/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/ucred.h sys/uio.h sys/un.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"
@@ -13888,60 +13888,6 @@ fi
 done
 
 
-# On BSD, test for net/if.h will fail unless sys/socket.h
-# is included first.
-for ac_header in net/if.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "$ac_includes_default
-#include <sys/socket.h>
-
-"
-if test "x$ac_cv_header_net_if_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_NET_IF_H 1
-_ACEOF
-
-fi
-
-done
-
-
-# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
-# is included first.
-for ac_header in sys/ucred.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "sys/ucred.h" "ac_cv_header_sys_ucred_h" "$ac_includes_default
-#include <sys/param.h>
-
-"
-if test "x$ac_cv_header_sys_ucred_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_UCRED_H 1
-_ACEOF
-
-fi
-
-done
-
-
-# At least on IRIX, test for netinet/tcp.h will fail unless
-# netinet/in.h is included first.
-for ac_header in netinet/tcp.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "netinet/tcp.h" "ac_cv_header_netinet_tcp_h" "$ac_includes_default
-#include <netinet/in.h>
-
-"
-if test "x$ac_cv_header_netinet_tcp_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_NETINET_TCP_H 1
-_ACEOF
-
-fi
-
-done
-
-
 if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
   for ac_header in readline/readline.h
 do :
diff --git a/configure.ac b/configure.ac
index 8593c50575f..c4590c9e674 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1452,6 +1452,8 @@ AC_CHECK_HEADERS(m4_normalize([
 	ifaddrs.h
 	langinfo.h
 	mbarrier.h
+	net/if.h
+	netinet/tcp.h
 	sys/epoll.h
 	sys/event.h
 	sys/ipc.h
@@ -1464,33 +1466,13 @@ AC_CHECK_HEADERS(m4_normalize([
 	sys/shm.h
 	sys/signalfd.h
 	sys/sockio.h
+	sys/ucred.h
 	sys/uio.h
 	sys/un.h
 	termios.h
 	ucred.h
 ]))
 
-# On BSD, test for net/if.h will fail unless sys/socket.h
-# is included first.
-AC_CHECK_HEADERS(net/if.h, [], [],
-[AC_INCLUDES_DEFAULT
-#include <sys/socket.h>
-])
-
-# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
-# is included first.
-AC_CHECK_HEADERS(sys/ucred.h, [], [],
-[AC_INCLUDES_DEFAULT
-#include <sys/param.h>
-])
-
-# At least on IRIX, test for netinet/tcp.h will fail unless
-# netinet/in.h is included first.
-AC_CHECK_HEADERS(netinet/tcp.h, [], [],
-[AC_INCLUDES_DEFAULT
-#include <netinet/in.h>
-])
-
 if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
   AC_CHECK_HEADERS(readline/readline.h, [],
         [AC_CHECK_HEADERS(readline.h, [],
-- 
2.37.0.3.g30cc8d0f14

Reply via email to