Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6019247

Browse files
committed
Make some fixes to allow building Postgres on macOS 10.14 ("Mojave").
Apple's latest rearrangements of the system-supplied headers have brokenbuilding of PL/Perl and PL/Tcl. The only practical way to fix PL/Tcl is tostart using the "-isysroot" compiler flag to point to SDK-supplied headers,as Apple expects. We must also start distinguishing where to find Perl'sheaders from where to find its shared library; but that seems like goodcleanup anyway.Extensions that formerly did something like -I$(perl_archlibexp)/COREshould now do -I$(perl_includedir)/CORE instead. perl_archlibexpis still the place to look for libperl.so, though.If for some reason you don't like the default -isysroot setting, you canoverride that by setting PG_SYSROOT in configure's arguments. I don'tcurrently think people would need to do so, unless maybe for cross-versionbuild purposes.In addition, teach configure where to find tclConfig.sh. Our traditionalmethod of searching $auto_path hasn't worked for the last couple of macOSreleases, and it now seems clear that Apple's not going to change that.The workaround of manually specifying --with-tclconfig was annoyingalready, but Mojave's made it a lot more so because the sysroot path nowhas to be included as well. Let's just wire the knowledge into configureinstead. 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 buildfarmcares about that. The changes are set up to not do anything on macOSreleases that are old enough to not have functional sysroot trees.
1 parent7ecdeb5 commit6019247

File tree

6 files changed

+61
-9
lines changed

6 files changed

+61
-9
lines changed

‎config/tcl.m4

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ fi
1313

