2.2
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)

ifdef([m4_pattern_allow],
      [m4_pattern_allow([^AC_.*])])

dnl IMPORTANT !! $version must also be set to exactly the same string in smogrify
AC_INIT(LiVES,2.2.5,https://sourceforge.net/p/lives/bugs/)

AC_CANONICAL_HOST
AC_CANONICAL_TARGET


AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2])

AM_MAINTAINER_MODE
AC_PREFIX_DEFAULT(/usr)

AC_GNU_SOURCE
AC_ISC_POSIX
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_CXX

AC_CONFIG_MACRO_DIR([m4])

AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AM_PROG_CC_STDC
AM_PROG_CC_C_O
AC_HEADER_STDC
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_SYS_LARGEFILE

AM_PROG_AS

dnl AC_DEFINE([LiVES_VERSION],[],[Description])
dnl AC_CONFIG_HEADERS(config.h)

ACX_PTHREAD(PTHREAD_OK=true,PTHREAD_OK=false)

IS_DARWIN="false"
IS_IRIX="false"
IS_SOLARIS="false"
IS_LINUX_GNU="false"
IS_MINGW="false"

case "{$target_os}" in
 *darwin*)
   IS_DARWIN="true"
  ;;
 *irix*)
   IS_IRIX="true"
  ;;
 *linux-gnu*)
   IS_LINUX_GNU="true"
  ;;
 *solaris*)
   IS_SOLARIS="true"
  ;;
 *mingw*)
   IS_MINGW="true"
  ;;
 *)
  ;;
esac

AM_CONDITIONAL(IS_DARWIN,$IS_DARWIN)
AM_CONDITIONAL(IS_IRIX,$IS_IRIX)
AM_CONDITIONAL(IS_LINUX_GNU,$IS_LINUX_GNU)
AM_CONDITIONAL(IS_SOLARIS,$IS_SOLARIS)
AM_CONDITIONAL(IS_MINGW,$IS_MINGW)

if test "$IS_MINGW" = "false"; then
AC_CHECK_FILE(lives-plugins/Makefile.am,,[
echo "LiVES plugins were not found. Please make sure you have checked them out."
echo
echo
exit
])
fi


GETTEXT_PACKAGE=lives
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [gtp])

AC_DEFINE_UNQUOTED(LOCALEDIR, "${datadir}/locale", [Name of gettext locale directory])

AC_DEFINE_UNQUOTED(PREFIX, "${prefix}", [prefix])
AC_DEFINE_UNQUOTED(LiVES_VERSION, "${VERSION}", [])

dnl Add the languages which your application supports here.
ALL_LINGUAS="ar fr ca cs da ja nl_NL de_DE pt pt_BR hu es it pl tr ru zh_CN sk he en_GB fi et gl uz te ro uk oc hr ug pms"
AM_GNU_GETTEXT
AM_GNU_GETTEXT_VERSION(0.17)


dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl


dnl Check of -ldl
AC_CHECK_LIB(dl,open)
AM_CONDITIONAL(HAVE_LIBdl,$HAVE_LIBdl)

dnl Check for posix_memalign
AC_CHECK_FUNCS(posix_memalign)


AC_PATH_PROGS(PERL, perl perl5)


dnl check for profiling



AC_ARG_ENABLE( profiling, [  --enable-profiling     Enable profiling with gmon.] , profiling=yes, profiling=no)

AM_CONDITIONAL(ENABLE_PROFILING, test $profiling != no)



dnl Check for pkg-config

if test "$IS_MINGW" = "true"; then
AC_PATH_PROG(PKG_CONFIG, i686-pc-mingw32-pkg-config, no)
else
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi

if test x$PKG_CONFIG = xno; then
   AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
fi

dnl Check for doxygen

AC_ARG_ENABLE( doxygen, [  --disable-doxygen     Disable doxygen documentation.] , disable_doxygen=yes)

if test "x$disable_doxygen" != "xyes" ; then

AC_PATH_PROG(DOXYGEN, doxygen, no)

if test x$DOXYGEN = xno; then
   echo "Cannot find doxygen, will not build sourcecode documentation"
fi

else
   echo "Doxygen documentation disabled, not checking"
   DOXYGEN=no
fi

AM_CONDITIONAL(HAVE_DOXYGEN, test x$DOXYGEN != xno)



dnl OSC
HAVE_OSC=true
AC_ARG_ENABLE(OSC,
[  --disable-OSC            Disable OSC support.],
[
AC_DEFINE_UNQUOTED(DISABLE_OSC,1, [OSC])
HAVE_OSC=false
]
)
AM_CONDITIONAL(ENABLE_OSC,$HAVE_OSC)


dnl js_header
AC_CHECK_HEADERS(linux/joystick.h, HAVE_JS_HEADER=true, HAVE_JS_HEADER=false)


HAVE_JACK=false
HAVE_JACK_TRANSPORT=false

AC_ARG_ENABLE( jack, [  --disable-jack     Disable jack support.] , disable_jack=yes)
AC_ARG_ENABLE( jack-transport, [  --disable-jack-transport     Disable jack transport support.] , disable_jack_transport=yes)

if test "x$disable_jack" != "xyes" ; then

dnl check for jack

dnl PKG_CHECK_MODULES(JACK, [jack >= 0.100.0], HAVE_JACK=true, HAVE_JACK=false)

AC_CHECK_LIB(jack,jack_get_client_name,have_jacklib=true,have_jacklib=false)
if test "$have_jacklib" = "true"; then

AC_CHECK_HEADERS(jack/jack.h, HAVE_JACK=true, HAVE_JACK=false)


if test "$HAVE_JACK" != "false"; then
if test "x$disable_jack_transport" != "xyes" ; then

dnl check for jack-transport
AC_CHECK_HEADERS(jack/transport.h, HAVE_JACK_TRANSPORT=true, HAVE_JACK_TRANSPORT=false)

fi
fi
fi
else
echo not checking for jack
fi

dnl check for jack-video
HAVE_JACK_VIDEO=false
AC_ARG_ENABLE(vjack,
[  --enable-vjack            Enable video jack integration. Experimental. ],
[
AC_DEFINE_UNQUOTED(ENABLE_VJACK,1, [vjack])
HAVE_JACK_VIDEO=true
]
)
AM_CONDITIONAL(ENABLE_JACK,$HAVE_JACK)
AM_CONDITIONAL(ENABLE_JACK_TRANSPORT,$HAVE_JACK_TRANSPORT)
AM_CONDITIONAL(ENABLE_VJACK,$HAVE_JACK_VIDEO)


PKG_CHECK_MODULES(X11,x11,HAVE_X11=true,HAVE_X11=false)
AC_SUBST(X11_CFLAGS)
AC_SUBST(X11_LIBS)

AM_CONDITIONAL(HAVE_X11,$HAVE_X11)

PKG_CHECK_MODULES(XRENDER,xrender,HAVE_XRENDER=true,HAVE_XRENDER=false)
AC_SUBST(XRENDER_CFLAGS)
AC_SUBST(XRENDER_LIBS)

AM_CONDITIONAL(HAVE_XRENDER,$HAVE_XRENDER)

HAVE_GTK_VERSION3=false

AC_ARG_ENABLE( gtk3, [  --disable-gtk3     Disable gtk+ 3.x and compile with gtk+ 2.x] , disable_gtk3=yes)

if test "x$disable_gtk3" != "xyes" ; then

echo -n "checking for GTK+ >= 3.0.0... "

PKG_CHECK_EXISTS([gtk+-3.0 >= 3.0.0],[HAVE_GTK_VERSION3=true],[HAVE_GTK_VERSION3=false])

if test "x$HAVE_GTK_VERSION3" = "xfalse"; then
echo "no"
else
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0.0)
fi

else

echo "Not checking for gtk+ 3.x"

fi

if test "x$HAVE_GTK_VERSION3" = "xfalse"; then

echo -n "checking for GTK+ >= 2.4.0... "

PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0)

PKG_CHECK_EXISTS([gtk+-2.0 >= 2.16.0],[HAVE_GTK_VERSION216=true],[HAVE_GTK_VERSION216=false])

PKG_CHECK_EXISTS([gtk+-2.0 >= 2.6.0],[HAVE_GTK_VERSION206=true],[HAVE_GTK_VERSION206=false])

echo "- Compiling with gtk+ 2.x -"

else

echo "- Compiling with gtk+ 3.x -"

HAVE_GTK_VERSION216=true
HAVE_GTK_VERSION206=true

fi

AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

GTK_LIBS_NODYNAMIC=`echo "$GTK_LIBS" | sed 's/-Wl,--export-dynamic//g'`
AC_SUBST(GTK_LIBS_NODYNAMIC)

PKG_CHECK_EXISTS([glib-2.0 >= 2.14.0],[HAVE_GLIB_VERSION214=true],[HAVE_GLIB_VERSION214=false])
PKG_CHECK_EXISTS([glib-2.0 >= 2.4.0],[HAVE_GLIB_VERSION24=true],[HAVE_GLIB_VERSION24=false])


