]> git.sesse.net Git - vlc/blobdiff - configure.ac
Fix win32 compile.
[vlc] / configure.ac
index ce8f7ab76d9ea014ae65e69773c3cfa7704e6697..f3d58e51f3f07a52d479284deb3058e74f28bc5f 100644 (file)
@@ -29,6 +29,24 @@ AS_IF([test "x${enable_maintainer_mode}" != "xno"],
        [enable_maintainer_mode="yes"])
 AM_MAINTAINER_MODE
 
+dnl
+dnl  Deprecated options
+dnl  to notify packagers that stuff has changed
+dnl
+AC_ARG_ENABLE(python-bindings,
+  [  --enable-python-bindings Always fails for historical reasons)],,
+  [enable_python_bindings="no"])
+AS_IF([test "${enable_python_bindings}" != "no"], [
+  AC_MSG_ERROR([Python bindings are now built from a separate source package])
+])
+
+AC_ARG_ENABLE(java-bindings,
+  [  --enable-java-bindings  Always fails for historical reasons],,
+  [enable_java_bindings="no"])
+AS_IF([test "${enable_java_bindings}" != "no"], [
+  AC_MSG_ERROR([Java bindings are now built from a separate source package])
+])
+
 dnl
 dnl  Save *FLAGS
 dnl
@@ -174,9 +192,9 @@ case "${host_os}" in
     VLC_ADD_LDFLAGS([mkv mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
     VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup])
     VLC_ADD_LDFLAGS([libvlc_control],[-Wl,dynamic_lookup])
-    VLC_ADD_LDFLAGS([ffmpeg i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress])
+    VLC_ADD_LDFLAGS([avcodec avformat swscale imgresample postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress])
     VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
-    VLC_ADD_LDFLAGS([libvlc],[-Wl,-framework,Cocoa,-framework,CoreFoundation])
+    VLC_ADD_LDFLAGS([libvlc],[-Wl,-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)])
@@ -213,6 +231,8 @@ case "${host_os}" in
         echo "  Assuming --enable-twolame"
         enable_realrtsp="yes"
         echo "  Assuming --enable-realrtsp"
+        enable_update_check="yes"
+        echo "  Assuming --enable-update-check"
 
         enable_skins2="no"
         echo "  Assuming --disable-skins2"
@@ -222,9 +242,6 @@ case "${host_os}" in
         echo "  Assuming --disable-glx"
         enable_xvideo="no"
         echo "  Assuming --disable-xvideo"
-
-        with_macosx_sdk=""
-        echo "  Compiling with default SDK"
     fi
     if test ".`uname -p`" = ".i386"; then
         dnl Due to a ld(64) bug in 10.5 we cannot use our mmx code
@@ -298,13 +315,13 @@ case "${host_os}" in
         VLC_ADD_LDFLAGS([vlc],[-mwindows])
         VLC_ADD_LIBS([activex mozilla],[-lgdi32])
         VLC_ADD_LIBS([cdda vcdx cddax sdl_image],[-lwinmm])
-        VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout sap slp http stream_out_standard stream_out_rtp vod_rtsp access_realrtsp telnet rc netsync gnutls growl_udp flac ts audioscrobbler lua],[-lws2_32])
+        VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap slp http stream_out_standard stream_out_rtp vod_rtsp access_realrtsp rtp telnet rc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd],[-lws2_32])
     fi
     if test "${SYS}" = "mingwce"; then
         # add ws2 for closesocket, select, recv
         VLC_ADD_CPPFLAGS([libvlc vlc],[-Dmain(a,b)=maince(a,b)])
         VLC_ADD_LDFLAGS([libvlc vlc],[-e WinMainCRTStartup])
-        VLC_ADD_LIBS([libvlc access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp sap http netsync audioscrobbler growl rtp stream_out_rtp],[-lws2])
+        VLC_ADD_LIBS([libvlc access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp sap http netsync audioscrobbler growl rtp stream_out_rtp remoteosd],[-lws2])
         VLC_ADD_LIBS([libvlc],[-lmmtimer])
    fi
     ;;
@@ -349,6 +366,7 @@ case "${host_os}" in
 esac
 AM_CONDITIONAL(HAVE_BEOS, test "${SYS}" = "beos")
 AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
+AM_CONDITIONAL(HAVE_LINUX, [test "${SYS}" = "linux"])
 AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
 AM_CONDITIONAL(HAVE_WINCE, test "${SYS}" = "mingwce")
 
@@ -460,9 +478,6 @@ dnl Plugin compilation stuff
 
 VLC_LIBRARY_SUFFIX
 
-VLC_SYMBOL_PREFIX
-AC_SUBST(SYMPREF)
-
 dnl The -DSYS_FOO flag
 CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
 
@@ -470,7 +485,7 @@ dnl Check for system libs needed
 need_libc=false
 
 dnl Check for usual libc functions
-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 strdup strndup strnlen atof lldiv posix_fadvise posix_madvise])
+AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid_r memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy strdup strndup strnlen atof lldiv posix_fadvise posix_madvise uselocale])
 AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
 AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
 AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
@@ -478,11 +493,7 @@ AC_FUNC_ALLOCA
 
 AH_BOTTOM([#include <vlc_fixups.h>])
 
-AC_CHECK_FUNCS(mmap, [VLC_ADD_PLUGINS([access_mmap])])
-
-AS_IF([test "${SYS}" = "linux"], [
-  AC_CHECK_FUNCS(tee)
-])
+AC_CHECK_FUNCS(mmap, [VLC_ADD_PLUGIN([access_mmap])])
 
 dnl Check for setlocal and langinfo
 AC_CHECK_FUNCS(setlocale)
@@ -509,7 +520,7 @@ AC_CHECK_FUNCS(connect,,[
 
 AC_CHECK_FUNCS(send,,[
   AC_CHECK_LIB(socket,send,[
-    VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp sap access_output_udp stream_out_standard growl_udp],[-lsocket])
+    VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp sap access_output_udp access_output_rtmp stream_out_standard growl_udp remoteosd],[-lsocket])
   ])
 ])
 
@@ -636,7 +647,7 @@ AC_CHECK_LIB(m,cos,[
   VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain],[-lm])
 ])
 AC_CHECK_LIB(m,pow,[
-  VLC_ADD_LIBS([ffmpeg ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer spatializer param_eq libvlc vorbis freetype mod mpc dmo quicktime realaudio galaktos opengl],[-lm])
+  VLC_ADD_LIBS([avcodec avformat swscale imgresample postproc ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer spatializer param_eq libvlc vorbis freetype mod mpc dmo quicktime realaudio realvideo galaktos opengl],[-lm])
 ])
 AC_CHECK_LIB(m,sqrt,[
   VLC_ADD_LIBS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm])
@@ -647,6 +658,9 @@ AC_CHECK_LIB(m,ceil,[
 AC_CHECK_LIB(m,exp,[
   VLC_ADD_LIBS([gaussianblur],[-lm])
 ])
+AC_CHECK_LIB(m,round,[
+  VLC_ADD_LIBS([dbus],[-lm])
+])
 AC_CHECK_LIB(mx,sqrtf,[
   VLC_ADD_LIBS([x264],[-lmx])
 ])
@@ -718,7 +732,7 @@ 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_LIBS([libvlc realaudio],[-ldl]),
+      VLC_ADD_LIBS([libvlc realaudio realvideo],[-ldl]),
       AC_CHECK_LIB(svld, dlopen,
         ac_cv_my_have_dlopen=yes
         VLC_ADD_LIBS([libvlc],[-lsvld]))))
@@ -849,19 +863,13 @@ AC_ARG_ENABLE(hal,
 if test "${enable_hal}" != "no"
 then
   PKG_CHECK_MODULES(HAL, hal >= 0.5.0,
-    [ AC_DEFINE( HAVE_HAL_1, 1 , [Define if you have the new HAL library API])
+    [
       AC_DEFINE( HAVE_HAL, 1, [Define if you have the HAL library] )
-      VLC_ADD_PLUGINS([hal probe_hal]) 
+      VLC_ADD_PLUGIN([hal])
+      VLC_ADD_PLUGIN([probe_hal])
       VLC_ADD_LIBS([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, 1, [Define if you have the HAL library])
-        VLC_ADD_PLUGINS([hal])
-        VLC_ADD_LIBS([libvlc hal],[$HAL_LIBS])
-        VLC_ADD_CFLAGS([libvlc hal],[$HAL_CFLAGS])],
-       [AC_MSG_WARN(HAL library not found)])
-    ]
+      VLC_ADD_CFLAGS([libvlc hal probe_hal],[$HAL_CFLAGS])],
+    [AC_MSG_WARN([libhal >= 0.5.0 was not found. Install libhal-dev ?])]
   )
 fi
 
@@ -874,74 +882,30 @@ if test "${enable_dbus}" != "no"
 then
   dnl api stable dbus
   PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0,
-    [ AC_DEFINE( HAVE_DBUS_3, 1, [Define if you have the D-BUS library API >= 1.0.0] )
-      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] )
+    [ AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
       VLC_ADD_LIBS([screensaver libvlc],[$DBUS_LIBS])
       VLC_ADD_CFLAGS([screensaver libvlc],[$DBUS_CFLAGS])
       dnl Check for dbus control interface
         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_PLUGIN([dbus])
           VLC_ADD_LIBS([dbus],[$DBUS_LIBS])
           VLC_ADD_CFLAGS([dbus],[$DBUS_CFLAGS])
         fi
       dnl Check for Telepathy
         AC_ARG_ENABLE(telepathy, [  --enable-telepathy      Telepathy Presence plugin through DBus(default enabled)])
         if test "${enable_telepathy}" != "no"; then
-          VLC_ADD_PLUGINS([telepathy])
+          VLC_ADD_PLUGIN([telepathy])
           VLC_ADD_LIBS([telepathy],[$DBUS_LIBS])
           VLC_ADD_CFLAGS([telepathy],[$DBUS_CFLAGS])
         fi
         dnl Power Management Inhibiter
-        VLC_ADD_PLUGINS([inhibit])
+        VLC_ADD_PLUGIN([inhibit])
         VLC_ADD_LIBS([inhibit],[$DBUS_LIBS])
         VLC_ADD_CFLAGS([inhibit],[$DBUS_CFLAGS])
-        ],
-    if ${PKG_CONFIG} --exists dbus-1
-    then
-      [AC_ARG_ENABLE(old-dbus,
-        [  --enable-old-dbus       Deprecated D-Bus support (default disabled)])]
-
-      if test "${enable_old_dbus}" != "yes"
-      then
-        echo ""
-        echo "****** WARNING **** WARNING ***** WARNING *************"
-        echo "*** Your D-Bus version is < 1.0.0"
-        echo "*** You are using old and buggy software and so"
-        echo "*** D-Bus support has been disabled."
-        echo "*** Please upgrade D-Bus : http://dbus.freedesktop.org"
-        echo "*** Alternatively you can force the use of your old and"
-        echo "*** buggy D-Bus version by specifying --enable-old-dbus"
-        echo "*******************************************************"
-        echo ""
-      else
-        dnl not too old dbus
-        [ PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.92,
-          [ 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_LIBS([screensaver],[$DBUS_LIBS])
-            VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
-          dnl older dbus
-          [ PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.30,
-            [ 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_LIBS([screensaver],[$DBUS_LIBS])
-              VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
-            dnl much older dbus
-            [ PKG_CHECK_MODULES( DBUS, dbus-1, 
-               [AC_DEFINE(HAVE_DBUS, 1, [Define if you have the D-BUS library])
-                VLC_ADD_LIBS([screensaver],[$DBUS_LIBS])
-                VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
-               [AC_MSG_WARN(DBUS library not found)])
-            ]
-          )]
-        )]
-      fi
-    fi
+    ],
+    [AC_MSG_ERROR([Couldn't find DBus >= 1.0.0, install libdbus-dev ?])]
   )
 fi
 ;;
@@ -971,15 +935,6 @@ CFLAGS="${CFLAGS_save}"
 RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast cast-align write-strings missing-prototypes volatile-register-var])
 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.
-dnl Unfortunately, this sucks on FreeBSD (won't even link with -lc)
-if test `uname -s` != FreeBSD; then
-  RDC_PROG_LINK_FLAGS_IFELSE([-Wl,-z,defs], [
-    VLC_ADD_LDFLAGS([plugin],[-Wl,-z,defs])
-  ])
-fi
-
 dnl Check for various optimization flags
 AC_CACHE_CHECK([if \$CC accepts -Os],
     [ac_cv_c_os],
@@ -1062,44 +1017,6 @@ if test "${ac_cv_c_omit_frame_pointer}" != "no"; then
     CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
 fi
 
-dnl Check for -fvisibility=hidden
-dnl Don't test on mingw32, because it is going to work with just a warning
-dnl even if it doesn't support it
-if test "${SYS}" != "mingw32"
-then
-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
-fi
-
-AM_CONDITIONAL(HAVE_COMPILER_EXPORT, [test "$SYS" = "mingw32" -o "${ac_cv_c_visibility_hidden}" != "no"])
-
-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
-dnl AC_CACHE_CHECK([if \$CC accepts -mdynamic-no-pic],
-dnl     [ac_cv_c_dynamic_no_pic],
-dnl     [CFLAGS="${CFLAGS_save} -mdynamic-no-pic"
-dnl      AC_TRY_COMPILE([],,ac_cv_c_dynamic_no_pic=yes, ac_cv_c_dynamic_no_pic=no)])
-dnl AS_IF([test "${ac_cv_c_dynamic_no_pic}" != "no"], [
-dnl     VLC_ADD_CFLAGS([builtin],[-mdynamic-no-pic])
-dnl     VLC_ADD_CFLAGS([libvlc],[-mdynamic-no-pic])
-dnl ])
-
 dnl Check for Darwin plugin linking flags
 AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error],
     [ac_cv_ld_darwin],
@@ -1109,20 +1026,6 @@ if test "${ac_cv_ld_darwin}" != "no"; then
     VLC_ADD_LDFLAGS([plugin],[-bundle -undefined error])
 fi
 
-dnl Check for standard plugin linking flags
-dnl BeOS' gcc needs -nostart instead of -shared, even if -shared isn't harmful (just a warning)
-dnl AS_IF([test "${SYS}" = "beos"], [
-dnl   VLC_ADD_LDFLAGS([plugin mozilla],[-nostart])
-dnl ], [
-dnl   AC_CACHE_CHECK([if \$CC accepts -shared],
-dnl         [ac_cv_ld_plugins],
-dnl         [CFLAGS="${CFLAGS_save} -shared"
-dnl        AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
-dnl   AS_IF([test "${ac_cv_ld_plugins}" != "no"], [
-dnl     VLC_ADD_LDFLAGS([plugin mozilla],[-shared])
-dnl   ])
-dnl ])
-
 dnl Checks for __attribute__(aligned()) directive
 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
     [ac_cv_c_attribute_aligned],
@@ -1139,19 +1042,6 @@ if test "${ac_cv_c_attribute_aligned}" != "0"; then
         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
 fi
 
-dnl Checks for __attribute__(format()) directive
-AC_CACHE_CHECK([__attribute__ ((format ())) support with function pointers],
-    [ac_cv_c_attribute_format],
-    [ac_cv_c_attribute_format=no
-        CFLAGS="${CFLAGS_save} -Werror"
-        AC_TRY_COMPILE([],
-        [static void (*pf_printf)(const char *, ...) __attribute__ ((format(printf,1,2)));(void)pf_printf;],
-        [ac_cv_c_attribute_format=yes])
-        CFLAGS="${CFLAGS_save}"])
-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__((packed))
 AC_CACHE_CHECK([for __attribute__((packed))],
   [ac_cv_c_attribute_packed],
@@ -1162,16 +1052,6 @@ 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
@@ -1184,6 +1064,10 @@ case "${host_cpu}" in
     ;;
 esac
 
+dnl Check for backtrace() support
+AC_CHECK_HEADERS(execinfo.h)
+AC_CHECK_FUNCS(backtrace)
+
 dnl
 dnl  Enable profiling
 dnl
@@ -1197,22 +1081,91 @@ test "${enable_cprof}" != "yes" && enable_cprof="no"
 dnl
 dnl  default modules
 dnl
-VLC_ADD_PLUGINS([dummy logger memcpy])
-VLC_ADD_PLUGINS([mpgv mpga m4v m4a h264 vc1 demux_cdg cdg ps pva avi asf mp4 rawdv rawvid nsv real aiff mjpeg demuxdump flacsys tta])
-VLC_ADD_PLUGINS([cvdsub svcdsub spudec subsdec subsusf t140 dvbsub cc mpeg_audio lpcm a52 dts cinepak flac])
-VLC_ADD_PLUGINS([deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise grain extract sharpen seamcarving croppadd blendbench])
-VLC_ADD_PLUGINS([converter_fixed mono])
-VLC_ADD_PLUGINS([trivial_resampler ugly_resampler])
-VLC_ADD_PLUGINS([trivial_channel_mixer trivial_mixer])
-VLC_ADD_PLUGINS([playlist export nsc xtag])
-VLC_ADD_PLUGINS([i420_rgb grey_yuv rawvideo blend scale image vmem logo magnify puzzle colorthres])
-VLC_ADD_PLUGINS([wav araw subtitle vobsub adpcm a52sys dtssys au ty voc xa nuv smf])
-VLC_ADD_PLUGINS([access_directory access_file access_udp access_tcp])
-VLC_ADD_PLUGINS([access_http access_mms access_ftp access_rtmp])
-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])
+VLC_ADD_PLUGIN([dummy])
+VLC_ADD_PLUGIN([stats])
+VLC_ADD_PLUGIN([logger])
+VLC_ADD_PLUGIN([memcpy])
+dnl Demuxers:
+VLC_ADD_PLUGIN([mpgv])
+VLC_ADD_PLUGIN([mpga])
+VLC_ADD_PLUGIN([m4v])
+VLC_ADD_PLUGIN([m4a])
+VLC_ADD_PLUGIN([h264])
+VLC_ADD_PLUGIN([cdg])
+VLC_ADD_PLUGIN([ps])
+VLC_ADD_PLUGIN([avi])
+VLC_ADD_PLUGIN([asf])
+VLC_ADD_PLUGIN([mp4])
+dnl Text codecs:
+VLC_ADD_PLUGIN([cvdsub])
+VLC_ADD_PLUGIN([svcdsub])
+VLC_ADD_PLUGIN([spudec])
+VLC_ADD_PLUGIN([subsdec])
+VLC_ADD_PLUGIN([subsusf])
+VLC_ADD_PLUGIN([t140])
+VLC_ADD_PLUGIN([dvbsub])
+VLC_ADD_PLUGIN([cc])
+dnl Video codecs:
+VLC_ADD_PLUGIN([cinepak])
+dnl Audio codecs:
+VLC_ADD_PLUGIN([araw])
+VLC_ADD_PLUGIN([adpcm])
+VLC_ADD_PLUGIN([mpeg_audio])
+VLC_ADD_PLUGIN([lpcm])
+VLC_ADD_PLUGIN([a52])
+VLC_ADD_PLUGIN([dts])
+VLC_ADD_PLUGIN([flac])
+dnl Video filters:
+VLC_ADD_PLUGIN([deinterlace])
+VLC_ADD_PLUGIN([invert])
+VLC_ADD_PLUGIN([adjust])
+VLC_ADD_PLUGIN([transform])
+VLC_ADD_PLUGIN([wave])
+VLC_ADD_PLUGIN([ripple])
+VLC_ADD_PLUGIN([psychedelic])
+VLC_ADD_PLUGIN([gradient])
+VLC_ADD_PLUGIN([motionblur])
+VLC_ADD_PLUGIN([rv32])
+VLC_ADD_PLUGIN([rotate])
+VLC_ADD_PLUGIN([noise])
+VLC_ADD_PLUGIN([grain])
+VLC_ADD_PLUGIN([extract])
+VLC_ADD_PLUGIN([sharpen])
+VLC_ADD_PLUGIN([seamcarving])
+VLC_ADD_PLUGIN([croppadd])
+VLC_ADD_PLUGIN([blendbench])
+VLC_ADD_PLUGIN([blend])
+VLC_ADD_PLUGIN([scale])
+VLC_ADD_PLUGIN([image])
+VLC_ADD_PLUGIN([vmem])
+VLC_ADD_PLUGIN([logo])
+VLC_ADD_PLUGIN([magnify])
+VLC_ADD_PLUGIN([puzzle])
+VLC_ADD_PLUGIN([colorthres])
+dnl Meta demuxers:
+VLC_ADD_PLUGIN([playlist])
+VLC_ADD_PLUGIN([export])
+VLC_ADD_PLUGIN([nsc])
+VLC_ADD_PLUGIN([xtag])
+dnl Channel mixing audio filters:
+VLC_ADD_PLUGIN([converter_fixed])
+VLC_ADD_PLUGIN([mono])
+VLC_ADD_PLUGIN([trivial_channel_mixer])
+dnl Resampling audio filters:
+VLC_ADD_PLUGIN([trivial_resampler])
+VLC_ADD_PLUGIN([ugly_resampler])
+dnl Audio mixers:
+VLC_ADD_PLUGIN([trivial_mixer])
+dnl Video chromas:
+VLC_ADD_PLUGIN([i420_rgb])
+VLC_ADD_PLUGIN([grey_yuv])
+dnl Video codecs:
+VLC_ADD_PLUGIN([rawvideo])
+dnl Access filters:
+VLC_ADD_PLUGIN([access_filter_timeshift])
+VLC_ADD_PLUGIN([access_filter_record])
+VLC_ADD_PLUGIN([access_filter_dump])
+VLC_ADD_PLUGIN([access_filter_bandwidth])
 
 ALIASES="${ALIASES} cvlc"
 
@@ -1220,18 +1173,52 @@ dnl
 dnl default modules that need g++
 dnl
 AC_LANG_PUSH(C++)
-VLC_ADD_PLUGINS([spatializer])
+VLC_ADD_PLUGIN([spatializer])
 AC_LANG_POP(C++)
 
 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 showintf marq podcast shout sap fake folder])
