--- configure	2024-05-27 04:04:39.000000000 +0800
+++ configure	2024-05-28 13:32:01.000000000 +0800
@@ -1,4 +1,5 @@
 # Anticonf script by Jeroen Ooms (2020)
+# But fixed by MacPorts (2023).
 # This script will prefer cflags (specifically includefile dirs) and lib dirs
 # in the following order of precedence:
 #   (1) INCLUDE_DIR or LIB_DIR entered explicitly on the command line, e.g.
@@ -12,54 +13,14 @@
 PKG_RPM_NAME="postgresql-devel"
 PKG_AMZ_RPM_NAMES="postgreql8-devel, postgresql92-devel, postgresql93-devel, or postgresql94-devel"
 PKG_CSW_NAME="postgresql_dev"
-PKG_BREW_NAME="libpq"
+PKG_MP_NAME="libpq"
 PKG_TEST_HEADER="<libpq-fe.h>"
 PKG_LIBS="-lpq"
 
-# Extra checks on MacOS for SSL support in libpq
-# command -v is probably fine: https://stackoverflow.com/a/677212/946850
-if [ "`uname`" = Darwin ] && [ "`command -v pkg-config`" ]; then
-  if pkg-config --atleast-version=15 libpq; then
-    case "`pkg-config --libs --static libpq`" in
-    *crypto*)
-      echo "Local libpq has SSL support"
-      ;;
-    *)
-      echo "Local libpq does not have SSL support"
-      FORCE_AUTOBREW=1
-      ;;
-    esac
-  else
-    FORCE_AUTOBREW=1
-  fi
-fi
-
-# pkg-config values (if available)
-if [ -z "$FORCE_AUTOBREW" ] && [ "`command -v pkg-config`" ]; then
-  PKGCONFIG_CFLAGS=`pkg-config --cflags --silence-errors ${PKG_CONFIG_NAME}`
-  PKGCONFIG_LIBS=`pkg-config --libs --silence-errors ${PKG_CONFIG_NAME}`
-  PKGCONFIG_MODVERSION=`pkg-config --modversion --silence-errors ${PKG_CONFIG_NAME}`
-
-  # Workaround for broken libpq.pc files on some systems
-  if [ `uname` = "Darwin" ]; then
-    case "$PKGCONFIG_CFLAGS" in
-      *"Internal.sdk"*)
-        unset PKGCONFIG_CFLAGS
-        unset PKGCONFIG_LIBS
-      ;;
-    esac
-    if [ -z "$PKGCONFIG_CFLAGS" ]; then
-      unset PKGCONFIG_LIBS
-    fi
-  fi
-fi
-
 # pg_config values (if available)
-if [ -z "$FORCE_AUTOBREW" ] && [ "`command -v pg_config`" ]; then
   PG_INC_DIR=`pg_config --includedir`
   PG_LIB_DIR=`pg_config --libdir`
   PG_VERSION=`pg_config --version`
-fi
 
 # Note that cflags may be empty in case of success
 if [ "$INCLUDE_DIR" ] || [ "$LIB_DIR" ]; then
@@ -82,16 +43,6 @@
 
   PKG_CFLAGS="-I${PG_INC_DIR}"
   PKG_LIBS="-L${PG_LIB_DIR} ${PKG_LIBS}"
-elif [ `uname` = "Darwin" ]; then
-  brew --version 2>/dev/null
-  if [ $? -eq 0 ] && [ -z "$FORCE_AUTOBREW" ]; then
-    BREWDIR=`brew --prefix`
-    PKG_CFLAGS="-I$BREWDIR/opt/$PKG_BREW_NAME/include"
-    PKG_LIBS="-L$BREWDIR/opt/$PKG_BREW_NAME/lib $PKG_LIBS"
-  else
-    curl -sfL "https://autobrew.github.io/scripts/libpq" > autobrew
-    . ./autobrew
-  fi
 fi
 
 if [ "$R_PLOGR_ENABLE" ]; then
@@ -119,7 +70,7 @@
   echo " * rpm: $PKG_RPM_NAME (Fedora, EPEL)"
   echo " * rpm: $PKG_AMZ_RPM_NAMES (Amazon Linux)"
   echo " * csw: $PKG_CSW_NAME (Solaris)"
-  echo " * brew: $PKG_BREW_NAME (OSX)"
+  echo " * port: $PKG_MP_NAME (OSX)"
   echo "If $PKG_CONFIG_NAME is already installed, check that either:"
   echo "(i)  'pkg-config' is in your PATH AND PKG_CONFIG_PATH contains"
   echo "     a $PKG_CONFIG_NAME.pc file; or"
