]> git.sesse.net Git - vlc/blobdiff - configure.ac
Remove gettext template
[vlc] / configure.ac
index 8fe52bb91d3e921153548d892e406ee7456c0fa7..8567124321715cf78f2e3e1e2d343334a821fd00 100644 (file)
@@ -6,16 +6,16 @@ VERSION_MINOR="9"
 VERSION_REVISION="0"
 VERSION_EXTRA="svn"
 
-CONFIGURE_LINE="$0 $ac_configure_args"
+CONFIGURE_LINE="`echo "$0 $ac_configure_args" | sed -e 's/\\\/\\\\\\\/g'`"
 CODENAME="Grishenko"
 
-AC_PREREQ(2.59)
+AC_PREREQ(2.59) dnl this really should be 2.59c
 AC_CONFIG_SRCDIR(src/libvlc.c)
 AC_CONFIG_AUX_DIR(autotools)
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
-AM_INIT_AUTOMAKE([1.7 check-news dist-bzip2])
+AM_INIT_AUTOMAKE([1.9 check-news dist-bzip2 no-dist-gzip -Wall])
 AM_CONFIG_HEADER(config.h)
 
 dnl Too many people are not aware of maintainer mode:
@@ -26,8 +26,6 @@ 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
 
 dnl
@@ -40,6 +38,7 @@ dnl Check for tools
 dnl
 AC_PROG_CC_C99
 AC_USE_SYSTEM_EXTENSIONS
+AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to `2' to get glibc warnings.])
 AM_PROG_CC_C_O
 AC_PROG_CXX
 AC_PROG_CPP
@@ -165,31 +164,62 @@ case "${host_os}" in
         ;;
     esac
     ;;
-  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}"
-    OBJCFLAGS_save="${OBJCFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS -std=gnu99"; OBJCFLAGS="${OBJCFLAGS_save}"
-    VLC_ADD_LDFLAGS([vlc ffmpeg ffmpegaltivec],[-all_load])
-    VLC_ADD_LDFLAGS([mkv mp4], [-framework IOKit -framework CoreFoundation])
-    VLC_ADD_CFLAGS([libvlc],[-x objective-c])
-    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 -std=gnu99"; OBJCFLAGS="${OBJCFLAGS_save}"
-    VLC_ADD_LDFLAGS([mp4], [-framework IOKit -framework CoreFoundation])
-    VLC_ADD_LDFLAGS([mkv mp4], [-framework IOKit -framework CoreFoundation])
-    VLC_ADD_CFLAGS([libvlc],[-x objective-c])
-    VLC_ADD_CFLAGS([vlc],[-x objective-c])
+    VLC_ADD_LDFLAGS([mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
+    VLC_ADD_LDFLAGS([mkv mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
+    VLC_ADD_CFLAGS([libvlc vlc],[-x objective-c])
+    VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup])
+    VLC_ADD_LDFLAGS([libvlc_control],[-Wl,dynamic_lookup])
+    VLC_ADD_LDFLAGS([ffmpeg i420_rgb_mmx],[-Wl,-read_only_relocs,suppress])
+    VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
+    VLC_ADD_LDFLAGS([libvlc],[-Wl,-framework,Cocoa,-framework,CoreFoundation])
+    VLC_ADD_LDFLAGS([motion],[-Wl,-framework,IOKit,-framework,CoreFoundation])
+    AC_ARG_ENABLE(macosx-defaults,
+        [  --enable-macosx-defaults Build the default configuration on Mac OS X (default enabled)])
+    if test "x${enable_macosx_defaults}" != "xno"
+    then
+        echo ""
+        echo "Building with Mac OS X defaults:"
+        enable_faad="yes"
+        echo "  Assuming --enable-faad"
+        enable_flac="yes"
+        echo "  Assuming --enable-flac"
+        enable_theora="yes"
+        echo "  Assuming --enable-theora"
+        enable_shout="yes"
+        echo "  Assuming --enable-shout"
+        enable_cddax="yes"
+        echo "  Assuming --enable-cddax"
+        enable_vcdx="yes"
+        echo "  Assuming --enable-vcdx"
+        enable_caca="yes"
+        echo "  Assuming --enable-caca"
+        enable_goom="yes"
+        echo "  Assuming --enable-goom"
+        enable_ncurses="yes"
+        echo "  Assuming --enable-ncurses"
+        enable_twolame="yes"
+        echo "  Assuming --enable-twolame"
+        enable_realrtsp="yes"
+        echo "  Assuming --enable-realrtsp"
+
+        enable_skins2="no"
+        echo "  Assuming --disable-skins2"
+        enable_x11="no"
+        echo "  Assuming --disable-x11"
+        enable_glx="no"
+        echo "  Assuming --disable-glx"
+        enable_xvideo="no"
+        echo "  Assuming --disable-xvideo"
+
+    fi
     ;;
   *mingw32* | *cygwin* | *wince* | *mingwce* | *pe*)
     AC_CHECK_TOOL(WINDRES, windres, :)
-    enable_libtool="no"
 
     case "${host_os}" in
       *mingw32*)
@@ -211,16 +241,15 @@ case "${host_os}" in
 
     if test "${SYS}" = "mingw32"; then
         # 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([cdda vcdx cddax],[-lwinmm])
-        VLC_ADD_LDFLAGS([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])
+        VLC_ADD_LDFLAGS([libvlc],[-lws2_32 -lnetapi32 -lwinmm])
+        VLC_ADD_LDFLAGS([vlc activex mozilla],[-mwindows])
+        VLC_ADD_LDFLAGS([cdda vcdx cddax sdl_image],[-lwinmm])
+        VLC_ADD_LDFLAGS([access_http access_mms access_udp access_tcp access_ftp access_output_udp access_output_shout sap slp http stream_out_standard stream_out_rtp vod_rtsp access_realrtsp telnet rc netsync gnutls growl flac ts audioscrobbler],[-lws2_32])
     fi
     if test "${SYS}" = "mingwce"; then
         # add ws2 for closesocket, select, recv
-        CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"; CPPFLAGS="${CPPFLAGS_save}"
-        VLC_ADD_CPPFLAGS([vlc],[-Dmain(a,b)=maince(a,b)])
-        VLC_ADD_LDFLAGS([vlc],[-lws2 -e WinMainCRTStartup])
+        VLC_ADD_CPPFLAGS([libvlc vlc],[-Dmain(a,b)=maince(a,b)])
+        VLC_ADD_LDFLAGS([libvlc vlc],[-lws2 -e WinMainCRTStartup])
         VLC_ADD_LDFLAGS([access_http access_mms access_udp access_tcp access_ftp access_output_udp sap http netsync],[-lws2])
    fi
     ;;
@@ -242,16 +271,16 @@ case "${host_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 logger],[-lbe])
+    VLC_ADD_LDFLAGS([vlc libvlc logger],[-lbe])
     VLC_ADD_LDFLAGS([beos],[-lbe -lmedia -ltranslation -ltracker -lgame])
     VLC_ADD_LDFLAGS([dvdnav dvdread],[-ldl])
     VLC_ADD_LDFLAGS([access_file],[-lpoll])
     LDFLAGS_save="${LDFLAGS_save} -lintl"; LDFLAGS="${LDFLAGS_save}"
     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 vlc growl],[-lbind -lsocket])
+        VLC_ADD_LDFLAGS([access_file access_ftp access_mms access_output_udp telnet netsync sap libvlc growl],[-lbind -lsocket])
     else
-        VLC_ADD_LDFLAGS([access_file access_ftp access_mms access_output_udp telnet netsync sap vlc growl],[-lnet])
+        VLC_ADD_LDFLAGS([access_file access_ftp access_mms access_output_udp telnet netsync sap libvlc growl],[-lnet])
     fi
 
     dnl Ugly check for Zeta
@@ -269,41 +298,71 @@ AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
 AM_CONDITIONAL(HAVE_WINCE, test "${SYS}" = "mingwce")
 
 dnl
+dnl Sadly autoconf doesn't think about testing foo.exe when ask to test 
+dnl for program foo on win32
+
+case "${build_os}" in
+    cygwin|msys)
+        ac_executable_extensions=".exe"
+       ;;
+    *)
+       ;;
+esac
+
+dnl 
 dnl  Libtool
 dnl  It's very bad, but our former custom system was worst
 dnl  -- Courmisch
 dnl
+
+dnl override platform specific check for dependent libraries
+dnl otherwise libtool linking of shared libraries will
+dnl fail on anything other than pass_all.
+AC_CACHE_VAL(lt_cv_deplibs_check_method,
+    [lt_cv_deplibs_check_method=pass_all])
+
 AC_DISABLE_STATIC
 AC_LIBTOOL_DLOPEN
-dnl AC_LIBTOOL_WIN32_DLL - couldn't get libtool to work on Win32 so far
+AC_LIBTOOL_WIN32_DLL
 m4_undefine([AC_PROG_F77])
 m4_defun([AC_PROG_F77],[])
 AC_PROG_LIBTOOL
 
+m4_undefine([AC_DEPLIBS_CHECK_METHOD])
+m4_defun([AC_DEPLIBS_CHECK_METHOD],[])
+
 AC_ARG_ENABLE(libtool,
-    [  --enable-libtool        use libtool (default disabled)])
-AM_CONDITIONAL(USE_LIBTOOL, [test "x${enable_libtool}" != "xno"])
+    [  --enable-libtool        use libtool (default enabled)])
+AS_IF([test "x{enable_libtool}" = "xno"], [
+       AC_MSG_WARN([Disabling libtool is strongly discouraged. There are known bugs.])
+])
+AM_CONDITIONAL(USE_LIBTOOL, [test "x${enable_libtool}" != "xno"] )
+
+lt_cv_deplibs_check_method=pass_all
 
 
 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)
+   [  --with-macosx-sdk       compile with the Mac OS X 10.4u 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"
+    CC="${CC} -isysroot /Developer/SDKs/MacOSX10.4u.sdk" 
+    CXX="${CXX} -isysroot /Developer/SDKs/MacOSX10.4u.sdk" 
+    OBJC="${OBJC} -isysroot /Developer/SDKs/MacOSX10.4u.sdk" 
+    LD="${LD} -syslibroot /Developer/SDKs/MacOSX10.4u.sdk"
+    CFLAGS_save="${CFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=10.4 -mmacosx-version-min=10.4"; CFLAGS="${CFLAGS_save}"
+    CXXFLAGS_save="${CXXFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=10.4 -mmacosx-version-min=10.4"; CXXFLAGS="${CXXFLAGS_save}"
+    OBJCFLAGS_save="${OBJCFLAGS_save} -DMACOSX_DEPLOYMENT_TARGET=10.4 -mmacosx-version-min=10.4"; OBJCFLAGS="${OBJCFLAGS_save}"
+    MACOSX_DEPLOYMENT_TARGET="10.4"
+    export MACOSX_DEPLOYMENT_TARGET
 fi
 
 dnl
 dnl Gettext stuff
 dnl
-ALL_LINGUAS="af ar bn ca co cs da de el en_GB es eu fr fur gl he hi hu it ja ka ko lt lv ms my nb ne nl nn no oc pa pl ps pt_BR pt_PT ro ru sk sl sq sv tet th tl tr zh_CN zh_TW"
-AM_GNU_GETTEXT_VERSION(0.11.5)
+ALL_LINGUAS="af ar bn ca co cs da de el en_GB es eu fa fr fur gl he hi hu it ja ka ko lt lv ms my ne nl no oc pa pl ps pt_BR pt_PT ro ru sk sl sq sv tet th tl tr zh_CN zh_TW"
+AM_GNU_GETTEXT_VERSION(0.16.1)
 AM_GNU_GETTEXT
 AS_IF([test "${nls_cv_force_use_gnu_gettext}" = "yes"], [
   AC_DEFINE(HAVE_INCLUDED_GETTEXT, 1, [Define if we use the local libintl])
@@ -315,13 +374,12 @@ AS_IF([test "${nls_cv_force_use_gnu_gettext}" = "yes"], [
   ])
 ], [
   AS_IF([test "${enable_libtool}" != "no"], [
-    VLC_ADD_LDFLAGS([vlc], [${LTLIBINTL}])
+    VLC_ADD_LDFLAGS([libvlc vlc], [${LTLIBINTL}])
   ], [
-    VLC_ADD_LDFLAGS([vlc], [${LIBINTL}])
+    VLC_ADD_LDFLAGS([libvlc vlc], [${LIBINTL}])
   ])
 ])
 AC_SUBST(INCLUDED_LIBINTL)
-XGETTEXT="${XGETTEXT} --keyword=_NS --keyword=_ANS" 
 
 dnl
 dnl Iconv stuff
@@ -330,19 +388,19 @@ if test "${SYS}" != "mingwce"; then
 AS_IF([test "$am_cv_func_iconv" != "yes"],
        [AC_MSG_ERROR([libiconv is needed for VLC to work properly])])
 fi
-VLC_ADD_CFLAGS([vlc],[${INCICONV}])
+VLC_ADD_CFLAGS([libvlc],[${INCICONV}])
 AS_IF([test "${enable_libtool}" != "no"], [
-  VLC_ADD_LDFLAGS([vlc],[${LIBICONV}])
+  VLC_ADD_LDFLAGS([libvlc vlc],[${LIBICONV}])
 ],[
-  VLC_ADD_LDFLAGS([vlc],[${LTLIBICONV}])
+  VLC_ADD_LDFLAGS([libvlc vlc],[${LTLIBICONV}])
 ])
 
 dnl Check for the need to include the mingwex lib for mingw32
 if test "${SYS}" = "mingw32"
 then
     AC_CHECK_LIB(mingwex,opendir,
-        AC_CHECK_LIB(mingw32,opendir,VLC_ADD_LDFLAGS([vlc],[]),
-            [VLC_ADD_LDFLAGS([vlc gtk],[-lmingwex])])
+        AC_CHECK_LIB(mingw32,opendir,VLC_ADD_LDFLAGS([libvlc],[]),
+            [VLC_ADD_LDFLAGS([libvlc gtk],[-lmingwex])])
     )
 fi
 
@@ -421,7 +479,7 @@ need_libc=false
 AC_CHECK_FUNCS(gettimeofday 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 strlcpy)
 
 dnl Check for usual libc functions
-AC_CHECK_FUNCS(strdup strndup atof)
+AC_CHECK_FUNCS(strdup strndup strnlen atof)
 AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
 AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
 AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
@@ -444,7 +502,7 @@ fi
 
 AC_CHECK_FUNCS(connect,,[
   AC_CHECK_LIB(socket,connect,[
-    VLC_ADD_LDFLAGS([vlc cdda cddax],-lsocket)
+    VLC_ADD_LDFLAGS([libvlc cdda cddax],-lsocket)
     LIBS_socket="-lsocket"
   ])
 ])
@@ -457,7 +515,7 @@ AC_CHECK_FUNCS(send,,[
 
 AC_CHECK_FUNCS(gethostbyname,,[
   AC_CHECK_LIB(nsl,gethostbyname,[
-    VLC_ADD_LDFLAGS([cdda cddax vlc],[-lnsl])
+    VLC_ADD_LDFLAGS([cdda cddax libvlc],[-lnsl])
   ],[
     AC_CHECK_LIB(bind,gethostbyname,[
       VLC_ADD_LDFLAGS([access_mms],[-lbind])
@@ -545,7 +603,7 @@ fi
 
 AC_CHECK_FUNCS(inet_aton,,[
   AC_CHECK_LIB(resolv,inet_aton,[
-    VLC_ADD_LDFLAGS([vlc],[-lresolv])
+    VLC_ADD_LDFLAGS([libvlc],[-lresolv])
   ])
 ])
 
@@ -558,7 +616,7 @@ AC_CHECK_FUNCS(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
 [ # FreeBSD has a gnugetopt library for this:
   AC_CHECK_LIB([gnugetopt],[getopt_long],
     [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support)
-     VLC_ADD_LDFLAGS([vlc],[-lgnugetopt])],
+     VLC_ADD_LDFLAGS([libvlc],[-lgnugetopt])],
     [need_getopt=:])])
 fi
 AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
@@ -566,17 +624,20 @@ AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
 AC_TYPE_SIGNAL
 AC_CHECK_LIB(m,cos,[
-  VLC_ADD_LDFLAGS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise],[-lm])
+  VLC_ADD_LDFLAGS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain],[-lm])
 ])
 AC_CHECK_LIB(m,pow,[
-  VLC_ADD_LDFLAGS([ffmpeg ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer param_eq vlc vorbis freetype mod mpc dmo quicktime realaudio galaktos opengl],[-lm])
+  VLC_ADD_LDFLAGS([ffmpeg ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer param_eq libvlc vorbis freetype mod mpc dmo quicktime realaudio galaktos opengl],[-lm])
 ])
 AC_CHECK_LIB(m,sqrt,[
-  VLC_ADD_LDFLAGS([headphone_channel_mixer normvol speex mono colorthres],[-lm])
+  VLC_ADD_LDFLAGS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm])
 ])
 AC_CHECK_LIB(m,ceil,[
   VLC_ADD_LDFLAGS([mosaic],[-lm])
 ])
+AC_CHECK_LIB(m,exp,[
+  VLC_ADD_LDFLAGS([gaussianblur],[-lm])
+])
 AC_CHECK_LIB(mx,sqrtf,[
   VLC_ADD_LDFLAGS([x264],[-lmx])
 ])
@@ -599,7 +660,7 @@ if test "${ac_cv_have_plugins}" = "no"; then
    [ac_cv_my_have_shl_load=yes,
     AC_CHECK_LIB(dld, shl_load,
      [ac_cv_my_have_shl_load=yes
-      VLC_ADD_LDFLAGS([vlc],[-ldld])])])
+      VLC_ADD_LDFLAGS([libvlc],[-ldld])])])
   if test "${ac_cv_my_have_shl_load}" = "yes"; then
     AC_DEFINE(HAVE_DL_SHL_LOAD, 1, [Define if you have the shl_load API])
     ac_cv_have_plugins=yes
@@ -609,7 +670,7 @@ fi
 # Whatever style
 if test "${ac_cv_have_plugins}" = "no"; then
   AC_CHECK_LIB(dld, dld_link,
-   [VLC_ADD_LDFLAGS([vlc],[-ldld])
+   [VLC_ADD_LDFLAGS([libvlc],[-ldld])
     AC_DEFINE(HAVE_DL_DLD_LINK, 1, [Define if you have the GNU dld library])
     ac_cv_have_plugins=yes])
 fi
@@ -618,7 +679,7 @@ fi
 if test "${ac_cv_have_plugins}" = "no"; then
   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
     AC_CHECK_LIB(kernel32, main,
-     [VLC_ADD_LDFLAGS([vlc],[-lkernel32])
+     [VLC_ADD_LDFLAGS([libvlc],[-lkernel32])
       AC_DEFINE(HAVE_DL_WINDOWS, 1, [Define if you have Windows' LoadLibrary])
       ac_cv_have_plugins=yes])
   fi
@@ -648,10 +709,10 @@ if test "${ac_cv_have_plugins}" = "no"; then
     ac_cv_my_have_dlopen=yes,
     AC_CHECK_LIB(dl, dlopen,
       ac_cv_my_have_dlopen=yes
-      VLC_ADD_LDFLAGS([vlc],[-ldl]),
+      VLC_ADD_LDFLAGS([libvlc],[-ldl]),
       AC_CHECK_LIB(svld, dlopen,
         ac_cv_my_have_dlopen=yes
-        VLC_ADD_LDFLAGS([vlc],[-lsvld]))))
+        VLC_ADD_LDFLAGS([libvlc],[-lsvld]))))
   if test "${ac_cv_my_have_dlopen}" = "yes"; then
     AC_DEFINE(HAVE_DL_DLOPEN, 1, [Define if you have the dlopen API])
     ac_cv_have_plugins=yes
@@ -716,24 +777,24 @@ AC_ARG_ENABLE(st,
     fi
 ])
 
-VLC_ADD_LDFLAGS([vlc plugin],[${THREAD_LIB}])
+VLC_ADD_LDFLAGS([libvlc plugin],[${THREAD_LIB}])
 
 dnl Don't link with rt when using GNU-pth
 if test "${THREAD_LIB}" != "-lpth" && test "${THREAD_LIB}" != "-lst"; then
   AC_CHECK_LIB(rt, clock_nanosleep, [
-    VLC_ADD_LDFLAGS([vlc],[-lrt])
+    VLC_ADD_LDFLAGS([libvlc],[-lrt])
     AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define to 1 if you have clock_nanosleep.])
   ], [
     dnl HP/UX port
-    AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LDFLAGS([vlc],[-lrt])])
+    AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LDFLAGS([libvlc],[-lrt])])
   ])
 
   have_nanosleep=false
   AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
     AC_CHECK_LIB(rt,nanosleep,
-      [VLC_ADD_LDFLAGS([vlc],[-lrt]) have_nanosleep=:],
+      [VLC_ADD_LDFLAGS([libvlc],[-lrt]) have_nanosleep=:],
       [AC_CHECK_LIB(posix4,nanosleep,
-          [VLC_ADD_LDFLAGS([vlc],[-lposix4]) have_nanosleep=:])]
+          [VLC_ADD_LDFLAGS([libvlc],[-lposix4]) have_nanosleep=:])]
     )
   ])
   if ${have_nanosleep}; then
@@ -766,9 +827,9 @@ AC_EGREP_HEADER(strncasecmp,strings.h,[
   AC_MSG_RESULT(no)])
 
 dnl Check for headers
-AC_CHECK_HEADERS(signal.h time.h errno.h stdint.h stdbool.h getopt.h strings.h inttypes.h sys/int_types.h wchar.h)
+AC_CHECK_HEADERS(signal.h time.h errno.h stdint.h stdbool.h getopt.h strings.h inttypes.h sys/int_types.h wchar.h locale.h)
 AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h)
-AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
+AC_CHECK_HEADERS([arpa/inet.h net/if.h netinet/in.h sys/socket.h netinet/udplite.h])
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
 AC_CHECK_HEADERS(machine/param.h sys/shm.h)
 AC_CHECK_HEADERS(linux/version.h)
@@ -829,14 +890,14 @@ then
     [ AC_DEFINE( HAVE_HAL_1, [] , [Define if you have the new HAL library API])
       AC_DEFINE( HAVE_HAL, [], [Define if you have the HAL library] )
       VLC_ADD_PLUGINS([hal probe_hal]) 
-      VLC_ADD_LDFLAGS([vlc hal probe_hal],[$HAL_LIBS])
-      VLC_ADD_CFLAGS([vlc hal probe_hal],[$HAL_CFLAGS])],   
+      VLC_ADD_LDFLAGS([libvlc hal probe_hal],[$HAL_LIBS])
+      VLC_ADD_CFLAGS([libvlc hal probe_hal],[$HAL_CFLAGS])],   
     dnl No hal 0.5 Test for 0.2
     [ PKG_CHECK_MODULES( HAL, hal >= 0.2.97, 
        [AC_DEFINE(HAVE_HAL, [], [Define if you have the HAL library])
         VLC_ADD_PLUGINS([hal])
-        VLC_ADD_LDFLAGS([vlc hal],[$HAL_LIBS])
-        VLC_ADD_CFLAGS([vlc hal],[$HAL_CFLAGS])],
+        VLC_ADD_LDFLAGS([libvlc hal],[$HAL_LIBS])
+        VLC_ADD_CFLAGS([libvlc hal],[$HAL_CFLAGS])],
        [AC_MSG_WARN(HAL library not found)])
     ]
   )
@@ -845,7 +906,8 @@ fi
 dnl Check for dbus
 AC_ARG_ENABLE(dbus,
   [  --enable-dbus           Linux D-BUS message bus system (default enabled)])
+case "${SYS}" in
+    linux*|*bsd*)
 if test "${enable_dbus}" != "no"
 then
   dnl api stable dbus
@@ -854,11 +916,11 @@ then
       AC_DEFINE( HAVE_DBUS_2, 1, [Define if you have the D-BUS library API >= 0.92] )
       AC_DEFINE( HAVE_DBUS_1, 1, [Define if you have the D-BUS library API >= 0.30] )
       AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
-      VLC_ADD_LDFLAGS([screensaver vlc],[$DBUS_LIBS])
-      VLC_ADD_CFLAGS([screensaver vlc],[$DBUS_CFLAGS])
+      VLC_ADD_LDFLAGS([screensaver libvlc],[$DBUS_LIBS])
+      VLC_ADD_CFLAGS([screensaver libvlc],[$DBUS_CFLAGS])
       dnl Check for dbus control interface
-        AC_ARG_ENABLE(dbus-control, [  --enable-dbus-control   D-BUS control interface (default disabled)])
-        if test "${enable_dbus_control}" = "yes"
+        AC_ARG_ENABLE(dbus-control, [  --disable-dbus-control   D-BUS control interface (default enabled)])
+        if test "${enable_dbus_control}" != "no"
         then
           VLC_ADD_PLUGINS([dbus])
           VLC_ADD_LDFLAGS([dbus],[$DBUS_LIBS])
@@ -909,6 +971,8 @@ then
     fi
   )
 fi
+;;
+esac
 
 dnl Build the gtk_main plugins?
 NEED_GTK_MAIN=no
@@ -936,47 +1000,60 @@ RDC_PROG_CC_FLAGS_IFELSE([-pipe])
 
 dnl This helps detect broken plugins with undefined symbols
 dnl Better fail loudly at build-time than silenty at run-time.
-RDC_PROG_LINK_FLAGS_IFELSE([-Wl,-z,defs], [
-  VLC_ADD_LDFLAGS([plugin],[-Wl,-z,defs])
-])
+dnl Unfortunately, this sucks on FreeBSD (won't even link with -lc)
+dnl RDC_PROG_LINK_FLAGS_IFELSE([-Wl,-z,defs], [
+dnl   VLC_ADD_LDFLAGS([plugin],[-Wl,-z,defs])
+dnl ])
 
 dnl Check for various optimization flags
 AC_CACHE_CHECK([if \$CC accepts -Os],
     [ac_cv_c_os],
     [CFLAGS="${CFLAGS_save} -Os"
      AC_TRY_COMPILE([],,ac_cv_c_os=yes, ac_cv_c_os=no)])
-if test "${ac_cv_c_os}" != "no" -a "${host_cpu}" = "mipsel"; then
-    CFLAGS_OPTIM="${CFLAGS_OPTIM} -Os"
+if test "${ac_cv_c_os}" != "no"; then
+    CFLAGS_OPTIM_SIZE="${CFLAGS_OPTIM_SIZE} -Os"
+else 
+    AC_CACHE_CHECK([if \$CC accepts -O],
+        [ac_cv_c_o],
+        [CFLAGS="${CFLAGS_save} -O"
+         AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
+    if test "${ac_cv_c_o}" != "no"; then
+        if test "${ac_cv_c_o3}" = "no"; then
+            CFLAGS_OPTIM_SIZE="${CFLAGS_OPTIM_SIZE} -O"
+        fi
+    fi
 fi
 
 AC_CACHE_CHECK([if \$CC accepts -O3],
     [ac_cv_c_o3],
     [CFLAGS="${CFLAGS_save} -O3"
      AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
-if test "${ac_cv_c_o3}" != "no" -a "${host_cpu}" != "mipsel"; then
-    CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
+if test "${ac_cv_c_o3}" != "no"; then
+    CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O3"
+else
+    AC_CACHE_CHECK([if \$CC accepts -O2],
+        [ac_cv_c_o2],
+        [CFLAGS="${CFLAGS_save} -O2"
+         AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
+    if test "${ac_cv_c_o2}" != "no"; then
+        CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O2"
+    else
+        AC_CACHE_CHECK([if \$CC accepts -O],
+            [ac_cv_c_o],
+            [CFLAGS="${CFLAGS_save} -O"
+             AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
+        if test "${ac_cv_c_o}" != "no"; then
+            CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O"
+        fi
+    fi
 fi
 
-AC_CACHE_CHECK([if \$CC accepts -O2],
-    [ac_cv_c_o2],
-    [CFLAGS="${CFLAGS_save} -O2"
-     AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
-if test "${ac_cv_c_o2}" != "no" -a "${host_cpu}" != "mipsel"; then
-    if test "${ac_cv_c_o3}" = "no"; then
-        CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
-    fi
-    CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O2"
-else 
-    AC_CACHE_CHECK([if \$CC accepts -O],
-        [ac_cv_c_o],
-        [CFLAGS="${CFLAGS_save} -O"
-         AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
-    if test "${ac_cv_c_o}" != "no" -a "${host_cpu}" != "mipsel"; then
-        if test "${ac_cv_c_o3}" = "no"; then
-            CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
-       fi
-        CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O"
-    fi
+AC_CACHE_CHECK([if \$CC accepts -O0],
+    [ac_cv_c_o0],
+    [CFLAGS="${CFLAGS_save} -O0"
+     AC_TRY_COMPILE([],,ac_cv_c_o0=yes, ac_cv_c_o0=no)])
+if test "${ac_cv_c_o0}" != "no"; then
+    CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O0"
 fi
 
 dnl Check for -ffast-math
@@ -985,7 +1062,7 @@ AC_CACHE_CHECK([if \$CC accepts -ffast-math],
     [CFLAGS="${CFLAGS_save} -ffast-math"
      AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
 if test "${ac_cv_c_fast_math}" != "no"; then
-    CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
+    CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -ffast-math"
 fi
 
 dnl Check for -funroll-loops
@@ -997,7 +1074,7 @@ then
       [CFLAGS="${CFLAGS_save} -funroll-loops"
        AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
   if test "${ac_cv_c_unroll_loops}" != "no"; then
-      CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
+      CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -funroll-loops"
   fi
 fi
 
@@ -1008,9 +1085,30 @@ AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
      AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
 if test "${ac_cv_c_omit_frame_pointer}" != "no"; then
     CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
-    # this plugin does not compile without -fomit-frame-pointer, damn gcc!
-    VLC_ADD_CFLAGS([i420_yuy2_mmx],[-fomit-frame-pointer])
-fi
+    # these plugins do not compile without -fomit-frame-pointer, damn gcc!
+    VLC_ADD_CFLAGS([i420_yuy2_mmx i420_yuy2_sse2],[-fomit-frame-pointer])
+fi
+
+dnl Check for -fvisibility=hidden
+AC_CACHE_CHECK([if \$CC accepts -fvisibility=hidden],
+    [ac_cv_c_visibility_hidden],
+    [CFLAGS="${CFLAGS_save} -fvisibility=hidden"
+     AC_TRY_COMPILE([],,ac_cv_c_visibility_hidden=yes, ac_cv_c_visibility_hidden=no)])
+if test "${ac_cv_c_visibility_hidden}" != "no"; then
+    VLC_ADD_CFLAGS([libvlc plugin],[-fvisibility=hidden])
+fi
+
+dnl Check for -fvisibility-inlines-hidden (breaks x86_64 linkers)
+dnl AC_LANG_PUSH(C++)
+dnl     AC_CACHE_CHECK([if \$CXX accepts -fvisibility-inlines-hidden],
+dnl         [ac_cv_c_visibility_inlines_hidden],
+dnl         [CXXFLAGS="${CXXFLAGS_save} -fvisibility-inlines-hidden"
+dnl          AC_TRY_COMPILE([],,ac_cv_c_visibility_inlines_hidden=yes, ac_cv_c_visibility_inlines_hidden=no)])
+dnl     if test "${ac_cv_c_visibility_inlines_hidden}" != "no"; then
+dnl         VLC_ADD_CXXFLAGS([libvlc plugin],[-fvisibility-inlines-hidden])
+dnl     fi
+dnl     CXXFLAGS="${CXXFLAGS_save}"
+dnl AC_LANG_POP(C++)
 
 dnl Check for -mdynamic-no-pic
 AC_CACHE_CHECK([if \$CC accepts -mdynamic-no-pic],
@@ -1090,7 +1188,7 @@ if test "${ac_cv_c_attribute_format}" != "no"; then
     AC_DEFINE(HAVE_ATTRIBUTE_FORMAT, 1, Support for __attribute__((format())) with function pointers)
 fi
 
-dnl Check for __attribute__(())
+dnl Check for __attribute__((packed))
 AC_CACHE_CHECK([for __attribute__((packed))],
   [ac_cv_c_attribute_packed],
   [ac_cv_c_attribute_packed=no
@@ -1100,6 +1198,16 @@ if test "${ac_cv_c_attribute_packed}" != "no"; then
   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
 fi
 
+dnl Check for __attribute__((visibility()))
+AC_CACHE_CHECK([for __attribute__((visibility()))],
+  [ac_cv_c_attribute_visibility],
+  [ac_cv_c_attribute_visibility=no
+   AC_TRY_COMPILE(, [extern __attribute__((visibility("default"))) int foo(int);],
+                    [ac_cv_c_attribute_visibility=yes])])
+if test "${ac_cv_c_attribute_visibility}" != "no"; then
+  AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1, Support for __attribute__((visibility())) for exporting symbols)
+fi
+
 dnl
 dnl  Check the CPU
 dnl
@@ -1126,9 +1234,9 @@ dnl
 dnl  default modules
 dnl
 VLC_ADD_PLUGINS([dummy logger memcpy])
-VLC_ADD_PLUGINS([mpgv mpga m4v m4a h264 ps pva avi asf mp4 rawdv nsv real aiff mjpeg demuxdump flacsys tta])
+VLC_ADD_PLUGINS([mpgv mpga m4v m4a h264 vc1 ps pva avi asf mp4 rawdv rawvid nsv real aiff mjpeg demuxdump flacsys tta])
 VLC_ADD_PLUGINS([cvdsub svcdsub spudec subsdec dvbsub mpeg_audio lpcm a52 dts cinepak flac])
-VLC_ADD_PLUGINS([deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise])
+VLC_ADD_PLUGINS([deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise grain extract sharpen])
 VLC_ADD_PLUGINS([converter_fixed mono])
 VLC_ADD_PLUGINS([trivial_resampler ugly_resampler])
 VLC_ADD_PLUGINS([trivial_channel_mixer trivial_mixer])
@@ -1137,14 +1245,16 @@ VLC_ADD_PLUGINS([i420_rgb rawvideo blend scale image logo magnify puzzle colorth
 VLC_ADD_PLUGINS([wav araw subtitle vobsub adpcm a52sys dtssys au ty voc xa nuv])
 VLC_ADD_PLUGINS([access_directory access_file access_udp access_tcp])
 VLC_ADD_PLUGINS([access_http access_mms access_ftp])
+VLC_ADD_PLUGINS([access_filter_bandwidth])
 VLC_ADD_PLUGINS([packetizer_mpegvideo packetizer_h264])
 VLC_ADD_PLUGINS([packetizer_mpeg4video packetizer_mpeg4audio])
+VLC_ADD_PLUGINS([packetizer_vc1])
 
 
 if test "${SYS}" != "mingwce"; then
   VLC_ADD_PLUGINS([access_fake access_filter_timeshift access_filter_record access_filter_dump])
   VLC_ADD_PLUGINS([gestures rc telnet hotkeys netsync showintf marq podcast shout sap fake folder])
-  VLC_ADD_PLUGINS([rss mosaic wall motiondetect clone crop])
+  VLC_ADD_PLUGINS([rss mosaic wall motiondetect clone crop erase bluescreen alphamask gaussianblur])
   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])
@@ -1173,34 +1283,24 @@ elif test "${SYS}" != "mingwce"; then
 else
     VLC_ADD_PLUGINS([win32text])
 fi
+if test "${SYS}" = "darwin"; then
+    VLC_ADD_PLUGINS([quartztext])
+    VLC_ADD_LDFLAGS([quartztext],[-Wl,-framework,Carbon,-framework,ApplicationServices])
+fi
 
 dnl
 dnl  Accelerated modules
 dnl
-MMX_MODULES="memcpymmx i420_rgb_mmx i422_yuy2_mmx i420_ymga_mmx"
+MMX_MODULES="memcpymmx i420_rgb_mmx i420_yuy2_mmx i422_yuy2_mmx i420_ymga_mmx"
 #MMX_MODULES="${MMX_MODULES} idctmmx motionmmx"
 MMXEXT_MODULES="memcpymmxext"
 #MMXEXT_MODULES="${MMXEXT_MODULES} idctmmxext motionmmxext"
 THREEDNOW_MODULES="memcpy3dn"
 SSE_MODULES=""
+SSE2_MODULES="i420_rgb_sse2 i420_yuy2_sse2"
 ALTIVEC_MODULES="memcpyaltivec i420_yuy2_altivec"
 #ALTIVEC_MODULES="${ALTIVEC_MODULES} idctaltivec motionaltivec"
 
-if test "${enable_gprof}" != "yes"
-then
-  MMX_MODULES="${MMX_MODULES} i420_yuy2_mmx"
-fi
-
-AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
-    [ac_cv_mmx_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
-                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
-if test "${ac_cv_mmx_inline}" != "no"; then
-  AC_DEFINE(CAN_COMPILE_MMX, 1, Define if \$CC groks MMX inline assembly.)
-  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
-fi
-
 dnl  Check for fully workin MMX intrinsics
 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
@@ -1226,6 +1326,41 @@ if test "${ac_cv_c_mmx_intrinsics}" != "no"; then
   VLC_ADD_CFLAGS([i420_rgb_mmx],[-mmmx])
 fi
 
+dnl  Check for fully workin SSE2 intrinsics
+dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
+dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
+AC_CACHE_CHECK([if \$CC groks SSE2 intrinsics],
+    [ac_cv_c_sse2_intrinsics],
+    [CFLAGS="${CFLAGS_save} -O -msse2"
+     AC_TRY_COMPILE([#include <emmintrin.h>
+                     #include <stdint.h>
+                     uint64_t frobzor;],
+                    [__m128i a, b, c;
+                     a = b = c = _mm_set1_epi64((__m64)frobzor);
+                     a = _mm_slli_epi16(a, 3);
+                     a = _mm_adds_epi16(a, b);
+                     c = _mm_srli_epi16(c, 8);
+                     c = _mm_slli_epi16(c, 3);
+                     b = _mm_adds_epi16(b, c);
+                     a = _mm_unpacklo_epi8(a, b);
+                     frobzor = (uint64_t)_mm_movepi64_pi64(a);],
+                    [ac_cv_c_sse2_intrinsics=yes],
+                    [ac_cv_c_sse2_intrinsics=no])])
+if test "${ac_cv_c_sse2_intrinsics}" != "no"; then
+  AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, Define if SSE2 intrinsics are available.)
+  VLC_ADD_CFLAGS([i420_rgb_sse2],[-msse2])
+fi
+
+AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
+    [ac_cv_mmx_inline],
+    [CFLAGS="${CFLAGS_save}"
+     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
+                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
+if test "${ac_cv_mmx_inline}" != "no"; then
+  AC_DEFINE(CAN_COMPILE_MMX, 1, Define if \$CC groks MMX inline assembly.)
+  ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
+fi
+
 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
     [ac_cv_mmxext_inline],
     [CFLAGS="${CFLAGS_save}"
@@ -1256,6 +1391,16 @@ if test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"; then
   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
 fi
 
+AC_CACHE_CHECK([if \$CC groks SSE2 inline assembly],
+    [ac_cv_sse2_inline],
+    [CFLAGS="${CFLAGS_save}"
+     AC_TRY_COMPILE(,[void *p;asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p));],
+                    ac_cv_sse2_inline=yes, ac_cv_sse2_inline=no)])
+if test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"; then
+  AC_DEFINE(CAN_COMPILE_SSE2, 1, Define if \$CC groks SSE2 inline assembly.)
+  ACCEL_MODULES="${ACCEL_MODULES} ${SSE2_MODULES}"
+fi
+
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
     [ac_cv_altivec_inline],
@@ -1274,7 +1419,7 @@ if test "${ac_cv_altivec_inline}" != "no"; then
     VLC_ADD_CFLAGS([motionaltivec],[${ac_cv_altivec_inline}])
     VLC_ADD_CFLAGS([memcpyaltivec],[${ac_cv_altivec_inline}])
     VLC_ADD_CFLAGS([i420_yuy2_altivec],[${ac_cv_altivec_inline}])
-    VLC_ADD_CFLAGS([vlc],[${ac_cv_altivec_inline}])
+    VLC_ADD_CFLAGS([libvlc],[${ac_cv_altivec_inline}])
   fi
   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
 fi
@@ -1329,27 +1474,33 @@ AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
 if test "${ac_cv_c_altivec}" != "no"; then
   CPPFLAGS="${CPPFLAGS_save} ${ac_cv_c_altivec}"
 fi
-AC_CHECK_HEADERS(altivec.h)
-CPPFLAGS="${CPPFLAGS_save}"
 
-if test "${ac_cv_c_altivec}" != "no"; then
-  AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
-  VLC_ADD_CFLAGS([vlc],[${ac_cv_c_altivec}])
-  VLC_ADD_CFLAGS([idctaltivec motionaltivec],[${ac_cv_c_altivec}])
-  VLC_ADD_CFLAGS([i420_yuy2_altivec memcpyaltivec deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
-  if test "${ac_cv_altivec_inline}" = "no"; then
-    ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
+AS_IF( test "${enable_altivec}" != "no",
+[
+  AC_CHECK_HEADERS(altivec.h)
+  CPPFLAGS="${CPPFLAGS_save}"
+  
+  if test "${ac_cv_c_altivec}" != "no"; then
+    AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
+    VLC_ADD_CFLAGS([libvlc],[${ac_cv_c_altivec}])
+    VLC_ADD_CFLAGS([idctaltivec motionaltivec],[${ac_cv_c_altivec}])
+    VLC_ADD_CFLAGS([i420_yuy2_altivec memcpyaltivec deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
+    if test "${ac_cv_altivec_inline}" = "no"; then
+      ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
+    fi
   fi
-fi
+],[
+  CPPFLAGS="${CPPFLAGS_save}"
+])
 
 AC_CACHE_CHECK([if linker needs -framework vecLib],
     [ac_cv_ld_altivec],
-    [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
+    [LDFLAGS="${LDFLAGS_vlc} -Wl,-framework,vecLib"
      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
      LDFLAGS="${LDFLAGS_save}"
     ])
 if test "${ac_cv_ld_altivec}" != "no"; then
-  VLC_ADD_LDFLAGS([vlc idctaltivec motionaltivec memcpyaltivec],[-framework vecLib])
+  VLC_ADD_LDFLAGS([libvlc idctaltivec motionaltivec memcpyaltivec],[-Wl,-framework,vecLib])
 fi
 fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
 
@@ -1397,11 +1548,16 @@ AS_IF([test "${CFLAGS_TUNING}"],
 dnl
 dnl  x86 accelerations
 dnl
-if test "${host_cpu}" = "i686" -o "${host_cpu}" = "i586" -o "${host_cpu}" = "x86" -o "${host_cpu}" = "i386" -o "${host_cpu}" = "x86_64"
+if test "${host_cpu}" = "i686" -o "${host_cpu}" = "i586" -o "${host_cpu}" = "x86" -o "${host_cpu}" = "i386" -o "${host_cpu}"="i486" -o "${host_cpu}" = "x86_64"
 then
     ARCH="${ARCH} mmx"
     VLC_ADD_BUILTINS([${ACCEL_MODULES}])
 fi
+if test "${host_cpu}" = "i686" -o "${host_cpu}" = "x86_64"
+then
+    ARCH="${ARCH} sse sse2"
+    VLC_ADD_BUILTINS([${ACCEL_MODULES}])
+fi
 
 dnl
 dnl  Memory usage
@@ -1417,7 +1573,13 @@ dnl  Enable/disable optimizations
 dnl
 AC_ARG_ENABLE(optimizations,
 [  --disable-optimizations disable compiler optimizations (default enabled)])
-test "${enable_optimizations}" != "no" && enable_optimizations="yes"
+if test "${enable_optimizations}" != "no"; then
+   if test "${enable_optimize_memory}" = "yes"; then
+      enable_optimizations="size"
+   else
+      enable_optimizations="speed"
+   fi
+fi
 
 dnl
 dnl  AltiVec acceleration
@@ -1439,6 +1601,22 @@ 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  Test coverage
+dnl
+AC_ARG_ENABLE(coverage,
+       [  --enable-coverage       build for test coverage (default disabled)],,
+       [enable_coverage="no"])
+AS_IF([test "${enable_coverage}" != "no"], [
+       CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
+       CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
+       LDFLAGS="-lgcov ${LDFLAGS}"
+       dnl ugly...
+       CFLAGS_save="${CFLAGS}"
+       CXXFLAGS_save="${CXXFLAGS}"
+       LDFLAGS_save="${LDFLAGS}"
+])
+
 dnl
 dnl  Enable release-specific flags
 dnl
@@ -1446,15 +1624,6 @@ 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
-AC_ARG_ENABLE(shared-libvlc,
-  [  --enable-shared-libvlc  Win32 libvlc.dll build (default disabled)])
-AS_IF([test "${enable_libtool}" != "no" && test "${enable_shared_libvlc}"], [
-  AC_MSG_ERROR([--enable-shared-libvlc and --enable-libtool are mutually exclusive])
-])
-
 dnl
 dnl Stream output
 dnl
@@ -1467,7 +1636,8 @@ then
   VLC_ADD_PLUGINS([packetizer_copy])
 
   VLC_ADD_PLUGINS([stream_out_dummy stream_out_standard stream_out_es stream_out_rtp stream_out_description vod_rtsp])
-  VLC_ADD_PLUGINS([stream_out_duplicate stream_out_gather stream_out_display stream_out_transcode stream_out_bridge stream_out_mosaic_bridge stream_out_autodel])
+  VLC_ADD_PLUGINS([stream_out_duplicate stream_out_display stream_out_transcode stream_out_bridge stream_out_mosaic_bridge stream_out_autodel])
+  VLC_ADD_PLUGINS([stream_out_gather])
 #  VLC_ADD_PLUGINS([stream_out_transrate])
 #  VLC_ADD_PLUGINS([rtcp])
   VLC_ADD_PLUGINS([profile_parser])
@@ -1476,7 +1646,7 @@ then
 fi
 
 AC_ARG_ENABLE(switcher,
-  [  --enable-switcher       Stream-out switcher plugin (default disabled)])    
+  [  --enable-switcher       Stream-out switcher plugin (default disabled)])
 
 dnl Check for libshout
 AC_ARG_ENABLE(shout,
@@ -1490,6 +1660,43 @@ if test "${enable_shout}" = "yes"; then
     [AC_MSG_WARN(libshout library not found)])
 fi
 
+dnl Lua playlist demux
+AC_ARG_ENABLE(luaplaylist,
+  [  --enable-lua            lua playlist demux plugin (default enabled)])
+if test "${enable_lua}" != "no"
+then
+  PKG_CHECK_MODULES(LUA, lua5.1,
+    [ have_lua=yes ],
+    [
+    AC_MSG_WARN([lua5.1 not found, trying lua >= 5.1 instead])
+    PKG_CHECK_MODULES(LUA, lua >= 5.1,
+      [ have_lua=yes ],
+      [ 
+        have_lua=yes
+        AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h], 
+         [],  
+          [ have_lua=no ] )
+       AC_CHECK_LIB(  lua5.1 , luaL_newstate, 
+          [LUA_LIBS="-llua5.1"],
+         AC_CHECK_LIB( lua51 , luaL_newstate, 
+            [LUA_LIBS="-llua51"],
+                 AC_CHECK_LIB( lua , luaL_newstate, 
+                   [LUA_LIBS="-llua"],
+             [ have_lua=no
+                AC_MSG_WARN([lua >= 5.1 not found!])
+              ])
+           )
+         )
+      ])
+    ])
+  if test "x${have_lua}" = "xyes" ;  then
+     AC_DEFINE(HAVE_LUA, [], [Define if you have the lua library])
+     VLC_ADD_PLUGINS([luaplaylist])
+     VLC_ADD_LDFLAGS([luaplaylist],[$LUA_LIBS])
+     VLC_ADD_CFLAGS([luaplaylist],[$LUA_CFLAGS])
+  fi
+fi
+
 dnl
 dnl HTTP daemon
 dnl
@@ -1608,7 +1815,7 @@ if test "${enable_live555}" != "no"; then
     AC_MSG_WARN(--with-livedotcom-tree is deprecated. Use --with-live555-tree instead.)
   with_live555_tree="${with_livedotcom_tree}"
   fi
-  
+
   if test -z "${with_live555_tree}" -a "${CXX}" != ""; then
     AC_LANG_PUSH(C++)
     CPPFLAGS_save="${CPPFLAGS}"
@@ -1946,6 +2153,22 @@ then
   fi
 fi
 
+dnl
+dnl  Windows DirectShow BDA access module
+dnl
+AC_ARG_ENABLE(bda,
+  [  --enable-bda          Win32 DirectShow BDA support (default enabled on Win32)])
+if test "${enable_bda}" != "no"
+then
+  if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
+  then
+      AC_CHECK_HEADERS(dshow.h,
+      [ VLC_ADD_PLUGINS([bda])
+        VLC_ADD_CXXFLAGS([bda],[])
+        VLC_ADD_LDFLAGS([bda],[-lstrmiids -lole32 -loleaut32 -luuid]) ])
+  fi
+fi
+
 
 dnl
 dnl  OpenCV wrapper and example filters
@@ -2147,14 +2370,38 @@ AC_ARG_ENABLE(pvr,
 if test "${enable_pvr}" = "yes"
 then
   VLC_ADD_PLUGINS([pvr])
+  AC_ARG_WITH(videodev2,
+    [  --with-videodev2=FILE   Location of videodev2.h file (default /usr/include/linux/videodev2.h)],[],[])
+  if test "${with_videodev2}" != "no" -a -n "${with_videodev2}"
+  then
+    AC_DEFINE_UNQUOTED(VIDEODEV2_H_FILE, "${with_videodev2}", [Location of videodev2.h])
+  fi
+    
+
+  AC_CACHE_CHECK([for new linux/videodev2.h],
+      [new_linux_videodev2_h],
+      [AC_TRY_COMPILE([
+          #include <sys/types.h>
+          #   ifdef VIDEODEV2_H_FILE
+         #   include VIDEODEV2_H_FILE
+         #   else
+         #   include <linux/videodev2.h>
+         #   endif
+         ],
+          [struct v4l2_ext_controls ctrls; ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; ],
+          new_linux_videodev2_h=yes,
+          new_linux_videodev2_h=no)])
+  if test "${new_linux_videodev2_h}" != "no"; then
+    AC_DEFINE(HAVE_NEW_LINUX_VIDEODEV2_H, 1, [Define if new linux/videodev2.h present])
+  fi
 fi
 
 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 disabled)])
+if test "${enable_gnomevfs}" = "yes
 then
   PKG_CHECK_MODULES(GNOMEVFS, gnome-vfs-2.0,
     VLC_ADD_LDFLAGS([access_gnomevfs],[$GNOMEVFS_LIBS])
@@ -2302,7 +2549,7 @@ then
   if test "${SYS}" = "darwin"
   then
     VLC_ADD_PLUGINS([vcd cdda])
-    VLC_ADD_LDFLAGS([vcd vcdx cdda cddax],[-framework IOKit -framework CoreFoundation])
+    VLC_ADD_LDFLAGS([vcd vcdx cdda cddax],[-Wl,-framework,IOKit,-framework,CoreFoundation])
     VLC_ADD_LDFLAGS([vcdx cddax cdda],[-liconv])
   fi
 
@@ -2353,7 +2600,7 @@ if test "${enable_screen}" != "no"; then
   if test "${SYS}" = "darwin"; then
     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
       VLC_ADD_PLUGINS([screen])
-      VLC_ADD_LDFLAGS([screen],[-framework ApplicationServices])
+      VLC_ADD_LDFLAGS([screen],[-Wl,-framework,ApplicationServices])
     ])
   elif test "${SYS}" = "mingw32"; then
     VLC_ADD_PLUGINS([screen])
@@ -2368,7 +2615,7 @@ if test "${enable_screen}" != "no"; then
     CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
     AC_CHECK_HEADERS(X11/Xlib.h, [
       VLC_ADD_PLUGINS([screen])
-      VLC_ADD_LDFLAGS([screen],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext])
+      VLC_ADD_LDFLAGS([screen],[${X_LIBS} ${X_PRE_LIBS} -lX11])
       VLC_ADD_CPPFLAGS([screen],[${X_CFLAGS}])
     ])
     CPPFLAGS="${CPPFLAGS_save}"
@@ -2386,6 +2633,11 @@ AC_CHECK_FUNCS(inet_pton,[have_ipv6=yes],[
 AS_IF([test "${have_ipv6}" = "yes"], [
   AC_DEFINE(HAVE_INET_PTON, 1, [Define to 1 if you have inet_pton().])])
 
+
+AC_CHECK_FUNCS(inet_ntop,[
+  AC_DEFINE(HAVE_INET_NTOP, 1, [Define to 1 if you have inet_ntop().])])
+
+
 dnl
 dnl  ogg demux plugin
 dnl
@@ -2867,7 +3119,8 @@ dnl Trying with pkg-config
      PKG_CHECK_MODULES(SWSCALE, libswscale,[
        VLC_ADD_CFLAGS([ffmpeg],[${SWSCALE_CFLAGS}]) 
        VLC_ADD_LDFLAGS([ffmpeg],[${SWSCALE_LIBS}]) 
-       AC_CHECK_HEADERS(ffmpeg/swscale.h)
+       AC_CHECK_LIB(swscale, sws_getContext,
+         [AC_CHECK_HEADERS(ffmpeg/swscale.h)],[])
        ],[ true ])
      VLC_RESTORE_FLAGS
     ],[
@@ -2879,7 +3132,6 @@ dnl Trying with pkg-config
       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
       AC_CHECK_HEADERS(ffmpeg/avcodec.h, [], [AC_MSG_ERROR([Missing header file ffmpeg/avcodec.h.])] )
       AC_CHECK_HEADERS(ffmpeg/avformat.h)
-      AC_CHECK_HEADERS(ffmpeg/swscale.h)
       AC_CHECK_HEADERS(ffmpeg/avutil.h)
       AC_CHECK_HEADERS(postproc/postprocess.h, [], [AC_MSG_ERROR([Missing header file postproc/postprocess.h.])] )
 
@@ -2907,6 +3159,7 @@ dnl Trying with pkg-config
       CPPFLAGS="${CPPFLAGS_save}"
 
       AC_CHECK_LIB(swscale, sws_getContext, [
+        AC_CHECK_HEADERS(ffmpeg/swscale.h)
         VLC_ADD_LDFLAGS([ffmpeg],[-lswscale]) ], [], [-lavcodec $LDAVUTIL])
       LDFLAGS="${LDFLAGS_save}"
       CPPFLAGS="${CPPFLAGS_save}"
@@ -3024,25 +3277,26 @@ then
       AC_MSG_RESULT(no)
       AC_MSG_ERROR([cannot cd to ${with_twolame_tree}])
     fi
-    if test -f "${real_twolame_tree}/src/libtwolame/.libs/libtwolame.a"
+    if test -f "${real_twolame_tree}/libtwolame/.libs/libtwolame.a"
     then
       dnl  Use a custom twolame
-      AC_MSG_RESULT(${real_twolame_tree}/src/libtwolame/.libs/libtwolame.a)
+      AC_MSG_RESULT(${real_twolame_tree}/libtwolame/.libs/libtwolame.a)
       VLC_ADD_BUILTINS([twolame])
-      VLC_ADD_LDFLAGS([twolame],[${real_twolame_tree}/src/libtwolame/.libs/libtwolame.a])
-      VLC_ADD_CPPFLAGS([twolame],[-I${real_twolame_tree}/src/libtwolame])
+      VLC_ADD_LDFLAGS([twolame],[${real_twolame_tree}/libtwolame/.libs/libtwolame.a])
+      VLC_ADD_CPPFLAGS([twolame],[-I${real_twolame_tree}/libtwolame -DLIBTWOLAME_STATIC])
     else
       dnl  The given libtwolame wasn't built
       AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${real_twolame_tree}/src/libtwolame/.libs/libtwolame.a, make sure you compiled libtwolame in ${with_twolame_tree}])
+      AC_MSG_ERROR([cannot find ${real_twolame_tree}/libtwolame/.libs/libtwolame.a, make sure you compiled libtwolame in ${with_twolame_tree}])
     fi
   else
-    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_twolame}"
+    CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_twolame} -DLIBTWOLAME_STATIC"
     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_twolame}"
     AC_CHECK_HEADERS(twolame.h, ,
       [ AC_MSG_ERROR([Cannot find development header for libtwolame...]) ])
     AC_CHECK_LIB(twolame, twolame_init, [
       VLC_ADD_PLUGINS([twolame])
+      VLC_ADD_CPPFLAGS([twolame],[-DLIBTWOLAME_STATIC])
       VLC_ADD_LDFLAGS([twolame],[-ltwolame]) ],
         [ AC_MSG_ERROR([Cannot find libtwolame library...]) ])
     LDFLAGS="${LDFLAGS_save}"  
@@ -3063,7 +3317,7 @@ then
   else
   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
     [ VLC_ADD_BUILTINS([quicktime])
-      VLC_ADD_LDFLAGS([quicktime],[-framework QuickTime -framework Carbon])
+      VLC_ADD_LDFLAGS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
   fi
 fi
@@ -3100,11 +3354,14 @@ AC_CHECK_HEADERS(sysfs/libsysfs.h, [
 dnl
 dnl skins2 module
 dnl
-AC_CHECK_HEADERS(libtar.h, [
-  VLC_ADD_LDFLAGS([skins2],[-ltar])
-] )
-
+AC_ARG_ENABLE(libtar,
+  [  --enable-libtar support for skins2 (default enabled)])
 
+AS_IF([test "${enable_libtar}" != "no"],[
+  AC_CHECK_HEADERS(libtar.h, [
+    VLC_ADD_LDFLAGS([skins2],[-ltar])
+  ] )
+])
 
 dnl
 dnl A52/AC3 decoder plugin
@@ -3186,69 +3443,52 @@ AC_ARG_WITH(a52-fixed,
 dnl
 dnl DTS Coherent Acoustics decoder plugin
 dnl
-AC_ARG_ENABLE(dts,
-  [  --enable-dts            DTS Coherent Acoustics support with libdca (default enabled)])
-if test "${enable_dts}" != "no"; then
-  AC_ARG_WITH(dts-tree,
-    [    --with-dts-tree=PATH  libdts tree for static linking ],[],[])
-  if test "${with_dts_tree}" != "no" -a -n "${with_dts_tree}"
-  then
-    real_dts_tree="`cd ${with_dts_tree} 2>/dev/null && pwd`"
-    if test -z "${real_dts_tree}"
-    then
+AS_IF([test "x${enable_dts}" != "x"], [
+  AC_MSG_ERROR([--enable-dts is obsolete. Please use libdca and --enable-dca.])
+])
+AS_IF([test "x${with_dts_tree}" != "x"], [
+  AC_MSG_ERROR([--with-dts-tree is obsolete. Please use libdca and --with-dca-tree.])
+])
+
+AC_ARG_ENABLE(dca,
+  [  --enable-dca            DTS Coherent Acoustics support with libdca (default enabled)])
+AS_IF([test "${enable_dca}" != "no"], [
+  AC_ARG_WITH(dca-tree,
+    [    --with-dca-tree=PATH  libdca tree for static linking],,
+    [with_dca_tree="no"])
+  AS_IF([test "${with_dca_tree}" != "no"], [
+    real_dca_tree="`cd ${with_dca_tree} 2>/dev/null && pwd`"
+    AS_IF([test -z "${real_dca_tree}"], [
       dnl  The given directory can't be found
       AC_MSG_RESULT(no)
-      AC_MSG_ERROR([${with_dts_tree} directory doesn't exist])
-    fi
-    dnl  Use a custom libdts
-    AC_MSG_CHECKING(for dts.h in ${real_dts_tree}/include)
-    if test -f ${real_dts_tree}/include/dts.h
-    then
+      AC_MSG_ERROR([${with_dca_tree} directory doesn't exist])
+    ])
+    dnl  Use a custom libdca
+    AC_MSG_CHECKING(for libdca in ${real_dca_tree})
+    AS_IF([test -f "${real_dca_tree}/libdca/.libs/libdca.a"], [
       AC_MSG_RESULT(yes)
-      VLC_ADD_CPPFLAGS([dtstofloat32],[-I${real_dts_tree}/include])
-      VLC_ADD_LDFLAGS([dtstofloat32],[-L${real_dts_tree}/libdts])
-      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_dtstofloat32}"
-      AC_CHECK_LIB(dts_pic, dts_free, [
-        VLC_ADD_PLUGINS([dtstofloat32])
-        VLC_ADD_LDFLAGS([dtstofloat32],[-ldts_pic -lm])
-        ],[
-        AC_CHECK_LIB(dts, dts_free, [
-          VLC_ADD_BUILTINS([dtstofloat32])
-          VLC_ADD_LDFLAGS([dtstofloat32],[-ldts])
-          ],[
-          if test -f ${real_dts_tree}/libdts/libdts.a
-          then
-            AC_MSG_ERROR([make sure you have at least libdts-0.0.2])
-          else
-            AC_MSG_ERROR([the specified tree hasn't been compiled])
-          fi
-        ])
-      ], [-lm])
-      LDFLAGS="${LDFLAGS_save}"
-    else
+      VLC_ADD_LDFLAGS([dtstofloat32],[${real_dca_tree}/libdca/.libs/libdca.a])
+      AS_IF([test -f "${real_dca_tree}/include/dca.h"], [
+        VLC_ADD_CPPFLAGS([dtstofloat32],[-I${real_dca_tree}/include])
+      ], [
+        VLC_ADD_CPPFLAGS([dtstofloat32],[-I${real_dca_tree}/../include])
+      ])
+    ], [
       AC_MSG_RESULT(no)
-      AC_MSG_ERROR([the specified tree doesn't have dts.h])
-    fi
-  else
-    LDFLAGS="${LDFLAGS_save} ${LDFLAGS_dtstofloat32}"
-    AC_CHECK_HEADERS(dts.h, [
-      AC_CHECK_LIB(dts_pic, dts_free, [
-        VLC_ADD_PLUGINS([dtstofloat32])
-        VLC_ADD_LDFLAGS([dtstofloat32],[-ldts_pic -lm])
-      ],[
-        AC_CHECK_LIB(dts, dts_free, [
-          VLC_ADD_BUILTINS([dtstofloat32])
-          VLC_ADD_LDFLAGS([dtstofloat32],[-ldts])
-        ],[
-          if test "${enable_dts}" = "yes"; then
-            AC_MSG_ERROR([Could not find libdts on your system: you may get it from http://www.videolan.org/dtsdec.html])
-          fi
-        ])
-      ], [-lm])
+      AC_MSG_ERROR([the specified tree doesn't have libdca/.libs/libdca.a])
     ])
-    LDFLAGS="${LDFLAGS_save}"
-  fi
-fi
+  ], [
+    PKG_CHECK_MODULES([DCA], [libdca >= 0.0.5], [
+      VLC_ADD_PLUGINS([dtstofloat32])
+      VLC_ADD_CPPFLAGS([dtstofloat32], [${DCA_CFLAGS}])
+      VLC_ADD_LDFLAGS([dtstofloat32], [${DCA_LIBS}])
+    ], [
+      AS_IF([test "x${enable_dca}" != "x"], [
+        AC_MSG_ERROR([${DCA_PKG_ERRORS}])
+      ])
+    ])
+  ])
+])
 
 dnl
 dnl  Flac plugin
@@ -3283,7 +3523,7 @@ then
     fi
   else
     AC_CHECK_HEADERS(FLAC/stream_decoder.h, [
-      VLC_ADD_LDFLAGS([flac],[-lFLAC])
+      VLC_ADD_LDFLAGS([flac],[-lFLAC -logg])
      ],[])
   fi
 fi
@@ -3492,7 +3732,7 @@ dnl
 AC_ARG_ENABLE(dirac,
 [  --enable-dirac          experimental dirac codec (default disabled)])
 if test "${enable_dirac}" = "yes"; then
-  PKG_CHECK_MODULES(DIRAC,dirac, [
+  PKG_CHECK_MODULES(DIRAC,[dirac >= 0.6.0], [
       VLC_ADD_PLUGINS([dirac])
       VLC_ADD_CFLAGS([dirac],[$DIRAC_CFLAGS])
       VLC_ADD_LDFLAGS([dirac],[$DIRAC_LIBS -lstdc++]) ],[
@@ -3570,6 +3810,38 @@ if test "${enable_x264}" != "no"; then
   fi
 fi
 
+dnl
+dnl Teletext Modules
+dnl vbi decoder plugin (using libzbvi)
+dnl telx module
+dnl uncompatible
+dnl
+AC_ARG_ENABLE(zvbi,
+  [  --enable-zvbi           VBI (inc. Teletext) decoding support with libzvbi (default enabled)])
+AC_ARG_ENABLE(telx,
+  [  --enable-telx,          Teletext decoding module (conflicting with zvbi) (default disabled)])
+
+AS_IF( [test "${enable_zvbi}" != "no"],[
+  AS_IF( [test "${enable_telx}" = "yes"],[
+    AC_MSG_ERROR([The zvbi and telx modules are uncompatibles. Disable the other if you enable one.])
+  ],[
+    PKG_CHECK_MODULES(ZVBI,
+       zvbi-0.2 >= 0.2.25,
+       [
+         VLC_ADD_LDFLAGS([zvbi],[$ZVBI_LIBS])
+         VLC_ADD_CFLAGS([zvbi],[$ZVBI_CFLAGS])
+         VLC_ADD_PLUGINS([zvbi])
+         AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built]) 
+       ],[
+         AC_MSG_WARN(ZVBI library not found. Enabling the telx module instead)
+         enable_telx="yes"
+       ])
+    ])  
+  ])
+AS_IF( [test "${enable_telx}" = "yes"],[
+  VLC_ADD_PLUGINS([telx])
+  ])
+
 dnl
 dnl  CMML plugin
 dnl
@@ -3616,9 +3888,14 @@ if test "${enable_x11}" != "no" &&
    test "${enable_x11}" = "yes"); then
   CPPFLAGS="${CPPFLAGS_save} ${X_FLAGS}"
   AC_CHECK_HEADERS(X11/Xlib.h, [
-    VLC_ADD_PLUGINS([x11 panoramix])
-    VLC_ADD_LDFLAGS([x11 panoramix],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext])
-    VLC_ADD_CPPFLAGS([x11 panoramix],[${X_CFLAGS}])
+    VLC_ADD_PLUGINS([panoramix])
+    VLC_ADD_LDFLAGS([panoramix],[${X_LIBS} ${X_PRE_LIBS} -lX11])
+    VLC_ADD_CPPFLAGS([panoramix],[${X_CFLAGS}])
+    AC_CHECK_LIB(Xext, XShmAttach, [
+      VLC_ADD_PLUGINS([x11])
+      VLC_ADD_LDFLAGS([x11],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext])
+      VLC_ADD_CPPFLAGS([x11],[${X_CFLAGS}])
+    ])
   ])
   CPPFLAGS="${CPPFLAGS_save}"
 fi
@@ -3669,11 +3946,16 @@ if test "${enable_glx}" != "no" &&
   (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
    test "${enable_glx}" = "yes"); then
   CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
-  AC_CHECK_HEADERS(X11/Xlib.h GL/glu.h GL/glx.h, [
+  AC_CHECK_HEADERS(X11/Xlib.h GL/glu.h GL/glx.h)
+  AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
+    [[#if !defined(HAVE_X11_XLIB_H) || !defined(HAVE_GL_GLU_H) || !defined(HAVE_GL_GLX_H)
+    choke me
+    #endif]]),
+    [
       VLC_ADD_PLUGINS([glx])
       VLC_ADD_LDFLAGS([glx],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lGL -lGLU])
       VLC_ADD_CPPFLAGS([glx],[${X_CFLAGS}])
-   ],[AC_MSG_ERROR([Please install GL development package. Alternatively you can also configure with --disable-glx.])])
+    ],[AC_MSG_ERROR([Please install GL development package. Alternatively you can also configure with --disable-glx.])])
   CPPFLAGS="${CPPFLAGS_save}"
 fi
 
@@ -3780,7 +4062,7 @@ if test "${enable_opengl}" != "no" &&
   else
     dnl OS X special case (no GL/gl.h but OpenGL/gl.h)
     VLC_ADD_PLUGINS([opengl])
-    VLC_ADD_LDFLAGS([opengl],[-framework OpenGL])
+    VLC_ADD_LDFLAGS([opengl],[-Wl,-framework,OpenGL])
   fi
 fi
 
@@ -3789,6 +4071,8 @@ dnl  SDL module
 dnl
 AC_ARG_ENABLE(sdl,
   [  --enable-sdl            SDL support (default enabled)])
+AC_ARG_ENABLE(sdl-image,
+  [  --enable-sdl-image            SDL image support (default enabled)])
 if test "${enable_sdl}" != "no"
 then
   SDL_PATH="${PATH}"
@@ -3842,21 +4126,23 @@ then
 Please install it and try again. Alternatively you can also configure with
 --disable-sdl.])
       ])])
-    AC_CHECK_HEADERS(${SDL_IMAGE}, [AC_DEFINE_UNQUOTED(SDL_IMAGE_INCLUDE_FILE,
-      <${SDL_IMAGE}>, Indicate the path of SDL_image.h)
-      VLC_ADD_PLUGINS([sdl_image])
-      AC_CHECK_LIB(png, png_set_rows,
-        [VLC_ADD_LDFLAGS([sdl_image],[-lpng -lz])],[],[-lz])
-      AC_CHECK_LIB(jpeg, jpeg_start_decompress,
-        [VLC_ADD_LDFLAGS([sdl_image],[-ljpeg])])
-      AC_CHECK_LIB(tiff, TIFFClientOpen,
-        [VLC_ADD_LDFLAGS([sdl_image],[-ltiff])])
-      VLC_ADD_LDFLAGS([sdl_image], [-lSDL_image])],
-      [ AC_CHECK_HEADERS(SDL_image.h, AC_DEFINE(SDL_IMAGE_INCLUDE_FILE, <SDL_image.h>,
-          As a last resort we also test for SDL_image.h presence),
-      [ AC_MSG_WARN([The development package for SDL_image is not installed.
-You should install it alongside your SDL package.])
-      ])])
+    AS_IF([ test "${enable_sdl_image}" != "no"],[
+      AC_CHECK_HEADERS(${SDL_IMAGE}, [AC_DEFINE_UNQUOTED(SDL_IMAGE_INCLUDE_FILE,
+        <${SDL_IMAGE}>, Indicate the path of SDL_image.h)
+        VLC_ADD_PLUGINS([sdl_image])
+        AC_CHECK_LIB(png, png_set_rows,
+          [VLC_ADD_LDFLAGS([sdl_image],[-lpng -lz])],[],[-lz])
+        AC_CHECK_LIB(jpeg, jpeg_start_decompress,
+          [VLC_ADD_LDFLAGS([sdl_image],[-ljpeg])])
+        AC_CHECK_LIB(tiff, TIFFClientOpen,
+          [VLC_ADD_LDFLAGS([sdl_image],[-ltiff])])
+        VLC_ADD_LDFLAGS([sdl_image], [-lSDL_image])],
+        [ AC_CHECK_HEADERS(SDL_image.h, AC_DEFINE(SDL_IMAGE_INCLUDE_FILE, <SDL_image.h>,
+            As a last resort we also test for SDL_image.h presence),
+        [ AC_MSG_WARN([The development package for SDL_image is not installed.
+  You should install it alongside your SDL package.])
+        ])])
+    ])
     CPPFLAGS="${CPPFLAGS_save}"
     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
     then
@@ -3896,8 +4182,11 @@ then
     VLC_ADD_PLUGINS([freetype])
     VLC_ADD_CFLAGS([freetype],[`${FREETYPE_CONFIG} --cflags`])
     VLC_ADD_LDFLAGS([freetype],[`${FREETYPE_CONFIG} --libs`])
+    AC_CHECK_HEADERS(fontconfig/fontconfig.h,
+      [VLC_ADD_CFLAGS([freetype],[-DHAVE_FONTCONFIG])
+       VLC_ADD_LDFLAGS([freetype],[-lfontconfig])])
     AC_CHECK_HEADERS(Carbon/Carbon.h,
-      [VLC_ADD_LDFLAGS([freetype],[-framework Carbon])])
+      [VLC_ADD_LDFLAGS([freetype],[-Wl,-framework,Carbon])])
   elif test "${enable_freetype}" =  "yes"
   then
     AC_MSG_ERROR([I couldn't find the freetype package. You can download libfreetype2
@@ -4098,7 +4387,7 @@ then
       ])
       AC_CHECK_HEADERS(d3d9.h,
       [ VLC_ADD_PLUGINS([direct3d])
-        VLC_ADD_LDFLAGS([direct3d],[-ld3d9 -lgdi32])
+        VLC_ADD_LDFLAGS([direct3d],[-lgdi32])
       ])
     else
       AC_MSG_CHECKING(for directX headers in ${with_directx})
@@ -4402,7 +4691,7 @@ if test "${enable_macosx-audio}" != "no" &&
 then
   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h, 
     [ VLC_ADD_BUILTINS([auhal])
-      VLC_ADD_LDFLAGS([auhal],[-framework CoreAudio -framework AudioUnit -framework AudioToolbox])
+      VLC_ADD_LDFLAGS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,Carbon])
     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
 fi
 
@@ -4423,16 +4712,18 @@ then
 fi
 
 dnl
-dnl  JACK module
+dnl  JACK modules
 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])
+ [  --enable-jack           JACK audio I/O modules (default disabled)],,
+ [enable_jack="no"])
+
+AS_IF([test "${enable_jack}" != "no"], [
+  AC_CHECK_HEADERS(jack/jack.h, [
+    VLC_ADD_PLUGINS([access_jack jack])
+    VLC_ADD_LDFLAGS([access_jack jack],[-ljack])
+  ],[AC_MSG_ERROR([cannot find JACK headers])])
+])
 
 dnl
 dnl  CyberLink for C++ UPnP stack
@@ -4546,7 +4837,7 @@ dnl
 dnl Skins2 module
 dnl
 AC_ARG_ENABLE(skins2,
-  [  --enable-skins2         Skins2 interface module (experimental)])
+  [  --enable-skins2         Skins2 interface module (default disabled)])
 if test "${enable_skins2}" = "yes" ||
   (test "${SYS}" != "darwin" && test "${SYS}" != "beos" &&
    test "${SYS}" != "mingwce" && test "${enable_skins2}" != "no"); then
@@ -4572,13 +4863,20 @@ if test "${enable_skins2}" = "yes" ||
     VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
     VLC_ADD_LDFLAGS([skins2],[-loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32])
 
+  else if test "${skins2_missing_lib}" = "no" && (test "${SYS}" = "darwin"); then
+    VLC_ADD_PLUGINS([skins2])
+    ALIASES="${ALIASES} svlc"
+    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 -DMACOSX_SKINS])
+    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
+    VLC_ADD_LDFLAGS([skins2],[-Wl,-framework,Carbon])
+
   else if test "${skins2_missing_lib}" = "no"; then
     VLC_ADD_PLUGINS([skins2])
     ALIASES="${ALIASES} svlc"
     VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 ${X_CFLAGS} -DX11_SKINS])
     VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
     VLC_ADD_LDFLAGS([skins2],[${X_LIBS} ${X_PRE_LIBS} -lXext -lX11])
-  fi fi
+  fi fi fi
 fi
 
 
@@ -4723,18 +5021,11 @@ dnl
 dnl  wxWidgets module
 dnl
 AC_ARG_ENABLE(wxwidgets,
-  [  --enable-wxwidgets      wxWidgets support (default enabled)])
-if test "${enable_wxwindows}" 
-then
-  AC_MSG_WARN(--{en|dis}able-wxwindows is deprecated. Use --{en|dis}able-wxwidgets instead.)
-fi
+  [  --enable-wxwidgets      wxWidgets support (default disabled)])
 
-if test "${enable_wxwindows}" = "no"
-then
-  enable_wxwidgets="no"
-fi
-if test "${enable_wxwidgets}" != "no"
+if test "${enable_wxwidgets}" = "yes"
 then
+  AC_MSG_WARN([wxWidgets support is deprecated and will be removed. Consider using Qt4 instead.])
   WXWIDGETS_PATH="${PATH}"
   AC_ARG_WITH(wx-config-path,
     [    --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
@@ -4753,9 +5044,9 @@ then
   AC_PATH_PROG(WX_CONFIG, ${WXWIDGETS_NAME}, no, ${WXWIDGETS_PATH})
   if test "${WX_CONFIG}" != "no" -a "${CXX}" != ""
   then
-    if expr 2.6.0 \> `${WX_CONFIG} --version` >/dev/null ||  expr 2.7.0 \<= `${WX_CONFIG} --version` >/dev/null
+    if expr 2.6.0 \> `${WX_CONFIG} --version` >/dev/null
     then
-      AC_MSG_ERROR([You need wxWidgets of the 2.6 branch. Please upgrade and try again. Alternatively you can also configure with --disable-wxwidgets.])
+      AC_MSG_ERROR([You need wxWidgets version 2.6.0 or upwards. Please upgrade and try again.])
     fi
     AC_LANG_PUSH(C++)
     # Turn this error:
@@ -4788,6 +5079,8 @@ then
       # wxwidgets should provide the following flags but does not
       # the following is required to compile for win32
       VLC_ADD_CXXFLAGS([wxwidgets],[-D_UNICODE -DUNICODE])
+    else
+      AC_MSG_ERROR([You need a unicode build of wxWidgets. Please fix that and try again. Better yet, you can configure with --disable-wxwidgets.])
     fi
     if test "$have_libcdio" = "yes"
     then 
@@ -4829,19 +5122,26 @@ dnl QT 4
 dnl
 enableqt4=false
 AC_ARG_ENABLE(qt4,
-  [  --enable-qt4            QT 4 support (default disabled) ],
-  [if test "${enable_qt4}" = "yes"; then
-      PKG_CHECK_MODULES(QT4, QtCore QtGui,
-       [ VLC_ADD_PLUGINS([qt4])
-          ALIASES="${ALIASES} qvlc"
-         enableqt4=true
-         VLC_ADD_LDFLAGS([qt4],[$QT4_LIBS])
-         VLC_ADD_CXXFLAGS([qt4],[$QT4_CFLAGS])
-         MOC=`$PKG_CONFIG --variable=exec_prefix QtCore`/bin/moc
-         RCC=`$PKG_CONFIG --variable=exec_prefix QtCore`/bin/rcc
-         UIC=`$PKG_CONFIG --variable=exec_prefix QtCore`/bin/uic],
-       [AC_MSG_WARN(QT4 library not found)])
-   fi])
+  [  --enable-qt4            QT 4 support (default enabled) ])
+AS_IF([test "${enable_qt4}" != "no" &&
+  (test "${SYS}" != "darwin" || test "${enable_qt4}" = "yes")], [
+  PKG_CHECK_MODULES(QT4, [QtCore QtGui >= 4.2.0],
+    [ VLC_ADD_PLUGINS([qt4])
+      ALIASES="${ALIASES} qvlc"
+      enableqt4=true
+      VLC_ADD_LDFLAGS([qt4],[$QT4_LIBS])
+      VLC_ADD_CXXFLAGS([qt4],[$QT4_CFLAGS])
+      AC_PATH_PROGS(MOC, [moc-qt4 moc], moc,`$PKG_CONFIG --variable=exec_prefix QtCore`/bin)
+      AC_PATH_PROG(RCC, rcc, rcc,`$PKG_CONFIG --variable=exec_prefix QtCore`/bin)
+      AC_PATH_PROGS(UIC, [uic-qt4 uic], uic,`$PKG_CONFIG --variable=exec_prefix QtCore`/bin)
+      ],
+      AS_IF([test "${enable_qt4}" = "yes"],[
+       AC_MSG_ERROR(QT4 library not found)
+      ],[
+        AC_MSG_WARN(QT4 library not found)
+      ])
+    )
+])
 AM_CONDITIONAL(ENABLE_QT4, test "$enableqt4" = "true")
 
 dnl
@@ -4974,15 +5274,18 @@ AC_ARG_ENABLE(macosx,
   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
   [if test "${enable_macosx}" = "yes"
    then
-     VLC_ADD_BUILTINS([macosx])
-     VLC_ADD_LDFLAGS([macosx],[-framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC -framework OpenGL -framework AGL])
+     VLC_ADD_PLUGINS([access_eyetv])
+     VLC_ADD_LDFLAGS([access_eyetv], [-Wl,-framework,CoreFoundation])
+     VLC_ADD_LDFLAGS([macosx],[-Wl,-framework,IOKit,-framework,Cocoa,-framework,Carbon,-framework,QuickTime,-lobjc,-ObjC,-framework,OpenGL,-framework,AGL,-framework,QTKit])
      VLC_ADD_OBJCFLAGS( [macosx],[-fobjc-exceptions] )
    fi],
   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
+    [VLC_ADD_PLUGINS([access_eyetv])
+     VLC_ADD_LDFLAGS([access_eyetv], [-Wl,-framework,CoreFoundation])
      VLC_ADD_BUILTINS([macosx])
-     VLC_ADD_LDFLAGS([macosx],[-framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC -framework OpenGL -framework AGL])
-     VLC_ADD_OBJCFLAGS( [macosx],[-fobjc-exceptions] )
-   )])
+     VLC_ADD_LDFLAGS([macosx],[-Wl,-framework,IOKit,-framework,Cocoa,-framework,Carbon,-framework,QuickTime,-lobjc,-ObjC,-framework,OpenGL,-framework,AGL,-framework,QTKit])
+     VLC_ADD_OBJCFLAGS([macosx],[-fobjc-exceptions])
+    ])])
 CFLAGS=$ORIGCFLAGS
 
 dnl
@@ -5159,17 +5462,44 @@ AS_IF([test "${enable_gnutls}" != "no"], [
   AS_IF([test "${have_gnutls}" = "yes"], [
     VLC_ADD_PLUGINS([gnutls])
     VLC_ADD_CFLAGS([gnutls], [$GNUTLS_CFLAGS])
+    AS_IF([test "${SYS}" = "mingw32"], [
+      dnl pkg-config --libs gnutls omits these
+      VLC_ADD_LDFLAGS([gnutls], [-lz])
+      AS_IF([test "${enable_libtool}" != "no"], [
+        VLC_ADD_LDFLAGS([gnutls], [${LTLIBINTL}])
+      ], [
+        VLC_ADD_LDFLAGS([gnutls], [${LIBINTL}])
+      ])
+    ])
+    AC_CHECK_LIB([gcrypt], [gcry_control], [
+      VLC_ADD_LDFLAGS([gnutls], [-lgcrypt -lgpg-error])
+    ], [], [-lgpg-error])
     VLC_ADD_LDFLAGS([gnutls], [$GNUTLS_LIBS])
   ], [
     AS_IF([test "${enable_gnutls}" = "yes"], [
       AC_MSG_ERROR([gnutls not present or too old (version 1.2.9 required)])
     ])
   ])
-  AC_CHECK_LIB([gcrypt], [gcry_control], [
-    VLC_ADD_LDFLAGS([gnutls], [-lgcrypt])
-  ])
 ])
 
+dnl
+dnl libgcrypt
+dnl
+AC_ARG_ENABLE(libgcrypt,
+  [  --enable-libgcrypt      libgcrypts support (default enabled)])
+if test "${enable_libgcrypt}" != "no" -a "${enable_gnutls}" != "no"i
+then
+  dnl Workaround for cross-compiling since AM_PATH_LIBGRYPT doesn't dectect
+  dnl it and looks for libgcrypt headers in the wrong place.
+  if test "${host_cpu}" = "${build_cpu}"
+  then
+    AM_PATH_LIBGCRYPT([1:1.1.94], [have_libgcrypt="yes"], [have_libgcrypt="no"])
+  else
+    AC_CHECK_HEADERS(gcrypt.h,have_libgcrypt="yes",have_libgcrypt="no")
+  fi
+fi
+AM_CONDITIONAL([HAVE_LIBGCRYPT], [test "${have_libgcrypt}" = "yes"])
+
 
 dnl
 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
@@ -5239,12 +5569,12 @@ AC_ARG_ENABLE(loader,
 AM_CONDITIONAL(LOADER, [test "${enable_loader}" = "yes"])
 AS_IF([test "${enable_loader}" = "yes"],
   [ VLC_ADD_PLUGINS([dmo])
-    VLC_ADD_CPPFLAGS([dmo],[-I../../../@top_srcdir@/loader])
-    VLC_ADD_LDFLAGS([dmo],[../../../loader/libloader.la -lpthread])
-    VLC_ADD_CPPFLAGS([quicktime],[-I../../@top_srcdir@/loader])
-    VLC_ADD_LDFLAGS([quicktime],[../../loader/libloader.la -lpthread])
-    VLC_ADD_CPPFLAGS([realaudio],[-I../../@top_srcdir@/loader -DLOADER])
-    VLC_ADD_LDFLAGS([realaudio],[../../loader/libloader.la -ldl -lpthread])
+    VLC_ADD_CPPFLAGS([dmo],[-I../../../@top_srcdir@/libs/loader])
+    VLC_ADD_LDFLAGS([dmo],[../../../libs/loader/libloader.la -lpthread])
+    VLC_ADD_CPPFLAGS([quicktime],[-I../../@top_srcdir@/libs/loader])
+    VLC_ADD_LDFLAGS([quicktime],[../../libs/loader/libloader.la -lpthread])
+    VLC_ADD_CPPFLAGS([realaudio],[-I../../@top_srcdir@/libs/loader -DLOADER])
+    VLC_ADD_LDFLAGS([realaudio],[../../libs/loader/libloader.la -ldl -lpthread])
   ])
 
 dnl
@@ -5268,17 +5598,24 @@ then
        WIDL=no
     fi
     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]),,
-          [#if HAVE_OLE2_H
-           #   include <ole2.h>
-           #endif]
-        )
-        activex=:
-      ],
+    AC_CHECK_HEADERS(ole2.h, 
+      [AC_CHECK_HEADERS(olectl.h,
+        [ VLC_ADD_CPPFLAGS([activex],[-DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_])
+          VLC_ADD_CXXFLAGS([activex],[-fno-exceptions])
+          VLC_ADD_LDFLAGS([activex],[-lole32 -loleaut32 -luuid -lshlwapi -lgdi32]) 
+          AC_CHECK_HEADERS(objsafe.h,
+            VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER]),,
+            [
+            #if HAVE_OLE2_H
+             #   include <ole2.h>
+             #endif
+            ]
+          )
+          activex=:
+         PLUGINS_BINDINGS="${PLUGINS_BINDINGS} activex"
+        ],
+        [ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
+      )],
       [ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
     )
     AC_LANG_POP(C++)
@@ -5295,7 +5632,7 @@ dnl  Mozilla plugin
 dnl
 mozilla=false
 AC_ARG_ENABLE(mozilla,
-  [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
+  [  --enable-mozilla        build a vlc-based Firefox/Mozilla plugin (default disabled)])
 AC_ARG_WITH(mozilla-sdk-path,
   [    --with-mozilla-sdk-path=PATH path to mozilla sdk])
 AC_LANG_PUSH(C++)
@@ -5303,41 +5640,96 @@ if test "${enable_mozilla}" = "yes"
 then
   dnl currently vlc plugin only needs headers, no xpcom support apis are actually used
   need_xpcom_libs=false
+
   if test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"
   then
-    AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
-    if test "${MOZILLA_CONFIG}" = "no"
-    then
-      AC_PATH_PROG(SEAMONKEY_CONFIG, seamonkey-config, no)
-      if test "${SEAMONKEY_CONFIG}" = "no"
-      then
-        AC_PATH_PROG(XULRUNNER_CONFIG, xulrunner-config, no)
-        if test "${XULRUNNER_CONFIG}" = "no"
-        then
-          AC_MSG_ERROR([Please install the Mozilla development tools, mozilla-config was not found.])
+    dnl New firefox-1.5 SDK api
+    PKG_CHECK_MODULES([FIREFOX], [firefox-plugin],
+      [
+        PKG_CHECK_MODULES([FIREFOX_XPCOM], [firefox-xpcom],
+          [],
+          [
+            PKG_CHECK_MODULES([MOZILLA_NSPR], [mozilla-nspr],
+              [],
+              [
+                PKG_CHECK_MODULES([NSPR], [nspr],
+                  [],
+                  [
+                    AC_MSG_ERROR([Please install the nspr development tools.])
+                  ]
+                )
+              ]
+            )
+          ])
+        CPPFLAGS="${CPPFLAGS_save} ${FIREFOX_CFLAGS} ${FIREFOX_XPCOM_CFLAGS} ${MOZILLA_NSPR_CFLAGS} ${NSPR_CFLAGS} ${MOZILLA_CPPFLAGS}"
+        MOZILLA_REQUIRED_HEADERS=1
+        AC_CHECK_HEADERS(mozilla-config.h,,MOZILLA_REQUIRED_HEADERS=0)
+        AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
+        AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
+          [#if HAVE_NPAPI_H
+           # include <npapi.h>
+           #endif
+          ])
+        if test "${MOZILLA_REQUIRED_HEADERS}" = "0"; then
+            AC_MSG_ERROR([Please install the Firefox development tools; mozilla-config.h, plugin/npapi.h and plugin/npruntime.h were not found.])
+        fi
+        MOZILLA_REQUIRED_HEADERS=
+        mozilla=:
+        firefox_include=`pkg-config --variable=includedir firefox-plugin`
+        if test -f "${firefox_include}/mozilla-config.h" -a -f "${firefox_include}/mozilla-config32.h"; then
+            MOZILLA_CONFIG_H="${firefox_include}/mozilla-config32.h"
+        elif test -f "${firefox_include}/mozilla-config.h" -a -f "${firefox_include}/mozilla-config64.h"; then
+            MOZILLA_CONFIG_H="${firefox_include}/mozilla-config64.h"
         else
-          have_xul=true
-          MOZILLA_CONFIG="${XULRUNNER_CONFIG}"
+            MOZILLA_CONFIG_H="${firefox_include}/mozilla-config.h"
         fi
-      else
-        MOZILLA_CONFIG="${SEAMONKEY_CONFIG}"
+        if grep '^#define MOZ_X11 1' ${MOZILLA_CONFIG_H} 2>&1 > /dev/null ; then
+            VLC_ADD_LDFLAGS([mozilla], [${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt])
+        fi
+        VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS}])
+        VLC_ADD_LDFLAGS([mozilla],[${FIREFOX_LIBS} ${MOZILLA_NSPR_LIBS} ${NSPR_LIBS} ${MOZILLA_LDFLAGS}])
+        VLC_ADD_PLUGINS([mozilla])
+        MOZILLA_CONFIG=
+        CPPFLAGS="${CPPFLAGS_save}"
+      ],
+      [
+        AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
+        if test "${MOZILLA_CONFIG}" = "no"
+        then
+          AC_PATH_PROG(SEAMONKEY_CONFIG, seamonkey-config, no)
+          if test "${SEAMONKEY_CONFIG}" = "no"
+          then
+            AC_PATH_PROG(XULRUNNER_CONFIG, xulrunner-config, no)
+            if test "${XULRUNNER_CONFIG}" = "no"
+            then
+              AC_MSG_ERROR([Please install the Mozilla development tools, mozilla-config was not found.])
+            else
+              have_xul=true
+              MOZILLA_CONFIG="${XULRUNNER_CONFIG}"
+            fi
+          else
+            MOZILLA_CONFIG="${SEAMONKEY_CONFIG}"
+          fi
+        fi
+      ]
+    )
+    if test ! -z "${MOZILLA_CONFIG}"
+    then
+      if ${MOZILLA_CONFIG} --defines | grep -q 'MOZ_X11=1'; then
+        LDFLAGS="${LDFLAGS_save} ${X_LIBS} ${X_PRE_LIBS}"
+        AC_CHECK_LIB(Xt,XtStrings,
+         [
+           VLC_ADD_CPPFLAGS([mozilla],[${X_CFLAGS}])
+           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
-    fi
-    
-    if ${MOZILLA_CONFIG} --defines | grep -q 'MOZ_X11=1'; then
-      LDFLAGS="${LDFLAGS_save} ${X_LIBS} ${X_PRE_LIBS}"
-      AC_CHECK_LIB(Xt,XtStrings,
-       [
-         VLC_ADD_CPPFLAGS([mozilla],[${X_CFLAGS}])
-         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=:
+      PLUGINS_BINDINGS="${PLUGINS_BINDINGS} 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`]])
       if ${need_xpcom_libs}; then
@@ -5361,6 +5753,7 @@ then
       MOZILLA_REQUIRED_HEADERS=
       CPPFLAGS="${CPPFLAGS_save}"
       MOZILLA_SDK_PATH="`${MOZILLA_CONFIG} --prefix`"
+    fi
     dnl End of moz_sdk = ""
   else
     dnl special case for mingw32
@@ -5372,7 +5765,7 @@ then
           mozilla_sdk_xpcom="/xpcom"
       fi
     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"
     MOZILLA_REQUIRED_HEADERS=1
@@ -5389,19 +5782,20 @@ then
     fi
     MOZILLA_REQUIRED_HEADERS=
     mozilla=:
+    PLUGINS_BINDINGS="${PLUGINS_BINDINGS} 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])
     if ${need_xpcom_libs}; then
        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
-           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
+        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
     fi
     MOZILLA_SDK_PATH="${real_mozilla_sdk}"
-  
+
     if test -n "${CYGPATH}"; then
       real_mozilla_sdk="`${CYGPATH} -w ${real_mozilla_sdk}`"
     fi
@@ -5411,12 +5805,32 @@ fi
 AC_LANG_POP(C++)
 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
 
+   dnl Tests for Osso and Xsp
+if test "${enable_x11}" != "no" &&
+  (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
+   test "${enable_x11}" = "yes"); then
+   AC_CHECK_LIB(osso, osso_display_blanking_pause,[
+      PKG_CHECK_MODULES(GLIB2, glib-2.0, [                                               
+          VLC_ADD_CPPFLAGS([x11],[-DHAVE_OSSO ${DBUS_CFLAGS} ${GLIB2_CFLAGS}])
+          VLC_ADD_LDFLAGS([x11],[-losso])
+      ])
+   ])
+   AC_CHECK_LIB(Xsp, XSPSetPixelDoubling,[
+      VLC_ADD_CPPFLAGS([x11],[-DHAVE_XSP])
+      VLC_ADD_LDFLAGS([x11],[-lXsp])
+   ])
+fi
+
 dnl
 dnl  Mediacontrol Python bindings
 dnl
 AC_ARG_ENABLE(python-bindings,
   [  --enable-python-bindings    Enable Python bindings (default disabled)])
 dnl TODO: look for python dev headers
