TS-2082: fix build with --enable-standalone-iocore

This is redo of the 94215bf293d76d27a88a0fc9e35356321310fbf5.
and with a fix of the cache regression testing.

This also reverts commit b9b1bdc81fa1b7e3b1edb54de938d1ea0aec2d7a.