Skip to content

Commit 0749acc

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 176f659 commit 0749acc

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
@@ -670,7 +670,7 @@ python_majorversion
670670
PYTHON
671671
perl_embed_ldflags
672672
perl_embed_ccflags
673-
perl_includedir
673+
perl_includespec
674674
perl_useshrplib
675675
perl_privlibexp
676676
perl_archlibexp
@@ -7505,11 +7505,12 @@ test "$PORTNAME" = "win32" && perl_useshrplib=`echo $perl_useshrplib | sed 's,\\
75057505
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_useshrplib" >&5
75067506
$as_echo "$perl_useshrplib" >&6; }
75077507
# On most platforms, archlibexp is also where the Perl include files live ...
7508-
perl_includedir="$perl_archlibexp"
7509-
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
7510-
if test x"$PG_SYSROOT" != x"" ; then
7508+
perl_includespec="-I$perl_archlibexp/CORE"
7509+
# ... but on newer macOS versions, we must use -iwithsysroot to look
7510+
# under $PG_SYSROOT
7511+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
75117512
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
7512-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
7513+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
75137514
fi
75147515
fi
75157516

@@ -14680,12 +14681,7 @@ eval TCL_LIBS=\"$TCL_LIBS\"
1468014681
eval TCL_LIB_SPEC=\"$TCL_LIB_SPEC\"
1468114682
eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\"
1468214683

14683-
# Some macOS versions report an include spec that uses -iwithsysroot.
14684-
# We don't really want to use -isysroot, so translate that if we can.
14685-
if test x"$PG_SYSROOT" != x"" ; then
14686-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
14687-
fi
14688-
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
14684+
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
1468914685
ac_save_CPPFLAGS=$CPPFLAGS
1469014686
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
1469114687
ac_fn_c_check_header_mongrel "$LINENO" "tcl.h" "ac_cv_header_tcl_h" "$ac_includes_default"
@@ -14702,7 +14698,7 @@ fi
1470214698
# check for <perl.h>
1470314699
if test "$with_perl" = yes; then
1470414700
ac_save_CPPFLAGS=$CPPFLAGS
14705-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
14701+
CPPFLAGS="$CPPFLAGS $perl_includespec"
1470614702
ac_fn_c_check_header_compile "$LINENO" "perl.h" "ac_cv_header_perl_h" "#include <EXTERN.h>
1470714703
"
1470814704
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
@@ -916,14 +916,15 @@ if test "$with_perl" = yes; then
916916
fi
917917
PGAC_CHECK_PERL_CONFIGS([archlibexp,privlibexp,useshrplib])
918918
# On most platforms, archlibexp is also where the Perl include files live ...
919-
perl_includedir="$perl_archlibexp"
920-
# ... but on some macOS versions, we must look under $PG_SYSROOT instead
921-
if test x"$PG_SYSROOT" != x"" ; then
919+
perl_includespec="-I$perl_archlibexp/CORE"
920+
# ... but on newer macOS versions, we must use -iwithsysroot to look
921+
# under $PG_SYSROOT
922+
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
922923
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
923-
perl_includedir="$PG_SYSROOT$perl_archlibexp"
924+
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
924925
fi
925926
fi
926-
AC_SUBST(perl_includedir)dnl
927+
AC_SUBST(perl_includespec)dnl
927928
PGAC_CHECK_PERL_EMBED_CCFLAGS
928929
PGAC_CHECK_PERL_EMBED_LDFLAGS
929930
fi
@@ -1933,11 +1934,6 @@ if test "$with_tcl" = yes; then
19331934
PGAC_EVAL_TCLCONFIGSH([$TCL_CONFIG_SH],
19341935
[TCL_INCLUDE_SPEC,TCL_LIB_FILE,TCL_LIBS,TCL_LIB_SPEC,TCL_SHARED_BUILD])
19351936
AC_SUBST(TCL_SHLIB_LD_LIBS)dnl don't want to double-evaluate that one
1936-
# Some macOS versions report an include spec that uses -iwithsysroot.
1937-
# We don't really want to use -isysroot, so translate that if we can.
1938-
if test x"$PG_SYSROOT" != x"" ; then
1939-
TCL_INCLUDE_SPEC="`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsysroot */|-I $PG_SYSROOT/|"`"
1940-
fi
19411937
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
19421938
ac_save_CPPFLAGS=$CPPFLAGS
19431939
CPPFLAGS="$TCL_INCLUDE_SPEC $CPPFLAGS"
@@ -1948,7 +1944,7 @@ fi
19481944
# check for <perl.h>
19491945
if test "$with_perl" = yes; then
19501946
ac_save_CPPFLAGS=$CPPFLAGS
1951-
CPPFLAGS="$CPPFLAGS -I$perl_includedir/CORE"
1947+
CPPFLAGS="$CPPFLAGS $perl_includespec"
19521948
AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
19531949
[#include <EXTERN.h>])
19541950
# 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
@@ -306,7 +306,7 @@ else
306306
endif
307307
perl_archlibexp = @perl_archlibexp@
308308
perl_privlibexp = @perl_privlibexp@
309-
perl_includedir = @perl_includedir@
309+
perl_includespec = @perl_includespec@
310310
perl_useshrplib = @perl_useshrplib@
311311
perl_embed_ccflags = @perl_embed_ccflags@
312312
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)