Skip to content

Commit

Permalink
absorbs the difference of GNU sed and BSD sed in configure script.
Browse files Browse the repository at this point in the history
  • Loading branch information
aoym committed Jul 13, 2017
1 parent ae6a7c7 commit d281705
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Fine tuning of the installation directories:
_EOF
}

# absorbs the difference of GNU sed and BSD sed
replace()
{
[ ! -f "$2" ] && return
sed -e "$1" "$2" > "$2".$$
mv -f "$2".$$ "$2"
}

# check the platform
if which uname >/dev/null 2>&1; then
Expand Down Expand Up @@ -76,10 +83,8 @@ fi
BASEDIR=`pwd`/`dirname $0`

if [ "$KERNEL" = "Darwin" ]; then
SED="sed -i '' -e"
PREFIX=/usr/local
else
SED="sed -i -e"
PREFIX=/usr
fi
BINDIR=$PREFIX/bin
Expand Down Expand Up @@ -130,8 +135,8 @@ while [ -n "`echo $1 | grep '-'`" ]; do
done

cd "$BASEDIR"
$SED "s|unix:LIBS +=.*$|unix:LIBS += -Wl,-rpath,. -Wl,-rpath,$LIBDIR -L$LIBDIR -ltreefrog|" defaults/appbase.pri
$SED "s|unix:INCLUDEPATH +=.*$|unix:INCLUDEPATH += $INCLUDEDIR|" defaults/appbase.pri
replace "s|unix:LIBS +=.*$|unix:LIBS += -Wl,-rpath,. -Wl,-rpath,$LIBDIR -L$LIBDIR -ltreefrog|" defaults/appbase.pri
replace "s|unix:INCLUDEPATH +=.*$|unix:INCLUDEPATH += $INCLUDEDIR|" defaults/appbase.pri

if [ -n "$ENABLE_DEBUG" ]; then
OPT="$OPT CONFIG+=debug"
Expand Down

0 comments on commit d281705

Please sign in to comment.