#
# This file is specific to Carnegie Mellon University's
# software build process
# 
# $Id: SMakefile,v 1.49 1999/12/29 19:21:48 leg Exp $
#

if test ! -x configure; then
  echo aclocal -I cmulocal
  aclocal -I cmulocal
  echo autoconf
  autoconf
fi

MAKE=gmake

# settings; we have to disable these on some platforms
AMSSYNC=--enable-amssync
STATIC=""
DEBUG=""
WITHAUTH="--with-auth=krb_pts"

if test "${CC-unset}" = "unset"; then
  CC=cc
fi


VER=`smake -D | sed 's;^.*\/;;'`
LOCALDEFS="-DEXTRA_IDENT=\\\"$VER\\\""

# Ryan's aggressive optimizations
if test "${OVERRIDE-nil}" != "t" ; then
  case `uname` in	
    Linux) CC="gcc"
	   CFLAGS="${CFLAGS} -O3 -g"
	   LDFLAGS="${LDFLAGS}"
	   #LIBS="-ldbm"
	   export LIBS
           AMSSYNC=""

           if test "${WASH_CYRUS_DEBUG}" = "t"; then
	     CC="gcc"
	     CFLAGS="-g"
             LDFLAGS="${LDFLAGS}"
             STATIC=""
           fi
	   ;;
    IRIX) CFLAGS="${CFLAGS} -O2"
	  LDFLAGS="${LDFLAGS}"
	  #LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib"
	  #export LDFLAGS
	  AMSSYNC=""
	  ;;
    HP-UX)
      CC=gcc # hp cc can't handle Cyrus
      CFLAGS="${CFLAGS} -O2"
      ;;
    SunOS)
      CFLAGS="${CFLAGS} -xs -xO3 -xdepend"
      LDFLAGS="${LDFLAGS} -xs -xO3 -xdepend"
      STATIC=""

      if test "${WASH_CYRUS_DEBUG}" = "t"; then
        CFLAGS="-g -xs"
        LDFLAGS="-L/usr/local/lib -R/usr/local/lib -xs -g"
        STATIC=""
      fi
      ;;
    ULTRIX)
      CC=gcc # cheat -- Ultrix cc is aged
      CFLAGS="${CFLAGS} -g -O2"
      WITHAUTH=""
      AMSSYNC=""
      ;;
    *)    
      ;;
  esac
fi;

if test "${WASH_CYRUS_DEBUG}" = "t"; then
  DEBUG="--enable-debug"
fi

LNCOMMAND="${SRCDIR}/configure $WITHAUTH --with-inn=/usr/news $AMSSYNC --enable-experiment --enable-cmulocal --with-cyrus-group=staff $DEBUG"

export CFLAGS CC VER LNCOMMAND LOCALDEFS LDFLAGS
