AM_PATH_GLIB(1.2.0)

dnl check whether we have arts/common.h and arts/artsmidi.h installed
AC_DEFUN(AC_CHECK_ARTS_HEADERS,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_cppflags_safe="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$kde_includes"

AC_CHECK_HEADER(arts/common.h, [], [
AC_MSG_ERROR([
aRts development headers not found (missing include file arts/common.h).

Please ensure that the aRts development headers are installed. If you have
installed aRts as binary package, they are usually found in a development
package, which is called arts-dev, libarts-dev or similar.
])
])

AC_CHECK_HEADER(arts/artsmidi.h, [], [
AC_MSG_ERROR([
aRts extra development headers not found (missing include file arts/artsmidi.h).

Please ensure that the aRts extra development headers are installed. If you
installed kdemultimedia as binary package, they are usually found in a
development package called kdemultimedia-dev or similar.
])
])

CPPFLAGS="$ac_cppflags_safe"
AC_LANG_RESTORE
])

dnl check whether we have aRts environments
AC_DEFUN(AC_CHECK_ARTS_ENVIRONMENT,
[
AC_MSG_CHECKING([for Arts::Environment support in aRts])

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_cxxflags_safe="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -I$kde_includes"

AC_CACHE_VAL(ac_cv_have_arts_environment,
[
AC_TRY_COMPILE([
#include <arts/artsmodules.h>
],
[
Arts::Environment::Container container;
],
ac_cv_have_arts_environment=yes,
ac_cv_have_arts_environment=no)
])

CXXFLAGS="$ac_cxxflags_safe"

AC_MSG_RESULT($ac_cv_have_arts_environment)
if eval "test \"`echo `$ac_cv_have_arts_environment\" = yes"; then
  AC_DEFINE(HAVE_ARTS_ENVIRONMENT,1,
        [Define if your aRts has Arts::Environment support (>= aRts-0.7.0)])
fi
])

AC_CHECK_ARTS_HEADERS
AC_CHECK_ARTS_ENVIRONMENT
