# Function to do a preliminary package dependency check
checkdependencies() {
  echo "Parsing $APP 's dependency list..."

  for PACKAGEDEP in $REQUIRES; do
    DEPCOUNT="$(find /doc -name $PACKAGEDEP.SMBuild | wc -l)"
    # If count is 1, we are ok
    if [ "$DEPCOUNT" == "1" ] ; then
      echo "Found dependency $PACKAGEDEP"
    # If count is 0, we exit, because we are in trouble
    elif [ "$DEPCOUNT" == "0" ] ; then
      echo "Did not find dependency $PACKAGEDEP ! Aborting!"
      exit 1
    # If count is greater than or equal to 2, we are in slightly less trouble
    elif [ "$DEPCOUNT" -ge "2" ] ; then
      echo "Warning! Found multiple versions of $PACKAGEDEP !"
      sleep 0.5
    fi
  done
}
