#MIN_CONFIG(3.0.0)
KDE_ENABLE_HIDDEN_VISIBILITY
KDE_INIT_DOXYGEN([KDE Utils API Reference], [Version $VERSION])

AM_INIT_AUTOMAKE(k9copy, 1.2.4)
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN

case "$target" in
    i?86-* | k?-*)
        AC_DEFINE([ARCH_X86],,[x86 architecture])
        AC_DEFINE([ARCH_386],,[386 architecture])
        ARCH_X86=yes
        ARCH_386=yes
        ARCH_X86_64=no
        ;;
    x86_64-*)
        AC_DEFINE([ARCH_X86_64],,[x86_64 architecture])
        ARCH_X86=no
        ARCH_386=no
        ARCH_X86_64=yes
        ;;
    *)
        ARCH_X86=no
        ARCH_386=no
        ARCH_X86_64=no
        ;;
esac

AC_MSG_CHECKING(for X86 architecture)
AC_MSG_RESULT($ARCH_X86)
AM_CONDITIONAL(ARCH_X86, [test "$ARCH_X86" = "yes"])

AC_MSG_CHECKING(for 386 architecture)
AC_MSG_RESULT($ARCH_386)
AM_CONDITIONAL(ARCH_386, [test "$ARCH_386" = "yes"])

AC_MSG_CHECKING(for X86_64 architecture)
AC_MSG_RESULT($ARCH_X86_64)
AM_CONDITIONAL(ARCH_X86_64, [test "$ARCH_X86_64" = "yes"])

have_gl=no
AC_CHECK_HEADER([GL/gl.h], \
[AC_DEFINE(HAVE_OPENGL, 1, [openGL support]) have_gl=yes], \
[AC_DEFINE(NO_OPENGL, 1, [No openGL support])])


AC_LANG_SAVE
AC_LANG_CPLUSPLUS
cxx_flags_safe="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -D__STDC_CONSTANT_MACROS -I$qt_includes"
AC_CHECK_HEADER([ffmpeg/avcodec.h], \
[AC_DEFINE(OLD_FFMPEG,1, [old ffmpeg])], \
  [AC_CHECK_HEADER([libavcodec/avcodec.h], \
   [AC_DEFINE(NEW_FFMPEG,1, [new ffmpeg])], \
   [AC_MSG_ERROR([libavcodec may be missing]) ])])
CXXFLAGS="$cxx_flags_safe"
AC_LANG_RESTORE

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
cxx_flags_safe="$CXXFLAGS"
cflags_safe="$CFLAGS"
CXXFLAGS="$CXXFLAGS -D__STDC_CONSTANT_MACROS -I$qt_includes"
CFLAGS="$CFLAGS -D__STDC_CONSTANT_MACROS"
AC_MSG_CHECKING([if libavformat/avformat.h provides av_free_packet])
AC_TRY_LINK([#include <libavformat/avformat.h>
],[AVPacket *packet; av_free_packet(packet);],
AC_MSG_RESULT(yes),
[AC_MSG_RESULT(no)
AC_DEFINE(NEEDS_AV_FREE_PACKET,1,[no])])
CXXFLAGS="$cxx_flags_safe"
CFLAGS="$cflags_safe"
AC_LANG_RESTORE

have_swscale=no
AC_CHECK_HEADER([libswscale/swscale.h], \
[AC_DEFINE(HAVE_SWSCALE, 1, [swscale support]) have_swscale=yes], \
[AC_DEFINE(NO_SWSCALE, 1, [No swscale support])])

