]> git.sesse.net Git - vlc/blobdiff - configure.ac
Dash: C++ sanitization
[vlc] / configure.ac
index 9d554a279adcb713bd0d10552b3ffdec481d6318..a9d412be656ece8181155359fedc2d8076093d3f 100644 (file)
@@ -566,7 +566,7 @@ dnl Check for poll
 AC_SEARCH_LIBS(poll, [poll], [
   AC_DEFINE(HAVE_POLL, 1, [Define to 1 if the OS has poll().])
 ], [
-  AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [
+  AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" -a "${SYS}" != "os2"], [
     AC_MSG_ERROR([poll() is required.])
   ])
 ])
@@ -1202,11 +1202,18 @@ AS_IF([test "${enable_mmx}" != "no"], [
               [Define to 1 if MMX intrinsics are available.])
   ])
 
-  AC_CACHE_CHECK([if $CC groks MMX inline assembly],
-    [ac_cv_mmx_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
-                    ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
+  AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
+    CFLAGS="${CFLAGS_save} -mmmx"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
+]])
+    ], [
+      ac_cv_mmx_inline=yes
+    ], [
+      ac_cv_mmx_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
     AC_DEFINE(CAN_COMPILE_MMX, 1,
               [Define to 1 inline MMX assembly is available.])
@@ -1214,10 +1221,18 @@ AS_IF([test "${enable_mmx}" != "no"], [
   ])
 
   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
-    [ac_cv_mmxext_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
-                    ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
+                 [ac_cv_mmxext_inline], [
+    CFLAGS="${CFLAGS_save} -mmmx"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
+]])
+    ], [
+      ac_cv_mmxext_inline=yes
+    ], [
+      ac_cv_mmxext_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
     AC_DEFINE(CAN_COMPILE_MMXEXT, 1,
               [Define to 1 if MMX EXT inline assembly is available.])
@@ -1268,21 +1283,35 @@ AS_IF([test "${enable_sse}" != "no"], [
               [Define to 1 if SSE2 intrinsics are available.])
   ])
 
-  AC_CACHE_CHECK([if $CC groks SSE inline assembly],
-    [ac_cv_sse_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
-                    ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
+  AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
+    CFLAGS="${CFLAGS_save} -msse"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
+]])
+    ], [
+      ac_cv_sse_inline=yes
+    ], [
+      ac_cv_sse_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
     AC_DEFINE(CAN_COMPILE_SSE, 1,
               [Define to 1 if SSE inline assembly is available.])
   ])
 
-  AC_CACHE_CHECK([if $CC groks SSE2 inline assembly],
-    [ac_cv_sse2_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p));],
-                    ac_cv_sse2_inline=yes, ac_cv_sse2_inline=no)])
+  AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
+    CFLAGS="${CFLAGS_save} -msse"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
+]])
+    ], [
+      ac_cv_sse2_inline=yes
+    ], [
+      ac_cv_sse2_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
     AC_DEFINE(CAN_COMPILE_SSE2, 1,
               [Define to 1 if SSE2 inline assembly is available.])
@@ -1290,50 +1319,87 @@ AS_IF([test "${enable_sse}" != "no"], [
   ])
 
   # SSE3
-  AC_CACHE_CHECK([if $CC groks SSE3 inline assembly],
-    [ac_cv_sse3_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p));],
-                    ac_cv_sse3_inline=yes, ac_cv_sse3_inline=no)])
+  AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
+    CFLAGS="${CFLAGS_save} -msse"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
+]])
+    ], [
+      ac_cv_sse3_inline=yes
+    ], [
+      ac_cv_sse3_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
     AC_DEFINE(CAN_COMPILE_SSE3, 1,
               [Define to 1 if SSE3 inline assembly is available.]) ])
   # SSSE3
-  AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly],
-    [ac_cv_ssse3_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p));],
-                    ac_cv_ssse3_inline=yes, ac_cv_ssse3_inline=no)])
+  AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
+    CFLAGS="${CFLAGS_save} -msse"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
+]])
+    ], [
+      ac_cv_ssse3_inline=yes
+    ], [
+      ac_cv_ssse3_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
     AC_DEFINE(CAN_COMPILE_SSSE3, 1,
               [Define to 1 if SSSE3 inline assembly is available.]) ])
 
   # SSE4.1
   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
