Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d1e869d

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 0a21c6d commit d1e869d

File tree

7 files changed

+24
-38
lines changed

7 files changed

+24
-38
lines changed

configure

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ python_majorversion
668668
PYTHON
669669
perl_embed_ldflags
670670
perl_embed_ccflags
671-
perl_includedir
671+
perl_includespec
672672
perl_useshrplib
673673
perl_privlibexp
674674
perl_archlibexp
@@ -9549,11 +9549,12 @@ documentation for details. Use --without-perl to disable building
95499549
PL/Perl." "$LINENO" 5
95509550
fi
95519551
# On most platforms, archlibexp is also where the Perl include files live ...
9552-
perl_includedir="$perl_archlibexp"
9553-
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
9554-
if test x"$PG_SYSROOT" != x"" ; then
9552+
perl_includespec="-I$perl_archlibexp/CORE"
9553+
# ... but on newer macOS versions, we must use -iwithsysroot to look
9554+
# under $PG_SYSROOT
9555+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
95559556
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
9556-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
9557+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
95579558
fi
95589559
fi
95599560

@@ -18135,11 +18136,6 @@ eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\"
1813518136
as_fn_error $? "cannot build PL/Tcl because Tcl is not a shared library
1813618137
Use --without-tcl to disable building PL/Tcl." "$LINENO" 5
1813718138
fi
18138-
# Some macOS versions report an include spec that uses -iwithsysroot.
18139-
# We don't really want to use -isysroot, so translate that if we can.
18140-
if test x"$PG_SYSROOT" != x"" ; then
18141-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
18142-
fi
1814318139
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
1814418140
ac_save_CPPFLAGS=$CPPFLAGS
1814518141
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -18157,7 +18153,7 @@ fi
1815718153
# check for <perl.h>
1815818154
if test "$with_perl" = yes; then
1815918155
ac_save_CPPFLAGS=$CPPFLAGS
18160-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
18156+
CPPFLAGS="$CPPFLAGS $perl_includespec"
1816118157
ac_fn_c_check_header_compile "$LINENO" "perl.h" "ac_cv_header_perl_h" "#include <EXTERN.h>
1816218158
"
1816318159
if test "x$ac_cv_header_perl_h" = xyes; then :

configure.in

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,14 +1034,15 @@ documentation for details. Use --without-perl to disable building
10341034
PL/Perl.])
10351035
fi
10361036
# On most platforms, archlibexp is also where the Perl include files live ...
1037-
perl_includedir="$perl_archlibexp"
1038-
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
1039-
if test x"$PG_SYSROOT" != x"" ; then
1037+
perl_includespec="-I$perl_archlibexp/CORE"
1038+
# ... but on newer macOS versions, we must use -iwithsysroot to look
1039+
# under $PG_SYSROOT
1040+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
10401041
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
1041-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
1042+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
10421043
fi
10431044
fi
1044-
AC_SUBST(perl_includedir)dnl
1045+
AC_SUBST(perl_includespec)dnl
10451046
PGAC_CHECK_PERL_EMBED_CCFLAGS
10461047
PGAC_CHECK_PERL_EMBED_LDFLAGS
10471048
fi
@@ -2213,11 +2214,6 @@ if test "$with_tcl" = yes; then
22132214
AC_MSG_ERROR([cannot build PL/Tcl because Tcl is not a shared library
22142215
Use --without-tcl to disable building PL/Tcl.])
22152216
fi
2216-
# Some macOS versions report an include spec that uses -iwithsysroot.
2217-
# We don't really want to use -isysroot, so translate that if we can.
2218-
if test x"$PG_SYSROOT" != x"" ; then
2219-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
2220-
fi
22212217
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
22222218
ac_save_CPPFLAGS=$CPPFLAGS
22232219
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -2228,7 +2224,7 @@ fi
22282224
# check for <perl.h>
22292225
if test "$with_perl" = yes; then
22302226
ac_save_CPPFLAGS=$CPPFLAGS
2231-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
2227+
CPPFLAGS="$CPPFLAGS $perl_includespec"
22322228
AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
22332229
[#include <EXTERN.h>])
22342230
# While we're at it, check that we can link to libperl.

contrib/hstore_plperl/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,5 @@ rpathdir = $(perl_archlibexp)/CORE
3535
SHLIB_LINK += $(perl_embed_ldflags)
3636
endif
3737

38-
# As with plperl we need to make sure that the CORE directory is included
39-
# last, probably because it sometimes contains some header files with names
40-
# that clash with some of ours, or with some that we include, notably on
41-
# Windows.
42-
override CPPFLAGS := $(CPPFLAGS) $(perl_embed_ccflags) -I$(perl_includedir)/CORE
38+
# As with plperl we need to include the perl_includespec directory last.
39+
override CPPFLAGS := $(CPPFLAGS) $(perl_embed_ccflags) $(perl_includespec)

contrib/jsonb_plperl/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,5 @@ rpathdir = $(perl_archlibexp)/CORE
3535
SHLIB_LINK += $(perl_embed_ldflags)
3636
endif
3737

38-
# As with plperl we need to make sure that the CORE directory is included
39-
# last, probably because it sometimes contains some header files with names
40-
# that clash with some of ours, or with some that we include, notably on
41-
# Windows.
42-
override CPPFLAGS := $(CPPFLAGS) $(perl_embed_ccflags) -I$(perl_includedir)/CORE
38+
# As with plperl we need to include the perl_includespec directory last.
39+
override CPPFLAGS := $(CPPFLAGS) $(perl_embed_ccflags) $(perl_includespec)

src/Makefile.global.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ else
331331
endif
332332
perl_archlibexp = @perl_archlibexp@
333333
perl_privlibexp = @perl_privlibexp@
334-
perl_includedir = @perl_includedir@
334+
perl_includespec = @perl_includespec@
335335
perl_embed_ccflags = @perl_embed_ccflags@
336336
perl_embed_ldflags = @perl_embed_ldflags@
337337

src/pl/plperl/GNUmakefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ override CPPFLAGS += -DPLPERL_HAVE_UID_GID
1212
override CPPFLAGS += -Wno-comment
1313
endif
1414

15-
# Note: we need to make sure that the CORE directory is included last,
15+
# Note: we need to include the perl_includespec directory last,
1616
# probably because it sometimes contains some header files with names
1717
# that clash with some of ours, or with some that we include, notably on
1818
# Windows.
19-
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) -I$(perl_includedir)/CORE
19+
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) $(perl_includespec)
2020

21+
# this is often, but not always, the same directory named by perl_includespec
2122
rpathdir = $(perl_archlibexp)/CORE
2223

2324
PGFILEDESC = "PL/Perl - procedural language"

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)