list_remove XORG_SERVER_OPTS "--enable-multibuffer" "--disable-multibuffer"
list_remove XORG_SERVER_OPTS "--enable-aiglx" "--disable-aiglx"

. $GRIMOIRE/config_query_multi.function

# for order see configure.ac
config_query_list XORG_SHA1 "Choose SHA1 implementation:" \
                            nettle \
                            libgcrypt \
                            openssl &&

config_query XORG_XINITRC_XSESSION                                          \
                  "install a .desktop file that calls the user's .xinitrc?" \
                  n                                                         &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build documentation?"                                  \
                    n                                                       \
                    "--enable-docs"                                    \
                    "--disable-docs"                                   &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build Glamor, for radeon?"                             \
                    n                                                       \
                    "--enable-glamor"                                       \
                    "--disable-glamor"                                      &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build XRes extension?"                                 \
                    y                                                       \
                    "--enable-xres"                                         \
                    "--disable-xres"                                        &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build DPMS extension?"                                 \
                    y                                                       \
                    "--enable-dpms"                                         \
                    "--disable-dpms"                                        &&


config_query_option XORG_SERVER_OPTS                                        \
                    "Build Record extension?"                               \
                    y                                                       \
                    "--enable-record"                                       \
                    "--disable-record"                                      &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build XDMCP extension?"                                \
                    y                                                       \
                    "--enable-xdmcp"                                        \
                    "--disable-xdmcp"                                       &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build XDM_Auth_1 extension?"                           \
                    y                                                       \
                    "--enable-xdm-auth-1"                                   \
                    "--disable-xdm-auth-1"                                  &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build GLX extension?"                                  \
                    y                                                       \
                    "--enable-glx"                                          \
                    "--disable-glx"                                         &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build DRI extension?"                                  \
                    y                                                       \
                    "--enable-dri"                                          \
                    "--disable-dri"                                         &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build Security extension?"                             \
                    y                                                       \
                    "--enable-xcsecurity"                                   \
                    "--disable-xcsecurity"                                  &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build X-ACE extension?"                                \
                    y                                                       \
                    "--enable-xace"                                         \
                    "--disable-xace"                                        &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build Xorg server?"                                    \
                    y                                                       \
                    "--enable-xorg"                                         \
                    "--disable-xorg"                                        &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build Xvfb server?"                                    \
                    y                                                       \
                    "--enable-xvfb"                                         \
                    "--disable-xvfb"                                        &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build Xnest server?"                                   \
                    n                                                       \
                    "--enable-xnest"                                        \
                    "--disable-xnest"                                       &&

message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR} provides some advanced"       \
        "${PROBLEM_COLOR}EXPERIMENTAL${DEFAULT_COLOR} options that may"     \
        "${PROBLEM_COLOR}BREAK${DEFAULT_COLOR} the build or the final"      \
        "executing of the server. So answer the following carefully"        &&

config_query XORG_SERVER_ADVANCED "Do you wish the advanced options?" n     &&

if [[ $XORG_SERVER_ADVANCED == y ]] ; then
config_query_option XORG_SERVER_OPTS                                        \
                    "Build kdrive servers (EXPERIMENTAL)?"                  \
                    n                                                       \
                    "--enable-kdrive"                                       \
                    "--disable-kdrive"                                      &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build the kdrive Xephyr server (EXPERIMENTAL)?"        \
                    n                                                       \
                    "--enable-xephyr"                                       \
                    "--disable-xephyr"                                      &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build the kdrive Xsdl server (EXPERIMENTAL)?"          \
                    n                                                       \
                    "--enable-xsdl"                                         \
                    "--disable-xsdl"                                        &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build the kdrive Xfbdev server (EXPERIMENTAL)?"        \
                    n                                                       \
                    "--enable-xfbdev"                                       \
                    "--disable-xfbdev"                                      &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build the kdrive Xfake server (EXPERIMENTAL)?"         \
                    n                                                       \
                    "--enable-xfake"                                        \
                    "--disable-xfake"                                       &&
# this tends to break stuff badly
config_query_option XORG_SERVER_OPTS                                        \
                    "Install Xorg server as owned by root with setuid bit (EXPERIMENTAL)?" \
                    y                                                       \
                    "--enable-install-setuid"                               \
                    "--disable-install-setuid"                              &&

message "${QUERY_COLOR}Advanced options end here${DEFAULT_COLOR}"
fi
config_query_option XORG_SERVER_OPTS                                        \
                    "Enable Secure RPC?"                                    \
                    y                                                       \
                    "--enable-secure-rpc"                                   \
                    "--disable-secure-rpc"                                  &&

config_query_option XORG_SERVER_OPTS                                        \
                    "Build the xfree86 DDX utils?"                          \
                    n                                                       \
                    "--enable-xfree86-utils"                                \
                    "--disable-xfree86-utils"                               &&


message "${MESSAGE_COLOR}Note:"                                             &&
message "Default font search prefix is now /usr/share/fonts/X11 ."          && 
message "You might want to make sure you got no old font installs left in"  &&
message "/usr/lib/X11/fonts or instead have those paths set in xorg.conf ." &&
message "$DEFAULT_COLOR"                                                    &&

persistent_remove XORG_SERVER_FONT_100DPI
persistent_remove XORG_SERVER_FONT_75DPI
persistent_remove XORG_SERVER_FONT_SPEEDO
persistent_remove XORG_SERVER_FONT_TYPE1
persistent_remove XORG_SERVER_FONT_TTFOTF
persistent_remove XORG_SERVER_FONT_MISC

persistent_remove XORG_SERVER_INPUT_DRIVER
persistent_remove XORG_SERVER_INPUT_OBSCURE 
persistent_remove XORG_SERVER_VIDEO_DRIVER_COMMON
persistent_remove XORG_SERVER_VIDEO_DRIVER_UNCOMMON
persistent_remove XORG_SERVER_VIDEO_DRIVER_OBSCURE

