--- config/install.sh.orig	2019-11-10 21:36:40.000000000 -0800
+++ config/install.sh	2019-11-10 21:37:53.000000000 -0800
@@ -320,40 +320,6 @@
 	10.7*) AS_ACCEPTS_SDK=no ;;
 	10.8*) AS_ACCEPTS_SDK=no ;;
 	10.9*) AS_ACCEPTS_SDK=no ;;
-	10.14*)
-	  AS_ACCEPTS_SDK=yes
-	  # Mojave needs a special makefile for the x86, but we need to be careful
-	  # about when we are running the postinstall script, so we check
-	  # for the nolib argument
-	  if [ x"$nolib" = xfalse ] ; then
-	    RT_MAKEFILE=mk.x86-darwin18
-	    # location of Xcode SDKs
-	    if [ ! -x /usr/bin/xcode-select ] ; then
-	      echo "$this: !!! /usr/bin/xcode-select is missing; please install Xcode"
-	      exit 1
-	    fi
-	    XCODE_DEV_PATH=`xcode-select -p`
-	    if [ x"$XCODE_DEV_PATH" = x/Library/Developer/CommandLineTools ] ; then
-	      XCODE_SDK_PATH="$XCODE_DEV_PATH/SDKs"
-	    else
-	      XCODE_SDK_PATH="$XCODE_DEV_PATH/Platforms/MacOSX.platform/Developer/SDKs"
-	    fi
-	    # look for an SDK that supports 32-bit builds (starting with 10.13 High Sierra
-	    # and going back to 10.10 Yosemite)
-	    #
-	    for SDK_VERS in 13 12 11 10 ; do
-	      if [ -d "$XCODE_SDK_PATH/MacOSX10.$SDK_VERS.sdk" ] ; then
-		SDK="$XCODE_SDK_PATH/MacOSX10.$SDK_VERS.sdk"
-		break
-	      fi
-	    done
-	    if [ x"$SDK" = xnone ] ; then
-	      echo "$this: !!! SML/NJ requires support for 32-bit executables."
-	      echo "  Please see http://www.smlnj.org/dist/working/$VERSION/MACOSXINSTALL for more details."
-	      exit 1
-	    fi
-	  fi
-	  ;;
 	*) AS_ACCEPTS_SDK=yes ;;
       esac
       if [ x"$SDK" = xnone ] ; then
@@ -412,7 +378,14 @@
     vsay $this: Run-time system already exists.
 else
     "$CONFIGDIR"/unpack "$ROOT" runtime
+    echo $this: Adjusting the build scripts to MacPorts requirements
     cd "$BASEDIR"/runtime/objs
+    /usr/bin/sed -E -i '.orig' \
+        -e 's|^CC[ 	]*=[ 	]*cc|CC = @CC@|g' \
+        -e 's|^CPP[ 	]*=[ 	]*cc|CPP = @CPP@|g' \
+        -e 's|^CFLAGS[ 	]*=(.*)$|CFLAGS = \1 @CFLAGS@|g' \
+        -e 's|^LD_LIBS[ 	]*=(.*)$|LD_LIBS = \1 @LDFLAGS@|g' \
+        mk.$ARCH-$OPSYS
     echo $this: Compiling the run-time system.
     $MAKE -f $RT_MAKEFILE $EXTRA_DEFS
     if [ -x run.$ARCH-$OPSYS ]; then
