From d533e1d46b39eed10e3af62d9344c88ab9ea4de5 Mon Sep 17 00:00:00 2001 From: Oscar Fuentes Date: Thu, 12 Nov 2009 05:36:09 +0000 Subject: [PATCH] CMake: Pass -lm to check_symbol_exists for detecting several math functions like floorf, ceilf, ... Add test for detecting nearbyintf. This change was prompted by test/Transforms/SimplifyLibCalls/floor.ll llvm-svn: 86954 --- llvm/cmake/config-ix.cmake | 6 ++++++ llvm/include/llvm/Config/config.h.cmake | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 28dee471ef06..3a2b91cc33cf 100755 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -4,6 +4,11 @@ include(CheckSymbolExists) include(CheckFunctionExists) include(CheckCXXSourceCompiles) +if( UNIX ) + # Used by check_symbol_exists: + set(CMAKE_REQUIRED_LIBRARIES m) +endif() + # Helper macros and functions macro(add_cxx_include result files) set(${result} "") @@ -84,6 +89,7 @@ check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH) check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H) check_symbol_exists(ceilf math.h HAVE_CEILF) check_symbol_exists(floorf math.h HAVE_FLOORF) +check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF) check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) check_symbol_exists(malloc_zone_statistics malloc/malloc.h HAVE_MALLOC_ZONE_STATISTICS) diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index fa8272798a42..2bec93f2469e 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -253,7 +253,7 @@ #cmakedefine HAVE_NDIR_H ${HAVE_NDIR_H} /* Define to 1 if you have the `nearbyintf' function. */ -#undef HAVE_NEARBYINTF +#cmakedefine HAVE_NEARBYINTF ${HAVE_NEARBYINTF} /* Define if the neat program is available */ #cmakedefine HAVE_NEATO ${HAVE_NEATO}