Perhaps I'm missing something, but you are testing for jemalloc/jemalloc.h in configure, but then include it regardless of the result.
(We should move feature specific tests to feature specific blocks to reduce the number of tests unconditionally run. Not that I would hold up this PR for that)