Use perl instead of GNU sed; fix spelling error

This changeset is already merged in the stable-2.0 branch so it should also gi to devel.

* Use Perl to replace configuration variables in place instead of GNU sed to
  help some poor souls without a proper GNU installation. This solves
  ticket:1403, thanks to sthen for the report.
* Also fix my previous spelling error: substitue vs. substitute. Again thanks to sthen :)