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

Commit e74dd00

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 26cb820 commit e74dd00

File tree

7 files changed

+24
-38
lines changed

7 files changed

+24
-38
lines changed

configure

+7-11
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
@@ -9775,11 +9775,12 @@ documentation for details. Use --without-perl to disable building
97759775
PL/Perl." "$LINENO" 5
97769776
fi
97779777
# On most platforms, archlibexp is also where the Perl include files live ...
9778-
perl_includedir="$perl_archlibexp"
9779-
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
9780-
if test x"$PG_SYSROOT" != x"" ; then
9778+
perl_includespec="-I$perl_archlibexp/CORE"
9779+
# ... but on newer macOS versions, we must use -iwithsysroot to look
9780+
# under $PG_SYSROOT
9781+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
97819782
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
9782-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
9783+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
97839784
fi
97849785
fi
97859786

@@ -18114,11 +18115,6 @@ eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\"
1811418115
as_fn_error $? "cannot build PL/Tcl because Tcl is not a shared library
1811518116
Use --without-tcl to disable building PL/Tcl." "$LINENO" 5
1811618117
fi
18117-
# Some macOS versions report an include spec that uses -iwithsysroot.
18118-
# We don't really want to use -isysroot, so translate that if we can.
18119-
if test x"$PG_SYSROOT" != x"" ; then
18120-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
18121-
fi
1812218118
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
1812318119
ac_save_CPPFLAGS=$CPPFLAGS
1812418120
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -18136,7 +18132,7 @@ fi
1813618132
# check for <perl.h>
1813718133
if test "$with_perl" = yes; then
1813818134
ac_save_CPPFLAGS=$CPPFLAGS
18139-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
18135+
CPPFLAGS="$CPPFLAGS $perl_includespec"
1814018136
ac_fn_c_check_header_compile "$LINENO" "perl.h" "ac_cv_header_perl_h" "#include <EXTERN.h>
1814118137
"
1814218138
if test "x$ac_cv_header_perl_h" = xyes; then :

configure.in

+7-11
Original file line numberDiff line numberDiff line change
@@ -1045,14 +1045,15 @@ documentation for details. Use --without-perl to disable building
10451045
PL/Perl.])
10461046
fi
10471047
# On most platforms, archlibexp is also where the Perl include files live ...
1048-
perl_includedir="$perl_archlibexp"
1049-
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
1050-
if test x"$PG_SYSROOT" != x"" ; then
1048+
perl_includespec="-I$perl_archlibexp/CORE"
1049+
# ... but on newer macOS versions, we must use -iwithsysroot to look
1050+
# under $PG_SYSROOT
1051+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
10511052
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
1052-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
1053+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
10531054
fi
10541055
fi
1055-
AC_SUBST(perl_includedir)dnl
1056+
AC_SUBST(perl_includespec)dnl
10561057
PGAC_CHECK_PERL_EMBED_CCFLAGS
10571058
PGAC_CHECK_PERL_EMBED_LDFLAGS
10581059
fi
@@ -2211,11 +2212,6 @@ if test "$with_tcl" = yes; then
22112212
AC_MSG_ERROR([cannot build PL/Tcl because Tcl is not a shared library
22122213
Use --without-tcl to disable building PL/Tcl.])
22132214
fi
2214-
# Some macOS versions report an include spec that uses -iwithsysroot.
2215-
# We don't really want to use -isysroot, so translate that if we can.
2216-
if test x"$PG_SYSROOT" != x"" ; then
2217-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
2218-
fi
22192215
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
22202216
ac_save_CPPFLAGS=$CPPFLAGS
22212217
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -2226,7 +2222,7 @@ fi
22262222
# check for <perl.h>
22272223
if test "$with_perl" = yes; then
22282224
ac_save_CPPFLAGS=$CPPFLAGS
2229-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
2225+
CPPFLAGS="$CPPFLAGS $perl_includespec"
22302226
AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
22312227
[#include <EXTERN.h>])
22322228
# While we're at it, check that we can link to libperl.

contrib/hstore_plperl/Makefile

+2-5
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

+2-5
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

+1-1
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

+3-2
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

+2-3
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)