DISABLE_GLSLICE=true
AC_ARG_ENABLE( glib-slice-allocator, [  --disable-glib-slice-allocator           Disable the glib slice allocator (not recommended).] , disable_glslice=yes)
if test "x$disable_glslice" != "xyes" ; then
DISABLE_GLSLICE=false
if test "x$HAVE_GLIB_VERSION24" = "xfalse"; then
echo "***********************************************"
echo "LiVES requires glib-2.0 version 2.4.0 or higher"
echo "version 2.10.0 or higher is strongly recommended"
echo "***********************************************"
else
if test "x$HAVE_GLIB_VERSION214" = "xfalse"; then
echo "***********************************************"
echo "LiVES runs best with glib-2.0 version 2.14.0 or higher"
echo "however, it can be compiled with the current version of glib-2.0"
echo "for versions < 2.10, use the configure option --disable-glib-slice-allocator"
echo "***********************************************"
fi
fi

if test "x$HAVE_GTK_VERSION216" = "xfalse"; then
echo "***********************************************"
echo "LiVES runs best with gtk+-2.0 version 2.16.0 or higher"
echo "***********************************************"
fi


PKG_CHECK_MODULES(GLIB,glib-2.0 >= 2.14.0)
else
PKG_CHECK_MODULES(GLIB,glib-2.0 >= 2.4.0)
fi

AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

AM_CONDITIONAL(DISABLE_GLSLICE,$DISABLE_GLSLICE)






dnl giw
if test "x$HAVE_GTK_VERSION206" = "xfalse"; then
HAVE_GIW=false
else
HAVE_GIW=true
AC_ARG_ENABLE(OSC,
[  --disable-GIW            Disable GTK+ Instrument Widgets.],
[
AC_DEFINE_UNQUOTED(DISABLE_GIW,1, [GIW])
HAVE_GIW=false
]
)
fi

AM_CONDITIONAL(ENABLE_GIW,$HAVE_GIW)




HAVE_SDL=false
FORCE_SDL=false
TRY_SDL=true

AC_ARG_ENABLE( sdl, [  --enable-sdl             Enable SDL playback plugin support without checking for it.] , force_sdl=yes)


AC_ARG_ENABLE(sdl,
[  --disable-sdl            Disable SDL support.],
[
AC_DEFINE_UNQUOTED(disable_sdl,1, [sdl])
TRY_SDL=false
]
)

if test "x$force_sdl" != "xyes" ; then
if test "$TRY_SDL" != "false" ; then

dnl check for SDL

 ifdef([m4_pattern_allow],
      [m4_pattern_allow([^AM_PATH_SDL])])


 ifdef([$AM_PATH_SDL"],

 [AM_PATH_SDL([1.2],[
        HAVE_SDL=true
        SDL_LIBS=`$SDL_CONFIG --libs`
	SDL_CFLAGS=`$SDL_CONFIG --cflags`]
 ,[AC_MSG_WARN([*** Unable to find SDL ***])])],

[

dnl if AM_PATH_SDL fails, try pkg-config
PKG_CHECK_MODULES(SDL,sdl >= 1.2,HAVE_SDL=true,HAVE_SDL=false)


if test "$HAVE_SDL" != "true"; then
echo
echo "*******************************************************************"
echo You are compiling LiVES without \(optional\) SDL support.
echo It is recommended that you install the libSDL development  
echo package and run autoconf again before compiling LiVES.
echo "*******************************************************************"
echo
fi

])



fi

else FORCE_SDL=true
SDL_PREFIX=${with-sdl-prefix}
fi

AC_SUBST(SDL_LIBS)
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_PREFIX)

AM_CONDITIONAL(HAVE_SDL,$HAVE_SDL)
AM_CONDITIONAL(FORCE_SDL,$FORCE_SDL)


HAVE_AVCODEC=false
HAVE_AVFORMAT=false
HAVE_AVUTIL=false
HAVE_SWSCALE=false

AC_ARG_ENABLE( ffmpeg, [  --disable-ffmpeg            Disable ffmpeg (avcodec) support.] , disable_ffmpeg=yes)
if test "x$disable_ffmpeg" != "xyes" ; then

dnl check for avcodec, avformat, avutil, swscale

PKG_CHECK_MODULES(LIBAVCODEC,libavcodec >= 53.0.0,HAVE_AVCODEC=true,HAVE_AVCODEC=false)

PKG_CHECK_MODULES(LIBAVFORMAT,libavformat,HAVE_AVFORMAT=true,HAVE_AVFORMAT=false)

PKG_CHECK_MODULES(LIBAVUTIL,libavutil,HAVE_AVUTIL=true,HAVE_AVUTIL=false)

