]> git.sesse.net Git - vlc/blobdiff - configure.ac
- Build libvlc from src/ rather than top
[vlc] / configure.ac
index b9a648d69e69924ad897bb2d621c74a1400d0e0c..bba8aaed59f529b710625f1d573054589b929c00 100644 (file)
@@ -20,6 +20,15 @@ dnl them. And we need the comma otherwize automake will choke on it.
 AM_INIT_AUTOMAKE(vlc,0.8.5-svn)
 AM_CONFIG_HEADER(config.h)
 
+dnl Too many people are not aware of maintainer mode:
+dnl If you want to use it, you definitely know what you are doing, so
+dnl you can specify "--disable-maintainer-mode". But if you want the default
+dnl automake behavior, you've likely never heard of maintainer mode, so we
+dnl can't expect you to enable it manually.
+
+AS_IF([test "x${enable_maintainer_mode}" != "xno"],
+       [enable_maintainer_mode="yes"])
+
 dnl HA! HA!
 AM_MAINTAINER_MODE
 
@@ -87,8 +96,6 @@ AC_ARG_WITH(contrib,
 
   if test -d ${topdir}/extras/contrib/lib; then
     export PATH=${topdir}/extras/contrib/bin:$PATH
-dnl kludge because only the debian package provides a ffmpeg-config
-    with_ffmpeg_config_path=${topdir}/extras/contrib/bin       
     CPPFLAGS="${CPPFLAGS} -I${topdir}/extras/contrib/include"
     CPPFLAGS_save="${CPPFLAGS_save} -I${topdir}/extras/contrib/include"
     CFLAGS="${CFLAGS} -I${topdir}/extras/contrib/include"
@@ -97,10 +104,10 @@ dnl kludge because only the debian package provides a ffmpeg-config
     CXXFLAGS_save="${CXXFLAGS_save} -I${topdir}/extras/contrib/include"
     OBJCFLAGS="${OBJCFLAGS} -I${topdir}/extras/contrib/include"
     OBJCFLAGS_save="${OBJCFLAGS_save} -I${topdir}/extras/contrib/include"
-    if test $BUILD = $HOST; then
-       export PKG_CONFIG_PATH=${topdir}/extras/contrib/bin:$PKG_CONFIG_PATH
-dnl    else
-dnl            export PKG_CONFIG_LIBDIR=${topdir}/extras/contrib/bin
+    if test $build = $host -o $PKG_CONFIG_LIBDIR; then
+       export PKG_CONFIG_PATH=${topdir}/extras/contrib/lib/pkgconfig:$PKG_CONFIG_PATH
+    else
+       export PKG_CONFIG_LIBDIR=${topdir}/extras/contrib/lib/pkgconfig
     fi
     if test -d ${topdir}/extras/contrib/vlc-lib; then
       LDFLAGS="${LDFLAGS} -L${topdir}/extras/contrib/vlc-lib"
@@ -108,8 +115,18 @@ dnl        export PKG_CONFIG_LIBDIR=${topdir}/extras/contrib/bin
     fi
     LDFLAGS="${LDFLAGS} -L${topdir}/extras/contrib/lib"
     LDFLAGS_save="${LDFLAGS_save} -L${topdir}/extras/contrib/lib"
-    with_livedotcom_tree=${topdir}/extras/contrib/src/live
-    with_goom_tree=${topdir}/extras/contrib/src/goom
+
+dnl kludge because only the debian package provides a ffmpeg-config
+    if test -z $with_ffmpeg_config_path; then 
+       with_ffmpeg_config_path=${topdir}/extras/contrib/bin;
+    fi
+    if test -z $with_livedotcom_tree; then
+       with_livedotcom_tree=${topdir}/extras/contrib/src/live
+    fi
+    if test -z $with_goom_tree; then
+      with_goom_tree=${topdir}/extras/contrib/src/goom
+    fi
+
     if test ".`uname -s`" = ".Darwin"; then
       export LD_LIBRARY_PATH=${topdir}/extras/contrib/lib:$LD_LIBRARY_PATH
       export DYLD_LIBRARY_PATH=${topdir}/extras/contrib/lib:$DYLD_LIBRARY_PATH
@@ -142,8 +159,17 @@ case "${target_os}" in
   *bsd*)
     SYS="${target_os}"
     CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
+    case "${target_os}" in
+      freebsd*)
+        CPPFLAGS_save="${CPPFLAGS_save} -I/usr/local/include"
+        CPPFLAGS="${CPPFLAGS_save}"
+        LDFLAGS_save="${LDFLAGS_save} -L/usr/local/lib"
+        LDFLAGS="${LDLFAGS_save}"
+        ;;
+    esac
     ;;
-  darwin*)
+  darwin1.[0123])
+    dnl Mac OS X < 10.3
     SYS=darwin
     CFLAGS_save="${CFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; CFLAGS="${CFLAGS_save}"
     CXXFLAGS_save="${CXXFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; CXXFLAGS="${CXXFLAGS_save}"
@@ -154,6 +180,15 @@ case "${target_os}" in
     VLC_ADD_CFLAGS([vlc],[-x objective-c])
     VLC_ADD_LDFLAGS([vlc],[-Wl,-m -Wl,-multiply_defined -Wl,suppress])
     ;;
+  darwin*)
+    SYS=darwin
+    CFLAGS_save="${CFLAGS_save} -D_INTL_REDIRECT_MACROS"; CFLAGS="${CFLAGS_save}"
+    CXXFLAGS_save="${CXXFLAGS_save} -D_INTL_REDIRECT_MACROS"; CXXFLAGS="${CXXFLAGS_save}"
+    OBJCFLAGS_save="${OBJCFLAGS_save} -D_INTL_REDIRECT_MACROS"; OBJCFLAGS="${OBJCFLAGS_save}"
+    VLC_ADD_LDFLAGS([mp4], [-framework IOKit -framework CoreFoundation])
+    VLC_ADD_CFLAGS([libvlc],[-x objective-c])
+    VLC_ADD_CFLAGS([vlc],[-x objective-c])
+    ;;
   *mingw32* | *cygwin* | *wince* | *mingwce* | *pe*)
     AC_CHECK_TOOL(WINDRES, windres, :)
 
@@ -179,8 +214,8 @@ case "${target_os}" in
         # add ws2_32 for closesocket, select, recv
         CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"; CPPFLAGS="${CPPFLAGS_save}"
         VLC_ADD_LDFLAGS([vlc],[-lws2_32 -lnetapi32 -lwinmm -mwindows])
-        VLC_ADD_LDFLAGS([vcdx cddax],[-lwinmm])
-        VLC_ADD_LDFLAGS([ipv4 ipv6 access_http access_mms access_udp access_tcp access_ftp access_output_udp sap slp http stream_out_standard stream_out_rtp vod_rtsp telnet netsync],[-lws2_32])
+        VLC_ADD_LDFLAGS([cdda vcdx cddax],[-lwinmm])
+        VLC_ADD_LDFLAGS([ipv4 ipv6 access_http access_mms access_udp access_tcp access_ftp access_output_udp sap slp http stream_out_standard stream_out_rtp vod_rtsp telnet netsync growl],[-lws2_32])
     fi
     if test "${SYS}" = "mingwce"; then
         # add ws2 for closesocket, select, recv
@@ -208,14 +243,14 @@ case "${target_os}" in
     CFLAGS_save="${CFLAGS_save} -Wno-multichar"; CFLAGS="${CFLAGS_save}"
     CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar"; CXXFLAGS="${CXXFLAGS_save}"
     VLC_ADD_CXXFLAGS([beos],[])
-    VLC_ADD_LDFLAGS([vlc beos],[-lbe])
+    VLC_ADD_LDFLAGS([vlc beos logger],[-lbe])
     VLC_ADD_LDFLAGS([beos],[-lmedia -ltranslation -ltracker -lgame])
 
     dnl Check for BONE
     if test -f /boot/beos/system/lib/libbind.so; then
-        VLC_ADD_LDFLAGS([access_file access_ftp access_mms access_output_udp telnet netsync sap ipv4 vlc],[-lbind -lsocket])
+        VLC_ADD_LDFLAGS([access_file access_ftp access_mms access_output_udp telnet netsync sap ipv4 vlc growl],[-lbind -lsocket])
     else
-        VLC_ADD_LDFLAGS([access_file access_ftp access_mms access_output_udp telnet netsync sap ipv4 vlc],[-lnet])
+        VLC_ADD_LDFLAGS([access_file access_ftp access_mms access_output_udp telnet netsync sap ipv4 vlc growl],[-lnet])
     fi
 
     dnl Ugly check for Zeta
@@ -232,22 +267,31 @@ AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
 AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
 AM_CONDITIONAL(HAVE_WINCE, test "${SYS}" = "mingwce")
 
+dnl
+dnl  Check for Mac OS X SDK settings
+dnl
+AC_ARG_WITH(macosx-sdk,
+   [  --with-macosx-sdk       compile for Mac OS X 10.3 SDK],[], with_macosx_sdk=no)
+if test "${with_macosx_sdk}" != "no" ; then
+  CFLAGS_save="${CFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=10.3 -isysroot /Developer/SDKs/MacOSX10.3.9.sdk"; CFLAGS="${CFLAGS_save}"
+  CXXFLAGS_save="${CXXFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=10.3 -isysroot /Developer/SDKs/MacOSX10.3.9.sdk"; CXXFLAGS="${CXXFLAGS_save}"
+  OBJCFLAGS_save="${OBJCFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=10.3 -isysroot /Developer/SDKs/MacOSX10.3.9.sdk"; OBJCFLAGS="${OBJCFLAGS_save}"
+  LDFLAGS_save="${LDFLAGS_save} -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk"; LDFLAGS="${LDFLAGS_save}"
+  export MACOSX_DEPLOYMENT_TARGET=10.3
+  MACOSX_DEPLOYMENT_TARGET="10.3"
+fi
+
 dnl
 dnl Gettext stuff
 dnl
-ALL_LINGUAS="ca da de en_GB es fr it ja ko nl pt_BR ro ru sv tr zh_CN zh_TW"
+ALL_LINGUAS="ca da de en_GB es fr it ja ka ko nl oc pt_BR ro ru sv tr zh_CN zh_TW"
 AM_GNU_GETTEXT_VERSION(0.11.5)
 AM_GNU_GETTEXT
 if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
   AC_DEFINE(HAVE_INCLUDED_GETTEXT, 1, Define if we use the local libintl)
   INCLUDES="${INCLUDES} -I\$(top_builddir)/intl"
 else
-  AC_CHECK_FUNCS(textdomain,,[
-    AC_CHECK_LIB(intl,textdomain,
-      VLC_ADD_LDFLAGS([vlc],[${LIBINTL}]),,
-      ${LIBINTL}
-    )
-  ])
+  VLC_ADD_LDFLAGS([vlc],[${LIBINTL}])
 fi
 AM_CONDITIONAL(BUILD_INTL, test "${nls_cv_force_use_gnu_gettext}" = "yes")
 XGETTEXT="${XGETTEXT} --keyword=_NS --keyword=_ANS"
