]> git.sesse.net Git - vlc/blobdiff - configure.ac
Build plugins statically if --disable-shared is used
[vlc] / configure.ac
index 4f3575080bc5278a2d72f22570e91b73a65bf335..9812a531bace81f4e5cd8c101e09734c596e5912 100644 (file)
@@ -179,7 +179,6 @@ dnl
 dnl  Set default values
 dnl
 LDFLAGS_vlc="${LDFLAGS}"
-SOCKET_LIBS=""
 
 dnl
 dnl  Check the operating system
@@ -321,8 +320,8 @@ case "${host_os}" in
   *mingw32* | *cygwin* | *wince* | *mingwce*)
     AC_CHECK_TOOL(WINDRES, windres, :)
     AC_CHECK_TOOL(OBJCOPY, objcopy, :)
-    AC_DEFINE([_WIN32_WINNT], 0x0501, [Define to '0x0501' for Windows XP APIs.])
-    AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01 (and shell) APIs.])
+    AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows XP SP2 APIs.])
+    AC_DEFINE([_WIN32_IE], 0x0600, [Define to '0x0600' for IE 6.0 (and shell) APIs.])
 
     case "${host_os}" in
       *wince* | *mingwce* | *mingw32ce*)
@@ -344,13 +343,10 @@ case "${host_os}" in
     esac
 
     if test "${SYS}" = "mingw32"; then
-        # add ws2_32 for closesocket, select, recv
-        VLC_ADD_LIBS([libvlccore],[-lws2_32 -lnetapi32 -lwinmm])
+        VLC_ADD_LIBS([libvlccore],[-lnetapi32 -lwinmm])
         VLC_ADD_LDFLAGS([vlc],[-mwindows])
         VLC_ADD_LIBS([win32text],[-lgdi32])
         VLC_ADD_LIBS([cdda vcdx sdl_image vout_sdl],[-lwinmm])
-        VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap stream_out_standard stream_out_select stream_out_rtp stream_out_raop vod_rtsp access_realrtsp oldrc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd zvbi audiobargraph_a netsync],[-lws2_32])
-        SOCKET_LIBS="-lws2_32"
         dnl
         dnl DEP and ASLR options
         dnl
@@ -380,9 +376,6 @@ case "${host_os}" in
 
     fi
     if test "${SYS}" = "mingwce"; then
-        # add ws2 for closesocket, select, recv
-        VLC_ADD_LIBS([libvlccore access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_rtmp sap netsync audioscrobbler growl stream_out_standard stream_out_select stream_out_rtp remoteosd ts audiobargraph_a netsync],[-lws2])
-        SOCKET_LIBS="-lws2"
         VLC_ADD_LIBS([libvlccore],[-lmmtimer])
         AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
         ac_default_prefix="`pwd`/_wince"
@@ -459,36 +452,31 @@ dnl fail on anything other than pass_all.
 AC_CACHE_VAL(lt_cv_deplibs_check_method,
     [lt_cv_deplibs_check_method=pass_all])
 
-AC_DISABLE_STATIC
-dnl AC_DISABLE_FAST_INSTALL
-AC_LIBTOOL_DLOPEN
-AC_LIBTOOL_WIN32_DLL
-m4_undefine([AC_PROG_F77])
-m4_defun([AC_PROG_F77],[])
-AC_PROG_LIBTOOL
+LT_INIT([dlopen win32-dll shared disable-static])
+LT_LANG([C++])
+LT_LANG([Windows Resource])
 
 m4_undefine([AC_DEPLIBS_CHECK_METHOD])
 m4_defun([AC_DEPLIBS_CHECK_METHOD],[])
 
 lt_cv_deplibs_check_method=pass_all
 
-AS_IF([test "${enable_shared}" = "no"], [
+AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
 ])
 
+AM_CONDITIONAL(HAVE_SHARED_PLUGINS, [test "${enable_shared}" != "no"])
+
 dnl
 dnl Gettext stuff
 dnl
 AM_GNU_GETTEXT_VERSION([0.18.1])
 AM_GNU_GETTEXT([external])
-VLC_ADD_LIBS([libvlccore vlc], [${LTLIBINTL}])
 
 dnl
 dnl Iconv stuff
 dnl
 AM_ICONV
-VLC_ADD_CFLAGS([libvlccore],[${INCICONV}])
-VLC_ADD_LIBS([libvlccore],[${LTLIBICONV}])
 
 dnl Check for broken versions of mingw-runtime compatability library
 AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"], [