PKG_CHECK_MODULES(LIBSWSCALE,libswscale,HAVE_SWSCALE=true,HAVE_SWSCALE=false)

fi

AC_SUBST(LIBAVCODEC_CFLAGS)
AC_SUBST(LIBAVCODEC_LIBS)
AC_SUBST(LIBAVFORMAT_CFLAGS)
AC_SUBST(LIBAVFORMAT_LIBS)
AC_SUBST(LIBAVUTIL_CFLAGS)
AC_SUBST(LIBAVUTIL_LIBS)
AC_SUBST(LIBSWSCALE_CFLAGS)
AC_SUBST(LIBSWSCALE_LIBS)

AM_CONDITIONAL(HAVE_AVCODEC,$HAVE_AVCODEC)
AM_CONDITIONAL(HAVE_AVFORMAT,$HAVE_AVFORMAT)
AM_CONDITIONAL(HAVE_AVUTIL,$HAVE_AVUTIL)
AM_CONDITIONAL(HAVE_SWSCALE,$HAVE_SWSCALE)


HAVE_AVCODEC_OPEN2=false
HAVE_AVCODEC_ALLOC_CONTEXT3=false
HAVE_AVFORMAT_NEW_STREAM=false
HAVE_AVFORMAT_FIND_STREAM_INFO=false
HAVE_AVFORMAT_INTERNAL_H=false
HAVE_AV_SET_PTS_INFO=false
HAVE_AVPRIV_SET_PTS_INFO=false

if test "$HAVE_AVCODEC" = "true" ; then
AC_CHECK_LIB(avcodec,avcodec_open2,HAVE_AVCODEC_OPEN2=true,HAVE_AVCODEC_OPEN2=false)
AC_CHECK_LIB(avcodec,avcodec_alloc_context3,HAVE_AVCODEC_ALLOC_CONTEXT3=true,HAVE_AVCODEC_ALLOC_COBTEXT3=false)
fi

if test "$HAVE_AVFORMAT" = "true" ; then
AC_CHECK_LIB(avformat,avformat_new_stream,HAVE_AVFORMAT_NEW_STREAM=true,HAVE_AVFORMAT_NEW_STREAM=false)
AC_CHECK_LIB(avformat,avformat_find_stream_info,HAVE_AVFORMAT_FIND_STREAM_INFO=true,HAVE_AVFORMAT_FIND_STREAM_INFO=false)

AC_CHECK_LIB(avformat,av_set_pts_info,HAVE_AV_SET_PTS_INFO=true,HAVE_AV_SET_PTS_INFO=false)

if test "$HAVE_AV_SET_PTS_INFO" = "false"; then
AC_CHECK_LIB(avformat,avpriv_set_pts_info,HAVE_AVPRIV_SET_PTS_INFO=true,HAVE_AVPRIV_SET_PTS_INFO=false)
if test "$HAVE_AV_SET_PTS_INFO" = "true"; then

AC_CHECK_HEADERS(libavformat/internal.h,HAVE_AVFORMAT_INTERNAL_H=true,HAVE_AVFORMAT_INTERNAL_H=false)

fi

fi

fi

AM_CONDITIONAL(HAVE_AVCODEC_OPEN2,$HAVE_AVCODEC_OPEN2)
AM_CONDITIONAL(HAVE_AVCODEC_ALLOC_CONTEXT3,$HAVE_AVCODEC_ALLOC_CONTEXT3)
AM_CONDITIONAL(HAVE_AVFORMAT_NEW_STREAM,$HAVE_AVFORMAT_NEW_STREAM)
AM_CONDITIONAL(HAVE_AVFORMAT_FIND_STREAM_INFO,$HAVE_AVFORMAT_FIND_STREAM_INFO)
AM_CONDITIONAL(HAVE_AVFORMAT_INTERNAL_H,$HAVE_AVFORMAT_INTERNAL_H)
AM_CONDITIONAL(HAVE_AV_SET_PTS_INFO,$HAVE_AV_SET_PTS_INFO)

HAVE_OPENCV=false

dnl check for opencv

PKG_CHECK_MODULES(OPENCV, opencv >= 2.3.1, HAVE_OPENCV=true, HAVE_OPENCV=false)

if test "HAVE_OPENCV" = "true" ; then
OPENCV_LIBS_ONLY_L = `pkg-config opencv --libs-only-L`
fi


AC_SUBST(OPENCV_CFLAGS)
AC_SUBST(OPENCV_LIBS_ONLY_L)

AM_CONDITIONAL(HAVE_OPENCV,$HAVE_OPENCV)

HAVE_FFTW3F=false

dnl check for fftw3f

