Support OpenCV 2.1 by setting CPPFLAGS=-DOPENCV_2_1.
Autodetect OpenCV version.