configure: sed: illegal option -- r
configure fails (but does not stop) as follows:
:
checking version of ghc... 7.8.3
checking whether bootstrap compiler is affected by bug 9439... yes
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking target system type... x86_64-apple-darwin14.0.0
Build platform inferred as: x86_64-apple-darwin
Host platform inferred as: x86_64-apple-darwin
Target platform inferred as: x86_64-apple-darwin
GHC build : x86_64-apple-darwin
GHC host : x86_64-apple-darwin
GHC target : x86_64-apple-darwin
configure: Building in-tree ghc-pwd
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
The gnu sed manual page says
-r --regexp-extended Use extended regular expressions rather than basic regular expressions. Extended regexps are those that egrep accepts; they can be clearer because they usually have less backslashes, but are a GNU extension and hence scripts that use them are not portable. See Extended regular expressions.
So the fix is, presumably to remove the -r and add \ before () in the configure script at
sed -r 's/(^| )([^ ])/\1-optl\2/g'