@@ -341,7 +385,7 @@ CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcd
 dnl Check for system libs needed
 need_libc=false
 
-AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch)
+AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat)
 
 dnl Check for usual libc functions
 AC_CHECK_FUNCS(strdup strndup atof)
@@ -367,19 +411,19 @@ fi
 
 AC_CHECK_FUNCS(connect,,[
   AC_CHECK_LIB(socket,connect,[
-    VLC_ADD_LDFLAGS([vlc ipv4 cddax],-lsocket)
+    VLC_ADD_LDFLAGS([vlc ipv4 cdda cddax],-lsocket)
   ])
 ])
 
 AC_CHECK_FUNCS(send,,[
   AC_CHECK_LIB(socket,send,[
-    VLC_ADD_LDFLAGS([access_http access_mms access_udp access_tcp access_ftp sap access_output_udp stream_out_standard],[-lsocket])
+    VLC_ADD_LDFLAGS([access_http access_mms access_udp access_tcp access_ftp sap access_output_udp stream_out_standard growl],[-lsocket])
   ])
 ])
 
 AC_CHECK_FUNCS(gethostbyname,,[
   AC_CHECK_LIB(nsl,gethostbyname,[
-    VLC_ADD_LDFLAGS([cddax ipv4 vlc],[-lnsl])
+    VLC_ADD_LDFLAGS([cdda cddax ipv4 vlc],[-lnsl])
   ],[
     AC_CHECK_LIB(bind,gethostbyname,[
       VLC_ADD_LDFLAGS([ipv4 access_mms],[-lbind])
@@ -482,7 +526,7 @@ AC_CHECK_LIB(m,cos,[
   VLC_ADD_LDFLAGS([adjust distort a52tofloat32 dtstofloat32 x264 goom],[-lm])
 ])
 AC_CHECK_LIB(m,pow,[
-  VLC_ADD_LDFLAGS([ffmpeg ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer vlc freetype mpc],[-lm])
+  VLC_ADD_LDFLAGS([ffmpeg ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer param_eq vlc freetype mpc],[-lm])
 ])
 AC_CHECK_LIB(m,sqrt,[
   VLC_ADD_LDFLAGS([headphone_channel_mixer normvol speex],[-lm])
@@ -677,6 +721,7 @@ AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
 AC_CHECK_HEADERS(machine/param.h sys/shm.h)
 AC_CHECK_HEADERS(linux/version.h)
+AC_CHECK_HEADERS(syslog.h)
 fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
 
 AC_HEADER_TIME
@@ -713,13 +758,8 @@ if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
 fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
 
-dnl Default X headers and libraries
-if test "${x_includes}" = "NONE"; then
-  x_includes="/usr/X11R6/include"
-fi
-if test "${x_libraries}" = "NONE"; then
-  x_libraries="/usr/X11R6/lib"
-fi
+dnl Find where are the X headers and libraries
+AC_PATH_XTRA()
 
 dnl it seems that autoconf do the pkg-config detection only for the first PKG_CHECK_MODULES in the configure.ac ( which is logical) but in our case it is nested in a if so it was not working if you're not on linux or have disable hal.
 
@@ -909,15 +949,12 @@ if test "${ac_cv_c_dynamic_no_pic}" != "no"; then
 fi
 
 dnl Check for Darwin plugin linking flags
-AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
+AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error],
     [ac_cv_ld_darwin],
-    [CFLAGS="${CFLAGS_save} -bundle -undefined error -lcc_dynamic"
+    [CFLAGS="${CFLAGS_save} -bundle -undefined error"
      AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
 if test "${ac_cv_ld_darwin}" != "no"; then
     VLC_ADD_LDFLAGS([plugin],[-bundle -undefined error])
-    AC_CHECK_LIB(cc_dynamic, main,[
-      VLC_ADD_LDFLAGS([plugin],[-lcc_dynamic])
-    ])
 fi
 
 dnl Check for standard plugin linking flags
@@ -1035,7 +1072,7 @@ dnl  VLC_ADD_PLUGINS([externrun])
   VLC_ADD_PLUGINS([i420_yuy2 i422_yuy2 i420_ymga])
   VLC_ADD_PLUGINS([aout_file linear_resampler bandlimited_resampler])
   VLC_ADD_PLUGINS([float32_mixer spdif_mixer simple_channel_mixer])
-  VLC_ADD_PLUGINS([dolby_surround_decoder headphone_channel_mixer normvol equalizer])
+  VLC_ADD_PLUGINS([dolby_surround_decoder headphone_channel_mixer normvol equalizer param_eq])
   VLC_ADD_PLUGINS([fixed32tofloat32 float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif dtstospdif s16tofloat32 s16tofloat32swab s8tofloat32 u8tofloat32 audio_format])
 fi
 
@@ -1186,7 +1223,7 @@ AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
      [# OS X/PPC test (gcc 3.x)
       CFLAGS="${CFLAGS_save} -faltivec"
       AC_TRY_COMPILE([],
-        [vec_ld(0, (unsigned char *)0);],
+        [vec_ld(1 * sizeof(vector float), (unsigned char *)0);],
         [ac_cv_c_altivec="-faltivec"],
         dnl Below this are the Linux tests
         [# Linux/PPC test (gcc 4.x)
@@ -1248,7 +1285,9 @@ AC_ARG_WITH(tuning,
 [  --with-tuning=ARCH      enable special tuning for an architecture
                           (default Pentium 2 on IA-32 and 750 on PPC)])
 if test -n "${with_tuning}"; then
-    CFLAGS_TUNING="-mtune=${with_tuning}"
+    if test "${with_tuning}" != "no"; then
+        CFLAGS_TUNING="-mtune=${with_tuning}"
+    fi
 else
     if test "${target_cpu}" = "i686" -o "${target_cpu}" = "i586" -o "${target_cpu}" = "i486" -o "${target_cpu}" = "i386"; then
         CFLAGS_TUNING="-mtune=pentium2"
@@ -1316,6 +1355,9 @@ dnl
 AC_ARG_ENABLE(debug,
 [  --enable-debug          debug mode (default disabled)])
 test "${enable_debug}" != "yes" && enable_debug="no"
+AH_TEMPLATE(NDEBUG,
+            [Define to 1 if debug code should NOT be compiled])
+AS_IF([test "x${enable_debug}" == "xno"], [AC_DEFINE(NDEBUG)])
 
 dnl
 dnl  Enable release-specific flags
@@ -1324,6 +1366,15 @@ AC_ARG_ENABLE(release,
 [  --enable-release        activate extra optimizations (default disabled)])
 test "${enable_release}" != "yes" && enable_release="no"
 
+dnl
+dnl  Is the shared libvlc forced ?
+dnl
+build_pic=no
+AC_ARG_ENABLE(shared-libvlc,
+  [  --enable-shared-libvlc  shared libvlc (default disabled EXPERIMENTAL)],
+  ,[shared_libvlc=no])
+
+
 dnl
 dnl Stream output
 dnl
@@ -1375,6 +1426,17 @@ then
   AC_DEFINE(ENABLE_VLM, 1, Define if you want the VideoLAN manager support)
 fi
 
+dnl
+dnl Growl notification plugin
+dnl
+AC_ARG_ENABLE(growl,
+  [  --enable-growl         growl notification plugin (default enabled)])
+AS_IF([test "${enable_growl}" != "no"], [
+    VLC_ADD_PLUGINS([growl])
+  ]
+)
+
+
 dnl
 dnl TLS/SSL
 dnl
@@ -1485,6 +1547,128 @@ if test "${enable_livedotcom}" = "yes"; then
   fi
 fi
 
+dnl
+dnl dv module: digital video module check for libraw1394
+dnl
+AC_ARG_ENABLE(dv,
+[  --enable-dv             dv input module (default disabled)])
+if test "${enable_dv}" = "yes"
+then
+  AC_ARG_WITH(dv-raw1394,
+  [    --with-dv-raw1394=PATH   libraw1394 headers and libraries])
+  AC_ARG_WITH(dv-raw1394-tree,
+  [    --with-dv-raw1394=PATH   libraw1394 tree for static linking])
+
+  if test -z "${with_dv_raw1394}" -a "${with_dv_raw1394}" != ""
+  then
+    AC_MSG_CHECKING(for raw1394 headers in ${with_dv_raw1394})
+    if test -f ${with_dv_raw1394}/include/libraw1394/raw1394.h
+    then
+      dnl  Use ${with_dv_raw1394}/include/libraw1394/raw1394.h
+      AC_MSG_RESULT(yes)
+      VLC_ADD_PLUGINS([access_dv])
+      VLC_ADD_LDFLAGS([access_dv],[-L${with_dv_raw1394}/lib -lraw1394 -lpthread])
+      VLC_ADD_CPPFLAGS([access_dv],[-I${with_dv_raw1394}/include])
+    else
+      dnl  No libraw1394 could be found, sorry
+      AC_MSG_RESULT(no)
+      AC_MSG_ERROR([cannot find ${with_dv_raw1394}/include/libraw1394/raw1394.h])
+    fi
+  else
+    AC_CHECK_HEADERS(libraw1394/raw1394.h,
+    [ VLC_ADD_PLUGINS([access_dv])
+        VLC_ADD_LDFLAGS([access_dv],[-lraw1394 -lavc1394])
+    ],[
+        if test -n "${enable_dv}"
+        then
+          AC_MSG_ERROR([cannot find libraw1394 headers])
+        fi
+    ])
+  fi
+
+  dnl Check for static linking of libraw1394
+  if test -z "${with_dv_raw1394_tree}" -a "${with_dv_raw1394_tree}" != ""
+  then
+    AC_MSG_CHECKING(for libraw1394.a in ${with_dv_raw1394_tree})
+    real_dv_raw1394_tree="`cd ${with_dv_raw1394_tree} 2>/dev/null && pwd`"
+    if test -z "${real_dv_raw1394_tree}"
+    then
+      dnl  The given directory can't be found
+      AC_MSG_RESULT(no)
+      AC_MSG_ERROR([cannot cd to ${real_dv_raw1394_tree}])
+    fi
+    if test -f "${real_dv_raw1394_tree}/src/.libs/libraw1394.a"
+    then
+      dnl  Use a custom libraw1394
+      AC_MSG_RESULT(${real_dv_raw1394_tree}/src/.libs/libraw1394.a)
+      VLC_ADD_BUILTINS([access_dv])
+      VLC_ADD_LDFLAGS([access_dv],[-L${real_dv_raw1394_tree}/src/.libs -lraw1394])
+      VLC_ADD_CPPFLAGS([access_dv],[-I${real_dv_raw1394_tree}])
+    else
+      dnl  The given libraw1394 wasn't built
+      AC_MSG_RESULT(no)
+      AC_MSG_ERROR([cannot find ${real_dv_raw1394_tree}/src/.libs/libraw1394.a, make sure you compiled libraw1394 in ${with_dv_raw1394_tree}])
+    fi
+  fi
+
+  dnl
+  dnl Check for libavc1394
+  dnl
+
+  AC_ARG_WITH(dv-avc1394,
+  [    --with-dv-avc1394=PATH   libavc1394 headers and libraries])
+  AC_ARG_WITH(dv-avc1394-tree,
+  [    --with-dv-avc1394=PATH   libavc1394 tree for static linking])
+
+  if test -z "${with_dv_avc1394}" -a "${with_dv_avc1394}" != ""
+  then
+    AC_MSG_CHECKING(for avc1394 headers in ${with_dv_avc1394})
+    if test -f ${with_dv_avc1394}/include/libavc1394/avc1394.h
+    then
+      dnl  Use ${with_dv_avc1394}/include/libavc1394/avc1394.h
+      AC_MSG_RESULT(yes)
+      VLC_ADD_LDFLAGS([access_dv],[-L${with_dv_avc1394}/lib -lavc1394 -lrom1394 -lpthread])
+      VLC_ADD_CPPFLAGS([access_dv],[-I${with_avc1394}/include])
+    else
+      dnl  No libavc1394 could be found, sorry
+      AC_MSG_RESULT(no)
+      AC_MSG_ERROR([cannot find ${with_dv_avc1394}/include/libavc1394/avc1394.h])
+    fi
+  else
+    AC_CHECK_HEADERS(libavc1394/avc1394.h,
+    [ VLC_ADD_LDFLAGS([access_dv],[-lavc1394 -lrom1394 -lpthread])
+    ],[
+        if test -n "${enable_dv}"
+        then
+          AC_MSG_ERROR([cannot find libavc1394 headers])
+        fi
+    ])
+  fi
+
+  dnl Check for static linking of libavc1394
+  if test -z "${with_dv_avc1394_tree}" -a "${with_dv_avc1394_tree}" != ""
+  then
+    AC_MSG_CHECKING(for libavc1394.a in ${with_dv_avc1394_tree})
+    real_dv_avc1394_tree="`cd ${with_dv_avc1394_tree} 2>/dev/null && pwd`"
+    if test -z "${real_dv_avc1394_tree}"
+    then
+      dnl  The given directory can't be found
+      AC_MSG_RESULT(no)
+      AC_MSG_ERROR([cannot cd to ${real_dv_avc1394_tree}])
+    fi
+    if test -f "${real_dv_avc1394_tree}/src/.libs/libavc1394.a"
+    then
+      dnl  Use a custom libavc1394
+      AC_MSG_RESULT(${real_dv_avc1394_tree}/src/.libs/libavc1394.a)
+      VLC_ADD_LDFLAGS([access_dv],[-L${real_dv_avc1394_tree}/src/.libs -lavc1394 -lrom1394 -lpthread])
+      VLC_ADD_CPPFLAGS([access_dv],[-I${real_dv_avc1394_tree}])
+    else
+      dnl  The given libavc1394 wasn't built
+      AC_MSG_RESULT(no)
+      AC_MSG_ERROR([cannot find ${real_dv_avc1394_tree}/src/.libs/libavc1394.a, make sure you compiled libavc1394 in ${with_dv_avc1394_tree}])
+    fi
+  fi
+fi
 
 dnl
 dnl dvdread module: check for libdvdread
@@ -1592,10 +1776,12 @@ if test "${enable_dshow}" != "no"
 then
   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
   then
+    AC_LANG_PUSH(C++)
       AC_CHECK_HEADERS(dshow.h,
       [ VLC_ADD_PLUGINS([dshow])
         VLC_ADD_CXXFLAGS([dshow],[])
         VLC_ADD_LDFLAGS([dshow],[-lole32 -loleaut32 -luuid]) ])
+    AC_LANG_POP(C++)
   fi
 fi
 
@@ -1620,7 +1806,7 @@ dnl
 dnl  libdvbpsi ts demux/mux
 dnl
 AC_ARG_ENABLE(dvbpsi,
-[  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
+  [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
 if test "${enable_dvbpsi}" != "no"
 then
   AC_ARG_WITH(dvbpsi,
@@ -1745,8 +1931,8 @@ dnl
 dnl  gnomeVFS access module
 dnl
 AC_ARG_ENABLE(gnomevfs,
-  [  --enable-gnomevfs      GnomeVFS access module (default enabled)])
-if test "${enable_gnomevfs}" != "no"
+  [  --enable-gnomevfs       GnomeVFS access module (default enabled)])
+if test "${enable_gnomevfs}" != "no" -a  "${SYS}" = "linux" 
 then
   PKG_CHECK_MODULES(GNOMEVFS, gnome-vfs-2.0,
     VLC_ADD_LDFLAGS([access_gnomevfs],[$GNOMEVFS_LIBS])
@@ -1895,7 +2081,18 @@ then
   then
     VLC_ADD_PLUGINS([vcd cdda])
     VLC_ADD_LDFLAGS([vcd vcdx cdda cddax],[-framework IOKit -framework CoreFoundation])
-    VLC_ADD_LDFLAGS([vcdx cddax],[-liconv])
+    VLC_ADD_LDFLAGS([vcdx cddax cdda],[-liconv])
+  fi
+
+  if test "$enable_libcddb" != "no"; then
+    PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [
+      HAVE_LIBCDDB=yes 
+      AC_DEFINE(HAVE_LIBCDDB, [], [Define this if you have libcddb installed])
+      VLC_ADD_LDFLAGS([cdda],[$LIBCDDB_LIBS])
+      VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
+      ],:
+      [AC_MSG_WARN(new enough libcddb not found. CDDB access disabled) 
+      HAVE_LIBCDDB=no])
   fi
 fi
 
@@ -1946,11 +2143,11 @@ if test "${enable_screen}" != "no"; then
     VLC_ADD_CXXFLAGS([screen],[])
     VLC_ADD_LDFLAGS([screen],[-lbe])
   else
-    CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
+    CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
     AC_CHECK_HEADERS(X11/Xlib.h, [
       VLC_ADD_PLUGINS([screen])
-      VLC_ADD_LDFLAGS([screen],[-L${x_libraries} -lX11 -lXext])
-      VLC_ADD_CPPFLAGS([screen],[-I${x_includes}])
+      VLC_ADD_LDFLAGS([screen],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext])
+      VLC_ADD_CPPFLAGS([screen],[${X_CFLAGS}])
     ])
     CPPFLAGS="${CPPFLAGS_save}"
   fi
@@ -1993,7 +2190,7 @@ AC_ARG_ENABLE(ogg,
 if test "${enable_ogg}" != "no"
 then
   AC_ARG_WITH(ogg-tree,
-  [    --with-ogg-tree=PATH ogg tree for static linking])
+  [    --with-ogg-tree=PATH  ogg tree for static linking])
   if test -n "${with_ogg_tree}"
   then
     AC_MSG_CHECKING(for libogg.a in ${with_ogg_tree})
@@ -2161,7 +2358,7 @@ then
   fi
 
   AC_ARG_WITH(mad-tree,
-    [    --with-mad-tree=PATH  mad tree for static linking],[],[])
+    [    --with-mad-tree=PATH   mad tree for static linking],[],[])
   if test "${with_mad_tree}" != "no" -a -n "${with_mad_tree}"
   then
     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
@@ -2214,66 +2411,176 @@ AC_CHECK_HEADERS(id3tag.h, [
 dnl
 dnl  ffmpeg decoder/demuxer plugin
 dnl
-dnl we try to find ffmpeg using : 1- ffmpeg-config, 2- pkg-config
-dnl                            3- default place, 4- given tree
+dnl we try to find ffmpeg using : 1- given tree 2- ffmpeg-config, 3- pkg-config
+dnl                            4- default place, 
 
 AC_ARG_ENABLE(ffmpeg,
 [  --enable-ffmpeg         ffmpeg codec (default enabled)])
 if test "${enable_ffmpeg}" != "no"
 then
-dnl Look for a ffmpeg-config (we are on debian )
-   FFMPEG_PATH="${PATH}"
-   AC_ARG_WITH(ffmpeg-config-path,
-     [    --with-ffmpeg-config-path=PATH ffmpeg-config path (default search in \$PATH)],
-     [ if test "${with_ffmpeg_config_path}" != "no"
-       then
-         FFMPEG_PATH="${with_ffmpeg_config_path}"
-       fi ])
-   AC_PATH_PROG(FFMPEG_CONFIG, ffmpeg-config, no, ${FFMPEG_PATH})
-   if test "${FFMPEG_CONFIG}" != "no"
-   then
-     AC_CHECK_HEADERS(ffmpeg/avcodec.h)
-     AC_CHECK_HEADERS(postproc/postprocess.h)
-     VLC_ADD_PLUGINS([ffmpeg])
-     if test "${enable_sout}" != "no"; then
-         VLC_ADD_PLUGINS([stream_out_switcher])
-     fi
-     VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[`${FFMPEG_CONFIG} --cflags`])
-     VLC_ADD_LDFLAGS([ffmpeg stream_out_switcher],[`${FFMPEG_CONFIG} --plugin-libs avcodec avformat postproc`])
-  
-  else
 
 dnl Those options have to be here because the .pc can be bogus for ffmpeg previous nov 05
 
-       AC_ARG_WITH(ffmpeg-mp3lame,
-      [    --with-ffmpeg-mp3lame specify if ffmpeg has been compiled with mp3lame support],
-      [
-        if test "$with_ffmpeg_mp3lame" = "yes";        then
-               VLC_ADD_LDFLAGS([ffmpeg],[-lmp3lame])
-       fi
-       ])
+ AC_ARG_WITH(ffmpeg-mp3lame,
+   [    --with-ffmpeg-mp3lame specify if ffmpeg has been compiled with mp3lame support],
+   [
+     if test "$with_ffmpeg_mp3lame" = "yes";   then
+       VLC_ADD_LDFLAGS([ffmpeg],[-lmp3lame])
+     fi])
+
+ AC_ARG_WITH(ffmpeg-faac,
+   [    --with-ffmpeg-faac    specify if ffmpeg has been compiled with faac support],
+   [
+     if test "$with_ffmpeg_faac" = "yes"; then
+       VLC_ADD_LDFLAGS([ffmpeg],[-lfaac])
+     fi])
+
+ AC_ARG_WITH(ffmpeg-dts,
+   [    --with-ffmpeg-dts     specify if ffmpeg has been compiled with dts support],
+   [
+     if test "$with_ffmpeg_dts" = "yes"; then
+             LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
+             AC_CHECK_LIB(dts_pic, dts_free, 
+               [ VLC_ADD_LDFLAGS([ffmpeg],[-ldts_pic]) ],
+               [ VLC_ADD_LDFLAGS([ffmpeg],[-ldts]) ])
+             LDFLAGS="${LDFLAGS_save}"
+     fi])
+
+ AC_ARG_WITH(ffmpeg-vorbis,
+   [    --with-ffmpeg-vorbis    specify if ffmpeg has been compiled with vorbis support],
+   [
+     if test "$with_ffmpeg_vorbis" = "yes"; then
+        VLC_ADD_LDFLAGS([ffmpeg],[-lvorbisenc -lvorbis])
+     fi])
+
+ AC_ARG_WITH(ffmpeg-theora,
+   [    --with-ffmpeg-theora    specify if ffmpeg has been compiled with theora support],
+   [
+     if test "$with_ffmpeg_theora" = "yes"; then
+        VLC_ADD_LDFLAGS([ffmpeg],[-ltheora])
+     fi])
+
+ AC_ARG_WITH(ffmpeg-ogg,
+   [    --with-ffmpeg-ogg    specify if ffmpeg has been compiled with ogg support],
+   [
+     if test "$with_ffmpeg_ogg" = "yes"; then
+        VLC_ADD_LDFLAGS([ffmpeg],[-logg])
+     fi])
+
+ AC_ARG_WITH(ffmpeg-zlib,
+   [    --with-ffmpeg-zlib    specify if ffmpeg has been compiled with zlib support],
+   [
+     if test "$with_ffmpeg_zlib" = "yes"; then
+               VLC_ADD_LDFLAGS([ffmpeg],[-lz])
+     fi])
+
+ dnl
+ dnl test for --with-ffmpeg-tree
+ dnl
+ AC_ARG_WITH(ffmpeg-tree,
+   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
+
+ if test "${with_ffmpeg_tree}" != "no" -a -n "${with_ffmpeg_tree}"; then
+   AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
+   real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
+   if test -z "${real_ffmpeg_tree}"; then
+     dnl  The given directory can't be found
+     AC_MSG_RESULT(no)
+     AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
+   fi
+   if ! test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
+     dnl  The given libavcodec wasn't built
+     AC_MSG_RESULT(no)
+     AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
+   fi
+   if ! fgrep -s "pp_get_context" "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
+     if test -f "${real_ffmpeg_tree}/libavcodec/libpostproc/libpostproc.a"; then
+       VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavcodec/libpostproc ${real_ffmpeg_tree}/libavcodec/libpostproc/libpostproc.a])       
+     else
+       dnl  The given libavcodec wasn't built with --enable-pp
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR([${real_ffmpeg_tree}/libavcodec/libavcodec.a was not compiled with postprocessing support, make sure you configured ffmpeg with --enable-pp])
+     fi
+   fi
+   dnl  Use a custom libffmpeg
+   AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
 
-    AC_ARG_WITH(ffmpeg-faac,
-      [    --with-ffmpeg-faac    specify if ffmpeg has been compiled with faac support],
-      [
-        if test "$with_ffmpeg_faac" = "yes"; then
-               VLC_ADD_LDFLAGS([ffmpeg],[-lfaac])
-       fi])
+   if fgrep -s "CONFIG_ZLIB=yes" "${real_ffmpeg_tree}/config.mak"; then
+     if test "${with_ffmpeg_zlib}" != "yes"; then
+       VLC_ADD_LDFLAGS([ffmpeg],[-lz])
+     fi
+   fi
+   if fgrep -s "CONFIG_MP3LAME=yes" "${real_ffmpeg_tree}/config.mak"; then
+     if test "${with_ffmpeg_mp3lame}" != "yes"; then
+       VLC_ADD_LDFLAGS([ffmpeg],[-lmp3lame])
+     fi
+   fi
+   if fgrep -s "CONFIG_FAAC=yes" "${real_ffmpeg_tree}/config.mak"; then
+     if test "${with_ffmpeg_faac}" != "yes"; then
+       VLC_ADD_LDFLAGS([ffmpeg],[-lfaac])
+     fi
+   fi
+   if fgrep -s "CONFIG_DTS=yes" "${real_ffmpeg_tree}/config.mak"; then
+     if test "${with_ffmpeg_dts}" != "yes"; then
+       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
+       AC_CHECK_LIB(dts_pic, dts_free, 
+         [ VLC_ADD_LDFLAGS([ffmpeg],[-ldts_pic]) ],
+         [ VLC_ADD_LDFLAGS([ffmpeg],[-ldts]) ])
+       LDFLAGS="${LDFLAGS_save}"
+     fi
+   fi
+   if fgrep -s "CONFIG_VORBIS=yes" "${real_ffmpeg_tree}/config.mak"; then
+     VLC_ADD_LDFLAGS([ffmpeg],[-lvorbis -lvorbisenc])
+   fi
+   if fgrep -s "CONFIG_FAAD=yes" "${real_ffmpeg_tree}/config.mak"; then
+     VLC_ADD_LDFLAGS([ffmpeg],[-lfaad])
+   fi
+   if fgrep -s "CONFIG_XVID=yes" "${real_ffmpeg_tree}/config.mak"; then
+     VLC_ADD_LDFLAGS([ffmpeg],[-lxvidcore])
+   fi
 
-    AC_ARG_WITH(ffmpeg-dts,
-      [    --with-ffmpeg-dts     specify if ffmpeg has been compiled with dts support],
-      [
-        if test "$with_ffmpeg_dts" = "yes"; then
-               VLC_ADD_LDFLAGS([ffmpeg],[-ldts])
-       fi])
+   VLC_ADD_BUILTINS([ffmpeg])
+   if test "${enable_sout}" != "no"; then
+     VLC_ADD_BUILTINS([stream_out_switcher])
+   fi
 
-    AC_ARG_WITH(ffmpeg-zlib,
-      [    --with-ffmpeg-zlib    specify if ffmpeg has been compiled with zlib support],
-      [
-        if test "$with_ffmpeg_zlib" = "yes"; then
-               VLC_ADD_LDFLAGS([ffmpeg],[-lz])
-       fi])
+   if test -f "${real_ffmpeg_tree}/libavutil/libavutil.a"; then
+     VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavutil ${real_ffmpeg_tree}/libavutil/libavutil.a])
+     VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}/libavutil])
+   fi
+
+   VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavcodec ${real_ffmpeg_tree}/libavcodec/libavcodec.a])
+   VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}/libavcodec])
+
+   if test -f "${real_ffmpeg_tree}/libavformat/libavformat.a"; then
+     AC_DEFINE(HAVE_LIBAVFORMAT, 1, [Define if you have ffmpeg's libavformat.])
+     VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavformat ${real_ffmpeg_tree}/libavformat/libavformat.a])
+     VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}/libavformat])
+   fi
+else    
+    
+dnl Look for a ffmpeg-config (we are on debian )
+  FFMPEG_PATH="${PATH}"
+  AC_ARG_WITH(ffmpeg-config-path,
+    [    --with-ffmpeg-config-path=PATH ffmpeg-config path (default search in \$PATH)],
+    [ if test "${with_ffmpeg_config_path}" != "no"
+      then
+        FFMPEG_PATH="${with_ffmpeg_config_path}"
+      fi ])
+  AC_PATH_PROG(FFMPEG_CONFIG, ffmpeg-config, no, ${FFMPEG_PATH})
+  if test "${FFMPEG_CONFIG}" != "no"
+  then
+    AC_CHECK_HEADERS(ffmpeg/avcodec.h)
+    AC_CHECK_HEADERS(postproc/postprocess.h)
+    VLC_ADD_PLUGINS([ffmpeg])
+    if test "${enable_sout}" != "no"; then
+        VLC_ADD_PLUGINS([stream_out_switcher])
+    fi
+    VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[`${FFMPEG_CONFIG} --cflags`])
+    VLC_ADD_LDFLAGS([ffmpeg stream_out_switcher],[`${FFMPEG_CONFIG} --plugin-libs avcodec avformat postproc`])
+ else
 
 dnl Trying with pkg-config
    PKG_CHECK_MODULES(FFMPEG,[libavcodec, libavformat],
@@ -2286,13 +2593,15 @@ dnl Trying with pkg-config
      fi
      VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[${FFMPEG_CFLAGS}])
      VLC_ADD_LDFLAGS([ffmpeg],[${FFMPEG_LIBS}])
