[cmake] Improve pthread_[gs]etname_np detection code
authorPavel Labath <labath@google.com>
Wed, 18 Apr 2018 13:13:27 +0000 (13:13 +0000)
committerPavel Labath <labath@google.com>
Wed, 18 Apr 2018 13:13:27 +0000 (13:13 +0000)
commit8f5a456eb28a43a5620064a5074e0ec9b93d4f70
tree5c86d153be1f2cbdfd1aeac606722cd1c367a730
parentac2775889571951961dfd7f0e6ccbde4f869116d
[cmake] Improve pthread_[gs]etname_np detection code

Summary:
Due to some android peculiarities, in some build configurations
(statically linked executables targeting older releases) we could detect
the presence of these functions (because they are present in libc.a,
where check_library_exists searches), but then fail to build because the
headers did not include the definition.

This attempts to remedy that by upgrading the check_library_exists to
check_symbol_exists, which will check that the function is declared too.

I am hoping that a more thorough check will make the messy #ifdef we
have accumulated in the code obsolete, so I optimistically try to remove
them.

Reviewers: zturner, kparzysz, danalbert

Subscribers: srhines, mgorny, krytarowski, llvm-commits

Differential Revision: https://reviews.llvm.org/D45359

llvm-svn: 330251
llvm/cmake/config-ix.cmake
llvm/lib/Support/Unix/Threading.inc