dnl -*- m4 -*-
dnl Process this file with autoconf to produce a configure script.
dnl
dnl avifile - library for parsing reading playing audio/video files
dnl Copyright (C) 2000-2003 Eugene Kuznetsov,
dnl               2000-     Zdenek Kabelac
dnl
dnl stupid idea - works just with 2.52 AC_INIT([avifileX.Y],[X.Y.Z],[kabi@users.sourceforge.net])

AC_INIT(acinclude.m4)

dnl AC_CONFIG_SRCDIR([acinclude.m4])

dnl info file says that it is a good idea to put AC_REVISION before AC_INIT
dnl unfortunately it triggers a bug in autoconf 2.13 :( Quote:
dnl ***BUG in Autoconf--please report*** AC_DISABLE_FAST_INSTALL
dnl AC_REVISION(disabled - I no longer like the file modification after commit)

configure_options="$@"
echo "avifile configure options: $configure_options"

AC_CONFIG_AUX_DIR(admin)

# libtool versioning
#
# +1 : ? : +1  == new interface that does not break old one
# +1 : ? : 0   == new interface that breaks old one
#  ? : ? : 0   == no new interfaces, but breaks apps
#  ? :+1 : ?   == just some internal changes, nothing breaks but might work
#		  better
# CURRENT: REVISION : AGE
#
# ok theory was nice - but let's just do it more simple :)
AVIFILE_MAJOR_VERSION=0
AVIFILE_MINOR_VERSION=7
AVIFILE_MICRO_VERSION=48
AC_SUBST(AVIFILE_MAJOR_VERSION)
AC_SUBST(AVIFILE_MINOR_VERSION)
AC_SUBST(AVIFILE_MICRO_VERSION)

test -n "$CFLAGS" && have_user_cflags=yes || have_user_cflags=no
test -n "$CXXFLAGS" && have_user_cxxflags=yes || have_user_cxxflags=no

dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

dnl Setup for automake
AM_INIT_AUTOMAKE(avifile-0.7, $AVIFILE_MAJOR_VERSION.$AVIFILE_MINOR_VERSION.$AVIFILE_MICRO_VERSION )

AM_CONFIG_HEADER(include/config.h)
AH_TOP([
#ifndef AVM_CONFIG_H
#define AVM_CONFIG_H
#ifdef HAVE_AV_CONFIG_H
#include <configff.h>  /* ffmpegs' predefined set of supported parts */
#endif])
AH_BOTTOM([#endif /* AVM_CONFIG_H */])

dnl Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AM_PROG_AS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_AWK

AC_CC_VERSION

AC_LANG(C)

aviconfigure=
aviunconfigure=
enable_x86opt=yes
enable_win32=yes

case "$target" in
  i586-*) DEFAULT_FLAGS="i586" ;;
  i686-*) DEFAULT_FLAGS="i686" ;;
  i?86-*) DEFAULT_FLAGS="i386" ;; # Default for all other x86 (i386 and i486)
  amd64*|x86_64*) enable_win32=no ;;
  *)
    DEFAULT_FLAGS=
    enable_x86opt=no
    enable_win32=no
    ;;
esac

case "$target" in
  i?86*)
    if test "$GCC" = yes; then
	case "$GCC_VERSION" in
	    2*) GCCOPT=cpu ;;
            3.0*) GCCOPT=cpu ;;
            3.1*) GCCOPT=cpu ;;
            3.2*) GCCOPT=cpu ;;
            3.3*) GCCOPT=cpu ;;
	    *) GCCOPT=tune ;;
	esac
        DEFAULT_FLAGS="-m$GCCOPT=$DEFAULT_FLAGS -march=$DEFAULT_FLAGS"
    fi
    AC_DEFINE(ARCH_X86_32, 1, [Define if you want to build on x86 architecture.])
    AC_DEFINE(ARCH_X86_64, 0, [Define if you want to build on x86_64 architecture.])
    ;;
  x86_64*|amd64)
    AC_DEFINE(ARCH_X86_64, 1, [Define if you want to build on x86_64 architecture.])
    ;;
  alpha*)
    AC_DEFINE(ARCH_ALPHA, 1, [Define if you want to build on alpha architecture.])
    enable_alphaopt=yes
    ;;
  arm*)
    AC_DEFINE(ARCH_ARM, 1, [Define if you want to build on arm architecture.])
    enable_armopt=yes
    ;;


  sparc*)
    AC_DEFINE(ARCH_SPARC, 1, [Define if you want to build on sparc architecture.])
    ;;
  mips*)
    AC_DEFINE(ARCH_MIPS, 1, [Define if you want to build on mips architecture.])
    enable_mipsopt=yes
    ;;
  ppc*|powerpc*)
    AC_DEFINE(ARCH_POWERPC, 1, [Define if you want to build on ppc architecture.])
    enable_ppcopt=yes
    ;;
  s390*)
    AC_DEFINE(ARCH_S390, 1, [Define if you want to build on s390 architecture.])
    enable_s390opt=yes
    ;;
esac

case "$target" in
  i?86*|amd64*|x86_64*)
  AC_DEFINE(ARCH_X86, 1, [Define if you want to build on x86 architecture.])
  AC_DEFINE(HAVE_MMX, 1, [Define if you want to build with mmx code.])
  AC_DEFINE(HAVE_MMX2, 1, [Define if you want to build with mmx code.])
  AC_DEFINE(HAVE_3DNOW, 1, [Define if you want to build with mmx code.])
  DEFAULT_FLAGS="$DEFAULT_FLAGS -ffast-math -fomit-frame-pointer"
esac


AC_CHECK_GNU_EXTENSIONS(AC_DEFINE(_GNU_SOURCE, 1, [Define if compiling with large file support on Linux to get the correct prototypes for pread and pwrite.]), [])

test "$have_user_cflags" = no && CFLAGS="$CFLAGS $DEFAULT_FLAGS"
test "$have_user_cxxflags" = no && CXXFLAGS="$CXXFLAGS $DEFAULT_FLAGS"

dnl Check if compiler supports -finline-limit
CINLINEFLAGS="-finline-limit-200"
AC_TRY_CFLAGS([ $CINLINEFLAGS ], [], CINLINEFLAGS="")
AC_SUBST(CINLINEFLAGS)

