
# stuff from SUB_DEPENDS
optional_depends qtbase \
                 "--enable-qt5" "--disable-qt5" \
                 "Build Qt5Core mainloop integration?" &&
if is_depends_enabled $SPELL qtbase; then
  depends -sub CXX gcc
fi &&
optional_depends libevent \
                 "--enable-libevent" "--disable-libevent" \
                 "Build libevent mainloop integration?" &&

optional_depends mono \
                 "--enable-mono" "--disable-mono" \
                 "Enable mono bindings?" &&

optional_depends gtk+2 \
                 "--enable-gtk" "--disable-gtk" \
                 "Use GTK+2?" &&

optional_depends gtk+3 \
                 "--enable-gtk3" "--disable-gtk3" \
                 "Use GTK+3?" &&

optional_depends glib2 \
                 "--enable-glib" "--disable-glib --disable-gobject" \
                 "Enable glib bindings?" &&

if ( is_depends_enabled $SPELL qtbase ) || \
   ( is_depends_enabled $SPELL mono ) || ( is_depends_enabled $SPELL gtk+2 ) || \
   ( is_depends_enabled $SPELL glib2 ); then
    AVAHI_CLIENT=y
fi &&

optional_depends gobject-introspection --{en,dis}able-introspection 'introspection support' &&
optional_depends doxygen '' '--disable-doxygen-doc' 'install documentation?' &&

optional_depends python '' '--disable-python' 'Python support' &&
if is_depends_enabled $SPELL python;then
  depends dbus-python &&
  depends pygobject3
fi &&

if [[ "$AVAHI_DISCOVER" == 'y' ]]; then
   depends libglade2
fi &&

depends libdaemon --enable-libdaemon &&

# for the daemon it's technically optional, but that would make the spell unreliable
if [[ "$AVAHI_DISCOVER" == 'y' ]] || [[ "$AVAHI_DAEMON" == 'y' ]] || \
   [[ "$AVAHI_CLIENT" == 'y' ]] || [[ "$AVAHI_BOOKMARKS" == 'y' ]]; then
   depends dbus --enable-dbus
fi &&

if [[ "$AVAHI_DISCOVER" == 'y' ]] || [[ "$AVAHI_BOOKMARKS" == 'y' ]]; then
   depends dbus-python '--enable-dbus' &&
   depends pygtk2 '--enable-pygtk'
fi &&

if [[ "$AVAHI_BOOKMARKS" == 'y' ]]; then
   depends twisted
fi &&

if [[ "$AVAHI_DISCOVER" == 'y' ]] || [[ "$AVAHI_UTILS" == 'y' ]]; then
   # disabled in build if not enabled
   optional_depends gdbm "--enable-gdbm" "" "Use GDBM?"
fi &&

if [[ "$AVAHI_DISCOVER" == 'y' ]] && ( is_depends_enabled $SPELL gdbm ); then
   depends python '--enable-python' &&
   depends -sub GDBM python
fi &&

if [[ "$AVAHI_DAEMON" == 'y' ]]; then
  depends expat  --with-xml=expat &&
  optional_depends libcap '' '' 'for chroot support'
fi &&

# avahi depends on gtk-sharp-2 when both the dbus and mono dependencies are enabled
if ( is_depends_enabled $SPELL dbus ) && ( is_depends_enabled $SPELL mono ); then
  depends gtk-sharp-2
fi &&

if ( is_depends_enabled $SPELL mono ); then
   optional_depends monodoc \
                 "--enable-monodoc" "--disable-monodoc" \
                 "Enable documentation for mono bindings?"
fi
