aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-09-25 13:23:29 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-09-25 13:23:29 -0400
commit6dc28d291548a132d0dede79c30879ae9c6565e1 (patch)
treeb9fbfcf24fb3786d6350ddbe69512ad8a8f756bf /src
parent6ed095edb77651108222c881574f35e3be8980e2 (diff)
downloadpostgresql-6dc28d291548a132d0dede79c30879ae9c6565e1.tar.gz
postgresql-6dc28d291548a132d0dede79c30879ae9c6565e1.zip
Make some fixes to allow building Postgres on macOS 10.14 ("Mojave").
Apple's latest rearrangements of the system-supplied headers have broken building of PL/Perl and PL/Tcl. The only practical way to fix PL/Tcl is to start using the "-isysroot" compiler flag to point to SDK-supplied headers, as Apple expects. We must also start distinguishing where to find Perl's headers from where to find its shared library; but that seems like good cleanup anyway. Extensions that formerly did something like -I$(perl_archlibexp)/CORE should now do -I$(perl_includedir)/CORE instead. perl_archlibexp is still the place to look for libperl.so, though. If for some reason you don't like the default -isysroot setting, you can override that by setting PG_SYSROOT in configure's arguments. I don't currently think people would need to do so, unless maybe for cross-version build purposes. In addition, teach configure where to find tclConfig.sh. Our traditional method of searching $auto_path hasn't worked for the last couple of macOS releases, and it now seems clear that Apple's not going to change that. The workaround of manually specifying --with-tclconfig was annoying already, but Mojave's made it a lot more so because the sysroot path now has to be included as well. Let's just wire the knowledge into configure instead. To avoid breaking builds against non-default Tcl installations (e.g. MacPorts) wherein the $auto_path method probably still works, arrange to try the additional case only after all else has failed. Back-patch to all supported versions, since at least the buildfarm cares about that. The changes are set up to not do anything on macOS releases that are old enough to not have functional sysroot trees.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.global.in1
-rw-r--r--src/pl/plperl/GNUmakefile2
-rw-r--r--src/template/darwin23
3 files changed, 21 insertions, 5 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 72bd7156b1d..f76beee9b44 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -306,6 +306,7 @@ else
endif
perl_archlibexp = @perl_archlibexp@
perl_privlibexp = @perl_privlibexp@
+perl_includedir = @perl_includedir@
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 191f74067a6..d1c84279a6a 100644
--- a/src/pl/plperl/GNUmakefile
+++ b/src/pl/plperl/GNUmakefile
@@ -16,7 +16,7 @@ endif
# 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_archlibexp)/CORE
+override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) -I$(perl_includedir)/CORE
rpathdir = $(perl_archlibexp)/CORE
diff --git a/src/template/darwin b/src/template/darwin
index 542f706b0fa..cff258be26b 100644
--- a/src/template/darwin
+++ b/src/template/darwin
@@ -1,9 +1,24 @@
# src/template/darwin
-# Select appropriate semaphore support. Darwin 6.0 (Mac OS X 10.2) and up
-# support System V semaphores; before that we have to use POSIX semaphores,
-# which are less good for our purposes because they eat a file descriptor
-# per backend per max_connection slot.
+# 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 system include files should be sought.
+if test x"$PG_SYSROOT" = x"" ; then
+ PG_SYSROOT=`xcodebuild -version -sdk macosx Path 2>/dev/null`
+fi
+if test x"$PG_SYSROOT" != x"" ; then
+ if test -d "$PG_SYSROOT" ; then
+ CPPFLAGS="$CPPFLAGS -isysroot $PG_SYSROOT"
+ else
+ PG_SYSROOT=""
+ fi
+fi
+
+# Select appropriate semaphore support. Darwin 6.0 (macOS 10.2) and up
+# support System V semaphores; before that we have to use named POSIX
+# semaphores, which are less good for our purposes because they eat a
+# file descriptor per backend per max_connection slot.
case $host_os in
darwin[015].*)
USE_NAMED_POSIX_SEMAPHORES=1