-    [ac_cv_sse4_1_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p));],
-                    ac_cv_sse4_1_inline=yes, ac_cv_sse4_1_inline=no)])
+                 [ac_cv_sse4_1_inline], [
+    CFLAGS="${CFLAGS_save} -msse"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
+]])
+    ], [
+      ac_cv_sse4_1_inline=yes
+    ], [
+      ac_cv_sse4_1_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
     AC_DEFINE(CAN_COMPILE_SSE4_1, 1,
               [Define to 1 if SSE4_1 inline assembly is available.]) ])
 
   # SSE4.2
   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
-    [ac_cv_sse4_2_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p));],
-                    ac_cv_sse4_2_inline=yes, ac_cv_sse4_2_inline=no)])
+                 [ac_cv_sse4_2_inline], [
+    CFLAGS="${CFLAGS_save} -msse"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
+]])
+    ], [
+      ac_cv_sse4_2_inline=yes
+    ], [
+      ac_cv_sse4_2_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
     AC_DEFINE(CAN_COMPILE_SSE4_2, 1,
               [Define to 1 if SSE4_2 inline assembly is available.]) ])
 
   # SSE4A
-  AC_CACHE_CHECK([if $CC groks SSE4A inline assembly],
-    [ac_cv_sse4a_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("insertq %%xmm1,%%xmm0"::"r"(p));],
-                    ac_cv_sse4a_inline=yes, ac_cv_sse4a_inline=no)])
+  AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
+    CFLAGS="${CFLAGS_save} -msse"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
+]])
+    ], [
+      ac_cv_sse4a_inline=yes
+    ], [
+      ac_cv_sse4a_inline=no
+    ])
+  ])
   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
     AC_DEFINE(CAN_COMPILE_SSE4A, 1,
               [Define to 1 if SSE4A inline assembly is available.]) ])
@@ -1341,11 +1407,18 @@ AS_IF([test "${enable_sse}" != "no"], [
 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
 
 have_3dnow="no"
-AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly],
-    [ac_cv_3dnow_inline],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
-                    ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
+AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
+  CFLAGS="${CFLAGS_save} -mmmx"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
+void *p;
+asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
+]])
+  ], [
+    ac_cv_3dnow_inline=yes
+  ], [
+    ac_cv_3dnow_inline=no
+  ])
+])
 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
             [Define to 1 if 3D Now! inline assembly is available.])
@@ -1664,127 +1737,91 @@ dnl
 AC_ARG_ENABLE(live555,
   [AS_HELP_STRING([--enable-live555],
     [enable RTSP input through live555 (default enabled)])])