+AS_IF([test "${enable_python_bindings}" = "yes"],
+      PLUGINS_BINDINGS="${PLUGINS_BINDINGS} python"
+     ) 
+
 AM_CONDITIONAL(BUILD_PYTHON, [test "${enable_python_bindings}" = "yes"])
 
 dnl
@@ -5430,6 +5844,11 @@ then
        [AC_MSG_ERROR([Please set the JAVA_HOME variable to your JDK environment])])
   AC_PROG_JAVAC
   AC_PROG_JAVA
+  PLUGINS_BINDINGS="${PLUGINS_BINDINGS} java"
+  if test "${JAVAC}" == "javac${EXEEXT}"
+  then
+    JAVAC="javac${EXEEXT} -cp ./ "
+  fi
 fi
 AM_CONDITIONAL(BUILD_JAVA, [test "${enable_java_bindings}" = "yes"])
 
@@ -5458,7 +5877,7 @@ dnl
 if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
 then
     AC_CHECK_LIB(unicows, LoadUnicowsSymbol, [
-        VLC_ADD_LDFLAGS([vlc],[-Wl,--exclude-libs,libunicows.a -lunicows])
+        VLC_ADD_LDFLAGS([vlc libvlc],[-Wl,--exclude-libs,libunicows.a -lunicows])
     ])
 fi
 
