#! /bin/sh
#
# default configuration options and compiler flags for different hosts
#
SGE_MODE=off
SGE_SUFFIX=sge
#
CONFPATH=`echo $0 | cut -c 1-6`
if [ "$CONFPATH" != "../../" ] ; then
CONFPATH='./'
fi
#
if test -z "$1" ; then
  HOSTNAME=`hostname`
else
  if [ "$1" = "$SGE_SUFFIX" ] ; then
    SGE_MODE=on
    HOSTNAME=`hostname`
  else
    HOSTNAME=$1
  fi
fi
#
set -x
#
case "${HOSTNAME}" in
# ia64-xxx-linux
    ds*)
        if [ "$SGE_MODE" = "off" ] ; then
	  ${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=/pool/ia64/netcdf/netcdf-3.6.0-p1 \
                    --with-szlib=$HOME/local \
                    CC=icc CFLAGS="-g -O2 -Wall -fno-alias -DMIN_BUF_SIZE=4194304"
        else
	  ${CONFPATH}configure --prefix=$HOME/local \
                    --program-suffix=_${SGE_SUFFIX} \
                    --with-netcdf=/pool/ia64/netcdf/netcdf-3.6.0-p1 \
                    --with-szlib=$HOME/local \
                    CPPFLAGS="-DHAVE_LIBDRMAA -I/opt/gridware/sge/include -DHAVE_LIBCURL -I/pool/ia64/libcurl4-7.16.0/include" \
                    LIBS="-L/opt/gridware/sge/lib/lx24-ia64 -ldrmaa -ldl /pool/ia64/libcurl4-7.16.0/lib/libcurl.a -lssl -lz" \
                    CC=icc CFLAGS="-g -O2 -Wall -fno-alias -DMIN_BUF_SIZE=4194304"
        fi
	;;
    wasser*)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=/home/dkrz/m214089/local/ia64 \
                    CC=icc CFLAGS="-g -O2 -Wall -fno-alias"
	;;
# x86_64-suse-linux
    tornado1)
 	${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/sles9-x64 \
	            --with-netcdf=/sw/sles9-x64/netcdf-3.6.1 \
                    --with-szlib=$HOME/local/sles9-x64 \
	            CC=gcc CFLAGS="-g -D_REENTRANT -O2 -Wall"
	;;        
# x86_64-etch-x64-linux
    squall1)
 	${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/etch-x64 \
	            --with-netcdf=/sw/etch-x64/netcdf-3.6.1 \
                    --with-szlib=/sw/etch-x64/szip-2.1 \
	            CC=gcc CFLAGS="-g -D_REENTRANT -O2 -Wall"
	;;        
# i686-suse-linux
    linux | laptop)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=$HOME/local \
                    --with-szlib=$HOME/local \
                    CC=g++ CFLAGS="-g -D_REENTRANT -O2 -Wall -W -Wfloat-equal"
	;;
# etch-ia32
    etch-ia32 | gata | baba)
        if [ "$SGE_MODE" = "off" ] ; then
 	  ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/etch-ia32 \
	            --with-netcdf=/client \
                    --with-szlib=$HOME/local/etch-ia32 \
	            CC=gcc CFLAGS="-g -D_REENTRANT -O2 -Wall -W -Wfloat-equal"
        else
 	  ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/etch-ia32 \
                    --program-suffix=_${SGE_SUFFIX} \
	            --with-netcdf=/client \
                    --with-szlib=$HOME/local/etch-ia32 \
                    CPPFLAGS="-DHAVE_LIBDRMAA -I/opt/gridware/sge/include -DHAVE_LIBCURL -I/usr/include" \
                    LIBS="-L/opt/gridware/sge/lib/lx24-x86 -ldrmaa -ldl -L/usr/lib -lcurl" \
                    CC=gcc CFLAGS="-g -D_REENTRANT -O2 -Wall -W -Wfloat-equal"
        fi
        ;;
# sarge-ia32
    sarge-ia32)
