+# Check for libpanel and libmenu, for the nconf frontend
+AS_IF(
+ [test "$need_panel_menu" = "yes" -o "$need_panel_menu" = "auto"],
+ [AC_SUBST([ncurses_nconf_CPPFLAGS])
+ AC_SUBST([ncurses_panel_menu_LIBS])
+ AS_CASE(
+ [$CURSES_LOC],
+ [ncursesw/*],[ncurses_nconf_CPPFLAGS="-I/usr/include/ncursesw"],
+ [ncurses/*],[ncurses_nconf_CPPFLAGS="-I/usr/include/ncurses"])
+ LIBS_old="$LIBS"
+ LIBS=
+ AC_SEARCH_LIBS(
+ [new_panel],
+ [panelw panel],
+ [ac_ct_panel_lib_found=yes; break],,
+ [$ncurses_LIBS])
+ AS_IF(
+ [test -z "$ac_ct_panel_lib_found"],
+ [AS_IF(
+ [test "$need_panel_menu" = "yes"],
+ [AC_MSG_ERROR([could not find libpanel library (frontend: nconf)])],
+ [has_panel_menu=no])])
+ AC_SEARCH_LIBS(
+ [menu_init],
+ [menuw menu],
+ [ac_ct_menu_lib_found=yes; break],,
+ [$ncurses_LIBS])
+ AS_IF(
+ [test -z "$ac_ct_panel_lib_found"],
+ [AS_IF(
+ [test "$need_panel_menu" = "yes"],
+ [AC_MSG_ERROR([could not find libmenu library (frontend: nconf)])],
+ [has_panel_menu=no])])
+ ncurses_panel_menu_LIBS="$LIBS"
+ LIBS=$LIBS_old])
+
+AS_IF(
+ [test "$has_panel_menu" = "no" ],
+ [enable_nconf=no])
+
+#----------------------------------------
+# Check headers and libs for gconf
+AS_IF(
+ [test "$need_gtk" = "yes" -o "$need_gtk" = "auto"],
+ [PKG_CHECK_MODULES(
+ [gtk],
+ [gtk+-2.0 gmodule-2.0 libglade-2.0],
+ [has_gtk=yes],
+ [AS_IF(
+ [test "$need_gtk" = "yes"],
+ [AC_MSG_ERROR([could not find GTK+ headers and/or libraries (frontend: gconf)])],
+ [has_gtk=no])])])
+
+AS_IF(
+ [test "$has_gtk" = "no" ],
+ [enable_gconf=no])
+
+#----------------------------------------
+# Check headers and libs for qconf
+AS_IF(
+ [test "$need_qt" = "yes" -o "$need_qt" = "auto"],
+ [PKG_CHECK_MODULES(
+ [Qt5],
+ [Qt5Core Qt5Gui Qt5Widgets],
+ [has_qt=yes; need_moc="$need_qt"],
+ [AS_IF(
+ [test "$need_qt" = "yes"],
+ [AC_MSG_ERROR([could not find Qt5 headers and/or libraries (frontend: qconf)])],
+ [has_qt=no; need_moc=no])])])
+
+AC_ARG_VAR([MOC], [Qt5 meta object compiler (moc) command])
+AS_IF(
+ [test "$need_moc" = "yes" -o "$need_moc" = "auto"],
+ [QT5_BINDIR=`$PKG_CONFIG Qt5Core --variable host_bins`
+ AC_PATH_PROGS(
+ [MOC],
+ [moc-qt5 moc],,
+ [$QT5_BINDIR:$PATH])
+ AS_IF(
+ [test -n "$MOC"],
+ [has_moc=yes],
+ [AS_IF(
+ [test "$need_moc" = "yes"],
+ [AC_MSG_ERROR([could not find moc (frontend: qconf)])],
+ [has_moc=no])])])
+
+AS_IF(
+ [test "$has_qt" = "no" -o "$has_moc" = "no"],
+ [enable_qconf=no])
+
+#----------------------------------------
+# Per-frontends extra libraries
+AC_ARG_VAR([conf_EXTRA_LIBS], [Extra libraries to build the conf frontend] )
+AC_ARG_VAR([gconf_EXTRA_LIBS], [Extra libraries to build the gconf frontend])
+AC_ARG_VAR([mconf_EXTRA_LIBS], [Extra libraries to build the mconf frontend])
+AC_ARG_VAR([nconf_EXTRA_LIBS], [Extra libraries to build the nconf frontend])
+AC_ARG_VAR([qconf_EXTRA_LIBS], [Extra libraries to build the qconf frontend])
+
+#---------------------------------------------------------------------------
+# Now, we know what frontends to enable
+AS_IF([test "$enable_conf" = "auto"], [enable_conf=yes ])
+AS_IF([test "$enable_gconf" = "auto"], [enable_gconf=yes])
+AS_IF([test "$enable_mconf" = "auto"], [enable_mconf=yes])
+AS_IF([test "$enable_nconf" = "auto"], [enable_nconf=yes])
+AS_IF([test "$enable_qconf" = "auto"], [enable_qconf=yes])
+
+#----------------------------------------
+# Check if the lxdialog library should be built
+AS_IF(
+ [test "$enable_mconf" = "yes"],
+ [need_lxdialog=yes],
+ [need_lxdialog=no])
+
+#----------------------------------------
+# Check if the images library should be built
+AS_IF(
+ [test "$enable_gconf" = "yes" -o "$enable_qconf" = "yes"],
+ [need_images=yes],
+ [need_images=no])
+
+#----------------------------------------
+# Setup automake conditional build
+AM_CONDITIONAL(
+ [COND_kconfig],
+ [test "$enable_kconfig" = "yes"])