Make configure.py work with Python. Fixes issue #877.

Patch from @TheOneRing!
Merge pull request #878 from nico/py3

Make configure.py work with Python. Fixes issue #877.