# opt: -fno-PIC -O4 -march=i686 -mcpu=i686 -pipe -ffast-math -fomit-frame-pointer
        if [ "$SGE_MODE" = "off" ] ; then
 	  ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/LINUX \
	            --with-netcdf=/client \
                    --with-szlib=$HOME/local/LINUX \
	            CC=gcc CFLAGS="-g -D_REENTRANT -O2 -Wall -W -Wfloat-equal"
        else
 	  ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/LINUX \
                    --program-suffix=_${SGE_SUFFIX} \
	            --with-netcdf=/client \
                    --with-szlib=$HOME/local/LINUX \
                    CPPFLAGS="-DHAVE_LIBDRMAA -I/opt/gridware/sge/include -DHAVE_LIBCURL -I/usr/include" \
                    LIBS="-L/opt/gridware/sge/lib/lx24-x86 -ldrmaa -ldl -L/usr/lib -lcurl" \
                    CC=gcc CFLAGS="-g -D_REENTRANT -O2 -Wall -W -Wfloat-equal"
        fi
	;;
    regio01)
	${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/LINUX0 \
	            --with-netcdf=/client \
	            CC=gcc CFLAGS="-g -D_REENTRANT -O2 -Wall"
	;;
# i386-pc-solaris2.10
    grim)
	${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/solaris10-x86 \
                    --with-netcdf=/client \
                    --with-szlib=$HOME/local/solaris10-x86 \
                    CC=cc CFLAGS="-g -mt -fast"
	;;
# sparc-sun-solaris2.10
    xxf)
	${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/solaris10 \
                    --with-netcdf=/sw/solaris10/netcdf-3.6.1 \
                    CC=cc CFLAGS="-g -mt -fast -m64"
	;;
# sparc-sun-solaris2.9 changed to
# sparc-sun-solaris2.10
    executor | yang | yin)
        if [ "$SGE_MODE" = "off" ] ; then
 	  ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/solaris10 \
                    --with-netcdf=/sw/solaris10/netcdf-3.6.1 \
                    --with-szlib=$HOME/local/solaris10 \
                    CC=cc CFLAGS="-g -mt -fast -m64"
        else
 	  ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/solaris10 \
                    --program-suffix=_${SGE_SUFFIX} \
                    --with-netcdf=/sw/solaris10/netcdf-3.6.1 \
                    --with-szlib=$HOME/local/solaris10 \
                    CPPFLAGS="-DHAVE_LIBDRMAA -I/opt/gridware/sge/include -DHAVE_LIBCURL -I/usr/local/include" \
                    LIBS="-L/opt/gridware/sge/lib/sol-sparc64 -ldrmaa -ldl -L/sw/solaris10/curl-7.16.4-cc/lib -lcurl" \
                    CC=cc CFLAGS="-g -mt -fast -m64"
        fi
	;;
# sx6-nec-superux12.2
    cs*)
	${CONFPATH}configure --prefix=$HOME/local \
         	    --with-netcdf=/pool/netcdf/netcdf-3.6.0-p1 \
		    CC=c++ \
                    CFLAGS="-O -Onooverlap,restrict=all -pvctl,fullmsg,noassume,loopcnt=1000000"
	;;
    sx6)
	${CONFPATH}configure --host=sx6 --prefix=$HOME/local \
                    --with-netcdf=/pool/SX-6/netcdf/netcdf-3.6.0-p1 \
		    CC=sxc++ AR=sxar \
                    CFLAGS="-O -Onooverlap,restrict=all -pvctl,fullmsg,noassume,loopcnt=1000000"
	;;
    es)
	${CONFPATH}configure --host=sx6 --prefix=$HOME/local/ES \
                    --with-netcdf=/S/n010/home010/c0148/local/SX \
		    CC=esc++ AR=esar \
                    CFLAGS="-O -Onooverlap,restrict=all -pvctl,fullmsg,noassume,loopcnt=1000000"
	;;
# mips-sgi-irix6.5
    ecgate1)
	${CONFPATH}configure --prefix=$HOME/local \
 	            --with-netcdf=/home/ms/spdekplb/hmk/include,/home/ms/spdekplb/hmk/lib64 \
	            CC=cc CFLAGS="-O -64"
	;;
# 5000-fujitsu-uxpv4.1_ES
    vpp5*)
	${CONFPATH}configure --prefix=$HOME \
	            --with-netcdf=$HOME/PROJ \
	            CC=vcc CFLAGS="-O -Wv,-m3 -K4"
	;;
# powerpc-ibm-aix5.2.0.0
    ecgate)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=/home/ms/spdekplb/hmk/local/AIX \
                    --with-szlib=$HOME/local \
	            CC=xlc_r CFLAGS="-O -q64 -qMAXMEM=-1 -qarch=auto -DHAVE_MMAP -D_LARGE_FILES=1"
	;;
# powerpc-ibm-aix6.0.0.0
    hpc*)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=/usr/local/lib/netcdf-3.5.0/LP64 \
                    --with-szlib=$HOME/local \
	            CC=xlc_r CFLAGS="-O3 -q64 -qstrict -qarch=auto -qtune=auto -DHAVE_MMAP -D_LARGE_FILES=1"
	;;
# powerpc-ibm-aix6.0.0.0
    dwd | p???et01)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=/uhome/mpischul/local \
	            CC=xlc_r CFLAGS="-O -q64 -qMAXMEM=-1 -qarch=auto -DHAVE_MMAP -D_LARGE_FILES=1"
	;;
# hppa2.0w-hp-hpux11.11
    moon)
        ${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=/S/n010/home010/c0148/local \
	            CC=cc CFLAGS="-g -fast"
	;;
    *)
	echo "configuration for hostname $HOSTNAME not found!"
	;;
esac