-
+     dnl newer ffmpeg have a separate libpostproc
+     PKG_CHECK_MODULES(POSTPROC, libpostproc,[
+       VLC_ADD_LDFLAGS([ffmpeg],[${POSTPROC_LIBS}]) 
+       ],[ true ])
     ],[
      
     dnl
-    dnl test for !(--with-ffmpeg-tree)
+    dnl last chance: at the default place
     dnl
-    if test "${with_ffmpeg_tree}" = "no" -o -z "${with_ffmpeg_tree}"; then
       CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
       AC_CHECK_HEADERS(ffmpeg/avcodec.h, [], [AC_MSG_ERROR([Missing header file ffmpeg/avcodec.h.])] )
@@ -2302,10 +2611,11 @@ dnl Trying with pkg-config
         VLC_ADD_LDFLAGS([ffmpeg],[-lavutil])
         LDAVUTIL="-lavutil"])
 
+      AC_CHECK_LIB(postproc, pp_postprocess, [
+        VLC_ADD_LDFLAGS([ffmpeg],[-lpostproc])])
+
       AC_CHECK_LIB(avcodec, avcodec_init, [
         VLC_ADD_BUILTINS([ffmpeg])
-
-
         VLC_ADD_LDFLAGS([ffmpeg],[-lavcodec])
         if test "${enable_sout}" != "no"; then
             VLC_ADD_BUILTINS([stream_out_switcher])
@@ -2317,90 +2627,13 @@ dnl Trying with pkg-config
         VLC_ADD_LDFLAGS([ffmpeg],[-lavformat -lz]) ], [], [-lavcodec -lz $LDAVUTIL])
       LDFLAGS="${LDFLAGS_save}"
       CPPFLAGS="${CPPFLAGS_save}"
