From fd05ad3f1582884aef2db162c2c7ba4897299078 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 11 May 2022 11:08:07 +0200 Subject: [PATCH 1/9] meson: Fix Perl include dir detection Only use -iwithsysroot if required. This aligns with the logic in configure.ac. --- meson.build | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 5f8165df9c..7958e8eb19 100644 --- a/meson.build +++ b/meson.build @@ -591,8 +591,6 @@ else perl_inc_dir = '@0@/CORE'.format(archlibexp) - perl_ccflags = [] - if useshrplib != 'true' perl_may_work = false perl_msg = 'need a shared perl' @@ -606,9 +604,13 @@ else # et al seeing them. So we can't use include_directories(), as that checks # file existence. if perl_may_work - perl_ccflags += ['-I@0@'.format(perl_inc_dir)] - if host_machine.system() == 'darwin' - perl_ccflags += ['-iwithsysroot', perl_inc_dir] + # On most platforms, archlibexp is also where the Perl include files live ... + perl_ccflags = ['-I@0@'.format(perl_inc_dir)] + # ... but on newer macOS versions, we must use -iwithsysroot to look + # under sysroot + if not fs.is_file('@0@/perl.h'.format(perl_inc_dir)) and \ + fs.is_file('@0@@1@/perl.h'.format(sysroot, perl_inc_dir)) + perl_ccflags = ['-iwithsysroot', perl_inc_dir] endif endif -- 2.35.1