dnl  ********************************************************************
dnl       System: ALOG
dnl         File: configure.in
dnl       Author: Kees Schuerman, Arun Nanda
dnl       SccsId: "@(#)configure.in	1.18 24 Nov 1995"
dnl  Description: Configuration
dnl		  Process this file with autoconf to produce a configure
dnl		  script.
dnl  ********************************************************************

if test -z "$ARCH" || test "$ARCH" = "unknown"; then
    echo please set the environment variable ARCH
    exit
fi

AC_INIT(alog_env.c)

unset PROJECTDIR
if test -z "$SYS_DIR"; then
    SYS_DIR="`pwd`/../.."
fi
if test -z "$USC_DIR"; then
    USC_DIR="`pwd`/../../usc"
fi


#
# UNIX variants
#
CC=cc
CFLAGS="-O"
case "$ARCH" in
 sun3)
    ;;
 sun4)
    ;;
 supersparc_sunos4)
    CC=gcc
    CFLAGS="-msupersparc -O2"
    ;;
 sparc_svr4)
    ;;
 sparc_sunos5)
    CC=gcc
    CFLAGS="-O2"
    ;;
 sparc_sunos5_cc)
    ;;
 supersparc_sunos5)
    CC=gcc
    CFLAGS="-msupersparc -O2"
    ;;
 i386_sunos5)
    ;;
 i386_linux)
    LIBS="-lieee $LIBS"
    ;;
 rs_aix32)
    CC=gcc
    CFLAGS="-fsigned-char -O2"
    ;;
 rs_aix32_cc)
    CC=cc
    CFLAGS="-qchars=signed -O"
    ;;
 rs_aix41)
    CC=gcc
    CFLAGS="-fsigned-char -O2"
    ;;
 hp700_ux90)
    CC=gcc
    ;;
 spp_ux90)
    CC=gcc
    ;;
 sgi_irix52)
    ;;
 m88k_svr4)
    ;;
 alpha_osf32)
    CC=gcc
    ;;
 alpha_linux)
    CC=gcc
    CFLAGS="-mieee -O2"
    ;;
 *)
    echo Unknown architecture
    exit
    ;;
esac


#
# Programs
#
dnl Check if ranlib exists
if test -z "$RANLIB"; then
  # Extract the first word of `ranlib', so it can be a program name with args.
  set dummy ranlib; word=$2
  echo checking for $word
  IFS="${IFS=   }"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$word; then
      RANLIB="ranlib"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$RANLIB" && RANLIB="true"
test -n "$RANLIB" && test -n "$verbose" && echo "       setting RANLIB to $RANLIB"


AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(ARCH)
AC_SUBST(LIBS)
AC_SUBST(RANLIB)
AC_SUBST(SYS_DIR)
AC_SUBST(USC_DIR)

AC_OUTPUT(Makefile)