-AC_ARG_WITH(live555-tree,
-  [AS_HELP_STRING([--with-live555-tree=PATH],
-    [live555 tree for static linking])])
-if test "${enable_live555}" != "no"; then
-
-  dnl
-  dnl test for --with-live555-tree
-  dnl
-  if test -z "${with_live555_tree}" -a "${CXX}" != ""; then
-    AC_LANG_PUSH(C++)
-    CPPFLAGS_save="${CPPFLAGS}"
-    if test -z "${CONTRIB_DIR}"; then
-        CPPFLAGS_live555="-I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment"
-    else
-        CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
-    fi
-    if test "${SYS}" = "solaris"; then
-      CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
-    fi
-    CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
-
-    AC_CHECK_HEADERS(liveMedia_version.hh, [
-      AC_MSG_CHECKING(for liveMedia version >= 1275091200 )
-      AC_EGREP_CPP(yes,
-        [#include <liveMedia_version.hh>
-         #ifdef LIVEMEDIA_LIBRARY_VERSION_INT
-         #if LIVEMEDIA_LIBRARY_VERSION_INT < 1275091200
-         yes
-         #endif
-         #endif],
-        [AC_MSG_RESULT([no])
-          AC_MSG_WARN([The installed liveMedia version is too old:
+AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
+  AC_LANG_PUSH(C++)
+  CPPFLAGS_save="${CPPFLAGS}"
+  AS_IF([test -z "${CONTRIB_DIR}"], [
+    CPPFLAGS_live555="-I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment"
+  ], [
+    CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
+  ])
+  AS_IF([test "${SYS}" = "solaris"], [
+    CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
+  ])
+  CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
+
+  AC_CACHE_CHECK([for live555 version 1275091200 or later], [ac_cv_live555], [
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
+[#include <liveMedia_version.hh>
+#if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1275091200)
+# error BOOM
+#endif]])
+    ], [
+      ac_cv_live555="yes"
+    ], [
+      ac_cv_live555="no"
+    ])
+  ])
+  AS_IF([test "$ac_cv_live555" = "no"], [
+    AC_MSG_WARN([liveMedia is missing or its installed version is too old:
 Version 2010.05.29 or later is required to proceed.
 You can get an updated one from http://www.live555.com/liveMedia .])
-          AS_IF([test "${enable_live555}" = "yes"], [
-            AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable the plugin.])
-          ])
-        ],[
-          AC_MSG_RESULT([yes])
-          other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
-          other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
-          if test "${SYS}" = "mingw32"; then
-            # add ws2_32 for closesocket, select, recv
-            other_libs="$other_libs -lws2_32"
-          elif test "${SYS}" = "mingwce"; then
-            # add ws2 for closesocket, select, recv
-            other_libs="$other_libs -lws2"
-          fi
-
-          dnl We need to check for pic because live555 don't provide shared libs
-          dnl and we want to build a plugins so we need -fPIC on some arch.
-          VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
-          AC_CHECK_LIB(liveMedia_pic, main, [
-            VLC_ADD_PLUGIN([live555])
-            VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
-          ],[
-            AC_CHECK_LIB(liveMedia, main, [
-            VLC_ADD_PLUGIN([live555])
-            VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
-          ],[],[${other_libs}]) ],[${other_libs_pic}])
-
-          CPPFLAGS="${CPPFLAGS_save}"
-          AC_LANG_POP(C++)
-        ])
-      ])
-  else
-    AC_MSG_CHECKING(for liveMedia/libliveMedia.a in ${with_live555_tree})
-    real_live555_tree="`cd ${with_live555_tree} 2>/dev/null && pwd`"
-    if test -z "${real_live555_tree}"; then
-      dnl  The given directory can't be found
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot cd to ${with_live555_tree}])
-    fi
-    if test -f "${real_live555_tree}/liveMedia/libliveMedia.a"; then
-      AC_MSG_RESULT(${real_live555_tree}/liveMedia/libliveMedia.a)
-
-      AC_CHECK_HEADERS(${real_live555_tree}/liveMedia/include/liveMedia_version.hh,[
-        AC_MSG_CHECKING(for liveMedia version >= 1275091200 )
-        AC_EGREP_CPP(yes,
-          [#include "${real_live555_tree}/liveMedia/include/liveMedia_version.hh"
-           #ifdef LIVEMEDIA_LIBRARY_VERSION_INT
-           #if LIVEMEDIA_LIBRARY_VERSION_INT < 1275091200
-           yes
-           #endif
-           #endif],
-          [AC_MSG_RESULT([no])
-           AC_MSG_ERROR([Your version of liveMedia is too old: you may get a more recent one from http://www.live555.com/liveMedia.
-lternatively you can use --disable-live555 to disable the liveMedia plugin.])
-        ],[
-       AC_MSG_RESULT([yes])
-       ])
+    AS_IF([test -n "${enable_live555}"], [
+      AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
+    ])
+    ac_cv_live555_usable=""
+  ], [
+    dnl Check that live555 is patched correctly.
+    AC_CACHE_CHECK([for live555 usability], [ac_cv_live555_usable], [
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+[#include <locale.h>
+#ifdef __APPLE__
+# include <xlocale.h>
+#endif
+#undef LC_ALL
+#define LC_ALL BOOM
+#ifdef LC_ALL_MASK
+#include <Locale.hh>
+#endif
+#include <GroupsockHelper.hh>]], [
+[struct in_addr addr;
+our_inet_ntoa(addr, NULL);]])
+      ], [
+        ac_cv_live555_usable="yes"
+      ], [
+        ac_cv_live555_usable="no"
       ])
+    ])
+    AS_IF([test "$ac_cv_live555_usable" = "no"], [
+      AC_MSG_ERROR([liveMedia lacks patches and is not usable.
+Please apply our patches from the VLC contrib (contrib/src/live555/).
+You can also disable RTSP input with --disable-live555. You were warned.])
+    ])
+    other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
+    other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
+    AS_IF([test "${SYS}" = "mingw32"], [
+      # add ws2_32 for closesocket, select, recv
+      other_libs="$other_libs -lws2_32"
+    ], [test "${SYS}" = "mingwce"], [
+      # add ws2 for closesocket, select, recv
+      other_libs="$other_libs -lws2"
+    ])
 
+    dnl We need to check for pic because live555 don't provide shared libs
+    dnl and we want to build a plugins so we need -fPIC on some arch.
+    VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
+    AC_CHECK_LIB(liveMedia_pic, main, [
       VLC_ADD_PLUGIN([live555])
-
-      if test "${SYS}" = "mingw32"; then
-        # add ws2_32 for closesocket, select, recv
-        VLC_ADD_LIBS([live555],[-lws2_32])
-      fi
-
-      VLC_ADD_LIBS([live555],[-L${real_live555_tree}/UsageEnvironment -lUsageEnvironment])
-      VLC_ADD_LIBS([live555],[-L${real_live555_tree}/BasicUsageEnvironment -lBasicUsageEnvironment])
-      VLC_ADD_LIBS([live555],[-L${real_live555_tree}/groupsock -lgroupsock])
-      VLC_ADD_LIBS([live555],[-L${real_live555_tree}/liveMedia -lliveMedia])
-
-      VLC_ADD_CXXFLAGS([live555],[-I${real_live555_tree}/BasicUsageEnvironment/include])
-      VLC_ADD_CXXFLAGS([live555],[-I${real_live555_tree}/groupsock/include])
-      VLC_ADD_CXXFLAGS([live555],[-I${real_live555_tree}/liveMedia/include])
-      VLC_ADD_CXXFLAGS([live555],[-I${real_live555_tree}/UsageEnvironment/include ])
-      if test "${SYS}" = "solaris"; then
-        VLC_ADD_CXXFLAGS([live555],[-DSOLARIS])
-      fi
-    else
-      dnl  The given live555 wasn't built
-        AC_MSG_RESULT(no)
-      if test "${enable_live555}" = "yes"; then
-        AC_MSG_ERROR([cannot find ${real_live555_tree}/liveMedia/libliveMedia.a, make sure you compiled live555 in ${with_live555_tree}])
-      fi
-    fi
-  fi
-fi
+      VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
+    ],[
+      AC_CHECK_LIB(liveMedia, main, [
+        VLC_ADD_PLUGIN([live555])
+        VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
+      ],[],[${other_libs}])],[${other_libs_pic}])
+  ])
+  CPPFLAGS="${CPPFLAGS_save}"
+  AC_LANG_POP(C++)
+])
 
 dnl
 dnl - special access module for dc1394 input