PKG_CHECK_MODULES(FFTW3F, fftw3f, HAVE_FFTW3F=true, HAVE_FFTW3F=false)

AC_SUBST(FFTW3F_CFLAGS)
AC_SUBST(FFTW3F_LIBS)

AM_CONDITIONAL(HAVE_FFTW3F,$HAVE_FFTW3F)


dnl check for openGL
PKG_CHECK_MODULES(GL,gl,HAVE_OPENGL=true,HAVE_OPENGL=false)
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)

AM_CONDITIONAL(HAVE_OPENGL,$HAVE_OPENGL)



dnl check for GLee

HAVE_GLEE=false
AC_MSG_CHECKING(for GLee)
AC_CHECK_HEADERS(GLee.h GL/GLee.h,HAVE_GLEE=true)

if test "x$ac_cv_header_GL_GLee_h" != "xno"; then
GLEE_CFLAGS="-I $includedir/GL -I/usr/include/GL"
fi 

if test "$HAVE_GLEE" = "true" ; then

AC_CHECK_LIB(glee,GLeeEnabled,glee_lower_case=true,glee_lower_case=false)
if test "$glee_lower_case" = "true"; then
echo "GLee lib is -lglee"
GLEE_LIBS="-lglee"
else
AC_CHECK_LIB(GLee,GLeeEnabled,glee_mixed_case=true,glee_mixed_case=false)
if test "$glee_mixed_case" = "true"; then
echo "GLee lib is -lGLee"
GLEE_LIBS="-lGLee"
fi
fi
fi

AC_SUBST(GLEE_CFLAGS)
AC_SUBST(GLEE_LIBS)

AM_CONDITIONAL(HAVE_GLEE,$HAVE_GLEE)



dnl check for GLU
PKG_CHECK_MODULES(GLU,glu,HAVE_GLU=true,HAVE_GLU=false)
AC_SUBST(GLU_CFLAGS)
AC_SUBST(GLU_LIBS)

AM_CONDITIONAL(HAVE_GLU,$HAVE_GLU)



dnl check for mjpegtools
HAVE_MJPEGTOOLS=false
AC_ARG_ENABLE( mjpegtools, [  --disable-mjpegtools    Disable mjpegtools (yuv4mpeg) support.] , disable_mjpegtools=yes)
if test "x$disable_mjpegtools" != "xyes" ; then


PKG_CHECK_MODULES(MJPEGTOOLS,mjpegtools >= 1.6.2,HAVE_MJPEGTOOLS=true,HAVE_MJPEGTOOLS=false)
fi

AC_SUBST(MJPEGTOOLS_CFLAGS)
AC_SUBST(MJPEGTOOLS_LIBS)

AM_CONDITIONAL(HAVE_MJPEGTOOLS,$HAVE_MJPEGTOOLS)


dnl check for libpng
HAVE_LIBPNG=false
AC_ARG_ENABLE( libpng, [  --disable-libpng    Disable direct libpng support.] , disable_libpng=yes)
if test "x$disable_libpng" != "xyes" ; then

PKG_CHECK_MODULES(PNG,libpng > 1.2.0,HAVE_LIBPNG=true,HAVE_LIBPNG=false)
fi

AC_SUBST(PNG_CFLAGS)
AC_SUBST(PNG_LIBS)

AM_CONDITIONAL(HAVE_LIBPNG,$HAVE_LIBPNG)



HAVE_ZLIB=false
AC_ARG_ENABLE( libz, [  --disable-libz    Disable libz support.] , disable_libz=yes)
if test "x$disable_libz" != "xyes" ; then

dnl check for libz
PKG_CHECK_MODULES(LIBZ,zlib,HAVE_LIBZ=true,HAVE_LIBZ=false)
fi

AC_SUBST(LIBZ_CFLAGS)
AC_SUBST(LIBZ_LIBS)

AM_CONDITIONAL(CONFIG_ZLIB,$HAVE_LIBZ)


HAVE_BZLIB=false
AC_ARG_ENABLE( libbz, [  --disable-libbz    Disable libbz support.] , disable_libbz=yes)
if test "x$disable_libbz" != "xyes" ; then

dnl check for libz
AC_CHECK_HEADERS(bzlib.h,HAVE_LIBBZ=true,HAVE_LIBBZ=false)

if test "HAVE_LIBBZ" = "true" ; then
LIBBZ_LIBS=-lbz
fi
fi

AC_SUBST(LIBBZ_CFLAGS)
AC_SUBST(LIBBZ_LIBS)

AM_CONDITIONAL(CONFIG_BZLIB,$HAVE_LIBBZ)