-  VLC_ADD_PLUGINS([rss mosaic wall motiondetect clone crop erase bluescreen alphamask gaussianblur])
-  VLC_ADD_PLUGINS([i420_yuy2 i422_yuy2 i420_ymga i422_i420 yuy2_i422 yuy2_i420 chroma_chain])
-  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 param_eq])
-  VLC_ADD_PLUGINS([converter_float a52tospdif dtstospdif audio_format])
+  VLC_ADD_PLUGIN([gestures])
+  VLC_ADD_PLUGIN([rc])
+  VLC_ADD_PLUGIN([hotkeys])
+  VLC_ADD_PLUGIN([showintf])
+  VLC_ADD_PLUGIN([marq])
+  VLC_ADD_PLUGIN([podcast])
+  VLC_ADD_PLUGIN([shout])
+  VLC_ADD_PLUGIN([sap])
+  VLC_ADD_PLUGIN([fake])
+  VLC_ADD_PLUGIN([folder])
+  VLC_ADD_PLUGIN([rss])
+  VLC_ADD_PLUGIN([mosaic])
+  VLC_ADD_PLUGIN([wall])
+  VLC_ADD_PLUGIN([motiondetect])
+  VLC_ADD_PLUGIN([clone])
+  VLC_ADD_PLUGIN([crop])
+  VLC_ADD_PLUGIN([erase])
+  VLC_ADD_PLUGIN([bluescreen])
+  VLC_ADD_PLUGIN([alphamask])
+  VLC_ADD_PLUGIN([gaussianblur])
+  VLC_ADD_PLUGIN([i420_yuy2])
+  VLC_ADD_PLUGIN([i422_yuy2])
+  VLC_ADD_PLUGIN([i420_ymga])
+  VLC_ADD_PLUGIN([i422_i420])
+  VLC_ADD_PLUGIN([yuy2_i422])
+  VLC_ADD_PLUGIN([yuy2_i420])
+  VLC_ADD_PLUGIN([chroma_chain])
+  VLC_ADD_PLUGIN([aout_file])
+  VLC_ADD_PLUGIN([linear_resampler])
+  VLC_ADD_PLUGIN([bandlimited_resampler])
+  VLC_ADD_PLUGIN([float32_mixer])
+  VLC_ADD_PLUGIN([spdif_mixer])
+  VLC_ADD_PLUGIN([simple_channel_mixer])
+  VLC_ADD_PLUGIN([dolby_surround_decoder])
+  VLC_ADD_PLUGIN([headphone_channel_mixer])
+  VLC_ADD_PLUGIN([normvol])
+  VLC_ADD_PLUGIN([equalizer])
+  VLC_ADD_PLUGIN([param_eq])
+  VLC_ADD_PLUGIN([converter_float])
+  VLC_ADD_PLUGIN([a52tospdif])
+  VLC_ADD_PLUGIN([dtstospdif])
+  VLC_ADD_PLUGIN([audio_format])
   ALIASES="${ALIASES} rvlc"
 fi
 
@@ -1239,36 +1226,48 @@ dnl
 dnl Some plugins aren't useful on some platforms
 dnl
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
-    VLC_ADD_PLUGINS([screensaver motion])
-    VLC_ADD_PLUGINS([dynamicoverlay])
+    VLC_ADD_PLUGIN([screensaver])
+    VLC_ADD_PLUGIN([motion])
+    VLC_ADD_PLUGIN([dynamicoverlay])
+    VLC_ADD_PLUGIN([signals])
 elif test "${SYS}" != "mingwce"; then
-    VLC_ADD_PLUGINS([ntservice access_smb dmo msn])
+    VLC_ADD_PLUGIN([ntservice])
+    VLC_ADD_PLUGIN([access_smb])
+    VLC_ADD_PLUGIN([dmo])
+    VLC_ADD_PLUGIN([msn])
     VLC_ADD_LIBS([dmo],[-lole32 -luuid])
 else
-    VLC_ADD_PLUGINS([win32text])
+    VLC_ADD_PLUGIN([win32text])
 fi
 if test "${SYS}" = "darwin"; then
-    VLC_ADD_PLUGINS([quartztext])
+    VLC_ADD_PLUGIN([quartztext])
     VLC_ADD_LDFLAGS([quartztext],[-Wl,-framework,Carbon,-framework,ApplicationServices])
 fi
 
 dnl
 dnl  Accelerated modules
 dnl
-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 i422_yuy2_sse2"
-ALTIVEC_MODULES="memcpyaltivec i420_yuy2_altivec"
-#ALTIVEC_MODULES="${ALTIVEC_MODULES} idctaltivec motionaltivec"
-
-dnl  Check for fully workin MMX intrinsics
+AC_ARG_WITH(,[])
+AC_ARG_WITH(,[Optimization options:])
+
+dnl  Check for fully working 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)
-AC_CACHE_CHECK([if \$CC groks MMX intrinsics],
+AC_ARG_ENABLE(mmx,
+[  --disable-mmx           disable MMX optimizations (default auto)],,[
+  case "${host_cpu}" in
+    i?86|x86_64)
+      enable_mmx="yes"
+      ;;
+    *)
+      enable_mmx="no"
+      ;;
+  esac
+])
+AS_IF([test "${enable_mmx}" != "no"], [
+  ARCH="${ARCH} mmx"
+
+  AC_CACHE_CHECK([if $CC groks MMX intrinsics],
     [ac_cv_c_mmx_intrinsics],
     [CFLAGS="${CFLAGS_save} -O -mmmx"
      AC_TRY_COMPILE([#include <mmintrin.h>
@@ -1285,15 +1284,58 @@ AC_CACHE_CHECK([if \$CC groks MMX intrinsics],
                      frobzor = (uint64_t)a;],
                     [ac_cv_c_mmx_intrinsics=yes],
                     [ac_cv_c_mmx_intrinsics=no])])
-if test "${ac_cv_c_mmx_intrinsics}" != "no"; then
-  AC_DEFINE(HAVE_MMX_INTRINSICS, 1, Define if MMX intrinsics are available.)
-  VLC_ADD_CFLAGS([${MMX_MODULES}],[-mmmx])
-fi
+  AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
+    AC_DEFINE(HAVE_MMX_INTRINSICS, 1,
+              [Define to 1 if MMX intrinsics are available.])
+    VLC_ADD_CFLAGS([memcpymmx i420_rgb_mmx i420_yuy2_mmx i422_yuy2_mmx i420_ymga_mmx],[-mmmx])
+  ])
+
+  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)])
+  AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
+    AC_DEFINE(CAN_COMPILE_MMX, 1,
+              [Define to 1 inline MMX assembly is available.])
+    VLC_ADD_PLUGIN([memcpymmx])
+    VLC_ADD_PLUGIN([i420_rgb_mmx])
+    VLC_ADD_PLUGIN([i420_yuy2_mmx])
+    VLC_ADD_PLUGIN([i422_yuy2_mmx])
+    VLC_ADD_PLUGIN([i420_ymga_mmx])
+  ])
+
+  AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
+    [ac_cv_mmxext_inline],
+    [CFLAGS="${CFLAGS_save}"
+     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
+                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
+  AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
+    AC_DEFINE(CAN_COMPILE_MMXEXT, 1,
+              [Define to 1 if MMX EXT inline assembly is available.])
+    VLC_ADD_PLUGIN([memcpymmxext])
+  ])
+])
 
 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_ARG_ENABLE(sse,
+[  --disable-sse           disable SSE (1 and 2) optimizations (default auto)]
+,, [
+  case "${host_cpu}" in
+    i686|x86_64)
+      enable_sse=yes
+      ;;
+    *)
+      enable_sse=no
+      ;;
+  esac
+])
+AS_IF([test "${enable_sse}" != "no"], [
+  ARCH="${ARCH} sse sse2"
+
+  AC_CACHE_CHECK([if $CC groks SSE2 intrinsics],
     [ac_cv_c_sse2_intrinsics],
     [CFLAGS="${CFLAGS_save} -O -msse2"
      AC_TRY_COMPILE([#include <emmintrin.h>
@@ -1310,83 +1352,77 @@ AC_CACHE_CHECK([if \$CC groks SSE2 intrinsics],
                      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([${SSE2_MODULES}],[-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}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
-                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
-if test "${ac_cv_mmxext_inline}" != "no"; then
-  AC_DEFINE(CAN_COMPILE_MMXEXT, 1, Define if \$CC groks MMX EXT inline assembly.)
-  ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
-fi
-
-AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
-    [ac_cv_3dnow_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
-                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
-if test "${ac_cv_3dnow_inline}" != "no"; then
-  AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
-  ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
-fi
+  AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
+    AC_DEFINE(HAVE_SSE2_INTRINSICS, 1,
+              [Define to 1 if SSE2 intrinsics are available.])
+    VLC_ADD_CFLAGS([i420_rgb_sse2 i420_yuy2_sse2 i422_yuy2_sse2],[-msse2])
+  ])
 
-AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
+  AC_CACHE_CHECK([if $CC groks SSE inline assembly],
     [ac_cv_sse_inline],
     [CFLAGS="${CFLAGS_save}"
      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
-if test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"; then
-  AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
-  ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
-fi
+  AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
+    AC_DEFINE(CAN_COMPILE_SSE, 1,
+              [Define to 1 if SSE inline assembly is available.])
+  ])
 
-AC_CACHE_CHECK([if \$CC groks SSE2 inline assembly],
+  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
+  AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
+    AC_DEFINE(CAN_COMPILE_SSE2, 1,
+              [Define to 1 if SSE2 inline assembly is available.])
+    VLC_ADD_PLUGIN([i420_rgb_sse2])
+    VLC_ADD_PLUGIN([i420_yuy2_sse2])
+    VLC_ADD_PLUGIN([i422_yuy2_sse2])
+  ])
+])
 
-if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
-AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
+AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly],
+    [ac_cv_3dnow_inline],
+    [CFLAGS="${CFLAGS_save}"
+     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
+                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
+AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
+  AC_DEFINE(CAN_COMPILE_3DNOW, 1,
+            [Define to 1 if 3D Now! inline assembly is available.])
+  VLC_ADD_PLUGIN([memcpy3dn])
+])
+
+AC_ARG_ENABLE(altivec,
+[  --disable-altivec       disable AltiVec optimizations (default auto)],, [
+  AS_IF([test "${host_cpu}" = "powerpc"],
+        [enable_altivec=yes], [enable_altivec=no])
+])
+AS_IF([test "${enable_altivec}" = "yes"], [
+  ARCH="${ARCH} altivec";
+  AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
     [ac_cv_altivec_inline],
     [CFLAGS="${CFLAGS_save}"
      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
-         ac_cv_altivec_inline=yes,
+         ac_cv_altivec_inline="yes",
          [CFLAGS="${CFLAGS_save} -Wa,-m7400"
           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
             [ac_cv_altivec_inline="-Wa,-m7400"],
             ac_cv_altivec_inline=no)
          ])])
-if test "${ac_cv_altivec_inline}" != "no"; then
-  AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
-  if test "${ac_cv_altivec_inline}" != "yes"; then
-    VLC_ADD_CFLAGS([idctaltivec],[${ac_cv_altivec_inline}])
-    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([libvlc],[${ac_cv_altivec_inline}])
-  fi
-  ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
-fi
+  AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
+    AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
+              [Define to 1 if AltiVec inline assembly is available.])
+    AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
+      VLC_ADD_CFLAGS([idctaltivec],[${ac_cv_altivec_inline}])
+      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([libvlc],[${ac_cv_altivec_inline}])
+    ])
+    VLC_ADD_PLUGIN([memcpyaltivec])
+    VLC_ADD_PLUGIN([i420_yuy2_altivec])
+  ])
 
 dnl The AltiVec C extensions
 dnl
@@ -1398,7 +1434,7 @@ dnl - Linux PPC, gcc 3.4, 4.x: need <altivec.h> which requires -maltivec
 dnl - Linux PPC, gcc 3.3: need <altivec.h> and -maltivec -mabi=altivec
 dnl - Linux PPC, gcc 3.x: need <altivec.h> and -fvec
 dnl - Others: test should fail
-AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
+  AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
   [ac_cv_c_altivec],
   [# OS X/PPC test (gcc 4.x)
    CFLAGS="${CFLAGS_save} -mpim-altivec -force_cpusubtype_ALL"
@@ -1434,42 +1470,33 @@ AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
      ])
    CFLAGS="${CFLAGS_save}"
   ])
+  AS_IF([test "${ac_cv_c_altivec}" != "no"], [
+    CPPFLAGS="${CPPFLAGS_save} ${ac_cv_c_altivec}"
+  ])
 
-if test "${ac_cv_c_altivec}" != "no"; then
-  CPPFLAGS="${CPPFLAGS_save} ${ac_cv_c_altivec}"
-fi
-
-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.)
+  AS_IF([test "${ac_cv_c_altivec}" != "no"], [
+    AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1,
+              [Define to 1 if C AltiVec extensions are available.])
     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
-],[
-  CPPFLAGS="${CPPFLAGS_save}"
-])
+    VLC_ADD_PLUGIN([memcpyaltivec])
+    VLC_ADD_PLUGIN([i420_yuy2_altivec])
+  ])
 
-AC_CACHE_CHECK([if linker needs -framework vecLib],
+  AC_CACHE_CHECK([if linker needs -framework vecLib],
     [ac_cv_ld_altivec],
     [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([libvlc idctaltivec motionaltivec memcpyaltivec],[-Wl,-framework,vecLib])
-fi
-fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
-
-AC_ARG_WITH(,[])
-AC_ARG_WITH(,[Optimization options:])
+  AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
+    VLC_ADD_LDFLAGS([libvlc idctaltivec motionaltivec memcpyaltivec],[-Wl,-framework,vecLib])
+  ])
+])
 
 dnl
 dnl  Special arch tuning
@@ -1509,24 +1536,6 @@ AS_IF([test "${CFLAGS_TUNING}"],
     CFLAGS="${CFLAGS_save}"
 ])
 
-dnl
-dnl  x86 accelerations
-dnl
-AC_ARG_ENABLE(mmx,
-[  --disable-mmx       disable MMX optimizations (default enabled on x86)],
-[ if test "${enable_mmx}" = "yes"; then ARCH="${ARCH} mmx";
-    VLC_ADD_PLUGINS([${ACCEL_MODULES}]) fi ],
-[ 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_PLUGINS([${ACCEL_MODULES}]) fi ])
-
-AC_ARG_ENABLE(sse,
-[  --disable-sse       disable SSE (1 and 2) optimizations (default enabled on i686 and x86_64)],
-[ if test "${enable_sse}" = "yes"; then ARCH="${ARCH} sse sse2";
-    VLC_ADD_PLUGINS([${ACCEL_MODULES}]) fi ],
-[ if test "${host_cpu}" = "i686" -o "${host_cpu}" = "x86_64"; then ARCH="${ARCH} sse sse2";
-    VLC_ADD_PLUGINS([${ACCEL_MODULES}]) fi ])
-
 dnl
 dnl  Memory usage
 dnl
@@ -1549,16 +1558,6 @@ if test "${enable_optimizations}" != "no"; then
    fi
 fi
 
-dnl
-dnl  AltiVec acceleration
-dnl
-AC_ARG_ENABLE(altivec,
-[  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
-[ if test "${enable_altivec}" = "yes"; then ARCH="${ARCH} altivec";
-    VLC_ADD_PLUGINS([${ACCEL_MODULES}]) fi ],
-[ if test "${host_cpu}" = "powerpc"; then ARCH="${ARCH} altivec";
-    VLC_ADD_PLUGINS([${ACCEL_MODULES}]) fi ])
-
 dnl
 dnl  Debugging mode
 dnl
@@ -1597,21 +1596,10 @@ dnl Stream output
 dnl
 AC_ARG_ENABLE(sout,
   [  --enable-sout           Stream output modules (default enabled)])
-if test "${enable_sout}" != "no"
-then
-  VLC_ADD_PLUGINS([access_output_dummy access_output_udp access_output_file access_output_http])
-  VLC_ADD_PLUGINS([mux_ps mux_avi mux_mp4 mux_asf mux_dummy mux_wav mux_mpjpeg])
-  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_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])
-
-  AC_DEFINE(ENABLE_SOUT, 1, Define if you want the stream output support)
-fi
+AS_IF([test "${enable_sout}" != "no"], [
+  AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
+])
+AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
 
 AC_ARG_ENABLE(switcher,
   [  --enable-switcher       Stream-out switcher plugin (default disabled)])
@@ -1622,7 +1610,7 @@ AC_ARG_ENABLE(shout,
 if test "${enable_shout}" = "yes"; then
   PKG_CHECK_MODULES(SHOUT, shout >= 2.1,
     [AC_DEFINE(HAVE_SHOUT, 1, [Define if you have the libshout library])
-     VLC_ADD_PLUGINS([access_output_shout])
+     VLC_ADD_PLUGIN([access_output_shout])
      VLC_ADD_LIBS([access_output_shout],[$SHOUT_LIBS])
      VLC_ADD_CFLAGS([access_output_shout],[$SHOUT_CFLAGS])],
     [AC_MSG_WARN(libshout library not found)])
@@ -1630,7 +1618,7 @@ fi
 
 dnl Lua modules
 AC_ARG_ENABLE(lua,
-  [  --enable-lua            lua playlist and metafetcher plugins (default enabled)])
+  [  --enable-lua            lua playlist, metafetcher and interface plugins (default enabled)])
 if test "${enable_lua}" != "no"
 then
   PKG_CHECK_MODULES(LUA, lua5.1,
@@ -1659,7 +1647,6 @@ then
     ])
   if test "x${have_lua}" = "xyes" ;  then
      AC_DEFINE(HAVE_LUA, 1, [Define if you have the lua library])
-     VLC_ADD_PLUGINS([lua])
      VLC_ADD_LIBS([lua],[$LUA_LIBS])
      VLC_ADD_CFLAGS([lua],[$LUA_CFLAGS])
   fi
@@ -1673,20 +1660,39 @@ AC_ARG_ENABLE(httpd,
   [  --enable-httpd          HTTP daemon (default enabled)])
 if test "${enable_httpd}" != "no"
 then
-  VLC_ADD_PLUGINS([http])
+  VLC_ADD_PLUGIN([http])
   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP dameon support)
 fi
 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
 
+dnl
+dnl libproxy support
+dnl
+AC_ARG_ENABLE(libproxy,
+  [  --enable-libproxy       libproxy support (default auto)])
+AS_IF([test "${enable_libproxy}" != "no"], [
+  AC_CHECK_HEADERS(proxy.h, [
+    VLC_ADD_LIBS([access_http],[-lproxy])
+  ], [
+    AS_IF([test "x${enable_libproxy}" != "x"], [
+      AC_MSG_ERROR([libproxy could not be found on your system])
+    ])
+  ])
+])
+
 dnl
 dnl VideoLAN manager
 dnl
 AC_ARG_ENABLE(vlm,
-  [  --enable-vlm            VideoLAN manager (default enabled)])
-if test "${enable_vlm}" != "no"
-then
-  AC_DEFINE(ENABLE_VLM, 1, Define if you want the VideoLAN manager support)
-fi
+  [  --enable-vlm            VideoLAN manager (default enabled)],,
+  [enable_vlm="${enable_sout}"])
+AS_IF([test "${enable_vlm}" != "no"], [
+  AS_IF([test "${enable_sout}" = "no"], [
+    AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
+  ])
+  AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
+  VLC_ADD_PLUGIN([telnet])
+])
 
 dnl
 dnl Growl notification plugin
