Detect static libjemalloc

libjemalloc as static library requires -pthread flag to link.  Without
that, the check in configure.ac fails with unresolved symbols.