# 
# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer. 
#
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
#
# 3. The name "Carnegie Mellon University" must not be used to
#    endorse or promote products derived from this software without
#    prior written permission. For permission or any other legal
#    details, please contact  
#      Office of Technology Transfer
#      Carnegie Mellon University
#      5000 Forbes Avenue
#      Pittsburgh, PA  15213-3890
#      (412) 268-4387, fax: (412) 268-7395
#      tech-transfer@andrew.cmu.edu
#
# 4. Redistributions of any form whatsoever must retain the following
#    acknowledgment:
#    "This product includes software developed by Computing Services
#     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
#
# CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# This file is specific to Carnegie Mellon University's
# software build process
# 
# $Id: SMakefile,v 1.66 2000/12/18 20:28:20 leg Exp $
#

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

MAKE=gmake

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

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

if [ -r /.hostname ]; then
  # probably an andrew machine
  VER=`smake -D | sed 's;^.*\/;;'`
else
  # anonymous cvs?
  VER="anoncvs"
fi
LOCALDEFS="-DEXTRA_IDENT=\\\"$VER\\\""

# PERL CONFIGURATION
PERL_MM_OPT="INSTALLPRIVLIB=${DESTDIR}/usr/local/lib/perl5 INSTALLARCHLIB=${DESTDIR}/usr/local/lib/perl5/5.6.0 INSTALLSITELIB=${DESTDIR}/usr/local/lib/perl5/site_perl/5.6.0 INSTALLSITEARCH=${DESTDIR}/usr/local/lib/perl5/site_perl/5.6.0 INSTALLBIN=${DESTDIR}/usr/local/bin INSTALLSCRIPT=${DESTDIR}/usr/local/bin INSTALLMAN1DIR=${DESTDIR}/usr/local/man/man1 INSTALLMAN3DIR=${DESTDIR}/usr/local/man/man3"
export PERL_MM_OPT

# end perl configuration

case `uname` in	
    Linux) 
	CC="gcc"
	CFLAGS="${CFLAGS} -O3 -g -Wall"
	LDFLAGS="${LDFLAGS}"
	LIBS="-lnsl" # for libwrap

        if test "${WASH_CYRUS_DEBUG}" = "t"; then
	    CC="gcc"
	    CFLAGS="-g"
            LDFLAGS="${LDFLAGS}"
        fi
    ;;
    SunOS)
#      CFLAGS="${CFLAGS} -xs -xO3 -xdepend"
#      LDFLAGS="${LDFLAGS} -xs -xO3 -xdepend"

	CC="gcc"
        CFLAGS="${CFLAGS} -g -O3 -Wall"
        LDFLAGS="${LDFLAGS} -L/usr/local/lib -Wl,-R,/usr/local/lib"
	LIBS="-lkstat"

#     if test "${WASH_CYRUS_DEBUG}" = "t"; then
#        CFLAGS="-g -xs"
#        LDFLAGS="-L/usr/local/lib -R/usr/local/lib -xs -g"
#      fi

      if test "${WASH_CYRUS_DEBUG}" = "t"; then
        CFLAGS="-g"
      fi
      ;;
  *)    
  ;;
esac

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

MFCOMMAND="./configure $WITHAUTH --with-inn=/usr/news --enable-experiment --enable-cmulocal --with-cyrus-group=staff --with-openssl=/usr/local/lib --enable-thread-ref --with-ucdsnmp=/usr/local --enable-murder $DEBUG"

export CFLAGS CC VER LNCOMMAND LOCALDEFS LDFLAGS
export LIBS