@@ -1694,9 +1700,9 @@ dnl
 AC_ARG_ENABLE(growl,
   [  --enable-growl          growl notification plugin (default enabled)])
 AS_IF([test "${enable_growl}" != "no"], [
-    VLC_ADD_PLUGINS([growl_udp])
+    VLC_ADD_PLUGIN([growl_udp])
     AC_CHECK_HEADERS(Growl/GrowlDefines.h, [
-      VLC_ADD_PLUGINS([growl])
+      VLC_ADD_PLUGIN([growl])
       VLC_ADD_LDFLAGS([growl], [-Wl,-framework,Growl,-framework,AppKit])
     ])
   ]
@@ -1711,7 +1717,7 @@ AC_ARG_ENABLE(notify,
 AS_IF([test "${enable_notify}" != "no" -a "${SYS}" != "mingw32"], [
     PKG_CHECK_MODULES(NOTIFY, libnotify,
       [
-        VLC_ADD_PLUGINS([notify])
+        VLC_ADD_PLUGIN([notify])
         VLC_ADD_CFLAGS(notify, [$NOTIFY_CFLAGS])
         VLC_ADD_LIBS(notify, [$NOTIFY_LIBS])
       ],[
@@ -1727,7 +1733,7 @@ dnl
 AC_ARG_ENABLE(audioscrobbler,
   [  --disable-audioscrobbler Last.fm submission plugin (default enabled)])
 AS_IF([test "${enable_audioscrobbler}" != "no"], [
-        VLC_ADD_PLUGINS([audioscrobbler])
+        VLC_ADD_PLUGIN([audioscrobbler])
   ])
 
 dnl
@@ -1737,7 +1743,7 @@ AC_ARG_ENABLE(musicbrainz,
   [  --enable-musicbrainz    MusicBrainz support (default disabled) ])
   AS_IF([test "${enable_musicbrainz}" = "yes"],[
       PKG_CHECK_MODULES(MUSICBRAINZ, libmusicbrainz,
-    [ VLC_ADD_PLUGINS([musicbrainz])
+    [ VLC_ADD_PLUGIN([musicbrainz])
       VLC_ADD_LIBS([musicbrainz],[$MUSICBRAINZ_LIBS])
       VLC_ADD_CFLAGS([musicbrainz],[$MUSICBRAINZ_CFLAGS])  ],
        [AC_MSG_WARN(MusicBrainz library not found)])
@@ -1752,7 +1758,7 @@ AC_ARG_ENABLE(taglib,
   AS_IF([test "${enable_taglib}" != "no"],[
     PKG_CHECK_MODULES(TAGLIB, taglib,
       [ AC_DEFINE( HAVE_TAGLIB, 1, [Define if you have taglib plugin built] )
-        VLC_ADD_PLUGINS([taglib])
+        VLC_ADD_PLUGIN([taglib])
         VLC_ADD_LIBS([taglib],[$TAGLIB_LIBS -lz])
        VLC_ADD_CXXFLAGS([taglib],[$TAGLIB_CFLAGS]) ],
       [AC_MSG_WARN(TagLib library not found)])
@@ -1803,12 +1809,12 @@ if test "${enable_live555}" != "no"; then
       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
       AC_CHECK_LIB(liveMedia_pic, main, [
         # We have -lliveMedia_pic, build plugins
-        VLC_ADD_PLUGINS([live555])
+        VLC_ADD_PLUGIN([live555])
         VLC_ADD_LIBS([live555], [-lliveMedia_pic -lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic])
       ], [
         AC_CHECK_LIB(liveMedia, main, [
           # We only have -lliveMedia, do builtins
-          VLC_ADD_BUILTINS([live555])
+          VLC_ADD_PLUGIN([live555])
           VLC_ADD_LIBS([live555], [-lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment])
         ])
       ])
@@ -1830,7 +1836,7 @@ if test "${enable_live555}" != "no"; then
     if test -f "${real_live555_tree}/liveMedia/libliveMedia.a"; then
       AC_MSG_RESULT(${real_live555_tree}/liveMedia/libliveMedia.a)
 
-      VLC_ADD_BUILTINS([live555])
+      VLC_ADD_PLUGIN([live555])
 
       if test "${SYS}" = "mingw32"; then
         # add ws2_32 for closesocket, select, recv
@@ -1870,7 +1876,7 @@ then
     AC_CHECK_LIB( raw1394, raw1394_get_nodecount, [
         AC_CHECK_HEADERS(libdc1394/dc1394_control.h , [
 dnl         AC_CHECK_LIB( dc1394_control, dc1394_setup_capture, [
-              VLC_ADD_PLUGINS([dc1394])
+              VLC_ADD_PLUGIN([dc1394])
               VLC_ADD_LIBS([dc1394],[-ldc1394_control -lraw1394])
 dnl         ],
 dnl         [
@@ -1909,7 +1915,7 @@ then
     then
       dnl  Use ${with_dv_raw1394}/include/libraw1394/raw1394.h
       AC_MSG_RESULT(yes)
-      VLC_ADD_PLUGINS([access_dv])
+      VLC_ADD_PLUGIN([access_dv])
       VLC_ADD_LIBS([access_dv],[-L${with_dv_raw1394}/lib -lraw1394 -lpthread])
       VLC_ADD_CPPFLAGS([access_dv],[-I${with_dv_raw1394}/include])
     else
@@ -1919,7 +1925,7 @@ then
     fi
   else
     AC_CHECK_HEADERS(libraw1394/raw1394.h,
-    [ VLC_ADD_PLUGINS([access_dv])
+    [ VLC_ADD_PLUGIN([access_dv])
         VLC_ADD_LIBS([access_dv],[-lraw1394 -lavc1394])
     ],[
         if test -n "${enable_dv}"
@@ -2035,7 +2041,7 @@ then
     if test -z "${with_dvdread_tree}"
     then
       AC_CHECK_HEADERS(dvdread/dvd_reader.h,
-        [ VLC_ADD_PLUGINS([dvdread])
+        [ VLC_ADD_PLUGIN([dvdread])
           VLC_ADD_LIBS([dvdread],[-ldvdread ${LIBS_dvdcss}])
         ],[
           if test -n "${enable_dvdread}"
@@ -2071,7 +2077,7 @@ then
     then
       dnl  Use ${with_dvdread}/include/dvdread/dvd_reader.h
       AC_MSG_RESULT(yes)
-      VLC_ADD_PLUGINS([dvdread])
+      VLC_ADD_PLUGIN([dvdread])
       VLC_ADD_LIBS([dvdread],[-L${with_dvdread}/lib -ldvdread ${LIBS_dvdcss}])
       VLC_ADD_CPPFLAGS([dvdread],[-I${with_dvdread}/include])
     else
@@ -2104,7 +2110,7 @@ then
   AC_PATH_PROG(DVDNAV_CONFIG, dvdnav-config, no, ${DVDNAV_PATH})
   if test "${DVDNAV_CONFIG}" != "no"
   then
-    VLC_ADD_PLUGINS([dvdnav])
+    VLC_ADD_PLUGIN([dvdnav])
     VLC_ADD_CFLAGS([dvdnav],[`${DVDNAV_CONFIG} --cflags`])
     VLC_ADD_LIBS([dvdnav],[`${DVDNAV_CONFIG} --libs`])
   fi
@@ -2121,7 +2127,7 @@ then
   then
     AC_LANG_PUSH(C++)
       AC_CHECK_HEADERS(dshow.h,
-      [ VLC_ADD_PLUGINS([dshow])
+      [ VLC_ADD_PLUGIN([dshow])
         VLC_ADD_CXXFLAGS([dshow],[])
         VLC_ADD_LIBS([dshow],[-lole32 -loleaut32 -luuid]) ])
     AC_LANG_POP(C++)
@@ -2138,7 +2144,7 @@ then
   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
   then
       AC_CHECK_HEADERS(dshow.h,
-      [ VLC_ADD_PLUGINS([bda])
+      [ VLC_ADD_PLUGIN([bda])
         VLC_ADD_CXXFLAGS([bda],[])
         VLC_ADD_LIBS([bda],[-lstrmiids -lole32 -loleaut32 -luuid]) ])
   fi
@@ -2154,20 +2160,19 @@ if test "${enable_opencv}" = "yes" -a "${CXX}" != "";
 then
   AC_ARG_WITH(opencv-tree,
   [    --with-opencv-tree=PATH opencv tree for linking])
-  if test -n "${with_opencv_tree}"
-  then
     if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
     then
+      test -z "${with_opencv_tree}" && AC_MSG_ERROR([You have to specify --with-opencv-tree])
          AC_MSG_CHECKING(for opencv in ${with_opencv_tree})
          if test -f ${with_opencv_tree}/cv/include/cv.h -a -f ${with_opencv_tree}/cxcore/include/cxcore.h \
            -a -f ${with_opencv_tree}/cvaux/include/cvaux.h -a -f ${with_opencv_tree}/otherlibs/highgui/highgui.h
       then
         AC_MSG_RESULT(yes)
-        VLC_ADD_PLUGINS([opencv_wrapper])
+        VLC_ADD_PLUGIN([opencv_wrapper])
         VLC_ADD_LIBS([opencv_wrapper],[-L${with_opencv_tree}/lib -lcv -lcxcore -lcvaux -lhighgui])
         VLC_ADD_CFLAGS([opencv_wrapper],[-I${with_opencv_tree}/cv/include -I${with_opencv_tree}/cxcore/include -I${with_opencv_tree}/cvaux/include -I${with_opencv_tree}/otherlibs/highgui])
         AC_LANG_PUSH(C++)
-        VLC_ADD_PLUGINS([opencv_example])
+        VLC_ADD_PLUGIN([opencv_example])
         VLC_ADD_LIBS([opencv_example],[-L${with_opencv_tree}/lib -lcv -lcxcore -lcvaux -lhighgui])
         VLC_ADD_CXXFLAGS([opencv_example],[-I${with_opencv_tree}/cv/include -I${with_opencv_tree}/cxcore/include -I${with_opencv_tree}/cvaux/include -I${with_opencv_tree}/otherlibs/highgui])
         AC_LANG_POP(C++)        
@@ -2177,9 +2182,17 @@ then
         AC_MSG_ERROR([cannot find opencv in ${with_opencv_tree}])
          fi
     else
-         AC_MSG_WARN([--enable-opencv currently only works on windows])
+      PKG_CHECK_MODULES(OPENCV, opencv,
+        [
+          VLC_ADD_PLUGIN([opencv_example])
+          VLC_ADD_PLUGIN([opencv_wrapper])
+          VLC_ADD_LIBS([opencv_example opencv_wrapper],[${OPENCV_LIBS}])
+          VLC_ADD_CFLAGS([opencv_wrapper],[${OPENCV_CFLAGS}])
+          VLC_ADD_CXXFLAGS([opencv_example],[${OPENCV_CFLAGS}])
+        ],
+        [AC_MSG_ERROR([libopencv not found!])]
+      )
     fi
-  fi  
 fi
 
 
@@ -2190,7 +2203,7 @@ AC_ARG_ENABLE(smb,
   [  --enable-smb            smb input module (default enabled)])
 if test "${enable_smb}" != "no"; then
   AC_CHECK_HEADERS(libsmbclient.h,
-    [ VLC_ADD_PLUGINS([access_smb])
+    [ VLC_ADD_PLUGIN([access_smb])
       VLC_ADD_LIBS([access_smb],[-lsmbclient]) ],
     [ if test -n "${enable_smb}"; then
         AC_MSG_ERROR([cannot find libsmbclient headers])
@@ -2216,9 +2229,9 @@ then
     if test -z "${with_dvbpsi_tree}"
     then
       AC_CHECK_HEADERS(dvbpsi/dr.h,
-        [ VLC_ADD_PLUGINS([ts])
+        [ VLC_ADD_PLUGIN([ts])
           if test "${enable_sout}" != "no"; then
-            VLC_ADD_PLUGINS([mux_ts])
+            VLC_ADD_PLUGIN([mux_ts])
           fi
           VLC_ADD_LIBS([mux_ts ts dvb],[-ldvbpsi]) ],
         [  AC_MSG_WARN([cannot find libdvbpsi headers]) ],
@@ -2272,9 +2285,9 @@ then
     fi
     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
     AC_CHECK_HEADERS([dvbpsi/dr.h],[
-      VLC_ADD_PLUGINS([ts])
+      VLC_ADD_PLUGIN([ts])
       if test "${enable_sout}" != "no"; then
-        VLC_ADD_PLUGINS([mux_ts])
+        VLC_ADD_PLUGIN([mux_ts])
       fi
       VLC_ADD_CPPFLAGS([mux_ts ts dvb],[${CPPFLAGS_test}])
       VLC_ADD_LIBS([mux_ts ts dvb],[${LDFLAGS_test} -ldvbpsi])
@@ -2310,7 +2323,7 @@ then
 
   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_v4l}"
   AC_CHECK_HEADERS(linux/videodev.h, [
-    VLC_ADD_PLUGINS([v4l])
+    VLC_ADD_PLUGIN([v4l])
   ],[])
   CPPFLAGS="${CPPFLAGS_save}"
 fi
@@ -2319,8 +2332,8 @@ dnl
 dnl  Video4Linux2 plugin
 dnl
 AC_ARG_ENABLE(v4l2,
-  [  --enable-v4l2           Video4Linux2 input support (default disabled)])
-if test "${enable_v4l2}" = "yes"
+  [  --enable-v4l2           Video4Linux2 input support (default enabled)])
+if test "${enable_v4l2}" != "no"
 then
   AC_ARG_WITH(v4l2,
     [    --with-v4l2=PATH       path to a v4l2-enabled kernel tree],[],[])
@@ -2344,7 +2357,7 @@ then
 
   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_v4l2}"
   AC_CHECK_HEADERS(linux/videodev2.h, [
-    VLC_ADD_PLUGINS([v4l2])
+    VLC_ADD_PLUGIN([v4l2])
   ],[])
   CPPFLAGS="${CPPFLAGS_save}"
 fi
@@ -2357,7 +2370,7 @@ AC_ARG_ENABLE(pvr,
   [  --enable-pvr            PVR cards access module (default disabled)])
 if test "${enable_pvr}" = "yes"
 then
-  VLC_ADD_PLUGINS([pvr])
+  VLC_ADD_PLUGIN([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}"
@@ -2367,7 +2380,7 @@ then
     
 
   AC_CACHE_CHECK([for new linux/videodev2.h],
-      [new_linux_videodev2_h],
+      [ac_cv_new_linux_videodev2_h],
       [AC_TRY_COMPILE([
           #include <sys/types.h>
           #   ifdef VIDEODEV2_H_FILE
@@ -2377,9 +2390,9 @@ then
          #   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_cv_new_linux_videodev2_h=yes,
+          ac_cv_new_linux_videodev2_h=no)])
+  if test "${ac_cv_new_linux_videodev2_h}" != "no"; then
     AC_DEFINE(HAVE_NEW_LINUX_VIDEODEV2_H, 1, [Define if new linux/videodev2.h present])
   fi
 fi
@@ -2395,7 +2408,7 @@ then
     VLC_ADD_LIBS([access_gnomevfs],[$GNOMEVFS_LIBS])
     VLC_ADD_CPPFLAGS([access_gnomevfs],[$GNOMEVFS_CPPFLAGS])
     VLC_ADD_CFLAGS([access_gnomevfs],[$GNOMEVFS_CFLAGS])
-    VLC_ADD_PLUGINS([access_gnomevfs]),
+    VLC_ADD_PLUGIN([access_gnomevfs]),
     AC_MSG_WARN([GnomeVFS support disabled because GnomeVFS development headers not found]))
 fi
 
@@ -2437,7 +2450,7 @@ then
     AC_DEFINE(HAVE_CDDAX, 1, [Define for the audio CD plugin using libcdio])
     VLC_ADD_LIBS([cddax],[$LIBCDIO_LIBS])
     VLC_ADD_CFLAGS([cddax],[$LIBCDIO_CFLAGS])
-    VLC_ADD_PLUGINS([cddax])
+    VLC_ADD_PLUGIN([cddax])
     PKG_CHECK_MODULES(LIBCDIO_PARANOIA, libcdio_paranoia >= 0.72, [
     VLC_ADD_LIBS([cddax],[$LIBCDIO_CDDA_LIBS $LIBCDIO_CDDA_LIBS $LIBCDIO_PARANOIA_LIBS])],
     AC_MSG_WARN([CD Paranoia support disabled because no libcdio >= 0.72 found]))
@@ -2485,7 +2498,7 @@ then
     [Define for the VCD plugin using libcdio/libvcdinfo])
     VLC_ADD_LIBS([vcdx],[$VCDINFO_LIBS])
     VLC_ADD_CFLAGS([vcdx],[$VCDINFO_CFLAGS])
-    VLC_ADD_PLUGINS([vcdx])
+    VLC_ADD_PLUGIN([vcdx])
   else 
     AC_MSG_WARN([vcdx plugin disabled because ok libvcdinfo library not found])
     HAVE_VCDX=no
@@ -2506,7 +2519,8 @@ then
   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
     AC_MSG_RESULT(yes)
-    VLC_ADD_PLUGINS([vcd cdda])
+    VLC_ADD_PLUGIN([vcd])
+    VLC_ADD_PLUGIN([cdda])
   ],[
     AC_MSG_RESULT(no)
   ])
@@ -2514,7 +2528,8 @@ then
   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
     AC_MSG_RESULT(yes)
-    VLC_ADD_PLUGINS([vcd cdda])
+    VLC_ADD_PLUGIN([vcd])
+    VLC_ADD_PLUGIN([cdda])
     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
   ],[
     AC_MSG_RESULT(no)
@@ -2523,7 +2538,8 @@ then
   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
     AC_MSG_RESULT(yes)
-    VLC_ADD_PLUGINS([vcd cdda])
+    VLC_ADD_PLUGIN([vcd])
+    VLC_ADD_PLUGIN([cdda])
     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
   ],[
     AC_MSG_RESULT(no)
@@ -2531,12 +2547,14 @@ then
 
   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32"
   then
-    VLC_ADD_PLUGINS([vcd cdda])
+    VLC_ADD_PLUGIN([vcd])
+    VLC_ADD_PLUGIN([cdda])
   fi
 
   if test "${SYS}" = "darwin"
   then
-    VLC_ADD_PLUGINS([vcd cdda])
+    VLC_ADD_PLUGIN([vcd])
+    VLC_ADD_PLUGIN([cdda])
     VLC_ADD_LDFLAGS([vcd vcdx cdda cddax],[-Wl,-framework,IOKit,-framework,CoreFoundation])
     VLC_ADD_LIBS([vcdx cddax cdda],[-liconv])
   fi
@@ -2557,9 +2575,9 @@ dnl
 dnl  DVB-S/DVB-T/DVB-C satellite/teresterial/cable input using v4l2
 dnl
 AC_ARG_ENABLE(dvb,
-  [  --enable-dvb            DVB-S/T/C card support (default disabled)])
+  [  --enable-dvb            DVB-S/T/C card support (default enabled)])
 
-if test "${enable_dvb}" = "yes"
+if test "${enable_dvb}" != "no"
 then
   AC_ARG_WITH(dvb,
   [    --with-dvb=PATH       path to a dvb- and v4l2-enabled kernel tree],[],[])
@@ -2571,7 +2589,7 @@ then
   AC_CHECK_HEADERS(linux/dvb/version.h linux/dvb/frontend.h, [
     if test -z "${with_dvbpsi_tree}"
     then
-      VLC_ADD_PLUGINS([dvb])
+      VLC_ADD_PLUGIN([dvb])
     else
       VLC_ADD_BUILTINS([dvb])
     fi
@@ -2588,23 +2606,23 @@ if test "${enable_screen}" != "no"; then
   if test "${SYS}" = "darwin"; then
     AC_CHECK_HEADERS(OpenGL/gl.h, [
       AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
-        VLC_ADD_PLUGINS([screen])
+        VLC_ADD_PLUGIN([screen])
         VLC_ADD_LDFLAGS([screen],[-Wl,-framework,OpenGL,-framework,ApplicationServices])
       ])
     ])
   elif test "${SYS}" = "mingw32"; then
-    VLC_ADD_PLUGINS([screen])
+    VLC_ADD_PLUGIN([screen])
     VLC_ADD_LIBS([screen],[-lgdi32])
   elif test "${SYS}" = "mingwce"; then
     CPPFLAGS="${CPPFLAGS_save}"
   elif test "${SYS}" = "beos"; then
-    VLC_ADD_PLUGINS([screen])
+    VLC_ADD_PLUGIN([screen])
     VLC_ADD_CXXFLAGS([screen],[])
     VLC_ADD_LIBS([screen],[-lbe])
   else
     CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}"
     AC_CHECK_HEADERS(X11/Xlib.h, [
-      VLC_ADD_PLUGINS([screen])
+      VLC_ADD_PLUGIN([screen])
       VLC_ADD_LIBS([screen],[${X_LIBS} ${X_PRE_LIBS} -lX11])
       VLC_ADD_CPPFLAGS([screen],[${X_CFLAGS}])
     ])
@@ -2651,9 +2669,9 @@ then
     then
       dnl  Use a custom ogg
       AC_MSG_RESULT(${real_ogg_tree}/src/.libs/libogg.a)
-      VLC_ADD_PLUGINS([ogg])
+      VLC_ADD_PLUGIN([ogg])
       if test "${enable_sout}" != "no"; then
-        VLC_ADD_PLUGINS([mux_ogg])
+        VLC_ADD_PLUGIN([mux_ogg])
       fi
       VLC_ADD_LIBS([ogg mux_ogg speex vorbis],[${real_ogg_tree}/src/.libs/libogg.a])
       VLC_ADD_CFLAGS([ogg mux_ogg speex vorbis],[-I${real_ogg_tree}/include])
@@ -2665,9 +2683,9 @@ then
   else
     AC_CHECK_HEADERS(ogg/ogg.h, [
       AC_CHECK_LIB( ogg, oggpack_read, [
-        VLC_ADD_PLUGINS([ogg])
+        VLC_ADD_PLUGIN([ogg])
         if test "${enable_sout}" != "no"; then
-          VLC_ADD_PLUGINS([mux_ogg])
+          VLC_ADD_PLUGIN([mux_ogg])
         fi
         VLC_ADD_LIBS([ogg mux_ogg],[-logg])])
      ],[])
@@ -2707,11 +2725,11 @@ if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
                 VLC_ADD_CXXFLAGS([mkv],[-O1])
               fi
               AC_CHECK_LIB(ebml_pic, main, [
-                VLC_ADD_PLUGINS([mkv])
+                VLC_ADD_PLUGIN([mkv])
                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
               ],
                 AC_CHECK_LIB(ebml, main, [
-                  VLC_ADD_PLUGINS([mkv])
+                  VLC_ADD_PLUGIN([mkv])
                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
                 ]) 
              )
@@ -2751,7 +2769,7 @@ then
     then
       dnl  Use a custom mod
       AC_MSG_RESULT(${real_mod_tree}/src/.libs/libmodplug.a)
-      VLC_ADD_PLUGINS([mod])
+      VLC_ADD_PLUGIN([mod])
       VLC_ADD_LIBS([mod],[${real_mod_tree}/src/.libs/libmodplug.a -lstdc++])
       VLC_ADD_CXXFLAGS([mod],[-I${real_mod_tree}/include])
     else
@@ -2761,7 +2779,7 @@ then
     fi
   else
     AC_CHECK_HEADERS(libmodplug/modplug.h, [
-      VLC_ADD_PLUGINS([mod])
+      VLC_ADD_PLUGIN([mod])
       VLC_ADD_CXXFLAGS([mod],[])
       VLC_ADD_LIBS([mod],[-lmodplug -lstdc++])])
   fi
@@ -2775,7 +2793,7 @@ AC_ARG_ENABLE(mpc,
 if test "${enable_mpc}" != "no"
 then
   AC_CHECK_HEADERS(mpcdec/mpcdec.h, [
-    VLC_ADD_PLUGINS([mpc])
+    VLC_ADD_PLUGIN([mpc])
     VLC_ADD_LIBS([mpc],[-lmpcdec])])
 fi
 
@@ -2803,7 +2821,7 @@ then
     then
       dnl  Use a custom gme
       AC_MSG_RESULT(${real_gme_tree}/gme/libgme.a)
-      VLC_ADD_PLUGINS([gme])
+      VLC_ADD_PLUGIN([gme])
       VLC_ADD_LIBS([gme],[${real_gme_tree}/gme/libgme.a])
       VLC_ADD_CXXFLAGS([gme],[-I${real_gme_tree}/gme])
     else
@@ -2873,7 +2891,7 @@ then
     AC_CHECK_HEADERS(mad.h, ,
       [ AC_MSG_ERROR([Could not find libmad on your system: you may get it from http://www.underbit.com/products/mad/. Alternatively you can use --disable-mad to disable the mad plugin.]) ])
     AC_CHECK_LIB(mad, mad_bit_init, [
-      VLC_ADD_PLUGINS([mpgatofixed32])
+      VLC_ADD_PLUGIN([mpgatofixed32])
       VLC_ADD_LIBS([mpgatofixed32],[-lmad])],
       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
     CPPFLAGS="${CPPFLAGS_save}"
@@ -2885,314 +2903,149 @@ dnl
 dnl   libid3tag support (FIXME!!! doesn't work with new input)
 dnl
 AC_ARG_ENABLE( id3tag,
-  [  --disable-id3tag id3tag metadata reader plugin (default enabled)])
+[  --disable-id3tag        id3tag metadata reader plugin (default enabled)])
 AS_IF([test "${enable_id3tag}" != "no"], [
   AC_CHECK_HEADERS(id3tag.h, [
     AC_CHECK_HEADERS(zlib.h, [
       VLC_ADD_LIBS([id3tag],[-lid3tag -lz])
-      VLC_ADD_PLUGINS([id3tag])
+      VLC_ADD_PLUGIN([id3tag])
     ])
   ])
 ])
 
 dnl
-dnl  ffmpeg decoder/demuxer plugin
+dnl  avcodec decoder/encoder plugin
 dnl
-dnl we try to find ffmpeg using : 1- given tree, 2- pkg-config
-dnl                               3- default place,
 
-AC_ARG_ENABLE(ffmpeg,
-[  --enable-ffmpeg         ffmpeg codec (default enabled)])
-if test "${enable_ffmpeg}" != "no"
+AC_ARG_ENABLE(avcodec,
+[  --enable-avcodec        libavcodec codec (default enabled)])
+if test "${enable_avcodec}" != "no"
 then
+  PKG_CHECK_MODULES(AVCODEC,[libavcodec libavutil],
+    [
+      VLC_SAVE_FLAGS
+      CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
+      CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
+      AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h)
+      AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
+      VLC_ADD_PLUGIN([avcodec])
+      VLC_ADD_LIBS([avcodec],[$AVCODEC_LIBS])
+      VLC_ADD_CFLAGS([avcodec],[$AVCODEC_CFLAGS])
+      VLC_RESTORE_FLAGS
+    ],[
+      AC_MSG_ERROR([Could not find libavcodec or libavutil. Use --disable-avcodec to ignore this error.])
+  ])
+fi
 
-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_LIBS([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_LIBS([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} ${LIBS_ffmpeg}"
-             AC_CHECK_LIB(dts_pic, dts_free, 
-               [ VLC_ADD_LIBS([ffmpeg],[-ldts_pic]) ],
-               [ VLC_ADD_LIBS([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_LIBS([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_LIBS([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_LIBS([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_LIBS([ffmpeg],[-lz])
-     fi])
-
- AC_ARG_WITH(ffmpeg-amrnb,
-   [    --with-ffmpeg-amrnb specify if ffmpeg has been compiled with libamrnb support],
-   [
-     if test "$with_ffmpeg_amrnb" = "yes";     then
-        VLC_ADD_LIBS([ffmpeg],[-lamrnb])
-     fi])
-
- AC_ARG_WITH(ffmpeg-amrwb,
-   [    --with-ffmpeg-amrwb specify if ffmpeg has been compiled with libamrwb support],
-   [
-     if test "$with_ffmpeg_amrwb" = "yes";     then
-        VLC_ADD_LIBS([ffmpeg],[-lamrwb])
-     fi])
-
- AC_ARG_WITH(ffmpeg-x264,
-   [    --with-ffmpeg-x264 specify if ffmpeg has been compiled with libx264 support],
-   [
-     if test "$with_ffmpeg_x264" = "yes";      then
-        VLC_ADD_LIBS([ffmpeg],[-lx264])
-     fi])
-
- AC_ARG_WITH(ffmpeg-a52,
-   [    --with-ffmpeg-a52 specify if ffmpeg has been compiled with liba52 support],
-   [
-     if test "$with_ffmpeg_a52" = "yes";       then
-        VLC_ADD_LIBS([ffmpeg],[-la52])
-     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_LIBS([ffmpeg],[-L${real_ffmpeg_tree}/libavcodec/libpostproc ${real_ffmpeg_tree}/libavcodec/libpostproc/libpostproc.a])  
-     elif test -f "${real_ffmpeg_tree}/libpostproc/libpostproc.a"; then 
-        VLC_ADD_LIBS([ffmpeg],[-L${real_ffmpeg_tree}/libpostproc ${real_ffmpeg_tree}/libpostproc/libpostproc.a])
-        VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[-I${real_ffmpeg_tree}])
-     else
-       dnl  The given libavcodec wasn't built with --enable-postproc
-       AC_MSG_RESULT(no)
-       AC_MSG_ERROR([cannot find libpostproc.a in ${real_ffmpeg_tree}/[libavcodec/]libpostproc/. Make sure you configured ffmpeg with --enable-postproc])
-     fi
-   fi
-   dnl  Use a custom libffmpeg
-   AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
-
-   dnl Use pkg-config to look for the ldflags in libav*-uninstalled.pc
-   PKG_CONFIG_PATH_save="$PKG_CONFIG_PATH"
-   PKG_CONFIG_LIBDIR_save="$PKG_CONFIG_LIBDIR"
-   export PKG_CONFIG_PATH=""
-   export PKG_CONFIG_LIBDIR="${real_ffmpeg_tree}"
-   VLC_SAVE_FLAGS
-
-   PKG_CHECK_MODULES( [FFMPEG],[libavformat libavcodec libpostproc], [
-        VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher], ${FFMPEG_CFLAGS})
-        VLC_ADD_LIBS([ffmpeg stream_out_switcher], ${FFMPEG_LIBS})]
-        AC_DEFINE(HAVE_LIBAVFORMAT_TREE, 1, [Define if you have ffmpeg's libavformat.])
-      )
-   AS_IF([ test -f "${real_ffmpeg_tree}/libswscale/libswscale.a"],[
-     AC_DEFINE(HAVE_LIBSWSCALE_TREE, 1, [Define if you have ffmpeg's libswscale.])
-     PKG_CHECK_MODULES( [SWSCALE],[libswscale], [
-     VLC_ADD_LIBS([ffmpeg],[${SWSCALE_LIBS}])
-     VLC_ADD_CPPFLAGS([ffmpeg stream_out_switcher],[${SWSCALE_CFLAGS}])])
-     ])
-   CPPFLAGS="${CPPFLAGS} ${FFMPEG_CFLAGS} ${SWSCALE_CFLAGS}"
-   CFLAGS="${CFLAGS} ${FFMPEG_CFLAGS} ${SWSCALE_CFLAGS}"
-   
-   AC_CHECK_HEADERS(ffmpeg/avcodec.h libavcodec/avcodec.h)
-   AC_CHECK_HEADERS(ffmpeg/avformat.h libavformat/avformat.h)
-   AC_CHECK_HEADERS(ffmpeg/avutil.h libavutil/avutil.h)
-   AC_CHECK_HEADERS([ffmpeg/swscale.h libswscale/swscale.h])
-
-   VLC_RESTORE_FLAGS
-   AS_IF([test -n "${PKG_CONFIG_PATH_save}"],[
-         export PKG_CONFIG_PATH="${PKG_CONFIG_PATH_save}"
-   ],[
-        unset PKG_CONFIG_PATH
-   ])
-   AS_IF([test -n "${PKG_CONFIG_LIBDIR_save}"],[
-        export PKG_CONFIG_LIBDIR="${PKG_CONFIG_LIBDIR_save}"
-   ],[
-        unset PKG_CONFIG_LIBDIR
-   ])
-
-   VLC_ADD_BUILTINS([ffmpeg])
-   if test "${enable_sout}" != "no" -a "${enable_switcher}" = "yes" ; then
-     VLC_ADD_BUILTINS([stream_out_switcher])
-   fi
-
+dnl
+dnl  avformat demuxer/muxer plugin
+dnl
 
-else
+AC_ARG_ENABLE(avformat,
+[  --enable-avformat       libavformat containers (default enabled)])
+if test "${enable_avformat}" != "no"
+then
+  PKG_CHECK_MODULES(AVFORMAT,[libavformat libavutil],
+    [
+      VLC_SAVE_FLAGS
+      CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
+      CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
+      AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h)
+      AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
+      VLC_ADD_PLUGIN([avformat])
+      VLC_ADD_LIBS([avformat],[$AVFORMAT_LIBS])
+      VLC_ADD_CFLAGS([avformat],[$AVFORMAT_CFLAGS])
+      VLC_RESTORE_FLAGS
+    ],[
+      AC_MSG_ERROR([Could not find libavformat or libavutil. Use --disable-avformat to ignore this error.])
+  ])
+fi
 
+dnl
+dnl  swscale image scaling and conversion plugin
+dnl
 
-dnl Trying with pkg-config
-   PKG_CHECK_MODULES(FFMPEG,[libavcodec, libavformat],
+AC_ARG_ENABLE(swscale,
+[  --enable-swscale        libswscale image scaling and conversion (default enabled)])
+if test "${enable_swscale}" != "no"
+then
+  PKG_CHECK_MODULES(SWSCALE,[libswscale],
     [
-     VLC_SAVE_FLAGS
-     CPPFLAGS="${CPPFLAGS} ${FFMPEG_CFLAGS}"
-     CFLAGS="${CFLAGS} ${FFMPEG_CFLAGS}"
-     AC_CHECK_HEADERS(ffmpeg/avcodec.h libavcodec/avcodec.h)
-     AC_CHECK_HEADERS(ffmpeg/avformat.h libavformat/avformat.h)
-     AC_CHECK_HEADERS(ffmpeg/avutil.h libavutil/avutil.h)
-     dnl newer ffmpeg have a separate libpostproc
-     PKG_CHECK_MODULES(POSTPROC, libpostproc,[
-       VLC_ADD_CFLAGS([ffmpeg],[${POSTPROC_CFLAGS}]) 
-       VLC_ADD_LIBS([ffmpeg],[${POSTPROC_LIBS}]) 
-       ],[ true ])
-     CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
-     CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
-     AC_CHECK_HEADERS(postproc/postprocess.h)
-     if test "${SYS}" = "darwin"; then
-        VLC_ADD_BUILTINS([ffmpeg])
-     else
-        VLC_ADD_PLUGINS([ffmpeg])
-     fi
-     if test "${enable_sout}" != "no" -a "${enable_switcher}" = "yes"; then
-        if test "${SYS}" = "darwin"; then
-            VLC_ADD_BUILTINS([stream_out_switcher])
-        else
-            VLC_ADD_PLUGINS([stream_out_switcher])
-        fi
-     fi
-     VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[${FFMPEG_CFLAGS}])
-     VLC_ADD_LIBS([ffmpeg stream_out_switcher],[${FFMPEG_LIBS}])
-
-     dnl even newer ffmpeg has a libswscale
-     PKG_CHECK_MODULES(SWSCALE,[libswscale],[
-       VLC_ADD_CFLAGS([ffmpeg],[${SWSCALE_CFLAGS}])
-       VLC_ADD_LIBS([ffmpeg],[${SWSCALE_LIBS}])
-       AC_CHECK_LIB(swscale, sws_getContext,
-         [AC_CHECK_HEADERS([ffmpeg/swscale.h libswscale/swscale.h])],[],[-lavutil -lm])
-       ],[ true ])
-     VLC_RESTORE_FLAGS
+      VLC_SAVE_FLAGS
+      CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
+      CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
+      AC_CHECK_HEADERS(libswscale/swscale.h ffmpeg/swscale.h)
+      VLC_ADD_PLUGIN([swscale])
+      VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
+      VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
+      VLC_RESTORE_FLAGS
     ],[
+      AC_MSG_WARN([Could not find libswscale. Trying to enable imgresample.])
+      enable_imgresample=yes
+  ])
+fi
 
-    dnl
-    dnl last chance: at the default place
-    dnl
-      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
-      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg} ${LIBS_ffmpeg}"
-      AC_CHECK_HEADERS(ffmpeg/avcodec.h libavcodec/avcodec.h)
-      AC_CHECK_HEADERS(ffmpeg/avformat.h libavformat/avformat.h)
-      AC_CHECK_HEADERS(ffmpeg/avutil.h libavutil/avutil.h)
-      AC_CHECK_HEADERS(postproc/postprocess.h)
-
-      AC_CHECK_LIB(avutil, av_crc_init, [
-        VLC_ADD_LIBS([ffmpeg],[-lavutil])
-        LDAVUTIL="-lavutil"])
-
-      AC_CHECK_LIB(avcodec, avcodec_init, [
-        VLC_ADD_BUILTINS([ffmpeg])
-        VLC_ADD_LIBS([ffmpeg],[-lavcodec])
-        if test "${enable_sout}" != "no" -a "${enable_switcher}" = "yes"; then
-            VLC_ADD_BUILTINS([stream_out_switcher])
-        fi],
-         [ AC_MSG_ERROR([Could not find ffmpeg on your system: you may get it from http://ffmpeg.sf.net/ (svn version is recommended). Alternatively you can use --disable-ffmpeg to disable the ffmpeg plugins.]) ], [$LDAVUTIL])
-
-      AC_CHECK_LIB(postproc, pp_postprocess, [
-        VLC_ADD_LIBS([ffmpeg],[-lpostproc])],
-      AC_MSG_ERROR([Could not find libpostproc inside FFmpeg. You should configure FFmpeg with --enable-gpl --enable-postproc.]),
-        [$LDAVUTIL])
-
-      AC_CHECK_LIB(avformat, av_open_input_stream, [
-        VLC_ADD_LIBS([ffmpeg],[-lavformat -lz]) ], [], [-lavcodec -lz $LDAVUTIL])
-      LDFLAGS="${LDFLAGS_save}"
-      CPPFLAGS="${CPPFLAGS_save}"
+dnl
+dnl  avcodec (deprecated API) image scaling and conversion plugin
+dnl
+dnl  This is build as a seperate module than the avcodec one to prevent
+dnl  stupid run time library load errors from disabling most codecs
+dnl  from VLC.
+dnl
 
-      AC_CHECK_LIB(swscale, sws_getContext, [
-        AC_CHECK_HEADERS(ffmpeg/swscale.h libswscale/swscale.h)
-        VLC_ADD_LIBS([ffmpeg],[-lswscale]) ], [], [-lavcodec $LDAVUTIL])
-      LDFLAGS="${LDFLAGS_save}"
-      CPPFLAGS="${CPPFLAGS_save}"
-    ])
-  fi
+AC_ARG_ENABLE(imgresample,
+[  --enable-imgresample    deprecated libavcodec image scaling and conversion (default disabled)])
+if test "${enable_imgresample}" = "yes"
+then
+  PKG_CHECK_MODULES(IMGRESAMPLE,[libavcodec],
+    [
+      VLC_SAVE_FLAGS
+      CPPFLAGS="${CPPFLAGS} ${IMGRESAMPLE_CFLAGS}"
+      CFLAGS="${CFLAGS} ${IMGRESAMPLE_CFLAGS}"
+      AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h)
+      AC_CHECK_LIB(avcodec,img_resample,
+        [
+          VLC_ADD_PLUGIN([imgresample])
+          VLC_ADD_LIBS([imgresample],[$IMGRESAMPLE_LIBS])
+          VLC_ADD_CFLAGS([imgresample],[$IMGRESAMPLE_CFLAGS])
+        ],[
+          AC_MSG_WARN([Could not find img_resample in libavcodec.])
+          if test "${enable_swscale}" != "no"
+          then
+            AC_MSG_ERROR([swscale (and its fallback module imgresample) support will be missing. Use --disable-swscale to ignore this error. (This basically means that you will be missing any good software scaling module and some video chroma converters.)])
+          fi
+       # That sed hack to add -rpath is kind of ugly but at least it fixes
+        # detection when linking against a shared libavcodec with
+        # a libavutil not in one of your ld.so.conf directories.
+       # (for example a local install)
+        ],[${IMGRESAMPLE_LIBS} `echo ${IMGRESAMPLE_LIBS}|sed s'/-L/-Wl,-rpath=/'`])
+      VLC_RESTORE_FLAGS
+    ],[
+      AC_MSG_WARN([Could not find libavcodec.])
+  ])
 fi
 
 dnl
-dnl  ffmpegaltivec plugin
+dnl  postproc plugin
 dnl
-AC_ARG_ENABLE(ffmpegaltivec,
-[  --enable-ffmpegaltivec  ffmpegaltivec codec (DO NOT USE)])
-if test "${enable_ffmpegaltivec}" = "yes"
+
+AC_ARG_ENABLE(postproc,
+[  --enable-postproc       libpostproc image post-processing (default enabled)])
+if test "${enable_postproc}" != "no"
 then
-  if test "${with_ffmpeg_tree}" != "no" -a -n "${with_ffmpeg_tree}"; then
-    AC_MSG_CHECKING(for libavcodecaltivec.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/libavcodecaltivec.a"; then
-      dnl  The given libavcodecaltivec wasn't built
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodecaltivec.a, make sure you compiled libavcodecaltivec in ${with_ffmpeg_tree}])
-    fi
-    if ! fgrep -s "pp_get_context" "${real_ffmpeg_tree}/libavcodec/libavcodecaltivec.a"; then
-      dnl  The given libavcodecaltivec wasn't built with --enable-postproc
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([${real_ffmpeg_tree}/libavcodec/libavcodecaltivec.a was not compiled with postprocessing support, make sure you configured ffmpeg with --enable-postproc])
-    fi
-    dnl  Use a custom libffmpeg
-    AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodecaltivec.a)
-    VLC_ADD_BUILTINS([ffmpegaltivec])
-    VLC_ADD_LIBS([ffmpegaltivec],[-L${real_ffmpeg_tree}/libavcodec -lavcodecaltivec])
-    VLC_ADD_CPPFLAGS([ffmpeg],[-DNO_ALTIVEC_IN_FFMPEG])
-    VLC_ADD_CPPFLAGS([ffmpegaltivec],[-I${real_ffmpeg_tree}/libavcodec -I${real_ffmpeg_tree}/libavformat])
-
-    if test -f "${real_ffmpeg_tree}/libavformat/libavformat.a"; then
-      AC_DEFINE(HAVE_LIBAVFORMAT_TREE, 1, [Define if you have ffmpeg's libavformat.])
-      VLC_ADD_LIBS([ffmpegaltivec],[-L${real_ffmpeg_tree}/libavformat -lavformataltivec -lz])
-      VLC_ADD_CPPFLAGS([ffmpegaltivec],[-I${real_ffmpeg_tree}/libavformat])
-    fi
-    VLC_ADD_LIBS([stream_out_switcher],[-L${real_ffmpeg_tree}/libavcodec])
-    VLC_ADD_CPPFLAGS([stream_out_switcher],[-I${real_ffmpeg_tree}/libavcodec -I${real_ffmpeg_tree}/libavformat])
-  fi
+  PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
+    [
+      VLC_SAVE_FLAGS
+      CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
+      CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
+      AC_CHECK_HEADERS(libpostproc/postproc.h postproc/postprocess.h)
+      VLC_ADD_PLUGIN([postproc])
+      VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS])
+      VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS])
+      VLC_RESTORE_FLAGS
+    ],[
+      AC_MSG_ERROR([Could not find libpostproc.])
+  ])
 fi
 
 dnl
@@ -3232,10 +3085,10 @@ then
     AC_CHECK_HEADERS(faad.h, ,
       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
     AC_CHECK_LIB(faad, faacDecOpen, [
-      VLC_ADD_PLUGINS([faad])
+      VLC_ADD_PLUGIN([faad])
       VLC_ADD_LIBS([faad],[-lfaad]) ],
       AC_CHECK_LIB(faad, NeAACDecOpen, [
-        VLC_ADD_PLUGINS([faad])
+        VLC_ADD_PLUGIN([faad])
         VLC_ADD_LIBS([faad],[-lfaad]) ],
         [ AC_MSG_ERROR([Cannot find libfaad library...]) ]))
     LDFLAGS="${LDFLAGS_save}"
@@ -3280,7 +3133,7 @@ then
     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_PLUGIN([twolame])
       VLC_ADD_CPPFLAGS([twolame],[-DLIBTWOLAME_STATIC])
       VLC_ADD_LIBS([twolame],[-ltwolame]) ],
         [ AC_MSG_ERROR([Cannot find libtwolame library...]) ])
@@ -3301,7 +3154,7 @@ then
     VLC_ADD_BUILTINS([quicktime])
   else
   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
-    [ VLC_ADD_BUILTINS([quicktime])
+    [ VLC_ADD_PLUGIN([quicktime])
       VLC_ADD_LDFLAGS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
   fi
@@ -3311,9 +3164,10 @@ dnl
 dnl  Real plugin
 dnl
 AC_ARG_ENABLE(real,
-  [  --enable-real           Real audio module (default disabled)])
+  [  --enable-real           Real media module (default disabled)])
 if test "${enable_real}" = "yes"; then
-  VLC_ADD_PLUGINS([realaudio])
+  VLC_ADD_PLUGIN([realaudio])
+  VLC_ADD_PLUGIN([realvideo])
 fi
 
 dnl
@@ -3322,7 +3176,7 @@ dnl
 AC_ARG_ENABLE(realrtsp,
   [  --enable-realrtsp       Real RTSP module (default disabled)])
 if test "${enable_realrtsp}" = "yes"; then
-  VLC_ADD_PLUGINS([access_realrtsp])
+  VLC_ADD_PLUGIN([access_realrtsp])
 fi
 
 dnl
@@ -3406,7 +3260,7 @@ then
     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
     AC_CHECK_HEADERS(a52dec/a52.h, [
       AC_CHECK_LIB(a52, a52_free, [
-        VLC_ADD_PLUGINS([a52tofloat32])
+        VLC_ADD_PLUGIN([a52tofloat32])
         VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
         VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
       ],[
@@ -3464,7 +3318,7 @@ AS_IF([test "${enable_dca}" != "no"], [
     ])
   ], [
     PKG_CHECK_MODULES([DCA], [libdca >= 0.0.5], [
-      VLC_ADD_PLUGINS([dtstofloat32])
+      VLC_ADD_PLUGIN([dtstofloat32])
       VLC_ADD_CPPFLAGS([dtstofloat32], [${DCA_CFLAGS}])
       VLC_ADD_LIBS([dtstofloat32], [${DCA_LIBS}])
     ], [
@@ -3556,7 +3410,7 @@ then
          #endif
          #endif],
         [AC_MSG_RESULT([yes])
-          VLC_ADD_PLUGINS([libmpeg2])
+          VLC_ADD_PLUGIN([libmpeg2])
           VLC_ADD_LIBS([libmpeg2],[-lmpeg2])],
         [AC_MSG_RESULT([no])
           AC_MSG_ERROR([Your libmpeg2 is too old (you need the cvs version): you may get a more recent one from http://libmpeg2.sf.net/. Alternatively you can use --disable-libmpeg2 to disable the libmpeg2 plugin.])])],
@@ -3589,7 +3443,7 @@ then
     then
       dnl  Use a custom vorbis 
       AC_MSG_RESULT(${real_vorbis_tree}/lib/.libs/libvorbis.a)
-      VLC_ADD_PLUGINS([vorbis])
+      VLC_ADD_PLUGIN([vorbis])
       VLC_ADD_LIBS([vorbis],[${real_vorbis_tree}/lib/.libs/libvorbis.a ${real_vorbis_tree}/lib/.libs/libvorbisenc.a])
       VLC_ADD_CFLAGS([vorbis],[-I${real_vorbis_tree}/include])
     else
@@ -3599,7 +3453,7 @@ then
     fi
   else
     AC_CHECK_HEADERS(vorbis/codec.h, [
-      VLC_ADD_PLUGINS([vorbis])
+      VLC_ADD_PLUGIN([vorbis])
       VLC_ADD_LIBS([vorbis],[-lvorbis -logg -lm]) ],[])
 
     AC_CHECK_HEADERS(vorbis/vorbisenc.h, [
@@ -3615,7 +3469,7 @@ AC_ARG_ENABLE(tremor,
 if test "${enable_tremor}" = "yes"
 then
   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
-    VLC_ADD_PLUGINS([tremor])
+    VLC_ADD_PLUGIN([tremor])
     VLC_ADD_LIBS([tremor],[-lvorbisidec -logg])
    ],[])
 fi
@@ -3643,7 +3497,7 @@ then
     then
       dnl  Use a custom speex
       AC_MSG_RESULT(${real_speex_tree}/libspeex/.libs/libspeex.a)
-      VLC_ADD_PLUGINS([speex])
+      VLC_ADD_PLUGIN([speex])
       VLC_ADD_LIBS([speex],[${real_speex_tree}/libspeex/.libs/libspeex.a])
       VLC_ADD_CFLAGS([speex],[-I${real_speex_tree}/include])
     else
@@ -3655,7 +3509,7 @@ then
     AC_CHECK_HEADERS(speex/speex.h, [
       LDFLAGS="${LDFLAGS_save} ${LIBS_speex}"
       AC_CHECK_LIB(speex, speex_decode_int, [
-        VLC_ADD_PLUGINS([speex])
+        VLC_ADD_PLUGIN([speex])
         VLC_ADD_LIBS([speex],[-lspeex]) ],
         [ AC_MSG_RESULT([no])
           AC_MSG_WARN([Your libspeex is too old, please get the development
@@ -3702,7 +3556,7 @@ if test "${enable_theora}" = "yes"
 then
   AC_CHECK_HEADERS(theora/theora.h, [
     AC_CHECK_LIB(theora, theora_granule_time, [
-      VLC_ADD_PLUGINS([theora])
+      VLC_ADD_PLUGIN([theora])
       theora_libs="-ltheora -logg"
       VLC_ADD_LIBS([theora],[${theora_libs}]) ],[
       AC_MSG_ERROR([libtheora doesn't appear to be installed on your system.
@@ -3718,7 +3572,7 @@ AC_ARG_ENABLE(dirac,
 [  --enable-dirac          experimental dirac codec (default disabled)])
 if test "${enable_dirac}" = "yes"; then
   PKG_CHECK_MODULES(DIRAC,[dirac >= 0.9.0], [
-      VLC_ADD_PLUGINS([dirac])
+      VLC_ADD_PLUGIN([dirac])
       VLC_ADD_CFLAGS([dirac],[$DIRAC_CFLAGS])
       VLC_ADD_LIBS([dirac],[$DIRAC_LIBS -lstdc++]) ],[
       AC_MSG_ERROR([libdirac doesn't appear to be installed on you system.])
@@ -3735,8 +3589,9 @@ AC_CHECK_HEADERS(png.h, [
   LDFLAGS="${LDFLAGS_save} -lz"
   AC_CHECK_LIB(png, png_set_rows, [
     VLC_ADD_LIBS([png],[-lpng -lz])
-    VLC_ADD_PLUGINS([png])
-    VLC_ADD_PLUGINS([osdmenu osd_parser])
+    VLC_ADD_PLUGIN([png])
+    VLC_ADD_PLUGIN([osdmenu])
+    VLC_ADD_PLUGIN([osd_parser])
     AC_DEFINE(HAVE_LIBPNG, 1, [Define if you have the PNG library: libpng])],
     [],[-lz])
     LDFLAGS="${LDFLAGS_save}"
@@ -3769,7 +3624,7 @@ if test "${enable_x264}" != "no"; then
       VLC_ADD_CPPFLAGS([x264],[-I${real_x264_tree}])
       VLC_ADD_LIBS([x264],[-L${real_x264_tree}])
       PKG_CHECK_MODULES(X264,x264, [
-        VLC_ADD_PLUGINS([x264])
+        VLC_ADD_PLUGIN([x264])
         VLC_ADD_LDFLAGS([x264],[${X264_LIBS}])
         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
       ],[
@@ -3782,7 +3637,7 @@ if test "${enable_x264}" != "no"; then
     fi
   else
       PKG_CHECK_MODULES(X264,x264, [
-        VLC_ADD_PLUGINS([x264])
+        VLC_ADD_PLUGIN([x264])
         VLC_ADD_LDFLAGS([x264],[${X264_LIBS}])
         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
       ],[
@@ -3801,7 +3656,7 @@ AC_ARG_ENABLE(fluidsynth,
   [  --enable-fluidsynth     MIDI synthesisr with libfluidsynth (default enabled)])
 AS_IF([test "x${enable_fluidsynth}" != "xno"], [
   PKG_CHECK_MODULES(FLUIDSYNTH, fluidsynth, [
-    VLC_ADD_PLUGINS(fluidsynth)
+    VLC_ADD_PLUGIN(fluidsynth)
     VLC_ADD_CFLAGS(fluidsynth, [${FLUIDSYNTH_CFLAGS}])
     VLC_ADD_LIBS(fluidsynth, [${FLUIDSYNTH_LIBS}])
   ], [
@@ -3831,7 +3686,7 @@ AS_IF( [test "${enable_zvbi}" != "no"],[
        [
          VLC_ADD_LIBS([zvbi],[$ZVBI_LIBS])
          VLC_ADD_CFLAGS([zvbi],[$ZVBI_CFLAGS])
-         VLC_ADD_PLUGINS([zvbi])
+          VLC_ADD_PLUGIN([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)
@@ -3840,21 +3695,21 @@ AS_IF( [test "${enable_zvbi}" != "no"],[
     ])  
   ])
 AS_IF( [test "${enable_telx}" = "yes"],[
-  VLC_ADD_PLUGINS([telx])
+  VLC_ADD_PLUGIN([telx])
   ])
 
 dnl
 dnl asa/csri subtitle rendering module
 dnl
 AC_ARG_ENABLE(csri,
-  [  --enable-csri          Subtitle support using CSRI / asa (default disabled)])
+  [  --enable-csri           Subtitle support using CSRI / asa (default disabled)])
 AS_IF( [test "${enable_csri}" = "yes"], [
   PKG_CHECK_MODULES(CSRI,
       csri >= 0.1.0,
       [
         VLC_ADD_LDFLAGS([csri],[$CSRI_LIBS])
         VLC_ADD_CFLAGS([csri],[$CSRI_CFLAGS])
-        VLC_ADD_PLUGINS([csri])
+        VLC_ADD_PLUGIN([csri])
       ],[
         AC_MSG_WARN([CSRI helper library not found])
       ])
@@ -3864,14 +3719,14 @@ dnl
 dnl asa demuxer
 dnl
 AC_ARG_ENABLE(asademux,
-  [  --enable-asademux      asa subtitle demuxing (default disabled)])
+  [  --enable-asademux       asa subtitle demuxing (default disabled)])
 AS_IF( [test "${enable_asademux}" = "yes"], [
   PKG_CHECK_MODULES(PCRE,
       libpcre >= 6.5,
       [
         VLC_ADD_LDFLAGS([asademux],[$PCRE_LIBS])
         VLC_ADD_CFLAGS([asademux],[$PCRE_CFLAGS])
-        VLC_ADD_PLUGINS([asademux])
+        VLC_ADD_PLUGIN([asademux])
       ],[
         AC_MSG_WARN([PCRE library not found (required for asademux)])
       ])
@@ -3884,8 +3739,37 @@ AC_ARG_ENABLE(cmml,
   [  --enable-cmml           CMML support (default enabled)])
 if test "${enable_cmml}" != "no"
 then
-  VLC_ADD_PLUGINS([cmml])
-fi
+  VLC_ADD_PLUGIN([cmml])
+fi
+
+dnl
+dnl  kate decoder plugin
+dnl
+AC_ARG_ENABLE(kate,
+[  --enable-kate           kate codec (default enabled)])
+AS_IF([test "${enable_kate}" != "no"], [
+  PKG_CHECK_MODULES(KATE,[kate >= 0.1.2], [
+      VLC_ADD_PLUGIN([kate])
+      VLC_ADD_CFLAGS([kate],[$KATE_CFLAGS])
+      VLC_ADD_LIBS([kate],[$KATE_LIBS]) ],[
+        AC_CHECK_HEADERS(kate/kate.h, [
+          AC_CHECK_LIB(kate, kate_decode_init, [
+            VLC_ADD_PLUGIN([kate])
+            kate_libs="-lkate -logg"
+            VLC_ADD_LDFLAGS([kate],[${kate_libs}]) ],[
+            AS_IF([test "x${enable_kate}" != "x"], [
+              AC_MSG_ERROR([libkate doesn't appear to be installed on your system.
+              You also need to check that you have a libogg posterior to the 1.0 release.])
+            ])
+         ], [-lkate -logg])
+        ],[
+          AS_IF([test "x${enable_kate}" != "x"], [
+            AC_MSG_ERROR([libkate headers do not appear to be installed on your system.
+            You also need to check that you have a libogg posterior to the 1.0 release.])
+          ])
+        ])
+  ])
+])
 
 
 dnl
@@ -3923,11 +3807,11 @@ if test "${enable_x11}" != "no" &&
    test "${enable_x11}" = "yes"); then
   CPPFLAGS="${CPPFLAGS_save} ${X_FLAGS}"
   AC_CHECK_HEADERS(X11/Xlib.h, [
-    VLC_ADD_PLUGINS([panoramix])
+    VLC_ADD_PLUGIN([panoramix])
     VLC_ADD_LIBS([panoramix],[${X_LIBS} ${X_PRE_LIBS} -lX11])
     VLC_ADD_CPPFLAGS([panoramix],[${X_CFLAGS}])
     AC_CHECK_LIB(Xext, XShmAttach, [
-      VLC_ADD_PLUGINS([x11])
+      VLC_ADD_PLUGIN([x11])
       VLC_ADD_LIBS([x11],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext])
       VLC_ADD_CPPFLAGS([x11],[${X_CFLAGS}])
     ])
@@ -3951,12 +3835,12 @@ if test "${enable_xvideo}" != "no" &&
       # 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 /usr/lib/libXv.so -o -f "${x_libraries}"/libXv.so; then
-        VLC_ADD_PLUGINS([xvideo])
+        VLC_ADD_PLUGIN([xvideo])
         VLC_ADD_CPPFLAGS([xvideo],[${X_CFLAGS}])
         VLC_ADD_LIBS([xvideo],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lXv])
       else
         AC_CHECK_LIB(Xv_pic,XvPutImage,[
-          VLC_ADD_PLUGINS([xvideo])
+          VLC_ADD_PLUGIN([xvideo])
           VLC_ADD_CPPFLAGS([xvideo],[${X_CFLAGS}])
           VLC_ADD_LIBS([xvideo],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lXv_pic])
         ],[
@@ -3987,7 +3871,7 @@ if test "${enable_glx}" != "no" &&
     choke me
     #endif]]),
     [
-      VLC_ADD_PLUGINS([glx])
+      VLC_ADD_PLUGIN([glx])
       VLC_ADD_LIBS([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.])])
@@ -4005,7 +3889,7 @@ if test "${enable_xvmc}" = "yes" &&
    test "${enable_xvmc}" = "yes"); then
   CPPFLAGS="${CPPFLAGS_save} ${X_FLAGS}"
   AC_CHECK_HEADERS(X11/extensions/vldXvMC.h, [
-    VLC_ADD_PLUGINS([xvmc])
+    VLC_ADD_PLUGIN([xvmc])
     VLC_ADD_LIBS([xvmc],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lXvMCW -lXv -lXinerama])
     VLC_ADD_CPPFLAGS([xvmc],[${X_CFLAGS}])
   ])
@@ -4089,7 +3973,7 @@ if test "${enable_opengl}" != "no" &&
    test "${SYS}" != "beos" -a "${SYS}" != "mingwce"; then
   if test "${SYS}" != "darwin"; then
     AC_CHECK_HEADERS(GL/gl.h GL/glu.h, [
-      VLC_ADD_PLUGINS([opengl])
+      VLC_ADD_PLUGIN([opengl])
       if test "${SYS}" != "mingw32"; then
         VLC_ADD_LIBS([opengl],[${X_LIBS} -lGL -lGLU])
       else
@@ -4098,7 +3982,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_PLUGIN([opengl])
     VLC_ADD_LIBS([opengl],[-Wl,-framework,OpenGL])
   fi
 fi
@@ -4150,7 +4034,8 @@ then
   then
     # SDL on Darwin is heavily patched and can only run SDL_image
     if test "${SYS}" != "darwin" -a "${SYS}" != "mingw32"; then
-      VLC_ADD_PLUGINS([vout_sdl aout_sdl])
+      VLC_ADD_PLUGIN([vout_sdl])
+      VLC_ADD_PLUGIN([aout_sdl])
     fi
     VLC_ADD_CFLAGS([vout_sdl aout_sdl sdl_image],[`${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`])
     VLC_ADD_LIBS([vout_sdl aout_sdl sdl_image],[`${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`])
@@ -4166,7 +4051,7 @@ Please install it and try again. Alternatively you can also configure with
     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])
+        VLC_ADD_PLUGIN([sdl_image])
         AC_CHECK_LIB(png, png_set_rows,
           [VLC_ADD_LIBS([sdl_image],[-lpng -lz])],[],[-lz])
         AC_CHECK_LIB(jpeg, jpeg_start_decompress,
@@ -4206,7 +4091,7 @@ AC_ARG_ENABLE(fribidi,
 if test "${enable_freetype}" != "no"
 then
    PKG_CHECK_MODULES(FREETYPE, freetype2,[
-      VLC_ADD_PLUGINS([freetype])
+      VLC_ADD_PLUGIN([freetype])
       have_freetype=yes
       VLC_ADD_CPPFLAGS([freetype skins2],[${FREETYPE_CFLAGS}])
       VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
@@ -4259,7 +4144,7 @@ then
     LDFLAGS="${LDFLAGS_save} ${LIBS_xml}"
     AC_CHECK_LIB(xml2,xmlTextReaderConstName,[
       AC_EGREP_HEADER(xmlTextReaderConstName,libxml/xmlreader.h,[
-        VLC_ADD_PLUGINS([xml]) ],[
+        VLC_ADD_PLUGIN([xml]) ],[
           AC_MSG_WARN([libxml2 missing the xmlTextReader extension, you should update your version])
           if test "${enable_xml2}" = "yes"; then
             AC_MSG_ERROR([libxml2 missing the xmlTextReader extension])
@@ -4290,7 +4175,7 @@ then
        [
          VLC_ADD_LIBS([svg],[$SVG_LIBS])
          VLC_ADD_CFLAGS([svg],[$SVG_CFLAGS])
-          VLC_ADD_PLUGINS([svg]) ],
+          VLC_ADD_PLUGIN([svg]) ],
         [AC_MSG_WARN(SVG library not found)])
 fi
 
@@ -4301,7 +4186,7 @@ AC_ARG_ENABLE(snapshot,
   [  --enable-snapshot       snapshot module (default disabled)])
 if test "${enable_snapshot}" = "yes"
 then
-  VLC_ADD_PLUGINS([snapshot])
+  VLC_ADD_PLUGIN([snapshot])
 fi
 
 dnl
@@ -4322,7 +4207,7 @@ then
     VLC_ADD_LIBS([qte],[-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte])
     VLC_ADD_CXXFLAGS([qte],[-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti])
   fi
-  VLC_ADD_PLUGINS([qte])
+  VLC_ADD_PLUGIN([qte])
   NEED_QTE_MAIN=yes
   CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_qte}"
   AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
@@ -4331,29 +4216,6 @@ then
   CPPFLAGS="${CPPFLAGS_save}"
 fi
 
-dnl
-dnl  Qt Video output module
-dnl  (disabled by default)
-dnl
-dnl AC_ARG_ENABLE(qt_video,
-dnl   [  --enable-qt_video            QT Video Output support (default disabled)])
-dnl if test "${enable_qt_video}" = "yes"
-dnl then
-dnl  VLC_ADD_PLUGINS([qt_video])
-dnl  VLC_ADD_LIBS([qt_video],[-L${QTDIR}/lib])
-dnl  LDFLAGS="${LDFLAGS_save} ${LDFLAGS_qt_video}"
-dnl   AC_CHECK_LIB(qt-mt,main,[
-dnl    VLC_ADD_LIBS([qt_video],[-lqt-mt])
-dnl  ],[
-dnl    AC_CHECK_LIB(qt,main,[
-dnl      VLC_ADD_LIBS([qt_video],[-lqt])
-dnl    ])
-dnl  ])
-dnl  NEED_QTE_MAIN=yes
-dnl  LDFLAGS="${LDFLAGS_save}"
-dnl  VLC_ADD_CXXFLAGS([qt_video],[-I/usr/include/qt3 -I/usr/include/qt -I${QTDIR}/include])
-dnl fi
-
 dnl
 dnl Roku HD1000 Video output module
 dnl
@@ -4373,7 +4235,7 @@ if test "${enable_hd1000v}" != "no" -a "${CXX}" != "" &&
   ])
   if test "$can_build_roku" = "yes"
   then
-    VLC_ADD_PLUGINS([hd1000v])
+    VLC_ADD_PLUGIN([hd1000v])
     VLC_ADD_LIBS([hd1000v],[-lCascade -ldvbpsi -lmad])
   fi
   AC_LANG_POP([C++])
@@ -4385,7 +4247,7 @@ dnl
 
 if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce" -o "${SYS}" = "cygwin"
 then
-  VLC_ADD_PLUGINS([panoramix])
+  VLC_ADD_PLUGIN([panoramix])
 fi
 
 AC_ARG_ENABLE(directx,
@@ -4399,22 +4261,24 @@ then
     if test -z "${with_directx}"
     then
       AC_CHECK_HEADERS(ddraw.h,
-      [ VLC_ADD_PLUGINS([vout_directx aout_directx])
+      [ VLC_ADD_PLUGIN([vout_directx])
+        VLC_ADD_PLUGIN([aout_directx])
         VLC_ADD_LIBS([vout_directx],[-lgdi32])
       ])
       AC_CHECK_HEADERS(GL/gl.h,
-      [ VLC_ADD_PLUGINS([glwin32])
+      [ VLC_ADD_PLUGIN([glwin32])
         VLC_ADD_LIBS([glwin32],[-lopengl32 -lgdi32])
       ])
       AC_CHECK_HEADERS(d3d9.h,
-      [ VLC_ADD_PLUGINS([direct3d])
+      [ VLC_ADD_PLUGIN([direct3d])
         VLC_ADD_LIBS([direct3d],[-lgdi32])
       ])
     else
       AC_MSG_CHECKING(for directX headers in ${with_directx})
       if test -f ${with_directx}/ddraw.h
       then
-        VLC_ADD_PLUGINS([vout_directx aout_directx])
+        VLC_ADD_PLUGIN([vout_directx])
+       VLC_ADD_PLUGIN([aout_directx])
         VLC_ADD_CPPFLAGS([vout_directx aout_directx],[-I${with_directx}])
         VLC_ADD_LIBS([vout_directx],[-lgdi32])
         AC_MSG_RESULT(yes)
@@ -4434,7 +4298,7 @@ AC_ARG_ENABLE(fb,
     if test "${enable_fb}" != "no"
     then
       AC_CHECK_HEADERS(linux/fb.h, [
-        VLC_ADD_PLUGINS([fb])
+        VLC_ADD_PLUGIN([fb])
       ])
     fi
 
@@ -4445,7 +4309,7 @@ AC_ARG_ENABLE(mga,
   [  --enable-mga            Linux kernel Matrox support (default disabled)],
   [ if test "${enable_mga}" = "yes"
     then
-      VLC_ADD_PLUGINS([mga])
+      VLC_ADD_PLUGIN([mga])
     fi ])
 
 dnl
@@ -4455,7 +4319,7 @@ AC_ARG_ENABLE(svgalib,
   [  --enable-svgalib        SVGAlib support (default disabled)])
 if test "${enable_svgalib}" = "yes"
 then
-  VLC_ADD_PLUGINS([svgalib])
+  VLC_ADD_PLUGIN([svgalib])
   VLC_ADD_LIBS([svgalib],[-lvgagl -lvga])
 fi
 
@@ -4519,7 +4383,7 @@ if test "${enable_directfb}" = "yes"; then
         fi
     fi
     if test "${have_directfb}" = "true"; then
-        VLC_ADD_PLUGINS([directfb])
+        VLC_ADD_PLUGIN([directfb])
         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
     else 
@@ -4536,7 +4400,7 @@ AC_ARG_ENABLE(ggi,
   [  --enable-ggi            GGI support (default disabled)])
 if test "${enable_ggi}" = "yes"
 then
-  VLC_ADD_PLUGINS([ggi])
+  VLC_ADD_PLUGIN([ggi])
   VLC_ADD_LIBS([ggi],[-lggi])
   AC_ARG_WITH(ggi,
     [    --with-ggi=PATH       path to libggi],
@@ -4565,7 +4429,7 @@ then
     fi ])
    CFLAGS="$CFLAGS -I/usr/include/glide"
    AC_CHECK_HEADER(glide.h,[   
-      VLC_ADD_PLUGINS([glide])
+      VLC_ADD_PLUGIN([glide])
       VLC_ADD_LIBS([glide],[-lglide2x -lm])
       VLC_ADD_CPPFLAGS([glide],[-I/usr/include/glide])
     ],[
@@ -4584,7 +4448,7 @@ then
   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
   if test "${have_aa}" = "true"
   then
-    VLC_ADD_PLUGINS([aa])
+    VLC_ADD_PLUGIN([aa])
     VLC_ADD_LIBS([aa],[-laa])
   fi
 fi
@@ -4606,7 +4470,7 @@ then
   AC_PATH_PROG(CACA_CONFIG, caca-config, no, ${CACA_PATH})
   if test "${CACA_CONFIG}" != "no"
   then
-    VLC_ADD_PLUGINS([caca])
+    VLC_ADD_PLUGIN([caca])
     VLC_ADD_CFLAGS([caca],[`${CACA_CONFIG} --cflags`])
     VLC_ADD_LIBS([caca],[`${CACA_CONFIG} --plugin-libs`])
     AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <caca.h>
@@ -4626,11 +4490,12 @@ AC_ARG_ENABLE(wingdi,
   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
 if test "${enable_wingdi}" != "no"; then
   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
-    VLC_ADD_PLUGINS([wingdi])
+    VLC_ADD_PLUGIN([wingdi])
     VLC_ADD_LIBS([wingdi],[-lgdi32])
   fi
   if test "${SYS}" = "mingwce"; then
-    VLC_ADD_PLUGINS([wingdi wingapi])
+    VLC_ADD_PLUGIN([wingdi])
+    VLC_ADD_PLUGIN([wingapi])
   fi
 fi
 
@@ -4651,7 +4516,7 @@ if test "${enable_oss}" != "no" &&
    test "${enable_oss}" = "yes")
 then
   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
-    VLC_ADD_PLUGINS([oss])
+    VLC_ADD_PLUGIN([oss])
     AC_CHECK_LIB(ossaudio,main,VLC_ADD_LIBS([oss],[-lossaudio]))
   ])
 fi
@@ -4666,7 +4531,7 @@ AC_ARG_ENABLE(esd,
      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
      if test "${ESD_CONFIG}" != "no"
      then
-       VLC_ADD_PLUGINS([esd])
+       VLC_ADD_PLUGIN([esd])
        VLC_ADD_CFLAGS([esd],[`${ESD_CONFIG} --cflags`])
        VLC_ADD_LIBS([esd],[`${ESD_CONFIG} --libs`])
      fi
@@ -4680,10 +4545,10 @@ AC_ARG_ENABLE(pulse,
   if test "${enable_pulse}" != "no"
    then
      PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.8,
-       [ VLC_ADD_PLUGINS([pulse])
+       [ VLC_ADD_PLUGIN([pulse])
         VLC_ADD_CFLAGS([pulse],[${PULSE_CFLAGS}])
         VLC_ADD_LDFLAGS([pulse],[${PULSE_LIBS}])],
-       [AC_MSG_WARN(pulsaudio library not found)])
+       [AC_MSG_WARN(pulseaudio library not found)])
    fi
 
 dnl
@@ -4693,7 +4558,7 @@ AC_ARG_ENABLE(portaudio,
   [  --enable-portaudio      Portaudio library support (default disabled)],
   [if test "${enable_portaudio}" = "yes"
    then
-     VLC_ADD_PLUGINS([portaudio])
+     VLC_ADD_PLUGIN([portaudio])
      VLC_ADD_CXXFLAGS([portaudio],[])
      if test "${SYS}" = "mingw32"; then
         VLC_ADD_LIBS([portaudio],[-lportaudio -lwinmm -lole32])
@@ -4703,7 +4568,8 @@ AC_ARG_ENABLE(portaudio,
    fi])
 
 dnl
-dnl  aRts module -- broken (freeze wxWidgets)
+dnl  aRts module
+dnl  broken? (froze wxWidgets back then)
 dnl
 AC_ARG_ENABLE(arts,
  [  --enable-arts           aRts sound server (default disabled)],
@@ -4712,7 +4578,7 @@ AC_ARG_ENABLE(arts,
     AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
     if test "${ARTS_CONFIG}" != "no"
     then
-      VLC_ADD_PLUGINS([arts])
+      VLC_ADD_PLUGIN([arts])
       VLC_ADD_CFLAGS([arts],[`${ARTS_CONFIG} --cflags`])
       VLC_ADD_LIBS([arts],[`${ARTS_CONFIG} --libs `])
     fi
@@ -4734,7 +4600,7 @@ then
                     #include <alsa/asoundlib.h>],
        [snd_pcm_hw_params_get_period_time(0,0,0);],
         AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4))
-    VLC_ADD_PLUGINS([alsa])
+    VLC_ADD_PLUGIN([alsa])
     VLC_ADD_LIBS([alsa],[-lasound -lm -ldl])
   else
     if test "${enable_alsa}" = "yes"; then
@@ -4750,11 +4616,11 @@ AC_ARG_ENABLE(waveout,
   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
 if test "${enable_waveout}" != "no"; then
   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
-    VLC_ADD_PLUGINS([waveout])
+    VLC_ADD_PLUGIN([waveout])
     VLC_ADD_LIBS([waveout],[-lwinmm])
   fi
   if test "${SYS}" = "mingwce"; then
-    VLC_ADD_PLUGINS([waveout])
+    VLC_ADD_PLUGIN([waveout])
   fi
 fi
 
@@ -4767,7 +4633,7 @@ if test "${enable_macosx-audio}" != "no" &&
   (test "${SYS}" = "darwin" || test "${enable_macosx-audio}" = "yes")
 then
   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h, 
-    [ VLC_ADD_BUILTINS([auhal])
+    [ VLC_ADD_PLUGIN([auhal])
       VLC_ADD_LDFLAGS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,Carbon])
     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
 fi
@@ -4783,7 +4649,7 @@ if test "${enable_hd1000a}" != "no" -a "${CXX}" != "" &&
 then
   AC_LANG_PUSH([C++])
   AC_CHECK_HEADERS(deschutes/libraries/hdmachinex225/PCMAudioPlayer.h, [
-    VLC_ADD_PLUGINS([hd1000a])
+    VLC_ADD_PLUGIN([hd1000a])
     AC_CHECK_LIB(HDMachineX225,main,VLC_ADD_LIBS([hd1000a],[-lHDMachineX225]))  ])
   AC_LANG_POP([C++])
 fi
@@ -4797,7 +4663,8 @@ AC_ARG_ENABLE(jack,
 
 AS_IF([test "${enable_jack}" != "no"], [
   AC_CHECK_HEADERS(jack/jack.h, [
-    VLC_ADD_PLUGINS([access_jack jack])
+    VLC_ADD_PLUGIN([access_jack])
+    VLC_ADD_PLUGIN([jack])
     VLC_ADD_LIBS([access_jack jack],[-ljack])
   ],[AC_MSG_ERROR([cannot find JACK headers])])
 ])
@@ -4827,7 +4694,7 @@ AC_ARG_ENABLE(cyberlink,
     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_cyberlink}"
     AC_CHECK_HEADERS([cybergarage/upnp/MediaServer.h],
       [ VLC_ADD_CXXFLAGS([upnp_cc], [${CPPFLAGS_cyberlink}])
-        VLC_ADD_PLUGINS([upnp_cc]) 
+        VLC_ADD_PLUGIN([upnp_cc]) 
       ],[
         AC_MSG_ERROR([cannot find CyberLink for C++ headers])
       ])
@@ -4878,7 +4745,7 @@ dnl
 dnl UPnP Plugin (Intel SDK)
 dnl
 AC_ARG_ENABLE(upnp,
-  [  --enable-upnp           Intel UPnP SDK (default enabled)])
+  [AS_HELP_STRING([--enable-upnp],[Intel UPnP SDK (default enabled)])])
 
 VLC_ADD_CXXFLAGS([upnp_intel], [ ])
 AS_IF([test "x${enable_upnp}" != "xno"], [
@@ -4894,7 +4761,7 @@ AS_IF([test "x${enable_upnp}" != "xno"], [
 ])
 
 AS_IF([test "${has_upnp}" = "yes"], [
-  VLC_ADD_PLUGINS([upnp_intel])
+  VLC_ADD_PLUGIN([upnp_intel])
 ])
 
 
@@ -4914,7 +4781,8 @@ dnl
 dnl Skins2 module
 dnl
 AC_ARG_ENABLE(skins2,
-  [  --enable-skins2         Skins2 interface module (default disabled)])
+  [AS_HELP_STRING([--enable-skins2],[Skins2 interface module (default
+   enabled except on MacOSX, BeOS and WinCE)])])
 if test "${enable_skins2}" = "yes" ||
   (test "${SYS}" != "darwin" && test "${SYS}" != "beos" &&
    test "${SYS}" != "mingwce" && test "${enable_skins2}" != "no"); then
@@ -4931,97 +4799,30 @@ if test "${enable_skins2}" = "yes" ||
   fi
 
   if test "${skins2_missing_lib}" = "no" && (test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"); then
-    VLC_ADD_PLUGINS([skins2])
+    VLC_ADD_PLUGIN([skins2])
     ALIASES="${ALIASES} svlc"
     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -Imodules/gui/skins2 -DWIN32_SKINS])
     VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
     VLC_ADD_LIBS([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])
+    VLC_ADD_PLUGIN([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])
+    VLC_ADD_PLUGIN([skins2])
     ALIASES="${ALIASES} svlc"
     VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 ${X_CFLAGS} -DX11_SKINS])
     VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} -lXext -lX11])
   fi fi fi
 fi
-AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
-
-dnl dnl
-dnl dnl  Gtk+ module
-dnl dnl
-dnl AC_ARG_ENABLE(gtk,
-dnl   [  --enable-gtk            Gtk+ support (default enabled)])
-dnl if test "${enable_gtk}" != "no"
-dnl then
-dnl   GTK_PATH="${PATH}"
-dnl   AC_ARG_WITH(gtk-config-path,
-dnl     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
-dnl     [ if test "${with_gtk_config_path}" != "no"
-dnl       then
-dnl         GTK_PATH="${with_gtk_config_path}:${PATH}"
-dnl       fi ])
-dnl   # look for gtk-config
-dnl   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
-dnl   GTK_CONFIG=${GTK12_CONFIG}
-dnl   if test "${GTK_CONFIG}" = "no"
-dnl   then
-dnl     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
-dnl   fi
-dnl   if test "${GTK_CONFIG}" != "no"
-dnl   then
-dnl     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
-dnl     then
-dnl       AC_MSG_ERROR([Your development package for Gtk+ is too old, you need at least version 1.2.0. Please upgrade and try again. Alternatively you can also configure with --disable-gtk.])
-dnl     fi
-dnl     if test "${SYS}" != "mingw32"; then
-dnl       VLC_ADD_CFLAGS([gtk],[`${GTK_CONFIG} --cflags gtk gthread`])
-dnl       VLC_ADD_LIBS([gtk],[`${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`])
-dnl     else
-dnl       VLC_ADD_CFLAGS([gtk],[`${GTK_CONFIG} --cflags gtk`])
-dnl       VLC_ADD_LIBS([gtk],[`${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`])
-dnl     fi
-dnl     # now look for the gtk.h header
-dnl     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
-dnl     ac_cv_gtk_headers=yes
-dnl     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
-dnl       ac_cv_gtk_headers=no
-dnl       echo "Cannot find gtk development headers."
-dnl     ])
-dnl     if test "${ac_cv_gtk_headers}" = "yes"
-dnl     then
-dnl       VLC_ADD_PLUGINS([gtk])
-dnl       if test "${SYS}" != "mingw32"; then
-dnl         NEED_GTK_MAIN=yes
-dnl       fi
-dnl       ALIASES="${ALIASES} gvlc"
-dnl     fi
-dnl     CPPFLAGS="${CPPFLAGS_save}"
-dnl   fi
-dnl fi
-dnl 
-dnl
-dnl  Gtk+2 module ! Disabled for now as it is unusable and confuses users
-dnl
-dnl AC_ARG_ENABLE(gtk2,
-dnl   [  --enable-gtk2           Gtk2 support (default disabled)])
-dnl if test "${enable_gtk2}" = "yes"
-dnl then
-dnl   PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
-dnl   VLC_ADD_CFLAGS([gtk2],[${GTK2_CFLAGS}])
-dnl   VLC_ADD_LIBS([gtk2],[${GTK2_LIBS}])
-dnl   VLC_ADD_PLUGINS([gtk2])
-dnl   if test "${SYS}" != "mingw32"; then
-dnl     NEED_GTK2_MAIN=yes
-dnl   fi
-dnl fi
+AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes" ||
+        (test "${SYS}" != "darwin" && test "${SYS}" != "beos" &&
+         test "${SYS}" != "mingwce" && test "${enable_skins2}" != "no")])
 
 dnl
 dnl  PDA Gtk+2 module
@@ -5036,195 +4837,46 @@ then
   VLC_ADD_CFLAGS([pda],[${GTK2_CFLAGS} ${CFLAGS_pda}])
   VLC_ADD_LIBS([pda],[${LDFLAGS_pda}])
   VLC_ADD_LIBS([pda],[${GTK2_LIBS}])
-  VLC_ADD_PLUGINS([pda])
+  VLC_ADD_PLUGIN([pda])
   if test "${SYS}" != "mingw32"; then
     NEED_GTK2_MAIN=yes
+    VLC_ADD_CFLAGS([gtk2_main],[$GTK2_CFLAGS])
+    VLC_ADD_LIBS([gtk2_main],[$GTK2_LIBS])
   fi
 fi
 AM_CONDITIONAL(BUILD_PDA, [test "${enable_pda}" = "yes"])
 
-dnl dnl
-dnl dnl  Gnome module
-dnl dnl
-dnl AC_ARG_ENABLE(gnome,
-dnl   [  --enable-gnome          Gnome interface support (default disabled)],
-dnl   [if test "${enable_gnome}" = "yes"; then
-dnl     # look for gnome-config
-dnl     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
-dnl     if test -x ${GNOME_CONFIG}
-dnl     then
-dnl        VLC_ADD_CFLAGS([gnome],[`${GNOME_CONFIG} --cflags gtk gnomeui`])
-dnl        VLC_ADD_LIBS([gnome],[`${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`])
-dnl     fi
-dnl     # now look for the gnome.h header
-dnl     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
-dnl     AC_CHECK_HEADERS(gnome.h, [
-dnl       VLC_ADD_PLUGINS([gnome])
-dnl       NEED_GTK_MAIN=yes
-dnl       NEED_GNOME_MAIN=yes
-dnl       ALIASES="${ALIASES} gnome-vlc"
-dnl       dnl We need this because of some moronic gnomesupport.h flavours
-dnl       AC_MSG_CHECKING(for strndup in gnome.h)
-dnl       AC_EGREP_HEADER(strndup,gnome.h,[
-dnl         AC_MSG_RESULT(yes)
-dnl         AC_DEFINE(STRNDUP_IN_GNOME_H, 1,
-dnl                   Define if <gnome.h> defines strndup.)],[
-dnl         AC_MSG_RESULT(no)])
-dnl      ],[
-dnl       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
-dnl developement tools or remove the --enable-gnome option])
-dnl      ])
-dnl     CPPFLAGS="${CPPFLAGS_save}"
-dnl   fi])
-
-dnl
-dnl  Gnome2 module ! Disabled for know as it is unuseable and confuses users
-dnl
-dnl AC_ARG_ENABLE(gnome2,
-dnl   [  --enable-gnome2         Gnome2 support (default disabled)])
-dnl if test "${enable_gnome2}" = "yes"
-dnl then
-dnl   PKG_CHECK_MODULES(GNOME2, [libgnomeui-2.0])
-dnl   VLC_ADD_CFLAGS([gnome2],[${GNOME2_CFLAGS}])
-dnl   VLC_ADD_LIBS([gnome2],[${GNOME2_LIBS}])
-dnl   VLC_ADD_PLUGINS([gnome2])
-dnl   if test "${SYS}" != "mingw32"; then
-dnl     NEED_GNOME2_MAIN=yes
-dnl   fi
-dnl fi
-
-dnl
-dnl  wxWidgets module
-dnl
-AC_ARG_ENABLE(wxwidgets,
-  [  --enable-wxwidgets      wxWidgets support (default disabled)])
-
-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)],
-    [ if test "${with_wx_config_path}" != "no"
-      then
-        WXWIDGETS_PATH="${with_wx_config_path}:${PATH}"
-      fi ])
-  WXWIDGETS_NAME="wx-config"
-  AC_ARG_WITH(wx-config,
-    [    --with-wx-config=NAME      wx-config name (default is wx-config)],
-    [ if test "${with_wx_config}" != "no"
-      then
-        WXWIDGETS_NAME="${with_wx_config}"
-      fi ])
-  # look for wx-config
-  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
-    then
-      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:
-    #   playlist.cpp:1351: error: ISO C++ forbids cast to non-reference type
-    # into a warning. However better would be to fix playlist.cpp
-    AC_CACHE_CHECK([if \$CXX accepts -fpermissive],
-        [ac_cv_cxx_fpermissive],
-        [CXXFLAGS="${CXXFLAGS_save} -fpermissive"
-         AC_TRY_COMPILE([],,ac_cv_cxx_fpermissive=yes,
-                        ac_cv_cxx_fpermissive=no)])
-    if test "${ac_cv_cxx_fpermissive}" = "yes"; then
-      VLC_ADD_CXXFLAGS([wxwidgets],-fpermissive)
-    fi
-    VLC_ADD_LIBS([wxwidgets],[`${WX_CONFIG} --libs`])
-    VLC_ADD_CXXFLAGS([wxwidgets],[`${WX_CONFIG} --cxxflags`])
-    # check if we must link against gtk2 libs
-    # if __WXGTK20__ && __WXGTK__ are defined
-    # for modules/gui/wxwidgets/video.cpp
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
-#include <wx/wx.h>
-#ifdef __WXGTK20__
-#error ok, we need to link against gtk2
-#endif
-        ])],[WXGTK=no],[WXGTK=yes])
-    if test "$WXGTK" = "yes"; then
-      ${PKG_CONFIG} --exists gtk+-2.0 && VLC_ADD_LIBS([wxwidgets],[`$PKG_CONFIG --libs gtk+-2.0`])
-    fi
-    if ${WX_CONFIG} --unicode
-    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 
-      VLC_ADD_LIBS([wxwidgets],[$LIBCDIO_LIBS])
-      VLC_ADD_CXXFLAGS([wxwidgets],[$LIBCDIO_CFLAGS])
-    else 
-      AC_MSG_WARN([Probe disc disabled because ok libcdio library not found])
-    fi
-
-    if test "$have_libvcdinfo" = "yes"
-    then 
-      VLC_ADD_LIBS([wxwidgets],[$VCDINFO_LIBS])
-      VLC_ADD_CXXFLAGS([wxwidgets],[$VCDINFO_CFLAGS])
-    else 
-      AC_MSG_WARN([VCD information on Probe disc disabled because ok libvcdinfo not found])
-    fi
-
-    # now look for the wxprec.h header
-    CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwidgets}"
-    ac_cv_wx_headers=yes
-    AC_CHECK_HEADERS(wx/wxprec.h, , [
-      ac_cv_wx_headers=no
-      echo "Cannot find wxWidgets development headers."
-    ])
-    if test "${ac_cv_wx_headers}" = "yes"
-    then
-      VLC_ADD_PLUGINS([wxwidgets])
-      AC_DEFINE([HAVE_WX], 1, [Define to 1 if you have WxWidgets library.])
-      ALIASES="${ALIASES} wxvlc"
-    fi
-    CPPFLAGS="${CPPFLAGS_save}"
-    AC_LANG_POP(C++)
-  fi
-  dnl WxWidgets plugin will yield incorrect code without this
-  VLC_ADD_CXXFLAGS([wxwidgets], [-fno-strict-aliasing])
-fi
-
 dnl
 dnl QT 4
 dnl
-enableqt4=false
 AC_ARG_ENABLE(qt4,
-  [  --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])
-      AC_DEFINE([HAVE_QT4], 1, [Define to 1 if you have QT4 library.])
-      ALIASES="${ALIASES} qvlc"
-      enableqt4=true
-      if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" -a "${SYS}" != "cygwin" -a "${SYS}" != "darwin"; then
-          VLC_ADD_LIBS([qt4],[$QT4_LIBS -lX11])
-      else
-          VLC_ADD_LIBS([qt4],[$QT4_LIBS])
-      fi
-      VLC_ADD_CXXFLAGS([qt4],[$QT4_CFLAGS -DQT4LOCALEDIR=\\\\\\\"$($PKG_CONFIG --variable=prefix QtCore)/share/qt4/translations/\\\\\\\"])
-      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)
-      ])
-    )
+  [  --enable-qt4            QT 4 support (default enabled) ],, [
+  AS_IF([test "${SYS}" = "darwin"], [enable_qt4=no])
 ])
-AM_CONDITIONAL(ENABLE_QT4, test "$enableqt4" = "true")
+AS_IF([test "${enable_qt4}" != "no"], [
+  PKG_CHECK_MODULES(QT4, [QtCore QtGui >= 4.2.0], [
+    VLC_ADD_PLUGIN([qt4])
+    AC_DEFINE([HAVE_QT4], 1, [Define to 1 if you have QT4 library.])
+    ALIASES="${ALIASES} qvlc"
+    AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" -a "${SYS}" != "cygwin" -a "${SYS}" != "darwin"], [
+        VLC_ADD_LIBS([qt4],[$QT4_LIBS -lX11])
+    ], [
+        VLC_ADD_LIBS([qt4],[$QT4_LIBS])
+    ])
+    VLC_ADD_CXXFLAGS([qt4],[$QT4_CFLAGS -DQT4LOCALEDIR=\\\\\\\"$($PKG_CONFIG --variable=prefix QtCore)/share/qt4/translations/\\\\\\\"])
+    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([Qt 4 library not found])
+    ],[
+      AC_MSG_WARN([Qt 4 library not found])
+    ])
+    enable_qt4="no"
+  ])
+])
+AM_CONDITIONAL(ENABLE_QT4, [test "x$enable_qt4" != "xno"])
 
 dnl
 dnl  WinCE GUI module
@@ -5249,73 +4901,9 @@ fi
 dnl
 dnl Simple test for skins2 dependency
 dnl
-if test "${enable_skins2}" != "no"
-then
-  if test "${WX_CONFIG}" = "no"
-  then
-    AC_MSG_ERROR([The skins2 module depends on the wxWidgets development package. Without it you won't be able to open any dialog box from the interface, which makes the skins2 interface rather useless. Install the wxWidgets development package or alternatively you can also configure with: --disable-wxwidgets --disable-skins2.])
-  fi
-fi
-
-dnl dnl
-dnl dnl  Qt module
-dnl dnl
-dnl AC_ARG_ENABLE(qt,
-dnl   [  --enable-qt             Qt interface support (default disabled)],
-dnl   [if test "${enable_qt}" = "yes"; then
-dnl      VLC_ADD_PLUGINS([qt])
-dnl      ALIASES="${ALIASES} qvlc"
-dnl      VLC_ADD_LIBS([qt],[-L${QTDIR}/lib])
-dnl      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_qt}"
-dnl      AC_CHECK_LIB(qt-mt,main,[
-dnl        VLC_ADD_LIBS([qt],[-lqt-mt])
-dnl      ],[
-dnl        AC_CHECK_LIB(qt,main,[
-dnl          VLC_ADD_LIBS([qt],[-lqt])
-dnl        ])
-dnl      ])
-dnl      LDFLAGS="${LDFLAGS_save}"
-dnl      VLC_ADD_CXXFLAGS([qt],[-I/usr/include/qt3 -I/usr/include/qt -I${QTDIR}/include])
-dnl      if test -x ${QTDIR}/bin/moc
-dnl      then
-dnl        MOC=${QTDIR}/bin/moc
-dnl      else
-dnl        MOC=moc
-dnl      fi
-dnl    fi])
-dnl 
-dnl dnl
-dnl dnl  KDE module
-dnl dnl
-dnl AC_ARG_ENABLE(kde,
-dnl   [  --enable-kde            KDE interface support (default disabled)],
-dnl   [if test "${enable_kde}" = "yes"; then
-dnl      VLC_ADD_PLUGINS([kde])
-dnl      ALIASES="${ALIASES} kvlc"
-dnl      VLC_ADD_LIBS([kde],[-L${KDEDIR}/lib])
-dnl      dnl Check for -lkfile (only in KDE 2) or -lkdeui -lkio (KDE 3)
-dnl      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
-dnl      AC_CHECK_LIB(kfile,main,[
-dnl        VLC_ADD_LIBS([kde],[-lkfile])
-dnl      ])
-dnl      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
-dnl      AC_CHECK_LIB(kdeui,main,[
-dnl        VLC_ADD_LIBS([kde],[-lkdeui])
-dnl      ])
-dnl      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
-dnl      AC_CHECK_LIB(kio,main,[
-dnl        VLC_ADD_LIBS([kde],[-lkio])
-dnl      ])
-dnl      LDFLAGS="${LDFLAGS_save}"
-dnl      VLC_ADD_CXXFLAGS([kde],[-I/usr/include/kde -I/usr/include/qt3 -I/usr/include/qt])
-dnl      VLC_ADD_CXXFLAGS([kde],[-I${KDEDIR}/include -I${QTDIR}/include])
-dnl      if test -x ${QTDIR}/bin/moc
-dnl      then
-dnl        MOC=${QTDIR}/bin/moc
-dnl      else
-dnl        MOC=moc
-dnl      fi
-dnl    fi])
+AS_IF([test "${enable_skins2}" != "no" && test "x$enable_qt4" = "xno"], [
+  AC_MSG_ERROR([The skins2 module depends on a the Qt4 development package. Without it you won't be able to open any dialog box from the interface, which makes the skins2 interface rather useless. Install the Qt4 development package or alternatively you can also configure with: --disable-qt4 --disable-skins2.])
+])
 
 dnl
 dnl  Opie QT embedded module
@@ -5339,7 +4927,7 @@ AC_ARG_ENABLE(opie,
      ] )
      CPPFLAGS="${CPPFLAGS_save}"
 
-     VLC_ADD_PLUGINS([opie])
+     VLC_ADD_PLUGIN([opie])
      NEED_QTE_MAIN=yes
      VLC_ADD_LIBS([opie],[-lqpe ${LDFLAGS_qte}])
      VLC_ADD_CXXFLAGS([opie],[${CXXFLAGS_qte}])
@@ -5359,23 +4947,28 @@ AC_ARG_ENABLE(macosx,
 if test "x${enable_macosx}" = "xyes"
 then
 #  VLC_ADD_LDFLAGS([access_eyetv],                     [-Wl,-framework,Foundation])
-  VLC_ADD_LDFLAGS([macosx minimal_macosx opengllayer],[-Wl,-framework,Cocoa])
+  VLC_ADD_LDFLAGS([macosx minimal_macosx opengllayer qtcapture],[-Wl,-framework,Cocoa])
   VLC_ADD_LDFLAGS([macosx minimal_macosx opengllayer],[-Wl,-framework,OpenGL])
   VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,Carbon])
   VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,AGL])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,IOKit])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,QuickTime])
-  VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,QTKit])
+  VLC_ADD_LDFLAGS([macosx qtcapture],                 [-Wl,-framework,QTKit])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,WebKit])
-  VLC_ADD_LDFLAGS([opengllayer],                      [-Wl,-framework,QuartzCore])
+  VLC_ADD_LDFLAGS([opengllayer qtcapture],            [-Wl,-framework,QuartzCore])
+  VLC_ADD_LDFLAGS([qtcapture],                        [-Wl,-framework,CoreVideo])
   VLC_ADD_OBJCFLAGS([macosx minimal_macosx opengllayer growl], [-fobjc-exceptions] )
 
-#  VLC_ADD_PLUGINS([access_eyetv])
-  VLC_ADD_BUILTINS([macosx minimal_macosx])
+#  VLC_ADD_PLUGIN([access_eyetv])
+  VLC_ADD_PLUGIN([qtcapture])
+  VLC_ADD_PLUGIN([macosx])
+  VLC_ADD_PLUGIN([minimal_macosx])
  
   ORIGCFLAGS=$CFLAGS
   CFLAGS="$CFLAGS -x objective-c"
-  AC_CHECK_HEADER(QuartzCore/CALayer.h, [VLC_ADD_BUILTINS([opengllayer])])
+  AC_CHECK_HEADER(QuartzCore/CALayer.h, 
+  [VLC_ADD_PLUGIN([opengllayer])
+  VLC_ADD_OBJCFLAGS([opengllayer], [-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5])])
   CFLAGS=$ORIGCFLAGS
 fi
 
@@ -5387,7 +4980,7 @@ AC_ARG_ENABLE(qnx,
     if test "${enable_qnx}" != "no"
     then
       AC_CHECK_HEADERS(Ph.h, [
-        VLC_ADD_PLUGINS([qnx])
+        VLC_ADD_PLUGIN([qnx])
         VLC_ADD_LIBS([qnx],[-lasound -lph])
       ])
     fi
@@ -5400,7 +4993,7 @@ AC_ARG_ENABLE(ncurses,
   [if test "${enable_ncurses}" != "no"; then
     AC_CHECK_HEADER(ncurses.h,
       [AC_CHECK_LIB(ncursesw, mvprintw,
-        [VLC_ADD_PLUGINS([ncurses])
+        [VLC_ADD_PLUGIN([ncurses])
         VLC_ADD_LIBS([ncurses],[-lncursesw])
         ALIASES="${ALIASES} nvlc"
         AC_DEFINE([HAVE_NCURSESW], 1, [Define to 1 if you have libncursesw.])
@@ -5415,7 +5008,7 @@ AC_ARG_ENABLE(ncurses,
         )
         ],
         [AC_CHECK_LIB( ncurses, mvprintw,
-          [VLC_ADD_PLUGINS([ncurses])
+          [VLC_ADD_PLUGIN([ncurses])
           ALIASES="${ALIASES} nvlc"
           VLC_ADD_LIBS([ncurses],[-lncurses])
           AC_CHECK_LIB(ncurses, tgetent, [],
@@ -5449,7 +5042,7 @@ then
           AC_DEFINE(HAVE_XOSD_VERSION_0, 1, Define if <xosd.h> is pre-1.0.0))))
   if test "${have_xosd}" = "true"
   then
-    VLC_ADD_PLUGINS([xosd])
+    VLC_ADD_PLUGIN([xosd])
     VLC_ADD_LIBS([xosd],[-lxosd])
   fi
 fi
@@ -5462,7 +5055,7 @@ AC_ARG_ENABLE(fbosd,
 if test "${enable_fbosd}" = "yes"
 then
   AC_CHECK_HEADERS(linux/fb.h, [
-    VLC_ADD_PLUGINS([fbosd])
+    VLC_ADD_PLUGIN([fbosd])
  ])
 fi
 
@@ -5473,7 +5066,7 @@ AC_ARG_ENABLE(visual,
   [  --enable-visual         visualisation plugin (default enabled)])
 if test "${enable_visual}" != "no"
 then
-    VLC_ADD_PLUGINS([visual])
+    VLC_ADD_PLUGIN([visual])
 fi
 
 dnl
@@ -5484,7 +5077,7 @@ AC_ARG_ENABLE(galaktos,
 if test "${enable_galaktos}" = "yes"
 then
   AC_CHECK_HEADERS(GL/gl.h GL/glu.h, [
-    VLC_ADD_PLUGINS([galaktos])
+    VLC_ADD_PLUGIN([galaktos])
     if test "${SYS}" != "mingw32"; then
       VLC_ADD_LIBS([galaktos],[${X_LIBS} -lGL -lGLU])
     else
@@ -5516,7 +5109,7 @@ then
     fi
     if test -f "${real_goom_tree}/src/.libs/libgoom2.a"; then
       AC_MSG_RESULT(${real_goom_tree}/src/.libs/libgoom2.a)
-      VLC_ADD_BUILTINS([goom])
+      VLC_ADD_PLUGIN([goom])
       VLC_ADD_LIBS([goom],[-L${real_goom_tree}/src/.libs -lgoom2])
       VLC_ADD_CPPFLAGS([goom],[-I${real_goom_tree}/src -DUSE_GOOM_TREE])
     else
@@ -5525,7 +5118,7 @@ then
       AC_MSG_CHECKING(for libgoom.a in ${with_goom_tree})
       if test -f "${real_goom_tree}/libgoom.a"; then
         AC_MSG_RESULT(${real_goom_tree}/libgoom.a)
-        VLC_ADD_BUILTINS([goom])
+        VLC_ADD_PLUGIN([goom])
         VLC_ADD_LIBS([goom],[-L${real_goom_tree} -lgoom])
         VLC_ADD_CPPFLAGS([goom],[-I${real_goom_tree} -DUSE_GOOM_TREE -DOLD_GOOM])
       else
@@ -5538,7 +5131,7 @@ then
     AC_CHECK_HEADERS(goom/goom.h, [
       LDFLAGS="${LDFLAGS_save} ${LIBS_goom}"
       AC_CHECK_LIB(goom2, goom_init, [
-        VLC_ADD_PLUGINS([goom])
+        VLC_ADD_PLUGIN([goom])
         VLC_ADD_LIBS([goom],[-lgoom2])
       ],[
         AC_MSG_ERROR([Could not find goom on your system: you may get it from http://www.ios-software.com/.])
@@ -5553,10 +5146,10 @@ dnl  AtmoLight (homebrew AmbiLight)
 dnl
 if test "${SYS}" = "mingw32" -o "${SYS}" = "linux"; then
    AC_ARG_ENABLE(atmo,
-[  --disable-atmo      AtmoLight (homebrew philips ambilight) (default enabled)])
+[  --disable-atmo          AtmoLight (homebrew philips ambilight) (default enabled)])
    if test "${enable_atmo}" != "no"; then
       AC_LANG_PUSH(C++)
-      VLC_ADD_PLUGINS([atmo])
+      VLC_ADD_PLUGIN([atmo])
       AC_LANG_POP(C++)
    fi
 fi
@@ -5574,7 +5167,7 @@ then
       AC_DEFINE(HAVE_AVAHI_CLIENT, 1, [Define if you have the avahi-client library])
       VLC_ADD_LIBS([bonjour access_output_http],[$BONJOUR_LIBS])
       VLC_ADD_CFLAGS([bonjour access_output_http],[$BONJOUR_CFLAGS])
-      VLC_ADD_PLUGINS([bonjour]) ],
+      VLC_ADD_PLUGIN([bonjour]) ],
     [AC_MSG_WARN(avahi-client library not found)])
 fi
 
@@ -5588,7 +5181,7 @@ then
   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
   if test "${have_lirc}" = "true"
   then
-    VLC_ADD_PLUGINS([lirc])
+    VLC_ADD_PLUGIN([lirc])
     VLC_ADD_LIBS([lirc],[-llirc_client])
   fi
 fi
@@ -5601,33 +5194,15 @@ dnl libgcrypt
 dnl
 AC_ARG_ENABLE(libgcrypt,
   [  --enable-libgcrypt      libgcrypts support (default enabled)])
-
-GCRYPT_PATH="${PATH}"
-AC_ARG_WITH(libgcrypt-config-path,
-[    --with-libgcrypt-config-path=PATH libgcrypt-config path (default search in \$PATH)],
-   [ if test "${with_libgcrypt_config_path}" != "no"
-     then
-       GCRYPT_PATH="${with_libgcrypt_config_path}:${PATH}"
-     fi ])
-
-if test "${enable_libgcrypt}" != "no"
-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
+AS_IF([test "${enable_libgcrypt}" != "no"], [
+  AM_PATH_LIBGCRYPT([1:1.1.94], [have_libgcrypt="yes"], [have_libgcrypt="no"])
+])
+if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"; then
+  AS_IF([test "${have_libgcrypt}" = "yes"],[
+    VLC_ADD_LIBS([rtp stream_out_rtp], [${LIBGCRYPT_LIBS}])
+  ])
 fi
 AM_CONDITIONAL([HAVE_LIBGCRYPT], [test "${have_libgcrypt}" = "yes"])
-AS_IF([test "${have_libgcrypt}" = "yes"],[
-       # look for libgcrypt-config
-       AC_PATH_PROG(GCRYPT_CONFIG, "libgcrypt-config", no, ${GCRYPT_PATH})
-       GCRYPT_CFLAGS=`${GCRYPT_CONFIG} --cflags`
-       GCRYPT_LIBS=`${GCRYPT_CONFIG} --libs`
-])
 
 dnl
 dnl TLS/SSL
@@ -5637,17 +5212,18 @@ AC_ARG_ENABLE(gnutls,
 
 AS_IF([test "${enable_gnutls}" != "no"], [
   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.3.3], [
-    VLC_ADD_PLUGINS([gnutls])
+    VLC_ADD_PLUGIN([gnutls])
     VLC_ADD_CFLAGS([gnutls], [$GNUTLS_CFLAGS])
     AS_IF([test "${SYS}" = "mingw32"], [
       dnl pkg-config --libs gnutls omits these
       VLC_ADD_LIBS([gnutls], [-lz])
       VLC_ADD_LIBS([gnutls], [${LTLIBINTL}])
     ])
+    dnl The GnuTLS plugin invokes gcry_control directly.
     AS_IF([test "${have_libgcrypt}" = "yes"],[
-      VLC_ADD_LIBS([gnutls], ${GCRYPT_LIBS})
-      VLC_ADD_CFLAGS([gnutls], ${GCRYPT_CFLAGS})
-    ], [-lgpg-error])
+      VLC_ADD_LIBS([gnutls], [${LIBGCRYPT_LIBS}])
+      VLC_ADD_CFLAGS([gnutls], [${LIBGCRYPT_CFLAGS}])
+    ])
     VLC_ADD_LIBS([gnutls], [$GNUTLS_LIBS])
   ], [
     AS_IF([test "${enable_gnutls}" = "yes"], [
@@ -5656,6 +5232,24 @@ AS_IF([test "${enable_gnutls}" != "no"], [
   ])
 ])
 
+
+dnl
+dnl RemoteOSD plugin (VNC client as video filter)
+dnl
+AC_ARG_ENABLE(remoteosd,
+  [  --disable-remoteosd     RemoteOSD plugin (default enabled)])
+
+AS_IF([test "${enable_remoteosd}" != "no"], [
+  AS_IF([test "${have_libgcrypt}" = "yes"],[
+    VLC_ADD_PLUGIN([remoteosd])
+    VLC_ADD_LIBS([remoteosd], ${LIBGCRYPT_LIBS})
+    VLC_ADD_CFLAGS([remoteosd], ${LIBGCRYPT_CFLAGS})
+  ], [
+    AC_MSG_ERROR([libgcrypt support required for RemoteOSD plugin])
+  ])
+])
+
+
 dnl
 dnl update checking system
 dnl
@@ -5667,69 +5261,21 @@ then
   then
     AC_MSG_ERROR([libgcrypt is required for update checking system])
   fi
-  VLC_ADD_LIBS([libvlc], ${GCRYPT_LIBS})
-  VLC_ADD_CFLAGS([libvlc], ${GCRYPT_CFLAGS})
+  VLC_ADD_LIBS([libvlc], [${LIBGCRYPT_LIBS}])
+  VLC_ADD_CFLAGS([libvlc], [${LIBGCRYPT_CFLAGS}])
   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
 fi
 
 dnl
-dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
+dnl  Endianness check
 dnl
-dnl  We give the user the opportunity to specify
-dnl  --with-words=big or --with-words=little ; otherwise, try to guess
-dnl
-AC_ARG_WITH(words,
-  [    --with-words=endianness set endianness (big or little)])
-  case "${with_words}" in
-    big)
-      ac_cv_c_bigendian=yes
-      ;;
-    little)
-      ac_cv_c_bigendian=no
-      ;;
-    *)
-      dnl  Try to guess endianness by matching patterns on a compiled
-      dnl  binary, by looking for an ASCII or EBCDIC string
-      AC_CACHE_CHECK([whether the byte order is big-endian],
-        [ac_cv_c_bigendian],
-        [ac_cv_c_bigendian="unknown"
-        [cat >conftest.c <<EOF
-        short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
-        short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
-        void _a(void) { char*s = (char*)am; s = (char *)ai; }
-        short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
-        short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
-        void _e(void) { char*s = (char*)em; s = (char*)ei; }
-        int main(void) { _a(); _e(); return 0; }
-EOF
-        ]
-        if test -f conftest.c
-        then
-          if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
-              && test -f conftest.o
-          then
-            if test "`strings conftest.o | grep BIGenDianSyS`"
-            then
-              ac_cv_c_bigendian="yes"
-            fi
-            if test "`strings conftest.o | grep LiTTleEnDian`"
-            then
-              ac_cv_c_bigendian="no"
-            fi
-          fi
-        fi
-      ])
-      if test "${ac_cv_c_bigendian}" = "unknown"
-      then
-        AC_MSG_ERROR([Could not guess endianness, please use --with-words])
-      fi
-      ;;
-  esac
-dnl  Now we know what to use for endianness, just put it in the header
-if test "${ac_cv_c_bigendian}" = "yes"
-then
-  AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
-fi
+AC_C_BIGENDIAN
+AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
+  DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
+], [
+  DEFS_BIGENDIAN=""
+])
+AC_SUBST(DEFS_BIGENDIAN)
 
 dnl
 dnl  DLL loader copied from MPlayer copied from somewhere else (WINE ?)
@@ -5739,13 +5285,15 @@ AC_ARG_ENABLE(loader,
   [  --enable-loader         build DLL loader for ELF i386 platforms (default disabled)])
 AM_CONDITIONAL(LOADER, [test "${enable_loader}" = "yes"])
 AS_IF([test "${enable_loader}" = "yes"],
-  [ VLC_ADD_PLUGINS([dmo])
+  [ VLC_ADD_PLUGIN([dmo])
     VLC_ADD_CPPFLAGS([dmo],[-I../../../@top_srcdir@/libs/loader])
     VLC_ADD_LIBS([dmo],[../../../libs/loader/libloader.la -lpthread])
     VLC_ADD_CPPFLAGS([quicktime],[-I../../@top_srcdir@/libs/loader])
     VLC_ADD_LIBS([quicktime],[../../libs/loader/libloader.la -lpthread])
     VLC_ADD_CPPFLAGS([realaudio],[-I../../@top_srcdir@/libs/loader -DLOADER])
     VLC_ADD_LIBS([realaudio],[../../libs/loader/libloader.la])
+    VLC_ADD_CPPFLAGS([realvideo],[-I../../@top_srcdir@/libs/loader -DLOADER])
+    VLC_ADD_LIBS([realvideo],[../../libs/loader/libloader.la])
   ])
 
 AC_ARG_WITH(,[Components:])
@@ -5786,13 +5334,13 @@ then
           AC_CHECK_HEADERS(objsafe.h,
             VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER]),,
             [
-            #if HAVE_OLE2_H
+             #if HAVE_OLE2_H
              #   include <ole2.h>
              #endif
-            ]
+            ]
           )
           activex=:
-         PLUGINS_BINDINGS="${PLUGINS_BINDINGS} activex"
+          PLUGINS_BINDINGS="${PLUGINS_BINDINGS} activex"
         ],
         [ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
       )],
@@ -5870,7 +5418,7 @@ then
         VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS}])
         VLC_ADD_LDFLAGS([mozilla],[${MOZILLA_LDFLAGS}])
         VLC_ADD_LIBS([mozilla],[${FIREFOX_LIBS} ${MOZILLA_NSPR_LIBS} ${NSPR_LIBS}])
-        VLC_ADD_PLUGINS([mozilla])
+        VLC_ADD_PLUGIN([mozilla])
         MOZILLA_CONFIG=
         CPPFLAGS="${CPPFLAGS_save}"
       ],
@@ -5989,56 +5537,16 @@ 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_LIBS([x11],[-losso])
-      ])
-   ])
-   AC_CHECK_LIB(Xsp, XSPSetPixelDoubling,[
-      VLC_ADD_CPPFLAGS([x11],[-DHAVE_XSP])
-      VLC_ADD_LIBS([x11],[-lXsp])
-   ])
-fi
-
-dnl
-dnl  Mediacontrol Python bindings
-dnl
-AC_ARG_ENABLE(python-bindings,
-  [  --enable-python-bindings Enable Python bindings (default disabled)])
-
-if test "${enable_python_bindings}" = "yes"; then
-  AC_PATH_PROG(PYTHON_CONFIG, python-config, no)
-  CFLAGS="${CFLAGS_save} `${PYTHON_CONFIG} --cflags`"
-  AC_CHECK_HEADER([Python.h],
-    PLUGINS_BINDINGS="${PLUGINS_BINDINGS} python",
-    AC_MSG_ERROR([You have to install python-dev to build the bindings]),
-    []
-  )
-  CFLAGS="${CFLAGS_save}"
-fi
-AM_CONDITIONAL(BUILD_PYTHON, [test "${enable_python_bindings}" = "yes"])
-
-dnl
-dnl  Java bindings
-dnl
-AC_ARG_ENABLE(java-bindings,
-  [  --enable-java-bindings  Enable Java bindings (default disabled)])
-if test "${enable_java_bindings}" = "yes"
-then
-        echo ""
-        echo "****** WARNING **** WARNING ***** WARNING *************"
-        echo "*** To compile the java bindings go to the "
-        echo "*** bindings/java folder and run mvn install. "
-       echo "*** You need maven2 installed. "
-       echo "*** This configuration will continue, so you will be "
-       echo "*** able to compile VideoLAN as usual. "
-        echo "*******************************************************"
-        echo ""
-fi
+AC_CHECK_LIB(osso, osso_display_blanking_pause, [
+  PKG_CHECK_MODULES(GLIB2, glib-2.0, [
+    VLC_ADD_CPPFLAGS([x11 xvideo xvmc glx],[-DHAVE_OSSO ${DBUS_CFLAGS} ${GLIB2_CFLAGS}])
+    VLC_ADD_LIBS([x11 xvideo xvmc glx],[-losso])
+ ])
+])
+AC_CHECK_LIB(Xsp, XSPSetPixelDoubling,[
+  VLC_ADD_CPPFLAGS([x11 xvideo xvmc glx],[-DHAVE_XSP])
+  VLC_ADD_LIBS([x11 xvideo xvmc glx],[-lXsp])
+])
 
 dnl
 dnl  test plugins
@@ -6055,7 +5563,10 @@ then
   dnl  this one is needed until automake knows what to do
   VLC_ADD_LIBS([test3],[-lobjc])
 
-  VLC_ADD_PLUGINS([${TESTS}])
+  VLC_ADD_PLUGIN([test1])
+  VLC_ADD_PLUGIN([test2])
+  VLC_ADD_PLUGIN([test3])
+  VLC_ADD_PLUGIN([test4])
 fi
 
 dnl
@@ -6073,21 +5584,21 @@ dnl  gtk_main plugin
 dnl
 if test "${NEED_GTK_MAIN}" != "no"
 then
-    VLC_ADD_PLUGINS([gtk_main])
+    VLC_ADD_PLUGIN([gtk_main])
     VLC_ADD_CFLAGS([gtk_main],[${CFLAGS_gtk}])
     VLC_ADD_LDFLAGS([gtk_main],[${LDFLAGS_gtk}])
 fi
 
 if test "${NEED_GNOME_MAIN}" != "no"
 then
-    VLC_ADD_PLUGINS([gnome_main])
+    VLC_ADD_PLUGIN([gnome_main])
     VLC_ADD_CFLAGS([gnome_main],[${CFLAGS_gtk} ${CFLAGS_gnome}])
     VLC_ADD_LDFLAGS([gnome_main],[${LDFLAGS_gtk} ${LDFLAGS_gnome}])
 fi
 
 if test "${NEED_GTK2_MAIN}" != "no"
 then
-    VLC_ADD_PLUGINS([gtk2_main])
+    VLC_ADD_PLUGIN([gtk2_main])
     VLC_ADD_CFLAGS([gtk2],[-DNEED_GTK2_MAIN])
     VLC_ADD_CFLAGS([pda],[-DNEED_GTK2_MAIN])
     VLC_ADD_CFLAGS([gtk2_main],[${CFLAGS_gtk2} ${CFLAGS_pda}])
@@ -6096,7 +5607,7 @@ fi
 
 if test "${NEED_GNOME2_MAIN}" != "no"
 then
-    VLC_ADD_PLUGINS([gnome2_main])
+    VLC_ADD_PLUGIN([gnome2_main])
     VLC_ADD_CFLAGS([gnome2_main],[${CFLAGS_gtk2} ${CFLAGS_gnome2}])
     VLC_ADD_LDFLAGS([gnome2_main],[${LDFLAGS_gtk2} ${LDFLAGS_gnome2}])
 fi
@@ -6106,13 +5617,12 @@ dnl  qte_main plugin
 dnl
 if test "${NEED_QTE_MAIN}" != "no"
 then
-    VLC_ADD_PLUGINS([qte_main])
+    VLC_ADD_PLUGIN([qte_main])
     VLC_ADD_CXXFLAGS([opie qte qt_video],[-DNEED_QTE_MAIN])
     VLC_ADD_CXXFLAGS([qte_main],[${CXXFLAGS_qte} ${CXXFLAGS_qt_video}])
     VLC_ADD_LDFLAGS([qte_main],[${LDFLAGS_qte} ${LDFLAGS_qt_video}])
 fi
 
-
 dnl
 dnl  Plugin and builtin checks
 dnl
@@ -6136,15 +5646,15 @@ AS_IF([test "${plugin_support}" != "no"], [
 AM_CONDITIONAL(HAVE_PLUGINS, [test "${plugin_support}" != "no"])
 
 dnl Temporary(?) hack for plugins/builtins transition
-VLC_ADD_PLUGINS([${BUILTINS}])
-BUILTINS=""
+dnl VLC_ADD_PLUGIN([${BUILTINS}])
+dnl BUILTINS=""
 
 dnl
 dnl Pic and shared libvlc stuff
 dnl
 AS_IF([test "${SYS}" = "mingw32"], [
+  FILE_LIBVLCCORE_DLL="!define LIBVLCCORE_DLL libvlccore.dll"
   FILE_LIBVLC_DLL="!define LIBVLC_DLL libvlc.dll"
-  FILE_LIBVLC_CONTROL_DLL="!define LIBVLC_CONTROL_DLL libvlc-control.dll"
 ])
 
 dnl
@@ -6204,8 +5714,8 @@ AC_SUBST(WINE_SDK_PATH)
 AC_SUBST(LIBEXT)
 AC_SUBST(AM_CPPFLAGS)
 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
+AC_SUBST(FILE_LIBVLCCORE_DLL)
 AC_SUBST(FILE_LIBVLC_DLL)
-AC_SUBST(FILE_LIBVLC_CONTROL_DLL)
 
 dnl Create vlc-config.in
 VLC_OUTPUT_VLC_CONFIG_IN
@@ -6215,8 +5725,6 @@ AC_CONFIG_FILES([
   Makefile
   projects/activex/Makefile
   projects/activex/axvlc.inf
-  bindings/Makefile
-  bindings/python/Makefile
   doc/Makefile
   extras/package/ipkg/Makefile
   libs/loader/Makefile
@@ -6253,9 +5761,9 @@ AC_CONFIG_FILES([
   modules/audio_mixer/Makefile
   modules/audio_output/Makefile
   modules/codec/Makefile
+  modules/codec/avcodec/Makefile
   modules/codec/cmml/Makefile
   modules/codec/dmo/Makefile
-  modules/codec/ffmpeg/Makefile
   modules/codec/subtitles/Makefile
   modules/codec/spudec/Makefile
   modules/codec/xvmc/Makefile
@@ -6263,6 +5771,7 @@ AC_CONFIG_FILES([
   modules/control/http/Makefile
   modules/demux/Makefile
   modules/demux/asf/Makefile
+  modules/demux/avformat/Makefile
   modules/demux/avi/Makefile
   modules/demux/mp4/Makefile
   modules/demux/mpeg/Makefile
@@ -6275,7 +5784,6 @@ AC_CONFIG_FILES([
   modules/gui/qnx/Makefile
   modules/gui/qt4/Makefile
   modules/gui/skins2/Makefile
-  modules/gui/wxwidgets/Makefile
   modules/gui/wince/Makefile
   modules/meta_engine/Makefile
   modules/misc/Makefile
@@ -6286,11 +5794,11 @@ AC_CONFIG_FILES([
   modules/misc/testsuite/Makefile
   modules/misc/playlist/Makefile
   modules/misc/osd/Makefile
+  modules/misc/stats/Makefile
   modules/misc/xml/Makefile
   modules/misc/probe/Makefile
   modules/mux/Makefile
   modules/mux/mpeg/Makefile
-  modules/mux/rtp/Makefile
   modules/packetizer/Makefile
   modules/services_discovery/Makefile
   modules/stream_out/Makefile
@@ -6316,11 +5824,8 @@ AC_OUTPUT
 ${SHELL} ./config.status --file=vlc-config
 chmod 0755 vlc-config
 
-dnl echo "Enabled builtin modules :"
-dnl for a in `./vlc-config --target builtin` ; do echo $a; done | sed -e 's,modules\/\(.*\)\/lib\(.*\)\.a,\2 (\1),'
-
-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),'
+/bin/echo -n "Enabled modules :"
+./vlc-config --list plugin
 
 dnl Shortcut to nice compile message
 rm -f compile
@@ -6355,8 +5860,6 @@ echo "build vlc executable  : no"
 fi
 echo "plugins/bindings      :${PLUGINS_BINDINGS}
 
-You can check which modules have been enabled 
-with \`./vlc-config --list plugin'.
 You can tune the compiler flags in vlc-config.
 To build vlc and its plugins, type \`./compile' or \`make'.
 "