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

Commit 1b92ca9

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 4c68883 commit 1b92ca9

File tree

6 files changed

+22
-33
lines changed

6 files changed

+22
-33
lines changed

configure

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ python_majorversion
671671
PYTHON
672672
perl_embed_ldflags
673673
perl_embed_ccflags
674-
perl_includedir
674+
perl_includespec
675675
perl_useshrplib
676676
perl_privlibexp
677677
perl_archlibexp
@@ -7626,11 +7626,12 @@ documentation for details. Use --without-perl to disable building
76267626
PL/Perl." "$LINENO" 5
76277627
fi
76287628
# On most platforms, archlibexp is also where the Perl include files live ...
7629-
perl_includedir="$perl_archlibexp"
7630-
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
7631-
if test x"$PG_SYSROOT" != x"" ; then
7629+
perl_includespec="-I$perl_archlibexp/CORE"
7630+
# ... but on newer macOS versions, we must use -iwithsysroot to look
7631+
# under $PG_SYSROOT
7632+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
76327633
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
7633-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
7634+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
76347635
fi
76357636
fi
76367637

@@ -15428,11 +15429,6 @@ eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\"
1542815429
as_fn_error $? "cannot build PL/Tcl because Tcl is not a shared library
1542915430
Use --without-tcl to disable building PL/Tcl." "$LINENO" 5
1543015431
fi
15431-
# Some macOS versions report an include spec that uses -iwithsysroot.
15432-
# We don't really want to use -isysroot, so translate that if we can.
15433-
if test x"$PG_SYSROOT" != x"" ; then
15434-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
15435-
fi
1543615432
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
1543715433
ac_save_CPPFLAGS=$CPPFLAGS
1543815434
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -15450,7 +15446,7 @@ fi
1545015446
# check for <perl.h>
1545115447
if test "$with_perl" = yes; then
1545215448
ac_save_CPPFLAGS=$CPPFLAGS
15453-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
15449+
CPPFLAGS="$CPPFLAGS $perl_includespec"
1545415450
ac_fn_c_check_header_compile "$LINENO" "perl.h" "ac_cv_header_perl_h" "#include <EXTERN.h>
1545515451
"
1545615452
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
@@ -959,14 +959,15 @@ documentation for details. Use --without-perl to disable building
959959
PL/Perl.])
960960
fi
961961
# On most platforms, archlibexp is also where the Perl include files live ...
962-
perl_includedir="$perl_archlibexp"
963-
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
964-
if test x"$PG_SYSROOT" != x"" ; then
962+
perl_includespec="-I$perl_archlibexp/CORE"
963+
# ... but on newer macOS versions, we must use -iwithsysroot to look
964+
# under $PG_SYSROOT
965+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
965966
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
966-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
967+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
967968
fi
968969
fi
969-
AC_SUBST(perl_includedir)dnl
970+
AC_SUBST(perl_includespec)dnl
970971
PGAC_CHECK_PERL_EMBED_CCFLAGS
971972
PGAC_CHECK_PERL_EMBED_LDFLAGS
972973
fi
@@ -2060,11 +2061,6 @@ if test "$with_tcl" = yes; then
20602061
AC_MSG_ERROR([cannot build PL/Tcl because Tcl is not a shared library
20612062
Use --without-tcl to disable building PL/Tcl.])
20622063
fi
2063-
# Some macOS versions report an include spec that uses -iwithsysroot.
2064-
# We don't really want to use -isysroot, so translate that if we can.
2065-
if test x"$PG_SYSROOT" != x"" ; then
2066-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
2067-
fi
20682064
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
20692065
ac_save_CPPFLAGS=$CPPFLAGS
20702066
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -2075,7 +2071,7 @@ fi
20752071
# check for <perl.h>
20762072
if test "$with_perl" = yes; then
20772073
ac_save_CPPFLAGS=$CPPFLAGS
2078-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
2074+
CPPFLAGS="$CPPFLAGS $perl_includespec"
20792075
AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
20802076
[#include <EXTERN.h>])
20812077
# 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
@@ -41,8 +41,5 @@ SHLIB_LINK_INTERNAL += -L../hstore -l hstore
4141
SHLIB_LINK += $(perl_embed_ldflags)
4242
endif
4343

44-
# As with plperl we need to make sure that the CORE directory is included
45-
# last, probably because it sometimes contains some header files with names
46-
# that clash with some of ours, or with some that we include, notably on
47-
# Windows.
48-
override CPPFLAGS := $(CPPFLAGS) $(perl_embed_ccflags) -I$(perl_includedir)/CORE
44+
# As with plperl we need to include the perl_includespec directory last.
45+
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
@@ -307,7 +307,7 @@ else
307307
endif
308308
perl_archlibexp = @perl_archlibexp@
309309
perl_privlibexp = @perl_privlibexp@
310-
perl_includedir = @perl_includedir@
310+
perl_includespec = @perl_includespec@
311311
perl_embed_ccflags = @perl_embed_ccflags@
312312
perl_embed_ldflags = @perl_embed_ldflags@
313313

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)