HAVE_LADSPA=false
AC_ARG_ENABLE( ladspa, [  --disable-ladspa    Disable LADSPA support.] , disable_ladspa=yes)
if test "x$disable_ladspa" != "xyes" ; then

dnl check for libz
AC_CHECK_HEADERS(ladspa.h,HAVE_LADSPA=true,HAVE_LADSPA=false)
fi

AM_CONDITIONAL(HAVE_LADSPA,$HAVE_LADSPA)


HAVE_UNICAP=false
AC_ARG_ENABLE( unicap, [  --disable-unicap    Disable unicap support.] , disable_unicap=yes)
if test "x$disable_unicap" != "xyes" ; then

dnl check for unicap
PKG_CHECK_MODULES(UNICAP,libunicap,HAVE_UNICAP=true,HAVE_UNICAP=false)
fi

AC_SUBST(UNICAP_CFLAGS)
AC_SUBST(UNICAP_LIBS)

AM_CONDITIONAL(HAVE_UNICAP,$HAVE_UNICAP)

dnl Check of -lv4l1
AC_CHECK_HEADERS(linux/videodev.h, HAVE_LIBv4l1=true, HAVE_LIBv4l1=false)
if test "$HAVE_LIBv4l1" = "true"; then
v4l1_INCFILE=1
else
AC_CHECK_HEADERS(libv4l1-videodev.h, HAVE_LIBv4l1=true, HAVE_LIBv4l1=false)
if test "$HAVE_LIBv4l1" = "true"; then
v4l1_INCFILE=2
fi
fi

AM_CONDITIONAL(HAVE_LIBv4l1,$HAVE_LIBv4l1)
AC_SUBST(v4l1_INCFILE)

AC_CHECK_HEADERS(linux/videodev2.h, HAVE_LIBv4l2=true, HAVE_LIBv4l2=false)
AM_CONDITIONAL(HAVE_LIBv4l2,$HAVE_LIBv4l2)



HAVE_LIBDV=false
dnl check for libdv
PKG_CHECK_MODULES(LIBDV,libdv,HAVE_LIBDV=true,HAVE_LIBDV=false)
AC_SUBST(LIBDV_CFLAGS)
AC_SUBST(LIBDV_LIBS)

AM_CONDITIONAL(HAVE_LIBDV,$HAVE_LIBDV)


HAVE_OGG=false
dnl check for ogg
PKG_CHECK_MODULES(OGG,ogg,HAVE_OGG=true,HAVE_OGG=false)
AC_SUBST(OGG_CFLAGS)
AC_SUBST(OGG_LIBS)

AM_CONDITIONAL(HAVE_OGG,$HAVE_OGG)


HAVE_THEORA=false
dnl check for libtheora
PKG_CHECK_MODULES(THEORA,theora,HAVE_THEORA=true,HAVE_THEORA=false)
AC_SUBST(THEORA_CFLAGS)
AC_SUBST(THEORA_LIBS)

AM_CONDITIONAL(HAVE_THEORA,$HAVE_THEORA)


HAVE_VORBIS=false
dnl check for libvorbis
PKG_CHECK_MODULES(VORBIS,vorbis,HAVE_VORBIS=true,HAVE_VORBIS=false)
AC_SUBST(VORBIS_CFLAGS)
AC_SUBST(VORBIS_LIBS)

AM_CONDITIONAL(HAVE_VORBIS,$HAVE_VORBIS)


HAVE_DIRAC=false
dnl check for dirac
echo "Checking for Dirac (schroedinger)..."
PKG_CHECK_MODULES(DIRAC,schroedinger-1.0,HAVE_DIRAC=true,HAVE_DIRAC=false)
AC_SUBST(DIRAC_CFLAGS)
AC_SUBST(DIRAC_LIBS)

AM_CONDITIONAL(HAVE_DIRAC,$HAVE_DIRAC)


HAVE_ALSA=false
dnl check for libasound
PKG_CHECK_MODULES(ALSA,alsa,HAVE_ALSA=true,HAVE_ALSA=false)
AC_SUBST(ALSA_CFLAGS)
AC_SUBST(ALSA_LIBS)

AM_CONDITIONAL(HAVE_ALSA,$HAVE_ALSA)


HAVE_PULSE_AUDIO=false
dnl check for pulse-audio
PKG_CHECK_MODULES(PULSE,libpulse >= 0.9.14,HAVE_PULSE_AUDIO=true,HAVE_PULSE_AUDIO=false)
AC_SUBST(PULSE_CFLAGS)
AC_SUBST(PULSE_LIBS)

AM_CONDITIONAL(HAVE_PULSE_AUDIO,$HAVE_PULSE_AUDIO)


