#!/bin/bash

# Get an updated config.sub and config.guess
cp -r ${BUILD_PREFIX}/share/libtool/build-aux/config.* .

sed -i.bak -E "s/-Werror/-Wno-error/" configure.ac
bash ./autogen.sh

# https://github.com/json-c/json-c/issues/406
export CPPFLAGS="${CPPFLAGS/-DNDEBUG/}"

if [[ "${target_platform}" == osx-* ]]; then
  # required for clang ...
  export CPPFLAGS="${CPPFLAGS} -Wno-error -Wno-unknown-warning-option"
  export CFLAGS="${CFLAGS} -Wno-error -Wno-unknown-warning-option"
fi

./configure --prefix=$PREFIX --host=$HOST --build=$BUILD

make ${VERBOSE_AT}
make check ${VERBOSE_AT}
make install