@@ -3007,6 +3044,37 @@ dnl
 
 EXTEND_HELP_STRING([Video plugins:])
 
+dnl
+dnl  OpenGL
+dnl
+PKG_CHECK_MODULES([GL], [gl], [
+  have_gl="yes"
+], [
+  AC_CHECK_HEADER([GL/gl.h], [
+    have_gl="yes"
+    GL_CFLAGS=""
+    GL_LIBS="-lGL"
+  ], [
+    have_gl="no"
+  ])
+])
+
+dnl OpenGL ES 2: depends on EGL 1.1 and is currently unfinished
+dnl PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [auto])
+dnl OpenGL ES 1: depends on EGL 1.0 and is currently broken
+dnl PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [auto])
+
+AC_ARG_ENABLE(egl,
+  [  --enable-egl            OpenGL support through EGL (default disabled)],, [
+  enable_egl="no"
+])
+AS_IF([test "$enable_egl" != "no"], [
+  PKG_CHECK_MODULES([EGL], [egl], [
+    VLC_ADD_PLUGIN([gl])
+    VLC_ADD_PLUGIN([egl])
+  ])
+])
+
 dnl
 dnl  Xlib
 dnl
@@ -3029,6 +3097,10 @@ AC_ARG_ENABLE(xvideo,
   [  --enable-xvideo         XVideo support (default enabled)],, [
     enable_xvideo="$enable_xcb"
 ])
