Add Rafael Caricio's changes to improve installation.

Still partial, but we'll start from his work.