configure: use c++11 and fallback to c++0x for c++ files

Needed for the C+11 atomics. Also change add_cxxflags to check_cxxflags.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
