dnl AB: checking for a system-wide highscore file. If "no" then the default
dnl (just kapp->config()) is used. See KHighscore for details.

AC_MSG_CHECKING(whether to use system-wide highscores)
AC_ARG_ENABLE(highscore-dir,
AC_HELP_STRING([--enable-highscore-dir=DIR], [system-wide highscore table @<:@default=no@:>@]), [use_highscore_dir=yes], [use_highscore_dir=no])

if test "$use_highscore_dir" = "no"; then
  AC_MSG_RESULT(no)
  AC_SUBST(HIGHSCORE_DIRECTORY, "")
else
  case "${enableval}" in
    yes) highscore_dir='${localstatedir}/games' ;;
    no) ;;
    *) highscore_dir=${enableval} ;;
  esac
  AC_DEFINE_UNQUOTED(HIGHSCORE_DIRECTORY, "$highscore_dir", [The system-wide highscore directory])
  AC_SUBST(HIGHSCORE_DIRECTORY, $highscore_dir)
  AC_MSG_RESULT($use_highscore_dir)
fi

AC_MSG_CHECKING(whether to setgid binaries)
AC_ARG_ENABLE(setgid,
  [  --enable-setgid           Enable the use of setgid binaries],
  [case "${enableval}" in
    yes) 
        case "$use_highscore_dir" in 
           yes) setgid=true;; 
           no) setgid=false;; 
        esac ;;
    no)  setgid=false ;;
    *) AC_MSG_ERROR(bad value ${enableval} for --disable-setgid) ;;
   esac],[setgid=false])
AC_SUBST(setgid)
AC_MSG_RESULT($setgid)

AC_MSG_CHECKING(what group to use for the highscore tables and binaries)
AC_ARG_WITH(highscore-group,
[  --with-highscore-group=group    Group for the highscore tables and binaries],
highscore_group="$withval",highscore_group="games")
AC_SUBST(highscore_group)
AC_MSG_RESULT($highscore_group)

AC_MSG_CHECKING(what user to use for the highscore tables and binaries)
AC_ARG_WITH(highscore-user,
[  --with-highscore-user=user    User for the highscore tables],
highscore_user="$withval",highscore_user="games")
AC_SUBST(highscore_user)
AC_MSG_RESULT($highscore_user)