HAVE_VISUAL=false
AC_ARG_ENABLE( libvisual, [  --disable-libvisual     Disable libvisual support.] , disable_libvisual=yes)
if test "x$disable_libvisual" != "xyes" ; then

dnl check for libvisual
PKG_CHECK_MODULES(VISUAL,libvisual-0.4 >= 0.4.0,HAVE_VISUAL=true,HAVE_VISUAL=false)
if test "x$HAVE_VISUAL" = "xfalse"; then
PKG_CHECK_MODULES(VISUAL,libvisual = 0.2.0,HAVE_VISUAL=true,HAVE_VISUAL=false)
fi
AC_SUBST(VISUAL_CFLAGS)
AC_SUBST(VISUAL_LIBS)
fi

AM_CONDITIONAL(HAVE_VISUAL,$HAVE_VISUAL)



HAVE_LIBOIL=false
AC_ARG_ENABLE( liboil, [  --disable-liboil     Disable liboil support.] , disable_liboil=yes)
if test "x$disable_liboil" != "xyes" ; then

dnl check for liboil
PKG_CHECK_MODULES(OIL,liboil-0.3 >= 0.3.9,HAVE_LIBOIL=true,HAVE_LIBOIL=false)
AC_SUBST(OIL_CFLAGS)
AC_SUBST(OIL_LIBS)
fi

AM_CONDITIONAL(HAVE_LIBOIL,$HAVE_LIBOIL)
AM_CONDITIONAL(ENABLE_LIBOIL,$HAVE_LIBOIL)



HAVE_FREI0R=false
AC_ARG_ENABLE( frei0r, [  --disable-frei0r     Disable frei0r support.] , disable_frei0r=yes)
if test "x$disable_freior" != "xyes" ; then

dnl check for frei0r
AC_CHECK_HEADERS(frei0r.h, HAVE_FREI0R=true, HAVE_FREI0R=false)
AM_CONDITIONAL(HAVE_FREI0R,$HAVE_FREI0R)
fi


HAVE_LDVGRAB=false

AC_ARG_ENABLE( ldvgrab, [  --disable-ldvgrab     Disable LiVES-dvgrab.] , disable_ldvgrab=yes)
if test "x$disable_ldvgrab" != "xyes" ; then

dnl check for ldvgrab requirements
AC_CHECK_HEADERS(libraw1394/raw1394.h, HAVE_RAW1394=true, HAVE_RAW1394=false)
if $HAVE_RAW1394  ; then
AC_CHECK_HEADERS(libavc1394/avc1394.h, HAVE_AVC1394=true, HAVE_AVC1394=false)
if $HAVE_AVC1394 ; then
AC_CHECK_HEADERS(libavc1394/rom1394.h, HAVE_ROM1394=true, HAVE_ROM1394=false)
if $HAVE_ROM1394 ; then
HAVE_LDVGRAB=true

fi
fi
fi
fi
AM_CONDITIONAL(ENABLE_LDVGRAB,$HAVE_LDVGRAB)


PKG_CHECK_MODULES(WEED, libweed >= 0.7.0, HAVE_SYSTEM_WEED=true, HAVE_SYSTEM_WEED=false)

if test "$HAVE_SYSTEM_WEED" = "false"; then
echo "...this is not a problem if we have WEED_SLICE"
fi

AC_SUBST(WEED_CFLAGS)
AC_SUBST(WEED_LIBS)

AM_CONDITIONAL(HAVE_SYSTEM_WEED,$HAVE_SYSTEM_WEED)


PKG_CHECK_MODULES(WEED_SLICE, libweed_slice >= 0.7.0, HAVE_SYSTEM_WEED_SLICE=true, HAVE_SYSTEM_WEED_SLICE=false)

if test "$HAVE_SYSTEM_WEED_SLICE" = "true"; then
HAVE_SYSTEM_WEED=true
else
echo "...will try to build from included sources"
fi

dnl CFLAGS will be the same
AC_SUBST(WEED_SLICE_LIBS)

AM_CONDITIONAL(HAVE_SYSTEM_WEED_SLICE,$HAVE_SYSTEM_WEED_SLICE)


PKG_CHECK_MODULES(WEED_UTILS, libweed-utils >= 0.6.0, HAVE_SYSTEM_WEED_UTILS=true, HAVE_SYSTEM_WEED_UTILS=false)

if test "$HAVE_SYSTEM_WEED_UTILS" = "false"; then
echo "...will try to build from included sources"
fi

AC_SUBST(WEED_UTILS_CFLAGS)
AC_SUBST(WEED_UTILS_LIBS)

