fix builds with gcc 4.6.3

disable spurious warnings (unused-but-set-variable, unused-variable) and
fix accurate ones (sign-compare)
fix packaging
Merged with development branch