dnl Check if compiler supports -fomit-frame-pointer
OMITFRAMEPOINTERFLAG="-fomit-frame-pointer"
AC_TRY_CFLAGS([ $OMITFRAMEPOINTERFLAG ], [], OMITFRAMEPOINTERFLAG="")
AC_SUBST(OMITFRAMEPOINTERFLAG)

dnl Check if compiler supports -fvisibility
VISIBILITYFLAG="-fvisibility=hidden"
AC_TRY_CFLAGS([ $VISIBILITYFLAG ], [visattr="__attribute__((visibility(\"default\")))"], VISIBILITYFLAG="")
AC_SUBST(VISIBILITYFLAG)
AC_DEFINE_UNQUOTED(AVMEXPORT, $visattr, [Compilers that support -fvisible flag])

dnl Check if compiler supports -fno-exceptions -fno-rtti
AC_ARG_ENABLE(rtti, AC_HELP_STRING(--enable-rtti, [build plugins with rtti and exceptions. [[disabled]]]),
              [], enable_rtti=no)
AC_IF_YES(enable_rtti,
    [CXXRTTIEXCEPT="-fno-exceptions -fno-rtti"
     AC_TRY_CXXFLAGS([ $CXXRTTIEXCEPT ], [], CXXRTTIEXCEPT="")],
    [CXXRTTIEXCEPT=""])
AC_SUBST(CXXRTTIEXCEPT)
dnl Use -Wall if we have gcc.
changequote(,)dnl

if test "$GCC" = yes; then
    CFLAGS="$CFLAGS -pipe"
    CXXFLAGS="$CXXFLAGS -pipe"
    packedattr="__attribute__((packed))"
    case "$CPPFLAGS" in
    *[\ \	]\-Wall[\ \	]*) ;;
    *) CPPFLAGS="$CPPFLAGS -Wall -Wno-unused" ;;
    esac
else
    packedattr=""
fi

dnl for testing change optimalization to -O0
COPTFLAGS=$CFLAGS
CXXOPTFLAGS=$CXXFLAGS
CFLAGS=`echo $CFLAGS | sed s/\-O[1-9]/\-O0/`
CXXFLAGS=`echo $CXXFLAGS | sed s/\-O[1-9]/\-O0/`
changequote([,])dnl

AC_DEFINE_UNQUOTED(AVMPACKED, [ $packedattr ], [Keep structure packed])

dnl
dnl Libtool
dnl
dnl AC_LIBTOOL_DLOPEN
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
dnl automatic updating of libtool configuration files
dnl not needed with automake AC_SUBST(LIBTOOL_DEPS)
dnl using rather hack for .lo creation AM_PROG_AS

dnl
dnl Endianess - use standard WORDS_BIGENDIAN (for PowerPC)
dnl
dnl with older autoconf produces warning
AC_C_BIGENDIAN

dnl Checks for libraries.
dnl Replace main with a function in -ldl:
AC_CHECK_FUNCS(dlopen, [], [
    AC_CHECK_LIB(dl, dlopen, DL_LIBS=-ldl, [
        AC_MSG_WARN([could not find dlopen() needed by libaviplay
        your system may not be supported.])
    ])
])

AC_SUBST(DL_LIBS)

AC_CHECK_FUNCS(gethostbyname, [], [
    AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
])

AC_CHECK_FUNCS(nanosleep, [], [
    AC_CHECK_LIB(posix4, nanosleep, EXTRA_LIBS="$EXTRA_LIBS -lposix4")
])

AC_CHECK_FUNCS(socket, [], [
    AC_CHECK_LIB(socket, socket, EXTRA_LIBS="$EXTRA_LIBS -lsocket")
])

AC_CHECK_FUNCS(kstat_open, [], [
    AC_CHECK_LIB(kstat, kstat_open, EXTRA_LIBS="$EXTRA_LIBS -lkstat")
])

AC_SUBST(EXTRA_LIBS)

AC_CHECK_FUNCS(lseek64,[
    AC_DEFINE(_LARGEFILE_SOURCE, 1, [Define if you want to use _LARGEFILE_SOURCE.])
    AC_DEFINE(_FILE_OFFSET_BITS, 64, [Define if you want to use 64bit file support.])
])

AH_VERBATIM([stdmacros],
[/* Define if you want to use INT64_C macros. */
#if defined __cplusplus && ! defined __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif

#if defined __cplusplus && ! defined __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif])

dnl AC_SUBST(LIBSOCKET)
dnl AC_SUBST(LIBNSL)

dnl Replace main with a function in pthread libs:
dnl some defaults
I386_LDADD=
build_avicap=no
build_avirecomp=no
AC_DEFINE(_REENTRANT, 1, [Define if you want to use pthreads.])
PTHREAD_CFLAGS=
PTHREAD_LIBS="-lpthread"

dnl Library linking
case "$target" in
  # untested
  -*-*-solaris*) AVIFILE_RLD_FLAGS="-R\${exec_prefix}/lib" ;;
  # untested
  *openbsd) AVIFILE_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" ;;
  # linux, freebsd, bsdi
  *) AVIFILE_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" ;;
esac
AC_SUBST(AVIFILE_RLD_FLAGS)

case "$target" in
  *-*-freebsd*)
    AC_DEFINE(_THREAD_SAFE, 1, [Define if you want to use pthreads on freebsd.])
    PTHREAD_CFLAGS="-I/usr/local/include $PTHREAD_CFLAGS"
    PTHREAD_LIBS="-pthread"
    ;;
  i?86-*-netbsd*) I386_LDADD=-li386 ;;
  *-*-solaris*) ;;
  *)
    build_avicap=yes
    build_avirecomp=yes
    ;;
esac
AC_SUBST(I386_LDADD)
# LIBS="$pthread_lib $LIBS -Wl,rpath,/usr/X11/lib"
AVILIBDEPLIB="$pthread_lib $LIBS -lm"
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(AVILIBDEPLIB)

AC_CACHE_CHECK([for pthreads], ac_cv_val_pthread,
    AC_LINK_IFELSE(AC_LANG_PROGRAM([ #include <pthread.h> ],
        [pthread_attr_t type; pthread_attr_init(&type)]),
        ac_cv_val_pthread=yes, ac_cv_val_pthread=no)
)

dnl AC_CHECK_FILE

dnl Checks for header files.
AC_HEADER_STDC

case "$target" in
  *-linux*)
    AC_CHECK_HEADER(linux/ioctl.h, , AC_MSG_ERROR([Linux kernel headers are not found! You cannot build this application without them.]))
    ;;
