summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2018-10-18 18:55:23 +0000
committerTom Lane2018-10-18 18:55:23 +0000
commit015fd381fe4ec333c093e7d4364580dd0c125ee7 (patch)
tree7bb5ecee69212cb8c2d8fc4e22c8a65e3a252526
parente2501d8013b26ed017b86d9b879930ca98e71c36 (diff)
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/[email protected]
-rwxr-xr-xconfigure20
-rw-r--r--configure.in18
-rw-r--r--src/Makefile.global.in2
-rw-r--r--src/pl/plperl/GNUmakefile5
-rw-r--r--src/template/darwin5
5 files changed, 21 insertions, 29 deletions
diff --git a/configure b/configure
index 66bbcce299..dc0c83fc98 100755
--- a/configure
+++ b/configure
@@ -683,7 +683,7 @@ python_majorversion
PYTHON
perl_embed_ldflags
perl_embed_ccflags
-perl_includedir
+perl_includespec
perl_useshrplib
perl_privlibexp
perl_archlibexp
@@ -7793,11 +7793,12 @@ test "$PORTNAME" = "win32" && perl_useshrplib=`echo $perl_useshrplib | sed 's,\\
{ $as_echo "$as_me:$LINENO: result: $perl_useshrplib" >&5
$as_echo "$perl_useshrplib" >&6; }
# 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
@@ -30257,12 +30258,7 @@ eval TCL_LIBS=\"$TCL_LIBS\"
eval TCL_LIB_SPEC=\"$TCL_LIB_SPEC\"
eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\"
- # 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 <tcl.h>
+ # now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
ac_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
if test "${ac_cv_header_tcl_h+set}" = set; then
@@ -30412,7 +30408,7 @@ fi
# check for <perl.h>
if test "$with_perl" = yes; then
ac_save_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
+ CPPFLAGS="$CPPFLAGS $perl_includespec"
{ $as_echo "$as_me:$LINENO: checking for perl.h" >&5
$as_echo_n "checking for perl.h... " >&6; }
if test "${ac_cv_header_perl_h+set}" = set; then
diff --git a/configure.in b/configure.in
index 30f09a56c6..e501f2c91e 100644
--- a/configure.in
+++ b/configure.in
@@ -881,14 +881,15 @@ if test "$with_perl" = yes; then
fi
PGAC_CHECK_PERL_CONFIGS([archlibexp,privlibexp,useshrplib])
# 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
- AC_SUBST(perl_includedir)dnl
+ AC_SUBST(perl_includespec)dnl
PGAC_CHECK_PERL_EMBED_CCFLAGS
PGAC_CHECK_PERL_EMBED_LDFLAGS
fi
@@ -1891,11 +1892,6 @@ if test "$with_tcl" = yes; then
PGAC_EVAL_TCLCONFIGSH([$TCL_CONFIG_SH],
[TCL_INCLUDE_SPEC,TCL_LIB_FILE,TCL_LIBS,TCL_LIB_SPEC,TCL_SHARED_BUILD])
AC_SUBST(TCL_SHLIB_LD_LIBS)dnl don't want to double-evaluate that one
- # 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 <tcl.h>
ac_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -1906,7 +1902,7 @@ fi
# check for <perl.h>
if test "$with_perl" = yes; then
ac_save_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
+ CPPFLAGS="$CPPFLAGS $perl_includespec"
AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
[#include <EXTERN.h>])
# While we're at it, check that we can link to libperl.
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index a439b200c5..561bfb7677 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -285,7 +285,7 @@ else
endif
perl_archlibexp = @perl_archlibexp@
perl_privlibexp = @perl_privlibexp@
-perl_includedir = @perl_includedir@
+perl_includespec = @perl_includespec@
perl_useshrplib = @perl_useshrplib@
perl_embed_ccflags = @perl_embed_ccflags@
perl_embed_ldflags = @perl_embed_ldflags@
diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile
index 7559d4565d..e92d7bb7eb 100644
--- a/src/pl/plperl/GNUmakefile
+++ b/src/pl/plperl/GNUmakefile
@@ -22,12 +22,13 @@ override CPPFLAGS += -DPLPERL_HAVE_UID_GID
override CFLAGS += -Wno-comment
endif
-# Note: we need to make sure that the CORE directory is included last,
+# Note: we need to include the perl_includespec directory last,
# probably because it sometimes contains some header files with names
# that clash with some of ours, or with some that we include, notably on
# Windows.
-override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) -I$(perl_includedir)/CORE
+override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) $(perl_includespec)
+# this is often, but not always, the same directory named by perl_includespec
rpathdir = $(perl_archlibexp)/CORE
diff --git a/src/template/darwin b/src/template/darwin
index 7022733566..159d8bb127 100644
--- a/src/template/darwin
+++ b/src/template/darwin
@@ -3,9 +3,8 @@
# Note: Darwin is the original code name for macOS, also known as OS X.
# We still use "darwin" as the port name, partly because config.guess does.
-# Select where some include files should be sought.
-# We may eventually be forced to use "-isysroot" with this value,
-# but for now, it only affects Perl and Tcl include files.
+# Some configure tests require explicit knowledge of where the Xcode "sysroot"
+# is. We try to avoid having this leak into configure's results, though.
if test x"$PG_SYSROOT" = x"" ; then
PG_SYSROOT=`xcodebuild -version -sdk macosx Path 2>/dev/null`
fi