From c63c102e2609c4ce86e4e3b63ecc5736550ca79b Mon Sep 17 00:00:00 2001
From: Rachel Heaton <rheaton@vmware.com>
Date: Mon, 27 Sep 2021 15:38:06 -0700
Subject: [PATCH] Print error when libpq-refs-stamp fails

The current failure is very difficult to parse without prior context.
Prior context: https://www.postgresql.org/message-id/flat/3128896.1624742969%40sss.pgh.pa.us

Co-authored-by: Jacob Champion <pchampion@vmware.com>
---
 src/interfaces/libpq/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 7cbdeb589b..34e972a08b 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -115,7 +115,9 @@ backend_src = $(top_srcdir)/src/backend
 libpq-refs-stamp: $(shlib)
 ifneq ($(enable_coverage), yes)
 ifeq (,$(filter aix solaris,$(PORTNAME)))
-	! nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit
+	@if nm -a -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit; then \
+		echo 'libpq must not call exit'; exit 1; \
+	fi
 endif
 endif
 	touch $@
-- 
2.28.0

