[CMAKE] Improve the FindJemalloc module
Summary:
Prefer the PIC version when available, and pull the dependencies as
needed.
Test Plan:
cmake -GNinja .. -DUSE_JEMALLOC_EXPERIMENTAL=ON
On Debian, check in the cmake output that libdl is required.
ninja all check
Require D6038:
cmake -GNinja .. -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Linux64.cmake -DUSE_JEMALLOC_EXPERIMENTAL=ON
Check in the cmake output that libdl is NOT required.
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Subscribers: deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6055