Compilation fixes

Compilation fixes extracted from my "debian" branch.

With these the code should be compilable again with "./configure; make" in recent Linux systems.