Skip to content

Commit 015fd38

Browse files
committed
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 5e22171; 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
1 parent e2501d8 commit 015fd38

File tree

5 files changed

+21
-29
lines changed

5 files changed

+21
-29
lines changed

configure

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ python_majorversion
683683
PYTHON
684684
perl_embed_ldflags
685685
perl_embed_ccflags
686-
perl_includedir
686+
perl_includespec
687687
perl_useshrplib
688688
perl_privlibexp
689689
perl_archlibexp
@@ -7793,11 +7793,12 @@ test "$PORTNAME" = "win32" && perl_useshrplib=`echo $perl_useshrplib | sed 's,\\
77937793
{ $as_echo "$as_me:$LINENO: result: $perl_useshrplib" >&5
77947794
$as_echo "$perl_useshrplib" >&6; }
77957795
# 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
7796+
perl_includespec="-I$perl_archlibexp/CORE"
7797+
# ... but on newer macOS versions, we must use -iwithsysroot to look
7798+
# under $PG_SYSROOT
7799+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
77997800
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
7800-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
7801+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
78017802
fi
78027803
fi
78037804

@@ -30257,12 +30258,7 @@ eval TCL_LIBS=\"$TCL_LIBS\"
3025730258
eval TCL_LIB_SPEC=\"$TCL_LIB_SPEC\"
3025830259
eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\"
3025930260

30260-
# Some macOS versions report an include spec that uses -iwithsysroot.
30261-
# We don't really want to use -isysroot, so translate that if we can.
30262-
if test x"$PG_SYSROOT" != x"" ; then
30263-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
30264-
fi
30265-
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
30261+
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
3026630262
ac_save_CPPFLAGS=$CPPFLAGS
3026730263
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
3026830264
if test "${ac_cv_header_tcl_h+set}" = set; then
@@ -30412,7 +30408,7 @@ fi
3041230408
# check for <perl.h>
3041330409
if test "$with_perl" = yes; then
3041430410
ac_save_CPPFLAGS=$CPPFLAGS
30415-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
30411+
CPPFLAGS="$CPPFLAGS $perl_includespec"
3041630412
{ $as_echo "$as_me:$LINENO: checking for perl.h" >&5
3041730413
$as_echo_n "checking for perl.h... " >&6; }
3041830414
if test "${ac_cv_header_perl_h+set}" = set; then

configure.in

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -881,14 +881,15 @@ if test "$with_perl" = yes; then
881881
fi
882882
PGAC_CHECK_PERL_CONFIGS([archlibexp,privlibexp,useshrplib])
883883
# 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
884+
perl_includespec="-I$perl_archlibexp/CORE"
885+
# ... but on newer macOS versions, we must use -iwithsysroot to look
886+
# under $PG_SYSROOT
887+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
887888
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
888-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
889+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
889890
fi
890891
fi
891-
AC_SUBST(perl_includedir)dnl
892+
AC_SUBST(perl_includespec)dnl
892893
PGAC_CHECK_PERL_EMBED_CCFLAGS
893894
PGAC_CHECK_PERL_EMBED_LDFLAGS
894895
fi
@@ -1891,11 +1892,6 @@ if test "$with_tcl" = yes; then
18911892
PGAC_EVAL_TCLCONFIGSH([$TCL_CONFIG_SH],
18921893
[TCL_INCLUDE_SPEC,TCL_LIB_FILE,TCL_LIBS,TCL_LIB_SPEC,TCL_SHARED_BUILD])
18931894
AC_SUBST(TCL_SHLIB_LD_LIBS)dnl don't want to double-evaluate that one
1894-
# Some macOS versions report an include spec that uses -iwithsysroot.
1895-
# We don't really want to use -isysroot, so translate that if we can.
1896-
if test x"$PG_SYSROOT" != x"" ; then
1897-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
1898-
fi
18991895
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
19001896
ac_save_CPPFLAGS=$CPPFLAGS
19011897
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -1906,7 +1902,7 @@ fi
19061902
# check for <perl.h>
19071903
if test "$with_perl" = yes; then
19081904
ac_save_CPPFLAGS=$CPPFLAGS
1909-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
1905+
CPPFLAGS="$CPPFLAGS $perl_includespec"
19101906
AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
19111907
[#include <EXTERN.h>])
19121908
# While we're at it, check that we can link to libperl.

src/Makefile.global.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ else
285285
endif
286286
perl_archlibexp = @perl_archlibexp@
287287
perl_privlibexp = @perl_privlibexp@
288-
perl_includedir = @perl_includedir@
288+
perl_includespec = @perl_includespec@
289289
perl_useshrplib = @perl_useshrplib@
290290
perl_embed_ccflags = @perl_embed_ccflags@
291291
perl_embed_ldflags = @perl_embed_ldflags@

src/pl/plperl/GNUmakefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ override CPPFLAGS += -DPLPERL_HAVE_UID_GID
2222
override CFLAGS += -Wno-comment
2323
endif
2424

25-
# Note: we need to make sure that the CORE directory is included last,
25+
# Note: we need to include the perl_includespec directory last,
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-
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) -I$(perl_includedir)/CORE
29+
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) $(perl_includespec)
3030

31+
# this is often, but not always, the same directory named by perl_includespec
3132
rpathdir = $(perl_archlibexp)/CORE
3233

3334

src/template/darwin

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
# Note: Darwin is the original code name for macOS, also known as OS X.
44
# We still use "darwin" as the port name, partly because config.guess does.
55

6-
# Select where some include files should be sought.
7-
# We may eventually be forced to use "-isysroot" with this value,
8-
# but for now, it only affects Perl and Tcl include files.
6+
# Some configure tests require explicit knowledge of where the Xcode "sysroot"
7+
# is. We try to avoid having this leak into configure's results, though.
98
if test x"$PG_SYSROOT" = x"" ; then
109
PG_SYSROOT=`xcodebuild -version -sdk macosx Path 2>/dev/null`
1110
fi

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy