#! /bin/sh
#
# default configuration options and compiler flags for different hosts
#
#
CONFPATH=`echo $0 | cut -c 1-6`
if [ "$CONFPATH" != "../../" ] ; then
CONFPATH='./'
fi
#
if test -z "$1" ; then
  HOSTNAME=`hostname`
else
  HOSTNAME=$1
fi
#
set -x
#
case "${HOSTNAME}" in
    icc)
	${CONFPATH}configure --prefix=$HOME/local \
                    --enable-maintainer-mode \
                    --with-jasper=$HOME/local \
                    --with-grib_api=$HOME/local/gribapi-1.9.16cgribex \
                    --with-netcdf=$HOME/local \
                    --with-hdf5=$HOME/local \
                    --with-szlib=$HOME/local \
                    --with-proj=/opt/local \
                    --with-magics=/Users/m214003/local/magics-2.14.9 \
	            CC=icc CFLAGS="-g  -D_REENTRANT -Wall -W -O3 -openmp -DHAVE_LIBXML -I/usr/include/libxml2 -I/opt/include" \
                    LIBS="-L/usr/lib -lxml2 -L/opt/local/lib -lopenjpeg"
	;;
# i386-apple-darwin10
    bailung*)
	${CONFPATH}configure --prefix=$HOME/local \
                    --enable-maintainer-mode \
                    --with-jasper=$HOME/local \
                    --with-grib_api=$HOME/local/gribapi-1.9.16cgribex \
                    --with-netcdf=$HOME/local \
                    --with-hdf5=$HOME/local \
                    --with-szlib=$HOME/local \
                    --with-proj=/opt/local \
                    --with-magics=/Users/m214003/local/magics-2.14.9 \
	            CC=gcc CFLAGS="-g -pipe -D_REENTRANT -Wall -W -Wfloat-equal -pedantic -O3 -fopenmp -DHAVE_LIBXML -I/usr/include/libxml2 -I/opt/include" \
                    LIBS="-L/usr/lib -lxml2 -L/opt/local/lib -lopenjpeg"
	;;
    hama*)
	${CONFPATH}configure --prefix=$HOME/local \
                    --enable-maintainer-mode \
                    --with-jasper=/opt/local \
                    --with-grib_api=$HOME/local/gribapi-1.9.8 \
                    --with-netcdf=/opt/local \
                    --with-szlib=$HOME/local \
                    --with-proj=/opt/local \
	            CC=gcc CFLAGS="-g -pipe -D_REENTRANT -Wall -W -Wfloat-equal -pedantic -O3 -fopenmp"
	;;
# ia64-xxx-linux
    ds*)
	${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"
	;;
    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
    tornado*)
 	${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/sles10-x64 \
                    --enable-all-static \
	            --with-netcdf=/sw/sles10-x64/netcdf-4.2-static \
	            --with-hdf5=/sw/sles10-x64/hdf5-1.8.8-static \
                    --with-szlib=/sw/sles10-x64/szip-2.1 \
	            CC=gcc CFLAGS='-g -Wall -O2 -fopenmp'
#	            CC=suncc CFLAGS="-g -fast -xopenmp"
	;;
# x86_64-squeeze-x64-linux
    thunder*)
        ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/squeeze-x64 \
                    --with-jasper=/sw/squeeze-x64/jasper-1.900.1-static \
                    --with-grib_api=/sw/squeeze-x64/grib_api-1.9.9-static \
                    --with-netcdf=/sw/squeeze-x64/netcdf-4.2-static \
                    --with-hdf5=/sw/squeeze-x64/hdf5-1.8.8-static \
                    --with-szlib=/sw/squeeze-x64/szip-2.1 \
                    --with-proj=/sw/squeeze-x64/proj-4.7.0 \
                    CC=gcc CFLAGS='-g -Wall -O3 -fopenmp'
	;;
# x86_64-lenny-linux-gnu
    squall*)
        ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/lenny-x64 \
                    --with-jasper=/sw/lenny-x64/jasper-1.900.1-static \
                    --with-grib_api=/sw/lenny-x64/grib_api-1.9.9-static \
                    --with-netcdf=/sw/lenny-x64/netcdf-4.2-static \
                    --with-hdf5=/sw/lenny-x64/hdf5-1.8.8-static \
                    --with-szlib=/sw/lenny-x64/szip-2.1 \
                    --with-proj=/sw/lenny-x64/proj-4.7.0 \
                    CC=gcc CFLAGS='-g -Wall -O3 -fopenmp'
	;;
# x86_64-archlinux
    thingol*)
 	${CONFPATH}configure --prefix=`pwd`/build \
                    --enable-maintainer-mode \
	            --with-netcdf=$HOME/local/libs4cdo-0.0.9 \
	              --with-hdf5=$HOME/local/libs4cdo-0.0.9 \
                     --with-szlib=$HOME/local/libs4cdo-0.0.9 \
                      --with-proj=$HOME/local/libs4cdo-0.0.9 \
                  --with-grib_api=$HOME/local/libs4cdo-0.0.9 \
                    --with-jasper=$HOME/local/libs4cdo-0.0.9 \
                      --with-pic \
	            CC=gcc CFLAGS="-g -Wall -O2 -fopenmp -DWITH_DATA" LIBS=-lopenjpeg
	;;
# i686-suse-linux
    linux | laptop)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-jasper=/usr \
                    --with-grib_api=$HOME/local \
                    --with-netcdf=$HOME/local \
                    --with-hdf5=$HOME/local \
                    --with-szlib=$HOME/local \
	            CC=colorgcc CFLAGS="-g -Wall -W -Wfloat-equal -pedantic -O2 -fopenmp"
	;;
