Incorrect version of sed when compiling on OSX

2

I am trying to install crosstool-ng on OSX 10.6.8. At the configure stage, I run ./configure --prefix=/opt/cross, and I get the following output:

! ./configure --prefix=/opt/cross
checking build system type... x86_64-apple-darwin10.8.0
checking host system type... x86_64-apple-darwin10.8.0
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking whether sed understands -r -i -e... no
configure: error: 

It appears that sed should accept -r as an argument, but doesn't. Looking up sed here also suggests that -r is a valid argument, but when I run man sed I don't think my version allows for this:

SED(1)                    BSD General Commands Manual                   SED(1)

NAME
     sed -- stream editor

SYNOPSIS
     sed [-Ealn] command [file ...]
     sed [-Ealn] [-e command] [-f command_file] [-i extension] [file ...]

Does my system contain an incorrect version of sed? What can I do to make my sed compatible with crosstool-ng?

Bill Cheatham

Posted 2013-03-30T14:38:08.820

Reputation: 1 139

Answers

2

GNU sed uses -r and OSX' BSD sed uses -E to enable extended regular expressions. GNU sed also understands -E which is an undocumented feature, but BSD sed does not understand -r. So you would either need to install GNU sed first and temporary change your search path so the configure sees it first, or perhaps you could try creating a wrapper around sed so the -r gets translated to -E . Then it still might not work, because the -i option works slightly different..

Scrutinizer

Posted 2013-03-30T14:38:08.820

Reputation: 249