#!/bin/sh

missing() {
	echo "$1, is missing - please install it and try again"
	exit 1
}

check() {
	for i in $* ; do
		which $i 1>/dev/null 2>/dev/null || missing $i
	done
}

# which is in the following list to prevent a false positive on autoreconf
check which autoreconf libtool autopoint convert make


echo "remaking missing files in build environment"

# Directory exists in git source only.
if [ -d docsrc ]; then
  cd docsrc
  make && make doc
  cd ..
fi

autoreconf -ifs