@@ -5541,25 +5960,24 @@ AS_IF([${plugin_support}], [
 dnl
 dnl Pic and shared libvlc stuff
 dnl
-AS_IF([test "x${enable_shared_libvlc}" = "x"], [enable_shared_libvlc=no])
-AM_CONDITIONAL(BUILD_SHARED, [test "${enable_shared_libvlc}" != "no"])
-AS_IF([test "${enable_shared_libvlc}" != "no" || test "${enable_libtool}" != "no"], [
+AS_IF([test "${enable_libtool}" != "no"], [
   AC_DEFINE(HAVE_SHARED_LIBVLC, 1, [Define to 1 if libvlc is built as a shared library.])
-  FILE_LIBVLC_DLL="!define LIBVLC_DLL libvlc.dll"
   VLC_ADD_PLUGINS([${BUILTINS}])
+  AS_IF([test "${SYS}" = "mingw32"], [
+    FILE_LIBVLC_DLL="!define LIBVLC_DLL libvlc.dll"
+  ])
   BUILTINS=""
 ], [
+  LDFLAGS_vlc="${LDFLAGS_vlc} ${LDFLAGS_libvlc}"
   FILE_LIBVLC_DLL=""
+  VLC_ADD_CPPFLAGS([libvlc],[-DDLL_EXPORT])
 ])
 
- dnl Import conditional variables generated by bootstrap
-VLC_CONDITIONALS
-
 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-2006 the VideoLAN team", [Copyright string])
+AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2007 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])
@@ -5600,8 +6018,7 @@ VLC_RESTORE_FLAGS
 dnl
 dnl  Create the vlc-config script
 dnl
-LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtin}"
-for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
+LDFLAGS_libvlc="${LDFLAGS_libvlc} ${LDFLAGS_builtin}"
 
 dnl
 dnl  Configuration is finished
@@ -5622,9 +6039,6 @@ AC_SUBST(ALL_LINGUAS)
 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
 AC_SUBST(FILE_LIBVLC_DLL)
 
-dnl Import substitutions generated by bootstrap
-VLC_SUBSTS
-
 dnl Create vlc-config.in
 VLC_OUTPUT_VLC_CONFIG_IN
 
@@ -5640,7 +6054,8 @@ AC_CONFIG_FILES([
   doc/Makefile
   intl/Makefile
   ipkg/Makefile
-  loader/Makefile
+  libs/loader/Makefile
+  libs/srtp/Makefile
   modules/Makefile
   mozilla/Makefile
   m4/Makefile
@@ -5651,6 +6066,7 @@ AC_CONFIG_FILES([
 
 AC_CONFIG_FILES([
   modules/access/Makefile
+  modules/access/bda/Makefile
   modules/access/dshow/Makefile
   modules/access/dvb/Makefile
   modules/access/mms/Makefile
@@ -5709,7 +6125,7 @@ AC_CONFIG_FILES([
   modules/video_chroma/Makefile
   modules/video_filter/Makefile
   modules/video_output/Makefile
-  modules/video_output/directx/Makefile
+  modules/video_output/msw/Makefile
   modules/video_output/qte/Makefile
   modules/video_output/x11/Makefile
   modules/visualization/Makefile
@@ -5753,6 +6169,7 @@ test "${enable_optimizations}" = "yes" && printf "optim "
 test "${enable_release}" = "yes" && printf "release " || printf "devel "
 echo "
 vlc aliases           :${ALIASES}
+plugins/bindings      :${PLUGINS_BINDINGS}
 
 You can tune the compiler flags in vlc-config.
 To build vlc and its plugins, type \`./compile' or \`make'.