PKG_CHECK_MODULES(HTML_PREVIEW,
                  [webkit2gtk-4.0 >= 2.8.4],
                  [have_html_preview_deps=yes],
                  [have_html_preview_deps=no])

AC_ARG_ENABLE([html-preview-plugin],
              [AS_HELP_STRING([--enable-html-preview-plugin=@<:@auto/yes/no@:>@],
                              [Build with support for HTML and Markdown live preview.])],
              [enable_html_preview_plugin=$enableval],
              [enable_html_preview_plugin=$have_html_preview_deps])

AS_IF([test "$enable_html_preview_plugin" = "yes" && test "$have_html_preview_deps" = "no"],[
	AC_MSG_ERROR([Failed to locate webkit2gtk-4.0. Try installing webkitgtk4-devel.])
])

# for if ENABLE_CLANG_PLUGIN in Makefile.am
AM_CONDITIONAL(ENABLE_HTML_PREVIEW_PLUGIN, test x$enable_html_preview_plugin = xyes)

# Ensure our makefile is generated by autoconf
AC_CONFIG_FILES([plugins/html-preview/Makefile])
