From 180f5a0e374803a5c583e5775668b0023b6c048c Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Tue, 2 Feb 2010 21:46:15 +0100
Subject: [PATCH 01/11] Make VLC_ADD_* capable of handling multiple plugins.

Loop during autoconf since we always use fixed strings for the first
parameter anyway. Probably saves some runtime too ;).

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 m4/vlc.m4 |   62 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/m4/vlc.m4 b/m4/vlc.m4
index 46b1021..38fd988 100644
--- a/m4/vlc.m4
+++ b/m4/vlc.m4
@@ -11,58 +11,60 @@ AC_DEFUN([VLC_ADD_BUILTINS], [
 ])
 
 AC_DEFUN([VLC_ADD_PLUGIN], [
-  PLUGINS="${PLUGINS} $1"
-  AC_SUBST([LTLIB$1], ["lib$1_plugin.la"])
+  m4_foreach_w([element], [$1], [
+    [PLUGINS="${PLUGINS} ]element["]
+    AC_SUBST([LTLIB]element, [lib]element[_plugin.la])
+  ])
 ])
 
 dnl  Special cases: vlc, pics, plugins, save
 AC_DEFUN([VLC_ADD_CPPFLAGS], [
-  for element in [$1]; do
-    eval "CPPFLAGS_${element}="'"$'"{CPPFLAGS_${element}} $2"'"'
-    am_modules_with_cppflags="${am_modules_with_cppflags} ${element}"
-  done
+  m4_foreach_w([element], [$1], [
+    [CPPFLAGS_]element[="${CPPFLAGS_]element[} $2"]
+    [am_modules_with_cppflags="${am_modules_with_cppflags} ]element["]
+  ])
 ])
 
 AC_DEFUN([VLC_ADD_CFLAGS], [
-  for element in [$1]; do
-    eval "CFLAGS_${element}="'"$'"{CFLAGS_${element}} $2"'"'
-    am_modules_with_cflags="${am_modules_with_cflags} ${element}"
-  done
+  m4_foreach_w([element], [$1], [
+    [CFLAGS_]element[="${CFLAGS_]element[} $2"]
+    [am_modules_with_cflags="${am_modules_with_cflags} ]element["]
+  ])
 ])
 
 AC_DEFUN([VLC_ADD_CXXFLAGS], [
-  for element in [$1]; do
-    eval "CXXFLAGS_${element}="'"$'"{CXXFLAGS_${element}} $2"'"'
-    am_modules_with_cxxflags="${am_modules_with_cxxflags} ${element}"
-  done
+  m4_foreach_w([element], [$1], [
+    [CXXFLAGS_]element[="${CXXFLAGS_]element[} $2"]
+    [am_modules_with_cxxflags="${am_modules_with_cxxflags} ]element["]
+  ])
 ])
 
 AC_DEFUN([VLC_ADD_OBJCFLAGS], [
-  for element in [$1]; do
-    eval "OBJCFLAGS_${element}="'"$'"{OBJCFLAGS_${element}} $2"'"'
-    am_modules_with_objcflags="${am_modules_with_objcflags} ${element}"
-  done
+  m4_foreach_w([element], [$1], [
+    [OBJCFLAGS_]element[="${OBJCFLAGS_]element[} $2"]
+    [am_modules_with_objcflags="${am_modules_with_objcflags} ]element["]
+  ])
 ])
 
 AC_DEFUN([VLC_ADD_LDFLAGS], [
-  for element in [$1]; do
-    eval "LDFLAGS_${element}="'"'"$2 "'$'"{LDFLAGS_${element}} "'"'
-    am_modules_with_ldflags="${am_modules_with_ldflags} ${element}"
-  done
+  m4_foreach_w([element], [$1], [
+    [LDFLAGS_]element[="${LDFLAGS_]element[} $2"]
+    [am_modules_with_ldflags="${am_modules_with_ldflags} ]element["]
+  ])
 ])
 
 AC_DEFUN([VLC_ADD_LIBS], [
-  for element in [$1]; do
-    eval "LIBS_${element}="'"'"$2 "'$'"{LIBS_${element}} "'"'
-    am_modules_with_libs="${am_modules_with_libs} ${element}"
-  done
+  m4_foreach_w([element], [$1], [
+    [LIBS_]element[="${LIBS_]element[} $2"]
+    [am_modules_with_libs="${am_modules_with_libs} ]element["]
+  ])
 ])
 
 AC_DEFUN([VLC_SET_CFLAGS_WERROR], [
-  for element in [$1]; do
-    eval "CFLAGS_WERROR_${element}="'"'"$2"'"'
-    am_modules_with_werror="${am_modules_with_werror} ${element}"
-  done
+  m4_foreach_w([element], [$1], [
+    [CFLAGS_WERROR_]element[="${CFLAGS_WERROR_]element[} $2"]
+    [am_modules_with_werror="${am_modules_with_werror} ]element["]
+  ])
 ])
 
 dnl ===========================================================================
-- 
1.6.6.1


From 39ab85e45779950d30a9fd90ac9fdba87f8fd615 Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Tue, 2 Feb 2010 21:47:27 +0100
Subject: [PATCH 02/11] Use new VLC_ADD_* capabilities in configure.ac.

Make use of the new feature in configure.ac.
I also removed some redundant calls to VLC_ADD* by combining them.

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac |  102 +++++++++++++++++----------------------------------------
 1 files changed, 31 insertions(+), 71 deletions(-)

diff --git a/configure.ac b/configure.ac
index ef73309..aa5a40d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -215,14 +215,11 @@ case "${host_os}" in
     CXXFLAGS_save="${CXXFLAGS_save} -D_INTL_REDIRECT_MACROS"; CXXFLAGS="${CXXFLAGS_save}"
     OBJCFLAGS_save="${OBJCFLAGS_save} -D_INTL_REDIRECT_MACROS -std=gnu99"; OBJCFLAGS="${OBJCFLAGS_save}"
     LDFLAGS_save="${LDFLAGS_save} -Wl,-headerpad_max_install_names"; LDFLAGS="${LDFLAGS_save}"
-    VLC_ADD_LDFLAGS([mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
-    VLC_ADD_LDFLAGS([mkv mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
-    VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup])
-    VLC_ADD_LDFLAGS([libvlc],[-Wl,-undefined,dynamic_lookup])
+    VLC_ADD_LDFLAGS([mkv mp4 motion], [-Wl,-framework,IOKit,-framework,CoreFoundation])
+    VLC_ADD_LDFLAGS([libvlc vlc],[-Wl,-undefined,dynamic_lookup])
     VLC_ADD_LDFLAGS([avcodec avformat access_avio swscale postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress])
     VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
     VLC_ADD_LDFLAGS([libvlccore],[-Wl,-framework,CoreFoundation])
-    VLC_ADD_LDFLAGS([motion],[-Wl,-framework,IOKit,-framework,CoreFoundation])
     AC_ARG_ENABLE(macosx-defaults,
       AS_HELP_STRING([--enable-macosx-defaults],[Build the default configuration on Mac OS X (default enabled)]))
     if test "x${enable_macosx_defaults}" != "xno"
@@ -932,8 +929,7 @@ then
   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
   VLC_ADD_CFLAGS([zip],[$MINIZIP_CFLAGS])
   VLC_ADD_LIBS([skins2 zip],[$MINIZIP_LIBS])
-  VLC_ADD_PLUGIN([unzip])
-  VLC_ADD_PLUGIN([zip])
+  VLC_ADD_PLUGIN([unzip zip])
 fi
 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
 
@@ -1164,8 +1160,7 @@ dnl
 ALIASES="${ALIASES} cvlc"
 
 if test "${SYS}" != "mingwce"; then
-  VLC_ADD_PLUGIN([oldrc])
-  VLC_ADD_PLUGIN([mediadirs])
+  VLC_ADD_PLUGIN([oldrc mediadirs])
   ALIASES="${ALIASES} rvlc"
 fi
 
@@ -1173,16 +1168,10 @@ dnl
 dnl Some plugins aren't useful on some platforms
 dnl
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
-    VLC_ADD_PLUGIN([motion])
-    VLC_ADD_PLUGIN([dynamicoverlay])
-    VLC_ADD_PLUGIN([signals])
+    VLC_ADD_PLUGIN([motion dynamicoverlay signals])
 elif test "${SYS}" != "mingwce"; then
-    VLC_ADD_PLUGIN([ntservice])
-    VLC_ADD_PLUGIN([access_smb])
-    VLC_ADD_PLUGIN([dmo])
-    VLC_ADD_PLUGIN([msn])
+    VLC_ADD_PLUGIN([ntservice access_smb dmo msn globalhotkeys])
     VLC_ADD_LIBS([dmo],[-lole32 -luuid])
-    VLC_ADD_PLUGIN([globalhotkeys])
 else
     VLC_ADD_PLUGIN([win32text])
 fi
@@ -2088,8 +2077,7 @@ then
     else
       PKG_CHECK_MODULES(OPENCV, opencv,
         [
-          VLC_ADD_PLUGIN([opencv_example])
-          VLC_ADD_PLUGIN([opencv_wrapper])
+          VLC_ADD_PLUGIN([opencv_example 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}])
@@ -2380,8 +2368,7 @@ 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_PLUGIN([vcd])
-    VLC_ADD_PLUGIN([cdda])
+    VLC_ADD_PLUGIN([vcd cdda])
   ],[
     AC_MSG_RESULT(no)
   ])
@@ -2389,8 +2376,7 @@ then
   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
     AC_MSG_RESULT(yes)
-    VLC_ADD_PLUGIN([vcd])
-    VLC_ADD_PLUGIN([cdda])
+    VLC_ADD_PLUGIN([vcd cdda])
     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
   ],[
     AC_MSG_RESULT(no)
@@ -2399,8 +2385,7 @@ 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_PLUGIN([vcd])
-    VLC_ADD_PLUGIN([cdda])
+    VLC_ADD_PLUGIN([vcd cdda])
     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
   ],[
     AC_MSG_RESULT(no)
@@ -2408,14 +2393,12 @@ then
 
   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32"
   then
-    VLC_ADD_PLUGIN([vcd])
-    VLC_ADD_PLUGIN([cdda])
+    VLC_ADD_PLUGIN([vcd cdda])
   fi
 
   if test "${SYS}" = "darwin"
   then
-    VLC_ADD_PLUGIN([vcd])
-    VLC_ADD_PLUGIN([cdda])
+    VLC_ADD_PLUGIN([vcd cdda])
     VLC_ADD_LDFLAGS([vcd vcdx cdda],[-Wl,-framework,IOKit,-framework,CoreFoundation])
     VLC_ADD_LIBS([vcdx cdda],[-liconv])
   fi
@@ -2893,13 +2876,9 @@ then
       AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h)
       AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
