Use xcrun to find SDK paths on OSX host during configure

Summary:
Previously it was required to provide SDKROOT during configure on Mojave
hosts to `make` the project which in scripts was messing up local clang
and somewhat error-prone. Instead we could use xcrun to find required SDK
paths automatically.

Reviewed By: jvillard

Differential Revision: D16072354

fbshipit-source-id: 93cbf3980
master
Artem Pianykh 5 years ago committed by Facebook Github Bot
parent b25f735c6e
commit 7792c02388

@ -28,6 +28,7 @@ ENABLE_OCAMLOPT_CUSTOM_CC = @ENABLE_OCAMLOPT_CUSTOM_CC@
ENABLE_OCAML_BINANNOT = @ENABLE_OCAML_BINANNOT@
exec_prefix = @exec_prefix@
GNU_SED = @GNU_SED@
HAS_OBJC = @HAS_OBJC@
INFER_MAJOR = @INFER_MAJOR@
INFER_MAN_LAST_MODIFIED = @INFER_MAN_LAST_MODIFIED@
INFER_MINOR = @INFER_MINOR@
@ -74,11 +75,11 @@ SDKROOT = @SDKROOT@
SHASUM = @SHASUM@
USER_JAVA_HOME = @USER_JAVA_HOME@
UTOP = @UTOP@
XCODE_SELECT = @XCODE_SELECT@
WINDOWS_BUILD = @WINDOWS_BUILD@
XCODE_BASE = @XCODE_BASE@
HAS_OBJC = @HAS_OBJC@
XCODE_SELECT = @XCODE_SELECT@
XCPRETTY = @XCPRETTY@
WINDOWS_BUILD = @WINDOWS_BUILD@
XCRUN = @XCRUN@
ifneq (,$(findstring s,$(MAKEFLAGS)))
# quiet mode

@ -142,17 +142,6 @@ echo >&2
echo "installing infer dependencies; this can take up to 30 minutes... " >&2
opam_retry install_opam_deps
#fix for Mojave
if [ "$OSTYPE" == "darwin18" ]; then
if [ "$(command -v xcode-select)" == "" ]; then
xcode-select --install
fi
SDKROOT=${SDKROOT:-/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk}
if [ -d "$SDKROOT" ]; then
export SDKROOT
fi
fi
if [ "$ONLY_SETUP_OPAM" == "yes" ]; then
exit 0
fi

@ -130,8 +130,18 @@ AS_IF(
[XCODE_BASE=$XCODE_SELECT_OUT HAS_OBJC=yes],
[HAS_OBJC=no])
AC_CHECK_TOOL([XCRUN], [xcrun], [no])
AC_ARG_VAR([SDKROOT], [path to the OSX platform SDK used by clang])
AS_IF(
[test "x$SDKROOT" = "x" && test "x$XCRUN" != "xno"],
[SDKROOT=`xcrun --sdk macosx --show-sdk-path`]
)
AC_SUBST([XCODE_BASE])
AC_SUBST([HAS_OBJC])
AC_SUBST([SDKROOT])
# prefer clang over gcc because the plugins makes use of
# clang-specific #pragma's
@ -350,8 +360,6 @@ AS_IF([test "$SED" != "xno"], [
AC_SUBST([GNU_SED])
AC_CHECK_TOOL([BREW], [brew], [no])
AC_ARG_VAR([SDKROOT], [path to the OSX platform SDK used by clang])
AC_SUBST([SDKROOT])
AC_CHECK_TOOL([INSTALL_NAME_TOOL], [install_name_tool], [no])
AC_SUBST([INSTALL_NAME_TOOL])

@ -11,7 +11,7 @@ CFLAGS=-c -w
all: $(OBJECTS)
clean:
$(QUIET)rm -rf $(OBJECTS)
$(QUIET)rm -rf $(OBJECTS)
%.o: %.c
$(CC) $(CFLAGS) $< -o $@

Loading…
Cancel
Save