esac

AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h stdint.h assert.h \
    sys/types.h sys/ioctl.h sys/ioccom.h sys/time.h sys/mman.h)

dnl check for valid header sys/sysinfo.h
AC_CACHE_CHECK([for valid sysinfo struct], ac_cv_val_sysinfo_valid,
    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
        [struct sysinfo s_info]),
        ac_cv_val_sysinfo_valid=yes, ac_cv_val_sysinfo_valid=no)
)
AC_IF_YES(ac_cv_val_sysinfo_valid, AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have struct sysinfo in <sys/sysinfo.h> header file.]))

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
dnl AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_PROG_GCC_TRADITIONAL
AC_HEADER_MAJOR
dnl AC_FUNC_MALLOC
AC_FUNC_MEMCMP
dnl AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_FUNC_SETVBUF_REVERSED
AC_TYPE_SIGNAL
dnl AC_FUNC_STAT
dnl AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(ftime gettimeofday strdup strstr setenv unsetenv memalign \
    scandir opendir nanosleep localtime_r asctime_r vsscanf)

AC_CACHE_CHECK([for extra asctime_r argument], ac_cv_val_asctime_t_long,
    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <time.h>],
        [char* c = asctime_r((struct tm*)0, (char*)0, 0)]),
        ac_cv_val_asctime_t_long=yes, ac_cv_val_asctime_t_long=no)
)
AC_IF_YES(ac_cv_val_asctime_t_long, AC_DEFINE(HAVE_ASCTIME_R_LONG, 1, [Define if you have long 3 params asctime_t in <time.h> header file.]))

AC_ARG_WITH(acdir, AC_HELP_STRING(--with-acdir=path, [use path for autogen.sh.]),
	    with_acdir="--acdir $withval", with_acdir="")

dnl =========================
dnl Build with profiling info
dnl =========================
AC_ARG_ENABLE(profiling, AC_HELP_STRING(--enable-profiling, [compile with profiling info for gprof. [[disabled]]]),
	      [], enable_profiling=no)

dnl ===============================
dnl Use some extra warning
dnl - we should slowly fix them all
dnl ===============================
AC_ARG_ENABLE(warnings, AC_HELP_STRING(--enable-warnings, [build with scary gcc warnings. [[disabled]]]),
	      [], enable_warnings=no)

if test "$enable_warnings" = yes -a "$GCC" = yes; then
    CPPFLAGS="$CPPFLAGS\
 -Wwrite-strings\
 -Wcast-qual\
 -Wbad-function-cast\
 -Wpointer-arith\
 -Wstrict-prototypes\
 -Wmissing-prototypes\
 -Wmissing-declarations\
 -Wnested-externs\
 -Wtraditional\
 -Wconversion\
 -Wcomment\
 -Wcast-align\
 -Winline\
 -Wshadow\
 -Wredundant-decls\
 -Wid-clash-31 -pedantic "
fi


dnl =======================
dnl Enable fast compilation
dnl =======================
dnl AC_ARG_ENABLE(fast_build, AC_HELP_STRING(--enable-fast-build, [useful for one-time build DO NOT USE! [[disabled]]]),
dnl	      [], enable_fast_build=no)


dnl ==========================
dnl Check whathever to build
dnl debug or optimized version
dnl ==========================
AC_ARG_ENABLE(release, AC_HELP_STRING(--disable-release, [turn off heavy optimizations. [[enabled]]]),
	      [], enable_release=yes)

if test "$enable_x86opt" = yes; then
    if (echo $GCC_VERSION | grep '2.91' 2>&1 >/dev/null ) ; then
	AC_MSG_WARN([
*** outdated version of GCC compiler is used, compilation may fail
*** - upgrade to 2.95.3 or better is recommended])
	enable_x86opt=no
    fi
fi

dnl ===========================
dnl Check for Freetype2 library
dnl ===========================
AC_ARG_WITH(freetype2, AC_HELP_STRING(--with-freetype2, [build FreeType2 support. [[disabled]]]),
            [], with_freetype2=no)
AC_IF_YES(with_freetype2,
    [AC_CHECK_FT2(2.0, [AC_DEFINE(HAVE_LIBFREETYPE, 1, [Define if you have libfreetype library (-lfreetype)])],
     with_freetype2=no)])

dnl ========================
dnl Check X Window libraries
dnl ========================
AC_PATH_XTRA

if test "$no_x" = yes; then
    with_xft=no
else
    X_MYLIBS="$X_LIBS -lXext -lX11 $X_EXTRA_LIBS"
    save_CPPFLAGS=$CPPFLAGS
    save_LDFLAGS=$LDFLAGS
    save_LIBS=$LIBS
    dnl use -I path for X11 header files
    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
    LDFLAGS="$LDFLAGS $X_LIBS"
    LIBS=""
    AC_CHECK_LIB(Xi, XGetExtensionVersion, [], [], $X_MYLIBS)

    AC_CACHE_CHECK([whether system has DGA fce in X11/extensions/dpms.h],
                   ac_cv_val_dga_uint,
        AC_LANG_PUSH(C++)
        AC_COMPILE_IFELSE(
            AC_LANG_PROGRAM([
            #include <X11/Xlib.h>
            #include <X11/extensions/xf86dga1.h>],
            [XF86DGAGetVideoLL(NULL, 0, (unsigned int*) NULL, NULL, NULL, NULL);]),
            ac_cv_val_dga_uint=unsigned, ac_cv_val_dga_uint="")
        AC_LANG_POP
    )
    AC_DEFINE_UNQUOTED(CAST_DGALL, $ac_cv_val_dga_uint, [Define to type of XF86DGAGetVideoLL from X11/extensions/xf86dga1.h file.])

    AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [], [], $X_MYLIBS)
    AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchMode, [], [], $X_MYLIBS)

