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 <lttng/tracepoint.h>
+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)
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
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
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