Changes to work with Mac OS X

(cherry picked from commit d9fc4a77bcc638a4507b12667dd9689601755f43)
made suggested changes and add --sed-tool option to build-all.sh script

(cherry picked from commit 72e098fc7c95086c2566476dd35c7feebc452a12)
clean up some more

(cherry picked from commit 9fdb24f9ff4b8b89b7fc0a94bfc90fd97e842d2d)
Minor corrections to previous patch

1. Remove extra bashbang
2. Ensure that option --sed-tool will not be ignored.

Signed-off-by: Anton Kolesov <anton.kolesov@synopsys.com>
(cherry picked from commit f6b6ba3878ddaec7b8b0fa1e0c80062d3fca201b)