#MIN_CONFIG(3.0.0)

AM_INIT_AUTOMAKE(%{APPNAMELC}, 0.1)
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN

AC_PROG_MAKE_SET

AC_CHECK_PROG(RUBY, ruby, ruby)

if test -z "$RUBY"; then
  DO_NOT_COMPILE="$DO_NOT_COMPILE qtruby"
else
  AC_MSG_CHECKING(for ruby dirs)
  RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
  RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
  RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`
  RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
  RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
  AC_MSG_RESULT([archdir $RUBY_ARCHDIR, sitearchdir $RUBY_SITEARCHDIR, sitedir $RUBY_SITEDIR, libdir $RUBY_LIBDIR, librubyarg $RUBY_LIBRUBYARG])
  AC_SUBST(RUBY_ARCHDIR)
  AC_SUBST(RUBY_SITEARCHDIR)
  AC_SUBST(RUBY_SITEDIR)
  AC_SUBST(RUBY_LIBDIR)
  AC_SUBST(RUBY_LIBRUBYARG)
fi

# Korundum check
AC_MSG_CHECKING([whether Korundum is installed])
korundum_present=no
cat >korundumtest.rb <<END
require 'Korundum'
END
${RUBY} korundumtest.rb >/dev/null 2>&1 && korundum_present=yes
AC_MSG_RESULT([$korundum_present])

# rbuic check
AC_PATH_PROG([RBUIC],[rbuic])
if test -z "${RBUIC}" ; then
   AC_MSG_ERROR([cannot find rbuic (part of the QtRuby package)])
fi
AC_SUBST([RBUIC])
AC_SUBST([RUBY])


