--- bin/mlton	2018-02-07 18:37:40.000000000 +0800
+++ bin/mlton	2023-07-21 04:00:52.000000000 +0800
@@ -5,7 +5,7 @@
 set -e
 
 dir=`dirname "$0"`
-lib=`cd "$dir/../lib/mlton" && pwd`
+lib='@MLTON@'
 
 declare -a rargs
 case "$1" in
@@ -57,7 +57,7 @@
     exit 1
 }
 
-CC="gcc"
+CC=@CC@
 
 # You may need to set 'GMP_INC_DIR' so the C compiler can find gmp.h.
 GMP_INC_DIR=""

--- lib/mlton/include/platform/darwin.h	2010-06-08 23:00:43.000000000 +0800
+++ lib/mlton/include/platform/darwin.h	2023-07-21 22:27:28.000000000 +0800
@@ -1,3 +1,7 @@
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+
 #include <fenv.h>
 #include <inttypes.h>
 #include <stdint.h>
@@ -27,6 +31,11 @@
 #include <sys/wait.h>
 #include <syslog.h>
 #include <termios.h>
+
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE /* In order for <ucontext.h> to work. */
+#endif
+
 #include <sys/ucontext.h>
 #include <utime.h>
 
