Enable the users to disable optional dependencies

OpenCV has [a lot of options](https://github.com/Itseez/opencv/blob/master/CMakeLists.txt#L113) for the optional libraries. Some of the newly added dependencies of Caffe are not needed by all the users and should be made optional during the building process. 

This PR adds make and cmake flags and guarding macros for those components. They are especially useful for a lean deployment. But they are still enabled by default to keep the building behavior consistent.