#---
## @Synopsis libdepends
#---

##
## @Globals SPELL_DEPENDENCIES
function query_spell_dependencies() {
  if ! [[ $SPELL_DEPENDENCIES ]] ||
     ! query "Are \"${SPELL_DEPENDENCIES}\" the proper dependencies for this spell" y
  then
    query_msg "Please enter the dependencies(non optional) \
of the spell if any:"
    read "SPELL_DEPENDENCIES"
    SPELL_DEPENDENCIES=$(tr ',' ' ' <<< "$SPELL_DEPENDENCIES" | sort | uniq)
fi
}

##
## @Globals SPELL_OPTIONAL_DEPENDENCIES
function query_spell_optional_dependencies() {
  query_msg "Please enter the optional dependencies of the spell if any:"
  read -a "SPELL_OPTIONAL_DEPENDENCIES"
}

##
## @Globals DEPENDSISON SPELL_DEPENDENCIES
function add_dependencies() {
  local i

  touch DEPENDS
  DEPENDSISON="DEPENDS, "
  for i in ${SPELL_DEPENDENCIES}
  do
     echo "depends ${i}" >> DEPENDS
  done
}

##
## @Globals DEPENDSISON SPELL_OPTIONAL_DEPENDENCIES
function add_optional_dependencies() {
  local dep dep_count
  local SPELL_OPTIONAL_DEPENDENCIES_ENABLED[0]=""
  local SPELL_OPTIONAL_DEPENDENCIES_DISABLED[0]=""
  local SPELL_OPTIONAL_DEPENDENCIES_DESCRIPTION[0]=""

  dep_count=${#SPELL_OPTIONAL_DEPENDENCIES[*]}
  touch DEPENDS
  DEPENDSISON="DEPENDS, "
  for  ((dep=0; dep < $dep_count; dep++))
  do
    query_msg "${SPELL_OPTIONAL_DEPENDENCIES[$dep]} needs a ./configure enable option"
    read SPELL_OPTIONAL_DEPENDENCIES_ENABLED[$dep]
    query_msg "${SPELL_OPTIONAL_DEPENDENCIES[$dep]} needs a ./configure disable option"
    read SPELL_OPTIONAL_DEPENDENCIES_DISABLED[$dep]
    query_msg "${SPELL_OPTIONAL_DEPENDENCIES[$dep]} needs a description"
    read SPELL_OPTIONAL_DEPENDENCIES_DESCRIPTION[$dep]

    message "optional_depends ${SPELL_OPTIONAL_DEPENDENCIES[$dep]} \\" >> DEPENDS
    message "                 \"${SPELL_OPTIONAL_DEPENDENCIES_ENABLED[$dep]}\" \\" >> DEPENDS
    message "                 \"${SPELL_OPTIONAL_DEPENDENCIES_DISABLED[$dep]}\" \\" >> DEPENDS
    message "                 \"${SPELL_OPTIONAL_DEPENDENCIES_DESCRIPTION[$dep]}\"" >> DEPENDS
  done
# "optional_depends ${j} \"enabled-option\" \"disabled-option\" \"description\""
}

##
## @Globals
function add_bs_depends() {
  return
}
#---
##
## This software is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This software is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this software; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
##
#---

