|
3 | 3 | # Note: Darwin is the original code name for macOS, also known as OS X.
|
4 | 4 | # We still use "darwin" as the port name, partly because config.guess does.
|
5 | 5 |
|
6 |
| -# Select where system include files should be sought, if user didn't say. |
7 |
| -if test x"$PG_SYSROOT" = x"" ; then |
8 |
| - # This is far more complicated than it ought to be. We first ask |
9 |
| - # "xcrun --show-sdk-path", which seems to match the default -isysroot |
10 |
| - # setting of Apple's compilers. |
11 |
| - PG_SYSROOT=`xcrun --show-sdk-path 2>/dev/null` |
12 |
| - # That may fail, or produce a result that is not version-specific (i.e., |
13 |
| - # just ".../SDKs/MacOSX.sdk"). Using a version-specific sysroot seems |
14 |
| - # desirable, so if the path is a non-version-specific symlink, expand it. |
15 |
| - if test -L "$PG_SYSROOT"; then |
16 |
| - if expr x"$PG_SYSROOT" : '.*[0-9]\.[0-9][^/]*$' >/dev/null ; then : okay |
17 |
| - else |
18 |
| - PG_SYSROOT=`expr "$PG_SYSROOT" : '\(.*\)/'`/`readlink "$PG_SYSROOT"` |
19 |
| - fi |
20 |
| - fi |
21 |
| - # If there are still not digits in the directory name, try |
22 |
| - # "xcrun --sdk macosx --show-sdk-path"; and if that still doesn't work, |
23 |
| - # fall back to asking xcodebuild, which is often a good deal slower. |
24 |
| - if expr x"$PG_SYSROOT" : '.*[0-9]\.[0-9][^/]*$' >/dev/null ; then : okay |
25 |
| - else |
26 |
| - PG_SYSROOT=`xcrun --sdk macosx --show-sdk-path 2>/dev/null` |
27 |
| - if expr x"$PG_SYSROOT" : '.*[0-9]\.[0-9][^/]*$' >/dev/null ; then : okay |
28 |
| - else |
29 |
| - PG_SYSROOT=`xcodebuild -version -sdk macosx Path 2>/dev/null` |
30 |
| - fi |
31 |
| - fi |
32 |
| -fi |
33 |
| -# Validate the result: if it doesn't point at a directory, ignore it. |
34 |
| -if test x"$PG_SYSROOT" != x"" ; then |
35 |
| - if test -d "$PG_SYSROOT" ; then |
36 |
| - CPPFLAGS="-isysroot $PG_SYSROOT $CPPFLAGS" |
37 |
| - LDFLAGS="-isysroot $PG_SYSROOT $LDFLAGS" |
38 |
| - else |
39 |
| - PG_SYSROOT="" |
40 |
| - fi |
| 6 | +# Select where system include files should be sought |
| 7 | +PG_SYSROOT=`${srcdir}/src/tools/darwin_sysroot $PG_SYSROOT` |
| 8 | + |
| 9 | +if test -d "$PG_SYSROOT" ; then |
| 10 | + CPPFLAGS="-isysroot $PG_SYSROOT $CPPFLAGS" |
| 11 | + LDFLAGS="-isysroot $PG_SYSROOT $LDFLAGS" |
41 | 12 | fi
|
42 | 13 |
|
43 | 14 | # Extra CFLAGS for code that will go into a shared library
|
|
0 commit comments