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