#!/bin/bash
set -x

./configure \
  --enable-openssl \
  --prefix=${PREFIX} \
  --enable-lib-static \
  --enable-lib-shared \
  --extra-cflags="$CFLAGS -I$PREFIX/include" \
  --extra-ldflags="$LDFLAGS"

make install
make check

pushd $PREFIX/lib
if [[ ${target_platform} =~ osx.* ]]; then
  ${INSTALL_NAME_TOOL:-install_name_tool} -id @rpath/librhash.0.dylib librhash.0.dylib
  ln -s librhash.0${SHLIB_EXT} librhash${SHLIB_EXT}
else
  ln -s librhash${SHLIB_EXT}.0 librhash${SHLIB_EXT}
fi
