Index: configure
--- configure.orig	2024-09-23 22:02:53.000000000 +0200
+++ configure	2024-09-26 22:17:06.229277000 +0200
@@ -8175,7 +8175,7 @@
 Use --without-icu to disable ICU support." "$LINENO" 5
 else
 	ICU_CFLAGS=$pkg_cv_ICU_CFLAGS
-	ICU_LIBS=$pkg_cv_ICU_LIBS
+	ICU_LIBS="$pkg_cv_ICU_LIBS -lstdc++"
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
@@ -10061,12 +10061,6 @@
 test "$PORTNAME" = "win32" && perl_useshrplib=`echo $perl_useshrplib | sed 's,\\\\,/,g'`
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_useshrplib" >&5
 $as_echo "$perl_useshrplib" >&6; }
-  if test "$perl_useshrplib" != yes && test "$perl_useshrplib" != true; then
-    as_fn_error $? "cannot build PL/Perl because libperl is not a shared library
-You might have to rebuild your Perl installation.  Refer to the
-documentation for details.  Use --without-perl to disable building
-PL/Perl." "$LINENO" 5
-  fi
   # On most platforms, archlibexp is also where the Perl include files live ...
   perl_includespec="-I$perl_archlibexp/CORE"
   # ... but on newer macOS versions, we must use -iwithsysroot to look
@@ -10289,12 +10283,6 @@
 		done
 	fi
 fi
-if test "$found_shlib" != 1; then
-	as_fn_error $? "could not find shared library for Python
-You might have to rebuild your Python installation.  Refer to the
-documentation for details.  Use --without-python to disable building
-PL/Python." "$LINENO" 5
-fi
 python_libspec="-L${python_libdir} -l${ldlibrary}"
 
 python_additional_libs=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
Index: src/Makefile.shlib
--- src/Makefile.shlib.orig	2024-09-23 22:02:53.000000000 +0200
+++ src/Makefile.shlib	2024-09-26 22:17:06.229452000 +0200
@@ -231,7 +231,7 @@
 
 .PHONY: all-lib all-static-lib all-shared-lib
 
-all-lib: all-shared-lib
+all-lib:
 ifdef soname
 # no static library when building a dynamically loadable module
 all-lib: all-static-lib
Index: src/interfaces/libpq/Makefile
--- src/interfaces/libpq/Makefile.orig	2024-09-26 22:17:06.229606000 +0200
+++ src/interfaces/libpq/Makefile	2024-09-26 22:19:14.435840000 +0200
@@ -113,13 +113,6 @@
 # by statically-linked libraries, as we can't expect them to honor this
 # coding rule.
 libpq-refs-stamp: $(shlib)
-ifneq ($(enable_coverage), yes)
-ifeq (,$(filter solaris,$(PORTNAME)))
-	@if nm -A -u $< 2>/dev/null | grep -v -e __cxa_atexit -e __tsan_func_exit | grep exit; then \
-		echo 'libpq must not be calling any function which invokes exit'; exit 1; \
-	fi
-endif
-endif
 	touch $@
 
 # Make dependencies on pg_config_paths.h visible in all builds.
Index: src/makefiles/Makefile.freebsd
--- src/makefiles/Makefile.freebsd.orig	2024-09-23 22:02:53.000000000 +0200
+++ src/makefiles/Makefile.freebsd	2024-09-26 22:17:06.229780000 +0200
@@ -11,4 +11,4 @@
 
 # Rule for building a shared library from a single .o file
 %.so: %.o
-	$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
+	$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $(SHLIB_LINK)
Index: src/makefiles/Makefile.linux
--- src/makefiles/Makefile.linux.orig	2024-09-23 22:02:53.000000000 +0200
+++ src/makefiles/Makefile.linux	2024-09-26 22:17:06.229850000 +0200
@@ -5,4 +5,4 @@
 
 # Rule for building a shared library from a single .o file
 %.so: %.o
-	$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
+	$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $(SHLIB_LINK)
