From 021b355cd1668c667f34b76c56fe6b3f8dbaefe3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 18 Oct 2018 14:55:23 -0400 Subject: Still further rethinking of build changes for macOS Mojave. To avoid the sorts of problems complained of by Jakob Egger, it'd be best if configure didn't emit any references to the sysroot path at all. In the case of PL/Tcl, we can do that just by keeping our hands off the TCL_INCLUDE_SPEC string altogether. In the case of PL/Perl, we need to substitute -iwithsysroot for -I in the compile commands, which is easily handled if we change to using a configure output variable that includes the switch not only the directory name. Since PL/Tcl and PL/Python already do it like that, this seems like good consistency cleanup anyway. Hence, this replaces the advice given to Perl-related extensions in commit 5e2217131; instead of writing "-I$(perl_archlibexp)/CORE", they should just write "$(perl_includespec)". (The old way continues to work, but not on recent macOS.) It's still the case that configure needs to be aware of the sysroot path internally, but that's cleaner than what we had before. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us --- configure | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'configure') diff --git a/configure b/configure index d78992c1ed7..542bf7355fd 100755 --- a/configure +++ b/configure @@ -671,7 +671,7 @@ python_majorversion PYTHON perl_embed_ldflags perl_embed_ccflags -perl_includedir +perl_includespec perl_useshrplib perl_privlibexp perl_archlibexp @@ -7540,11 +7540,12 @@ documentation for details. Use --without-perl to disable building PL/Perl." "$LINENO" 5 fi # On most platforms, archlibexp is also where the Perl include files live ... - perl_includedir="$perl_archlibexp" - # ... but on some macOS versions, we must look under $PG_SYSROOT instead - if test x"$PG_SYSROOT" != x"" ; then + perl_includespec="-I$perl_archlibexp/CORE" + # ... but on newer macOS versions, we must use -iwithsysroot to look + # under $PG_SYSROOT + if test \! -f "$perl_archlibexp/CORE/perl.h" ; then if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then - perl_includedir="$PG_SYSROOT$perl_archlibexp" + perl_includespec="-iwithsysroot $perl_archlibexp/CORE" fi fi @@ -15183,11 +15184,6 @@ 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" @@ -15205,7 +15201,7 @@ fi # check for if test "$with_perl" = yes; then ac_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE" + CPPFLAGS="$CPPFLAGS $perl_includespec" ac_fn_c_check_header_compile "$LINENO" "perl.h" "ac_cv_header_perl_h" "#include " if test "x$ac_cv_header_perl_h" = xyes; then : -- cgit v1.2.3