# 
# 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.94 2004/06/02 17:22:11 rjs3 Exp $
#

NEW_AUTOTOOLS=yes
export NEW_AUTOTOOLS

if test ! -x configure; then
# -nt deeply upsets normal sh.
#        -o configure.in -nt configure
#        -o acconfig.h -nt configure -o SMakefile -nt configure; then
  echo aclocal -I cmulocal
  aclocal -I cmulocal
  echo autoheader
  autoheader
  echo autoconf
  autoconf
fi

MAKE=gmake

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.1 INSTALLSITELIB=${DESTDIR}/usr/local/lib/perl5/site_perl/5.6.1 INSTALLSITEARCH=${DESTDIR}/usr/local/lib/perl5/site_perl/5.6.1 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

# Let's just assume we are using gcc...
if test "${WASH_CYRUS_INSURE}" = "t"; then
  CC="insure"
  CFLAGS="-g"
else
  CC="gcc"
  CFLAGS="${CFLAGS} -O3 -g -Wall -W"
fi

if test "${WASH_CYRUS_DEBUG}" = "t"; then
    CC="gcc"
    CFLAGS="-g"
    LDFLAGS="${LDFLAGS}"
    DEBUG="--enable-debug"
fi

case `uname` in	
    Linux) 
	LDFLAGS="${LDFLAGS}"
	LIBS="-lnsl" # for libwrap
    ;;
    SunOS)
        LDFLAGS="${LDFLAGS} -L/usr/local/lib -Wl,-R,/usr/local/lib"
	LIBS="-lkstat -ldoor"
    ;;
    *)
        CC=cc
    ;;
esac


# settings; we have to disable these on some platforms
DEBUG=""
WITHAUTH="--with-auth=pts --enable-krb5afspts --without-krbdes"
SSL_CONFIG="--with-openssl=/usr/local/lib"

# the defaults are good enough for us
DB_CONFIG="" 

# the following is for staticly linking SASL only
SASL_CONFIG="--with-staticsasl=/usr/local --with-gssapi=/usr/local"
KRB_CONFIG="--enable-statickrb --with-krb=/usr/local"
FEATURE_CONFIG="--enable-murder --enable-cmulocal"
EXT_PACKAGE_CONFIG="--with-inn=/usr/news --with-ucdsnmp=/usr/local"

MFCOMMAND="./configure $WITHAUTH $KRB_CONFIG $DB_CONFIG --enable-experiment --with-cyrus-group=staff $FEATURE_CONFIG $EXT_PACKAGE_CONFIG $SASL_CONFIG $DEBUG"

export CFLAGS CC VER LNCOMMAND LOCALDEFS LDFLAGS
export LIBS
