m4_define(sysprof_required_version, [3.23.91])

PKG_CHECK_MODULES(SYSPROF,
                  [sysprof-ui-2 >= sysprof_required_version],
                  [have_sysprof_ui=yes],
                  [have_sysprof_ui=no])

# --enable-sysprof-plugin=yes/no
AC_ARG_ENABLE([sysprof-plugin],
              [AS_HELP_STRING([--enable-sysprof-plugin=@<:@yes/no/auto@:>@],
                              [Build with support for the Sysprof system profiler.])],
              [enable_sysprof_plugin=$enableval],
              [enable_sysprof_plugin=auto])

AS_IF([test x$enable_sysprof_plugin = xauto],[
	AS_IF([test x$have_sysprof_ui = xyes],[enable_sysprof_plugin=yes],[enable_sysprof_plugin=no])
])

AS_IF([test x$enable_sysprof_plugin = xyes && test x$have_sysprof_ui = xno],[
       AC_MSG_ERROR([Failed to locate sysprof-ui dependencies. Try installing Sysprof with GTK support.])
])

# for if ENABLE_SYSPROF_PLUGIN in Makefile.am
AM_CONDITIONAL(ENABLE_SYSPROF_PLUGIN, [test x$enable_sysprof_plugin = xyes])

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