From 6831cd9e3b082d7b830c3196742dd49e3540c49b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 16 Jan 2026 17:21:32 +0100 Subject: [PATCH] Fix PL/Python build on MSVC with older Meson Amendment for commit 2bc60f86219. With older Meson versions, we need to specify the Python include directory directly to cc.check_header instead of relying on the dependency to pass it through. Author: Bryan Green Discussion: https://www.postgresql.org/message-id/0de98c41-4145-44c1-aac5-087cf5b3e4a9%40gmail.com --- meson.build | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index eedd40b8137..6d304f32fb0 100644 --- a/meson.build +++ b/meson.build @@ -1342,17 +1342,22 @@ if not pyopt.disabled() # this internally: # . if host_system == 'windows' and cc.get_id() == 'msvc' - python3_libdir = python3_inst.get_variable('prefix') / 'libs' + python3_prefix = python3_inst.get_variable('prefix') + python3_libdir = python3_prefix / 'libs' + python3_incdir = python3_prefix / 'include' python3_lib = cc.find_library('python3', dirs: python3_libdir, required: pyopt) python3_dep = declare_dependency( - include_directories: include_directories(python3_inst.get_variable('prefix') / 'include'), + include_directories: include_directories(python3_incdir), dependencies: python3_lib, ) + # Explicit args needed for older Meson compatibility + python3_header_check_args = ['/I' + python3_incdir] else python3_dep = python3_inst.dependency(embed: true, required: pyopt) + python3_header_check_args = [] endif # Remove this check after we depend on Meson >= 1.1.0 - if not cc.check_header('Python.h', dependencies: python3_dep, required: pyopt, include_directories: postgres_inc) + if not cc.check_header('Python.h', args: python3_header_check_args, dependencies: python3_dep, required: pyopt, include_directories: postgres_inc) python3_dep = not_found_dep endif endif