lib/scripts/polyml-version
author wenzelm
Mon Nov 15 17:39:23 2010 +0100 (2010-11-15)
changeset 40546 f46c902a8438
parent 31695 36c5c15597f2
child 41495 f8c11067e124
permissions -rwxr-xr-x
eliminated old-style sed in favour of builtin regex matching;
wenzelm@16996
     1
#!/usr/bin/env bash
wenzelm@16996
     2
#
wenzelm@16996
     3
# polyml-version --- determine Poly/ML runtime system version
wenzelm@16996
     4
wenzelm@16996
     5
if [ -x "$ML_HOME/poly" ]; then
wenzelm@40546
     6
  VERSION="$(env \
wenzelm@40546
     7
    LD_LIBRARY_PATH="$ML_HOME:$ML_HOME/../lib:$LD_LIBRARY_PATH" \
wenzelm@31695
     8
    DYLD_LIBRARY_PATH="$ML_HOME:$ML_HOME/../lib:$DYLD_LIBRARY_PATH" \
wenzelm@40546
     9
    "$ML_HOME/poly" -v -H 10)"
wenzelm@40546
    10
  REGEXP='^Poly/ML.*RTS version: [^ ]*(-[^ ]*).*$'
wenzelm@40546
    11
  if [[ "$VERSION" =~ $REGEXP ]]; then
wenzelm@40546
    12
    echo "polyml${BASH_REMATCH[1]}"
wenzelm@40546
    13
  else
wenzelm@40546
    14
    echo polyml-unknown
wenzelm@40546
    15
  fi
wenzelm@40546
    16
else
wenzelm@40546
    17
  echo polyml-unknown
wenzelm@16996
    18
fi