#MIN_CONFIG(3)

AM_INIT_AUTOMAKE(kgamma,1.0.2)

dnl CXXFLAGS="$NOOPT_CXXFLAGS" dnl __tdevelop[noopt]__
dnl CFLAGS="$NOOPT_CFLAGS" dnl __tdevelop[noopt]__
dnl CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS" dnl __tdevelop[exc]__

dnl KDE_NEED_FLEX dnl __tdevelop__
dnl AC_PROG_YACC dnl __tdevelop__

dnl This test is taken from the aktion configure.in.in
dnl Modified by Michael v.Ostheim
dnl Checking for XFree86 VidMode Extensions
AC_MSG_CHECKING([for XFree86-VidModeExtension])

AC_CACHE_VAL(ac_cv_lib_vm,
 [ac_save_LIBS="$LIBS"
  kgamma_save_CFLAGS=$CFLAGS
 CFLAGS="$CFLAGS $all_includes"
 LIBS="-L$x_libraries -lXxf86vm -lXext -lX11"
 AC_TRY_LINK( [
              #include <X11/Xlib.h>
              #include <X11/Xatom.h>
              #include <X11/extensions/xf86vmode.h>
              ],
              [],
              eval "ac_cv_lib_vm='-lXxf86vm'",
              [AC_MSG_RESULT(no)
              eval "ac_cv_lib_vm=no"])
 LIBS="$ac_save_LIBS"
 CFLAGS=$kgamma_save_CFLAGS
])

if eval "test ! \"`echo $ac_cv_lib_vm`\" = no"; then
  LIBVM="$ac_cv_lib_vm"
  AC_SUBST(LIBVM)
  AC_MSG_RESULT($ac_cv_lib_vm)

    AC_MSG_CHECKING([for gamma functions in XFree86-VidModeExtension])

    AC_CACHE_VAL(ac_cv_lib_vmgamma,
    [ac_save_LIBS="$LIBS"
    kgamma_save_CFLAGS=$CFLAGS
    CFLAGS="$CFLAGS $all_includes"
    LIBS="-L$x_libraries -lXxf86vm -lXext -lX11"
    AC_TRY_LINK( [],
                [XF86VidModeGetGamma();],
                 [AC_MSG_RESULT(yes)
                 eval "ac_cv_lib_vm='-lXxf86vm'"],
                 [AC_MSG_RESULT(no)
                 eval "ac_cv_lib_vm=no"])
    LIBS="$ac_save_LIBS"
    CFLAGS=$kgamma_save_CFLAGS
    ])
fi

if eval "test \"`echo $ac_cv_lib_vm`\" = no"; then
    DO_NOT_COMPILE="$DO_NOT_COMPILE kgamma"
fi

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
KDE_CHECK_HEADERS(sstream)
AC_LANG_RESTORE