dnl =====================
dnl Check for Xft library
dnl =====================
    AC_ARG_WITH(xft, AC_HELP_STRING(--with-xft, [build with Xft. [[autodetected]]]),
		[], with_xft=yes)
    AC_ARG_WITH(xft-config, AC_HELP_STRING(--with-xft-config=PATH, [where xft-config is installed.]),
		XFT_CONFIG="${with_xft_config}/xft-config", [])

    dnl this is another funny modification of the Xft2 installation
    dnl after roughly 3 months they have again changed configuration
    dnl and Debian is properly supporting only pkg-config
    ## Linking against libfontconfig is necessary, but -lfontconfig is
    ## not in xft.pc's Libs, at least on Debian.
    PKG_CHECK_MODULES([XFT], [xft], [XFT_LIBS="$XFT_LIBS -lfontconfig"],
      [AC_MSG_RESULT([reverting to use xft-config])])

    if test -z "$XFT_LIBS"; then
	dnl xft2 is a bit tricky and introduces  xft-config
	if test -z "$XFT_CONFIG" -a -z "$XFT_LIBS"; then
	    AC_CHECK_PROGS(XFT_CONFIG, xft-config, "")
	    if test -n "$XFT_CONFIG"; then
		 XFT_CONFIG=`which $XFT_CONFIG`
		 AC_MSG_RESULT([setting XFT_CONFIG to $XFT_CONFIG])
	    fi
	fi

	if test -n "$XFT_CONFIG"; then
	    XFT_CFLAGS=`$XFT_CONFIG --cflags | sed -e 's!-I/usr/include[[^/]]!!g' -e 's!-I/usr/include$!!g'`
	    XFT_LIBS=`$XFT_CONFIG --libs`
	else
	    XFT_CFLAGS=""
	    XFT_LIBS=""
	fi
    fi

    save_xft_CPPFLAGS=$CPPFLAGS
    CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
    AC_CHECK_HEADER(X11/Xft/Xft.h, [], with_xft=no)
    CPPFLAGS=$save_xft_CPPFLAGS
    if test "$with_xft" = yes; then
	save_xft_LIBS=$LIBS
	LIBS="$LIBS $XFT_LIBS"
	AC_CHECK_LIB(Xft, XftDrawStringUtf8,
		     [ test -z "$XFT_LIBS" && XFT_LIBS="-lXft"
		       AC_DEFINE(HAVE_LIBXFT, 1, [Define if you have libXft.])
		     ], [], $X_MYLIBS)
	LIBS=$save_xft_LIBS
    fi
    AC_SUBST(XFT_CFLAGS)
    AC_SUBST(XFT_LIBS)

dnl ======================
dnl Check for Xv extension
dnl ======================
    AC_ARG_WITH(xv, AC_HELP_STRING(--with-xv, [build with Xv extension. [[autodetected]]]),
		[], with_xv=yes)
    AC_IF_YES(with_xv, [AC_CHECK_HEADER(X11/extensions/Xv.h, [], with_xv=no)])
    AC_IF_YES(with_xv, [AC_CHECK_LIB(Xv, XvCreateImage, [], [], $X_MYLIBS)])

