#!/bin/sh
#*=====================================================================*/
#*    serrano/prgm/project/bigloo/autoconf/unix                        */
#*    -------------------------------------------------------------    */
#*    Author      :  Manuel Serrano                                    */
#*    Creation    :  Wed Oct 22 11:07:08 1997                          */
#*    Last change :  Wed Mar 24 13:56:28 2004 (serrano)                */
#*    -------------------------------------------------------------    */
#*    Setting bigloo.h up for Unix parameters.                         */
#*=====================================================================*/
fmt=c
tmpdir=/tmp

#*---------------------------------------------------------------------*/
#*    We parse the arguments                                           */
#*---------------------------------------------------------------------*/
while : ; do
  case $1 in
    "")
      break;;

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

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

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

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

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

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

#*---------------------------------------------------------------------*/
#*    Uname parameters                                                 */
#*---------------------------------------------------------------------*/
if eval uname > /dev/null 2> /dev/null; then
  osname=`uname -s`
  osarch=`uname -m`
  osversion=`uname -r`
else
  osname="unknown"
  osarch="unknown"
  osversion="unknown"
fi

if [ $fmt = "c" ]; then
  # the kind of OS (Unix|mingw)
  if [ "$posixos" = "mingw" ]; then
      echo "#define OS_CLASS \"mingw\""
  else 
      echo "#define OS_CLASS \"unix\""
  fi
  
  # The name of the OS
  echo "#define OS_NAME \"$osname\""
  
  # The architecture
  echo "#define OS_ARCH \"$osarch\""
  
  # the Os version
  echo "#define OS_VERSION \"$osversion\""
  
  # the temporary directory
  echo "#define OS_TMP \"$tmpdir\""
  
  # the file separator
  echo "#define FILE_SEPARATOR '/'"
  
  # the path separator
  if [ "$posixos" = "mingw" ]; then
      echo "#define PATH_SEPARATOR ';'"
  else 
      echo "#define PATH_SEPARATOR ':'"
  fi
  
  # the static library suffixes
  echo "#define STATIC_LIB_SUFFIX \"a\""
  
  # the shard library suffixes
  if [ "$posixos" = "mingw" ]; then
      echo "#define SHARED_LIB_SUFFIX \"dll\""
  else
      echo "#define SHARED_LIB_SUFFIX \"so\""
  fi
  
  # Is it possible to directly print UCS2 characters
  echo "#define UCS2_DISPLAYABLE 0"
fi

