--- configure.orig	2011-03-17 04:11:26.000000000 +1100
+++ configure	2011-06-08 15:49:42.000000000 +1000
@@ -64,6 +64,10 @@
 # First pair is used if nothing matches
 PROGS="CC=gcc CC=cc CXX=g++ CXX=c++ DOXYGEN=doxygen LD=ld AR=ar RANLIB=ranlib RANLIB=touch INSTALL=install"
 
+if [ -z "${SED}" ]; then
+    SED="sed"
+fi
+
 # Environment variables
 ENVIRONS="CXXFLAGS LDFLAGS"
 
@@ -283,12 +287,12 @@
 fi
 if [ "$SYSNAME" = "mac" ]; then
     echo 's/ \?@libgcc_eh@//g
-	s/@SYSWARNS@/-Wno-long-double/g
-	s/lib$1.so/lib$1.dylib/g
+	s/@SYSWARNS@//g
 	s/lib$1.so.${MAJOR}.${MINOR}.${BUILD}/lib$1.${MAJOR}.${MINOR}.${BUILD}.dylib/g
 	s/lib$1.so.${MAJOR}.${MINOR}/lib$1.${MAJOR}.${MINOR}.dylib/g
 	s/lib$1.so.${MAJOR}/lib$1.${MAJOR}.dylib/g
-	s/@SHBLDFL@/-Wl,-single_module -compatibility_version 1 -current_version 1 -install_name $1 -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.4/g' >>config.sed
+	s/lib$1.so/lib$1.dylib/g
+	s|@SHBLDFL@|-Wl,-single_module -compatibility_version 1 -current_version 1 -install_name ${LIBDIR}/$1 -Wl,-Y,1455 -dynamiclib|g' >>config.sed
 else
     echo 's/ \?@SYSWARNS@//g' >>config.sed
 fi
@@ -361,7 +365,7 @@
 
 SubVar() {
     local esc2
-    esc2=`echo $2 | sed 's/\//\\\&/g'`
+    esc2=`echo $2 | ${SED} 's/\//\\\&/g'`
     eval ac_var_$1='$esc2';
     echo "s/@$1@/$esc2/g" >>config.sed
 }
@@ -411,8 +415,8 @@
 s/@libdir@/${ac_var_libdir:=$ac_var_exec_prefix\/lib}/g
 s/@localedir@/$ac_var_datarootdir\/locale/g
 s/@mandir@/$ac_var_datarootdir\/man/g
-s/@gccincludedir@/${ac_var_gccincludedir:=`echo $PINCDIR | sed 's/\//\\\&/g'`}/g
-s/@gcclibdir@/${ac_var_gcclibdir:=`echo $PLIBDIR | sed 's/\//\\\&/g'`}/g
+s/@gccincludedir@/${ac_var_gccincludedir:=`echo $PINCDIR | ${SED} 's/\//\\\&/g'`}/g
+s/@gcclibdir@/${ac_var_gcclibdir:=`echo $PLIBDIR | ${SED} 's/\//\\\&/g'`}/g
 s/@customincdir@/${ac_var_customincdir:=$ac_var_prefix\/include}/g
 s/@customlibdir@/${ac_var_customlibdir:=$ac_var_prefix\/lib}/g" >>config.sed
 
@@ -429,7 +433,7 @@
 SubHeadLibsProgs() {
 local INCPATH LIBPATH LIBSUFFIX found pname pcall esciv
 INCPATH="$ac_var_oldincludedir $ac_var_includedir $ac_var_gccincludedir $ac_var_customincdir"
-INCPATH=`echo $INCPATH | sed 's/\\\\//g'`
+INCPATH=`echo $INCPATH | ${SED} 's/\\\\//g'`
 for i in $HEADERS; do
     for p in $INCPATH; do
 	if [ -r "$p/$i" ]; then
@@ -440,7 +444,7 @@
 done
 
 LIBPATH="`echo $LD_LIBRARY_PATH | tr ':' ' '` $ac_var_libdir $ac_var_gcclibdir $ac_var_customlibdir /usr/lib /usr/local/lib /lib"
-LIBPATH=`echo $LIBPATH | sed 's/\\\\//g'`
+LIBPATH=`echo $LIBPATH | ${SED} 's/\\\\//g'`
 LIBSUFFIX="so a la dylib"
 for i in $LIBS; do
     found=
@@ -459,7 +463,7 @@
 for i in $PROGS; do
     pname=`expr "$i" : '\([^=]*\)=[^=]*'`
     pcall=`expr "$i" : '[^=]*=\([^=]*\)'`
-    esciv="`eval echo \$\{$pname\}|sed 's/\//\\\\\//g'`"
+    esciv="`eval echo \$\{$pname\}|${SED} 's/\//\\\\\//g'`"
     # First check if an environment variable is set
     [ ! -z "$esciv" ] && echo "s/@$pname@/$esciv/g" >>config.sed
     # Check if the program exists
@@ -473,7 +477,7 @@
 done
 # And, finally, the environment variables
 for i in $ENVIRONS; do
-    esciv="`eval echo '"'\$\{$i\}'"'|sed 's/\//\\\&/g'`"
+    esciv="`eval echo '"'\$\{$i\}'"'|${SED} 's/\//\\\&/g'`"
     [ ! -z "$esciv" ] && esciv=" $esciv"
     echo "s/ \?@$i@/$esciv/g" >>config.sed
 done
@@ -484,7 +488,7 @@
 #### Apply substitutions to all files ################################
 
 for i in $FILES; do
-    sed -f config.sed $i.in > $i
+    ${SED} -f config.sed $i.in > $i
 done
 
 touch config.status
