Configure Boost with autoconf macros

This commit fixes the build failure `library not found for -lboost_thread` on
OS X / Homebrew and improves build.