. "$GRIMOIRE/FUNCTIONS" &&

local QEMU_ARCH_FILE=archs

local QEMU_ARCH_LIST=`cat $SPELL_DIRECTORY/$QEMU_ARCH_FILE` &&
persistent_add QEMU_ARCHS &&

# deliberately uses query, see locale CONFIGURE note
if query "Handpick architectures to emulate (y/n)?" n; then
  BACKTITLE="Qemu Archs Configuration"           &&
      TITLE="Arch Selection"                     &&
       HELP="Select Arch you want to build qemu" &&

  QEMU_ARCHS=`dialog --backtitle  "$BACKTITLE"  \
                     --title      "$TITLE"      \
                     --stdout                   \
                     --checklist  "$HELP"       \
                     0 0 0                      \
                     $QEMU_ARCH_LIST`
fi &&

if [[ -z $QEMU_ARCHS ]]; then
  QEMU_ARCHS=$(cut -f 1 $SPELL_DIRECTORY/$QEMU_ARCH_FILE | sed -e 's/^/"/' -e 's/\s*$/"/' | tr '\n' ' ')
fi

. $GRIMOIRE/config_query_multi.function                              &&

config_query_multi QEMU_AUDIO "Select sound system(s) to support"    \
     oss alsa sdl esd pa fmod                                        &&

config_query_multi QEMU_CARDS "Select sound card(s) to emulate"      \
                   hda ac97 es1370 sb16 cs4231a adlib gus            &&

config_query_option QEMU_OPTS "Enable KVM acceleration support" y     \
                              "" "--disable-kvm"  &&

config_query_option QEMU_OPTS "Enable Trusted Platform Module (TPM)?" n  \
                              '--enable-tpm'  ''                      &&

config_query_option QEMU_OPTS "Enable VNC support?" y \
		    '--enable-vnc' \
		    '--disable-vnc --disable-vnc-sasl --disable-vnc-jpeg --disable-vnc-png'  &&

config_query_multi QEMU_VNC_TLS "Enable TLS encryption in VNC?" 'none' 'nettle' 'gcrypt' &&

config_query_option QEMU_OPTS \
                    'Build documentation? (requires: perl, python, texinfo)' y \
                    '--enable-docs' \
                    '--disable-docs'

