From 68fc227dd0737f38295f3dee0c10268ad11a5150 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 16 Oct 2018 16:27:15 -0400 Subject: Back off using -isysroot on Darwin. Rethink the solution applied in commit 5e2217131 to get PL/Tcl to build on macOS Mojave. I feared that adding -isysroot globally might have undesirable consequences, and sure enough Jakob Egger reported one: it complicates building extensions with a different Xcode version than was used for the core server. (I find that a risky proposition in general, but apparently it works most of the time, so we shouldn't break it if we don't have to.) We'd already adopted the solution for PL/Perl of inserting the sysroot path directly into the -I switches used to find Perl's headers, and we can do the same thing for PL/Tcl by changing the -iwithsysroot switch that Apple's tclConfig.sh reports. This restricts the risks to PL/Perl and PL/Tcl themselves and directly-dependent extensions, which is a lot more pleasing in general than a global -isysroot switch. Along the way, tighten the test to see if we need to inject the sysroot path into $perl_includedir, as I'd speculated about upthread but not gotten round to doing. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us --- configure | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index b7250d7f5b..5e686b2a21 100755 --- a/configure +++ b/configure @@ -9778,7 +9778,7 @@ PL/Perl." "$LINENO" 5 perl_includedir="$perl_archlibexp" # ... but on some macOS versions, we must look under $PG_SYSROOT instead if test x"$PG_SYSROOT" != x"" ; then - if test -d "$PG_SYSROOT$perl_archlibexp" ; then + if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then perl_includedir="$PG_SYSROOT$perl_archlibexp" fi fi @@ -18114,6 +18114,11 @@ eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\" as_fn_error $? "cannot build PL/Tcl because Tcl is not a shared library Use --without-tcl to disable building PL/Tcl." "$LINENO" 5 fi + # Some macOS versions report an include spec that uses -iwithsysroot. + # We don't really want to use -isysroot, so translate that if we can. + if test x"$PG_SYSROOT" != x"" ; then + TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`" + fi # now that we have TCL_INCLUDE_SPEC, we can check for ac_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS" -- cgit v1.2.3