-        VLC_ADD_PLUGIN([avformat])
-        VLC_ADD_LIBS([avformat],[$AVFORMAT_LIBS $AVUTIL_LIBS])
-        VLC_ADD_CFLAGS([avformat],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
-
-        VLC_ADD_PLUGIN([access_avio])
-        VLC_ADD_LIBS([access_avio],[$AVFORMAT_LIBS $AVUTIL_LIBS])
-        VLC_ADD_CFLAGS([access_avio],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
+        VLC_ADD_PLUGIN([avformat access_avio])
+        VLC_ADD_LIBS([avformat access_avio],[$AVFORMAT_LIBS $AVUTIL_LIBS])
+        VLC_ADD_CFLAGS([avformat access_avio],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
       ], [
         VLC_ADD_LIBS([avcodec],[$AVFORMAT_LIBS $AVUTIL_LIBS])
         VLC_ADD_CFLAGS([avcodec],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
@@ -3208,9 +3187,7 @@ AC_CHECK_HEADERS(png.h, [
   LDFLAGS="${LDFLAGS_save} -lz"
   AC_CHECK_LIB(png, png_set_rows, [
     VLC_ADD_LIBS([png],[-lpng -lz])
-    VLC_ADD_PLUGIN([png])
-    VLC_ADD_PLUGIN([osdmenu])
-    VLC_ADD_PLUGIN([osd_parser])],
+    VLC_ADD_PLUGIN([png osdmenu osd_parser])],
     [],[-lz])
     LDFLAGS="${LDFLAGS_save}"
   ])
@@ -3447,10 +3424,7 @@ AS_IF([test "${enable_xcb}" != "no"], [
   dnl libxcb
   PKG_CHECK_MODULES(XCB, [xcb])
   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
-  VLC_ADD_PLUGIN([screensaver])
-  VLC_ADD_PLUGIN([xcb_x11])
-  VLC_ADD_PLUGIN([xcb_screen])
-  VLC_ADD_PLUGIN([xcb_apps])
+  VLC_ADD_PLUGIN([screensaver xcb_x11 xcb_screen xcb_apps])
   VLC_SET_CFLAGS_WERROR([xcb_screen], [-Wno-error=uninitialized]) # some gcc report a warning which doesn't reveal an error
 
   AS_IF([test "${enable_xvideo}" != "no"], [
@@ -3485,8 +3459,7 @@ AS_IF([test "${enable_xcb}" != "no"], [
 
   AS_IF([test "${have_xcb_keysyms}" = "yes"], [
     PKG_CHECK_MODULES(XPROTO, [xproto])
-    VLC_ADD_PLUGIN([xcb_window])
-    VLC_ADD_PLUGIN([globalhotkeys])
+    VLC_ADD_PLUGIN([xcb_window globalhotkeys])
     VLC_ADD_CFLAGS([globalhotkeys], [${XCB_KEYSYMS_CFLAGS} ${XCB_CFLAGS}])
     VLC_ADD_LIBS([globalhotkeys], [${XCB_KEYSYMS_LIBS} ${XCB_LIBS}])
   ])
@@ -3550,8 +3523,7 @@ then
      PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
         # SDL on Darwin is heavily patched and can only run SDL_image
         if test "${SYS}" != "darwin"; then
-          VLC_ADD_PLUGIN([vout_sdl])
-          VLC_ADD_PLUGIN([aout_sdl])
+          VLC_ADD_PLUGIN([vout_sdl aout_sdl])
         fi
         VLC_ADD_CFLAGS([vout_sdl aout_sdl sdl_image],[`${SDL_CONFIG} --cflags | sed 's,SDL,,'`])
         VLC_ADD_LIBS([vout_sdl aout_sdl sdl_image],[`${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`])
@@ -3689,8 +3661,7 @@ then
   if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
   then
       AC_CHECK_HEADERS(ddraw.h,
-      [ VLC_ADD_PLUGIN([directx])
-        VLC_ADD_PLUGIN([aout_directx])
+      [ VLC_ADD_PLUGIN([directx aout_directx])
         VLC_ADD_LIBS([directx],[-lgdi32])
       ],[AC_MSG_ERROR([Cannot find DirectX headers!])]
       )
@@ -3717,8 +3688,7 @@ if test "${enable_wingdi}" != "no"; then
     VLC_ADD_LIBS([wingdi],[-lgdi32 -lole32])
   fi
   if test "${SYS}" = "mingwce"; then
-    VLC_ADD_PLUGIN([wingdi])
-    VLC_ADD_PLUGIN([wingapi])
+    VLC_ADD_PLUGIN([wingdi wingapi])
     VLC_ADD_LIBS([wingdi],[-laygshell])
     VLC_ADD_LIBS([wingapi],[-laygshell])
   fi
@@ -3892,10 +3862,8 @@ if test "${enable_oss}" != "no" &&
    test "${enable_oss}" = "yes")
 then
   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
-    VLC_ADD_PLUGIN([oss])
-    VLC_ADD_PLUGIN([access_oss])
-    AC_CHECK_LIB(ossaudio,main,[VLC_ADD_LIBS([oss],[-lossaudio])
-                                VLC_ADD_LIBS([access_oss],[-lossaudio])])
+    VLC_ADD_PLUGIN([oss access_oss])
+    AC_CHECK_LIB(ossaudio,main,[VLC_ADD_LIBS([oss access_oss],[-lossaudio])])
   ])
 fi
 
@@ -3963,8 +3931,7 @@ fi
 dnl
 dnl  JACK modules
 dnl
-PKG_ENABLE_MODULES_VLC([JACK], [jack], [jack], [JACK audio I/O modules],[auto])
-PKG_ENABLE_MODULES_VLC([JACK], [access_jack], [jack], [JACK audio I/O modules],[auto])
+PKG_ENABLE_MODULES_VLC([JACK], [jack access_jack], [jack], [JACK audio I/O modules],[auto])
 
 
 dnl
@@ -4181,8 +4148,7 @@ then
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,WebKit])
   VLC_ADD_OBJCFLAGS([macosx minimal_macosx], [-fobjc-exceptions] )
 
-  VLC_ADD_PLUGIN([macosx])
-  VLC_ADD_PLUGIN([minimal_macosx])
+  VLC_ADD_PLUGIN([macosx minimal_macosx])
 fi
 
 dnl
@@ -4423,8 +4389,7 @@ AS_IF([test "${enable_gnutls}" != "no"], [
     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}])
+      VLC_ADD_LIBS([gnutls], [-lz ${LTLIBINTL}])
     ])
     dnl The GnuTLS plugin invokes gcry_control directly.
     AS_IF([test "${have_libgcrypt}" = "yes"],[
@@ -4553,12 +4518,10 @@ AC_ARG_ENABLE(loader,
 AM_CONDITIONAL(LOADER, [test "${enable_loader}" = "yes"])
 AS_IF([test "${enable_loader}" = "yes"],
   [ VLC_ADD_PLUGIN([dmo])
-    VLC_ADD_CPPFLAGS([dmo],[-I\\\${top_srcdir}/libs/loader])
-    VLC_ADD_LIBS([dmo],[\\\${top_builddir}/libs/loader/libloader.la -lpthread])
-    VLC_ADD_CPPFLAGS([quicktime],[-I\\\${top_srcdir}/libs/loader])
-    VLC_ADD_LIBS([quicktime],[\\\${top_builddir}/libs/loader/libloader.la -lpthread])
-    VLC_ADD_CPPFLAGS([realvideo],[-I\\\${top_srcdir}/libs/loader -DLOADER])
-    VLC_ADD_LIBS([realvideo],[\\\${top_builddir}/libs/loader/libloader.la])
+    VLC_ADD_CPPFLAGS([dmo quicktime realvideo],[-I\\\${top_srcdir}/libs/loader])
+    VLC_ADD_LIBS([dmo quicktime realvideo],[-I\\\${top_builddir}/libs/loader/libloader.a])
+    VLC_ADD_CPPFLAGS([realvideo], [-DLOADER])
+    VLC_ADD_LIBS([dmo quicktime], [-lpthread])
   ])
 
 AC_ARG_WITH(,[Components:])
@@ -4806,10 +4769,7 @@ then
   dnl  this one is needed until automake knows what to do
   VLC_ADD_LIBS([test3],[-lobjc])
 
-  VLC_ADD_PLUGIN([test1])
-  VLC_ADD_PLUGIN([test2])
-  VLC_ADD_PLUGIN([test3])
-  VLC_ADD_PLUGIN([test4])
+  VLC_ADD_PLUGIN([test1 test2 test3 test4])
 fi
 
 dnl
-- 
1.6.6.1


From 13d992999cab13f27a294ea2d0dd884fe1a8aa59 Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Sun, 24 Jan 2010 10:17:56 +0100
Subject: [PATCH 03/11] Use one configure option for alsa/access_alsa.

This matches the behaviour of --enable-jack and --enable-oss.

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index aa5a40d..d094eb3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3880,8 +3880,7 @@ PKG_ENABLE_MODULES_VLC([PORTAUDIO], [], [portaudio-2.0], [Portaudio library supp
 dnl
 dnl  ALSA module
 dnl
-PKG_ENABLE_MODULES_VLC([ALSA], [], [alsa >= 1.0.0], [Alsa sound support for linux], [auto])
-PKG_ENABLE_MODULES_VLC([ACCESS_ALSA], [access_alsa], [alsa >= 1.0.0], [Alsa access for linux], [auto])
+PKG_ENABLE_MODULES_VLC([ALSA], [alsa access_alsa], [alsa >= 1.0.0], [Alsa sound support for linux], [auto])
 
 dnl
 dnl  win32 waveOut plugin
-- 
1.6.6.1


From 5c70d76b5fc372b5e50fa23b4e772ffe0a3f7efb Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Sat, 23 Jan 2010 22:00:48 +0100
Subject: [PATCH 04/11] Remove --enable-cdda it's no longer used.


Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index d094eb3..f276de2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2354,11 +2354,8 @@ fi
 dnl
 dnl  Built-in CD-DA and VCD module
 dnl
-AC_ARG_ENABLE(cdda,
-  [  --enable-cdda           audio CD via built-in VCD (default enabled)])
-
 AC_ARG_ENABLE(vcd,
-  [  --enable-vcd            built-in VCD (default enabled)])
+  [  --enable-vcd            built-in VCD and CD-DA (default enabled)])
 
 AC_ARG_ENABLE(libcddb,
   [  --enable-libcddb        CDDB support for libcdio audio CD (default enabled)])
-- 
1.6.6.1


From 58434955d40b316f4cd9fef2d97555cd51989d46 Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Sun, 24 Jan 2010 22:29:38 +0100
Subject: [PATCH 05/11] Remove obsolete/deprecated configure options.

It's time to let go of those.

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac |   42 ------------------------------------------
 1 files changed, 0 insertions(+), 42 deletions(-)

diff --git a/configure.ac b/configure.ac
index f276de2..afa0ff5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,24 +50,6 @@ vlclibdir="\${libdir}/\${PKGDIR}"
 AC_SUBST(vlclibdir)
 
 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
 VLC_SAVE_FLAGS
@@ -1767,15 +1749,6 @@ AC_ARG_WITH(,[Input plugins:])
 
 dnl  live555 input
 dnl
-if test "${enable_livedotcom}"
-then
-  AC_MSG_WARN(--{en|dis}able-livedotcom is deprecated. Use --{en|dis}able-live555 instead.)
-fi
-if test "${enable_livedotcom}" = "no"
-then
-  enable_live555="no"
-fi
-
 AC_ARG_ENABLE(live555,
 [  --enable-live555        live555 RTSP input plugin (default enabled)])
 if test "${enable_live555}" != "no"; then
@@ -1785,12 +1758,6 @@ if test "${enable_live555}" != "no"; then
   dnl
   dnl test for --with-live555-tree
   dnl
-  if test "${with_livedotcom_tree}"
-  then
-    AC_MSG_WARN(--with-livedotcom-tree is deprecated. Use --with-live555-tree instead.)
-  with_live555_tree="${with_livedotcom_tree}"
-  fi
-
   if test -z "${with_live555_tree}" -a "${CXX}" != ""; then
     AC_LANG_PUSH(C++)
     CPPFLAGS_save="${CPPFLAGS}"
@@ -2745,12 +2712,6 @@ AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
 dnl
 dnl  avcodec decoder/encoder plugin
 dnl
-
-if test "${with_ffmpeg_tree}"
-then
-  AC_MSG_WARN([--with-ffmpeg-tree is deprecated. Use PKG_CONFIG_PATH instead.])
-fi
-
 AC_ARG_ENABLE(avcodec,
 [  --enable-avcodec        libavcodec codec (default enabled)])
 if test "${enable_avcodec}" != "no"
@@ -3121,9 +3082,6 @@ AC_ARG_WITH(a52-fixed,
 dnl
 dnl DTS Coherent Acoustics decoder plugin
 dnl
-AS_IF([test "x${enable_dts}" != "x"], [
-  AC_MSG_ERROR([--enable-dts is obsolete. Please use libdca and --enable-dca.])
-])
 PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
 
 dnl
-- 
1.6.6.1


From 52586e41a0b65e74f31432bda995bb7f6ffae935 Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Sun, 24 Jan 2010 10:32:24 +0100
Subject: [PATCH 06/11] Use extra parameter to AM_MAINTAINER_MODE.


Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index afa0ff5..07ab31f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,10 +34,7 @@ dnl If you want to use it, you definitely know what you are doing, so
 dnl you can specify "--disable-maintainer-mode". But if you want the default
 dnl automake behavior, you've likely never heard of maintainer mode, so we
 dnl can't expect you to enable it manually.
-
-AS_IF([test "x${enable_maintainer_mode}" != "xno"],
-    [enable_maintainer_mode="yes"])
-AM_MAINTAINER_MODE
+AM_MAINTAINER_MODE([enable])
 
 dnl
 dnl Directories
-- 
1.6.6.1


From 57aa690c07c39d417200d7f3ca86783a58fbdcdc Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Sun, 24 Jan 2010 22:24:14 +0100
Subject: [PATCH 07/11] Don't use uname in configure.ac.

uname considers the build system not the host system.

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 07ab31f..2f2f2da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,10 +139,10 @@ AC_ARG_WITH(contrib,
        with_cyberlink_tree=${CONTRIB_DIR}/src/clinkcc
     fi
 
-    if test ".`uname -s`" = ".Darwin"; then
+    if test "${SYS}" = "darwin"; then
       export LD_LIBRARY_PATH=${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH
       export DYLD_LIBRARY_PATH=${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH
-    elif test ".`uname -s`" = ".BeOS"; then
+    elif test "${SYS}" = "beos"; then
       export LIBRARY_PATH=${CONTRIB_DIR}/lib:$LIBRARY_PATH
       export BELIBRARIES=${CONTRIB_DIR}/lib:$BELIBRARIES
     fi
@@ -270,7 +270,7 @@ case "${host_os}" in
     fi
     ;;
   darwin9*)
-    if (test ".`uname -p`" = ".i386"); then
+    if test "${host_cpu}" = "i386"; then
         dnl Due to a ld(64) bug in 10.5 we cannot use our mmx code
         dnl without hacking it a lot, we disable mmx and sse.
         dnl (that bug is about ld being unable to handle
-- 
1.6.6.1


From 037caca135f2b4ef398883177be2de2c0b0788e6 Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Tue, 26 Jan 2010 20:04:49 +0100
Subject: [PATCH 08/11] Change configure comments to reflect autoconf logic.


Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2f2f2da..020d8f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1874,7 +1874,7 @@ dnl
 dnl dvdread module: check for libdvdread
 dnl
 AC_ARG_ENABLE(dvdread,
-[  --enable-dvdread        dvdread input module (default disabled)])
+[  --enable-dvdread        dvdread input module (default enabled)])
 if test "${enable_dvdread}" != "no"
 then
   AC_ARG_WITH(dvdread,
@@ -4157,7 +4157,7 @@ dnl
 dnl  ncurses module
 dnl
 AC_ARG_ENABLE(ncurses,
-  [  --disable-ncurses       ncurses interface support (default enabled)],
+  [  --disable-ncurses       ncurses interface support (default disabled)],
   [if test "${enable_ncurses}" != "no"; then
     AC_CHECK_HEADER(ncurses.h,
       [AC_CHECK_LIB(ncursesw, mvprintw,
-- 
1.6.6.1


From 8a1a967b3550270b641ac1f0b38bb4745afb084e Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Wed, 27 Jan 2010 20:39:23 +0100
Subject: [PATCH 09/11] Use new VLC_FEATURE macros in configure.ac.

I think it's bad style to override and tinker with enable_* strings on
your own. I choosed to implement the feature logic in m4 and provide
easy access macros to check for features.
This also fixes a small issue where in the output of configure it would
say "optim" if enable_optimizations was "yes" but that never happened,
because enable_optimizations was overwritten during the check.
I plan to move the whole configure.ac file to the VLC_FEATURE logic and
if bugs wrt the detection sneak in it should be a trivial fix.
AM_CONDITIONAL probed for enable_sqlite to be not set to "no", which
is the case if it was found by pkg-config (for example on darwin). The
new pkg-config check does no longer set enable_foo and so we need to
set a special variable. have_foo is a good choice, generally I think.
Also removed auto handling from PKG_ENABLE_MODULES_VLC since we always
use that.

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac       |  304 +++++++++++++++++++++++----------------------------
 m4/vlc.m4          |   10 +-
 m4/vlc_features.m4 |  240 +++++++++++++++++++++++++++++++++++++++++
 m4/with_pkg.m4     |   32 ++----
 4 files changed, 392 insertions(+), 194 deletions(-)
 create mode 100644 m4/vlc_features.m4

diff --git a/configure.ac b/configure.ac
index 020d8f7..1a8ac63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -212,35 +212,20 @@ case "${host_os}" in
         build_dir=`pwd`
         echo "  Assuming --prefix=${build_dir}/vlc_install_dir"
         ac_default_prefix="${build_dir}/vlc_install_dir"
-        enable_macosx="yes"
-        echo "  Assuming --enable-macosx"
-        enable_faad="yes"
-        echo "  Assuming --enable-faad"
-        enable_flac="yes"
-        echo "  Assuming --enable-flac"
-        enable_theora="yes"
-        echo "  Assuming --enable-theora"
-        enable_shout="yes"
-        echo "  Assuming --enable-shout"
-        enable_vcdx="yes"
-        echo "  Assuming --enable-vcdx"
-        enable_caca="yes"
-        echo "  Assuming --enable-caca"
-        enable_ncurses="yes"
-        echo "  Assuming --enable-ncurses"
-        enable_twolame="yes"
-        echo "  Assuming --enable-twolame"
-        enable_realrtsp="yes"
-        echo "  Assuming --enable-realrtsp"
-        enable_libass="yes"
-        echo "  Assuming --enable-libass"
-        enable_asademux="yes"
-        echo "  Assuming --enable-asademux"
-
-        enable_skins2="no"
-        echo "  Assuming --disable-skins2"
-        enable_xcb="no"
-        echo "  Assuming --disable-xcb"
+        VLC_FEATURE_FORCE_ENABLE([macosx])
+        VLC_FEATURE_FORCE_ENABLE([faad])
+        VLC_FEATURE_FORCE_ENABLE([flac])
+        VLC_FEATURE_FORCE_ENABLE([theora])
+        VLC_FEATURE_FORCE_ENABLE([shout])
+        VLC_FEATURE_FORCE_ENABLE([vcdx])
+        VLC_FEATURE_FORCE_ENABLE([caca])
+        VLC_FEATURE_FORCE_ENABLE([ncurses])
+        VLC_FEATURE_FORCE_ENABLE([twolame])
+        VLC_FEATURE_FORCE_ENABLE([realrtsp])
+        VLC_FEATURE_FORCE_ENABLE([libass])
+        VLC_FEATURE_FORCE_ENABLE([asademux])
+        VLC_FEATURE_FORCE_DISABLE([skins2])
+        VLC_FEATURE_FORCE_DISABLE([xcb])
     fi
     dnl
     dnl  Check for Mac OS X SDK settings
@@ -284,10 +269,8 @@ case "${host_os}" in
         CFLAGS="$save_cflags"
 
         if test "x$ac_ld_does_not_support_text_reloc" = "xyes"; then
-            enable_mmx="no"
-            echo "  Assuming --disable-mmx (due to a bug in ld)"
-            enable_sse="no"
-            echo "  Assuming --disable-sse (due to a bug in ld)"
+            VLC_FEATURE_FORCE_DISABLE([mmx], [due to a bug in ld])
+            VLC_FEATURE_FORCE_DISABLE([sse], [due to a bug in ld])
         fi
     fi
     ;;
@@ -1000,14 +983,14 @@ AC_CACHE_CHECK([if \$CC accepts -O4],
     [ac_cv_c_o4],
     [CFLAGS="${CFLAGS_save} -O4"
      AC_TRY_COMPILE([],,ac_cv_c_o4=yes, ac_cv_c_o4=no)])
-if test "${ac_cv_c_o4}" != "no" -a "x${enable_debug}" = "xno"; then
+if test "${ac_cv_c_o4}" != "no" && VLC_FEATURE_NOT_ENABLED([debug]); then
     CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O4"
 else
     AC_CACHE_CHECK([if \$CC accepts -O3],
         [ac_cv_c_o3],
         [CFLAGS="${CFLAGS_save} -O3"
          AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
-    if test "${ac_cv_c_o3}" != "no" -a "x${enable_debug}" = "xno"; then
+    if test "${ac_cv_c_o3}" != "no" && VLC_FEATURE_NOT_ENABLED([debug]); then
         CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O3"
     else
         AC_CACHE_CHECK([if \$CC accepts -O2],
@@ -1126,12 +1109,14 @@ AC_CHECK_FUNCS(backtrace)
 dnl
 dnl  Enable profiling
 dnl
+VLC_FEATURE_DEFAULT_DISABLE([gprof])
+VLC_FEATURE_DEFAULT_DISABLE([cprof])
 AC_ARG_ENABLE(gprof,
 [  --enable-gprof          gprof profiling (default disabled)])
 AC_ARG_ENABLE(cprof,
 [  --enable-cprof          cprof profiling (default disabled)])
-test "${enable_gprof}" != "yes" && enable_gprof="no"
-test "${enable_cprof}" != "yes" && enable_cprof="no"
+AS_IF([VLC_FEATURE_ENABLED([cprof])], [vlc_config_cprof="yes"], [vlc_config_cprof="no"])
+AS_IF([VLC_FEATURE_ENABLED([gprof])], [vlc_config_gprof="yes"], [vlc_config_gprof="no"])
 
 dnl
 dnl  default modules
@@ -1168,20 +1153,16 @@ 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)
+AS_CASE(
+  ["${host_cpu}"],
+  [i?86|x86_64], [VLC_FEATURE_DEFAULT_ENABLE([mmx])],
+  [VLC_FEATURE_DEFAULT_DISABLE([mmx])]
+)
 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
-])
+[  --disable-mmx           disable MMX optimizations (default auto)])
 have_mmx="no"
 have_mmxext="no"
-AS_IF([test "${enable_mmx}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([mmx])], [
   ARCH="${ARCH} mmx"
 
   AC_CACHE_CHECK([if $CC groks MMX intrinsics],
@@ -1236,20 +1217,15 @@ AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
 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)
+AS_CASE(
+  ["${host_cpu}"],
+  [i686|x86_64], [VLC_FEATURE_DEFAULT_ENABLE([sse])],
+  [VLC_FEATURE_DEFAULT_DISABLE([sse])]
+)
 AC_ARG_ENABLE(sse,
-[  --disable-sse           disable SSE (1, 2, 3 and 4) optimizations (default auto)],
-, [
-  case "${host_cpu}" in
-    i686|x86_64)
-      enable_sse=yes
-      ;;
-    *)
-      enable_sse=no
-      ;;
-  esac
-])
+[  --disable-sse           disable SSE (1, 2, 3 and 4) optimizations (default auto)])
 have_sse2="no"
-AS_IF([test "${enable_sse}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([sse])], [
   ARCH="${ARCH} sse sse2"
 
   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics],
@@ -1361,12 +1337,15 @@ AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
 ])
 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
 
+AS_IF([test "x${host_cpu}" = "xarm"], [
+  VLC_FEATURE_DEFAULT_ENABLE([neon])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([neon])
+])
 
 AC_ARG_ENABLE(neon,
-[  --disable-neon          disable NEON optimizations (default auto)],, [
-  AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
-])
-AS_IF([test "${enable_neon}" != "no"], [
+[  --disable-neon          disable NEON optimizations (default auto)])
+AS_IF([VLC_FEATURE_NOT_DISABLED([neon])], [
   AC_CACHE_CHECK([if $CC groks NEON inline assembly], [ac_cv_neon_inline], [
     CFLAGS="${CFLAGS_save} -mfpu=neon"
     AC_COMPILE_IFELSE([
@@ -1385,14 +1364,15 @@ AS_IF([test "${enable_neon}" != "no"], [
 AC_SUBST(ARM_NEON_CFLAGS)
 AM_CONDITIONAL(HAVE_ARM_NEON, [test "${ac_cv_neon_inline}" != "no"])
 
-
-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 "x${host_cpu}" = "xpowerpc"], [
+  VLC_FEATURE_DEFAULT_ENABLE([altivec])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([altivec])
 ])
+AC_ARG_ENABLE(altivec,
+[  --disable-altivec       disable AltiVec optimizations (default auto)])
 have_altivec="no"
-AS_IF([test "${enable_altivec}" = "yes"], [
+AS_IF([VLC_FEATURE_ENABLED([altivec])], [
   ARCH="${ARCH} altivec";
   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
     [ac_cv_altivec_inline],
@@ -1543,23 +1523,26 @@ dnl  Enable/disable optimizations
 dnl
 AC_ARG_ENABLE(optimizations,
 [  --disable-optimizations disable compiler optimizations (default enabled)])
-if test "${enable_optimizations}" != "no"; then
-   if test "${enable_optimize_memory}" = "yes"; then
-      enable_optimizations="size"
-   else
-      enable_optimizations="speed"
-   fi
-fi
+AS_IF([VLC_FEATURE_NOT_DISABLED([optimizations])], [
+  AS_IF([VLC_FEATURE_ENABLED([optimize-memory])], [
+    vlc_config_optimizations="size"
+  ], [
+    vlc_config_optimizations="speed"
+  ])
+], [
+  vlc_config_optimizations="no"
+])
 
 dnl
 dnl  Debugging mode
 dnl
 AC_ARG_ENABLE(debug,
 [  --enable-debug          debug mode (default disabled)])
-test "${enable_debug}" != "yes" && enable_debug="no"
 AH_TEMPLATE(NDEBUG,
             [Define to 1 if debug code should NOT be compiled])
-AS_IF([test "x${enable_debug}" = "xno"], [
+vlc_config_debug="no"
+AS_IF([VLC_FEATURE_ENABLED([debug])], [
+  vlc_config_debug="yes"
   AC_DEFINE(NDEBUG)
 ], [
   AC_CHECK_HEADERS([valgrind/valgrind.h])
@@ -1579,9 +1562,8 @@ dnl
 dnl  Test coverage
 dnl
 AC_ARG_ENABLE(coverage,
-	[  --enable-coverage       build for test coverage (default disabled)],,
-	[enable_coverage="no"])
-AS_IF([test "${enable_coverage}" != "no"], [
+	[  --enable-coverage       build for test coverage (default disabled)])
+AS_IF([VLC_FEATURE_ENABLED([coverage])], [
 	CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
 	CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
 	LDFLAGS="-lgcov ${LDFLAGS}"
@@ -1596,7 +1578,7 @@ dnl  Enable release-specific flags
 dnl
 AC_ARG_ENABLE(release,
 [  --enable-release        activate extra optimizations (default disabled)])
-test "${enable_release}" != "yes" && enable_release="no"
+AS_IF([VLC_FEATURE_ENABLED([release])], [vlc_config_release="yes"], [vlc_config_release="no"])
 
 dnl
 dnl Stream output
@@ -1682,25 +1664,24 @@ AS_IF([test "${enable_libproxy}" != "no"], [
 dnl
 dnl VideoLAN manager
 dnl
+VLC_FEATURE_DEFAULT([vlm], ["${enable_sout}"])
 AC_ARG_ENABLE(vlm,
-  [  --enable-vlm            VideoLAN manager (default enabled)],,
-  [enable_vlm="${enable_sout}"])
-AS_IF([test "${enable_vlm}" != "no"], [
+  [  --enable-vlm            VideoLAN manager (default enabled)])
+AS_IF([VLC_FEATURE_NOT_DISABLED([vlm])], [
   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([oldtelnet])
 ])
-AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
+AM_CONDITIONAL([ENABLE_VLM], [VLC_FEATURE_NOT_DISABLED([vlm])])
 
 dnl
 dnl Growl notification plugin
 dnl
 AC_ARG_ENABLE(growl,
-  [  --enable-growl          growl notification plugin (default disabled)],,
-  [enable_growl=no])
-AS_IF([test "${enable_growl}" != "no"], [
+  [  --enable-growl          growl notification plugin (default disabled)])
+AS_IF([VLC_FEATURE_ENABLED([growl])], [
     VLC_ADD_PLUGIN([growl_udp])
     AC_CHECK_HEADERS(Growl/GrowlDefines.h, [
       VLC_ADD_PLUGIN([growl])
@@ -2301,9 +2282,7 @@ dnl  VCDX modules
 dnl
 AC_ARG_ENABLE(vcdx,
   [  --enable-vcdx           VCD with navigation via libvcdinfo (default disabled)])
-
-if test "${enable_vcdx}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([vcdx])], [
 	PKG_CHECK_MODULES(LIBCDIO, [libcdio >= 0.78.2 libiso9660 >= 0.72],
 	  [VLC_ADD_LIBS([vcdx],[$LIBCDIO_LIBS])
 		 VLC_ADD_CFLAGS([vcdx],[$LIBCDIO_CFLAGS])],
@@ -2313,7 +2292,7 @@ then
 		 VLC_ADD_CFLAGS([vcdx],[$LIBVCDINFO_CFLAGS])],
 	  [AC_MSG_ERROR([vcdx plugin requires libvcdinfo library >= 0.7.22])])
         VLC_ADD_PLUGIN([vcdx])
-fi
+])
 
 dnl
 dnl  Built-in CD-DA and VCD module
@@ -2896,8 +2875,7 @@ dnl  faad decoder plugin
 dnl
 AC_ARG_ENABLE(faad,
 [  --enable-faad           faad codec (default disabled)])
-if test "${enable_faad}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([faad])], [
   AC_ARG_WITH(faad-tree,
   [  --with-faad-tree=PATH   faad tree for static linking])
   if test -n "${with_faad_tree}"
@@ -2937,7 +2915,7 @@ then
     LDFLAGS="${LDFLAGS_save}"
     CPPFLAGS="${CPPFLAGS_save}"
   fi
-fi
+])
 
 dnl
 dnl twolame encoder plugin
@@ -2974,9 +2952,9 @@ dnl  Real RTSP plugin
 dnl
 AC_ARG_ENABLE(realrtsp,
   [  --enable-realrtsp       Real RTSP module (default disabled)])
-if test "${enable_realrtsp}" = "yes"; then
+AS_IF([VLC_FEATURE_ENABLED([realrtsp])], [
   VLC_ADD_PLUGIN([access_realrtsp])
-fi
+])
 
 AC_ARG_ENABLE(libsysfs,
   [  --enable-libsysfs       Get user key from firewire connected iPod via libsysfs (default enabled)])
@@ -3259,7 +3237,7 @@ dnl libass subtitle rendering module
 dnl
 AC_ARG_ENABLE(libass,
   [  --enable-libass         Subtitle support using libass (default enabled)])
-AS_IF( [test "${enable_libass}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([libass])], [
   PKG_CHECK_MODULES(LIBASS, libass >= 0.9.6,
       [
         VLC_ADD_LIBS([libass],[$LIBASS_LIBS])
@@ -3280,7 +3258,7 @@ dnl asa demuxer
 dnl
 AC_ARG_ENABLE(asademux,
   [  --enable-asademux       asa subtitle demuxing (default disabled)])
-AS_IF( [test "${enable_asademux}" = "yes"], [
+AS_IF([VLC_FEATURE_ENABLED([asademux])], [
   PKG_CHECK_MODULES(PCRE,
       libpcre >= 6.5,
       [
@@ -3358,28 +3336,31 @@ AC_PATH_XTRA()
 dnl
 dnl  X C Bindings modules
 dnl
-AC_ARG_ENABLE(xcb,
-  [  --enable-xcb            X11 support with XCB (default enabled)],, [
-  AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" -a "${SYS}" != "darwin"], [
-    enable_xcb="yes"
-  ], [
-    enable_xcb="no"
-  ])
+AS_CASE(
+  ["${SYS}"],
+  [mingw32|mingwce|darwin], [VLC_FEATURE_DEFAULT_DISABLE([xcb])],
+  [VLC_FEATURE_DEFAULT_ENABLE([xcb])
 ])
-AC_ARG_ENABLE(xvideo,
-  [  --enable-xvideo         XVideo support (default enabled)],, [
-    enable_xvideo="$enable_xcb"
+
+AS_IF([VLC_FEATURE_REMOVED([xcb])], [
+  VLC_FEATURE_DEFAULT_DISABLE([xvideo])
+  VLC_FEATURE_DEFAULT_DISABLE([glx])
 ])
 
+AC_ARG_ENABLE(xcb,
+  [  --enable-xcb            X11 support with XCB (default enabled)])
+AC_ARG_ENABLE(xvideo,
+  [  --enable-xvideo         XVideo support (default enabled)])
+
 need_xid_provider="no"
-AS_IF([test "${enable_xcb}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([xcb])], [
   dnl libxcb
   PKG_CHECK_MODULES(XCB, [xcb])
   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
   VLC_ADD_PLUGIN([screensaver xcb_x11 xcb_screen xcb_apps])
   VLC_SET_CFLAGS_WERROR([xcb_screen], [-Wno-error=uninitialized]) # some gcc report a warning which doesn't reveal an error
 
-  AS_IF([test "${enable_xvideo}" != "no"], [
+  AS_IF([VLC_FEATURE_NOT_DISABLED([xvideo])], [
     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [
       VLC_ADD_PLUGIN([xcb_xv])
     ], [
@@ -3419,10 +3400,8 @@ AS_IF([test "${enable_xcb}" != "no"], [
 ])
 
 AC_ARG_ENABLE(glx,
-  [  --enable-glx            X11 OpenGL (GLX) support (default enabled)],, [
-  enable_glx="$enable_xcb"
-])
-AS_IF([test "${enable_glx}" != "no"], [
+  [  --enable-glx            X11 OpenGL (GLX) support (default enabled)])
+AS_IF([VLC_FEATURE_NOT_DISABLED([glx])], [
   PKG_CHECK_MODULES(XLIB_XCB, [x11-xcb])
   PKG_CHECK_MODULES(GL, [gl],, [
     AC_CHECK_HEADER([GL/gl.h], [
@@ -3975,19 +3954,21 @@ dnl
 AC_ARG_ENABLE(skins2,
   [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
-
+AS_CASE(
+  ["${SYS}"],
+  [darwin|beos|mingwce], [],
+  [VLC_FEATURE_DEFAULT_ENABLE([skins2])]
+)
+AS_IF([VLC_FEATURE_ENABLED([skins2])], [
   dnl test for the required libraries
   skins2_missing_lib="no"
 
   dnl freetype
   if test "${have_freetype}" != "yes"; then
     skins2_missing_lib="yes"
-    if test "${enable_skins2}" = "yes"; then
+    AS_IF([VLC_FEATURE_REQUESTED([skins2])], [
       AC_MSG_ERROR([Could not find freetype (required for skins2)])
-    fi
+    ])
   fi
 
   if test "${skins2_missing_lib}" = "no" && (test "${SYS}" = "mingw32"); then
@@ -4012,17 +3993,15 @@ if test "${enable_skins2}" = "yes" ||
     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} -lXext -lX11])
     need_xid_provider="no"
   fi fi fi
-fi
-AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes" ||
-	 (test "${SYS}" != "darwin" && test "${SYS}" != "beos" &&
-	  test "${SYS}" != "mingwce" && test "${enable_skins2}" != "no")])
+])
+AM_CONDITIONAL(BUILD_SKINS, [test "${skins2_missing_lib}" = "no"])
 
 dnl
 dnl Hildon UI
 dnl
 AC_ARG_ENABLE(hildon,
   [  --enable-hildon         Hildon touchscreen UI (default disabled)])
-AS_IF([test "${enable_hildon}" = "yes"], [
+AS_IF([VLC_FEATURE_ENABLED([hildon])], [
   PKG_CHECK_MODULES(HILDON, [hildon-1 hildon-fm-2], [
     VLC_ADD_CFLAGS([hildon],[${HILDON_CFLAGS}])
     VLC_ADD_LIBS([hildon],[${HILDON_LIBS}])
@@ -4030,22 +4009,18 @@ AS_IF([test "${enable_hildon}" = "yes"], [
     ALIASES="${ALIASES} mvlc"
     need_xid_provider="no"
   ], [
-    AS_IF([test "${enable_hildon}" = "yes"],[
-      AC_MSG_ERROR([Hildon libraries not found])
-    ])
-    enable_hildon="no"
+    AC_MSG_ERROR([Hildon libraries not found])
   ])
 ])
-AM_CONDITIONAL(BUILD_HILDON, [test "${enable_hildon}" = "yes"])
+AM_CONDITIONAL(BUILD_HILDON, [VLC_FEATURE_ENABLED([hildon])])
 
 dnl
 dnl QT 4
 dnl
+AS_IF([test "x${SYS}" = "xdarwin"], [VLC_FEATURE_DEFAULT_DISABLE([qt4])])
 AC_ARG_ENABLE(qt4,
-  [  --enable-qt4            Qt 4 support (default enabled) ],, [
-  AS_IF([test "${SYS}" = "darwin"], [enable_qt4=no])
-])
-AS_IF([test "${enable_qt4}" != "no"], [
+  [  --enable-qt4            Qt 4 support (default enabled) ])
+AS_IF([VLC_FEATURE_NOT_DISABLED([qt4])], [
   PKG_CHECK_MODULES(QT4, [QtCore QtGui >= 4.4.0], [
     VLC_ADD_PLUGIN([qt4])
     ALIASES="${ALIASES} qvlc"
@@ -4061,21 +4036,21 @@ AS_IF([test "${enable_qt4}" != "no"], [
     AC_PATH_PROGS(MOC, [moc-qt4 moc], moc,`eval $PKG_CONFIG --variable=exec_prefix QtCore`/bin)
     AC_PATH_PROG(RCC, rcc, rcc,`eval $PKG_CONFIG --variable=exec_prefix QtCore`/bin)
     AC_PATH_PROGS(UIC, [uic-qt4 uic], uic,`eval $PKG_CONFIG --variable=exec_prefix QtCore`/bin)
+    have_qt4="yes"
   ], [
-    AS_IF([test "${enable_qt4}" = "yes"],[
+    AS_IF([VLC_FEATURE_REQUESTED([qt4])], [
       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"])
+AM_CONDITIONAL(ENABLE_QT4, [test "x$have_qt4" = "xyes"])
 
 dnl
 dnl Simple test for skins2 dependency
 dnl
-AS_IF([test "${enable_skins2}" != "no" && test "x$enable_qt4" = "xno"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([skins2]) && test "x$have_qt4" != "xyes"], [
   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.])
 ])
 
@@ -4084,8 +4059,7 @@ dnl  MacOS X video output/gui modules
 dnl
 AC_ARG_ENABLE(macosx,
   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
-if test "x${enable_macosx}" = "xyes"
-then
+AS_IF([VLC_FEATURE_ENABLED([macosx])], [
   VLC_ADD_LDFLAGS([macosx minimal_macosx],[-Wl,-framework,Cocoa])
   VLC_ADD_LDFLAGS([macosx minimal_macosx],[-Wl,-framework,OpenGL])
   VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,Carbon])
@@ -4100,7 +4074,7 @@ then
   VLC_ADD_OBJCFLAGS([macosx minimal_macosx], [-fobjc-exceptions] )
 
   VLC_ADD_PLUGIN([macosx minimal_macosx])
-fi
+])
 
 dnl
 dnl  MacOS X related modules
@@ -4157,8 +4131,8 @@ dnl
 dnl  ncurses module
 dnl
 AC_ARG_ENABLE(ncurses,
-  [  --disable-ncurses       ncurses interface support (default disabled)],
-  [if test "${enable_ncurses}" != "no"; then
+  [  --disable-ncurses       ncurses interface support (default disabled)])
+AS_IF([VLC_FEATURE_ENABLED([ncurses])], [
     AC_CHECK_HEADER(ncurses.h,
       [AC_CHECK_LIB(ncursesw, mvprintw,
         [VLC_ADD_PLUGIN([ncurses])
@@ -4168,10 +4142,8 @@ AC_ARG_ENABLE(ncurses,
         AC_CHECK_LIB(ncursesw, tgetent, [],
           AC_CHECK_LIB(tinfow, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfow])],
             [AC_CHECK_LIB(tinfo, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfo])],
-              [AS_IF([test "x${enable_ncurses}" != "x"],
-                [AC_MSG_ERROR([tgetent not found in ncursesw tinfow tinfo]
-               )])])
-            ]
+                [AC_MSG_ERROR([tgetent not found in ncursesw tinfow tinfo])]
+            ])
           )
         )
         ],
@@ -4181,17 +4153,14 @@ AC_ARG_ENABLE(ncurses,
           VLC_ADD_LIBS([ncurses],[-lncurses])
           AC_CHECK_LIB(ncurses, tgetent, [],
             [AC_CHECK_LIB(tinfo, tgetent, [VLC_ADD_LIBS([ncurses],[-ltinfo])],
-              [AS_IF([test "x${enable_ncurses}" != "x"],
-                [AC_MSG_ERROR([tgetent not found in ncurses tinfo])])]
+                [AC_MSG_ERROR([tgetent not found in ncurses tinfo])]
             )]
           )],
-          [AS_IF([test "x${enable_ncurses}" != "x"], [
-            AC_MSG_ERROR([libncurses not found])])]
+          [AC_MSG_ERROR([libncurses not found])]
         )]
       )]
     )
-  fi]
-)
+])
 
 dnl
 dnl  XOSD plugin
@@ -4252,8 +4221,8 @@ dnl  AtmoLight (homemade Philips Ambilight clone)
 dnl
 AC_ARG_ENABLE(atmo,
 AS_HELP_STRING([--disable-atmo],[AtmoLight (homemade Philips Ambilight clone)
-                (default enabled)]),, [enable_atmo="yes"])
-AS_IF([test "${enable_atmo}" != no], [
+                (default enabled)]))
+AS_IF([VLC_FEATURE_NOT_DISABLED([atmo])], [
   AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
     AC_LANG_PUSH(C++)
     VLC_ADD_PLUGIN([atmo])
@@ -4332,9 +4301,9 @@ AS_IF([test "${have_libgcrypt}" != "yes"], [
   AS_IF([test "${enable_gnutls}" = "yes"], [
     AC_MSG_ERROR([--enable-gnutls and --disable-libgcrypt are mutually exclusive.])
   ])
-  enable_gnutls="no"
+  VLC_FEATURE_DEFAULT_DISABLE([gnutls])
 ])
-AS_IF([test "${enable_gnutls}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([gnutls])], [
   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.7.4], [
     VLC_ADD_PLUGIN([gnutls])
     VLC_ADD_CFLAGS([gnutls], [$GNUTLS_CFLAGS])
@@ -4349,7 +4318,7 @@ AS_IF([test "${enable_gnutls}" != "no"], [
     ])
     VLC_ADD_LIBS([gnutls], [$GNUTLS_LIBS])
   ], [
-    AS_IF([test "${enable_gnutls}" = "yes"], [
+    AS_IF([VLC_FEATURE_REQUESTED([gnutls])], [
       AC_MSG_ERROR([gnutls not present or too old (version 1.7.4 required)])
     ])
   ])
@@ -4438,6 +4407,7 @@ else
           VLC_ADD_CFLAGS([sqlite],[-I${with_sqlite}/include])
           VLC_ADD_LIBS([sqlite], [-L${with_sqlite}/lib -lsqlite3])
           AC_MSG_RESULT(yes)
+          have_sqlite="yes"
         else
           VLC_ADD_LIBS([sqlite], [-lsqlite3])
         fi
@@ -4445,7 +4415,7 @@ else
         AC_MSG_ERROR([sqlite3 is required for sqlite module]) )
   fi
 fi
-AM_CONDITIONAL([HAVE_SQLITE], [test "${enable_sqlite}" != "no"])
+AM_CONDITIONAL([HAVE_SQLITE], [test "x${have_sqlite}" = "xyes"])
 
 
 dnl
@@ -4964,11 +4934,11 @@ version               : ${VERSION}
 system                : ${SYS}
 architecture          : ${ARCH}
 build flavour         : "
-test "${enable_debug}" = "yes" && printf "debug "
-test "${enable_cprof}" = "yes" && printf "cprof "
-test "${enable_gprof}" = "yes" && printf "gprof "
-test "${enable_optimizations}" = "yes" && printf "optim "
-test "${enable_release}" = "yes" && printf "release " || printf "devel "
+AS_IF([VLC_FEATURE_ENABLED([debug])], [printf "debug "])
+AS_IF([VLC_FEATURE_ENABLED([cprof])], [printf "cprof "])
+AS_IF([VLC_FEATURE_ENABLED([gprof])], [printf "gprof "])
+AS_IF([VLC_FEATURE_NOT_DISABLED([optimizations])], [printf "optim "])
+AS_IF([VLC_FEATURE_ENABLED([release])], [printf "release "], [printf "devel "])
 echo ""
 if test "${enable_vlc}" != "no"; then
 echo "vlc aliases           :${ALIASES}"
diff --git a/m4/vlc.m4 b/m4/vlc.m4
index 38fd988..f434d68 100644
--- a/m4/vlc.m4
+++ b/m4/vlc.m4
@@ -99,11 +99,11 @@ AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [
 
   rm -f vlc-config.in
   sed -ne '/#@1@#/q;p' < "${srcdir}/vlc-config.in.in" \
-    | sed -e "s/@gprof@/${enable_gprof}/" \
-          -e "s/@cprof@/${enable_cprof}/" \
-          -e "s/@optim@/${enable_optimizations}/" \
-          -e "s/@debug@/${enable_debug}/" \
-          -e "s/@release@/${enable_release}/" \
+    | sed -e "s/@gprof@/${vlc_config_gprof}/" \
+          -e "s/@cprof@/${vlc_config_cprof}/" \
+          -e "s/@optim@/${vlc_config_optimizations}/" \
+          -e "s/@debug@/${vlc_config_debug}/" \
+          -e "s/@release@/${vlc_config_release}/" \
           -e "s/@PLUGINS@/${PLUGINS}/" \
           -e "s/@BUILTINS@/${BUILTINS}/" \
           -e "s/@CFLAGS_TUNING@/${CFLAGS_TUNING}/" \
diff --git a/m4/vlc_features.m4 b/m4/vlc_features.m4
new file mode 100644
index 0000000..80e3439
--- /dev/null
+++ b/m4/vlc_features.m4
@@ -0,0 +1,240 @@
+dnl Handling features and arguments to ./configure.
+dnl
+dnl Copyright © 2010 Daniel Mierswa <impulze@impulze.org>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that program.
+
+
+
+dnl ==========================================================================
+dnl First some helper macros for internal usage only.
+dnl ==========================================================================
+
+dnl _VLC_FEATURE_STRING(ENABLE-STRING)
+dnl Create the same string autoconf uses for AC_ARG_ENABLE().
+AC_DEFUN([_VLC_FEATURE_STRING],
+  [patsubst([$1], -, _)])
+
+dnl _VLC_FEATURE_CHECK_VARIABLE(ENABLE-STRING, PREFIX, TEST)
+dnl Check if shell variable with prefix_ENABLE-STRING succeeds TEST.
+AC_DEFUN([_VLC_FEATURE_CHECK_VARIABLE], 
+  [[test "x${$2_]_VLC_FEATURE_STRING([$1])[}" $3]])
+
+dnl _VLC_FEATURE_DEFAULT(ENABLE-STRING, [VALUE])
+dnl Set a default value for --enable-ENABLE-STRING (must be "yes" or "no").
+AC_DEFUN([_VLC_FEATURE_DEFAULT], [
+  m4_foreach_w([item], [$1], [
+    [vlc_feature_default_]_VLC_FEATURE_STRING(item)[="$2"]
+  ])
+])
+
+
+dnl ==========================================================================
+dnl Macros for manipulating defaults / forcing.
+dnl ==========================================================================
+
+dnl VLC_FEATURE_FORCE_ENABLE(ENABLE-STRING, [REASON])
+dnl Force a feature to be always enabled regardless what is passed to configure.
+AC_DEFUN([VLC_FEATURE_FORCE_ENABLE], [
+  [vlc_feature_force_]_VLC_FEATURE_STRING([$1])[="yes"]
+  AS_ECHO(["Assuming --enable-$1]m4_quote(m4_ifnblank([$2], [ $2]))["])
+])
+
+dnl VLC_FEATURE_FORCE_DISABLE(ENABLE-STRING, [REASON])
+dnl Force a feature to be always disabled regardless what is passed to configure.
+AC_DEFUN([VLC_FEATURE_FORCE_DISABLE], [
+  [vlc_feature_force_]_VLC_FEATURE_STRING([$1])[="no"]
+  AS_ECHO(["Assuming --disable-$1]m4_quote(m4_ifnblank([$2], [ $2]))["])
+])
+
+dnl VLC_FEATURE_DEFAULT_ENABLE(ENABLE-STRING)
+dnl Enable feature by default.
+AC_DEFUN([VLC_FEATURE_DEFAULT_ENABLE], [
+  _VLC_FEATURE_DEFAULT([$1], [yes])
+])
+
+dnl VLC_FEATURE_DEFAULT_DISABLE(ENABLE-STRING)
+dnl
+dnl Disable feature by default.
+AC_DEFUN([VLC_FEATURE_DEFAULT_DISABLE], [
+  _VLC_FEATURE_DEFAULT([$1], [no])
+])
+
+
+
+dnl ==========================================================================
+dnl Macros for probing the state of features.
+dnl ==========================================================================
+
+dnl VLC_FEATURE_(NOT_)FORCE_ENABLED/DISABLED(ENABLE-STRING)
+dnl Check if a feature is (or isn't) forced to be enabled/disabled.
+AC_DEFUN([VLC_FEATURE_FORCE_ENABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_force], [= "xyes" ])])
+AC_DEFUN([VLC_FEATURE_NOT_FORCE_ENABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_force], [!= "xyes" ])])
+AC_DEFUN([VLC_FEATURE_FORCE_DISABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_force], [= "xno" ])])
+AC_DEFUN([VLC_FEATURE_NOT_FORCE_DISABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_force], [!= "xno" ])])
+
+dnl VLC_FEATURE_(NOT_)USER_ENABLED/DISABLED(ENABLE-STRING)
+dnl Check if a feature is (or isn't) enabled/disabled via ./configure.
+AC_DEFUN([VLC_FEATURE_USER_ENABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [enable], [= "xyes" ])])
+AC_DEFUN([VLC_FEATURE_NOT_USER_ENABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [enable], [!= "xyes" ])])
+AC_DEFUN([VLC_FEATURE_USER_DISABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [enable], [= "xno" ])])
+AC_DEFUN([VLC_FEATURE_NOT_USER_DISABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [enable], [!= "xno" ])])
+
+dnl VLC_FEATURE_(NOT_)DEFAULT_ENABLED/DISABLED(ENABLE-STRING)
+dnl Check if a feature is (or isn't) default enabled/disabled by configure.ac authors.
+AC_DEFUN([VLC_FEATURE_DEFAULT_ENABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_default], [= "xyes" ])])
+AC_DEFUN([VLC_FEATURE_NOT_DEFAULT_ENABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_default], [!= "xyes" ])])
+AC_DEFUN([VLC_FEATURE_DEFAULT_DISABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_default], [= "xno" ])])
+AC_DEFUN([VLC_FEATURE_NOT_DEFAULT_DISABLED],
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_default], [!= "xno"])])
+
+
+
+dnl ==========================================================================
+dnl Convenient macros for probing the state of features.
+dnl ==========================================================================
+
+dnl VLC_FEATURE_(NOT_)REQUESTED/REMOVED(ENABLE-STRING)
+dnl Check if a feature is (or isn't) forced to be enabled/disabled or
+dnl enabled/disabled via ./configure.
+AC_DEFUN([VLC_FEATURE_REQUESTED],
+  [ { \]
+    [VLC_FEATURE_FORCE_ENABLED([$1])][ \]
+    [ || \]
+    [{ ][VLC_FEATURE_NOT_FORCE_DISABLED([$1])][ && ][VLC_FEATURE_USER_ENABLED([$1])][ ; } \]
+  [; }])
+AC_DEFUN([VLC_FEATURE_NOT_REQUESTED],
+  [AS_IF([VLC_FEATURE_REQUESTED([$1])], [false], [true])])
+AC_DEFUN([VLC_FEATURE_REMOVED],
+  [ { \]
+    [VLC_FEATURE_FORCE_DISABLED([$1])][ \]
+    [ || \]
+    [{ ][VLC_FEATURE_NOT_FORCE_ENABLED([$1])][ && ][VLC_FEATURE_USER_DISABLED([$1])][ ; } \]
+  [; }])
+AC_DEFUN([VLC_FEATURE_NOT_REMOVED],
+  [AS_IF([VLC_FEATURE_REMOVED([$1])], [false], [true])])
+
+dnl VLC_FEATURE_(NOT_)ENABLED/DISABLED(ENABLE-STRING)
+dnl Check if a feature is (or isn't) explicitly or default enabled/disabled.
+AC_DEFUN([VLC_FEATURE_ENABLED],
+  [{ \]
+    [VLC_FEATURE_REQUESTED([$1])][ \]
+    [ || \]
+    [{ \]
+        [VLC_FEATURE_NOT_FORCE_DISABLED([$1])][ \]
+        [ && \]
+        [VLC_FEATURE_NOT_USER_DISABLED([$1])][ \]
+        [ && \]
+        [VLC_FEATURE_DEFAULT_ENABLED([$1])][ \]
+    [; } \]
+  [; }])
+AC_DEFUN([VLC_FEATURE_NOT_ENABLED],
+  [AS_IF([VLC_FEATURE_ENABLED([$1])], [false], [true])])
+AC_DEFUN([VLC_FEATURE_DISABLED],
+  [{ \]
+    [VLC_FEATURE_REMOVED([$1])][ \]
+    [ || \]
+    [{ \]
+        [VLC_FEATURE_NOT_FORCE_ENABLED([$1])][ \]
+        [ && \]
+        [VLC_FEATURE_NOT_USER_ENABLED([$1])][ \]
+        [ && \]
+        [VLC_FEATURE_DEFAULT_DISABLED([$1])][ \]
+    [; } \]
+  [; }])
+AC_DEFUN([VLC_FEATURE_NOT_DISABLED],
+  [AS_IF([VLC_FEATURE_DISABLED([$1])], [false], [true])])
+
+
+
+dnl ==========================================================================
+dnl Macro to introduce a feature.
+dnl ==========================================================================
+
+dnl VLC_FEATURE_OPTION(ENABLE-STRING, DESCRIPTION, [DEFAULT-STRING])
+dnl Wrap around AC_ARG_ENABLE to provide features for VLC.
+dnl DESCRIPTION is _not_ optional, please pick good descriptions
+dnl preferably understandable for packagers (support for a is very vague).
+dnl DEFAULT-STRING defaults to "enabled".
+dnl If DEFAULT-STRING is not "enabled" or "disabled" the caller has to call
+dnl VLC_FEATURE_DEFAULT_{ENABLE,DISABLE} prior to calling this macro.
+dnl Only if DEFAULT-STRING is "enabled" the configure output will show --disable-foo.
+dnl So for example "enabled on BSD" will still print --enable-foo.
+AC_DEFUN([VLC_FEATURE_OPTION], [
+  m4_pushdef([default_string], m4_default([$3], [enabled]))
+  m4_pushdef([var], [vlc_feature_]_VLC_FEATURE_STRING([$1]))
+  m4_ifblank([$2], [m4_fatal([Don't leave description blank for $1])])
+
+  m4_case(default_string,
+    [enabled], [
+      m4_pushdef([with_without], [--disable-$1])
+      VLC_FEATURE_DEFAULT_ENABLE([$1])
+    ],
+    [disabled], [
+      m4_pushdef([with_without], [--enable-$1])
+      VLC_FEATURE_DEFAULT_DISABLE([$1])
+    ],
+    [m4_pushdef([with_without], [--enable-$1])]
+  )
+
+  dnl FIXME: only work in global scope?
+
+  dnl Check for default arguments, we always require them.
+  AS_IF([VLC_FEATURE_DEFAULT_ENABLED([$1]) || VLC_FEATURE_DEFAULT_DISABLED([$1])], [
+    :
+  ], [
+    AC_MSG_ERROR([The configure.ac author forgot to set a default for $1. Please fix.])
+  ])
+
+  dnl Check if the user wanted to disable/enable something that was forced the
+  dnl opposite. For example --enable-linux on Mac OS X or so.
+  AS_IF([VLC_FEATURE_FORCE_ENABLED([$1]) && VLC_FEATURE_USER_DISABLED([$1])], [
+    AC_MSG_ERROR([You cannot --disable-$1 it was force enabled.])
+  ])
+
+  AS_IF([VLC_FEATURE_FORCE_DISABLED([$1]) && VLC_FEATURE_USER_ENABLED([$1])], [
+    AC_MSG_ERROR([You cannot --enable-$1 it was force disabled.])
+  ])
+
+  AC_ARG_ENABLE([$1], [
+    AS_HELP_STRING(with_without,
+                   m4_quote([$2])[ @<:@default: ]m4_quote(default_string)[@:>@])
+  ])
+
+  AS_IF([test "x${]var[}" = "x"], [AS_IF([VLC_FEATURE_REQUESTED([$1])], var="yes")])
+  AS_IF([test "x${]var[}" = "x"], [AS_IF([VLC_FEATURE_REMOVED([$1])], var="no")])
+  AS_IF([test "x${]var[}" = "x"], [AS_IF([VLC_FEATURE_DEFAULT_ENABLED([$1])], var="yes")])
+  AS_IF([test "x${]var[}" = "x"], [AS_IF([VLC_FEATURE_DEFAULT_DISABLED([$1])], var="no")])
+
+  m4_popdef([default_string])
+  m4_popdef([var])
+  m4_popdef([with_without])
+])
diff --git a/m4/with_pkg.m4 b/m4/with_pkg.m4
index 7925317..a70dc1d 100644
--- a/m4/with_pkg.m4
+++ b/m4/with_pkg.m4
@@ -35,31 +35,17 @@ AC_DEFUN([PKG_WITH_MODULES],
 [
 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 m4_pushdef([with_arg], m4_tolower([$1]))
-
 m4_pushdef([description],
            [m4_default([$5], [build with ]with_arg[ support enabled])])
 
-m4_pushdef([def_arg], [m4_default([$6], [auto])])
-m4_pushdef([def_action_if_found], [AS_TR_SH([enable_]with_arg)=yes])
-m4_pushdef([def_action_if_not_found], [AS_TR_SH([enable_]with_arg)=no])
-
-m4_case(def_arg,
-            [yes],[m4_pushdef([with_without], [--disable-]with_arg)],
-            [m4_pushdef([with_without],[--enable-]with_arg)])
-
 AC_ARG_ENABLE(with_arg,
-     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
-    [AS_TR_SH([enable_]with_arg)=def_arg])
+     AS_HELP_STRING([--enable-]with_arg, description[ @<:@default=]auto[@:>@]))
 
-AS_CASE([$AS_TR_SH([enable_]with_arg)],
-            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
-            [auto],[PKG_CHECK_MODULES([$1],[$2],
-                                        [m4_n([def_action_if_found]) $3],
-                                        [m4_n([def_action_if_not_found]) $4])])
+AS_IF([VLC_FEATURE_NOT_DISABLED(with_arg)], [
+     PKG_CHECK_MODULES([$1],[$2],[$3],[$4])])
 
 m4_popdef([with_arg])
 m4_popdef([description])
-m4_popdef([def_arg])
 
 ]) dnl PKG_WITH_MODULES
 
@@ -89,11 +75,13 @@ PKG_WITH_MODULES([$1],[$3],
     VLC_ADD_PLUGIN(module_name)
     m4_ifval( m4_normalize([$8]), VLC_ADD_CPPFLAGS(module_name, [$8]))
     VLC_ADD_CFLAGS(module_name,[$$1_CFLAGS] [$6])
-    VLC_ADD_LIBS(module_name,[$$1_LIBS] [$7]),
-    AS_IF([test x"$AS_TR_SH([enable_]enable_arg)" = "xyes"],
-        [AC_MSG_ERROR(Library [$3] needed for [m4_tolower([$1])] was not found)],
-        [AC_MSG_WARN(Library [$3] needed for [m4_tolower([$1])] was not found)]
-         ),
+    VLC_ADD_LIBS(module_name,[$$1_LIBS] [$7])
+    AS_TR_SH([have_]enable_arg)="yes",
+    AS_IF([VLC_FEATURE_REQUESTED(enable_arg)],
+      [AC_MSG_ERROR(Library [$3] needed for [m4_tolower([$1])] was not found)])
+    AS_IF([VLC_FEATURE_DEFAULT_ENABLED(enable_arg)],
+      [AC_MSG_WARN(Library [$3] needed for [m4_tolower([$1])] was not found)])
+    AS_TR_SH([have_]enable_arg)="no",
     [$4],[$5])
 
 m4_popdef([module_name])
-- 
1.6.6.1


From 943b301f68db7c29387b1a8ce546d7dc9c5f4506 Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Wed, 27 Jan 2010 21:30:06 +0100
Subject: [PATCH 10/11] Use VLC_FEATURE everywhere.


Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac |  533 +++++++++++++++++++++++++---------------------------------
 1 files changed, 228 insertions(+), 305 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1a8ac63..5011221 100644
--- a/configure.ac
+++ b/configure.ac
@@ -201,8 +201,7 @@ case "${host_os}" in
     VLC_ADD_LDFLAGS([libvlccore],[-Wl,-framework,CoreFoundation])
     AC_ARG_ENABLE(macosx-defaults,
       AS_HELP_STRING([--enable-macosx-defaults],[Build the default configuration on Mac OS X (default enabled)]))
-    if test "x${enable_macosx_defaults}" != "xno"
-    then
+    AS_IF([VLC_FEATURE_NOT_DISABLED([macosx-defaults])], [
         echo ""
         echo "Building with Mac OS X defaults:"
         with_macosx_version_min="10.5"
@@ -226,7 +225,7 @@ case "${host_os}" in
         VLC_FEATURE_FORCE_ENABLE([asademux])
         VLC_FEATURE_FORCE_DISABLE([skins2])
         VLC_FEATURE_FORCE_DISABLE([xcb])
-    fi
+    ])
     dnl
     dnl  Check for Mac OS X SDK settings
     dnl
@@ -313,10 +312,9 @@ case "${host_os}" in
         dnl
         AC_ARG_ENABLE(peflags,
           [  --enable-peflags        peflags use (default enabled on Windows)])
-        if test "${enable_peflags}" != "no"
-        then
+        AS_IF([VLC_FEATURE_NOT_DISABLED([peflags])], [
           AC_CHECK_TOOL(PEFLAGS, peflags, :)
-        fi
+        ])
     fi
     if test "${SYS}" = "mingwce"; then
         # add ws2 for closesocket, select, recv
@@ -358,7 +356,7 @@ 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")
-AM_CONDITIONAL(USE_PEFLAGS, [test "${enable_peflags}" = "yes"])
+AM_CONDITIONAL(USE_PEFLAGS, [VLC_FEATURE_ENABLED([peflags])])
 
 dnl
 dnl Sadly autoconf doesn't think about testing foo.exe when ask to test
@@ -397,7 +395,7 @@ m4_defun([AC_DEPLIBS_CHECK_METHOD],[])
 
 lt_cv_deplibs_check_method=pass_all
 
-AS_IF([test "${enable_shared}" = "no"], [
+AS_IF([VLC_FEATURE_DISABLED([shared])], [
   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
 ])
 
@@ -500,7 +498,7 @@ AC_PREPROC_IFELSE([
   AC_MSG_RESULT([not present])
 ], [
   AC_MSG_RESULT([found])
-  AS_IF([test "x${enable_nls}" != "xno" || test "x${enable_mozilla}" != "xno"], [
+  AS_IF([VLC_FEATURE_NOT_DISABLED([nls]) || VLC_FEATURE_NOT_DISABLED([mozilla])], [
     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
 work-around for this. Check with your distribution vendor on how to update the
 glibc run-time. Alternatively, build with --disable-nls --disable-mozilla and
@@ -901,8 +899,7 @@ AC_ARG_ENABLE(dbus,
   [  --enable-dbus           Linux D-BUS message bus system (default enabled)])
 case "${SYS}" in
     linux*|*bsd*)
-if test "${enable_dbus}" != "no" -a "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([dbus]) && test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce"], [
   dnl api stable dbus
   PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0,
     [ AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
@@ -910,20 +907,19 @@ then
       VLC_ADD_CFLAGS([libvlccore],[$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
+        AS_IF([VLC_FEATURE_NOT_DISABLED([dbus_control])], [
           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,
           AS_HELP_STRING([--enable-telepathy],[Telepathy Presence plugin through DBus(default enabled)]))
-        if test "${enable_telepathy}" != "no"; then
+        AS_IF([VLC_FEATURE_NOT_DISABLED([telepathy])], [
           VLC_ADD_PLUGIN([telepathy])
           VLC_ADD_LIBS([telepathy],[$DBUS_LIBS])
           VLC_ADD_CFLAGS([telepathy],[$DBUS_CFLAGS])
-        fi
+        ])
         dnl Power Management Inhibiter
         VLC_ADD_PLUGIN([inhibit])
         VLC_ADD_LIBS([inhibit],[$DBUS_LIBS])
@@ -931,7 +927,7 @@ then
     ],
     [AC_MSG_ERROR([Couldn't find DBus >= 1.0.0, install libdbus-dev ?])]
   )
-fi
+])
 ;;
 esac
 
@@ -951,8 +947,8 @@ RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast
 RDC_PROG_CC_FLAGS([-pipe])
 
 AC_ARG_ENABLE(warnings-as-error,
-      AS_HELP_STRING([--enable-warnings-as-error],[Treat acceptable warnings as error (default disabled)]),, [enable_warnings_as_error="no"])
-AS_IF([test "${enable_warnings_as_error}" = "yes"], [
+      AS_HELP_STRING([--enable-warnings-as-error],[Treat acceptable warnings as error (default disabled)]))
+AS_IF([VLC_FEATURE_ENABLED([warnings-as-error])], [
     RDC_PROG_CC_WERRORFLAGS([unused-function unused-label unused-value unused-parameter unused-variable unused \
      missing-braces nonnull parentheses uninitialized address enum-compare undef comment switch \
      bad-function-cast implicit sequence-point strict-aliasing array-bounds missing-parameter-type \
@@ -1514,9 +1510,9 @@ dnl  Memory usage
 dnl
 AC_ARG_ENABLE(optimize-memory,
 [  --enable-optimize-memory optimize memory usage over performance])
-if test "${enable_optimize_memory}" = "yes"; then
+AS_IF([VLC_FEATURE_ENABLED([optimize-memory])], [
   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
-fi
+])
 
 dnl
 dnl  Enable/disable optimizations
@@ -1553,7 +1549,7 @@ dnl Allow runing as root (usefull for people runing on embedded platforms)
 dnl
 AC_ARG_ENABLE(run-as-root,
 [  --enable-run-as-root    allow runing VLC as root (default disabled)])
-AS_IF([test "${enable_run_as_root}" = "yes"],[
+AS_IF([VLC_FEATURE_ENABLED([run-as-root])], [
     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
               [Define to 1 to allow runing VLC as root (uid 0).])
 ])
@@ -1585,7 +1581,7 @@ dnl Stream output
 dnl
 AC_ARG_ENABLE(sout,
   [  --enable-sout           Stream output modules (default enabled)])
-AS_IF([test "${enable_sout}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
 ])
 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
@@ -1594,8 +1590,7 @@ dnl Lua modules
 AC_ARG_ENABLE(lua,
   AS_HELP_STRING([--enable-lua],[lua playlist, metafetcher and interface
 		  plugins (default enabled)]))
-if test "${enable_lua}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([lua])], [
   PKG_CHECK_MODULES(LUA, lua5.1,
     [ have_lua=yes ],
     [
@@ -1614,7 +1609,7 @@ then
             AC_CHECK_LIB( lua , luaL_newstate,
               [LUA_LIBS="-llua"],
               [ have_lua=no
-                AS_IF([test "x${enable_lua}" = "xyes"],
+                AS_IF([VLC_FEATURE_REQUESTED([lua])], 
                   [AC_MSG_ERROR([lua >= 5.1 not found!])],
                   [AC_MSG_WARN([lua >= 5.1 not found!])])
               ], [-lm])
@@ -1628,7 +1623,7 @@ then
   else
       AC_MSG_ERROR([Could not find lua. Lua is needed for some interfaces (rc, telnet, http) as well as many other custom scripts. Use --disable-lua to ignore this error.])
   fi
-fi
+])
 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
 
 dnl
@@ -1636,25 +1631,24 @@ dnl HTTP daemon
 dnl
 AC_ARG_ENABLE(httpd,
   [  --enable-httpd          HTTP daemon (default enabled)])
-if test "${enable_httpd}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([httpd])], [
   VLC_ADD_PLUGIN([oldhttp])
   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP dameon support)
-fi
-AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
+])
+AM_CONDITIONAL(BUILD_HTTPD, [VLC_FEATURE_NOT_DISABLED([httpd])])
 
 dnl
 dnl libproxy support
 dnl
 AC_ARG_ENABLE(libproxy,
   [  --enable-libproxy       libproxy support (default auto)])
-AS_IF([test "${enable_libproxy}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([libproxy])], [
   PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, [
     AC_DEFINE(HAVE_LIBPROXY, 1, [Define if libproxy is available])
     VLC_ADD_CFLAGS([access_http],[$LIBPROXY_CFLAGS])
     VLC_ADD_LIBS([access_http],[$LIBPROXY_LIBS])
   ], [
-    AS_IF([test "x${enable_libproxy}" != "x"], [
+    AS_IF([VLC_FEATURE_REQUESTED([libproxy])], [
       AC_MSG_ERROR([libproxy could not be found on your system])
     ])
   ])
@@ -1668,7 +1662,7 @@ VLC_FEATURE_DEFAULT([vlm], ["${enable_sout}"])
 AC_ARG_ENABLE(vlm,
   [  --enable-vlm            VideoLAN manager (default enabled)])
 AS_IF([VLC_FEATURE_NOT_DISABLED([vlm])], [
-  AS_IF([test "${enable_sout}" = "no"], [
+  AS_IF([VLC_FEATURE_DISABLED([sout])], [
     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])
@@ -1702,7 +1696,7 @@ dnl
 
 AC_ARG_ENABLE(audioscrobbler,
   [  --disable-audioscrobbler Last.fm submission plugin (default enabled)])
-AS_IF([test "${enable_audioscrobbler}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([audioscrobbler])], [
         VLC_ADD_PLUGIN([audioscrobbler])
   ])
 
@@ -1711,7 +1705,7 @@ dnl Taglibplugin
 dnl
 AC_ARG_ENABLE(taglib,
   [  --disable-taglib        Taglib support (default enabled) ])
-  AS_IF([test "${enable_taglib}" != "no"],[
+  AS_IF([VLC_FEATURE_NOT_DISABLED([taglib])], [
     PKG_CHECK_MODULES(TAGLIB, taglib >= 1.5,
       [ VLC_ADD_PLUGIN([taglib])
         VLC_ADD_LIBS([taglib],[$TAGLIB_LIBS -lz])
@@ -1729,7 +1723,7 @@ dnl  live555 input
 dnl
 AC_ARG_ENABLE(live555,
 [  --enable-live555        live555 RTSP input plugin (default enabled)])
-if test "${enable_live555}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([live555])], [
   AC_ARG_WITH(live555-tree,
     [  --with-live555-tree=PATH live.com tree for static linking])
 
@@ -1837,12 +1831,12 @@ lternatively you can use --disable-live555 to disable the liveMedia plugin.])
     else
       dnl  The given live555 wasn't built
         AC_MSG_RESULT(no)
-      if test "${enable_live555}" = "yes"; then
+      AS_IF([VLC_FEATURE_REQUESTED([live555])], [
         AC_MSG_ERROR([cannot find ${real_live555_tree}/liveMedia/libliveMedia.a, make sure you compiled live555 in ${with_live555_tree}])
-      fi	
+      ])
     fi
   fi
-fi
+])
 
 dnl
 dnl - special access module for dc1394 input
@@ -1856,8 +1850,7 @@ dnl dvdread module: check for libdvdread
 dnl
 AC_ARG_ENABLE(dvdread,
 [  --enable-dvdread        dvdread input module (default enabled)])
-if test "${enable_dvdread}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([dvdread])], [
   AC_ARG_WITH(dvdread,
   [  --with-dvdread=PATH     libdvdread headers and libraries])
   AC_ARG_WITH(dvdread-tree,
@@ -1880,10 +1873,9 @@ then
             [ VLC_ADD_PLUGIN([dvdread])
 	      VLC_ADD_LIBS([dvdread],[-ldvdread ${LIBS_dvdcss}])
 	    ],[
-	      if test -n "${enable_dvdread}"
-	      then
+        AS_IF([VLC_FEATURE_REQUESTED([dvdread])], [
 	      AC_MSG_ERROR([cannot find libdvdread headers])
-	     fi
+	     ])
 	   ])
 	])
     else
@@ -1923,15 +1915,14 @@ then
       AC_MSG_ERROR([cannot find ${with_dvdread}/include/dvdread/dvd_reader.h])
     fi
   fi
-fi
+])
 
 dnl
 dnl  libdvdnav plugin
 dnl
 AC_ARG_ENABLE(dvdnav,
   [  --enable-dvdnav         dvdnav input module (default enabled)])
-if test "${enable_dvdnav}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([dvdnav])], [
   dnl Same hack than dvdread
   if test "${SYS}" = "mingw32" || test "${SYS}" = "darwin" || test "${SYS}" = "beos" ; then
       VLC_ADD_LIBS([dvdnav],[-ldvdcss])
@@ -1951,15 +1942,14 @@ then
     VLC_ADD_CFLAGS([dvdnav],[`${DVDNAV_CONFIG} --cflags`])
     VLC_ADD_LIBS([dvdnav],[`${DVDNAV_CONFIG} --libs`])
   fi
-fi
+])
 
 dnl
 dnl  Windows DirectShow access module
 dnl
 AC_ARG_ENABLE(dshow,
   [  --enable-dshow          Win32 DirectShow support (default enabled on Win32)])
-if test "${enable_dshow}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([dshow])], [
   if test "${SYS}" = "mingw32"
   then
     AC_LANG_PUSH(C++)
@@ -1969,7 +1959,7 @@ then
         VLC_ADD_LIBS([dshow],[-lole32 -loleaut32 -luuid]) ])
     AC_LANG_POP(C++)
   fi
-fi
+])
 
 dnl
 dnl  Windows DirectShow BDA access module
@@ -1977,8 +1967,7 @@ dnl
 AC_ARG_ENABLE(bda,
   AS_HELP_STRING([--enable-bda],[Win32 DirectShow BDA support (default
 		  enabled on Win32)]))
-if test "${enable_bda}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([bda])], [
   if test "${SYS}" = "mingw32"
   then
       AC_CHECK_HEADERS(dshow.h,
@@ -1986,7 +1975,7 @@ then
         VLC_ADD_CXXFLAGS([bda],[])
         VLC_ADD_LIBS([bda],[-lstrmiids -lole32 -loleaut32 -luuid]) ])
   fi
-fi
+])
 
 
 dnl
@@ -1994,8 +1983,7 @@ dnl  OpenCV wrapper and example filters
 dnl
 AC_ARG_ENABLE(opencv,
   [  --enable-opencv         OpenCV (computer vision) filter (default disabled)])
-if test "${enable_opencv}" = "yes" -a "${CXX}" != "";
-then
+AS_IF([VLC_FEATURE_ENABLED([opencv]) && test "${CXX}" != ""], [
   AC_ARG_WITH(opencv-tree,
   [  --with-opencv-tree=PATH opencv tree for linking])
     if test "${SYS}" = "mingw32"
@@ -2030,7 +2018,7 @@ then
         [AC_MSG_ERROR([libopencv not found!])]
       )
     fi
-fi
+])
 
 
 dnl
@@ -2038,14 +2026,14 @@ dnl  libsmbclient plugin
 dnl
 AC_ARG_ENABLE(smb,
   [  --enable-smb            smb input module (default enabled)])
-if test "${enable_smb}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([smb])], [
   AC_CHECK_HEADERS(libsmbclient.h,
     [ VLC_ADD_PLUGIN([access_smb])
       VLC_ADD_LIBS([access_smb],[-lsmbclient]) ],
-    [ if test -n "${enable_smb}"; then
+    [ AS_IF([VLC_FEATURE_REQUESTED([smb])], [
         AC_MSG_ERROR([cannot find libsmbclient headers])
-     fi ])
-fi
+     ]) ])
+])
 
 
 dnl
@@ -2053,12 +2041,12 @@ dnl sftp access support
 dnl
 AC_ARG_ENABLE(sftp,
   [  --enable-sftp           sftp input access module (default disable)])
-if test "${enable_sftp}" = "yes"; then
+AS_IF([VLC_FEATURE_ENABLED([sftp])], [
   AC_CHECK_HEADERS(libssh2.h, [
     VLC_ADD_PLUGIN([access_sftp])
     VLC_ADD_LIBS([access_sftp], [-lssh2])
   ])
-fi
+])
 
 dnl
 dnl  libdvbpsi ts demux/mux
@@ -2066,8 +2054,7 @@ dnl
 AC_ARG_ENABLE(dvbpsi,
   [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
 have_dvbpsi=no
-if test "${enable_dvbpsi}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([dvbpsi])], [
   AC_ARG_WITH(dvbpsi,
   [  --with-dvbpsi=PATH      libdvbpsi headers and libraries])
   AC_ARG_WITH(dvbpsi,
@@ -2078,9 +2065,9 @@ then
     then
       AC_CHECK_HEADERS(dvbpsi/dr.h,
         [ VLC_ADD_PLUGIN([ts])
-          if test "${enable_sout}" != "no"; then
+          AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
             VLC_ADD_PLUGIN([mux_ts])
-          fi
+          ])
           VLC_ADD_LIBS([mux_ts ts dvb],[-ldvbpsi])
 	  have_dvbpsi=yes],
         [  AC_MSG_WARN([cannot find libdvbpsi headers]) ],
@@ -2107,9 +2094,9 @@ then
         dnl  Use a custom libdvbpsi
         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
         VLC_ADD_PLUGIN([ts])
-        if test "${enable_sout}" != "no"; then
+        AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
           VLC_ADD_PLUGIN([mux_ts])
-        fi
+        ])
         VLC_ADD_CPPFLAGS([mux_ts ts dvb],[-I${real_dvbpsi_tree}/src])
         VLC_ADD_LIBS([mux_ts ts dvb],[${real_dvbpsi_tree}/src/.libs/libdvbpsi.a])
 	have_dvbpsi=yes
@@ -2136,18 +2123,17 @@ then
     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
     AC_CHECK_HEADERS([dvbpsi/dr.h],[
       VLC_ADD_PLUGIN([ts])
-      if test "${enable_sout}" != "no"; then
+      AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
         AC_CHECK_LIB(dvbpsi, dvbpsi_SDTServiceAddDescriptor,
            [VLC_ADD_PLUGIN([mux_ts])], [], [${LDFLAGS_test} -ldvbpsi])
-      fi
+      ])
       VLC_ADD_CPPFLAGS([mux_ts ts dvb],[${CPPFLAGS_test}])
       VLC_ADD_LIBS([mux_ts ts dvb],[${LDFLAGS_test} -ldvbpsi])
       have_dvbpsi=yes
     ],[
-      if test -n "${enable_dvbpsi}"
-      then
+      AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
         AC_MSG_ERROR([Could not find libdvbpsi on your system: you may get it from www.videolan.org, you'll need at least version 0.1.6])
-      fi
+      ])
     ],
     [#if defined( HAVE_STDINT_H )
 #   include <stdint.h>
@@ -2165,15 +2151,14 @@ then
     AC_DEFINE(HAVE_DVBPSI_SDT, 1, [Define if you have dvbpsi_GenSDTSections.])
   ], [], [${LIBS_ts}])
 
-fi
+])
 
 dnl
 dnl  Video4Linux plugin
 dnl
 AC_ARG_ENABLE(v4l,
   [  --enable-v4l            Video4Linux input support (default disabled)])
-if test "${enable_v4l}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([v4l])], [
   AC_ARG_WITH(v4l,
     [  --with-v4l=PATH         path to a v4l-enabled kernel tree],[],[])
   if test "${with_v4l}" != "no" -a -n "${with_v4l}"
@@ -2186,30 +2171,28 @@ then
     VLC_ADD_PLUGIN([v4l])
   ],[])
   CPPFLAGS="${CPPFLAGS_save}"
-fi
+])
 
 dnl
 dnl libv4l1 support for video4linux.
 dnl
 AC_ARG_ENABLE( libv4l,
   [  --enable-libv4l         Libv4l Video4Linux support (default enabled)])
-if test "${enable_libv4l}" != "no" -a "${enable_v4l}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([libv4l]) && VLC_FEATURE_NOT_DISABLED([v4l])], [
     PKG_CHECK_MODULES( LIBV4L, libv4l1, [
       VLC_ADD_LDFLAGS([v4l],[${LIBV4L_LIBS}])
       VLC_ADD_CFLAGS([v4l],[${LIBV4L_CFLAGS}])
       AC_DEFINE(HAVE_LIBV4L1, 1, Define if libv4l is available)],
       AC_MSG_WARN([LibV4L support disabled because libv4l development headers were not found])
     )
-fi
+])
 
 dnl
 dnl  Video4Linux2 plugin
 dnl
 AC_ARG_ENABLE(v4l2,
   [  --enable-v4l2           Video4Linux2 input support (default enabled)])
-if test "${enable_v4l2}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([v4l2])], [
   AC_ARG_WITH(v4l2,
     [  --with-v4l2=PATH        path to a v4l2-enabled kernel tree],[],[])
   if test "${with_v4l2}" != "no" -a -n "${with_v4l2}"
@@ -2222,30 +2205,28 @@ then
     VLC_ADD_PLUGIN([v4l2])
   ],[])
   CPPFLAGS="${CPPFLAGS_save}"
-fi
+])
 
 dnl
 dnl libv4l2 support for video4linux.
 dnl
 AC_ARG_ENABLE( libv4l2,
   [  --enable-libv4l2        Libv4l2 Video4Linux2 support (default enabled)])
-if test "${enable_libv4l2}" != "no" -a "${enable_v4l2}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([libv4l2]) && VLC_FEATURE_NOT_DISABLED([v4l2])], [
     PKG_CHECK_MODULES( LIBV4L2, libv4l2, [
       VLC_ADD_LDFLAGS([v4l2],[${LIBV4L2_LIBS}])
       VLC_ADD_CFLAGS([v4l2],[${LIBV4L2_CFLAGS}])
       AC_DEFINE(HAVE_LIBV4L2, 1, Define if libv4l2 is available)],
       AC_MSG_WARN([LibV4L2 support disabled because libv4l2 development headers were not found])
     )
-fi
+])
 
 dnl
 dnl  special access module for Hauppauge PVR cards
 dnl
 AC_ARG_ENABLE(pvr,
   [  --enable-pvr            PVR cards access module (default disabled)])
-if test "${enable_pvr}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([pvr])], [
   VLC_ADD_PLUGIN([pvr])
   AC_ARG_WITH(videodev2,
     [  --with-videodev2=FILE   Location of videodev2.h file (default /usr/include/linux/videodev2.h)],[],[])
@@ -2270,7 +2251,7 @@ then
   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
+])
 
 dnl
 dnl  gnomeVFS access module
@@ -2303,8 +2284,7 @@ AC_ARG_ENABLE(vcd,
 AC_ARG_ENABLE(libcddb,
   [  --enable-libcddb        CDDB support for libcdio audio CD (default enabled)])
 
-if test "${enable_vcd}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([vcd])], [
   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
     AC_MSG_RESULT(yes)
@@ -2343,7 +2323,7 @@ then
     VLC_ADD_LIBS([vcdx cdda],[-liconv])
   fi
 
-  if test "$enable_libcddb" != "no"; then
+  AS_IF([VLC_FEATURE_NOT_DISABLED([libcddb])], [
     PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [
       HAVE_LIBCDDB=yes
       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
@@ -2352,17 +2332,15 @@ then
       ],:
       [AC_MSG_WARN(new enough libcddb not found. CDDB access disabled)
       HAVE_LIBCDDB=no])
-  fi
-fi
+  ])
+])
 
 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 enabled)])
-
-if test "${enable_dvb}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([dvb])], [
     AS_IF([test "${have_dvbpsi}" = "yes" ],[
     AC_ARG_WITH(dvb,
      [  --with-dvb=PATH         path to a dvb- and v4l2-enabled kernel tree],[],[])
@@ -2378,14 +2356,14 @@ then
    ],[
      AC_MSG_WARN([the dvb access module requires libdvbpsi])
     ])
-fi
+])
 
 dnl
 dnl  Screen capture module
 dnl
 AC_ARG_ENABLE(screen,
   [  --enable-screen         Screen capture support (default enabled)])
-if test "${enable_screen}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([screen])], [
   if test "${SYS}" = "darwin"; then
     AC_CHECK_HEADERS(OpenGL/gl.h, [
       AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
@@ -2403,7 +2381,7 @@ if test "${enable_screen}" != "no"; then
     VLC_ADD_CXXFLAGS([screen],[])
     VLC_ADD_LIBS([screen],[-lbe])
   fi
-fi
+])
 
 dnl
 dnl  ipv6 plugin
@@ -2425,21 +2403,21 @@ dnl
 dnl  ogg demux plugin
 dnl
 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
-if test "${enable_sout}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
     PKG_ENABLE_MODULES_VLC([MUX_OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
-fi
+])
 
-if test "${enable_sout}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
 dnl Check for libshout
 PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
-fi
+])
 
 dnl
 dnl  matroska demux plugin
 dnl
 AC_ARG_ENABLE(mkv,
   [  --enable-mkv            Matroska demux support (default enabled)])
-if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([mkv]) && test "${CXX}" != ""], [
   AC_LANG_PUSH(C++)
   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
     AC_MSG_CHECKING(for libebml version >= 0.7.7)
@@ -2486,15 +2464,14 @@ if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
     ])
   ])
   AC_LANG_POP(C++)
-fi
+])
 
 dnl
 dnl  modplug demux plugin
 dnl
 AC_ARG_ENABLE(mod,
   [  --enable-mod            Mod demux support (default enabled)])
-if test "${enable_mod}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([mod])], [
   AC_ARG_WITH(mod-tree,
   [  --with-mod-tree=PATH    mod tree for static linking])
   if test -n "${with_mod_tree}"
@@ -2526,30 +2503,28 @@ then
           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
         ],[AC_MSG_WARN([libmodplug not found!])])
   fi
-fi
+])
 
 dnl
 dnl  mpc demux plugin
 dnl
 AC_ARG_ENABLE(mpc,
   [  --enable-mpc            Mpc demux support (default enabled)])
-if test "${enable_mpc}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([mpc])], [
   AC_CHECK_HEADERS([mpc/mpcdec.h], [
     VLC_ADD_PLUGIN([mpc])
     VLC_ADD_LIBS([mpc],[-lmpcdec])],
     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
     VLC_ADD_PLUGIN([mpc])
     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
-fi
+])
 
 dnl
 dnl  game music emu demux plugin
 dnl
 AC_ARG_ENABLE(gme,
   [  --enable-gme            Game Music Emu demux support (default enabled)])
-if test "${enable_gme}" != "no" -a "${CXX}" != "";
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([gme]) && test "${CXX}" != ""], [
   AC_LANG_PUSH(C++)
   AC_ARG_WITH(gme-tree,
   [  --with-gme-tree=PATH    gme tree for static linking])
@@ -2579,7 +2554,7 @@ then
       AC_MSG_WARN([only static linking is available, you must provide a gme-tree])
   fi
   AC_LANG_POP(C++)
-fi
+])
 
 dnl
 dnl  Codec plugins
@@ -2592,28 +2567,25 @@ dnl wmafixed plugin
 dnl
 AC_ARG_ENABLE(wma-fixed,
   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
-if test "${enable_wma_fixed}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([wma-fixed])], [
   VLC_ADD_PLUGIN([wma_fixed])
-fi
+])
 
 dnl
 dnl shine fixed point mp3 encoder
 dnl
 AC_ARG_ENABLE(shine,
   [  --enable-shine          shine mp3 encoding module (default disabled)])
-if test "${enable_shine}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([shine])], [
   VLC_ADD_PLUGIN([shine])
-fi
+])
 
 dnl
 dnl  mad plugin
 dnl
 AC_ARG_ENABLE(mad,
   [  --enable-mad            libmad module (default enabled)])
-if test "${enable_mad}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([mad])], [
   AC_ARG_WITH(mad,
     [  --with-mad=PATH         path to libmad],[],[])
   if test "${with_mad}" != "no" -a -n "${with_mad}"
@@ -2663,14 +2635,14 @@ then
     CPPFLAGS="${CPPFLAGS_save}"
     LDFLAGS="${LDFLAGS_save}"
   fi
-fi
+])
 
 dnl
 dnl   libid3tag support (FIXME!!! doesn't work with new input)
 dnl
 AC_ARG_ENABLE( id3tag,
 [  --disable-id3tag        id3tag metadata reader plugin (default disabled)])
-AS_IF([test "${enable_id3tag}" = "yes"], [
+AS_IF([VLC_FEATURE_ENABLED([id3tag])], [
   AC_CHECK_HEADERS(id3tag.h, [
       AS_IF([test "${have_zlib}" = "yes"],[
           VLC_ADD_LIBS([id3tag],[-lid3tag -lz])
@@ -2680,18 +2652,15 @@ AS_IF([test "${enable_id3tag}" = "yes"], [
 ])
 
 AC_ARG_ENABLE(merge-ffmpeg,
-[  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
-  enable_merge_ffmpeg="no"
-])
-AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
+[  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)])
+AM_CONDITIONAL([MERGE_FFMPEG], [AS_IF([VLC_FEATURE_ENABLED([ffmpeg])])])
 
 dnl
 dnl  avcodec decoder/encoder plugin
 dnl
 AC_ARG_ENABLE(avcodec,
 [  --enable-avcodec        libavcodec codec (default enabled)])
-if test "${enable_avcodec}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([avcodec])], [
   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 51.48.0 libavutil],
     [
       VLC_SAVE_FLAGS
@@ -2707,7 +2676,7 @@ then
     ],[
       AC_MSG_ERROR([Could not find libavcodec or libavutil. Use --disable-avcodec to ignore this error.])
   ])
-fi
+])
 
 dnl
 dnl libva needs avcodec
@@ -2715,8 +2684,8 @@ dnl
 AC_ARG_ENABLE(libva,
   [  --enable-libva          libva VAAPI support (default auto)])
 
-AS_IF([test "${enable_libva}" != "no"], [
-  AS_IF([test "x${have_avcodec}" = "xyes"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([libva])], [
+  AS_IF([VLC_FEATURE_ENABLED([avcodec])], [
     PKG_CHECK_MODULES(LIBVA, [libva libva-x11],
       [
         VLC_SAVE_FLAGS
@@ -2728,19 +2697,19 @@ AS_IF([test "${enable_libva}" != "no"], [
            AC_DEFINE(HAVE_AVCODEC_VAAPI, 1, [Define if avcodec has to be built with VAAPI support.])
            echo "VAAPI acceleration activated"
         ],[
-	AS_IF([test "${enable_libva}" == "yes"],
+	AS_IF([VLC_FEATURE_REQUESTED([libva])],
 	      [AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])],
               [AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])])
         ])
         VLC_RESTORE_FLAGS
       ],[
-	AS_IF([test "${enable_libva}" == "yes"],
+	AS_IF([VLC_FEATURE_REQUESTED([libva])],
               [AC_MSG_ERROR([Could not find required libva.])],
               [AC_MSG_WARN([libva not found  ])])
       ])
   ],[
-    AS_IF([test "x${enable_libva}" != "x"], [
-      AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive.])
+    AS_IF([VLC_FEATURE_REQUESTED([libva])], [
+      AC_MSG_ERROR([--enable-libva needs a working avcodec.])
     ])
   ])
 ])
@@ -2750,8 +2719,7 @@ dnl dxva2 needs avcodec
 dnl
 AC_ARG_ENABLE(dxva2,
   [  --enable-dxva2          DxVA2  support (default auto)])
-
-AS_IF([test "${enable_dxva2}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([dxva2])], [
   if test "${SYS}" = "mingw32"; then
   AS_IF([test "x${have_avcodec}" = "xyes"], [
     AC_CHECK_HEADERS(dxva2api.h, 
@@ -2761,18 +2729,18 @@ AS_IF([test "${enable_dxva2}" != "no"], [
            AC_DEFINE(HAVE_AVCODEC_DXVA2, 1, [Define if avcodec has to be built with DxVA2 support.])
            echo "DxVA2 acceleration activated"
         ],[
-	AS_IF([test "${enable_dxva2}" == "yes"],
+	AS_IF([VLC_FEATURE_REQUESTED([dxva2])],
 	      [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
         ])
       ],[
-	AS_IF([test "${enable_dxva2}" == "yes"],
+	AS_IF([VLC_FEATURE_REQUESTED([dxva2])],
               [AC_MSG_ERROR([Could not find required dxva2api.h])],
               [AC_MSG_WARN([dxva2api.h not found])])
       ])
   ],[
-    AS_IF([test "x${enable_dxva2}" != "x"], [
-      AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
+    AS_IF([VLC_FEATURE_REQUESTED([dxva2])], [
+      AC_MSG_ERROR([--enable-dxva2 needs a working avcodec.])
     ])
   ])
   fi
@@ -2784,7 +2752,7 @@ dnl stream_out switcher needs libavcodec
 dnl
 AC_ARG_ENABLE(switcher,
   [  --enable-switcher       Stream-out switcher plugin (default disabled)])
-AS_IF([test "${enable_switcher}" = "yes"], [
+AS_IF([VLC_FEATURE_ENABLED([switcher])], [
   AS_IF([test "x${have_avcodec}" = "xyes"], [
     VLC_ADD_PLUGIN([stream_out_switcher])
     VLC_ADD_LIBS([stream_out_switcher],[$AVCODEC_LIBS $AVUTIL_LIBS])
@@ -2800,8 +2768,7 @@ dnl
 
 AC_ARG_ENABLE(avformat,
 [  --enable-avformat       libavformat containers (default enabled)])
-if test "${enable_avformat}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([avformat])], [
   PKG_CHECK_MODULES(AVFORMAT,[libavformat libavutil],
     [
       VLC_SAVE_FLAGS
@@ -2809,7 +2776,7 @@ then
       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
       AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h)
       AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
-      AS_IF([test "$enable_merge_ffmpeg" = "no"], [
+      AS_IF([VLC_FEATURE_NOT_ENABLED([merge-ffmpeg])], [
         VLC_ADD_PLUGIN([avformat access_avio])
         VLC_ADD_LIBS([avformat access_avio],[$AVFORMAT_LIBS $AVUTIL_LIBS])
         VLC_ADD_CFLAGS([avformat access_avio],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
@@ -2821,7 +2788,7 @@ then
     ],[
       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
@@ -2830,8 +2797,7 @@ dnl
 AC_ARG_ENABLE(swscale,
   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
 		  (default enabled)]))
-if test "${enable_swscale}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([swscale])], [
   PKG_CHECK_MODULES(SWSCALE,[libswscale],
     [
       VLC_SAVE_FLAGS
@@ -2845,7 +2811,7 @@ then
     ],[
       AC_MSG_ERROR([Could not find libswscale. Use --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
   ])
-fi
+])
 
 dnl
 dnl  postproc plugin
@@ -2853,8 +2819,7 @@ dnl
 
 AC_ARG_ENABLE(postproc,
 [  --enable-postproc       libpostproc image post-processing (default enabled)])
-if test "${enable_postproc}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([postproc])], [
   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
     [
       VLC_SAVE_FLAGS
@@ -2868,7 +2833,7 @@ then
     ],[
       AC_MSG_ERROR([Could not find libpostproc. Use --disable-postproc to ignore this error.])
   ])
-fi
+])
 
 dnl
 dnl  faad decoder plugin
@@ -2927,7 +2892,7 @@ dnl  QuickTime plugin
 dnl
 AC_ARG_ENABLE(quicktime,
   [  --enable-quicktime      QuickTime module (deprecated)])
-if test "${enable_quicktime}" = "yes"; then
+AS_IF([VLC_FEATURE_ENABLED([quicktime])], [
   if test "${SYS}" = "mingw32"; then
     VLC_ADD_PLUGIN([quicktime])
   else
@@ -2936,16 +2901,16 @@ if test "${enable_quicktime}" = "yes"; then
       VLC_ADD_LDFLAGS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
   fi
-fi
+])
 
 dnl
 dnl  Real plugin
 dnl
 AC_ARG_ENABLE(real,
   [  --enable-real           Real media module (default disabled)])
-if test "${enable_real}" = "yes"; then
+AS_IF([VLC_FEATURE_ENABLED([real])], [
   VLC_ADD_PLUGIN([realvideo])
-fi
+])
 
 dnl
 dnl  Real RTSP plugin
@@ -2959,7 +2924,7 @@ AS_IF([VLC_FEATURE_ENABLED([realrtsp])], [
 AC_ARG_ENABLE(libsysfs,
   [  --enable-libsysfs       Get user key from firewire connected iPod via libsysfs (default enabled)])
 
-AS_IF([test "${enable_libsysfs}" != "no"],[
+AS_IF([VLC_FEATURE_NOT_DISABLED([libsysfs])], [
   AC_CHECK_HEADERS(sysfs/libsysfs.h, [
     VLC_ADD_LIBS([mp4 mkv],[-lsysfs])
   ] )
@@ -2971,7 +2936,7 @@ dnl
 AC_ARG_ENABLE(libtar,
   [  --enable-libtar         libtar support for skins2 (default enabled)])
 
-AS_IF([test "${enable_libtar}" != "no"],[
+AS_IF([VLC_FEATURE_NOT_DISABLED([libtar])], [
   AC_CHECK_HEADERS(libtar.h, [
     VLC_ADD_LIBS([skins2],[-ltar])
   ] )
@@ -2982,8 +2947,7 @@ dnl A52/AC3 decoder plugin
 dnl
 AC_ARG_ENABLE(a52,
   [  --enable-a52            A/52 support with liba52 (default enabled)])
-if test "${enable_a52}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([a52])], [
   AC_ARG_WITH(a52,
     [  --with-a52=PATH         a52 headers and libraries])
   AC_ARG_WITH(a52-tree,
@@ -3047,7 +3011,7 @@ then
     CPPFLAGS="${CPPFLAGS_save}"
     LDFLAGS="${LDFLAGS_save}"
   fi
-fi
+])
 
 AC_ARG_WITH(a52-fixed,
       [  --with-a52-fixed        specify if liba52 has been compiled with fixed point support],
@@ -3079,13 +3043,12 @@ dnl  Tremor plugin
 dnl
 AC_ARG_ENABLE(tremor,
   [  --enable-tremor         Tremor decoder support (default disabled)])
-if test "${enable_tremor}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([tremor])], [
   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
     VLC_ADD_PLUGIN([tremor])
     VLC_ADD_LIBS([tremor],[-lvorbisidec -logg])
    ],[])
-fi
+])
 
 dnl
 dnl  Speex plugin
@@ -3112,7 +3075,7 @@ dnl  PNG decoder module
 dnl
 AC_ARG_ENABLE(png,
   [  --enable-png            PNG support (default enabled)])
-if test "${enable_png}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([png])], [
 AC_CHECK_HEADERS(png.h, [
   LDFLAGS="${LDFLAGS_save} -lz"
   AC_CHECK_LIB(png, png_set_rows, [
@@ -3121,15 +3084,15 @@ AC_CHECK_HEADERS(png.h, [
     [],[-lz])
     LDFLAGS="${LDFLAGS_save}"
   ])
-fi
-AM_CONDITIONAL(BUILD_OSDMENU, [test "${enable_png}" != "no"])
+])
+AM_CONDITIONAL(BUILD_OSDMENU, [VLC_FEATURE_NOT_DISABLED([png])])
 
 dnl
 dnl H264 encoder plugin (using libx264)
 dnl
 AC_ARG_ENABLE(x264,
   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
-if test "${enable_x264}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([x264])], [
   AC_ARG_WITH(x264-tree,
     [  --with-x264-tree=PATH   x264 tree for static linking ],[],[])
   if test "${with_x264_tree}" != "no" -a -n "${with_x264_tree}"
@@ -3183,13 +3146,13 @@ if test "${enable_x264}" != "no"; then
           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
         fi
       ],[
-        if test "${enable_x264}" = "yes"; then
+        AS_IF([VLC_FEATURE_REQUESTED([x264])], [
             AC_MSG_ERROR([Could not find libx264 >= 0.76 on your system: you may get it from http://www.videolan.org/x264.html])
-          fi
+          ])
       ])
     LDFLAGS="${LDFLAGS_save}"
   fi
-fi
+])
 
 dnl
 dnl libfluidsynth (MIDI synthetizer) plugin
@@ -3209,7 +3172,7 @@ AC_ARG_ENABLE(telx,
   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
                   zvbi) (default enabled if zvbi is absent)]))
 
-AS_IF( [test "${enable_zvbi}" != "no"],[
+AS_IF([VLC_FEATURE_NOT_DISABLED([zvbi])], [
     PKG_CHECK_MODULES(ZVBI,
         zvbi-0.2 >= 0.2.28,
         [
@@ -3220,7 +3183,7 @@ AS_IF( [test "${enable_zvbi}" != "no"],[
           VLC_ADD_CFLAGS([zvbi],[$ZVBI_CFLAGS])
           VLC_ADD_PLUGIN([zvbi])
           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
-          AS_IF( [test "${enable_telx}" = "yes"],[
+          AS_IF([VLC_FEATURE_REQUESTED([telx])], [
                   AC_MSG_WARN([The zvbi and telx modules are uncompatibles.
                                Using zvbi.])
                   ])
@@ -3228,7 +3191,7 @@ AS_IF( [test "${enable_zvbi}" != "no"],[
           AC_MSG_WARN(ZVBI library not found. Enabling the telx module instead)
         ])
     ])
-AS_IF( [test "${enable_telx}" != "no" ],[
+AS_IF([VLC_FEATURE_NOT_DISABLED([telx])], [
   VLC_ADD_PLUGIN([telx])
   ])
 
@@ -3278,7 +3241,7 @@ dnl  kate decoder plugin
 dnl
 AC_ARG_ENABLE(kate,
 [  --enable-kate           kate codec (default enabled)])
-AS_IF([test "${enable_kate}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([kate])], [
   PKG_CHECK_MODULES(KATE,[kate >= 0.1.5], [
       VLC_ADD_PLUGIN([kate])
       VLC_ADD_CFLAGS([kate],[$KATE_CFLAGS])
@@ -3288,13 +3251,13 @@ AS_IF([test "${enable_kate}" != "no"], [
             VLC_ADD_PLUGIN([kate])
             kate_libs="-lkate -logg"
             VLC_ADD_LDFLAGS([kate],[${kate_libs}]) ],[
-            AS_IF([test "x${enable_kate}" != "x"], [
+            AS_IF([VLC_FEATURE_REQUESTED([kate])], [
               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"], [
+          AS_IF([VLC_FEATURE_REQUESTED([kate])], [
             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.])
           ])
@@ -3308,12 +3271,12 @@ dnl  tiger rendering for kate decoder plugin
 dnl
 AC_ARG_ENABLE(tiger,
 [  --enable-tiger          Tiger rendering library for Kate streams (default enabled)])
-AS_IF([test "${enable_tiger}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([tiger])], [
   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])
       VLC_ADD_CFLAGS([kate],[$TIGER_CFLAGS])
       VLC_ADD_LIBS([kate],[$TIGER_LIBS]) ],[
-        AS_IF([test "x${enable_tiger}" != "x"], [
+        AS_IF([VLC_FEATURE_REQUESTED([tiger])], [
           AC_MSG_ERROR([libtiger does not appear to be installed on your system.])
         ])
   ])
@@ -3423,12 +3386,11 @@ dnl  (enabled by default except on beos)
 dnl
 AC_ARG_ENABLE(opengl,
   [  --enable-opengl         OpenGL support (default enabled)])
-if test "${enable_opengl}" != "no" &&
-   test "${SYS}" = "darwin"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([opengl]) && test "${SYS}" = "darwin"], [
     dnl OS X special case (no GL/gl.h but OpenGL/gl.h)
     VLC_ADD_PLUGIN([opengl])
     VLC_ADD_LIBS([opengl],[-Wl,-framework,OpenGL])
-fi
+])
 
 dnl
 dnl  SDL module
@@ -3437,8 +3399,7 @@ AC_ARG_ENABLE(sdl,
   [  --enable-sdl            SDL support (default enabled)])
 AC_ARG_ENABLE(sdl-image,
   [  --enable-sdl-image      SDL image support (default enabled)])
-if test "${enable_sdl}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([sdl])], [
   SDL_PATH="${PATH}"
   AC_ARG_WITH(sdl-config-path,
     [  --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
@@ -3460,7 +3421,7 @@ then
         VLC_ADD_LIBS([vout_sdl aout_sdl sdl_image],[`${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`])
 
         # SDL_image
-        AS_IF([ test "${enable_sdl_image}" != "no"],[
+        AS_IF([VLC_FEATURE_NOT_DISABLED([sdl-image])], [
           AC_CHECK_HEADERS("SDL/SDL_image.h", [
             VLC_ADD_PLUGIN([sdl_image])
             AC_CHECK_LIB(png, png_set_rows, [VLC_ADD_LIBS([sdl_image],[-lpng -lz])],[],[-lz])
@@ -3475,13 +3436,14 @@ then
        AC_MSG_ERROR([The development package for SDL is too old. You need 1.2.10.
                     Alternatively you can also configure with --disable-sdl.])
      ])
-  else if test "${enable_sdl}" =  "yes"; then
+  else
+    AS_IF([VLC_FEATURE_REQUESTED([sdl])], [
     AC_MSG_ERROR([I could not find the SDL package. You can download libSDL
 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
     ])
-      fi
+    ])
   fi
-fi
+])
 
 dnl
 dnl  freetype module
@@ -3492,8 +3454,7 @@ AC_ARG_ENABLE(fribidi,
   [  --enable-fribidi        fribidi support (default enabled)])
 AC_ARG_ENABLE(fontconfig,
   [  --enable-fontconfig     fontconfig support (default enabled)])
-if test "${enable_freetype}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([freetype])], [
    PKG_CHECK_MODULES(FREETYPE, freetype2,[
       VLC_ADD_PLUGIN([freetype])
       have_freetype=yes
@@ -3502,34 +3463,32 @@ then
         VLC_ADD_LIBS([freetype],[-liconv -lz])
       fi
       VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
-      if test "${enable_fontconfig}" != "no"
-      then
+      AS_IF([VLC_FEATURE_NOT_DISABLED([fontconfig])], [
         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
           [VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
            VLC_ADD_LIBS([freetype],[-lfontconfig])])
         AC_CHECK_HEADERS(Carbon/Carbon.h,
           [VLC_ADD_LDFLAGS([freetype],[-Wl,-framework,Carbon])])
-      fi
+      ])
 
      dnl fribidi support
-      if test "${enable_fribidi}" != "no"
-      then
+      AS_IF([VLC_FEATURE_NOT_DISABLED([fribidi])], [
         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
           VLC_ADD_CPPFLAGS([freetype skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
           VLC_ADD_LIBS([freetype skins2], [${FRIBIDI_LIBS}])
         ])
-      fi
+      ])
 
   ],[
   have_freetype=no
-  AS_IF([ test "${enable_freetype}" =  "yes"],[
+  AS_IF([VLC_FEATURE_REQUESTED([freetype])], [
     AC_MSG_ERROR([I couldn't find the freetype package. You can download libfreetype2
 from http://www.freetype.org/, or configure with --disable-freetype. Have a nice day.
       ])
     ])
   ])
 
-fi
+])
 
 dnl
 dnl  libxml2 module
@@ -3546,19 +3505,16 @@ dnl Snapshot vout module (with cache)
 dnl
 AC_ARG_ENABLE(snapshot,
   [  --enable-snapshot       snapshot module (default disabled)])
-if test "${enable_snapshot}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([snapshot])], [
   VLC_ADD_PLUGIN([snapshot])
-fi
+])
 
 dnl
 dnl Roku HD1000 Video output module
 dnl
 AC_ARG_ENABLE(hd1000v,
   [  --enable-hd1000v        HD1000 Video Output module (default enabled on HD1000)])
-if test "${enable_hd1000v}" != "no" -a "${CXX}" != "" &&
-  (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
-   test "${enable_hd1000v}" = "yes"); then
+AS_IF([{ VLC_FEATURE_NOT_DISABLED([hd1000v]) && test "${CXX}" != "" && test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce" ;} || VLC_FEATURE_ENABLED([hd1000v])], [
   AC_LANG_PUSH([C++])
   AC_CHECK_HEADERS([cascade/graphics/CascadeScreen.h cascade/graphics/CascadeBitmap.h],
   [
@@ -3574,7 +3530,7 @@ if test "${enable_hd1000v}" != "no" -a "${CXX}" != "" &&
     VLC_ADD_LIBS([hd1000v],[-lCascade -ldvbpsi -lmad])
   fi
   AC_LANG_POP([C++])
-fi
+])
 
 dnl
 dnl  Windows DirectX module
@@ -3587,8 +3543,7 @@ fi
 
 AC_ARG_ENABLE(directx,
   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
-if test "${enable_directx}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([directx])], [
   if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
   then
       AC_CHECK_HEADERS(ddraw.h,
@@ -3606,14 +3561,14 @@ then
       ])
       VLC_ADD_LIBS([direct3d directx glwin32],[-lole32])
   fi
-fi
+])
 
 dnl
 dnl  win32 GDI plugin
 dnl
 AC_ARG_ENABLE(wingdi,
   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
-if test "${enable_wingdi}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([wingdi])], [
   if test "${SYS}" = "mingw32"; then
     VLC_ADD_PLUGIN([wingdi])
     VLC_ADD_LIBS([wingdi],[-lgdi32 -lole32])
@@ -3623,7 +3578,7 @@ if test "${enable_wingdi}" != "no"; then
     VLC_ADD_LIBS([wingdi],[-laygshell])
     VLC_ADD_LIBS([wingapi],[-laygshell])
   fi
-fi
+])
 
 
 dnl
@@ -3631,38 +3586,35 @@ dnl  Linux framebuffer module
 dnl
 AC_ARG_ENABLE(fb,
   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
-    if test "${enable_fb}" != "no"
-    then
+AS_IF([VLC_FEATURE_NOT_DISABLED([fb])], [
       AC_CHECK_HEADERS(linux/fb.h, [
         VLC_ADD_PLUGIN([fb])
       ])
-    fi
+    ])
 
 dnl
 dnl  OMAP Framebuffer module
 dnl
 AC_ARG_ENABLE(omapfb,
   [  --enable-omapfb         OMAP framebuffer support (default disabled)])
-    if test "${enable_omapfb}" = "yes"
-    then
+AS_IF([VLC_FEATURE_ENABLED([omapfb])], [
       AC_CHECK_HEADERS(asm/arch-omap/omapfb.h, [
         VLC_ADD_PLUGIN([omapfb])
         AC_CHECK_HEADERS(X11/Xlib.h, [
           VLC_ADD_LIBS([omapfb],[${X_LIBS} ${X_PRE_LIBS} -lX11]) ])
       ])
       VLC_ADD_PLUGIN([swscale_omap])
-    fi
+    ])
 
 dnl
 dnl  SVGAlib module
 dnl
 AC_ARG_ENABLE(svgalib,
   [  --enable-svgalib        SVGAlib support (default disabled)])
-if test "${enable_svgalib}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([svgalib])], [
   VLC_ADD_PLUGIN([svgalib])
   VLC_ADD_LIBS([svgalib],[-lvgagl -lvga])
-fi
+])
 
 dnl
 dnl  DirectFB module
@@ -3673,8 +3625,7 @@ AC_ARG_ENABLE(directfb,
   [  --enable-directfb       DirectFB support (default disabled)])
 AC_ARG_WITH(directfb,
   [  --with-directfb=PATH    path to DirectFB headers and libraries])
-
-if test "${enable_directfb}" = "yes"; then
+AS_IF([VLC_FEATURE_ENABLED([directfb])], [
     have_directfb="false"
     CPPFLAGS_mydirectfb=
     LIBS_mydirectfb=
@@ -3730,7 +3681,7 @@ if test "${enable_directfb}" = "yes"; then
     else
         AC_MSG_ERROR([cannot find directfb headers and/or libraries ])
     fi
-fi
+])
 
 
 
@@ -3739,8 +3690,7 @@ dnl  GGI module
 dnl
 AC_ARG_ENABLE(ggi,
   [  --enable-ggi            GGI support (default disabled)])
-if test "${enable_ggi}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([ggi])], [
   AC_CHECK_HEADER([ggi/ggi.h],[
     VLC_ADD_PLUGIN([ggi])
     VLC_ADD_LIBS([ggi],[-lggi])
@@ -3754,22 +3704,21 @@ then
     ],[
        AC_MSG_ERROR([LibGGI development files can't be found])
     ])
-fi
+])
 
 dnl
 dnl  AA plugin
 dnl
 AC_ARG_ENABLE(aa,
   [  --enable-aa             aalib output (default disabled)])
-if test "${enable_aa}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([aa])], [
   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
   if test "${have_aa}" = "true"
   then
     VLC_ADD_PLUGIN([aa])
     VLC_ADD_LIBS([aa],[-laa])
   fi
-fi
+])
 
 dnl
 dnl  libcaca plugin
@@ -3787,16 +3736,12 @@ dnl  OSS /dev/dsp module (enabled by default except on win32)
 dnl
 AC_ARG_ENABLE(oss,
   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
-
-if test "${enable_oss}" != "no" &&
-  (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
-   test "${enable_oss}" = "yes")
-then
+AS_IF([{ VLC_FEATURE_NOT_DISABLED([oss]) && test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce" ;} || VLC_FEATURE_ENABLED([oss])], [
   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
     VLC_ADD_PLUGIN([oss access_oss])
     AC_CHECK_LIB(ossaudio,main,[VLC_ADD_LIBS([oss access_oss],[-lossaudio])])
   ])
-fi
+])
 
 dnl
 dnl  Pulseaudio module
@@ -3818,7 +3763,7 @@ dnl  win32 waveOut plugin
 dnl
 AC_ARG_ENABLE(waveout,
   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
-if test "${enable_waveout}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([waveout])], [
   if test "${SYS}" = "mingw32"; then
     VLC_ADD_PLUGIN([waveout])
     VLC_ADD_LIBS([waveout],[-lwinmm])
@@ -3826,37 +3771,32 @@ if test "${enable_waveout}" != "no"; then
   if test "${SYS}" = "mingwce"; then
     VLC_ADD_PLUGIN([waveout])
   fi
-fi
+])
 
 dnl
 dnl  CoreAudio plugin
 dnl
 AC_ARG_ENABLE(macosx-audio,
   [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
-if test "x${enable_macosx_audio}" != "xno" &&
-  (test "${SYS}" = "darwin" || test "${enable_macosx_audio}" = "yes")
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([macosx-audio]) && { test "${SYS}" = "darwin" || VLC_FEATURE_ENABLED([macosx-audio]) ;}], [
   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
     [ 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
+])
 
 dnl
 dnl  Roku HD1000 audio
 dnl
 AC_ARG_ENABLE(hd1000a,
   [  --enable-hd1000a        HD1000 audio module (default enabled on HD1000)])
-if test "${enable_hd1000a}" != "no" -a "${CXX}" != "" &&
-  (test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ||
-   test "${enable_hd1000a}" = "yes")
-then
+AS_IF([{ VLC_FEATURE_NOT_DISABLED([hd1000a]) && test "${CXX}" != "" && test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce" ;} || VLC_FEATURE_ENABLED([hd1000a])], [
   AC_LANG_PUSH([C++])
   AC_CHECK_HEADERS(deschutes/libraries/hdmachinex225/PCMAudioPlayer.h, [
     VLC_ADD_PLUGIN([hd1000a])
     AC_CHECK_LIB(HDMachineX225,main,VLC_ADD_LIBS([hd1000a],[-lHDMachineX225]))  ])
   AC_LANG_POP([C++])
-fi
+])
 
 dnl
 dnl  JACK modules
@@ -3869,7 +3809,7 @@ dnl  CyberLink for C++ UPnP stack
 dnl
 AC_ARG_ENABLE(cyberlink,
   [  --enable-cyberlink      CyberLink for C++ UPnP stack (default disabled)])
-  AS_IF([test "${enable_cyberlink}" = "yes" ], [
+  AS_IF([VLC_FEATURE_ENABLED([cyberlink])], [
   AC_ARG_WITH(cyberlink-tree,
     [  --with-cyberlink-tree=PATH CyberLink for C++ tree for static linking])
 
@@ -4082,49 +4022,41 @@ dnl
 
 AC_ARG_ENABLE(macosx-vout,
   [  --enable-macosx-vout    Mac OS X video output module (default enabled on Mac OS X)])
-if test "x${enable_macosx_vout}" != "xno" &&
-  (test "${SYS}" = "darwin" || test "${enable_macosx_vout}" = "yes")
-then
+AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-vout]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-vout])], [
   VLC_ADD_LDFLAGS([vout_macosx],[-Wl,-framework,Cocoa])
   VLC_ADD_LDFLAGS([vout_macosx],[-Wl,-framework,OpenGL])
   VLC_ADD_PLUGIN([vout_macosx])
-fi
+])
 
 AC_ARG_ENABLE(macosx-dialog-provider,
   [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
-if test "x${enable_macosx_dialog_provider}" != "xno" &&
-  (test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
-then
+AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-dialog-provider]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-dialog-provider])], [
   VLC_ADD_LDFLAGS([macosx_dialog_provider],[-Wl,-framework,Cocoa])
   VLC_ADD_PLUGIN([macosx_dialog_provider])
-fi
+])
 
 AC_ARG_ENABLE(macosx-qtcapture,
   [  --enable-macosx-qtcapture Mac OS X qtcapture (iSight) module (default enabled on Mac OS X)])
-if test "x${enable_macosx_qtcapture}" != "xno" &&
-  (test "${SYS}" = "darwin" || test "${enable_macosx_qtcapture}" = "yes")
-then
+AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-qtcapture]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-qtcapture])], [
   VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,Cocoa])
   VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,QTKit])
   VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,CoreAudio])
   VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,QuartzCore])
   VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,CoreVideo])
   VLC_ADD_PLUGIN([qtcapture])
-fi
+])
 
 AC_ARG_ENABLE(macosx-eyetv,
   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
-if test "x${enable_macosx_eyetv}" != "xno" &&
-  (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
-then
+AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-eyetv]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-eyetv])], [
   VLC_ADD_LDFLAGS([access_eyetv], [-Wl,-framework,Foundation])
   VLC_ADD_PLUGIN([access_eyetv])
-fi
+])
 
 AC_ARG_ENABLE(macosx-vlc-app,
   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
-AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
-    (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
+AM_CONDITIONAL(BUILD_MACOSX_VLC_APP,
+  [{ VLC_FEATURE_NOT_DISABLED([macosx-vlc-app]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-vlc-app])])
 
 
 dnl
@@ -4167,27 +4099,25 @@ dnl  XOSD plugin
 dnl
 AC_ARG_ENABLE(xosd,
   [  --enable-xosd           xosd interface support (default disabled)])
-if test "${enable_xosd}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([xosd])], [
   AC_CHECK_HEADERS(xosd.h,
     AC_CHECK_LIB(xosd, xosd_set_horizontal_offset, [
       VLC_ADD_PLUGIN([xosd])
       VLC_ADD_LIBS([xosd],[-lxosd])
     ])
   )
-fi
+])
 
 dnl
 dnl Framebuffer (overlay) plugin
 dnl
 AC_ARG_ENABLE(fbosd,
   [  --enable-fbosd          fbosd interface support (default disabled)])
-if test "${enable_fbosd}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([fbosd])], [
   AC_CHECK_HEADERS(linux/fb.h, [
     VLC_ADD_PLUGIN([fbosd])
  ])
-fi
+])
 
 dnl
 dnl Post-interface configuration checks
@@ -4201,10 +4131,9 @@ dnl Visualisation plugin
 dnl
 AC_ARG_ENABLE(visual,
   [  --enable-visual         visualisation plugin (default enabled)])
-if test "${enable_visual}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([visual])], [
     VLC_ADD_PLUGIN([visual])
-fi
+])
 
 dnl
 dnl  goom visualization plugin
@@ -4247,15 +4176,14 @@ dnl  Lirc plugin
 dnl
 AC_ARG_ENABLE(lirc,
   [  --enable-lirc           lirc support (default disabled)])
-if test "${enable_lirc}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([lirc])], [
   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_PLUGIN([lirc])
     VLC_ADD_LIBS([lirc],[-llirc_client])
   fi
-fi
+])
 
 
 AC_ARG_WITH(,[Misc options:])
@@ -4265,7 +4193,7 @@ dnl libgcrypt
 dnl
 AC_ARG_ENABLE(libgcrypt,
   [  --disable-libgcrypt     gcrypt support (default enabled)])
-AS_IF([test "${enable_libgcrypt}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([libgcrypt])], [
   AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
     libgcrypt-config --version >/dev/null || \
         AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
@@ -4298,7 +4226,7 @@ AC_ARG_ENABLE(gnutls,
   [  --enable-gnutls         gnutls TLS/SSL support (default enabled)])
 
 AS_IF([test "${have_libgcrypt}" != "yes"], [
-  AS_IF([test "${enable_gnutls}" = "yes"], [
+  AS_IF([VLC_FEATURE_REQUESTED([gnutls])], [
     AC_MSG_ERROR([--enable-gnutls and --disable-libgcrypt are mutually exclusive.])
   ])
   VLC_FEATURE_DEFAULT_DISABLE([gnutls])
@@ -4331,7 +4259,7 @@ dnl
 AC_ARG_ENABLE(remoteosd,
   [  --disable-remoteosd     RemoteOSD plugin (default enabled)])
 
-AS_IF([test "${enable_remoteosd}" != "no"], [
+AS_IF([VLC_FEATURE_NOT_DISABLED([remoteosd])], [
   AS_IF([test "${have_libgcrypt}" = "yes"],[
     VLC_ADD_PLUGIN([remoteosd])
     VLC_ADD_LIBS([remoteosd], ${GCRYPT_LIBS})
@@ -4372,8 +4300,7 @@ dnl update checking system
 dnl
 AC_ARG_ENABLE(update-check,
   [  --enable-update-check   update checking system (default disabled)])
-if test "${enable_update_check}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([update-check])], [
   if test "${have_libgcrypt}" != "yes"
   then
     AC_MSG_ERROR([libgcrypt is required for update checking system])
@@ -4381,7 +4308,7 @@ then
   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
-fi
+])
 
 dnl
 dnl SQLite
@@ -4391,8 +4318,7 @@ AC_ARG_WITH(sqlite,
 if test "${SYS}" != "darwin"; then
   PKG_ENABLE_MODULES_VLC([SQLITE], [], [sqlite3 >= 3.6.0], [sqlite3], [auto])
 else
-  if test "${enable_sqlite}" != "no"
-  then
+  AS_IF([VLC_FEATURE_NOT_DISABLED([sqlite])], [
     AC_CHECK_HEADERS(sqlite3.h, [
         VLC_ADD_PLUGIN([sqlite])
         if test "${with_sqlite}" != "no" -a -n "${with_sqlite}"; then
@@ -4413,7 +4339,7 @@ else
         fi
         AC_DEFINE([SQLITE_MODULE], 1, [Define if you want to use SQLite module]) ],
         AC_MSG_ERROR([sqlite3 is required for sqlite module]) )
-  fi
+  ])
 fi
 AM_CONDITIONAL([HAVE_SQLITE], [test "x${have_sqlite}" = "xyes"])
 
@@ -4436,8 +4362,8 @@ loader=false
 AC_ARG_ENABLE(loader,
   AS_HELP_STRING([--enable-loader],[build DLL loader for ELF i386 platforms
 		  (default disabled)]))
-AM_CONDITIONAL(LOADER, [test "${enable_loader}" = "yes"])
-AS_IF([test "${enable_loader}" = "yes"],
+AM_CONDITIONAL(LOADER, [VLC_FEATURE_ENABLED([loader])])
+AS_IF([VLC_FEATURE_ENABLED([loader])],
   [ VLC_ADD_PLUGIN([dmo])
     VLC_ADD_CPPFLAGS([dmo quicktime realvideo],[-I\\\${top_srcdir}/libs/loader])
     VLC_ADD_LIBS([dmo quicktime realvideo],[-I\\\${top_builddir}/libs/loader/libloader.a])
@@ -4452,7 +4378,7 @@ dnl  the VLC binary
 dnl
 AC_ARG_ENABLE(vlc,
   [  --enable-vlc            build the VLC media player (default enabled)])
-AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
+AM_CONDITIONAL(BUILD_VLC, [VLC_FEATURE_NOT_DISABLED([vlc])])
 
 dnl
 dnl  Microsoft ActiveX support
@@ -4463,8 +4389,7 @@ AC_ARG_ENABLE(activex,
 		  (default enabled on Win32)]))
 AC_ARG_WITH(wine-sdk-path,
   [  --with-wine-sdk-path=PATH path to wine sdk])
-if test "${enable_activex}" != "no"
-then
+AS_IF([VLC_FEATURE_NOT_DISABLED([activex])], [
   if test "${SYS}" = "mingw32"
   then
     AC_CHECK_PROGS(MIDL, [midl], no)
@@ -4498,7 +4423,7 @@ then
     )
     AC_LANG_POP(C++)
   fi
-fi
+])
 AC_ARG_VAR(MIDL, [Microsoft IDL compiler (Win32 platform only)])
 AM_CONDITIONAL(HAS_MIDL_COMPILER, test "${MIDL}" != "no")
 AC_ARG_VAR(WIDL, [Wine IDL compiler (requires Wine SDK)])
@@ -4517,8 +4442,7 @@ AC_ARG_WITH(mozilla-sdk-path,
 AC_ARG_WITH(mozilla-pkg,
   [  --with-mozilla-pkg=PKG  look for PKG.pc to build the mozilla plugin.])
 AC_LANG_PUSH(C++)
-if test "${enable_mozilla}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([mozilla])], [
   AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"],
     [
     dnl pkg-config
@@ -4671,7 +4595,7 @@ then
     fi
     CPPFLAGS="${CPPFLAGS_save}"
  ])
-fi
+])
 AC_LANG_POP(C++)
 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
 
@@ -4680,8 +4604,7 @@ dnl  test plugins
 dnl
 AC_ARG_ENABLE(testsuite,
   [  --enable-testsuite      build test modules (default disabled)])
-if test "${enable_testsuite}" = "yes"
-then
+AS_IF([VLC_FEATURE_ENABLED([testsuite])], [
   TESTS="test1 test2 test3 test4"
 
   dnl  we define those so that bootstrap sets the right linker
@@ -4691,7 +4614,7 @@ then
   VLC_ADD_LIBS([test3],[-lobjc])
 
   VLC_ADD_PLUGIN([test1 test2 test3 test4])
-fi
+])
 
 dnl
 dnl  Plugin and builtin checks
@@ -4940,11 +4863,11 @@ AS_IF([VLC_FEATURE_ENABLED([gprof])], [printf "gprof "])
 AS_IF([VLC_FEATURE_NOT_DISABLED([optimizations])], [printf "optim "])
 AS_IF([VLC_FEATURE_ENABLED([release])], [printf "release "], [printf "devel "])
 echo ""
-if test "${enable_vlc}" != "no"; then
+AS_IF([VLC_FEATURE_NOT_DISABLED([vlc])], [
 echo "vlc aliases           :${ALIASES}"
-else
+], [
 echo "build vlc executable  : no"
-fi
+])
 echo "plugins/bindings      :${PLUGINS_BINDINGS}
 
 You can tune the compiler flags in vlc-config.
-- 
1.6.6.1


From bf0cc18fd9ecfd1d9e0a97ccd1db796435385a3a Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Thu, 28 Jan 2010 00:56:16 +0100
Subject: [PATCH 11/11] Use VLC_FEATURE_OPTION and require default values.

Bye bye negative logic.
Also provide a possibility to disable sqlite.

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
---
 configure.ac       |  717 +++++++++++++++++++++++-----------------------------
 m4/vlc_features.m4 |   45 +---
 m4/with_pkg.m4     |    3 +-
 3 files changed, 325 insertions(+), 440 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5011221..e7ee60b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -199,9 +199,9 @@ case "${host_os}" in
     VLC_ADD_LDFLAGS([avcodec avformat access_avio swscale postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress])
     VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
     VLC_ADD_LDFLAGS([libvlccore],[-Wl,-framework,CoreFoundation])
-    AC_ARG_ENABLE(macosx-defaults,
-      AS_HELP_STRING([--enable-macosx-defaults],[Build the default configuration on Mac OS X (default enabled)]))
-    AS_IF([VLC_FEATURE_NOT_DISABLED([macosx-defaults])], [
+    VLC_FEATURE_DEFAULT_ENABLE([macosx-defaults])
+    VLC_FEATURE_OPTION([macosx-defaults], [Build the default configuration on Mac OS X], [enabled on Mac OS X])
+    AS_IF([VLC_FEATURE_ENABLED([macosx-defaults])], [
         echo ""
         echo "Building with Mac OS X defaults:"
         with_macosx_version_min="10.5"
@@ -310,11 +310,13 @@ case "${host_os}" in
         dnl
         dnl DEP and ASLR options
         dnl
-        AC_ARG_ENABLE(peflags,
-          [  --enable-peflags        peflags use (default enabled on Windows)])
-        AS_IF([VLC_FEATURE_NOT_DISABLED([peflags])], [
+        VLC_FEATURE_DEFAULT_ENABLE([peflags])
+        VLC_FEATURE_OPTION([peflags], [peflags use], [enabled on Windows])
+        AS_IF([VLC_FEATURE_ENABLED([peflags])], [
           AC_CHECK_TOOL(PEFLAGS, peflags, :)
         ])
+    else
+      VLC_FEATURE_DEFAULT_DISABLE([peflags])
     fi
     if test "${SYS}" = "mingwce"; then
         # add ws2 for closesocket, select, recv
@@ -498,7 +500,7 @@ AC_PREPROC_IFELSE([
   AC_MSG_RESULT([not present])
 ], [
   AC_MSG_RESULT([found])
-  AS_IF([VLC_FEATURE_NOT_DISABLED([nls]) || VLC_FEATURE_NOT_DISABLED([mozilla])], [
+  AS_IF([VLC_FEATURE_ENABLED([nls]) || VLC_FEATURE_ENABLED([mozilla])], [
     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
 work-around for this. Check with your distribution vendor on how to update the
 glibc run-time. Alternatively, build with --disable-nls --disable-mozilla and
@@ -895,27 +897,34 @@ AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
 
 
 dnl Check for dbus
-AC_ARG_ENABLE(dbus,
-  [  --enable-dbus           Linux D-BUS message bus system (default enabled)])
-case "${SYS}" in
-    linux*|*bsd*)
-AS_IF([VLC_FEATURE_NOT_DISABLED([dbus]) && test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce"], [
+AS_CASE(
+  ["${SYS}"],
+  [linux*|*bsd*], [
+    AS_IF([test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce"], [
+      VLC_FEATURE_DEFAULT_ENABLE([dbus dbus-control telepathy])
+    ])
+  ], [
+    VLC_FEATURE_DEFAULT_DISABLE([dbus dbus-control telepathy])
+  ]
+)
+
+VLC_FEATURE_OPTION([dbus], [Linux D-BUS message bus system], [auto])
+VLC_FEATURE_OPTION([dbus-control], [D-BUS control interface], [auto])
+VLC_FEATURE_OPTION([telepathy], [Telepathy Presence plugin through DBus], [auto])
+AS_IF([VLC_FEATURE_ENABLED([dbus])], [
   dnl api stable dbus
   PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0,
     [ AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
       VLC_ADD_LIBS([libvlccore],[$DBUS_LIBS])
       VLC_ADD_CFLAGS([libvlccore],[$DBUS_CFLAGS])
       dnl Check for dbus control interface
-        AC_ARG_ENABLE(dbus-control, [  --disable-dbus-control  D-BUS control interface (default enabled)])
-        AS_IF([VLC_FEATURE_NOT_DISABLED([dbus_control])], [
+      AS_IF([VLC_FEATURE_ENABLED([dbus-control])], [
           VLC_ADD_PLUGIN([dbus])
           VLC_ADD_LIBS([dbus],[$DBUS_LIBS])
           VLC_ADD_CFLAGS([dbus],[$DBUS_CFLAGS])
         ])
       dnl Check for Telepathy
-        AC_ARG_ENABLE(telepathy,
-          AS_HELP_STRING([--enable-telepathy],[Telepathy Presence plugin through DBus(default enabled)]))
-        AS_IF([VLC_FEATURE_NOT_DISABLED([telepathy])], [
+        AS_IF([VLC_FEATURE_ENABLED([telepathy])], [
           VLC_ADD_PLUGIN([telepathy])
           VLC_ADD_LIBS([telepathy],[$DBUS_LIBS])
           VLC_ADD_CFLAGS([telepathy],[$DBUS_CFLAGS])
@@ -928,8 +937,6 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dbus]) && test "${SYS}" != "mingw32" && test "$
     [AC_MSG_ERROR([Couldn't find DBus >= 1.0.0, install libdbus-dev ?])]
   )
 ])
-;;
-esac
 
 dnl Check for ntohl, etc.
 AC_CACHE_CHECK([for ntohl in sys/param.h],
@@ -946,8 +953,7 @@ CFLAGS="${CFLAGS_save}"
 RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast write-strings missing-prototypes volatile-register-var error-implicit-function-declaration])
 RDC_PROG_CC_FLAGS([-pipe])
 
-AC_ARG_ENABLE(warnings-as-error,
-      AS_HELP_STRING([--enable-warnings-as-error],[Treat acceptable warnings as error (default disabled)]))
+VLC_FEATURE_OPTION([warnings-as-error], [Treat acceptable warnings as error], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([warnings-as-error])], [
     RDC_PROG_CC_WERRORFLAGS([unused-function unused-label unused-value unused-parameter unused-variable unused \
      missing-braces nonnull parentheses uninitialized address enum-compare undef comment switch \
@@ -979,14 +985,14 @@ AC_CACHE_CHECK([if \$CC accepts -O4],
     [ac_cv_c_o4],
     [CFLAGS="${CFLAGS_save} -O4"
      AC_TRY_COMPILE([],,ac_cv_c_o4=yes, ac_cv_c_o4=no)])
-if test "${ac_cv_c_o4}" != "no" && VLC_FEATURE_NOT_ENABLED([debug]); then
+if test "${ac_cv_c_o4}" != "no" && VLC_FEATURE_DISABLED([debug]); then
     CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O4"
 else
     AC_CACHE_CHECK([if \$CC accepts -O3],
         [ac_cv_c_o3],
         [CFLAGS="${CFLAGS_save} -O3"
          AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
-    if test "${ac_cv_c_o3}" != "no" && VLC_FEATURE_NOT_ENABLED([debug]); then
+    if test "${ac_cv_c_o3}" != "no" && VLC_FEATURE_DISABLED([debug]); then
         CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O3"
     else
         AC_CACHE_CHECK([if \$CC accepts -O2],
@@ -1105,12 +1111,8 @@ AC_CHECK_FUNCS(backtrace)
 dnl
 dnl  Enable profiling
 dnl
-VLC_FEATURE_DEFAULT_DISABLE([gprof])
-VLC_FEATURE_DEFAULT_DISABLE([cprof])
-AC_ARG_ENABLE(gprof,
-[  --enable-gprof          gprof profiling (default disabled)])
-AC_ARG_ENABLE(cprof,
-[  --enable-cprof          cprof profiling (default disabled)])
+VLC_FEATURE_OPTION([gprof], [gprof profiling], [disabled])
+VLC_FEATURE_OPTION([cprof], [cprof profiling], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([cprof])], [vlc_config_cprof="yes"], [vlc_config_cprof="no"])
 AS_IF([VLC_FEATURE_ENABLED([gprof])], [vlc_config_gprof="yes"], [vlc_config_gprof="no"])
 
@@ -1154,11 +1156,10 @@ AS_CASE(
   [i?86|x86_64], [VLC_FEATURE_DEFAULT_ENABLE([mmx])],
   [VLC_FEATURE_DEFAULT_DISABLE([mmx])]
 )
-AC_ARG_ENABLE(mmx,
-[  --disable-mmx           disable MMX optimizations (default auto)])
+VLC_FEATURE_OPTION([mmx], [enable MMX optimizations], [auto])
 have_mmx="no"
 have_mmxext="no"
-AS_IF([VLC_FEATURE_NOT_DISABLED([mmx])], [
+AS_IF([VLC_FEATURE_ENABLED([mmx])], [
   ARCH="${ARCH} mmx"
 
   AC_CACHE_CHECK([if $CC groks MMX intrinsics],
@@ -1218,10 +1219,9 @@ AS_CASE(
   [i686|x86_64], [VLC_FEATURE_DEFAULT_ENABLE([sse])],
   [VLC_FEATURE_DEFAULT_DISABLE([sse])]
 )
-AC_ARG_ENABLE(sse,
-[  --disable-sse           disable SSE (1, 2, 3 and 4) optimizations (default auto)])
+VLC_FEATURE_OPTION([sse], [enable SSE (1, 2, 3 and 4) optimizations], [auto])
 have_sse2="no"
-AS_IF([VLC_FEATURE_NOT_DISABLED([sse])], [
+AS_IF([VLC_FEATURE_ENABLED([sse])], [
   ARCH="${ARCH} sse sse2"
 
   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics],
@@ -1339,9 +1339,8 @@ AS_IF([test "x${host_cpu}" = "xarm"], [
   VLC_FEATURE_DEFAULT_DISABLE([neon])
 ])
 
-AC_ARG_ENABLE(neon,
-[  --disable-neon          disable NEON optimizations (default auto)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([neon])], [
+VLC_FEATURE_OPTION([neon], [enable NEON optimizations], [auto])
+AS_IF([VLC_FEATURE_ENABLED([neon])], [
   AC_CACHE_CHECK([if $CC groks NEON inline assembly], [ac_cv_neon_inline], [
     CFLAGS="${CFLAGS_save} -mfpu=neon"
     AC_COMPILE_IFELSE([
@@ -1365,8 +1364,7 @@ AS_IF([test "x${host_cpu}" = "xpowerpc"], [
 ], [
   VLC_FEATURE_DEFAULT_DISABLE([altivec])
 ])
-AC_ARG_ENABLE(altivec,
-[  --disable-altivec       disable AltiVec optimizations (default auto)])
+VLC_FEATURE_OPTION([altivec], [enable AltiVec optimizations], [auto])
 have_altivec="no"
 AS_IF([VLC_FEATURE_ENABLED([altivec])], [
   ARCH="${ARCH} altivec";
@@ -1508,8 +1506,7 @@ AS_IF([test "${CFLAGS_TUNING}"],
 dnl
 dnl  Memory usage
 dnl
-AC_ARG_ENABLE(optimize-memory,
-[  --enable-optimize-memory optimize memory usage over performance])
+VLC_FEATURE_OPTION([optimize-memory], [optimize memory usage over performance], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([optimize-memory])], [
   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
 ])
@@ -1517,9 +1514,8 @@ AS_IF([VLC_FEATURE_ENABLED([optimize-memory])], [
 dnl
 dnl  Enable/disable optimizations
 dnl
-AC_ARG_ENABLE(optimizations,
-[  --disable-optimizations disable compiler optimizations (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([optimizations])], [
+VLC_FEATURE_OPTION([optimizations], [disable compiler optimizations])
+AS_IF([VLC_FEATURE_ENABLED([optimizations])], [
   AS_IF([VLC_FEATURE_ENABLED([optimize-memory])], [
     vlc_config_optimizations="size"
   ], [
@@ -1532,8 +1528,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([optimizations])], [
 dnl
 dnl  Debugging mode
 dnl
-AC_ARG_ENABLE(debug,
-[  --enable-debug          debug mode (default disabled)])
+VLC_FEATURE_OPTION([debug], [debug mode], [disabled])
 AH_TEMPLATE(NDEBUG,
             [Define to 1 if debug code should NOT be compiled])
 vlc_config_debug="no"
@@ -1547,8 +1542,7 @@ AS_IF([VLC_FEATURE_ENABLED([debug])], [
 dnl
 dnl Allow runing as root (usefull for people runing on embedded platforms)
 dnl
-AC_ARG_ENABLE(run-as-root,
-[  --enable-run-as-root    allow runing VLC as root (default disabled)])
+VLC_FEATURE_OPTION([run-as-root], [allow running VLC as root], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([run-as-root])], [
     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
               [Define to 1 to allow runing VLC as root (uid 0).])
@@ -1557,8 +1551,7 @@ AS_IF([VLC_FEATURE_ENABLED([run-as-root])], [
 dnl
 dnl  Test coverage
 dnl
-AC_ARG_ENABLE(coverage,
-	[  --enable-coverage       build for test coverage (default disabled)])
+VLC_FEATURE_OPTION([coverage], [build for test coverage], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([coverage])], [
 	CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
 	CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
@@ -1572,25 +1565,21 @@ AS_IF([VLC_FEATURE_ENABLED([coverage])], [
 dnl
 dnl  Enable release-specific flags
 dnl
-AC_ARG_ENABLE(release,
-[  --enable-release        activate extra optimizations (default disabled)])
+VLC_FEATURE_OPTION([release], [activate extra optimizations], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([release])], [vlc_config_release="yes"], [vlc_config_release="no"])
 
 dnl
 dnl Stream output
 dnl
-AC_ARG_ENABLE(sout,
-  [  --enable-sout           Stream output modules (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
+VLC_FEATURE_OPTION([sout], [Stream output modules])
+AS_IF([VLC_FEATURE_ENABLED([sout])], [
   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
 ])
-AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
+AM_CONDITIONAL(ENABLE_SOUT, [VLC_FEATURE_ENABLED([sout])])
 
 dnl Lua modules
-AC_ARG_ENABLE(lua,
-  AS_HELP_STRING([--enable-lua],[lua playlist, metafetcher and interface
-		  plugins (default enabled)]))
-AS_IF([VLC_FEATURE_NOT_DISABLED([lua])], [
+VLC_FEATURE_OPTION([lua], [lua playlist, metafetcher and interface])
+AS_IF([VLC_FEATURE_ENABLED([lua])], [
   PKG_CHECK_MODULES(LUA, lua5.1,
     [ have_lua=yes ],
     [
@@ -1629,20 +1618,18 @@ AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
 dnl
 dnl HTTP daemon
 dnl
-AC_ARG_ENABLE(httpd,
-  [  --enable-httpd          HTTP daemon (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([httpd])], [
+VLC_FEATURE_OPTION([httpd], [HTTP daemon])
+AS_IF([VLC_FEATURE_ENABLED([httpd])], [
   VLC_ADD_PLUGIN([oldhttp])
   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP dameon support)
 ])
-AM_CONDITIONAL(BUILD_HTTPD, [VLC_FEATURE_NOT_DISABLED([httpd])])
+AM_CONDITIONAL(BUILD_HTTPD, [VLC_FEATURE_ENABLED([httpd])])
 
 dnl
 dnl libproxy support
 dnl
-AC_ARG_ENABLE(libproxy,
-  [  --enable-libproxy       libproxy support (default auto)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([libproxy])], [
+VLC_FEATURE_OPTION([libproxy], [libproxy support])
+AS_IF([VLC_FEATURE_ENABLED([libproxy])], [
   PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, [
     AC_DEFINE(HAVE_LIBPROXY, 1, [Define if libproxy is available])
     VLC_ADD_CFLAGS([access_http],[$LIBPROXY_CFLAGS])
@@ -1658,23 +1645,25 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([libproxy])], [
 dnl
 dnl VideoLAN manager
 dnl
-VLC_FEATURE_DEFAULT([vlm], ["${enable_sout}"])
-AC_ARG_ENABLE(vlm,
-  [  --enable-vlm            VideoLAN manager (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([vlm])], [
-  AS_IF([VLC_FEATURE_DISABLED([sout])], [
+AS_IF([VLC_FEATURE_REQUESTED([sout])], [
+  VLC_FEATURE_DEFAULT_ENABLE([vlm])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([vlm])
+])
+VLC_FEATURE_OPTION([vlm], [VideoLAN manager], [enabled if you have Stream output modules])
+AS_IF([VLC_FEATURE_ENABLED([vlm])], [
+  AS_IF([VLC_FEATURE_REMOVED([sout])], [
     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([oldtelnet])
 ])
-AM_CONDITIONAL([ENABLE_VLM], [VLC_FEATURE_NOT_DISABLED([vlm])])
+AM_CONDITIONAL([ENABLE_VLM], [VLC_FEATURE_ENABLED([vlm])])
 
 dnl
 dnl Growl notification plugin
 dnl
-AC_ARG_ENABLE(growl,
-  [  --enable-growl          growl notification plugin (default disabled)])
+VLC_FEATURE_OPTION([growl], [growl notification plugin], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([growl])], [
     VLC_ADD_PLUGIN([growl_udp])
     AC_CHECK_HEADERS(Growl/GrowlDefines.h, [
@@ -1694,18 +1683,16 @@ dnl
 dnl Audioscrobbler plugin
 dnl
 
-AC_ARG_ENABLE(audioscrobbler,
-  [  --disable-audioscrobbler Last.fm submission plugin (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([audioscrobbler])], [
+VLC_FEATURE_OPTION([audioscrobbler], [Last.fm submission plugin])
+AS_IF([VLC_FEATURE_ENABLED([audioscrobbler])], [
         VLC_ADD_PLUGIN([audioscrobbler])
   ])
 
 dnl
 dnl Taglibplugin
 dnl
-AC_ARG_ENABLE(taglib,
-  [  --disable-taglib        Taglib support (default enabled) ])
-  AS_IF([VLC_FEATURE_NOT_DISABLED([taglib])], [
+VLC_FEATURE_OPTION([taglib], [Taglib support])
+  AS_IF([VLC_FEATURE_ENABLED([taglib])], [
     PKG_CHECK_MODULES(TAGLIB, taglib >= 1.5,
       [ VLC_ADD_PLUGIN([taglib])
         VLC_ADD_LIBS([taglib],[$TAGLIB_LIBS -lz])
@@ -1721,9 +1708,8 @@ AC_ARG_WITH(,[Input plugins:])
 
 dnl  live555 input
 dnl
-AC_ARG_ENABLE(live555,
-[  --enable-live555        live555 RTSP input plugin (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([live555])], [
+VLC_FEATURE_OPTION([live555], [live555 RTSP input plugin])
+AS_IF([VLC_FEATURE_ENABLED([live555])], [
   AC_ARG_WITH(live555-tree,
     [  --with-live555-tree=PATH live.com tree for static linking])
 
@@ -1848,9 +1834,8 @@ PKG_ENABLE_MODULES_VLC([DV], [access_dv], [libraw1394 >= 2.0.1 libavc1394 >= 0.5
 dnl
 dnl dvdread module: check for libdvdread
 dnl
-AC_ARG_ENABLE(dvdread,
-[  --enable-dvdread        dvdread input module (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([dvdread])], [
+VLC_FEATURE_OPTION([dvdread], [dvdread input module])
+AS_IF([VLC_FEATURE_ENABLED([dvdread])], [
   AC_ARG_WITH(dvdread,
   [  --with-dvdread=PATH     libdvdread headers and libraries])
   AC_ARG_WITH(dvdread-tree,
@@ -1920,9 +1905,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dvdread])], [
 dnl
 dnl  libdvdnav plugin
 dnl
-AC_ARG_ENABLE(dvdnav,
-  [  --enable-dvdnav         dvdnav input module (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([dvdnav])], [
+VLC_FEATURE_OPTION([dvdnav], [dvdnav input module])
+AS_IF([VLC_FEATURE_ENABLED([dvdnav])], [
   dnl Same hack than dvdread
   if test "${SYS}" = "mingw32" || test "${SYS}" = "darwin" || test "${SYS}" = "beos" ; then
       VLC_ADD_LIBS([dvdnav],[-ldvdcss])
@@ -1945,44 +1929,37 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dvdnav])], [
 ])
 
 dnl
-dnl  Windows DirectShow access module
+dnl  Windows DirectShow and DirectShow BDA access module
 dnl
-AC_ARG_ENABLE(dshow,
-  [  --enable-dshow          Win32 DirectShow support (default enabled on Win32)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([dshow])], [
-  if test "${SYS}" = "mingw32"
-  then
+AS_IF([test "${SYS}" = "mingw32"], [
+  VLC_FEATURE_DEFAULT_ENABLE([dshow bda])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([dshow bda])
+])
+VLC_FEATURE_OPTION([dshow], [Win32 DirectShow support], [enabled on Win32])
+VLC_FEATURE_OPTION([bda], [Win32 DirectShow BDA support], [enabled on Win32])
+
+AS_IF([VLC_FEATURE_ENABLED([dshow]) && test "${SYS}" = "mingw32"], [
     AC_LANG_PUSH(C++)
       AC_CHECK_HEADERS(dshow.h,
       [ VLC_ADD_PLUGIN([dshow])
         VLC_ADD_CXXFLAGS([dshow],[])
         VLC_ADD_LIBS([dshow],[-lole32 -loleaut32 -luuid]) ])
     AC_LANG_POP(C++)
-  fi
 ])
 
-dnl
-dnl  Windows DirectShow BDA access module
-dnl
-AC_ARG_ENABLE(bda,
-  AS_HELP_STRING([--enable-bda],[Win32 DirectShow BDA support (default
-		  enabled on Win32)]))
-AS_IF([VLC_FEATURE_NOT_DISABLED([bda])], [
-  if test "${SYS}" = "mingw32"
-  then
+AS_IF([VLC_FEATURE_ENABLED([bda]) && test "${SYS}" = "mingw32"], [
       AC_CHECK_HEADERS(dshow.h,
       [ VLC_ADD_PLUGIN([bda])
         VLC_ADD_CXXFLAGS([bda],[])
         VLC_ADD_LIBS([bda],[-lstrmiids -lole32 -loleaut32 -luuid]) ])
-  fi
 ])
 
 
 dnl
 dnl  OpenCV wrapper and example filters
 dnl
-AC_ARG_ENABLE(opencv,
-  [  --enable-opencv         OpenCV (computer vision) filter (default disabled)])
+VLC_FEATURE_OPTION([opencv], [OpenCV (computer vision) filter], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([opencv]) && test "${CXX}" != ""], [
   AC_ARG_WITH(opencv-tree,
   [  --with-opencv-tree=PATH opencv tree for linking])
@@ -2024,9 +2001,8 @@ AS_IF([VLC_FEATURE_ENABLED([opencv]) && test "${CXX}" != ""], [
 dnl
 dnl  libsmbclient plugin
 dnl
-AC_ARG_ENABLE(smb,
-  [  --enable-smb            smb input module (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([smb])], [
+VLC_FEATURE_OPTION([smb], [smb input module])
+AS_IF([VLC_FEATURE_ENABLED([smb])], [
   AC_CHECK_HEADERS(libsmbclient.h,
     [ VLC_ADD_PLUGIN([access_smb])
       VLC_ADD_LIBS([access_smb],[-lsmbclient]) ],
@@ -2039,8 +2015,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([smb])], [
 dnl
 dnl sftp access support
 dnl
-AC_ARG_ENABLE(sftp,
-  [  --enable-sftp           sftp input access module (default disable)])
+VLC_FEATURE_OPTION([sftp], [sftp input access module], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([sftp])], [
   AC_CHECK_HEADERS(libssh2.h, [
     VLC_ADD_PLUGIN([access_sftp])
@@ -2051,10 +2026,9 @@ AS_IF([VLC_FEATURE_ENABLED([sftp])], [
 dnl
 dnl  libdvbpsi ts demux/mux
 dnl
-AC_ARG_ENABLE(dvbpsi,
-  [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
+VLC_FEATURE_OPTION([dvbpsi], [dvbpsi ts mux and demux module])
 have_dvbpsi=no
-AS_IF([VLC_FEATURE_NOT_DISABLED([dvbpsi])], [
+AS_IF([VLC_FEATURE_ENABLED([dvbpsi])], [
   AC_ARG_WITH(dvbpsi,
   [  --with-dvbpsi=PATH      libdvbpsi headers and libraries])
   AC_ARG_WITH(dvbpsi,
@@ -2065,7 +2039,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dvbpsi])], [
     then
       AC_CHECK_HEADERS(dvbpsi/dr.h,
         [ VLC_ADD_PLUGIN([ts])
-          AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
+          AS_IF([VLC_FEATURE_ENABLED([sout])], [
             VLC_ADD_PLUGIN([mux_ts])
           ])
           VLC_ADD_LIBS([mux_ts ts dvb],[-ldvbpsi])
@@ -2094,7 +2068,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dvbpsi])], [
         dnl  Use a custom libdvbpsi
         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
         VLC_ADD_PLUGIN([ts])
-        AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
+        AS_IF([VLC_FEATURE_ENABLED([sout])], [
           VLC_ADD_PLUGIN([mux_ts])
         ])
         VLC_ADD_CPPFLAGS([mux_ts ts dvb],[-I${real_dvbpsi_tree}/src])
@@ -2123,7 +2097,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dvbpsi])], [
     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
     AC_CHECK_HEADERS([dvbpsi/dr.h],[
       VLC_ADD_PLUGIN([ts])
-      AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
+      AS_IF([VLC_FEATURE_ENABLED([sout])], [
         AC_CHECK_LIB(dvbpsi, dvbpsi_SDTServiceAddDescriptor,
            [VLC_ADD_PLUGIN([mux_ts])], [], [${LDFLAGS_test} -ldvbpsi])
       ])
@@ -2131,7 +2105,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dvbpsi])], [
       VLC_ADD_LIBS([mux_ts ts dvb],[${LDFLAGS_test} -ldvbpsi])
       have_dvbpsi=yes
     ],[
-      AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
+      AS_IF([VLC_FEATURE_ENABLED([sout])], [
         AC_MSG_ERROR([Could not find libdvbpsi on your system: you may get it from www.videolan.org, you'll need at least version 0.1.6])
       ])
     ],
@@ -2156,8 +2130,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dvbpsi])], [
 dnl
 dnl  Video4Linux plugin
 dnl
-AC_ARG_ENABLE(v4l,
-  [  --enable-v4l            Video4Linux input support (default disabled)])
+VLC_FEATURE_OPTION([v4l], [Video4Linux input support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([v4l])], [
   AC_ARG_WITH(v4l,
     [  --with-v4l=PATH         path to a v4l-enabled kernel tree],[],[])
@@ -2176,9 +2149,8 @@ AS_IF([VLC_FEATURE_ENABLED([v4l])], [
 dnl
 dnl libv4l1 support for video4linux.
 dnl
-AC_ARG_ENABLE( libv4l,
-  [  --enable-libv4l         Libv4l Video4Linux support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([libv4l]) && VLC_FEATURE_NOT_DISABLED([v4l])], [
+VLC_FEATURE_OPTION([libv4l], [Libv4l Video4Linux support])
+AS_IF([VLC_FEATURE_ENABLED([libv4l]) && VLC_FEATURE_ENABLED([v4l])], [
     PKG_CHECK_MODULES( LIBV4L, libv4l1, [
       VLC_ADD_LDFLAGS([v4l],[${LIBV4L_LIBS}])
       VLC_ADD_CFLAGS([v4l],[${LIBV4L_CFLAGS}])
@@ -2190,9 +2162,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([libv4l]) && VLC_FEATURE_NOT_DISABLED([v4l])], [
 dnl
 dnl  Video4Linux2 plugin
 dnl
-AC_ARG_ENABLE(v4l2,
-  [  --enable-v4l2           Video4Linux2 input support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([v4l2])], [
+VLC_FEATURE_OPTION([v4l2], [Video4Linux2 input support])
+AS_IF([VLC_FEATURE_ENABLED([v4l2])], [
   AC_ARG_WITH(v4l2,
     [  --with-v4l2=PATH        path to a v4l2-enabled kernel tree],[],[])
   if test "${with_v4l2}" != "no" -a -n "${with_v4l2}"
@@ -2210,9 +2181,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([v4l2])], [
 dnl
 dnl libv4l2 support for video4linux.
 dnl
-AC_ARG_ENABLE( libv4l2,
-  [  --enable-libv4l2        Libv4l2 Video4Linux2 support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([libv4l2]) && VLC_FEATURE_NOT_DISABLED([v4l2])], [
+VLC_FEATURE_OPTION([libv4l2], [Libv4l2 Video4Linux2 support])
+AS_IF([VLC_FEATURE_ENABLED([libv4l2]) && VLC_FEATURE_ENABLED([v4l2])], [
     PKG_CHECK_MODULES( LIBV4L2, libv4l2, [
       VLC_ADD_LDFLAGS([v4l2],[${LIBV4L2_LIBS}])
       VLC_ADD_CFLAGS([v4l2],[${LIBV4L2_CFLAGS}])
@@ -2224,8 +2194,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([libv4l2]) && VLC_FEATURE_NOT_DISABLED([v4l2])],
 dnl
 dnl  special access module for Hauppauge PVR cards
 dnl
-AC_ARG_ENABLE(pvr,
-  [  --enable-pvr            PVR cards access module (default disabled)])
+VLC_FEATURE_OPTION([pvr], [PVR cards access module], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([pvr])], [
   VLC_ADD_PLUGIN([pvr])
   AC_ARG_WITH(videodev2,
@@ -2261,8 +2230,7 @@ PKG_ENABLE_MODULES_VLC([GNOMEVFS], [access_gnomevfs], [gnome-vfs-2.0], [GnomeVFS
 dnl
 dnl  VCDX modules
 dnl
-AC_ARG_ENABLE(vcdx,
-  [  --enable-vcdx           VCD with navigation via libvcdinfo (default disabled)])
+VLC_FEATURE_OPTION([vcdx], [VCD with navigation via libvcdinfo], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([vcdx])], [
 	PKG_CHECK_MODULES(LIBCDIO, [libcdio >= 0.78.2 libiso9660 >= 0.72],
 	  [VLC_ADD_LIBS([vcdx],[$LIBCDIO_LIBS])
@@ -2278,13 +2246,9 @@ AS_IF([VLC_FEATURE_ENABLED([vcdx])], [
 dnl
 dnl  Built-in CD-DA and VCD module
 dnl
-AC_ARG_ENABLE(vcd,
-  [  --enable-vcd            built-in VCD and CD-DA (default enabled)])
-
-AC_ARG_ENABLE(libcddb,
-  [  --enable-libcddb        CDDB support for libcdio audio CD (default enabled)])
-
-AS_IF([VLC_FEATURE_NOT_DISABLED([vcd])], [
+VLC_FEATURE_OPTION([vcd], [built-in VCD and CD-DA])
+VLC_FEATURE_OPTION([libcddb], [CDDB support for libcdio audio CD])
+AS_IF([VLC_FEATURE_ENABLED([vcd])], [
   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
     AC_MSG_RESULT(yes)
@@ -2323,7 +2287,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([vcd])], [
     VLC_ADD_LIBS([vcdx cdda],[-liconv])
   fi
 
-  AS_IF([VLC_FEATURE_NOT_DISABLED([libcddb])], [
+  AS_IF([VLC_FEATURE_ENABLED([libcddb])], [
     PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [
       HAVE_LIBCDDB=yes
       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
@@ -2338,9 +2302,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([vcd])], [
 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 enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([dvb])], [
+VLC_FEATURE_OPTION([dvb], [DVB-S/T/C card support])
+AS_IF([VLC_FEATURE_ENABLED([dvb])], [
     AS_IF([test "${have_dvbpsi}" = "yes" ],[
     AC_ARG_WITH(dvb,
      [  --with-dvb=PATH         path to a dvb- and v4l2-enabled kernel tree],[],[])
@@ -2361,9 +2324,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dvb])], [
 dnl
 dnl  Screen capture module
 dnl
-AC_ARG_ENABLE(screen,
-  [  --enable-screen         Screen capture support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([screen])], [
+VLC_FEATURE_OPTION([screen], [Screen capture support])
+AS_IF([VLC_FEATURE_ENABLED([screen])], [
   if test "${SYS}" = "darwin"; then
     AC_CHECK_HEADERS(OpenGL/gl.h, [
       AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
@@ -2403,11 +2365,11 @@ dnl
 dnl  ogg demux plugin
 dnl
 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
-AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
+AS_IF([VLC_FEATURE_ENABLED([sout])], [
     PKG_ENABLE_MODULES_VLC([MUX_OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
 ])
 
-AS_IF([VLC_FEATURE_NOT_DISABLED([sout])], [
+AS_IF([VLC_FEATURE_ENABLED([sout])], [
 dnl Check for libshout
 PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
 ])
@@ -2415,9 +2377,8 @@ PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout
 dnl
 dnl  matroska demux plugin
 dnl
-AC_ARG_ENABLE(mkv,
-  [  --enable-mkv            Matroska demux support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([mkv]) && test "${CXX}" != ""], [
+VLC_FEATURE_OPTION([mkv], [Matroska demux support])
+AS_IF([VLC_FEATURE_ENABLED([mkv]) && test "${CXX}" != ""], [
   AC_LANG_PUSH(C++)
   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
     AC_MSG_CHECKING(for libebml version >= 0.7.7)
@@ -2469,9 +2430,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([mkv]) && test "${CXX}" != ""], [
 dnl
 dnl  modplug demux plugin
 dnl
-AC_ARG_ENABLE(mod,
-  [  --enable-mod            Mod demux support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([mod])], [
+VLC_FEATURE_OPTION([mod], [Mod demux support])
+AS_IF([VLC_FEATURE_ENABLED([mod])], [
   AC_ARG_WITH(mod-tree,
   [  --with-mod-tree=PATH    mod tree for static linking])
   if test -n "${with_mod_tree}"
@@ -2508,9 +2468,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([mod])], [
 dnl
 dnl  mpc demux plugin
 dnl
-AC_ARG_ENABLE(mpc,
-  [  --enable-mpc            Mpc demux support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([mpc])], [
+VLC_FEATURE_OPTION([mpc], [Mpc demux support])
+AS_IF([VLC_FEATURE_ENABLED([mpc])], [
   AC_CHECK_HEADERS([mpc/mpcdec.h], [
     VLC_ADD_PLUGIN([mpc])
     VLC_ADD_LIBS([mpc],[-lmpcdec])],
@@ -2522,9 +2481,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([mpc])], [
 dnl
 dnl  game music emu demux plugin
 dnl
-AC_ARG_ENABLE(gme,
-  [  --enable-gme            Game Music Emu demux support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([gme]) && test "${CXX}" != ""], [
+VLC_FEATURE_OPTION([gme], [Game Music Emu demux support])
+AS_IF([VLC_FEATURE_ENABLED([gme]) && test "${CXX}" != ""], [
   AC_LANG_PUSH(C++)
   AC_ARG_WITH(gme-tree,
   [  --with-gme-tree=PATH    gme tree for static linking])
@@ -2565,8 +2523,7 @@ AC_ARG_WITH(,[Codec plugins:])
 dnl
 dnl wmafixed plugin
 dnl
-AC_ARG_ENABLE(wma-fixed,
-  [  --enable-wma-fixed      libwma-fixed module (default disabled)])
+VLC_FEATURE_OPTION([wma-fixed], [libwma-fixed module], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([wma-fixed])], [
   VLC_ADD_PLUGIN([wma_fixed])
 ])
@@ -2574,8 +2531,7 @@ AS_IF([VLC_FEATURE_ENABLED([wma-fixed])], [
 dnl
 dnl shine fixed point mp3 encoder
 dnl
-AC_ARG_ENABLE(shine,
-  [  --enable-shine          shine mp3 encoding module (default disabled)])
+VLC_FEATURE_OPTION([shine], [shine mp3 encoding module], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([shine])], [
   VLC_ADD_PLUGIN([shine])
 ])
@@ -2583,9 +2539,8 @@ AS_IF([VLC_FEATURE_ENABLED([shine])], [
 dnl
 dnl  mad plugin
 dnl
-AC_ARG_ENABLE(mad,
-  [  --enable-mad            libmad module (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([mad])], [
+VLC_FEATURE_OPTION([mad], [libmad module])
+AS_IF([VLC_FEATURE_ENABLED([mad])], [
   AC_ARG_WITH(mad,
     [  --with-mad=PATH         path to libmad],[],[])
   if test "${with_mad}" != "no" -a -n "${with_mad}"
@@ -2640,8 +2595,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([mad])], [
 dnl
 dnl   libid3tag support (FIXME!!! doesn't work with new input)
 dnl
-AC_ARG_ENABLE( id3tag,
-[  --disable-id3tag        id3tag metadata reader plugin (default disabled)])
+VLC_FEATURE_OPTION([id3tag], [id3tag metadata reader plugin], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([id3tag])], [
   AC_CHECK_HEADERS(id3tag.h, [
       AS_IF([test "${have_zlib}" = "yes"],[
@@ -2651,16 +2605,14 @@ AS_IF([VLC_FEATURE_ENABLED([id3tag])], [
     ])
 ])
 
-AC_ARG_ENABLE(merge-ffmpeg,
-[  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)])
+VLC_FEATURE_OPTION([merge-ffmpeg], [merge FFmpeg-based plugins], [disabled])
 AM_CONDITIONAL([MERGE_FFMPEG], [AS_IF([VLC_FEATURE_ENABLED([ffmpeg])])])
 
 dnl
 dnl  avcodec decoder/encoder plugin
 dnl
-AC_ARG_ENABLE(avcodec,
-[  --enable-avcodec        libavcodec codec (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([avcodec])], [
+VLC_FEATURE_OPTION([avcodec], [libavcodec codec])
+AS_IF([VLC_FEATURE_ENABLED([avcodec])], [
   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 51.48.0 libavutil],
     [
       VLC_SAVE_FLAGS
@@ -2681,10 +2633,9 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([avcodec])], [
 dnl
 dnl libva needs avcodec
 dnl
-AC_ARG_ENABLE(libva,
-  [  --enable-libva          libva VAAPI support (default auto)])
-
-AS_IF([VLC_FEATURE_NOT_DISABLED([libva])], [
+VLC_FEATURE_DEFAULT_ENABLE([libva])
+VLC_FEATURE_OPTION([libva], [libva VAAPI support])
+AS_IF([VLC_FEATURE_ENABLED([libva])], [
   AS_IF([VLC_FEATURE_ENABLED([avcodec])], [
     PKG_CHECK_MODULES(LIBVA, [libva libva-x11],
       [
@@ -2717,10 +2668,9 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([libva])], [
 dnl
 dnl dxva2 needs avcodec
 dnl
-AC_ARG_ENABLE(dxva2,
-  [  --enable-dxva2          DxVA2  support (default auto)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([dxva2])], [
-  if test "${SYS}" = "mingw32"; then
+VLC_FEATURE_DEFAULT_ENABLE([dxva2])
+VLC_FEATURE_OPTION([dxva2], [DxVA2 support], [auto])
+AS_IF([VLC_FEATURE_ENABLED([dxva2]) && test "${SYS}" = "mingw32"], [
   AS_IF([test "x${have_avcodec}" = "xyes"], [
     AC_CHECK_HEADERS(dxva2api.h, 
       [
@@ -2743,15 +2693,13 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([dxva2])], [
       AC_MSG_ERROR([--enable-dxva2 needs a working avcodec.])
     ])
   ])
-  fi
 ])
 
 
 dnl
 dnl stream_out switcher needs libavcodec
 dnl
-AC_ARG_ENABLE(switcher,
-  [  --enable-switcher       Stream-out switcher plugin (default disabled)])
+VLC_FEATURE_OPTION([switcher], [Stream-out switcher plugin], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([switcher])], [
   AS_IF([test "x${have_avcodec}" = "xyes"], [
     VLC_ADD_PLUGIN([stream_out_switcher])
@@ -2765,10 +2713,8 @@ AS_IF([VLC_FEATURE_ENABLED([switcher])], [
 dnl
 dnl  avformat demuxer/muxer plugin
 dnl
-
-AC_ARG_ENABLE(avformat,
-[  --enable-avformat       libavformat containers (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([avformat])], [
+VLC_FEATURE_OPTION([avformat], [libavformat containers])
+AS_IF([VLC_FEATURE_ENABLED([avformat])], [
   PKG_CHECK_MODULES(AVFORMAT,[libavformat libavutil],
     [
       VLC_SAVE_FLAGS
@@ -2776,7 +2722,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([avformat])], [
       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
       AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h)
       AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
-      AS_IF([VLC_FEATURE_NOT_ENABLED([merge-ffmpeg])], [
+      AS_IF([VLC_FEATURE_DISABLED([merge-ffmpeg])], [
         VLC_ADD_PLUGIN([avformat access_avio])
         VLC_ADD_LIBS([avformat access_avio],[$AVFORMAT_LIBS $AVUTIL_LIBS])
         VLC_ADD_CFLAGS([avformat access_avio],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
@@ -2793,11 +2739,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([avformat])], [
 dnl
 dnl  swscale image scaling and conversion plugin
 dnl
-
-AC_ARG_ENABLE(swscale,
-  AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
-		  (default enabled)]))
-AS_IF([VLC_FEATURE_NOT_DISABLED([swscale])], [
+VLC_FEATURE_OPTION([swscale], [libswscale image scaling and conversion])
+AS_IF([VLC_FEATURE_ENABLED([swscale])], [
   PKG_CHECK_MODULES(SWSCALE,[libswscale],
     [
       VLC_SAVE_FLAGS
@@ -2816,10 +2759,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([swscale])], [
 dnl
 dnl  postproc plugin
 dnl
-
-AC_ARG_ENABLE(postproc,
-[  --enable-postproc       libpostproc image post-processing (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([postproc])], [
+VLC_FEATURE_OPTION([postproc], [libpostproc image post-processing])
+AS_IF([VLC_FEATURE_ENABLED([postproc])], [
   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
     [
       VLC_SAVE_FLAGS
@@ -2838,8 +2779,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([postproc])], [
 dnl
 dnl  faad decoder plugin
 dnl
-AC_ARG_ENABLE(faad,
-[  --enable-faad           faad codec (default disabled)])
+VLC_FEATURE_OPTION([faad], [faad codec], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([faad])], [
   AC_ARG_WITH(faad-tree,
   [  --with-faad-tree=PATH   faad tree for static linking])
@@ -2890,8 +2830,7 @@ PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [
 dnl
 dnl  QuickTime plugin
 dnl
-AC_ARG_ENABLE(quicktime,
-  [  --enable-quicktime      QuickTime module (deprecated)])
+VLC_FEATURE_OPTION([quicktime], [QuickTime module (deprecated)], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([quicktime])], [
   if test "${SYS}" = "mingw32"; then
     VLC_ADD_PLUGIN([quicktime])
@@ -2906,8 +2845,7 @@ AS_IF([VLC_FEATURE_ENABLED([quicktime])], [
 dnl
 dnl  Real plugin
 dnl
-AC_ARG_ENABLE(real,
-  [  --enable-real           Real media module (default disabled)])
+VLC_FEATURE_OPTION([real], [Real media module], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([real])], [
   VLC_ADD_PLUGIN([realvideo])
 ])
@@ -2915,16 +2853,13 @@ AS_IF([VLC_FEATURE_ENABLED([real])], [
 dnl
 dnl  Real RTSP plugin
 dnl
-AC_ARG_ENABLE(realrtsp,
-  [  --enable-realrtsp       Real RTSP module (default disabled)])
+VLC_FEATURE_OPTION([realrtsp], [Real RTSP module], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([realrtsp])], [
   VLC_ADD_PLUGIN([access_realrtsp])
 ])
 
-AC_ARG_ENABLE(libsysfs,
-  [  --enable-libsysfs       Get user key from firewire connected iPod via libsysfs (default enabled)])
-
-AS_IF([VLC_FEATURE_NOT_DISABLED([libsysfs])], [
+VLC_FEATURE_OPTION([libsysfs], [Get user key from firewire connected iPod via libsysfs])
+AS_IF([VLC_FEATURE_ENABLED([libsysfs])], [
   AC_CHECK_HEADERS(sysfs/libsysfs.h, [
     VLC_ADD_LIBS([mp4 mkv],[-lsysfs])
   ] )
@@ -2933,10 +2868,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([libsysfs])], [
 dnl
 dnl skins2 module
 dnl
-AC_ARG_ENABLE(libtar,
-  [  --enable-libtar         libtar support for skins2 (default enabled)])
-
-AS_IF([VLC_FEATURE_NOT_DISABLED([libtar])], [
+VLC_FEATURE_OPTION([libtar], [libtar support for skins2])
+AS_IF([VLC_FEATURE_ENABLED([libtar])], [
   AC_CHECK_HEADERS(libtar.h, [
     VLC_ADD_LIBS([skins2],[-ltar])
   ] )
@@ -2945,9 +2878,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([libtar])], [
 dnl
 dnl A52/AC3 decoder plugin
 dnl
-AC_ARG_ENABLE(a52,
-  [  --enable-a52            A/52 support with liba52 (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([a52])], [
+VLC_FEATURE_OPTION([a52], [A/52 support with liba52])
+AS_IF([VLC_FEATURE_ENABLED([a52])], [
   AC_ARG_WITH(a52,
     [  --with-a52=PATH         a52 headers and libraries])
   AC_ARG_WITH(a52-tree,
@@ -3041,8 +2973,7 @@ PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorb
 dnl
 dnl  Tremor plugin
 dnl
-AC_ARG_ENABLE(tremor,
-  [  --enable-tremor         Tremor decoder support (default disabled)])
+VLC_FEATURE_OPTION([tremor], [Tremor decoder support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([tremor])], [
   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
     VLC_ADD_PLUGIN([tremor])
@@ -3073,9 +3004,8 @@ PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.6], [dirac d
 dnl
 dnl  PNG decoder module
 dnl
-AC_ARG_ENABLE(png,
-  [  --enable-png            PNG support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([png])], [
+VLC_FEATURE_OPTION([png], [PNG support])
+AS_IF([VLC_FEATURE_ENABLED([png])], [
 AC_CHECK_HEADERS(png.h, [
   LDFLAGS="${LDFLAGS_save} -lz"
   AC_CHECK_LIB(png, png_set_rows, [
@@ -3085,14 +3015,13 @@ AC_CHECK_HEADERS(png.h, [
     LDFLAGS="${LDFLAGS_save}"
   ])
 ])
-AM_CONDITIONAL(BUILD_OSDMENU, [VLC_FEATURE_NOT_DISABLED([png])])
+AM_CONDITIONAL(BUILD_OSDMENU, [VLC_FEATURE_ENABLED([png])])
 
 dnl
 dnl H264 encoder plugin (using libx264)
 dnl
-AC_ARG_ENABLE(x264,
-  [  --enable-x264           H264 encoding support with libx264 (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([x264])], [
+VLC_FEATURE_OPTION([x264], [H264 encoding support with libx264])
+AS_IF([VLC_FEATURE_ENABLED([x264])], [
   AC_ARG_WITH(x264-tree,
     [  --with-x264-tree=PATH   x264 tree for static linking ],[],[])
   if test "${with_x264_tree}" != "no" -a -n "${with_x264_tree}"
@@ -3165,14 +3094,9 @@ dnl vbi decoder plugin (using libzbvi)
 dnl telx module
 dnl uncompatible
 dnl
-AC_ARG_ENABLE(zvbi,
-  AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
-                  libzvbi (default enabled)]))
-AC_ARG_ENABLE(telx,
-  AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
-                  zvbi) (default enabled if zvbi is absent)]))
-
-AS_IF([VLC_FEATURE_NOT_DISABLED([zvbi])], [
+VLC_FEATURE_OPTION([zvbi], [VBI (inc. Teletext) decoding support with libzvbi])
+VLC_FEATURE_OPTION([telx], [Teletext decoding module (conflicting with zvbi)])
+AS_IF([VLC_FEATURE_ENABLED([zvbi])], [
     PKG_CHECK_MODULES(ZVBI,
         zvbi-0.2 >= 0.2.28,
         [
@@ -3191,16 +3115,15 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([zvbi])], [
           AC_MSG_WARN(ZVBI library not found. Enabling the telx module instead)
         ])
     ])
-AS_IF([VLC_FEATURE_NOT_DISABLED([telx])], [
+AS_IF([VLC_FEATURE_ENABLED([telx])], [
   VLC_ADD_PLUGIN([telx])
   ])
 
 dnl
 dnl libass subtitle rendering module
 dnl
-AC_ARG_ENABLE(libass,
-  [  --enable-libass         Subtitle support using libass (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([libass])], [
+VLC_FEATURE_OPTION([libass], [Subtitle support using libass])
+AS_IF([VLC_FEATURE_ENABLED([libass])], [
   PKG_CHECK_MODULES(LIBASS, libass >= 0.9.6,
       [
         VLC_ADD_LIBS([libass],[$LIBASS_LIBS])
@@ -3219,8 +3142,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([libass])], [
 dnl
 dnl asa demuxer
 dnl
-AC_ARG_ENABLE(asademux,
-  [  --enable-asademux       asa subtitle demuxing (default disabled)])
+VLC_FEATURE_OPTION([asademux], [asa subtitle demuxing], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([asademux])], [
   PKG_CHECK_MODULES(PCRE,
       libpcre >= 6.5,
@@ -3239,9 +3161,8 @@ AS_IF([VLC_FEATURE_ENABLED([asademux])], [
 dnl
 dnl  kate decoder plugin
 dnl
-AC_ARG_ENABLE(kate,
-[  --enable-kate           kate codec (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([kate])], [
+VLC_FEATURE_OPTION([kate], [kate codec])
+AS_IF([VLC_FEATURE_ENABLED([kate])], [
   PKG_CHECK_MODULES(KATE,[kate >= 0.1.5], [
       VLC_ADD_PLUGIN([kate])
       VLC_ADD_CFLAGS([kate],[$KATE_CFLAGS])
@@ -3269,9 +3190,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([kate])], [
 dnl
 dnl  tiger rendering for kate decoder plugin
 dnl
-AC_ARG_ENABLE(tiger,
-[  --enable-tiger          Tiger rendering library for Kate streams (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([tiger])], [
+VLC_FEATURE_OPTION([tiger], [Tiger rendering library for Kate streams])
+AS_IF([VLC_FEATURE_ENABLED([tiger])], [
   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])
       VLC_ADD_CFLAGS([kate],[$TIGER_CFLAGS])
@@ -3301,29 +3221,32 @@ dnl  X C Bindings modules
 dnl
 AS_CASE(
   ["${SYS}"],
-  [mingw32|mingwce|darwin], [VLC_FEATURE_DEFAULT_DISABLE([xcb])],
-  [VLC_FEATURE_DEFAULT_ENABLE([xcb])
-])
+  [mingw32|mingwce|darwin], [
+    VLC_FEATURE_DEFAULT_DISABLE([xcb])
+  ],
+  [
+    VLC_FEATURE_DEFAULT_ENABLE([xcb])
+  ]
+)
 
 AS_IF([VLC_FEATURE_REMOVED([xcb])], [
-  VLC_FEATURE_DEFAULT_DISABLE([xvideo])
-  VLC_FEATURE_DEFAULT_DISABLE([glx])
+  VLC_FEATURE_DEFAULT_DISABLE([xvideo glx])
+], [
+  VLC_FEATURE_DEFAULT_ENABLE([xvideo glx])
 ])
 
-AC_ARG_ENABLE(xcb,
-  [  --enable-xcb            X11 support with XCB (default enabled)])
-AC_ARG_ENABLE(xvideo,
-  [  --enable-xvideo         XVideo support (default enabled)])
+VLC_FEATURE_OPTION([xcb], [X11 support with XCB], [auto])
+VLC_FEATURE_OPTION([xvideo], [XVideo support], [enabled if using xcb])
 
 need_xid_provider="no"
-AS_IF([VLC_FEATURE_NOT_DISABLED([xcb])], [
+AS_IF([VLC_FEATURE_ENABLED([xcb])], [
   dnl libxcb
   PKG_CHECK_MODULES(XCB, [xcb])
   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
   VLC_ADD_PLUGIN([screensaver xcb_x11 xcb_screen xcb_apps])
   VLC_SET_CFLAGS_WERROR([xcb_screen], [-Wno-error=uninitialized]) # some gcc report a warning which doesn't reveal an error
 
-  AS_IF([VLC_FEATURE_NOT_DISABLED([xvideo])], [
+  AS_IF([VLC_FEATURE_ENABLED([xvideo])], [
     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [
       VLC_ADD_PLUGIN([xcb_xv])
     ], [
@@ -3362,9 +3285,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([xcb])], [
   VLC_ADD_PLUGIN([xdg_screensaver])
 ])
 
-AC_ARG_ENABLE(glx,
-  [  --enable-glx            X11 OpenGL (GLX) support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([glx])], [
+VLC_FEATURE_OPTION([glx], [X11 OpenGL (GLX) support], [enabled if using xcb])
+AS_IF([VLC_FEATURE_ENABLED([glx])], [
   PKG_CHECK_MODULES(XLIB_XCB, [x11-xcb])
   PKG_CHECK_MODULES(GL, [gl],, [
     AC_CHECK_HEADER([GL/gl.h], [
@@ -3384,9 +3306,8 @@ dnl
 dnl  OpenGL module
 dnl  (enabled by default except on beos)
 dnl
-AC_ARG_ENABLE(opengl,
-  [  --enable-opengl         OpenGL support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([opengl]) && test "${SYS}" = "darwin"], [
+VLC_FEATURE_OPTION([opengl], [OpenGL support])
+AS_IF([VLC_FEATURE_ENABLED([opengl]) && test "${SYS}" = "darwin"], [
     dnl OS X special case (no GL/gl.h but OpenGL/gl.h)
     VLC_ADD_PLUGIN([opengl])
     VLC_ADD_LIBS([opengl],[-Wl,-framework,OpenGL])
@@ -3395,11 +3316,9 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([opengl]) && test "${SYS}" = "darwin"], [
 dnl
 dnl  SDL module
 dnl
-AC_ARG_ENABLE(sdl,
-  [  --enable-sdl            SDL support (default enabled)])
-AC_ARG_ENABLE(sdl-image,
-  [  --enable-sdl-image      SDL image support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([sdl])], [
+VLC_FEATURE_OPTION([sdl], [SDL support])
+VLC_FEATURE_OPTION([sdl-image], [SDL image support])
+AS_IF([VLC_FEATURE_ENABLED([sdl])], [
   SDL_PATH="${PATH}"
   AC_ARG_WITH(sdl-config-path,
     [  --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
@@ -3421,7 +3340,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([sdl])], [
         VLC_ADD_LIBS([vout_sdl aout_sdl sdl_image],[`${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`])
 
         # SDL_image
-        AS_IF([VLC_FEATURE_NOT_DISABLED([sdl-image])], [
+        AS_IF([VLC_FEATURE_ENABLED([sdl-image])], [
           AC_CHECK_HEADERS("SDL/SDL_image.h", [
             VLC_ADD_PLUGIN([sdl_image])
             AC_CHECK_LIB(png, png_set_rows, [VLC_ADD_LIBS([sdl_image],[-lpng -lz])],[],[-lz])
@@ -3448,13 +3367,10 @@ from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
 dnl
 dnl  freetype module
 dnl
-AC_ARG_ENABLE(freetype,
-  [  --enable-freetype       freetype support (default enabled)])
-AC_ARG_ENABLE(fribidi,
-  [  --enable-fribidi        fribidi support (default enabled)])
-AC_ARG_ENABLE(fontconfig,
-  [  --enable-fontconfig     fontconfig support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([freetype])], [
+VLC_FEATURE_OPTION([freetype], [freetype support])
+VLC_FEATURE_OPTION([fribidi], [fribidi support])
+VLC_FEATURE_OPTION([fontconfig], [fontconfig support])
+AS_IF([VLC_FEATURE_ENABLED([freetype])], [
    PKG_CHECK_MODULES(FREETYPE, freetype2,[
       VLC_ADD_PLUGIN([freetype])
       have_freetype=yes
@@ -3463,7 +3379,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([freetype])], [
         VLC_ADD_LIBS([freetype],[-liconv -lz])
       fi
       VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
-      AS_IF([VLC_FEATURE_NOT_DISABLED([fontconfig])], [
+      AS_IF([VLC_FEATURE_ENABLED([fontconfig])], [
         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
           [VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
            VLC_ADD_LIBS([freetype],[-lfontconfig])])
@@ -3472,7 +3388,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([freetype])], [
       ])
 
      dnl fribidi support
-      AS_IF([VLC_FEATURE_NOT_DISABLED([fribidi])], [
+      AS_IF([VLC_FEATURE_ENABLED([fribidi])], [
         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
           VLC_ADD_CPPFLAGS([freetype skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
           VLC_ADD_LIBS([freetype skins2], [${FRIBIDI_LIBS}])
@@ -3503,18 +3419,22 @@ PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library
 dnl
 dnl Snapshot vout module (with cache)
 dnl
-AC_ARG_ENABLE(snapshot,
-  [  --enable-snapshot       snapshot module (default disabled)])
+VLC_FEATURE_OPTION([snapshot], [snapshot module], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([snapshot])], [
   VLC_ADD_PLUGIN([snapshot])
 ])
 
 dnl
-dnl Roku HD1000 Video output module
+dnl Roku HD1000 Video and Audio output module
 dnl
-AC_ARG_ENABLE(hd1000v,
-  [  --enable-hd1000v        HD1000 Video Output module (default enabled on HD1000)])
-AS_IF([{ VLC_FEATURE_NOT_DISABLED([hd1000v]) && test "${CXX}" != "" && test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce" ;} || VLC_FEATURE_ENABLED([hd1000v])], [
+AS_IF([test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce"], [
+  VLC_FEATURE_DEFAULT_ENABLE([hd1000v hd1000a])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([hd1000v hd1000a])
+])
+VLC_FEATURE_OPTION([hd1000v], [HD1000 Video Output module], [enabled on HD1000])
+
+AS_IF([VLC_FEATURE_ENABLED([hd1000v]) && test "${CXX}" != ""], [
   AC_LANG_PUSH([C++])
   AC_CHECK_HEADERS([cascade/graphics/CascadeScreen.h cascade/graphics/CascadeBitmap.h],
   [
@@ -3536,14 +3456,16 @@ dnl
 dnl  Windows DirectX module
 dnl
 
+VLC_FEATURE_DEFAULT_DISABLE([directx])
+
 if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
 then
   VLC_ADD_PLUGIN([panoramix])
+  VLC_FEATURE_DEFAULT_ENABLE([directx])
 fi
 
-AC_ARG_ENABLE(directx,
-  [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([directx])], [
+VLC_FEATURE_OPTION([directx], [Win32 DirectX support], [enabled on Win32])
+AS_IF([VLC_FEATURE_ENABLED([directx])], [
   if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
   then
       AC_CHECK_HEADERS(ddraw.h,
@@ -3566,9 +3488,13 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([directx])], [
 dnl
 dnl  win32 GDI plugin
 dnl
-AC_ARG_ENABLE(wingdi,
-  [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([wingdi])], [
+AS_IF([{ test "${SYS}" = "mingw32" || test "${SYS}" = "mingwce"; }], [
+  VLC_FEATURE_DEFAULT_ENABLE([wingdi])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([wingdi])
+])
+VLC_FEATURE_OPTION([wingdi], [Win32 GDI module], [enabled on Win32])
+AS_IF([VLC_FEATURE_ENABLED([wingdi])], [
   if test "${SYS}" = "mingw32"; then
     VLC_ADD_PLUGIN([wingdi])
     VLC_ADD_LIBS([wingdi],[-lgdi32 -lole32])
@@ -3584,9 +3510,9 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([wingdi])], [
 dnl
 dnl  Linux framebuffer module
 dnl
-AC_ARG_ENABLE(fb,
-  [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([fb])], [
+VLC_FEATURE_DEFAULT_ENABLE([fb])
+VLC_FEATURE_OPTION([fb], [Linux framebuffer support], [enabled on Linux])
+AS_IF([VLC_FEATURE_ENABLED([fb])], [
       AC_CHECK_HEADERS(linux/fb.h, [
         VLC_ADD_PLUGIN([fb])
       ])
@@ -3595,8 +3521,7 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([fb])], [
 dnl
 dnl  OMAP Framebuffer module
 dnl
-AC_ARG_ENABLE(omapfb,
-  [  --enable-omapfb         OMAP framebuffer support (default disabled)])
+VLC_FEATURE_OPTION([omapfb], [OMAP framebuffer support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([omapfb])], [
       AC_CHECK_HEADERS(asm/arch-omap/omapfb.h, [
         VLC_ADD_PLUGIN([omapfb])
@@ -3609,8 +3534,7 @@ AS_IF([VLC_FEATURE_ENABLED([omapfb])], [
 dnl
 dnl  SVGAlib module
 dnl
-AC_ARG_ENABLE(svgalib,
-  [  --enable-svgalib        SVGAlib support (default disabled)])
+VLC_FEATURE_OPTION([svgalib], [SVGAlib support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([svgalib])], [
   VLC_ADD_PLUGIN([svgalib])
   VLC_ADD_LIBS([svgalib],[-lvgagl -lvga])
@@ -3621,8 +3545,7 @@ dnl  DirectFB module
 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
 dnl  TODO: support for static linking
 dnl
-AC_ARG_ENABLE(directfb,
-  [  --enable-directfb       DirectFB support (default disabled)])
+VLC_FEATURE_OPTION([directfb], [DirectFB support], [disabled])
 AC_ARG_WITH(directfb,
   [  --with-directfb=PATH    path to DirectFB headers and libraries])
 AS_IF([VLC_FEATURE_ENABLED([directfb])], [
@@ -3688,8 +3611,7 @@ AS_IF([VLC_FEATURE_ENABLED([directfb])], [
 dnl
 dnl  GGI module
 dnl
-AC_ARG_ENABLE(ggi,
-  [  --enable-ggi            GGI support (default disabled)])
+VLC_FEATURE_OPTION([ggi], [GGI support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([ggi])], [
   AC_CHECK_HEADER([ggi/ggi.h],[
     VLC_ADD_PLUGIN([ggi])
@@ -3709,8 +3631,7 @@ AS_IF([VLC_FEATURE_ENABLED([ggi])], [
 dnl
 dnl  AA plugin
 dnl
-AC_ARG_ENABLE(aa,
-  [  --enable-aa             aalib output (default disabled)])
+VLC_FEATURE_OPTION([aa], [aalib output], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([aa])], [
   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
   if test "${have_aa}" = "true"
@@ -3734,9 +3655,13 @@ AC_ARG_WITH(,[Audio plugins:])
 dnl
 dnl  OSS /dev/dsp module (enabled by default except on win32)
 dnl
-AC_ARG_ENABLE(oss,
-  [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
-AS_IF([{ VLC_FEATURE_NOT_DISABLED([oss]) && test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce" ;} || VLC_FEATURE_ENABLED([oss])], [
+AS_IF([{ test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce"; }], [
+  VLC_FEATURE_DEFAULT_ENABLE([oss])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([oss])
+])
+VLC_FEATURE_OPTION([oss], [Linux OSS /dev/dsp support], [enabled on Linux])
+AS_IF([VLC_FEATURE_ENABLED([oss])], [
   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
     VLC_ADD_PLUGIN([oss access_oss])
     AC_CHECK_LIB(ossaudio,main,[VLC_ADD_LIBS([oss access_oss],[-lossaudio])])
@@ -3761,9 +3686,13 @@ PKG_ENABLE_MODULES_VLC([ALSA], [alsa access_alsa], [alsa >= 1.0.0], [Alsa sound
 dnl
 dnl  win32 waveOut plugin
 dnl
-AC_ARG_ENABLE(waveout,
-  [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([waveout])], [
+AS_IF([{ test "${SYS}" = "mingw32" || test "${SYS}" = "mingwce"; }], [
+  VLC_FEATURE_DEFAULT_ENABLE([waveout])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([waveout])
+])
+VLC_FEATURE_OPTION([waveout], [Win32 waveOut module], [enabled on Win32])
+AS_IF([VLC_FEATURE_ENABLED([waveout])], [
   if test "${SYS}" = "mingw32"; then
     VLC_ADD_PLUGIN([waveout])
     VLC_ADD_LIBS([waveout],[-lwinmm])
@@ -3776,9 +3705,13 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([waveout])], [
 dnl
 dnl  CoreAudio plugin
 dnl
-AC_ARG_ENABLE(macosx-audio,
-  [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([macosx-audio]) && { test "${SYS}" = "darwin" || VLC_FEATURE_ENABLED([macosx-audio]) ;}], [
+AS_IF([test "${SYS}" = "darwin"], [
+  VLC_FEATURE_DEFAULT_ENABLE([macosx-audio])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([macosx-audio])
+])
+VLC_FEATURE_OPTION([macosx-audio], [Mac OS X audio module], [enabled on Mac OS X])
+AS_IF([VLC_FEATURE_ENABLED([macosx-audio])], [
   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
     [ VLC_ADD_PLUGIN([auhal])
       VLC_ADD_LDFLAGS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,Carbon])
@@ -3788,9 +3721,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([macosx-audio]) && { test "${SYS}" = "darwin" ||
 dnl
 dnl  Roku HD1000 audio
 dnl
-AC_ARG_ENABLE(hd1000a,
-  [  --enable-hd1000a        HD1000 audio module (default enabled on HD1000)])
-AS_IF([{ VLC_FEATURE_NOT_DISABLED([hd1000a]) && test "${CXX}" != "" && test "${SYS}" != "mingw32" && test "${SYS}" != "mingwce" ;} || VLC_FEATURE_ENABLED([hd1000a])], [
+VLC_FEATURE_OPTION([hd1000a], [HD1000 Audio Output module], [enabled on HD1000])
+AS_IF([VLC_FEATURE_ENABLED([hd1000a]) && test "${CXX}" != ""], [
   AC_LANG_PUSH([C++])
   AC_CHECK_HEADERS(deschutes/libraries/hdmachinex225/PCMAudioPlayer.h, [
     VLC_ADD_PLUGIN([hd1000a])
@@ -3807,8 +3739,7 @@ PKG_ENABLE_MODULES_VLC([JACK], [jack access_jack], [jack], [JACK audio I/O modul
 dnl
 dnl  CyberLink for C++ UPnP stack
 dnl
-AC_ARG_ENABLE(cyberlink,
-  [  --enable-cyberlink      CyberLink for C++ UPnP stack (default disabled)])
+VLC_FEATURE_OPTION([cyberlin], [CyberLink for C++ UPnP stack], [disabled])
   AS_IF([VLC_FEATURE_ENABLED([cyberlink])], [
   AC_ARG_WITH(cyberlink-tree,
     [  --with-cyberlink-tree=PATH CyberLink for C++ tree for static linking])
@@ -3891,14 +3822,12 @@ AC_ARG_WITH(,[Interface plugins:])
 dnl
 dnl Skins2 module
 dnl
-AC_ARG_ENABLE(skins2,
-  [AS_HELP_STRING([--enable-skins2],[Skins2 interface module (default
-   enabled except on MacOSX, BeOS and WinCE)])])
 AS_CASE(
   ["${SYS}"],
-  [darwin|beos|mingwce], [],
+  [darwin|beos|mingwce], [VLC_FEATURE_DEFAULT_DISABLE([skins2])],
   [VLC_FEATURE_DEFAULT_ENABLE([skins2])]
 )
+VLC_FEATURE_OPTION([skins2], [Skins2 interface module], [enabled except on MacOSX, BeOS and WinCE])
 AS_IF([VLC_FEATURE_ENABLED([skins2])], [
   dnl test for the required libraries
   skins2_missing_lib="no"
@@ -3939,8 +3868,7 @@ AM_CONDITIONAL(BUILD_SKINS, [test "${skins2_missing_lib}" = "no"])
 dnl
 dnl Hildon UI
 dnl
-AC_ARG_ENABLE(hildon,
-  [  --enable-hildon         Hildon touchscreen UI (default disabled)])
+VLC_FEATURE_OPTION([hildon], [Hildon touchscreen UI], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([hildon])], [
   PKG_CHECK_MODULES(HILDON, [hildon-1 hildon-fm-2], [
     VLC_ADD_CFLAGS([hildon],[${HILDON_CFLAGS}])
@@ -3957,10 +3885,13 @@ AM_CONDITIONAL(BUILD_HILDON, [VLC_FEATURE_ENABLED([hildon])])
 dnl
 dnl QT 4
 dnl
-AS_IF([test "x${SYS}" = "xdarwin"], [VLC_FEATURE_DEFAULT_DISABLE([qt4])])
-AC_ARG_ENABLE(qt4,
-  [  --enable-qt4            Qt 4 support (default enabled) ])
-AS_IF([VLC_FEATURE_NOT_DISABLED([qt4])], [
+AS_IF([test "x${SYS}" = "xdarwin"], [
+  VLC_FEATURE_DEFAULT_DISABLE([qt4]),
+], [
+  VLC_FEATURE_DEFAULT_ENABLE([qt4])
+])
+VLC_FEATURE_OPTION([qt4], [Qt 4 support], [enabled except on darwin])
+AS_IF([VLC_FEATURE_ENABLED([qt4])], [
   PKG_CHECK_MODULES(QT4, [QtCore QtGui >= 4.4.0], [
     VLC_ADD_PLUGIN([qt4])
     ALIASES="${ALIASES} qvlc"
@@ -3990,15 +3921,16 @@ AM_CONDITIONAL(ENABLE_QT4, [test "x$have_qt4" = "xyes"])
 dnl
 dnl Simple test for skins2 dependency
 dnl
-AS_IF([VLC_FEATURE_NOT_DISABLED([skins2]) && test "x$have_qt4" != "xyes"], [
+AS_IF([VLC_FEATURE_ENABLED([skins2]) && test "x$have_qt4" != "xyes"], [
   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  MacOS X video output/gui modules
 dnl
-AC_ARG_ENABLE(macosx,
-  [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
+dnl default disable, forced by macosx-defaults
+VLC_FEATURE_DEFAULT_DISABLE([macosx])
+VLC_FEATURE_OPTION([macosx], [Mac OS X gui support], [enabled on Mac OS X])
 AS_IF([VLC_FEATURE_ENABLED([macosx])], [
   VLC_ADD_LDFLAGS([macosx minimal_macosx],[-Wl,-framework,Cocoa])
   VLC_ADD_LDFLAGS([macosx minimal_macosx],[-Wl,-framework,OpenGL])
@@ -4020,24 +3952,27 @@ dnl
 dnl  MacOS X related modules
 dnl
 
-AC_ARG_ENABLE(macosx-vout,
-  [  --enable-macosx-vout    Mac OS X video output module (default enabled on Mac OS X)])
-AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-vout]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-vout])], [
+AS_IF([test "${SYS}" = "darwin"], [
+  VLC_FEATURE_DEFAULT_ENABLE([macosx-vout macosx-dialog-provider macosx-qtcapture macosx-eyetv macosx-vlc-app])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([macosx-vout macosx-dialog-provider macosx-qtcapture macosx-eyetv macosx-vlc-app])
+])
+
+VLC_FEATURE_OPTION([macosx-vout], [Mac OS X video output module], [enabled on Mac OS X])
+AS_IF([VLC_FEATURE_ENABLED([macosx-vout])], [
   VLC_ADD_LDFLAGS([vout_macosx],[-Wl,-framework,Cocoa])
   VLC_ADD_LDFLAGS([vout_macosx],[-Wl,-framework,OpenGL])
   VLC_ADD_PLUGIN([vout_macosx])
 ])
 
-AC_ARG_ENABLE(macosx-dialog-provider,
-  [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
-AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-dialog-provider]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-dialog-provider])], [
+VLC_FEATURE_OPTION([macosx-dialog-provider], [Mac OS X dialog module], [enabled on Mac OS X])
+AS_IF([VLC_FEATURE_ENABLED([macosx-dialog-provider])], [
   VLC_ADD_LDFLAGS([macosx_dialog_provider],[-Wl,-framework,Cocoa])
   VLC_ADD_PLUGIN([macosx_dialog_provider])
 ])
 
-AC_ARG_ENABLE(macosx-qtcapture,
-  [  --enable-macosx-qtcapture Mac OS X qtcapture (iSight) module (default enabled on Mac OS X)])
-AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-qtcapture]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-qtcapture])], [
+VLC_FEATURE_OPTION([macosx-qtcapture], [Mac OS X qtcapture (iSight) module], [enabled on Mac OS X])
+AS_IF([VLC_FEATURE_ENABLED([macosx-qtcapture])], [
   VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,Cocoa])
   VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,QTKit])
   VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,CoreAudio])
@@ -4046,24 +3981,20 @@ AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-qtcapture]) && test "${SYS}" = "darwin
   VLC_ADD_PLUGIN([qtcapture])
 ])
 
-AC_ARG_ENABLE(macosx-eyetv,
-  [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
-AS_IF([{ VLC_FEATURE_NOT_DISABLED([macosx-eyetv]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-eyetv])], [
+VLC_FEATURE_OPTION([macosx-eyetv], [Mac OS X EyeTV (TNT Tuner) module], [enabled on Mac OS X])
+AS_IF([VLC_FEATURE_ENABLED([macosx-eyetv])], [
   VLC_ADD_LDFLAGS([access_eyetv], [-Wl,-framework,Foundation])
   VLC_ADD_PLUGIN([access_eyetv])
 ])
 
-AC_ARG_ENABLE(macosx-vlc-app,
-  [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
-AM_CONDITIONAL(BUILD_MACOSX_VLC_APP,
-  [{ VLC_FEATURE_NOT_DISABLED([macosx-vlc-app]) && test "${SYS}" = "darwin" ;} || VLC_FEATURE_ENABLED([macosx-vlc-app])])
+VLC_FEATURE_OPTION([macosx-vlc-app], [build the VLC media player], [enabled on Mac OS X])
+AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [VLC_FEATURE_ENABLED([macosx-vlc-app])])
 
 
 dnl
 dnl  ncurses module
 dnl
-AC_ARG_ENABLE(ncurses,
-  [  --disable-ncurses       ncurses interface support (default disabled)])
+VLC_FEATURE_OPTION([ncurses], [ncurses interface support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([ncurses])], [
     AC_CHECK_HEADER(ncurses.h,
       [AC_CHECK_LIB(ncursesw, mvprintw,
@@ -4097,8 +4028,7 @@ AS_IF([VLC_FEATURE_ENABLED([ncurses])], [
 dnl
 dnl  XOSD plugin
 dnl
-AC_ARG_ENABLE(xosd,
-  [  --enable-xosd           xosd interface support (default disabled)])
+VLC_FEATURE_OPTION([xosd], [xosd interface support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([xosd])], [
   AC_CHECK_HEADERS(xosd.h,
     AC_CHECK_LIB(xosd, xosd_set_horizontal_offset, [
@@ -4111,8 +4041,7 @@ AS_IF([VLC_FEATURE_ENABLED([xosd])], [
 dnl
 dnl Framebuffer (overlay) plugin
 dnl
-AC_ARG_ENABLE(fbosd,
-  [  --enable-fbosd          fbosd interface support (default disabled)])
+VLC_FEATURE_OPTION([fbosd], [fbosd interface support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([fbosd])], [
   AC_CHECK_HEADERS(linux/fb.h, [
     VLC_ADD_PLUGIN([fbosd])
@@ -4129,9 +4058,8 @@ AS_IF([test "$need_xid_provider" = "yes"], [
 dnl
 dnl Visualisation plugin
 dnl
-AC_ARG_ENABLE(visual,
-  [  --enable-visual         visualisation plugin (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([visual])], [
+VLC_FEATURE_OPTION([visual], [visualisation plugin])
+AS_IF([VLC_FEATURE_ENABLED([visual])], [
     VLC_ADD_PLUGIN([visual])
 ])
 
@@ -4148,10 +4076,8 @@ PKG_ENABLE_MODULES_VLC([PROJECTM], [], [libprojectM], [projectM visualization pl
 dnl
 dnl  AtmoLight (homemade Philips Ambilight clone)
 dnl
-AC_ARG_ENABLE(atmo,
-AS_HELP_STRING([--disable-atmo],[AtmoLight (homemade Philips Ambilight clone)
-                (default enabled)]))
-AS_IF([VLC_FEATURE_NOT_DISABLED([atmo])], [
+VLC_FEATURE_OPTION([atmo], [AtmoLight (homemade Philips Ambilight clone)])
+AS_IF([VLC_FEATURE_ENABLED([atmo])], [
   AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
     AC_LANG_PUSH(C++)
     VLC_ADD_PLUGIN([atmo])
@@ -4174,8 +4100,7 @@ PKG_ENABLE_MODULES_VLC([MTP], [], [libmtp >= 0.3.0],[MTP devices support],[auto]
 dnl
 dnl  Lirc plugin
 dnl
-AC_ARG_ENABLE(lirc,
-  [  --enable-lirc           lirc support (default disabled)])
+VLC_FEATURE_OPTION([lirc], [lirc support], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([lirc])], [
   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"
@@ -4191,9 +4116,8 @@ AC_ARG_WITH(,[Misc options:])
 dnl
 dnl libgcrypt
 dnl
-AC_ARG_ENABLE(libgcrypt,
-  [  --disable-libgcrypt     gcrypt support (default enabled)])
-AS_IF([VLC_FEATURE_NOT_DISABLED([libgcrypt])], [
+VLC_FEATURE_OPTION([libgcrypt], [gcrypt support])
+AS_IF([VLC_FEATURE_ENABLED([libgcrypt])], [
   AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
     libgcrypt-config --version >/dev/null || \
         AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
@@ -4222,16 +4146,15 @@ AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
 dnl
 dnl TLS/SSL
 dnl
-AC_ARG_ENABLE(gnutls,
-  [  --enable-gnutls         gnutls TLS/SSL support (default enabled)])
-
+VLC_FEATURE_DEFAULT_ENABLE([gnutls])
 AS_IF([test "${have_libgcrypt}" != "yes"], [
   AS_IF([VLC_FEATURE_REQUESTED([gnutls])], [
     AC_MSG_ERROR([--enable-gnutls and --disable-libgcrypt are mutually exclusive.])
   ])
   VLC_FEATURE_DEFAULT_DISABLE([gnutls])
 ])
-AS_IF([VLC_FEATURE_NOT_DISABLED([gnutls])], [
+VLC_FEATURE_OPTION([gnutls], [gnutls TLS/SSL support], [enabled if you have libgcrypt])
+AS_IF([VLC_FEATURE_ENABLED([gnutls])], [
   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.7.4], [
     VLC_ADD_PLUGIN([gnutls])
     VLC_ADD_CFLAGS([gnutls], [$GNUTLS_CFLAGS])
@@ -4256,10 +4179,8 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([gnutls])], [
 dnl
 dnl RemoteOSD plugin (VNC client as video filter)
 dnl
-AC_ARG_ENABLE(remoteosd,
-  [  --disable-remoteosd     RemoteOSD plugin (default enabled)])
-
-AS_IF([VLC_FEATURE_NOT_DISABLED([remoteosd])], [
+VLC_FEATURE_OPTION([remoteosd], [RemoteOSD plugin])
+AS_IF([VLC_FEATURE_ENABLED([remoteosd])], [
   AS_IF([test "${have_libgcrypt}" = "yes"],[
     VLC_ADD_PLUGIN([remoteosd])
     VLC_ADD_LIBS([remoteosd], ${GCRYPT_LIBS})
@@ -4298,8 +4219,7 @@ AS_IF([test -f "/etc/maemo_version"], [
 dnl
 dnl update checking system
 dnl
-AC_ARG_ENABLE(update-check,
-  [  --enable-update-check   update checking system (default disabled)])
+VLC_FEATURE_OPTION([update-check], [update checking system], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([update-check])], [
   if test "${have_libgcrypt}" != "yes"
   then
@@ -4313,12 +4233,13 @@ AS_IF([VLC_FEATURE_ENABLED([update-check])], [
 dnl
 dnl SQLite
 dnl
+VLC_FEATURE_OPTION([sqlite], [sqlite support])
 AC_ARG_WITH(sqlite,
   [  --with-sqlite=PATH      sqlite path linking])
 if test "${SYS}" != "darwin"; then
   PKG_ENABLE_MODULES_VLC([SQLITE], [], [sqlite3 >= 3.6.0], [sqlite3], [auto])
 else
-  AS_IF([VLC_FEATURE_NOT_DISABLED([sqlite])], [
+  AS_IF([VLC_FEATURE_ENABLED([sqlite])], [
     AC_CHECK_HEADERS(sqlite3.h, [
         VLC_ADD_PLUGIN([sqlite])
         if test "${with_sqlite}" != "no" -a -n "${with_sqlite}"; then
@@ -4359,9 +4280,7 @@ dnl
 dnl  DLL loader copied from MPlayer copied from somewhere else (WINE ?)
 dnl
 loader=false
-AC_ARG_ENABLE(loader,
-  AS_HELP_STRING([--enable-loader],[build DLL loader for ELF i386 platforms
-		  (default disabled)]))
+VLC_FEATURE_OPTION([loader], [build DLL loader for ELF i386 platforms], [disabled])
 AM_CONDITIONAL(LOADER, [VLC_FEATURE_ENABLED([loader])])
 AS_IF([VLC_FEATURE_ENABLED([loader])],
   [ VLC_ADD_PLUGIN([dmo])
@@ -4376,22 +4295,22 @@ AC_ARG_WITH(,[Components:])
 dnl
 dnl  the VLC binary
 dnl
-AC_ARG_ENABLE(vlc,
-  [  --enable-vlc            build the VLC media player (default enabled)])
-AM_CONDITIONAL(BUILD_VLC, [VLC_FEATURE_NOT_DISABLED([vlc])])
+VLC_FEATURE_OPTION([vlc], [build the VLC media player])
+AM_CONDITIONAL(BUILD_VLC, [VLC_FEATURE_ENABLED([vlc])])
 
 dnl
 dnl  Microsoft ActiveX support
 dnl
 activex=false
-AC_ARG_ENABLE(activex,
-  AS_HELP_STRING([--enable-activex],[build a vlc-based ActiveX control
-		  (default enabled on Win32)]))
+AS_IF([test "${SYS}" = "mingw32"], [
+  VLC_FEATURE_DEFAULT_ENABLE([activex])
+], [
+  VLC_FEATURE_DEFAULT_DISABLE([activex])
+])
+VLC_FEATURE_OPTION([activex], [build a vlc-based ActiveX control], [enabled on Win32])
 AC_ARG_WITH(wine-sdk-path,
   [  --with-wine-sdk-path=PATH path to wine sdk])
-AS_IF([VLC_FEATURE_NOT_DISABLED([activex])], [
-  if test "${SYS}" = "mingw32"
-  then
+AS_IF([VLC_FEATURE_ENABLED([activex]) && test "${SYS}" = "mingw32"], [
     AC_CHECK_PROGS(MIDL, [midl], no)
     if test "${with_wine_sdk_path}" != ""
     then
@@ -4422,7 +4341,6 @@ AS_IF([VLC_FEATURE_NOT_DISABLED([activex])], [
       [ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
     )
     AC_LANG_POP(C++)
-  fi
 ])
 AC_ARG_VAR(MIDL, [Microsoft IDL compiler (Win32 platform only)])
 AM_CONDITIONAL(HAS_MIDL_COMPILER, test "${MIDL}" != "no")
@@ -4434,9 +4352,7 @@ dnl
 dnl  Mozilla plugin
 dnl
 mozilla=false
-AC_ARG_ENABLE(mozilla,
-  AS_HELP_STRING([--enable-mozilla],[build a vlc-based Firefox/Mozilla plugin
-		  (default disabled)]))
+VLC_FEATURE_OPTION([mozilla], [build a vlc-based Firefox/Mozilla plugin], [disabled])
 AC_ARG_WITH(mozilla-sdk-path,
   [  --with-mozilla-sdk-path=PATH path to mozilla sdk])
 AC_ARG_WITH(mozilla-pkg,
@@ -4602,8 +4518,7 @@ AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
 dnl
 dnl  test plugins
 dnl
-AC_ARG_ENABLE(testsuite,
-  [  --enable-testsuite      build test modules (default disabled)])
+VLC_FEATURE_OPTION([testsuite], [build test modules], [disabled])
 AS_IF([VLC_FEATURE_ENABLED([testsuite])], [
   TESTS="test1 test2 test3 test4"
 
@@ -4860,10 +4775,10 @@ build flavour         : "
 AS_IF([VLC_FEATURE_ENABLED([debug])], [printf "debug "])
 AS_IF([VLC_FEATURE_ENABLED([cprof])], [printf "cprof "])
 AS_IF([VLC_FEATURE_ENABLED([gprof])], [printf "gprof "])
-AS_IF([VLC_FEATURE_NOT_DISABLED([optimizations])], [printf "optim "])
+AS_IF([VLC_FEATURE_ENABLED([optimizations])], [printf "optim "])
 AS_IF([VLC_FEATURE_ENABLED([release])], [printf "release "], [printf "devel "])
 echo ""
-AS_IF([VLC_FEATURE_NOT_DISABLED([vlc])], [
+AS_IF([VLC_FEATURE_ENABLED([vlc])], [
 echo "vlc aliases           :${ALIASES}"
 ], [
 echo "build vlc executable  : no"
diff --git a/m4/vlc_features.m4 b/m4/vlc_features.m4
index 80e3439..ee31713 100644
--- a/m4/vlc_features.m4
+++ b/m4/vlc_features.m4
@@ -109,12 +109,8 @@ dnl VLC_FEATURE_(NOT_)DEFAULT_ENABLED/DISABLED(ENABLE-STRING)
 dnl Check if a feature is (or isn't) default enabled/disabled by configure.ac authors.
 AC_DEFUN([VLC_FEATURE_DEFAULT_ENABLED],
   [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_default], [= "xyes" ])])
-AC_DEFUN([VLC_FEATURE_NOT_DEFAULT_ENABLED],
-  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_default], [!= "xyes" ])])
 AC_DEFUN([VLC_FEATURE_DEFAULT_DISABLED],
   [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_default], [= "xno" ])])
-AC_DEFUN([VLC_FEATURE_NOT_DEFAULT_DISABLED],
-  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature_default], [!= "xno"])])
 
 
 
@@ -142,36 +138,12 @@ AC_DEFUN([VLC_FEATURE_REMOVED],
 AC_DEFUN([VLC_FEATURE_NOT_REMOVED],
   [AS_IF([VLC_FEATURE_REMOVED([$1])], [false], [true])])
 
-dnl VLC_FEATURE_(NOT_)ENABLED/DISABLED(ENABLE-STRING)
-dnl Check if a feature is (or isn't) explicitly or default enabled/disabled.
+dnl VLC_FEATURE_ENABLED/DISABLED(ENABLE-STRING)
+dnl Check if a feature is explicitly or default enabled/disabled.
 AC_DEFUN([VLC_FEATURE_ENABLED],
-  [{ \]
-    [VLC_FEATURE_REQUESTED([$1])][ \]
-    [ || \]
-    [{ \]
-        [VLC_FEATURE_NOT_FORCE_DISABLED([$1])][ \]
-        [ && \]
-        [VLC_FEATURE_NOT_USER_DISABLED([$1])][ \]
-        [ && \]
-        [VLC_FEATURE_DEFAULT_ENABLED([$1])][ \]
-    [; } \]
-  [; }])
-AC_DEFUN([VLC_FEATURE_NOT_ENABLED],
-  [AS_IF([VLC_FEATURE_ENABLED([$1])], [false], [true])])
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature], [= "xyes"])])
 AC_DEFUN([VLC_FEATURE_DISABLED],
-  [{ \]
-    [VLC_FEATURE_REMOVED([$1])][ \]
-    [ || \]
-    [{ \]
-        [VLC_FEATURE_NOT_FORCE_ENABLED([$1])][ \]
-        [ && \]
-        [VLC_FEATURE_NOT_USER_ENABLED([$1])][ \]
-        [ && \]
-        [VLC_FEATURE_DEFAULT_DISABLED([$1])][ \]
-    [; } \]
-  [; }])
-AC_DEFUN([VLC_FEATURE_NOT_DISABLED],
-  [AS_IF([VLC_FEATURE_DISABLED([$1])], [false], [true])])
+  [_VLC_FEATURE_CHECK_VARIABLE([$1], [vlc_feature], [= "xno"])])
 
 
 
@@ -189,11 +161,11 @@ dnl VLC_FEATURE_DEFAULT_{ENABLE,DISABLE} prior to calling this macro.
 dnl Only if DEFAULT-STRING is "enabled" the configure output will show --disable-foo.
 dnl So for example "enabled on BSD" will still print --enable-foo.
 AC_DEFUN([VLC_FEATURE_OPTION], [
-  m4_pushdef([default_string], m4_default([$3], [enabled]))
+  m4_pushdef([default_string], m4_default_quoted([$3], [enabled]))
   m4_pushdef([var], [vlc_feature_]_VLC_FEATURE_STRING([$1]))
   m4_ifblank([$2], [m4_fatal([Don't leave description blank for $1])])
 
-  m4_case(default_string,
+  m4_case(m4_quote(default_string),
     [enabled], [
       m4_pushdef([with_without], [--disable-$1])
       VLC_FEATURE_DEFAULT_ENABLE([$1])
@@ -224,10 +196,7 @@ AC_DEFUN([VLC_FEATURE_OPTION], [
     AC_MSG_ERROR([You cannot --enable-$1 it was force disabled.])
   ])
 
-  AC_ARG_ENABLE([$1], [
-    AS_HELP_STRING(with_without,
-                   m4_quote([$2])[ @<:@default: ]m4_quote(default_string)[@:>@])
-  ])
+  AC_ARG_ENABLE([$1], [AS_HELP_STRING(with_without, m4_quote([$2])[ @<:@default: ]m4_quote(default_string)[@:>@])])
 
   AS_IF([test "x${]var[}" = "x"], [AS_IF([VLC_FEATURE_REQUESTED([$1])], var="yes")])
   AS_IF([test "x${]var[}" = "x"], [AS_IF([VLC_FEATURE_REMOVED([$1])], var="no")])
diff --git a/m4/with_pkg.m4 b/m4/with_pkg.m4
index a70dc1d..3f6cddc 100644
--- a/m4/with_pkg.m4
+++ b/m4/with_pkg.m4
@@ -41,7 +41,8 @@ m4_pushdef([description],
 AC_ARG_ENABLE(with_arg,
      AS_HELP_STRING([--enable-]with_arg, description[ @<:@default=]auto[@:>@]))
 
-AS_IF([VLC_FEATURE_NOT_DISABLED(with_arg)], [
+VLC_FEATURE_DEFAULT_ENABLE(with_arg)
+AS_IF([VLC_FEATURE_ENABLED(with_arg)], [
      PKG_CHECK_MODULES([$1],[$2],[$3],[$4])])
 
 m4_popdef([with_arg])
-- 
1.6.6.1