-    fi
-
-    dnl
-    dnl test for --with-ffmpeg-tree
-    dnl
-    if test "${with_ffmpeg_tree}" != "no" -a -n "${with_ffmpeg_tree}"; then
-      AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
-      real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
-      if test -z "${real_ffmpeg_tree}"; then
-        dnl  The given directory can't be found
-        AC_MSG_RESULT(no)
-        AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
-      fi
-      if ! test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
-        dnl  The given libavcodec wasn't built
-        AC_MSG_RESULT(no)
-        AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
-      fi
-      if ! fgrep -s "pp_get_context" "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
-        dnl  The given libavcodec wasn't built with --enable-pp
-        AC_MSG_RESULT(no)
-        AC_MSG_ERROR([${real_ffmpeg_tree}/libavcodec/libavcodec.a was not compiled with postprocessing support, make sure you configured ffmpeg with --enable-pp])
-      fi
-      dnl  Use a custom libffmpeg
-      AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
-
-      if fgrep -s "CONFIG_ZLIB=yes" "${real_ffmpeg_tree}/config.mak"; then
-        if test "${with_ffmpeg_zlib}" != "yes"; then
-          VLC_ADD_LDFLAGS([ffmpeg],[-lz])
-        fi
-      fi
-      if fgrep -s "CONFIG_MP3LAME=yes" "${real_ffmpeg_tree}/config.mak"; then
-        if test "${with_ffmpeg_mp3lame}" != "yes"; then
-          VLC_ADD_LDFLAGS([ffmpeg],[-lmp3lame])
-        fi
-      fi
-      if fgrep -s "CONFIG_FAAC=yes" "${real_ffmpeg_tree}/config.mak"; then
-        if test "${with_ffmpeg_faac}" != "yes"; then
-          VLC_ADD_LDFLAGS([ffmpeg],[-lfaac])
-        fi
-      fi
-      if fgrep -s "CONFIG_DTS=yes" "${real_ffmpeg_tree}/config.mak"; then
-        if test "${with_ffmpeg_dts}" != "yes"; then
-          VLC_ADD_LDFLAGS([ffmpeg],[-ldts])
-        fi
-      fi
-      if fgrep -s "CONFIG_VORBIS=yes" "${real_ffmpeg_tree}/config.mak"; then
-        VLC_ADD_LDFLAGS([ffmpeg],[-lvorbis -lvorbisenc])
-      fi
-      if fgrep -s "CONFIG_FAAD=yes" "${real_ffmpeg_tree}/config.mak"; then
-        VLC_ADD_LDFLAGS([ffmpeg],[-lfaad])
-      fi
-      if fgrep -s "CONFIG_XVID=yes" "${real_ffmpeg_tree}/config.mak"; then
-        VLC_ADD_LDFLAGS([ffmpeg],[-lxvidcore])
-      fi
-
-      VLC_ADD_BUILTINS([ffmpeg])
-      if test "${enable_sout}" != "no"; then
-        VLC_ADD_BUILTINS([stream_out_switcher])
-      fi
-
-      if test -f "${real_ffmpeg_tree}/libavutil/libavutil.a"; then
-        VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavutil ${real_ffmpeg_tree}/libavutil/libavutil.a])
-        VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}/libavutil])
-      fi
-
-      VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavcodec ${real_ffmpeg_tree}/libavcodec/libavcodec.a])
-      VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}/libavcodec])
-
-      if test -f "${real_ffmpeg_tree}/libavformat/libavformat.a"; then
-        AC_DEFINE(HAVE_LIBAVFORMAT, 1, [Define if you have ffmpeg's libavformat.])
-        VLC_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavformat ${real_ffmpeg_tree}/libavformat/libavformat.a])
-        VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}/libavformat])
-      fi
-    fi
     ])
