#!/bin/sh
#*=====================================================================*/
#*    serrano/prgm/project/scribe/autoconf/bversion                    */
#*    -------------------------------------------------------------    */
#*    Author      :  Manuel Serrano                                    */
#*    Creation    :  Tue Jan 12 14:33:21 1999                          */
#*    Last change :  Sun Jan 13 07:30:21 2002 (serrano)                */
#*    -------------------------------------------------------------    */
#*    Check the current bigloo version                                 */
#*=====================================================================*/

bigloo=bigloo
version=2.4b

#*---------------------------------------------------------------------*/
#*    We parse the arguments                                           */
#*---------------------------------------------------------------------*/
while : ; do
  case $1 in
    "")
      break;;
    --bigloo=*|-bigloo=*)
      bigloo="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --version=*|-version=*)
      version="`echo $1 | sed 's/^[-a-z]*=//'`";;

    -*)
      echo "Unknown option \"$1\", ignored" >&2;;
  esac
  shift
done

#*---------------------------------------------------------------------*/
#*    We spawn a bigloo process to check its version number            */
#*---------------------------------------------------------------------*/
bver=`$bigloo -q -eval "(exit (print *bigloo-version*))"`
echo $bver

$bigloo -q -eval "(exit (if (string>=? *bigloo-version* \"$version\") 0 1))"

exit $?