# standard workstations at MPI-M x86_64-lenny
    mpipc* )
	${CONFPATH}configure \
               --prefix=`pwd`/build \
               --enable-maintainer-mode \
               --with-netcdf='/sw/lenny-x64/netcdf-latest-gccsys' \
               --with-hdf5='/sw/lenny-x64/hdf5-latest' \
               --with-szlib='/sw/lenny-x64/szip-latest' \
               --with-proj='/sw/lenny-x64/proj-latest' \
               --enable-ruby --enable-swig --enable-python \
	           CC=gcc CFLAGS="-g -fopenmp -Wall -W -Wfloat-equal -pedantic -O2"
        ;;
# dap enabled
    egmont | columbine)
 	  ${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/etch-ia32 \
	            --with-netcdf=/sw/etch-ia32/netcdf-4.1.1-gcc \
	            --with-hdf5=/sw/etch-ia32/hdf5-1.8.4-threadsafe \
                    --with-zlib=/sw/etch-ia32/zlib-1.2.3 \
                    --with-szlib=/sw/etch-ia32/szip-2.1 \
                    --with-proj=/sw/etch-ia32/proj-4.6.0 \
	            --enable-all-static CC=icc CFLAGS="-g -fast -openmp" AR=xiar LD=xild
#	            CC=gcc CFLAGS="-g -Wall -W -Wfloat-equal -pedantic -O2 -fopenmp"
    ;;
# i386-pc-solaris2.10
    grim | mil* )
	${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"
	;;
# sx6-nec-superux12.2
    cs*)
	${CONFPATH}configure --prefix=$HOME/local \
         	    --with-netcdf=/pool/netcdf/netcdf-3.6.0-p1 \
		    CC=cc \
                    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=sxcc 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=escc AR=esar \
                    CFLAGS="-O -Onooverlap,restrict=all -pvctl,fullmsg,noassume,loopcnt=1000000"
	;;
# x86_64-unknown-linux-gnu (rhel55)
    lizard*)
        LDFLAGS="-lpng"
        export LDFLAGS
	${CONFPATH}configure --prefix=$HOME/local/rhel55-x64 \
                    --with-jasper=/sw/rhel55-x64/jasper-1.900.1 \
                    --with-grib_api=/sw/rhel55-x64/grib_api-1.9.0 \
                    --with-netcdf=/sw/rhel55-x64/netcdf-4.2 \
                    --with-hdf5=/sw/rhel55-x64/hdf5-1.8.8-threadsafe \
                    --with-szlib=/sw/rhel55-x64/szip-2.1 \
                    --with-zlib=/usr \
 	            CC=gcc44 CFLAGS="-g -Wall -O2 -fopenmp"
	;;
# powerpc-ibm-aix5.2.0.0
    ecga*)

	${CONFPATH}configure --prefix=$HOME/local \
                    --with-jasper=/usr/local/lib/metaps/lib/grib_api/jasper_64 \
                    --with-grib_api=$HOME/gribapi/1.9.8 \
                    --with-netcdf=/usr/local/apps/netCDF/3.6.2/LP64 \
                    --with-szlib=$HOME/local \
                    AR="ar -X 64"  LDFLAGS="-brtl" \
	            CC=xlc_r CFLAGS="-g -O3 -q64 -qhot -qstrict -qarch=auto -qtune=auto -qsmp=omp -DHAVE_MMAP -qthreaded"
	;;
# powerpc-ibm-aix5.3.0.0
    blizzard*)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-jasper=/sw/aix53/jasper-1.900.1 \
                    --with-grib_api=/sw/aix61/grib_api-1.9.9 \
                    --with-netcdf=/sw/aix61/netcdf-4.2-threadsafe \
                    --with-hdf5=/sw/aix61/hdf5-1.8.8-threadsafe \
                    --with-szlib=/sw/aix61/szip-2.1-threadsafe \
                    --with-proj=/sw/aix53/proj-4.6.1 \
                    AR="ar -X 64"  LDFLAGS="-brtl" \
 	            CC=xlc_r CFLAGS="-g -O3 -q64 -qhot -qstrict -qarch=auto -qtune=auto -qsmp=omp -DHAVE_MMAP -qthreaded"
	;;
    vip*)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=$HOME/local \
                    --with-szlib=$HOME/local \
                    AR="ar -X 64"  LDFLAGS="-brtl" \
	            CC=xlc_r CFLAGS="-g -O3 -q64 -qhot -qstrict -qarch=auto -qtune=auto -qsmp=omp -DHAVE_MMAP -qthreaded"
	;;
# powerpc-ibm-aix6.0.0.0
    c1a*)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=/usr/local/apps/netcdf/3.6.3/LP64 \
                    --with-hdf5=/usr/local/apps/hdf5/1.8.1/LP64 \
                    --with-szlib=/usr/local/apps/szip/2.1/LP64 \
                    AR="ar -X 64"  LDFLAGS="-brtl" \
	            CC=xlc_r CFLAGS="-g -O3 -q64 -qhot -qstrict -qarch=auto -qtune=auto -qsmp=omp -DHAVE_MMAP -qthreaded"
	;;
# powerpc-ibm-aix6.0.0.0
    dwd | p???et01)
	${CONFPATH}configure --prefix=$HOME/local \
                    --with-netcdf=/uhome/mpischul/local \
                    AR="ar -X 64"  LDFLAGS="-brtl" \
	            CC=xlc_r CFLAGS="-g -O3 -q64 -qhot -qstrict -qarch=auto -qtune=auto -qsmp=omp -DHAVE_MMAP -qthreaded"
	;;
    *)
	echo "configuration for hostname $HOSTNAME not found!"
	;;
esac
