Fix debian build (Son of #76)

This is the successor of issue #76. 
It contains are the changes I had to make to build the current master successfully on a debian 6.0.4 system. Comments appreciated.