1414
# PGAC_PATH_TCLCONFIGSH([SEARCH-PATH])
1515
# ------------------------------------
16+
# If the user doesn't specify $TCL_CONFIG_SH directly, search for it in
17+
# the list of directories passed as parameter (from --with-tclconfig).
18+
# If no list is given, try the Tcl shell's $auto_path.
19+
1620
AC_DEFUN([PGAC_PATH_TCLCONFIGSH],
1721
[AC_REQUIRE([PGAC_PATH_TCLSH])[]dnl
1822
AC_BEFORE([$0],[PGAC_PATH_TKCONFIGSH])[]dnl
@@ -24,7 +28,14 @@ if test -z "$TCL_CONFIG_SH"; then
2428
set X $pgac_test_dirs; shift
2529
if test $[#] -eq 0; then
2630
test -z "$TCLSH" &&AC_MSG_ERROR([unable to locate tclConfig.sh because no Tcl shell was found])
27-
set X `echo 'puts $auto_path' | $TCLSH`; shift
31+
pgac_test_dirs=`echo 'puts $auto_path' | $TCLSH`
32+
# On newer macOS, $auto_path frequently doesn't include the place
33+
# where tclConfig.sh actually lives. Append that to the end, so as not
34+
# to break cases where a non-default Tcl installation is being used.
35+
if test -d "$PG_SYSROOT/System/Library/Frameworks/Tcl.framework" ; then
36+
pgac_test_dirs="$pgac_test_dirs $PG_SYSROOT/System/Library/Frameworks/Tcl.framework"
37+
fi
38+
set X $pgac_test_dirs; shift
2839
fi
2940
3041
for pgac_dir do

‎configure

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ python_majorversion
683683
PYTHON
684684
perl_embed_ldflags
685685
perl_embed_ccflags
686+
perl_includedir
686687
perl_useshrplib
687688
perl_privlibexp
688689
perl_archlibexp
@@ -7791,6 +7792,14 @@ perl_useshrplib=`$PERL -MConfig -e 'print $Config{useshrplib}'`
77917792
test "$PORTNAME" = "win32" && perl_useshrplib=`echo $perl_useshrplib | sed 's,\\\\,/,g'`
77927793
{ $as_echo "$as_me:$LINENO: result: $perl_useshrplib" >&5
77937794
$as_echo "$perl_useshrplib" >&6; }
7795+
# On most platforms, archlibexp is also where the Perl include files live ...
7796+
perl_includedir="$perl_archlibexp"
7797+
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
7798+
if test x"$PG_SYSROOT" != x"" ; then
7799+
if test -d "$PG_SYSROOT$perl_archlibexp" ; then
7800+
perl_includedir="$PG_SYSROOT$perl_archlibexp"
7801+
fi
7802+
fi
77947803

77957804
{ $as_echo "$as_me:$LINENO: checking for CFLAGS recommended by Perl" >&5
77967805
$as_echo_n "checking for CFLAGS recommended by Perl... " >&6; }
@@ -30212,7 +30221,14 @@ if test -z "$TCL_CONFIG_SH"; then
3021230221
test -z "$TCLSH" && { { $as_echo "$as_me:$LINENO: error: unable to locate tclConfig.sh because no Tcl shell was found" >&5
3021330222
$as_echo "$as_me: error: unable to locate tclConfig.sh because no Tcl shell was found" >&2;}
3021430223
{ (exit 1); exit 1; }; }
30215-
set X `echo 'puts $auto_path' | $TCLSH`; shift
30224+
pgac_test_dirs=`echo 'puts $auto_path' | $TCLSH`
30225+
# On newer macOS, $auto_path frequently doesn't include the place
30226+
# where tclConfig.sh actually lives. Append that to the end, so as not
30227+
# to break cases where a non-default Tcl installation is being used.
30228+
if test -d "$PG_SYSROOT/System/Library/Frameworks/Tcl.framework" ; then
30229+
pgac_test_dirs="$pgac_test_dirs $PG_SYSROOT/System/Library/Frameworks/Tcl.framework"
30230+
fi
30231+
set X $pgac_test_dirs; shift
3021630232
fi
3021730233

3021830234
for pgac_dir do
@@ -30393,7 +30409,7 @@ fi
3039330409
# check for <perl.h>
3039430410
if test "$with_perl" = yes; then
3039530411
ac_save_CPPFLAGS=$CPPFLAGS
30396-
CPPFLAGS="$CPPFLAGS -I$perl_archlibexp/CORE"
30412+
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
3039730413
{ $as_echo "$as_me:$LINENO: checking for perl.h" >&5
3039830414
$as_echo_n "checking for perl.h... " >&6; }
3039930415
if test "${ac_cv_header_perl_h+set}" = set; then

‎configure.in

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,15 @@ if test "$with_perl" = yes; then
880880
AC_MSG_ERROR([Perl not found])
881881
fi
882882
PGAC_CHECK_PERL_CONFIGS([archlibexp,privlibexp,useshrplib])
883+
# On most platforms, archlibexp is also where the Perl include files live ...
884+
perl_includedir="$perl_archlibexp"
885+
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
886+
if test x"$PG_SYSROOT" != x"" ; then
887+
if test -d "$PG_SYSROOT$perl_archlibexp" ; then
888+
perl_includedir="$PG_SYSROOT$perl_archlibexp"
889+
fi
890+
fi
891+
AC_SUBST(perl_includedir)dnl
883892
PGAC_CHECK_PERL_EMBED_CCFLAGS
884893
PGAC_CHECK_PERL_EMBED_LDFLAGS
885894
fi
@@ -1892,7 +1901,7 @@ fi
18921901
# check for <perl.h>
18931902
if test "$with_perl" = yes; then
18941903
ac_save_CPPFLAGS=$CPPFLAGS
1895-
CPPFLAGS="$CPPFLAGS -I$perl_archlibexp/CORE"
1904+
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
18961905
AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
18971906
[#include <EXTERN.h>])
18981907
# While we're at it, check that we can link to libperl.

‎src/Makefile.global.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ else
285285
endif
286286
perl_archlibexp= @perl_archlibexp@
287287
perl_privlibexp= @perl_privlibexp@
288+
perl_includedir= @perl_includedir@
288289
perl_useshrplib= @perl_useshrplib@
289290
perl_embed_ccflags= @perl_embed_ccflags@
290291
perl_embed_ldflags= @perl_embed_ldflags@

‎src/pl/plperl/GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif
2626
# probably because it sometimes contains some header files with names
2727
# that clash with some of ours, or with some that we include, notably on
2828
# Windows.
29-
overrideCPPFLAGS := -I. -I$(srcdir)$(CPPFLAGS)$(perl_embed_ccflags) -I$(perl_archlibexp)/CORE
29+
overrideCPPFLAGS := -I. -I$(srcdir)$(CPPFLAGS)$(perl_embed_ccflags) -I$(perl_includedir)/CORE
3030

3131
rpathdir =$(perl_archlibexp)/CORE
3232

‎src/template/darwin

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
# src/template/darwin
22

3-
# Select appropriate semaphore support. Darwin 6.0 (Mac OS X 10.2) and up
4-
# support System V semaphores; before that we have to use POSIX semaphores,
5-
# which are less good for our purposes because they eat a file descriptor
6-
# per backend per max_connection slot.
3+
# Note: Darwin is the original code name for macOS, also known as OS X.
4+
# We still use "darwin" as the port name, partly because config.guess does.
5+
6+
# Select where system include files should be sought.
7+
if test x"$PG_SYSROOT" = x"" ; then
8+
PG_SYSROOT=`xcodebuild -version -sdk macosx Path 2>/dev/null`
9+
fi
10+
if test x"$PG_SYSROOT" != x"" ; then
11+
if test -d "$PG_SYSROOT" ; then
12+
CPPFLAGS="$CPPFLAGS -isysroot $PG_SYSROOT"
13+
else
14+
PG_SYSROOT=""
15+
fi
16+
fi
17+
18+
# Select appropriate semaphore support. Darwin 6.0 (macOS 10.2) and up
19+
# support System V semaphores; before that we have to use named POSIX
20+
# semaphores, which are less good for our purposes because they eat a
21+
# file descriptor per backend per max_connection slot.
722
case $host_os in
823
darwin[015].*)
924
USE_NAMED_POSIX_SEMAPHORES=1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp