+# Set misc options
+
+# By default, do build with -Wall, unless the user asks not to
+[wall_CFLAGS=-Wall]
+AC_ARG_ENABLE(
+ [wall],
+ [AS_HELP_STRING(
+ [--disable-wall],
+ [build with -Wall (default=yes)])],
+ [AS_CASE(
+ ["$enableval"],
+ [yes], [wall_CFLAGS=-Wall],
+ [*], [wall_CFLAGS=""])])
+AC_SUBST([wall_CFLAGS],[${wall_CFLAGS}])
+
+# For releases, do not build with -Werror, unless the user explicitly
+# requests to build with -Werror.
+# For the devel tree, do build with -Werror by default, unless user
+# explicitly disables -Werror
+AS_IF(
+ [test "$(${srcdir}/scripts/version.sh --internal)" = "git"],
+ [werror_CFLAGS=-Werror])
+AC_ARG_ENABLE(
+ [werror],
+ [AS_HELP_STRING(
+ [--enable-werror],
+ [build with -Werror (default=no)])],
+ [AS_CASE(
+ ["$enableval"],
+ [yes], [werror_CFLAGS=-Werror],
+ [*], [werror_CFLAGS=""])])
+AC_SUBST([werror_CFLAGS],[${werror_CFLAGS}])
+
+# Although there is a default (="linux") in the code, we do provide
+# a default here, to get a consistent autostuff behavior
+AC_ARG_ENABLE(
+ [root-menu-prompt],
+ [AS_HELP_STRING(
+ [--enable-root-menu-prompt=PROMPT],
+ [set the root-menu prompt (default=Configuration)])],
+ [AS_CASE(
+ ["$enableval"],
+ [yes], [root_menu=Configuration],
+ [no], [root_menu=],
+ [# Escape the $ signs, otherwise they would get munged by make
+ root_menu="$( echo "$enableval" |sed -e 's/\$/\\$$/g;' )"])])
+AC_SUBST([root_menu], [${root_menu=Configuration}])
+
+AC_ARG_ENABLE(
+ [config-prefix],
+ [AS_HELP_STRING(
+ [--enable-config-prefix=PREFIX],
+ [the prefix to the config option (default=CONFIG_)])],
+ [AS_CASE(
+ ["$enableval"],
+ [*" "*],[AC_MSG_ERROR([config prefix can not contain spaces: '$enableval'])],
+ [yes], [config_prefix=CONFIG_],
+ [no], [config_prefix=],
+ [config_prefix=$enableval])])
+AC_SUBST([config_prefix], [${config_prefix-CONFIG_}])
+
+AC_ARG_ENABLE(
+ [utils],
+ [AS_HELP_STRING(
+ [--disable-utils],
+ [install utilities to manage .config files (default=yes)])])
+AC_SUBST([enable_utils], [${enable_utils:-yes}])
+
+AC_ARG_ENABLE(
+ [L10n],
+ [AS_HELP_STRING(
+ [--disable-L10n],
+ [enable localisation (L10n) (default=auto)])])
+AC_SUBST([enable_L10n], [${enable_L10n:-yes}])
+
+#----------------------------------------
+# Options to selectively enable/disable frontends
+# All are selected by default
+AC_ARG_ENABLE(
+ [conf],
+ [AS_HELP_STRING(
+ [--disable-conf],
+ [conf, the stdin-based frontend (default=auto)])])
+AC_SUBST([enable_conf], [${enable_conf:-auto}])
+AC_ARG_ENABLE(
+ [mconf],
+ [AS_HELP_STRING(
+ [--disable-mconf],
+ [mconf, the traditional ncurses-based frontend (default=auto)])])
+AC_SUBST([enable_mconf], [${enable_mconf:-auto}])
+AC_ARG_ENABLE(
+ [nconf],
+ [AS_HELP_STRING(
+ [--disable-nconf],
+ [nconf, the modern ncurses-based frontend (default=auto)])])
+AC_SUBST([enable_nconf], [${enable_nconf:-auto}])
+AC_ARG_ENABLE(
+ [gconf],
+ [AS_HELP_STRING(
+ [--disable-gconf],
+ [gconf, the GTK-based frontend (default=auto)])])
+AC_SUBST([enable_gconf], [${enable_gconf:-auto}])
+AC_ARG_ENABLE(
+ [qconf],
+ [AS_HELP_STRING(
+ [--disable-qconf],
+ [qconf, the QT-based frontend (default=auto)])])
+AC_SUBST([enable_qconf], [${enable_qconf:-auto}])
+
+AC_ARG_ENABLE(
+ [frontends],
+ [AS_HELP_STRING(
+ [--enable-frontends=list],
+ [enables only the set of frontends in comma-separated 'list'
+ (default: auto selection), takes precedence over all
+ --enable-*conf, above])],
+ [for f in conf mconf nconf gconf qconf; do
+ AS_CASE(
+ ["$enableval"],
+ [yes], [eval enable_$f=yes],
+ ["$f"], [eval enable_$f=yes],
+ ["$f",*], [eval enable_$f=yes],
+ [*,"$f"], [eval enable_$f=yes],
+ [*,"$f",*], [eval enable_$f=yes],
+ [eval enable_$f=no])
+ done])
+AC_SUBST([enable_frontends])
+
+#----------------------------------------
+# What extra CFLAGS we will be using
+AC_SUBST([kf_CFLAGS], ["$wall_CFLAGS $werror_CFLAGS"])
+
+#----------------------------------------
+# Dependencies that will be needed, depending on the frontends
+AS_CASE(
+ ["$enable_mconf":"$enable_nconf"],
+ [*yes*], [need_curses=yes],
+ [*auto*], [need_curses=auto],
+ [need_curses=no])
+[need_panel_menu="$enable_nconf"]
+AS_CASE(
+ ["$enable_gconf":"$enable_qconf"],
+ [*yes*], [need_pkgconfig=yes],
+ [*auto*], [need_pkgconfig=yes],
+ [need_pkgconfig=no ])
+[need_gtk="$enable_gconf"]
+[need_qt="$enable_qconf"]
+
+#---------------------------------------------------------------------------
+# Now check we have the required stuff