From 11411bd2dce8d13bb74371d850b1f707b1dd8a01 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 15 Oct 2022 14:02:35 -0700
Subject: [PATCH v1] meson: macos: Use -Wl,-undefined,error for modules

meson defaults to -Wl,-undefined,dynamic_lookup for modules, which we don't
want because a) it's different from what we do for autoconf, b) it causes
warnings starting in macOS Ventura when combined with -bundle_loader.

ci-os-only: macos

Author:
Reviewed-by:
Discussion: https://postgr.es/m/
Backpatch:
---
 meson.build | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meson.build b/meson.build
index fdf8ec8ad9c..f288f0a5fc7 100644
--- a/meson.build
+++ b/meson.build
@@ -228,6 +228,11 @@ elif host_system == 'darwin'
   message('darwin sysroot: @0@'.format(pg_sysroot))
   cflags += ['-isysroot', pg_sysroot]
   ldflags += ['-isysroot', pg_sysroot]
+  # meson defaults to -Wl,-undefined,dynamic_lookup for modules, which we
+  # don't want because a) it's different from what we do for autoconf, b) it
+  # causes warnings starting in macOS Ventura when combined with
+  # -bundle_loader
+  ldflags_mod += ['-Wl,-undefined,error']
 
 elif host_system == 'freebsd'
   sema_kind = 'unnamed_posix'
-- 
2.38.0