AM_CONDITIONAL(HAVE_SYSTEM_WEED_UTILS,$HAVE_SYSTEM_WEED_UTILS)


PKG_CHECK_MODULES(WEED_COMPAT, libweed-compat >= 0.8.0, HAVE_SYSTEM_WEED_COMPAT=true, HAVE_SYSTEM_WEED_COMPAT=false)

AC_SUBST(WEED_COMPAT_CFLAGS)
AC_SUBST(WEED_COMPAT_LIBS)

AM_CONDITIONAL(HAVE_SYSTEM_WEED_COMPAT,$HAVE_SYSTEM_WEED_COMPAT)

if test "$HAVE_SYSTEM_WEED_COMPAT" = "false"; then
echo "...will try to build from included sources"
fi


PKG_CHECK_MODULES(WEED_PLUGIN_UTILS, libweed-plugin-utils >= 0.13.0, HAVE_SYSTEM_WEED_PLUGIN_UTILS=true, HAVE_SYSTEM_WEED_PLUGIN_UTILS=false)

AC_SUBST(WEED_PLUGIN_UTILS_CFLAGS)
AC_SUBST(WEED_PLUGIN_UTILS_LIBS)

if test "$HAVE_SYSTEM_WEED_PLUGIN_UTILS" = "false"; then
echo "...will try to build from included sources"
fi

AM_CONDITIONAL(HAVE_SYSTEM_WEED_PLUGIN_UTILS,$HAVE_SYSTEM_WEED_PLUGIN_UTILS)


AM_CONDITIONAL(BUILD_EXPERIMENTAL,false)


dnl find -name Makefile.am | sed "s/\.\///g" | sed "s/\.am//g" >> configure.in
AC_CONFIG_FILES([
libweed/Makefile
libOSC/Makefile
libOSC/client/Makefile
libOSC/sendOSC/Makefile
po/Makefile.in
Makefile
intl/Makefile
m4/Makefile
src/Makefile
resources/Makefile
lives-plugins/Makefile
lives-plugins/plugins/effects/RFXscripts/Makefile
lives-plugins/plugins/effects/compound/Makefile
lives-plugins/plugins/effects/Makefile
lives-plugins/plugins/encoders/Makefile
lives-plugins/plugins/decoders/Makefile
lives-plugins/plugins/Makefile
lives-plugins/plugins/playback/video/Makefile
lives-plugins/plugins/playback/audiostream/Makefile
lives-plugins/plugins/playback/Makefile
lives-plugins/icons/Makefile
lives-plugins/themes/cutting_room/Makefile
lives-plugins/themes/pinks/Makefile
lives-plugins/themes/camera/Makefile
lives-plugins/themes/editor/Makefile
lives-plugins/themes/crayons/Makefile
lives-plugins/themes/crayons-bright/Makefile
lives-plugins/themes/Makefile
lives-plugins/weed-plugins/Makefile
lives-plugins/weed-plugins/gdk/Makefile
lives-plugins/weed-plugins/cairo/Makefile
lives-plugins/marcos-encoders/Makefile
])
AC_OUTPUT

dnl lives-plugins/weed-plugins/supercollider/Makefile
dnl lives-plugins/weed-plugins/experimental/Makefile


if test "$HAVE_JACK" != "true"; then
echo
echo "*******************************************************************"
echo You are compiling LiVES without jack \(\>= 0.100.0\) support.
echo It is recommended that you install/upgrade libjack-devel 
echo before compiling LiVES.
echo
echo For more details, see: http://jackaudio.org
echo
echo "*******************************************************************"
echo
fi

if test "$HAVE_PULSE_AUDIO" != "true"; then
echo
echo "*******************************************************************"
echo You are compiling LiVES without pulse audio \(\>= 0.9.14\) support.
echo It is recommended that you install/upgrade libpulse-devel 
echo before compiling LiVES.
echo
echo For more details, see: http://www.pulseaudio.org
echo
echo "*******************************************************************"
echo
fi

if test "x$HAVE_GTK_VERSION210" = "xfalse"; then
echo "*******************************************************************"
echo "LiVES will compile with your current version of gtk+-2.0"
echo "however your strongly advised to upgrade to at least version"
echo "2.10.0 of gtk+-2.0 to ensure problem free running of LiVES"
echo "*******************************************************************"
echo
fi


echo "*******************************************************************"
echo "LiVES is now configured and ready for building."
echo "If you are building for MULTILIBS on a 64 bit system, "
echo "you may wish to re-run this, e.g.: ./configure --libdir=/usr/lib64"
echo "In this case you MUST first manually update the library paths in libweed/*.pc files."
echo  "*******************************************************************"