@@ -571,9 +559,6 @@ dnl Plugin compilation stuff
 
 VLC_LIBRARY_SUFFIX
 
-dnl The -DSYS_FOO flag
-CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
-
 dnl Check for system libs needed
 need_libc=false
 
@@ -593,14 +578,45 @@ AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity])
 
 AH_BOTTOM([#include <vlc_fixups.h>])
 
-AC_CHECK_FUNCS(connect,,[
-  AC_CHECK_LIB(socket,connect,[
-    VLC_ADD_LIBS([libvlccore cdda access_http access_mms access_udp access_tcp access_ftp access_rtmp sap access_output_udp access_output_rtmp stream_out_standard growl_udp remoteosd netsync],[-lsocket])
-    SOCKET_LIBS="-lsocket"
+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"], [
+    AC_MSG_ERROR([poll() is required.])
   ])
 ])
-AC_SUBST(SOCKET_LIBS)
 
+dnl Check for struct pollfd
+AC_CHECK_TYPES([struct pollfd],,,
+[#include <sys/types.h>
+#if HAVE_POLL
+# include <poll.h>
+#elif defined (WIN32)
+# include <winsock2.h>
+#endif
+])
+
+dnl Check for connect
+LIBS_save="$LIBS"
+SOCKET_LIBS=""
+AC_SEARCH_LIBS(connect, [socket], [
+  AS_IF([test "$ac_cv_search_connect" != "none required"], [
+    SOCKET_LIBS="$ac_cv_search_connect"
+  ])
+], [
+  AS_IF([test "${SYS}" = "mingw32"], [
+    SOCKET_LIBS="-lws2_32"
+  ])
+  AS_IF([test "${SYS}" = "mingwce"], [
+    SOCKET_LIBS="-lws2"
+  ])
+])
+LIBS="$LIBS_save"
+AS_IF([test -n "$SOCKET_LIBS"], [
+  VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout sap stream_out_select stream_out_standard stream_out_rtp stream_out_raop vod_rtsp access_realrtsp rtp oldrc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd zvbi audiobargraph_a netsync],[${SOCKET_LIBS}])
+])
+AC_SUBST(SOCKET_LIBS)
 
 dnl Check for socklen_t
 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
@@ -662,7 +678,7 @@ AC_CHECK_FUNC(getopt_long,, [
 AC_SUBST(GNUGETOPT_LIBS)
 
 AC_CHECK_LIB(m,cos,[
-  VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene kate flac lua chorus_flanger freetype avcodec avformat access_avio swscale postproc i420_rgb faad twolame equalizer spatializer param_eq samplerate libvlccore freetype mod mpc dmo quicktime realvideo qt4 compressor headphone_channel_mixer normvol audiobargraph_a speex mono colorthres extract ball access_imem hotkeys mosaic gaussianblur dbus x264],[-lm])
+  VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene kate flac lua chorus_flanger freetype avcodec avformat access_avio swscale postproc i420_rgb faad twolame equalizer spatializer param_eq samplerate freetype mod mpc dmo quicktime realvideo qt4 compressor headphone_channel_mixer normvol audiobargraph_a speex mono colorthres extract ball access_imem hotkeys mosaic gaussianblur dbus x264],[-lm])
   LIBM="-lm"
 ], [
   LIBM=""
@@ -675,50 +691,31 @@ AC_CHECK_LIB(m,lrintf, [
 ])
 
 dnl Check for dynamic plugins
-ac_cv_have_plugins=no
-
-# Win32 style
-if test "${ac_cv_have_plugins}" = "no"; then
-  if test "${SYS}" = "mingw32" ; then
-    AC_CHECK_LIB(kernel32, main,
-     [VLC_ADD_LIBS([libvlccore],[-lkernel32])
-      ac_cv_have_plugins=yes])
-  fi
-fi
+LIBDL="no"
+LIBS_save="$LIBS"
+AC_SEARCH_LIBS(dlopen, [dl svld], [
+  AS_IF([test "$ac_cv_search_dlopen" != "none required"], [
+    LIBDL="$ac_cv_search_dlopen"
+  ])
+])
+LIBS="$LIBS_save"
 
-# WinCE style
-if test "${ac_cv_have_plugins}" = "no"; then
-  if test "${SYS}" = "mingwce"; then
-    ac_cv_have_plugins=yes
-  fi
-fi
+# Windows
+AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"], [
+  LIBDL=""
+])
 
