Add make and cmake building flags and C++ macros to make LMDB optional