dnl ============================
dnl Check for Xinerama extension
dnl ============================
    AC_ARG_WITH(xinerama, AC_HELP_STRING(--with-xinerama, [build with Xinerama extension. [[autodetected]]]),
	        [], with_xinerama=yes)
    if test "$with_xinerama" = yes; then
	AC_CHECK_HEADER(X11/extensions/Xinerama.h, [], with_xinerama=no,
		        [ #include <X11/Xlib.h> ])
    fi
    if test "$with_xinerama" = yes; then
	AC_CHECK_LIB(Xinerama, XineramaQueryExtension, [], [], $X_MYLIBS)
    fi

dnl ========================
dnl Check for DPMS extension
dnl ========================
    AC_ARG_ENABLE(dpms, AC_HELP_STRING(--enable-dpms, [support DPMS. [[autodetected]]]),
	          [], enable_dpms=yes)
    AC_IF_YES(enable_dpms,
              [AC_CHECK_HEADER(X11/extensions/dpms.h, [], enable_dpms=no,
                              [#include <X11/Xlib.h>])])
    dnl Check for usable DPMS header file
    if test "$enable_dpms" = yes; then
	AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support.])

	AC_CACHE_CHECK([whether system has DPMS fce in X11/extensions/dpms.h],
		       ac_cv_val_ok_dpms_h,
		AC_COMPILE_IFELSE(AC_LANG_PROGRAM([
		  #include <X11/Xlib.h>
		  #include <X11/extensions/dpms.h>],
                  [ void* x = (void*) DPMSQueryExtension; ]),
                  ac_cv_val_ok_dpms_h=yes, ac_cv_val_ok_dpms_h=no)
	)
	if test "$ac_cv_val_ok_dpms_h" = yes; then
	    AC_DEFINE(HAVE_OK_DPMS_H, 1, [Define if you have correct 'X11/extensions/dpms.h' header file.])
	fi
	AC_CHECK_LIB(Xdpms, DPMSQueryExtension, [], [], $X_MYLIBS)
    fi

    X_LIBS="$X_LIBS $LIBS -lXext -lX11 $X_EXTRA_LIBS"
    CPPFLAGS=$save_CPPFLAGS
    LDFLAGS=$save_LDFLAGS
    LIBS=$save_LIBS
fi dnl no_x


dnl ====================
dnl Check for Qt library
dnl ====================
AC_ARG_WITH(qt, AC_HELP_STRING(--with-qt, [build with Qt utils. [[autodetected]]]),
	    [], with_qt=yes)
dnl no X means no Qt
test "$no_x" = yes && with_qt=no

AC_IF_YES(with_qt,
    [AC_PATH_QT(200, test -z "$qt_version" && qt_version=0
	       AC_DEFINE_UNQUOTED(HAVE_LIBQT, $qt_version, [Define if using 'Qt' libraries.]),
	       with_qt=no)],
    [AC_MSG_RESULT([compilation of Qt utils disabled])]
)

AC_IF_YES(with_qt,[
    AC_LANG_PUSH(C++)
    save_CXXFLAGS=$CXXFLAGS
    save_LIBS=$LIBS
    CXXFLAGS="$CXXFLAGS $QT_CFLAGS $X_CFLAGS"
    LIBS="$LIBS $QT_LIBS $X_LIBS $PTHREAD_LIBS"
    AC_CACHE_CHECK([for multithreading support in Qt],
	ac_cv_val_with_qt_multi,
	AC_LINK_IFELSE(AC_LANG_PROGRAM([
            #ifndef QT_THREAD_SUPPORT
	    #define QT_THREAD_SUPPORT
            #endif
	    #include <qapplication.h>], [ qApp->wakeUpGuiThread() ]),
            ac_cv_val_with_qt_multi=yes, ac_cv_val_with_qt_multi=no)
    )
    CXXFLAGS=$save_CXXFLAGS
    LIBS=$save_LIBS

    if test "$ac_cv_val_with_qt_multi" != yes; then
	AC_MSG_WARN([
*** Your Qt installation does not support multi-threading!
*** Avifile will be compiled - however it might crash mysteriously
*** Instalation of threaded Qt library version (qt-mt) is recommended
*** When rebuilding Qt use configure option '-thread'.])
    fi

    AC_MSG_CHECKING(Qt version for Avicap)
    AS_IF([test "$qt_version" -ge 220],
	[AC_MSG_RESULT([yes])],
	[AC_MSG_RESULT([no (needs Qt 2.2.0 or better)])
	build_avicap=no]
    )
    AC_LANG_POP
])


dnl ======================
dnl Check for Jpeg library
dnl ======================
AC_CHECK_HEADER(jpeglib.h,
      AC_CHECK_LIB(jpeg, jpeg_start_compress, [JPEG_LIBS=-ljpeg; have_jpeglib=yes], have_jpeglib="no "),
      have_jpeglib="no ")
AC_SUBST(JPEG_LIBS)
dnl =======================
dnl Check for iconv support
dnl =======================
AC_ICONV([], AC_DEFINE(HAVE_ICONV, 1, [Define if you have 'iconv_open' function.]))


dnl =====================
dnl Check for SDL library
dnl =====================
AC_ARG_WITH(sdl, AC_HELP_STRING(--with-sdl, [build with SDL. [[autodetected]]]),
	    [], with_sdl=yes)

if test "$with_sdl" != yes; then
    with_sdl="no  (video rendering unavailable as requested!)"
    AC_MSG_WARN([
*** there will be NO video rendering without SDL support!])
else
    SDL_MIN_VERSION=1.0.0
    save_CFLAGS=$CFLAGS
    save_CPPFLAGS=$CPPFLAGS
    save_LIBS=$LIBS
    LIBS=
    AM_PATH_SDL($SDL_MIN_VERSION,
		AC_DEFINE(HAVE_LIBSDL, 1, [Define if using 'SDL' library (-lsdl).]),
		with_sdl="no  (*** no SDL => no video rendering! ***)"
		AC_MSG_WARN([Could not find SDL >= $SDL_MIN_VERSION!]) )
    CFLAGS=$save_CFLAGS
    CPPFLAGS=$save_CPPFLAGS
    LIBS=$save_LIBS
fi


dnl =========================
dnl Check v4l video interface
dnl =========================
AC_CHECK_V4L([], build_avicap=no)


dnl =========================
dnl Check OSS audio interface
dnl =========================
AC_CHECK_OSS(AC_DEFINE(HAVE_OSS, 1, [Define if you want to have OSS audio support compiled.]))


dnl =============================
dnl Check for Sun audio interface
dnl =============================
AC_ARG_ENABLE(sunaudio, AC_HELP_STRING(--enable-sunaudio, [support the Sun audio API. [[autodetected]]]),
	      [], enable_sunaudio=yes)
if test "$enable_sunaudio" = yes; then
    AC_CACHE_CHECK([for Sun audio support], ac_cv_val_have_sun_audio,
	AC_COMPILE_IFELSE(AC_LANG_PROGRAM([
             #include <sys/param.h>
             #include <sys/audioio.h>], [
             audio_info_t audio_info;
             AUDIO_INITINFO(&audio_info);
            ]), ac_cv_val_have_sun_audio=yes, ac_cv_val_have_sun_audio=no)
    )
    enable_sunaudio=$ac_cv_val_have_sun_audio
    AC_IF_YES(enable_sunaudio, AC_DEFINE(HAVE_SUNAUDIO, 1, [Define if you want to have Sun audio support.]))
fi


dnl =====================
dnl Check for A52 support
dnl =====================
A52_CFLAGS=""
A52_LIBS=""
AC_ARG_WITH(a52, AC_HELP_STRING(--with-a52, [build a52 AC3 support. [[autodetected]]]),
	    [], with_a52=yes)
AC_IF_YES(with_a52,
	[AM_PATH_A52([AC_DEFINE(HAVE_LIBA52, 1, [Define if you have 'liba52' library (-l52).])], with_a52="no ")])
AC_ARG_ENABLE(a52bin, AC_HELP_STRING(--enable-a52bin, [dlopen liba52 at runtime. [[enabled]]]),
	      [], enable_a52bin=yes)
AC_SUBST(A52_LIBS)

dnl ================================
dnl Check for Ac3 passthrough plugin
dnl ================================
dnl tested and works only with SBLive
AC_ARG_WITH(ac3passthrough, AC_HELP_STRING(--without-ac3passthrough, [AC3 passthrough plugin (OSS & SBlive!). [[autodetect]]]),
	    [], with_ac3passthrough=yes)
test "$enable_oss" != yes && with_ac3passthrough=no


dnl ==============================
dnl Check if build Lame bin plugin
dnl ==============================
dnl NOTE:
dnl this kind of construction is necesary if we want to prevent
dnl automatic library inclusion by AUTOMAKE
AC_ARG_WITH(lame, AC_HELP_STRING(--without-lame, [do not build included old lame3.70 plugin. [[enabled]]]),
	    [], with_lame=yes)
AC_ARG_ENABLE(lamebin, AC_HELP_STRING(--enable-lamebin, [dlopen libmp3lame at runtime. [[disabled]]]),
	      [], enable_lamebin=no)
AC_CHECK_LIB(mp3lame, lame_decode_init,
	     [ enable_lamebin=yes
	       AC_DEFINE(HAVE_LIBMP3LAME, 1, [Define if you have 'mp3lame' library (-lmp3lame).]) ],
	     [], [ -lm ])


dnl ======================================
dnl Check for Win32 dll libraries & plugin
dnl ======================================
AC_ARG_ENABLE([win32], [AS_HELP_STRING([--enable-win32],
		       [build Win DLLs plugin. @<:@arch specific@:>@])])
AC_ARG_WITH(win32_path, AC_HELP_STRING(--with-win32-path=PATH, [where Windows DLL files are located. [[=/usr/lib/win32]]]),
	    WIN32_PATH=$withval, WIN32_PATH="/usr/lib/win32")
AC_SUBST(WIN32_PATH)
test ! -d $WIN32_PATH && AC_MSG_WARN([Directory: $WIN32_PATH does not exist - install binaries!])

AC_ARG_ENABLE(loader-out, AC_HELP_STRING(--enable-loader-out, [enable verbose Win32 loader output. [[disabled]]]),
    AC_IF_YES(enableval, AC_DEFINE(DETAILED_OUT, 1, [Define if you want to see detailed out of Win32 loader.]))
)

AC_ARG_ENABLE(timing, AC_HELP_STRING(--enable-timing, [show ALL process timings in library. [[disabled]]]),
    AC_IF_YES(enableval, AC_DEFINE(TIMING, 1, [Define if you want to have timing code in library.]))
)

AC_ARG_ENABLE(quiet, AC_HELP_STRING(--enable-quiet, [quiet library. [[disabled]]]),
    AC_IF_YES(enableval, AC_DEFINE(QUIET, 1, [Define if you want to have quiet library.]))
)

AC_ARG_ENABLE([x86opt], [AS_HELP_STRING([--disable-x86opt],
			[x86 optimizations MMX,MMX2,SSE... @<:@arch specific@:>@])],
	      [], [enable_x86opt=yes])


dnl ======================
dnl Check for zlib library
dnl ======================
AC_ARG_WITH(zlib, AC_HELP_STRING(--with-zlib, [build with z library. [[autodetected]]]),
	    [], with_zlib=yes)
AC_IF_YES(with_zlib, [AC_FIND_ZLIB([AC_DEFINE(HAVE_LIBZ, 1, [Define if you have z library (-lz)])], [])])


dnl ==============================
dnl Check for Ogg/Vorbis libraries
dnl ==============================
AC_ARG_WITH(vorbis, AC_HELP_STRING(--with-vorbis, [build vorbis plugin. [[autodetected]]]),
	    [], with_vorbis=yes)
AC_IF_YES(with_vorbis, [AM_PATH_OGG([], with_vorbis="no ")])
AC_IF_YES(with_vorbis, [AM_PATH_VORBIS([], with_vorbis="no ")])


dnl ==============================
dnl Check for MAD library
dnl ==============================
AC_ARG_WITH(mad, AC_HELP_STRING(--without-mad, [do not build MAD MPEG3 audio decoder plugin. [[enabled]]]),
      	    [], with_mad=yes)
AC_IF_YES(with_mad, [AM_PATH_MAD([], with_mad="no ")])


dnl =========================
dnl Check for DivX4 libraries
dnl =========================
AC_ARG_WITH(divx4, AC_HELP_STRING(--with-divx4, [build DivX4 plugin http://avifile.sf.net. [[autodetect]]]),
            [], with_divx4=yes)
AC_ARG_ENABLE(divxbin, AC_HELP_STRING(--enable-divxbin, [open DivX libs runtime. [[disabled]]]),
	      [], enable_divxbin=no)
AC_IF_YES(with_divx4,
    [AM_PATH_DIVX(AC_DEFINE(HAVE_LIBDIVXDECORE, 1, [Define if you have 'divxdecore' library (-ldivxdecore).]), [],
    		 AC_DEFINE(HAVE_LIBDIVXENCORE, 1, [Define if you have 'divxencore' library (-ldivxencore).]), [])])

dnl ======================
dnl Check for XviD library
dnl ======================
AC_ARG_WITH(xvid, AC_HELP_STRING(--with-xvid, [build old XviD plugin. [[disabled]]]),
	    [], with_xvid="no ")
if test "$with_xvid" = yes; then
    AM_PATH_XVID(AC_DEFINE(HAVE_LIBXVIDCORE, 1, [Define if you have old 'xvidcore' library (-lxvidcore).]),
		 with_xvid="no "; AC_MSG_RESULT(
[--- Sources to build XviD xvidcore library can be found at http://www.xvid.org])
    )
fi


dnl ======================
dnl Check for XviD4 library
dnl ======================
AC_ARG_WITH(xvid4, AC_HELP_STRING(--with-xvid4, [build XviD4 plugin http://www.xvid.org. [[autodetected]]]),
	    [], with_xvid4=yes)
if test "$with_xvid4" = yes; then
    AM_PATH_XVID4(AC_DEFINE(HAVE_LIBXVIDCORE4, 1, [Define if you have 'xvidcore' ver 1.0 library (-lxvidcore).]),
		  with_xvid4="no "; AC_MSG_RESULT(
[--- Sources to build XviD xvidcore library can be found at http://www.xvid.org])
    )
fi


dnl =======================
dnl Configure ffmpeg plugin
dnl =======================
AM_PATH_FFMPEG

tmp_LIBS="$LIBS"
AC_CHECK_LIB([avcodec], [avcodec_register_all], [],
  [AC_MSG_ERROR([libavcodec is required to build this package.])])
AC_CHECK_FUNCS([avcodec_decode_audio3 avcodec_decode_video2])
LIBS="$tmp_LIBS"

dnl =================================
dnl Configure external ffmpeg library
dnl =================================
dnl AM_PATH_FFMPEGLIB


dnl HAVE_GL=1
dnl AC_CHECK_HEADER(GL/gl.h,, HAVE_GL=)
dnl if test "HAVE_GL"; then
dnl AC_CHECK_LIB(GL, glClear, , HAVE_GL=, $X_LDFLAGS -lX11 -lXext $X_EXTRA_LIBS -lm)
dnl fi;
dnl if test "HAVE_GL"; then
dnl GL_LDFLAGS="-lGL -lGLU"
dnl AC_SUBST(GL_LDFLAGS)
dnl AC_DEFINE(HAVE_OPENGL, 1, [Define if you have 'GL' & 'GLU' libraries (-lGL -lGLU).])
dnl fi;

dnl ===================
dnl Configure libmmxnow
dnl ===================
dnl Note: this library is curently unused
dnl AC_CONFIG_SUBDIRS(libmmxnow)
dnl AC_MSG_CHECKING([configure in libmmxnow])
dnl ( cd $srcdir/libmmxnow/
dnl   test -f configure || ../autogen.sh $with_acdir )
dnl AC_MSG_RESULT([done])

AC_ARG_ENABLE(samples, AC_HELP_STRING(--disable-samples, [do not build samples (avicap, ...). [[enabled]]]),
	      [], enable_samples=yes)

dnl kde is currently unsupported
dnl AC_ARG_ENABLE(kde, [  --disable-kde           do not build kde sample programs. [[enabled]]],
dnl	      [], enable_kde=yes)


dnl =============================
dnl Check if linux kernel devices
dnl should be build
dnl =============================

dnl this require usable kernel headers
AM_PATH_LINUX(/usr/src/linux, enable_linux=yes, enable_linux=no)

AC_ARG_ENABLE(mga_vid, AC_HELP_STRING(--enable-mga, [build mga_vid driver. [[autodetected]]]),
	      [], enable_mga_vid=yes)
if test "$enable_mga_vid" = yes; then
    if test -c /dev/mga_vid -o -c /dev/misc/mga_vid; then
	if test ! -f /usr/src/linux/include/linux/modversions.h; then
	    enable_mga_vid=no
	    AC_MSG_RESULT([mga_vid can not find modversion.h])
	else
	    AC_MSG_RESULT([building mga_vid device])
	fi
    else
	enable_mga_vid=no
    fi
fi


dnl ===============
dnl Configure vidix
dnl ===============
AM_PATH_VIDIX

dnl we do not need this code now - FFMPEG no longer uses nasm
dnl but I am leaving it here just for the case we would need it
dnl in the future
dnl AC_MSG_CHECKING(whether to use --tag=CXX with libtool)
dnl  TAGCXX="--tag=CXX"
dnl  ${srcdir}/libtool "$TAGCXX" -n --mode=compile gcc test.c > /dev/null 2>&1 || TAGCXX=
dnl  if test -z "$TAGCXX"; then
dnl    AC_MSG_RESULT([no])
dnl  else
dnl    AC_MSG_RESULT([yes])
dnl  fi
dnl AC_SUBST(TAGCXX)

dnl Some platforms needs this to build some necessary parts of code
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include"

AC_ARG_ENABLE(fpic, AC_HELP_STRING(--disable-fpic, [no -fPIC for shlibs. (use --without-pic where available)]),
	      [], enable_fpic=yes)
LTNOPIC=""
if test "$enable_fpic" = no; then
    grep "prefer-non-pic" libtool && LTNOPIC="-prefer-non-pic"
fi
AC_SUBST(LTNOPIC)

CFLAGS=$COPTFLAGS
CXXFLAGS=$CXXOPTFLAGS

if test "$enable_release" != yes -o x$enable_profiling = xyes; then
    CFLAGS=`echo $CFLAGS | sed -e s/-O[[0-9]]//g -e s/-fomit-frame-pointer//g`
    CXXFLAGS=`echo $CXXFLAGS | sed -e s/-O[[0-9]]//g -e s/-fomit-frame-pointer//g`
    FFMPEG_CFLAGS=`echo $FFMPEG_CFLAGS | sed -e s/-O[[0-9]]//g -e s/-fomit-frame-pointer//g`
    if test "$enable_profiling" = yes; then
	AC_MSG_RESULT([profiling enabled - DO NOT USE FOR NORMAL OPERATIONS])
    dnl GCov does not like our C++ - figure out why
    dnl PROFFLAG="-fprofile-arcs -ftest-coverage"
    dnl this is for my yet released kprof profiler
	PROFFLAG="-finstrument-functions "
    fi
fi

WIN32_CFLAGS=`echo $CFLAGS | sed s/-fomit-frame-pointer//g`
AC_SUBST(WIN32_CFLAGS)

lt_major_version=`libtool --version 2>&1 | head -1 | sed 's/\(.*\ \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\(.*\)/\2/'`
lt_minor_version=`echo $lt_major_version | cut -d . -f 2`
lt_micro_version=`echo $lt_major_version | cut -d . -f 3`
lt_major_version=`echo $lt_major_version | cut -d . -f 1`
dnl echo LT  $lt_major_version $lt_minor_version $lt_micro_version

AM_CONDITIONAL(AMM_USE_QT, test "$with_qt" = yes )
AM_CONDITIONAL(AMM_USE_SDL, test "$with_sdl" = yes)
AM_CONDITIONAL(AMM_USE_SUN, test "$enable_sunaudio" = yes )
AM_CONDITIONAL(AMM_USE_OSS, test "$enable_oss" = yes)
AM_CONDITIONAL(AMM_USE_A52, test "$with_a52" = yes)
AM_CONDITIONAL(AMM_USE_A52BIN, test "$enable_a52bin" = yes)
AM_CONDITIONAL(AMM_USE_AC3PASS, test "$with_ac3passthrough" = yes)
AM_CONDITIONAL(AMM_USE_DIVX, test "$have_divx_decore" = yes -o "$have_divx_encore" = yes )
AM_CONDITIONAL(AMM_USE_DIVXBIN, test "$enable_divxbin" = yes)
AM_CONDITIONAL(AMM_USE_LIBMAD, test "$with_mad_prefix" != "internal" )
AM_CONDITIONAL(AMM_USE_MAD, test "$with_mad" = yes )
AM_CONDITIONAL(AMM_USE_MP3LAMEBIN, test "$enable_lamebin" = yes)
AM_CONDITIONAL(AMM_USE_MP3LAME, test "$with_lame" = yes)
AM_CONDITIONAL(AMM_USE_VORBIS, test "$with_vorbis" = yes )
AM_CONDITIONAL(AMM_USE_WIN32, test "$enable_win32" = yes)
AM_CONDITIONAL(AMM_USE_XVID, test "$enable_xvid" = yes)
AM_CONDITIONAL(AMM_USE_XVID4, test "$enable_xvid4" = yes)
AM_CONDITIONAL(AMM_USE_JPEGLIB, test "$have_jpeglib" = yes )
AM_CONDITIONAL(AMM_USE_AVICAP, test "$build_avicap" = yes )
AM_CONDITIONAL(AMM_USE_V4L, test "$enable_v4l" = yes )
AM_CONDITIONAL(AMM_USE_AVIRECOMP, test "$build_avirecomp" = yes )
AM_CONDITIONAL(AMM_USE_SAMPLES, test "$enable_samples" = yes )
AM_CONDITIONAL(AMM_USE_FT2, test "$with_freetype2" = yes )
AM_CONDITIONAL(AMM_USE_MGA_VID, test "$have_mga_vid" = yes )
AM_CONDITIONAL(AMM_USE_VIDIX, test "$enable_vidix" = yes )
AM_CONDITIONAL(AMM_USE_LINUX, test "$enable_linux" = yes )
AM_CONDITIONAL(AMM_USE_FAST_BUILD, test "$enable_fast_build" = yes )
AM_CONDITIONAL(AMM_LINK_SHARED, test $lt_major_version -ge 1 -a $lt_minor_version -ge 4 -a $lt_micro_version -ge 3 )

AM_CONDITIONAL(AMM_FF_FAAD, test "$have_faad" = yes )
AM_CONDITIONAL(AMM_FF_OPENJPEG, test "$have_openjpeg" = yes )
AM_CONDITIONAL(AMM_FF_FAADBIN, test "$enable_ffmpeg_faadbin" = yes)
AM_CONDITIONAL(AMM_FF_DC1394, test "$have_dc1394" = yes )
AM_CONDITIONAL(AMM_FF_ZLIB, test "$have_zlib" = yes )

AM_CONDITIONAL(AMM_FF_ALPHAOPT, test "$enable_alphaopt" = yes)
AM_CONDITIONAL(AMM_FF_ARMOPT, test "$enable_armopt" = yes)
AM_CONDITIONAL(AMM_FF_MIPSOPT, test "$enable_mipsopt" = yes)
AM_CONDITIONAL(AMM_FF_MLIBOPT, test "$enable_mlibopt" = yes)
AM_CONDITIONAL(AMM_FF_PPCOPT, test "$enable_ppcopt" = yes)
AM_CONDITIONAL(AMM_FF_PS2OPT, test "$enable_ps2opt" = yes)
AM_CONDITIONAL(AMM_FF_SH4OPT, test "$enable_sh4opt" = yes)
AM_CONDITIONAL(AMM_FF_SPARCOPT, test "$enable_sparcopt" = yes)
AM_CONDITIONAL(AMM_FF_X86OPT, test "$enable_x86opt" = yes -a 0 -eq 0)

last_cvs_update=`find . -name Entries -printf '%Ty%Tm%Td-%TH:%TM\n' | sort | tail -1`
if test $? -ne 0 -o -z "$last_cvs_update"; then
    # probably no gnu date installed(?), use current date
    # or this is release
    last_cvs_update=`date +%y%m%d-%H:%M`
    AVIFILE_BUILD="RELEASE"
else
    AVIFILE_BUILD="CVS"
fi
if test -n "$SOURCE_DATE_EPOCH"; then
    last_cvs_update=`date --utc --date="@$SOURCE_DATE_EPOCH" +%y%m%d-%H:%M`
fi
AVIFILE_BUILD="$AVIFILE_BUILD-$AVIFILE_MAJOR_VERSION.$AVIFILE_MINOR_VERSION.$AVIFILE_MICRO_VERSION-${last_cvs_update}-$GCC_VERSION"
AC_SUBST(AVIFILE_BUILD)

AC_SUBST(DIVX_LIBS)
AC_SUBST(DTS_LIBS)
AC_SUBST(MAD_LIBS)
AC_SUBST(QT_LIBS)
AC_SUBST(SDL_LIBS)
AC_SUBST(XVID4_LIBS)
AC_SUBST(XVID_LIBS)
AC_SUBST(Z_LIBS)

AC_OUTPUT([
 Makefile
 drivers/Makefile
 drivers/libdha/Makefile
 drivers/libdha/kernelhelper/Makefile
 drivers/vidix/Makefile
 lib/Makefile
 plugins/Makefile
 plugins/libac3pass/Makefile
 plugins/libaudiodec/Makefile
 plugins/libdivx4/Makefile
 plugins/libffmpeg/Makefile
 plugins/libmad/Makefile
 plugins/libmad/libmad/Makefile
 plugins/libmp3lamebin_audioenc/Makefile
 plugins/libmp3lame_audioenc/Makefile
 plugins/libmpeg_audiodec/Makefile
 plugins/libvorbis/Makefile
 plugins/libwin32/Makefile
 plugins/libwin32/audiodec/Makefile
 plugins/libwin32/loader/Makefile
 plugins/libwin32/loader/dmo/Makefile
 plugins/libwin32/loader/dshow/Makefile
 plugins/libwin32/loader/wine/Makefile
 plugins/libwin32/videocodec/Makefile
 plugins/libxvid/Makefile
 plugins/libxvid4/Makefile
 player/Makefile
 include/version.h
 libavqt/Makefile
 samples/Makefile
 samples/misc/Makefile
 samples/mjpeg_plugin/Makefile
 samples/qtrecompress/Makefile
 samples/qtvidcap/Makefile
 avifile-config
 avifile.spec
 avifile.pc
])

USED=""

dnl brutal hack for an old libtool which does not support -prefer-non-pic
dnl might fail on some systems which really needs -fPIC code
if test "$enable_fpic" = "no" -a -z "$LTNOPIC"; then
    for i in `find . -name libtool`
    do
	sed -e 's/^pic_flag=/#pic_flag=/g' $i >$i.tmp
	mv ${i}.tmp $i
    done
fi

touch admin/depcomp >/dev/null 2>&1
dnl touch libmmxnow/depcomp >/dev/null 2>&1

AC_MSG_RESULT([
Note: If you have installed/removed some package in your system
      do NOT forget to remove config.cache file before using configure!
Configuration for avifile ${AVIFILE_BUILD}
Compiler C:	  ${CC} ${CFLAGS}
Compiler C++:	  ${CXX} ${CXXFLAGS}
Install path:	  ${prefix}
Qt=$with_qt, Sdl=$with_sdl, Xft=$with_xft,
Oss audio=$enable_oss, Sun audio=$enable_sunaudio, Mga_vid=$enable_mga_vid
Plugins:
  ac3passthrough  $with_ac3passthrough  (with OSS/SBLive only)
  divx (dec/enc)  ${have_divx_decore}/${have_divx_encore} (DivxNetworks divx4linux)
  old xvid     	  $with_xvid  (DivX4, XviD)
  xvid4		  $with_xvid4  (DivX4, XviD)
  ffmpeg	  yes  (DivX ;-), OpenDivX, MJPEG,...)
  ffmpeg faad     $have_faad  (AAC) (runtime $enable_ffmpeg_faadbin)
  ffmpeg a52      $have_a52  (AC3) (runtime $enable_ffmpeg_a52bin)
  os motion jpeg  $have_jpeglib  (MJPEG)
  win32 	  $enable_win32  (DivX, WM7/8/9, DV, MJPEG, Ati, Asus,...)
  mad		  $with_mad  (MPEG Layer I/II/III) ($with_mad_prefix)
  vorbis	  $with_vorbis
  lame runtime	  $enable_lamebin
  lame internal	  $with_lame
])
