Revert "[CMake] Use __libc_start_main rather than fopen when checking for C library"
authorPetr Hosek <phosek@chromium.org>
Mon, 28 Jan 2019 19:26:41 +0000 (19:26 +0000)
committerPetr Hosek <phosek@chromium.org>
Mon, 28 Jan 2019 19:26:41 +0000 (19:26 +0000)
This reverts commit r352341: it broke the build on macOS which doesn't
seem to provide __libc_start_main in its C library.

llvm-svn: 352411

compiler-rt/cmake/config-ix.cmake
libcxx/cmake/config-ix.cmake
libcxxabi/cmake/config-ix.cmake
libunwind/cmake/config-ix.cmake
llvm/runtimes/CMakeLists.txt

index 9aaf90b..ec52882 100644 (file)
@@ -12,7 +12,7 @@ function(check_linker_flag flag out_var)
   cmake_pop_check_state()
 endfunction()
 
-check_library_exists(c __libc_start_main "" COMPILER_RT_HAS_LIBC)
+check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
 if (COMPILER_RT_USE_BUILTINS_LIBRARY)
   include(HandleCompilerRT)
   find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY)
index 657b036..730ee7e 100644 (file)
@@ -7,7 +7,7 @@ if(WIN32 AND NOT MINGW)
   # let the default linking take care of that.
   set(LIBCXX_HAS_C_LIB NO)
 else()
-  check_library_exists(c __libc_start_main "" LIBCXX_HAS_C_LIB)
+  check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
 endif()
 
 if (NOT LIBCXX_USE_COMPILER_RT)
index 4be7adc..379b554 100644 (file)
@@ -2,7 +2,7 @@ include(CheckLibraryExists)
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 
-check_library_exists(c __libc_start_main "" LIBCXXABI_HAS_C_LIB)
+check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
 if (NOT LIBCXXABI_USE_COMPILER_RT)
   check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB)
 endif ()
index c0c9a53..670c31f 100644 (file)
@@ -3,7 +3,7 @@ include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 include(CheckLibraryExists)
 
-check_library_exists(c __libc_start_main "" LIBUNWIND_HAS_C_LIB)
+check_library_exists(c fopen "" LIBUNWIND_HAS_C_LIB)
 
 if (NOT LIBUNWIND_USE_COMPILER_RT)
   check_library_exists(gcc_s __gcc_personality_v0 "" LIBUNWIND_HAS_GCC_S_LIB)
index 49fbe6a..4284240 100644 (file)
@@ -98,7 +98,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
   include(CheckLibraryExists)
   include(CheckCCompilerFlag)
 
-  check_library_exists(c __libc_start_main "" LLVM_HAS_C_LIB)
+  check_library_exists(c fopen "" LLVM_HAS_C_LIB)
   check_c_compiler_flag(-nodefaultlibs LLVM_HAS_NODEFAULTLIBS_FLAG)
   if(LLVM_HAS_NODEFAULTLIBS_FLAG)
     set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")