mescc: Support single-dash options on Mes too.
authorJan Nieuwenhuizen <janneke@gnu.org>
Wed, 29 May 2019 14:45:28 +0000 (16:45 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 29 May 2019 14:45:28 +0000 (16:45 +0200)
* scripts/mescc.in[MES]: Add -- as separator, fixes using single-dash
options on Mes too.

scripts/mescc.in

index 1e3dbbbc5ee56539c08c5cfb7e6be03279ed8aaf..d3190bc798afaf9556039fe0a06a1fe898a41c5d 100755 (executable)
@@ -41,9 +41,33 @@ if [ ! -f $bindir/mescc.scm ]; then
    bindir=$(dirname $0)
 fi
 
+# Workaround for second getopt-long parsing by Mes' boot-0.scm.
+args=""
+for i in "$@"; do
+    case "$i" in
+        -[a-zA-Z]) args="$args $i";;
+        -D[a-zA-Z]*) args="$args -D ${i:2}";;
+        -I[a-zA-Z]*) args="$args -I ${i:2}";;
+        -L[a-zA-Z]*) args="$args -L ${i:2}";;
+        -l[a-zA-Z]*) args="$args -l ${i:2}";;
+        -dumpmachine|-fno-builtin|-nodefaultlibs|-nostartfiles|-nostdinc|-nostdlib|-std=*) args="$args -$i";;
+        *) args="$args $i";;
+    esac
+done
+
+sep=
+if [ "$(basename ${SCHEME-$MES})" = "mes" ]; then
+    sep=--
+fi
+
 ${SCHEME-$MES} \
-     --no-auto-compile\
-     -e main\
-     -L @guile_site_dir@\
-     -C @guile_site_ccache_dir@\
-     $bindir/mescc.scm "$@"
+    --no-auto-compile\
+    -e main\
+    -L @guile_site_dir@\
+    -C @guile_site_ccache_dir@\
+    $bindir/mescc.scm\
+    $sep\
+    "$@"
+
+# ..but using -- "$@" that seems no longer necessary!
+#    $args