From 3f246b7674379d129e9c30fd5c65070e79de2983 Mon Sep 17 00:00:00 2001 From: Adeel Date: Thu, 7 Mar 2019 17:29:22 -0800 Subject: [PATCH] Address @janvorli's feedback Commit migrated from https://github.com/dotnet/coreclr/commit/6d26a56a77e86edd3d1df4161c8a9ada5b99a35b --- src/coreclr/src/pal/src/configure.cmake | 12 +++++++++--- src/coreclr/src/pal/tools/gen-buildsys-gcc.sh | 21 ++++++++++----------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/coreclr/src/pal/src/configure.cmake b/src/coreclr/src/pal/src/configure.cmake index 73c5c1c..1422cd0 100644 --- a/src/coreclr/src/pal/src/configure.cmake +++ b/src/coreclr/src/pal/src/configure.cmake @@ -43,11 +43,17 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) endif() if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD) - set(CMAKE_REQUIRED_FLAGS "-ldl") + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS}) endif() -find_path (HAVE_LTTNG_TRACEPOINT_H NAMES lttng/tracepoint.h) + +check_cxx_source_compiles(" +#include +int main(int argc, char **argv) { + return 0; +}" HAVE_LTTNG_TRACEPOINT_H) + if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD) - unset(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_LIBRARIES) endif() check_include_files(sys/sysctl.h HAVE_SYS_SYSCTL_H) diff --git a/src/coreclr/src/pal/tools/gen-buildsys-gcc.sh b/src/coreclr/src/pal/tools/gen-buildsys-gcc.sh index 7aba64c..5a72549 100755 --- a/src/coreclr/src/pal/tools/gen-buildsys-gcc.sh +++ b/src/coreclr/src/pal/tools/gen-buildsys-gcc.sh @@ -41,21 +41,22 @@ elif command -v "${gcc_prefix}gcc" > /dev/null then desired_gcc_version= else - echo "Unable to find \"${gcc_prefix}\"gcc Compiler" + echo "Unable to find ${gcc_prefix}gcc Compiler" exit 1 fi -if [ -z "$DOTNET_CC" ]; then +if [ -z "$CLR_CC" ]; then CC="$(command -v "${gcc_prefix}"gcc"$desired_gcc_version")" - export CC + gcc_link="$(command -v link)" else - CC="$DOTNET_CC" + CC="$CLR_CC" + gcc_link="$CC" fi -if [ -z "$DOTNET_CXX" ]; then +if [ -z "$CLR_CXX" ]; then CXX="$(command -v "${gcc_prefix}g++$desired_gcc_version")" else - CXX="$DOTNET_CXX" + CXX="$CLR_CXX" fi export CC CXX @@ -91,9 +92,9 @@ done OS=$(uname) locate_gcc_exec() { - ENV_KNOB="DOTNET_$(echo "$1" | tr '[:lower:]' '[:upper:]')" - if [ -n $(eval "\$$ENV_KNOB") ]; then - $(eval "\$$ENV_KNOB") + ENV_KNOB="CLR_$(echo "$1" | tr '[:lower:]' '[:upper:]')" + if env | grep -q "^$ENV_KNOB="; then + eval "echo \"\$$ENV_KNOB\"" return fi @@ -110,8 +111,6 @@ locate_gcc_exec() { if ! gcc_ar="$(locate_gcc_exec ar)"; then { echo "Unable to locate gcc-ar"; exit 1; } fi -if ! gcc_link="$(locate_gcc_exec link)"; then { echo "Unable to locate gcc-link"; exit 1; } fi - if ! gcc_nm="$(locate_gcc_exec nm)"; then { echo "Unable to locate gcc-nm"; exit 1; } fi if [ "$OS" = "Linux" ] || [ "$OS" = "FreeBSD" ] || [ "$OS" = "OpenBSD" ] || [ "$OS" = "NetBSD" ] || [ "$OS" = "SunOS" ]; then -- 2.7.4