. "$GRIMOIRE/FUNCTIONS" &&

persistent_remove NGINX_SYSLOG &&

if [[ "${NGINX_RELEASE}" != "devel" ]]; then
  config_query_option NGINX_OPTS "Build with IPv6 support?" n \
                                 "--with-ipv6" ""
else
  list_remove "NGINX_OPTS" "--with-ipv6"
fi &&

config_query_option NGINX_OPTS "Build with mail support?" n \
                               "--with-mail --with-mail_ssl_module" "" &&

if list_find "$NGINX_MODULES" "dav_ext"; then
  list_add "NGINX_OPTS" "--with-http_dav_module"
else
  config_query_option NGINX_OPTS "Enable HTTP WebDAV module?" n \
                                 "--with-http_dav_module" ""
fi &&

config_query_option NGINX_OPTS "Enable SUB filter module?" n \
                               "--with-http_sub_module" "" &&

config_query_option NGINX_OPTS "Enable HTTP Real IP module?" n \
                               "--with-http_realip_module" "" &&

config_query_option NGINX_OPTS "Enable thread pool support?" n \
                               "--with-threads" "" &&

persistent_remove NGINX_THREADS
