
dnl aRts specific configure tests
dnl

dnl
dnl ensure that the user has aRts-1.1.0 or newer installed
dnl

dnl Check for artsc-config
dnl no need to, AC_BASE_PATH_KDE does it for us already (see also
dnl comment below for mcopidl)
dnl AC_PATH_PROG(ARTSCCONFIG, artsc-config, no)

ARTS_WANT_VERSION_MAJOR=1
ARTS_WANT_VERSION_MINOR=1
ARTS_HAVE_VERSION=none
ARTS_HAVE_PREFIX=none

dnl Check for Glib-2.0
AC_MSG_CHECKING(for aRts-$ARTS_WANT_VERSION_MAJOR.$ARTS_WANT_VERSION_MINOR)

ARTS_OK=no

if test "$build_arts" != "yes"; then
  AC_MSG_RESULT(disabled)
else

  if test "x$ARTSCCONFIG" != "xno"; then
  	ARTS_HAVE_VERSION=`$ARTSCCONFIG --arts-version`
  	ARTS_HAVE_PREFIX=`$ARTSCCONFIG --arts-prefix`
  fi

  # And delete superfluous '/' to make compares easier
  ARTS_HAVE_PREFIX=`echo "$ARTS_HAVE_PREFIX" | sed 's,//*,/,g' | sed -e 's,/$,,'`

  ARTS_MAJOR=`echo $ARTS_HAVE_VERSION | sed 's/\.[[0-9]]*\.[[0-9]]*$//'`
  ARTS_MINOR=`echo $ARTS_HAVE_VERSION | sed 's/\.[[0-9]]*$//' | sed 's/^[[0-9]]*\.//'`
  dnl don't look at the micro version
  if test "x$ARTS_MAJOR" != "x" && test "x$ARTS_MINOR" != "x" && test $ARTS_MAJOR -ge $ARTS_WANT_VERSION_MAJOR && test $ARTS_MINOR -ge $ARTS_WANT_VERSION_MINOR; then
          realartsprefix=`(cd $ARTS_HAVE_PREFIX; /bin/pwd)`
          realprefix=`(cd $prefix; /bin/pwd)`
  	if test "x$realartsprefix" = "x$realprefix"; then
  		ARTS_OK=yes
  	else
  AC_MSG_ERROR([aRts $ARTS_WANT_VERSION_MAJOR.$ARTS_WANT_VERSION_MINOR not installed in the same prefix as KDE!
Please reinstall aRts in the same prefix as KDE, different prefixes are not
supported right now.

(kdelibs prefix is $prefix, aRts prefix is $ARTS_HAVE_PREFIX)
  ])
	fi
  fi

  AC_MSG_RESULT($ARTS_OK)

  if test "x$ARTS_OK" = "xno"; then
  AC_MSG_ERROR([aRts $ARTS_WANT_VERSION_MAJOR.$ARTS_WANT_VERSION_MINOR not found.

You'll need to install a suitable version of aRts in the same prefix as KDE
before you build kdelibs.

(found
 * artsc-config: $ARTSCCONFIG
 * kdelibs prefix: $prefix
 * aRts prefix: $ARTS_HAVE_PREFIX
 * aRts version: $ARTS_HAVE_VERSION (required: $ARTS_WANT_VERSION_MAJOR.$ARTS_WANT_VERSION_MINOR)
)
])
  fi
fi

dnl AC_BASE_PATH_KDE already checks for mcopidl, and it does it the
dnl right way using KDE_FIND_PATH
dnl AC_PATH_PROG(MCOPIDL, mcopidl, no)
dnl AC_SUBST(MCOPIDL)