-# Only test for dlopen() if the others didn't work
-LIBDL=""
-if test "${ac_cv_have_plugins}" = "no" -o "${SYS}" = "darwin"; then
-  AC_CHECK_HEADERS(dlfcn.h sys/dl.h)
-  ac_cv_my_have_dlopen=no
-  AC_CHECK_FUNC(dlopen, [
-    ac_cv_my_have_dlopen=yes
-  ], [
-    AC_CHECK_LIB(dl, dlopen, [
-      ac_cv_my_have_dlopen=yes
-      LIBDL="-ldl"
-    ], [
-      AC_CHECK_LIB(svld, dlopen, [
-        ac_cv_my_have_dlopen=yes
-        LIBDL="-lsvld"
-      ])
-    ])
-  ])
-  if test "${ac_cv_my_have_dlopen}" = "yes"; then
-    AC_DEFINE(HAVE_DL_DLOPEN, 1, [Define if you have the dlopen API])
-    ac_cv_have_plugins=yes
-    VLC_ADD_LIBS([libvlccore realvideo lua],[$LIBDL])
-  fi
-fi
+AS_IF([test "$LIBDL" != "no"], [
+  AC_DEFINE(HAVE_DYNAMIC_PLUGINS, 1,
+            [Define to 1 if dynamic plugins are supported.])
+], [
+  dnl Clear $LIBDL so as not to break linking
+  LIBDL=""
+])
 AC_SUBST(LIBDL)
+VLC_ADD_LIBS([realvideo lua],[$LIBDL])
 
+dnl Check for thread library
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
   dnl Check for pthreads - borrowed from XMMS
   THREAD_LIB=error
@@ -790,14 +787,6 @@ AC_CHECK_TYPE(ssize_t,, [
   AC_DEFINE(ssize_t, int)
 ])
 
-dnl Check for poll
-AC_SEARCH_LIBS(poll, [poll], [AC_DEFINE(HAVE_POLL, 1, [Define to 1 if the OS is usabl... err, has poll().])], [
-if test ${SYS} != "mingw32" -a ${SYS} != "mingwce"
-then
-    AC_MSG_WARN([Your platform does not support poll(). VLC has it's own poll() implementation, but it is only intended to be used on Windows. VLC might crash or be insecure when you see this message. Either switch to an OS with a proper poll() implementation, or implement one for your OS in VLC])
-fi
-])
-
 dnl Check for threads library
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
   AC_CHECK_HEADERS(pthread.h)
@@ -3334,18 +3323,19 @@ dnl
 dnl  Windows Direct2D plugin
 dnl
 AC_ARG_ENABLE(direct2d,
-  [  --enable-direct2d         Win7/VistaPU Direct2D support (default auto on Win32)])
-if test "${enable_direct2d}" != "no"; then
-  if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
-  then
-    AC_CHECK_HEADERS(d2d1.h,
-      [
-        VLC_ADD_PLUGIN([direct2d])
-        VLC_ADD_LIBS([direct2d],[-lgdi32 -lole32])
-      ], [AC_MSG_WARN([Cannot find Direct2D headers!])]
-    )
-  fi
-fi
+  [  --enable-direct2d         Win7/VistaPU Direct2D support (default auto on Win32)],, [
+  AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [
+    enable_direct2d="no"
+  ])
+])
+AS_IF([test "${enable_direct2d}" != "no"], [
+  AC_CHECK_HEADERS(d2d1.h, [
+    VLC_ADD_PLUGIN([direct2d])
+    VLC_ADD_LIBS([direct2d],[-lgdi32 -lole32])
+  ], [
+    AC_MSG_WARN([Cannot find Direct2D headers!])
+  ])
+])
 
 dnl
 dnl  win32 GDI plugin
@@ -4203,23 +4193,6 @@ AC_ARG_ENABLE(vlc,
 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
 
 
-dnl
-dnl  Plugin and builtin checks
-dnl
-plugin_support=yes
-
-dnl Automagically disable plugins if there is no system support for
-dnl dynamically loadable files (.so, .dll, .dylib).
-dnl don't forget vlc-win32 still can load .dll as plugins
-AS_IF([test "${ac_cv_have_plugins}" = "no"], [
-  AC_MSG_WARN([*** No plugin support! Building statically! ***])
-  plugin_support=no
-])
-
-AS_IF([test "${plugin_support}" != "no"], [
-  AC_DEFINE(HAVE_DYNAMIC_PLUGINS, 1, [Define if dynamic plugins are supported])
-])
-
 dnl
 dnl Pic and shared libvlc stuff
 dnl