-    AC_ARG_WITH(ffmpeg-tree,
-      [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
-
   fi
+ fi 
 fi
 
 dnl
-dnl  ffmpeg decoder/demuxer plugin
+dnl  ffmpegaltivec plugin
 dnl
 AC_ARG_ENABLE(ffmpegaltivec,
 [  --enable-ffmpegaltivec  ffmpegaltivec codec (DO NOT USE)])
@@ -2978,15 +3211,41 @@ dnl
 AC_ARG_ENABLE(dirac,
 [  --enable-dirac          experimental dirac codec (default disabled)])
 if test "${enable_dirac}" = "yes"; then
-  AC_CHECK_HEADERS(libdirac_decoder/dirac_parser.h, [
-    AC_CHECK_LIB(dirac_decoder, dirac_decoder_init, [
+  PKG_CHECK_MODULES(DIRAC,dirac, [
       VLC_ADD_PLUGINS([dirac])
-      VLC_ADD_LDFLAGS([dirac],[-ldirac_decoder -ldirac_encoder -lstdc++]) ],[
-      AC_MSG_ERROR([libdirac doesn't appear to be installed on you system.])],
-      [-lstdc++])
+      VLC_ADD_CFLAGS([dirac],[$DIRAC_CFLAGS])
+      VLC_ADD_LDFLAGS([dirac],[$DIRAC_LIBS -lstdc++]) ],[
+      AC_MSG_ERROR([libdirac doesn't appear to be installed on you system.])
   ])
 fi
 
+dnl  libvc1 decoder plugin
+dnl
+AC_ARG_ENABLE(libvc1,
+[  --enable-libvc1         VC-1 codec (default disabled)])
+if test "${enable_libvc1}" = "yes"
+then
+  AC_ARG_WITH(libvc1-tree,
+  [    --with-libvc1-tree=PATH libvc1 tree for static linking])
+  if test -n "${with_libvc1_tree}"
+  then
+    AC_MSG_CHECKING(for vc1dec.o in ${with_libvc1_tree})
+    real_libvc1_tree="`cd ${with_libvc1_tree} 2>/dev/null && pwd`"
+    if test -f "${real_libvc1_tree}/src/.libs/vc1dec.o"
+    then
+      VLC_ADD_BUILTINS([libvc1])
+      VLC_ADD_CPPFLAGS([libvc1],[-I${real_libvc1_tree}/src])
+      VLC_ADD_LDFLAGS([libvc1],[${real_libvc1_tree}/src/.libs/libvc1.a])
+      AC_MSG_RESULT(yes)
+    else
+      dnl  The given libvc1 tree wasn't built
+      AC_MSG_RESULT(no)
+      AC_MSG_ERROR([cannot find ${real_libvc1_tree}/src/.libs/vc1dec.o,
+                    make sure you compiled libvc1 in ${with_libvc1_tree}])
+    fi
+  fi
+fi
+
 dnl
 dnl  PNG decoder module
 dnl
@@ -3029,7 +3288,7 @@ if test "${enable_x264}" != "no"; then
       AC_MSG_RESULT(yes)
       VLC_ADD_CPPFLAGS([x264],[-I${real_x264_tree}])
       VLC_ADD_LDFLAGS([x264],[-L${real_x264_tree}])
-      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_x264}"
+      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_x264} ${THREAD_LIB}"
       AC_CHECK_LIB(x264, x264_encoder_open, [
         VLC_ADD_BUILTINS([x264])
         VLC_ADD_LDFLAGS([x264],[-lx264])
@@ -3042,7 +3301,7 @@ if test "${enable_x264}" != "no"; then
       AC_MSG_ERROR([the specified tree doesn't have x264.h])
     fi
   else
-    LDFLAGS="${LDFLAGS_save} ${LDFLAGS_x264}"
+    LDFLAGS="${LDFLAGS_save} ${LDFLAGS_x264} ${THREAD_LIB}"
     AC_CHECK_HEADERS(x264.h, [
       AC_CHECK_LIB(x264, x264_encoder_open, [
         VLC_ADD_PLUGINS([x264])
@@ -3076,7 +3335,7 @@ AC_ARG_WITH(,[Video plugins:])
 
 dnl Check for DPMS
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
-  CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
+  CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
   AC_CHECK_HEADERS(X11/extensions/dpms.h, [
     AC_MSG_CHECKING(for DPMSInfo in X11/extensions/dpms.h)
     AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
@@ -3101,11 +3360,11 @@ AC_ARG_ENABLE(x11,
 if test "${enable_x11}" != "no" &&
   (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
    test "${enable_x11}" = "yes"); then
-  CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
+  CPPFLAGS="${CPPFLAGS_save} ${X_FLAGS}"
   AC_CHECK_HEADERS(X11/Xlib.h, [
     VLC_ADD_PLUGINS([x11])
-    VLC_ADD_LDFLAGS([x11],[-L${x_libraries} -lX11 -lXext])
-    VLC_ADD_CPPFLAGS([x11],[-I${x_includes}])
+    VLC_ADD_LDFLAGS([x11],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext])
+    VLC_ADD_CPPFLAGS([x11],[${X_CFLAGS}])
   ])
   CPPFLAGS="${CPPFLAGS_save}"
 fi
@@ -3119,25 +3378,25 @@ AC_ARG_ENABLE(xvideo,
 if test "${enable_xvideo}" != "no" &&
   (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
    test "${enable_xvideo}" = "yes"); then
-  CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
+  CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
-    CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
+    CFLAGS="${CFLAGS_save} ${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext"
     AC_CHECK_LIB(Xv,XvPutImage,[
       # If libXv.so is available, xvideo can be a plugin. Otherwise, we
       # test for libXv_pic.
       if test -f /usr/X11R6/lib/libXv.so -o -f "${x_libraries}"/libXv.so; then
         VLC_ADD_PLUGINS([xvideo])
-        VLC_ADD_CPPFLAGS([xvideo],[-I${x_includes}])
-        VLC_ADD_LDFLAGS([xvideo],[-L${x_libraries} -lX11 -lXext -lXv])
+        VLC_ADD_CPPFLAGS([xvideo],[${X_CFLAGS}])
+        VLC_ADD_LDFLAGS([xvideo],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lXv])
       else
         AC_CHECK_LIB(Xv_pic,XvPutImage,[
           VLC_ADD_PLUGINS([xvideo])
-          VLC_ADD_CPPFLAGS([xvideo],[-I${x_includes}])
-          VLC_ADD_LDFLAGS([xvideo],[-L${x_libraries} -lX11 -lXext -lXv_pic])
+          VLC_ADD_CPPFLAGS([xvideo],[${X_CFLAGS}])
+          VLC_ADD_LDFLAGS([xvideo],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lXv_pic])
         ],[
           VLC_ADD_BUILTINS([xvideo])
-          VLC_ADD_LDFLAGS([xvideo],[-L${x_libraries} -lX11 -lXext -lXv])
-          VLC_ADD_CPPFLAGS([xvideo],[-I${x_includes}])
+          VLC_ADD_LDFLAGS([xvideo],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lXv])
+          VLC_ADD_CPPFLAGS([xvideo],[${X_CFLAGS}])
         ])
       fi
     ])
@@ -3155,25 +3414,25 @@ AC_ARG_ENABLE(glx,
 if test "${enable_glx}" != "no" &&
   (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
    test "${enable_glx}" = "yes"); then
-  CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
+  CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
   AC_CHECK_HEADERS(X11/Xlib.h, [
     AC_CHECK_HEADERS(GL/glx.h, [
       VLC_ADD_PLUGINS([glx])
-      VLC_ADD_LDFLAGS([glx],[-L${x_libraries} -lX11 -lXext -lGL -lGLU])
-      VLC_ADD_CPPFLAGS([glx],[-I${x_includes}])
+      VLC_ADD_LDFLAGS([glx],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lGL -lGLU])
+      VLC_ADD_CPPFLAGS([glx],[${X_CFLAGS}])
   ]) ])
   CPPFLAGS="${CPPFLAGS_save}"
 fi
 
-dnl
-dnl  Check for the Xinerama extension
-dnl
 if test "${enable_xvideo}" != "no" &&
   (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
    test "${enable_xvideo}" = "yes"); then
+dnl
+dnl  Check for the Xinerama extension
+dnl
   ac_cv_have_xinerama="no"
-  CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
-  CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
+  CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
+  CFLAGS="${CFLAGS_save} ${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext"
   AC_CHECK_HEADERS(X11/extensions/Xinerama.h,[
     AC_CHECK_LIB(Xinerama_pic, XineramaQueryExtension,[
       VLC_ADD_LDFLAGS([xvideo],[-lXinerama_pic])
@@ -3194,6 +3453,38 @@ if test "${enable_xvideo}" != "no" &&
   fi
   CFLAGS="${CFLAGS_save}"
   CPPFLAGS="${CPPFLAGS_save}"
+
+dnl
+dnl  Check for XF86VidMode extension
+dnl
+  ac_cv_have_xf86vidmode="no"
+  CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
+  CFLAGS="${CFLAGS_save} ${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext"
+  AC_CHECK_HEADERS(X11/extensions/xf86vmode.h,[
+    AC_CHECK_LIB(Xxf86vm_pic, XF86VidModeGetViewPort,[
+      VLC_ADD_LDFLAGS([xvideo],[-lXxf86vm_pic])
+      VLC_ADD_LDFLAGS([x11],[-lXxf86vm_pic])
+      VLC_ADD_LDFLAGS([glx],[-lXxf86vm_pic])
+      ac_cv_have_xf86vidmode="yes"
+    ],[
+      AC_CHECK_LIB(Xxf86vm, XF86VidModeGetViewPort,[
+        VLC_ADD_LDFLAGS([xvideo],[-lXxf86vm])
+        VLC_ADD_LDFLAGS([x11],[-lXxf86vm])
+        VLC_ADD_LDFLAGS([glx],[-lXxf86vm])
+        ac_cv_have_xf86vidmode="yes"
+      ])
+    ])
+  ],[true],
+[#ifdef HAVE_X11_XLIB_H
+# include <X11/Xlib.h>
+#endif]
+   )
+  AS_IF([test "${ac_cv_have_xf86vidmode}" = "yes"],
+    [AC_DEFINE(HAVE_XF86VIDMODE, 1, [Define this if you have libXxf86vm installed])
+  ])
+  CFLAGS="${CFLAGS_save}"
+  CPPFLAGS="${CPPFLAGS_save}"
+
 fi
 
 dnl
@@ -3208,7 +3499,7 @@ if test "${enable_opengl}" != "no" &&
     AC_CHECK_HEADERS(GL/gl.h, [
       VLC_ADD_PLUGINS([opengl])
       if test "${SYS}" != "mingw32"; then
-        VLC_ADD_LDFLAGS([opengl],[-L${x_libraries} -lGL -lGLU])
+        VLC_ADD_LDFLAGS([opengl],[${X_LIBS} -lGL -lGLU])
       else
         VLC_ADD_LDFLAGS([opengl],[-lopengl32])
       fi
@@ -3420,6 +3711,16 @@ then
         [AC_MSG_WARN(SVG library not found)])
 fi
 
+dnl
+dnl Snapshot vout module (with cache)
+dnl
+AC_ARG_ENABLE(snapshot,
+  [  --enable-snapshot       snapshot module (default disabled)])
+if test "${enable_snapshot}" = "yes"
+then
+  VLC_ADD_PLUGINS([snapshot])
+fi
+
 dnl
 dnl  Qt Embedded module
 dnl  (disabled by default)
@@ -3565,6 +3866,41 @@ then
   VLC_ADD_LDFLAGS([svgalib],[-lvgagl -lvga])
 fi
 
+dnl
+dnl  DirectFB module
+dnl
+AC_ARG_ENABLE(directfb,
+  [  --enable-directfb       DirectFB support (default disabled)])
+if test "${enable_directfb}" = "yes"
+then
+  if test "${with_directfb}" = "no"
+  then
+    AC_CHECK_HEADER(directfb.h, have_directfb="true", have_directfb="false")
+    if test "${have_directfb}"= "true"
+    then
+        VLC_ADD_PLUGINS([directfb])
+        VLC_ADD_LDFLAGS([directfb],[-ldirectfb -lfusion -ldirect -lpthread -ljpeg -lz -ldl])
+        VLC_ADD_CPPFLAGS([directfb],[-I/usr/include/directfb -D_REENTRANT])
+    else
+        AC_MSG_ERROR([cannot find /usr/include/directfb headers, make sure directfb is installed on your system or use --disable-directfb])
+    fi
+  else
+    CPPFLAGS_save="${CPPFLAGS}"
+    CPPFLAGS="${CPPFLAGS} -I${with_directfb}/include"
+    AC_CHECK_HEADER(directfb.h, have_directfb="true", have_directfb="false")
+    CPPFLAGS="${CPPFLAGS_save}"
+    AC_ARG_WITH(directfb,
+        [    --with-directfb=PATH  path to directfb],
+        [ if test "${with_directfb}" != "no" -a -n "${with_directfb}"
+        then
+            VLC_ADD_PLUGINS([directfb])
+            VLC_ADD_CPPFLAGS([directfb],[-I${with_directfb}/include -D_REENTRANT])
+            VLC_ADD_LDFLAGS([directfb],[-L${with_directfb}/lib -ldirectfb -lfusion -ldirect -lpthread -ljpeg -lz -ldl])
+        fi ],
+        [ AC_MSG_ERROR([cannot find directfb headers in ${with_directfb}/include]) ])
+  fi
+fi
+
 dnl
 dnl  GGI module
 dnl
@@ -3590,16 +3926,24 @@ AC_ARG_ENABLE(glide,
   [  --enable-glide          Glide (3dfx) support (default disabled)])
 if test "${enable_glide}" = "yes"
 then
-  VLC_ADD_PLUGINS([glide])
-  VLC_ADD_LDFLAGS([glide],[-lglide2x -lm])
-  VLC_ADD_CPPFLAGS([glide],[-I/usr/include/glide])
+  CFLAGS_save="${CFLAGS}"
   AC_ARG_WITH(glide,
     [    --with-glide=PATH     path to libglide],
     [ if test "${with_glide}" != "no" -a -n "${with_glide}"
       then
         VLC_ADD_CPPFLAGS([glide],[-I${with_glide}/include])
         VLC_ADD_LDFLAGS([glide],[-L${with_glide}/lib])
-      fi ])
+        CFLAGS="$CFLAGS -I${with_glide}/include"
+    fi ])
+   CFLAGS="$CFLAGS -I/usr/include/glide"
+   AC_CHECK_HEADER(glide.h,[   
+      VLC_ADD_PLUGINS([glide])
+      VLC_ADD_LDFLAGS([glide],[-lglide2x -lm])
+      VLC_ADD_CPPFLAGS([glide],[-I/usr/include/glide])
+    ],[
+      AC_MSG_ERROR([You don't have libglide. Install it or do not use --enable-glide])
+     ])
+   CFAGS="${CFLAGS_save}"
 fi
 
 dnl
@@ -3768,14 +4112,14 @@ fi
 dnl
 dnl  CoreAudio plugin
 dnl
-AC_ARG_ENABLE(coreaudio,
-  [  --enable-coreaudio      CoreAudio module (default enabled on MacOS X)])
-if test "${enable_coreaudio}" != "no" &&
-  (test "${SYS}" = "darwin" || test "${enable_coreaudio}" = "yes")
+AC_ARG_ENABLE(macosx-audio,
+  [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
+if test "${enable_macosx-audio}" != "no" &&
+  (test "${SYS}" = "darwin" || test "${enable_macosx-audio}" = "yes")
 then
   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h, 
-    [ VLC_ADD_BUILTINS([coreaudio auhal])
-      VLC_ADD_LDFLAGS([coreaudio auhal],[-framework CoreAudio -framework AudioUnit -framework AudioToolbox])
+    [ VLC_ADD_BUILTINS([auhal])
+      VLC_ADD_LDFLAGS([auhal],[-framework CoreAudio -framework AudioUnit -framework AudioToolbox])
     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
 fi
 
@@ -3795,49 +4139,113 @@ then
   AC_LANG_POP([C++])
 fi
 
+dnl
+dnl  JACK module
+dnl
+AC_ARG_ENABLE(jack,
+ [  --enable-jack           JACK audio module (default disabled)],
+ [if test "${enable_jack}" = "yes"
+  then
+    AC_CHECK_HEADERS(jack/jack.h, [
+      VLC_ADD_PLUGINS([jack])
+      VLC_ADD_LDFLAGS([jack],[-ljack]) ])
+  fi])
+
 dnl
 dnl  CyberLink for C++ UPnP stack
 dnl
 AC_ARG_ENABLE(cyberlink,
   [  --enable-cyberlink      CyberLink for C++ UPnP stack (default disabled)])
-if test "${CXX}" != "" -a "${enable_cyberlink}" = "yes" || (test "${enable_cyberlink}" != "no"); then
+AS_IF([test "${CXX}" != "" -a "${enable_cyberlink}" = "yes" || (test "${enable_cyberlink}" != "no")], [
   AC_ARG_WITH(cyberlink-tree,
     [    --with-cyberlink-tree=PATH CyberLink for C++ tree for static linking])
 
   dnl
   dnl test for --with-cyberlink-tree
   dnl
-  if test ! -z "${with_cyberlink_tree}" -a "${CXX}" != ""; then
+  AS_IF([test ! -z "${with_cyberlink_tree}" -a "${CXX}" != ""], [
     AC_LANG_PUSH(C++)
     real_cyberlink_tree="`cd ${with_cyberlink_tree} 2>/dev/null && pwd`"
-    if test -z "${real_cyberlink_tree}"
-    then
+    AS_IF([test -z "${real_cyberlink_tree}"], [
       dnl  The given directory can't be found
       AC_MSG_RESULT(no)
       AC_MSG_ERROR([cannot cd to ${with_cyberlink_tree}])
-    fi
-    CXXFLAGS_save="${CXXFLAGS}"
-    CXXFLAGS_cyberlink="-I${real_cyberlink_tree}/include"
-    CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_cyberlink}"
+    ])
+    CPPFLAGS_save="${CPPFLAGS}"
+    CPPFLAGS_cyberlink="-I${real_cyberlink_tree}/include"
+    CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_cyberlink}"
     AC_CHECK_HEADERS([cybergarage/upnp/MediaServer.h],
-      [ VLC_ADD_CXXFLAGS([upnp], [${CXXFLAGS_cyberlink}])
-        VLC_ADD_PLUGINS([upnp]) 
+      [ VLC_ADD_CXXFLAGS([upnp_cc], [${CPPFLAGS_cyberlink}])
+        VLC_ADD_PLUGINS([upnp_cc]) 
       ],[
         AC_MSG_ERROR([cannot find CyberLink for C++ headers])
       ])
     AC_MSG_CHECKING(for libclink.a in ${with_cyberlink_tree})
-    if test -f "${real_cyberlink_tree}/lib/unix/libclink.a"
-    then
+    AS_IF([test -f "${real_cyberlink_tree}/lib/unix/libclink.a"], [
       AC_MSG_RESULT(${real_cyberlink_tree}/lib/unix/libclink.a)
-      VLC_ADD_LDFLAGS([upnp], [${real_cyberlink_tree}/lib/unix/libclink.a -lexpat])
-    else
+      dnl The mere fact that we have to make such an ugly check sucks
+      AC_MSG_CHECKING(for XML parser to link CyberLink with)
+      LIBS_save="$LIBS"
+      LIBS_cclink="no"
+      for l in "`xml2-config --libs`" -lexpat -lxerces-c; do
+        LIBS="$LIBS_save ${real_cyberlink_tree}/lib/unix/libclink.a -lpthread $l"
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <cybergarage/upnp/media/player/MediaPlayer.h>
+using namespace CyberLink;
+
+class testclass : public SearchResponseListener, public MediaPlayer
+{
+    virtual void deviceSearchResponseReceived( SSDPPacket *)
+    {
+    }
+
+    public:
+      testclass (void)
+      {
+        addSearchResponseListener (this);
+       start ();
+      }
+};
+],[testclass l;])],[LIBS_cclink="$l"])
+      done
+      LIBS="${LIBS_save}"
+      dnl should not happen - otherwise this needs fixing - hence FAILURE
+      AS_IF([test "${LIBS_cclink}" == "no"],
+        [AC_MSG_FAILURE([cannot find XML parser for CyberLink])])
+      AC_MSG_RESULT([${LIBS_cclink}])
+      VLC_ADD_LDFLAGS([upnp_cc], [${real_cyberlink_tree}/lib/unix/libclink.a -lpthread ${LIBS_cclink}])
+    ], [
       AC_MSG_RESULT(no)
-       AC_MSG_ERROR([cannot find ${real_cyberlink_tree}/lib/unix/libclink.a, make sure you compiled CyberLink for C++ in ${with_cyberlink_tree}])
-    fi
-    CXXFLAGS="${CXXFLAGS_save}"
+      AC_MSG_ERROR([cannot find ${real_cyberlink_tree}/lib/unix/libclink.a, make sure you compiled CyberLink for C++ in ${with_cyberlink_tree}])
+    ])
+    CPPFLAGS="${CPPFLAGS_save}"
     AC_LANG_POP([C++])
-  fi
-fi
+  ])
+])
+
+dnl
+dnl UPnP Plugin (Intel SDK)
+dnl
+AC_ARG_ENABLE(upnp,
+  [  --enable-upnp           Intel UPnP SDK (default auto)])
+
+VLC_ADD_CXXFLAGS([upnp_intel], [ ])
+AS_IF([test "x${enable_upnp}" != "xno"], [
+  AC_CHECK_LIB([upnp], [UpnpInit], [has_upnp="yes"], [has_upnp="no"], [-lpthread])
+  AS_IF([test "x${enable_upnp}" != "x" && test "${has_upnp}" == "no"], [
+    AC_MSG_ERROR([cannot find Intel UPnP SDK (libupnp)])
+  ])
+  AS_IF([test "${has_upnp}" == "yes"], [
+    VLC_ADD_LDFLAGS([upnp_intel], [-lupnp])
+  ])
+], [
+  has_upnp="no"
+])
+
+AS_IF([test "${has_upnp}" == "yes"], [
+  VLC_ADD_PLUGINS([upnp_intel])
+])
+
 
 dnl
 dnl  Interface plugins
@@ -3884,9 +4292,9 @@ if test "${enable_skins2}" = "yes" ||
   else if test "${skins2_missing_lib}" = "no"; then
     VLC_ADD_PLUGINS([skins2])
     ALIASES="${ALIASES} svlc"
-    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 -I${x_includes} -DX11_SKINS])
+    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 ${X_CFLAGS} -DX11_SKINS])
     VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
-    VLC_ADD_LDFLAGS([skins2],[-L${x_libraries} -lXext -lX11])
+    VLC_ADD_LDFLAGS([skins2],[${X_LIBS} ${X_PRE_LIBS} -lXext -lX11])
   fi fi
 fi
 
@@ -4320,7 +4728,7 @@ then
   AC_CHECK_HEADERS(GL/gl.h, [
     VLC_ADD_PLUGINS([galaktos])
     if test "${SYS}" != "mingw32"; then
-      VLC_ADD_LDFLAGS([galaktos],[-L${x_libraries} -lGL -lGLU])
+      VLC_ADD_LDFLAGS([galaktos],[${X_LIBS} -lGL -lGLU])
     else
       VLC_ADD_LDFLAGS([galaktos],[-lopengl32])
     fi
@@ -4382,43 +4790,6 @@ then
   fi
 fi
 
-dnl
-dnl  SLP access plugin
-dnl
-AC_ARG_ENABLE(slp,
-  [  --enable-slp            SLP service discovery support (default disabled)])
-if test "${enable_slp}" = "yes"
-then
-  AC_ARG_WITH(slp,
-  [    --with-slp=PATH       libslp headers and libraries])
-  if test -z "${with_slp}"
-  then
-    AC_CHECK_HEADERS(slp.h, have_slp="true", have_slp="false")
-    if test "${have_slp}" = "true"
-    then
-      VLC_ADD_PLUGINS([slp])
-      VLC_ADD_LDFLAGS([slp],[-lslp])
-      VLC_ADD_LDFLAGS([stream_out_standard],[-lslp])
-    fi
-  else
-    AC_MSG_CHECKING(for slp headers in ${with_slp})
-    if test -f ${with_slp}/slp.h
-    then
-      dnl  Use ${with_slp}/libslp/slp.h
-      AC_MSG_RESULT(yes)
-      VLC_ADD_PLUGINS([slp])
-      VLC_ADD_LDFLAGS([slp],[-L${with_slp} -lslp])
-      VLC_ADD_LDFLAGS([stream_out_standard],[-L${with_slp} -lslp])
-      VLC_ADD_CPPFLAGS([slp],[-I${with_slp}])
-      AC_DEFINE(HAVE_SLP_H)
-    else
-      dnl  No libslp could be found, sorry
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
-    fi
-  fi
-fi
-
 dnl
 dnl DAAP access plugin and services discovery 
 dnl
@@ -4441,7 +4812,9 @@ AC_ARG_ENABLE(bonjour,
 if test "${enable_bonjour}" != "no"
 then
   PKG_CHECK_MODULES(BONJOUR, avahi-client >= 0.3,
-    [AC_DEFINE(HAVE_AVAHI_CLIENT, [], [Define if you have the avahi-client library])
+    [PKG_CHECK_MODULES(BONJOUR, avahi-client >= 0.6,
+       [AC_DEFINE(HAVE_AVAHI_06, [], [Define if you have avahi-client 0.6 or greater])],)
+      AC_DEFINE(HAVE_AVAHI_CLIENT, [], [Define if you have the avahi-client library])
       VLC_ADD_LDFLAGS([bonjour access_output_http],[$BONJOUR_LIBS])
       VLC_ADD_CFLAGS([bonjour access_output_http],[$BONJOUR_CFLAGS])
       VLC_ADD_PLUGINS([bonjour]) ],
@@ -4463,14 +4836,6 @@ then
   fi
 fi
 
-dnl 
-dnl  Joystick plugin
-dnl
-AC_ARG_ENABLE(joystick,
-  [  --enable-joystick       joystick control (default enabled)])
-if test "${enable_joystick}" = "yes"; then
-  AC_CHECK_HEADER(linux/joystick.h, [VLC_ADD_PLUGINS([joystick])])
-fi
 
 dnl
 dnl corba (ORBit) plugin
@@ -4585,16 +4950,21 @@ then
   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
   then
     AC_CHECK_PROGS(MIDL, [midl widl], no)
+    AC_LANG_PUSH(C++)
     AC_CHECK_HEADERS(ole2.h olectl.h,
       [ VLC_ADD_CXXFLAGS([activex],[-fno-exceptions])
         VLC_ADD_LDFLAGS([activex],[-lole32 -loleaut32 -luuid -lshlwapi]) 
         AC_CHECK_HEADERS(objsafe.h,
-          VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER])
+          VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER]),,
+          [#if HAVE_OLE2_H
+           #   include <ole2.h>
+           #endif]
         )
         activex=:
       ],
       [ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
     )
+    AC_LANG_POP(C++)
   fi
 fi
 AC_ARG_VAR(MIDL, [Microsoft IDL compiler (Win32 platform only)])
@@ -4610,70 +4980,105 @@ AC_ARG_ENABLE(mozilla,
 AC_ARG_WITH(mozilla-sdk-path,
   [    --with-mozilla-sdk-path=PATH path to mozilla sdk])
 
-if test "${enable_mozilla}" = "yes" -a "${with_mozilla_sdk_path}" = ""
+if test "${enable_mozilla}" = "yes" 
 then
-  AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
-  if test "${MOZILLA_CONFIG}" = "no"
+  if test "${with_mozilla_sdk_path}" = ""
   then
-    AC_MSG_ERROR([Please install the Mozilla development tools, mozilla-config was not found.])
+    AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
+    if test "${MOZILLA_CONFIG}" = "no"
+    then
+      AC_MSG_ERROR([Please install the Mozilla development tools, mozilla-config was not found.])
+    else
+      if test "${SYS}" != "mingw32"; then
+        LDFLAGS="${LDFLAGS_save} ${X_LIBS} ${X_PRE_LIBS}"
+        AC_CHECK_LIB(Xt,XtStrings,
+         [VLC_ADD_LDFLAGS([mozilla],[${X_LIBS} ${X_PRE_LIBS} -lXt -lX11 -lSM -lICE])],
+         [],
+         [[${X_LIBS} ${X_PRE_LIBS} -lX11 -lSM -lICE]
+        ])
+        LDFLAGS="${LDFLAGS_save}"
+      fi
+      mozilla=:
+      dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
+      VLC_ADD_CPPFLAGS([mozilla],[[`${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`]])
+      VLC_ADD_LDFLAGS([mozilla],[`${MOZILLA_CONFIG} --libs plugin xpcom`])
+      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mozilla}"
+      AC_CHECK_HEADERS(mozilla-config.h)
+      CPPFLAGS="${CPPFLAGS_save}"
+      XPIDL_INCL="`${MOZILLA_CONFIG} --cflags plugin xpcom java` \
+      `${MOZILLA_CONFIG} --idlflags plugin xpcom java` "
+      xpidl_path="`${MOZILLA_CONFIG} --prefix`/bin"
+    fi
   else
-    if test "${SYS}" != "mingw32"; then
-      LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
-      AC_CHECK_LIB(Xt,XtStrings,
-       [VLC_ADD_LDFLAGS([mozilla],[-L${x_libraries} -lXt -lX11 -lSM -lICE])],
-       [],
-       [[-L${x_libraries} -lX11 -lSM -lICE]
-      ])
-      LDFLAGS="${LDFLAGS_save}"
+    dnl special case for mingw32
+    if test "${SYS}" = "mingw32"
+    then
+      AC_CHECK_TOOL(CYGPATH, cygpath, "")
+      dnl latest gecko sdk does not have an xpcom directory
+      if test -d "${with_mozilla_sdk_path}/xpcom"; then
+          mozilla_sdk_xpcom="/xpcom"
+      fi
     fi
-    mozilla=:
-    dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
-    VLC_ADD_CPPFLAGS([mozilla],[[`${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`]])
-    VLC_ADD_LDFLAGS([mozilla],[`${MOZILLA_CONFIG} --libs plugin xpcom`])
-    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mozilla}"
-    AC_CHECK_HEADERS(mozilla-config.h)
+  
+    real_mozilla_sdk="`cd ${with_mozilla_sdk_path} 2>/dev/null && pwd`"
+    CPPFLAGS="${CPPFLAGS_save} -I${real_mozilla_sdk} -I${real_mozilla_sdk}/include"
+    AC_CHECK_HEADERS(mozilla-config.h, [
+      mozilla=:
+      VLC_ADD_CPPFLAGS([mozilla],[-DXPCOM_GLUE -DHAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX -I${real_mozilla_sdk} -I${real_mozilla_sdk}/include -I${real_mozilla_sdk}/embedstring/include -I${real_mozilla_sdk}/xpcom/include -I${real_mozilla_sdk}/nspr/include -I${real_mozilla_sdk}/string/include -I${real_mozilla_sdk}/plugin/include -I${real_mozilla_sdk}/java/include])
+      VLC_ADD_LDFLAGS([mozilla],[-L${real_mozilla_sdk}/embedstring/bin -L${real_mozilla_sdk}/xpcom/bin -L${real_mozilla_sdk}/nspr/bin -L${real_mozilla_sdk}/string/bin -L${real_mozilla_sdk}/lib -lnspr4 -lplds4 -lplc4 -lxpcomglue])
+      if test "${SYS}" = "mingw32"; then
+        LDFLAGS="${LDFLAGS_save}"
+        dnl latest gecko sdk does not have embedstring
+        if test -d "${real_mozilla_sdk}/embedstring/bin"
+        then
+          VLC_ADD_LDFLAGS([mozilla],[-lembedstring -Wl,--kill-at])
+        fi
+      fi
+  
+      XPIDL_INCL="-I${real_mozilla_sdk}${mozilla_sdk_xpcom}/idl"
+      xpidl_path="${real_mozilla_sdk}${mozilla_sdk_xpcom}/bin"
+  
+      if test -n "${CYGPATH}"; then
+        real_mozilla_sdk="`${CYGPATH} -w ${real_mozilla_sdk}`"
+        XPIDL_INCL="${XPIDL_INCL} -I\"${real_mozilla_sdk}${mozilla_sdk_xpcom}/idl\""
+      fi ])
     CPPFLAGS="${CPPFLAGS_save}"
   fi
-
-dnl special case for mingw32
-elif test "${enable_mozilla}" = "yes"
-then
-  if test "${SYS}" = "mingw32"; then
-    AC_CHECK_TOOL(CYGPATH, cygpath, "")
-    mozilla_sdk_xpcom="/xpcom"
-  fi
-
-  real_mozilla_sdk="`cd ${with_mozilla_sdk_path} 2>/dev/null && pwd`"
-  CPPFLAGS="${CPPFLAGS_save} -I${real_mozilla_sdk} -I${real_mozilla_sdk}/include"
-  AC_CHECK_HEADERS(mozilla-config.h, [
-    mozilla=:
-    VLC_ADD_CPPFLAGS([mozilla],[-DXPCOM_GLUE -I${real_mozilla_sdk} -I${real_mozilla_sdk}/include -I${real_mozilla_sdk}/embedstring/include -I${real_mozilla_sdk}/xpcom/include -I${real_mozilla_sdk}/nspr/include -I${real_mozilla_sdk}/string/include -I${real_mozilla_sdk}/plugin/include -I${real_mozilla_sdk}/java/include])
-    VLC_ADD_LDFLAGS([mozilla],[-L${real_mozilla_sdk}/embedstring/bin -L${real_mozilla_sdk}/xpcom/bin -L${real_mozilla_sdk}/nspr/bin -L${real_mozilla_sdk}/string/bin -L${real_mozilla_sdk}/lib -lnspr4 -lplds4 -lplc4 -lxpcomglue])
-    if test "${SYS}" = "mingw32"; then
-      VLC_ADD_LDFLAGS([mozilla],[-lembedstring -Wl,--kill-at])
+  
+  if test "${mozilla}" != "false"
+  then
+    build_pic=yes
+    AC_PATH_PROG(XPIDL, xpidl, no, ${xpidl_path} /usr/lib/mozilla)
+    if test "${XPIDL}" = "no"; then
+      AC_MSG_ERROR([Please install the Mozilla development tools, xpidl was not found.])
     fi
+  fi
+fi
+AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
 
-    XPIDL_INCL="-I${real_mozilla_sdk}${mozilla_sdk_xpcom}/idl"
-    XPIDL="${real_mozilla_sdk}${mozilla_sdk_xpcom}/bin/xpidl"
-
-    if test -n "${CYGPATH}"; then
-      real_mozilla_sdk="`${CYGPATH} -w ${real_mozilla_sdk}`"
-      XPIDL_INCL="${XPIDL_INCL} -I\"${real_mozilla_sdk}${mozilla_sdk_xpcom}/idl\""
-    fi ])
-  CPPFLAGS="${CPPFLAGS_save}"
+dnl
+dnl  Mediacontrol Python bindings
+dnl
+AC_ARG_ENABLE(mediacontrol-python-bindings,
+  [  --enable-mediacontrol-python-bindings    Enable Python bindings for MediaControl (default disabled)])
+dnl TODO: look for python dev headers
+AM_CONDITIONAL(BUILD_PYTHON, [test "${enable_mediacontrol_python_bindings}" = "yes"])
+if test "${enable_mediacontrol_python_bindings}" = "yes"
+then
+  build_pic=yes
 fi
 
-dnl Not necessarily in ${PATH}
-if test -z "${XPIDL}" -o ! -x "${XPIDL}"; then
-  XPIDL="/usr/lib/mozilla/xpidl"
+dnl
+dnl  Java bindings
+dnl
+AC_ARG_ENABLE(java-bindings,
+  [  --enable-java-bindings  Enable Java bindings (default disabled)])
+AM_CONDITIONAL(BUILD_JAVA, [test "${enable_java_bindings}" = "yes"])
+if test "${enable_java_bindings}" = "yes"
+then
+  build_pic=yes
 fi
-AS_IF([test "${MOZILLA_CONFIG}"], [
-  if test -z "${XPIDL_INCL}"; then
-    XPIDL_INCL="`${MOZILLA_CONFIG} --cflags plugin xpcom java` \
-    `${MOZILLA_CONFIG} --idlflags plugin xpcom java` "
-  fi
-])
-AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
+
 
 dnl
 dnl  test plugins
@@ -4787,20 +5192,18 @@ then
 fi]
 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
 
-AC_ARG_ENABLE(shared-libvlc,
-  [  --enable-shared-libvlc  shared libvlc (default disabled EXPERIMENTAL)],
-  ,[shared_libvlc=no])
-
+dnl
+dnl Pic and shared libvlc stuff
+dnl
 AM_CONDITIONAL(BUILD_SHARED, [test "${shared_libvlc}" != "no"])
+AM_CONDITIONAL(BUILD_PIC, [test "${build_pic}" = "yes" -o "${shared_libvlc}" != "no"] )
 AS_IF([test "${shared_libvlc}" != "no"], [
   AC_DEFINE(HAVE_SHARED_LIBVLC, 1, [Define to 1 if libvlc is built as a shared library.])
 ])
 
 pic=no
-AS_IF([test "${shared_libvlc}" != "no"], [pic=pic])
-AS_IF([${mozilla}], [pic=pic])
+AS_IF([test "${shared_libvlc}" != "no" -o "${build_pic}" = "yes"], [pic=pic])
 AS_IF([test "${SYS}" = "mingw32"], [pic=no])
-
 AS_IF([test "${pic}" = "no"], [pic=])
 AC_SUBST(pic)
 
@@ -4811,7 +5214,7 @@ dnl
 dnl  Stuff used by the program
 dnl
 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
-AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2005 the VideoLAN team", [Copyright string])
+AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2006 the VideoLAN team", [Copyright string])
 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,"${VERSION_MAJOR}", [version major number])
 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,"${VERSION_MINOR}", [version minor number])
@@ -4837,11 +5240,6 @@ AC_DEFINE_UNQUOTED(MODULE_SYMBOL, $module_symbol, [Symbol suffix for module func
 VLC_ENTRY="vlc_entry__${module_symbol}"
 AC_SUBST(VLC_ENTRY)
 
-DATA_PATH="${ac_tool_prefix}/share/vlc"
-AC_SUBST(DATA_PATH)
-PLUGIN_PATH="${ac_tool_prefix}/lib/vlc"
-AC_SUBST(PLUGIN_PATH)
-
 dnl
 dnl  Handle substvars that use $(top_srcdir)
 dnl
@@ -4874,6 +5272,7 @@ AC_SUBST(XPIDL_INCL)
 AC_SUBST(LIBEXT)
 AC_SUBST(INCLUDES)
 AC_SUBST(ALL_LINGUAS)
+AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
 
 dnl Import substitutions generated by bootstrap
 VLC_SUBSTS
@@ -4885,6 +5284,9 @@ AC_CONFIG_FILES([
   Makefile
   activex/Makefile
   activex/axvlc.inf
+  bindings/Makefile
+  bindings/java/Makefile
+  bindings/mediacontrol-python/Makefile
   debian/Makefile
   doc/Makefile
   intl/Makefile
@@ -4896,6 +5298,7 @@ AC_CONFIG_FILES([
   m4/Makefile
   po/Makefile.in
   share/Makefile
+  src/Makefile
 ])
 
 AC_CONFIG_FILES([
@@ -4980,6 +5383,12 @@ dnl for a in `./vlc-config --target builtin` ; do echo $a; done | sed -e 's,modu
 dnl echo "Enabled plugin modules :"
 dnl for a in `./vlc-config --target plugin` ; do echo $a; done | sed -e 's,modules\/\(.*\)\/lib\(.*\)_plugin,\2 (\1),'
 
+dnl Shortcut to nice compile message
+rm -f compile
+echo '#! /bin/sh' >compile
+echo "PATH=$PATH LANG=C make \$* 2>&1| ${srcdir}/extras/make.pl" >>compile
+chmod a+x compile
+
 printf "
 vlc configuration
 --------------------
@@ -4996,6 +5405,6 @@ echo "
 vlc aliases           :${ALIASES}
 
 You can tune the compiler flags in vlc-config.
-To build vlc and its plugins, type \`make'.
+To build vlc and its plugins, type \`./compile' or \`make'.
 "