Allow compiling with clang++ using -std=c++11 flag

I need to use c++11 features for something I'm working on, and I usually build with clang.  I had to
make a couple of changes for this to work and I thought they might also be useful for the mainline.

Patch includes changes needed for `CXXFLAGS=-std=c++11` to work
with clang++.

1) configure script should run in c++ mode when checking functions
otherwise clang++ gives an error.

2)` typeof` operator doesn't work in c++11 mode with clang++.  But
`__typeof__` is a valid replacement.