#!/bin/bash
# script to building zlib-1.2.5 with the Intel Compiler Suite

## load compiler settings
# Intel(R) Composer XE 2011 Update 4 for Linux
source /opt/intel/composerxe-2011.4.191/bin/compilervars.sh intel64 # compiler suite
source /opt/intel/mkl/bin/mklvars.sh intel64 # math kernel library

# set environment variables
export CC=icc
export CPP=icpc
export CFLAGS='-O3 -xHost -fPIC'
# Note: the Intel compiler can for unknown reasons only build the
# static library (libz.a). I built and installed the shared 
# library with GCC first.
#export SFLAGS='-O3 -xHost -fPIC -DPIC -shared'
#export LDSHARED='-lpthread'

## build static library
# configure
./configure
# build and test build
make

# install library if test successful
make check && make install