+AC_ARG_ENABLE(glx,
+  [  --enable-glx            OpenGL support through GLX (default enabled)],, [
+  enable_glx="$enable_xcb"
+])
 
 have_xcb="no"
 AS_IF([test "${enable_xcb}" != "no"], [
@@ -3062,33 +3134,19 @@ AS_IF([test "${enable_xcb}" != "no"], [
   ], [
     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
   ])
-])
-AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
 
-AC_ARG_ENABLE(glx,
-  [  --enable-glx            X11 OpenGL (GLX) support (default enabled)],, [
-  enable_glx="$enable_xcb"
-])
-AS_IF([test "${enable_glx}" != "no"], [
-  PKG_CHECK_MODULES(XLIB_XCB, [x11-xcb])
-  PKG_CHECK_MODULES(GL, [gl],, [
-    AC_CHECK_HEADER([GL/gl.h], [
-      GL_CFLAGS=""
-      GL_LIBS="-lGL"
+  AS_IF([test "${enable_glx}" != "no"], [
+    AS_IF([test "${have_gl}" != "yes"], [
+      AC_MSG_ERROR([${GL_PKG_ERRORS}. Pass --disable-glx if you do not need OpenGL X11 support.])
+    ])
+    PKG_CHECK_MODULES(XLIB_XCB, [x11-xcb], [
+      VLC_ADD_PLUGIN([xcb_glx])
     ], [
-      AC_MSG_ERROR([${GL_PKG_ERRORS}. If you do not need OpenGL with X11, pass --disable-glx.])
+      AC_MSG_ERROR([${XLIB_XCB_PKG_ERRORS}. Pass --disable-glx if you do not need OpenGL X11 support.])
     ])
   ])
-  VLC_ADD_PLUGIN([xcb_glx])
 ])
-
-dnl
-dnl  OpenGL
-dnl
-PKG_ENABLE_MODULES_VLC([GL], [], [gl], [OpenGL support], [auto])
-PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [auto])
-PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [auto])
-PKG_ENABLE_MODULES_VLC([EGL], [], [egl], [EGL support], [auto])
+AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
 
 dnl
 dnl  SDL module
@@ -3257,6 +3315,7 @@ if test "${enable_directx}" != "no"; then
       [ VLC_ADD_PLUGIN([glwin32])
         VLC_ADD_LIBS([glwin32],[-lopengl32 -lgdi32])
       ],[],[
+        #include <windows.h>
         #include <GL/gl.h>
       ])
 
@@ -4165,15 +4224,6 @@ AC_ARG_ENABLE(macosx-vlc-app,
 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
 
-
-dnl
-dnl Pic and shared libvlc stuff
-dnl
-AS_IF([test "${SYS}" = "mingw32"], [
-  FILE_LIBVLCCORE_DLL="!define LIBVLCCORE_DLL libvlccore.dll"
-  FILE_LIBVLC_DLL="!define LIBVLC_DLL libvlc.dll"
-])
-
 dnl
 dnl  Stuff used by the program
 dnl
@@ -4334,8 +4384,6 @@ AM_COND_IF([HAVE_DARWIN], [
 dnl Generate makefiles
 AC_OUTPUT
 
-/bin/echo -n "Enabled modules: ${PLUGINS}"
-
 dnl Do we have to use make or gmake ?
 USE_MAKE_OR_GMAKE=`case "${SYS}" in openbsd*) echo "gmake";; *) echo "make";; esac`
 dnl Shortcut to nice compile message