# Set some compiler flags
export CFLAGS="-I$PREFIX/include -I$BUILD_PREFIX/include -L$PREFIX/lib -L$BUILD_PREFIX/lib"
export CXXFLAGS="-I$PREFIX/include -I$BUILD_PREFIX/include -L$PREFIX/lib -L$BUILD_PREFIX/lib"
export LDFLAGS="$LDFLAGS -L$PREFIX/lib -L$BUILD_PREFIX/lib"

if [ "`uname -s`" == "Darwin" ] ; then
  CONDA_BUILD_SYSROOT=/opt/MacOSX10.9.sdk
fi

sed -i.orig "s|#define NIOBUF  40|#define NIOBUF  128|g" fitsio2.h

export MAKE_FLAGS="shared"

./configure --prefix=$PREFIX
make $MAKE_FLAGS
make install

cp -p fitsio.h $PREFIX/include
cp -p longnam.h $PREFIX/include
cp -p cfortran.h  $PREFIX/include
