]> git.sesse.net Git - vlc/blobdiff - configure.ac
inet_ntop always returns NULL on Windows.
[vlc] / configure.ac
index 74172148c9436ceb0377dd2cc5dd02a10eb08f6c..e6b30edb521c93dc92d1543f9007af6a51a09aef 100644 (file)
@@ -126,7 +126,7 @@ case "${host_os}" in
     dnl Force gcc "-arch" flag
     ARCH_flag=""
     case "${host}" in
-      i386*)
+      i?86*)
         ARCH_flag="-arch i386"
       ;;
       ppc64*)
@@ -158,28 +158,24 @@ case "${host_os}" in
     AC_ARG_WITH(macosx-sdk,
       [AS_HELP_STRING([--with-macosx-sdk=DIR],
         [compile using the SDK in DIR])])
-    test "${with_macosx_sdk}" = "" && with_macosx_sdk=/Developer/SDKs/MacOSX10.5.sdk
+    test "${with_macosx_sdk}" = "" && with_macosx_sdk=/Developer/SDKs/MacOSX10.6.sdk
     ! test -d "${with_macosx_sdk}" && AC_MSG_ERROR([SDK "${with_macosx_sdk}" not found])
-    CPP="${CPP} -isysroot ${with_macosx_sdk}"
-    CC="${CC} -isysroot ${with_macosx_sdk}"
-    CXX="${CXX} -isysroot ${with_macosx_sdk}"
-    OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
-    LD="${LD} -syslibroot ${with_macosx_sdk}"
     AC_ARG_WITH(macosx-version-min,
       [AS_HELP_STRING([--with-macosx-version-min=VERSION],
         [compile for MacOS X VERSION and above])])
-    if test "${with_macosx_version_min}" != "" ; then
-        CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
-        CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
-        CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
-        OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
-        LD="${LD} -macosx_version_min=${with_macosx_version_min}"
-        CFLAGS="${CFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
-        CXXFLAGS="${CXXFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
-        OBJCFLAGS="${OBJCFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
-        MACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}
-        export MACOSX_DEPLOYMENT_TARGET
+    if test "${with_macosx_version_min}" = "" ; then
+       with_macosx_version_min=10.5
     fi
+    MACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}
+    CPP="${CPP} -isysroot ${with_macosx_sdk} -mmacosx-version-min=${with_macosx_version_min}"
+    CC="${CC} -isysroot ${with_macosx_sdk} -mmacosx-version-min=${with_macosx_version_min}"
+    CXX="${CXX} -isysroot ${with_macosx_sdk} -mmacosx-version-min=${with_macosx_version_min}"
+    OBJC="${OBJC} -isysroot ${with_macosx_sdk} -mmacosx-version-min=${with_macosx_version_min}"
+    LD="${LD} -syslibroot ${with_macosx_sdk} -mmacosx_version_min=${with_macosx_version_min}"
+    CFLAGS="${CFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
+    CXXFLAGS="${CXXFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
+    OBJCFLAGS="${OBJCFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
+    export MACOSX_DEPLOYMENT_TARGET
     ;;
   *mingw32* | *cygwin* | *wince* | *mingwce*)
     AC_CHECK_TOOL(WINDRES, windres, :)
@@ -480,11 +476,26 @@ need_libc=false
 dnl Check for usual libc functions
 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
 AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r if_nameindex if_nametoindex isatty lstat memalign mmap openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp uselocale])
-AC_REPLACE_FUNCS([asprintf atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r inet_pton lldiv localtime_r nrand48 rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy vasprintf])
+AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r inet_pton lldiv localtime_r nrand48 rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy])
 AC_CHECK_FUNCS(fdatasync,,
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
 ])
 
+dnl mingw64 implements those as static inline, not functions with C linkage
+AC_LINK_IFELSE([
+    AC_LANG_PROGRAM([#include <stdio.h>], [
+        char *c;
+        if (asprintf(&c, "%s %d", "string", 1) == -1)
+            c = NULL;
+    ])],[AC_DEFINE([HAVE_ASPRINTF],[1],[Define to 1 if you have asprintf function])],[AC_LIBOBJ([asprintf])])
+AC_LINK_IFELSE([
+    AC_LANG_PROGRAM([#include <stdio.h>], [
+        char *c;
+        va_list ap;
+        if (vasprintf(&c, "%s %d", ap) == -1)
+            c = NULL;
+    ])],[AC_DEFINE([HAVE_VASPRINTF],[1],[Define to 1 if you have asprintf function])],[AC_LIBOBJ([vasprintf])])
+
 # Windows CE does not have strcoll()
 AC_FUNC_STRCOLL
 
@@ -535,7 +546,7 @@ AC_SUBST(SOCKET_LIBS)
 
 dnl Check for socklen_t
 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
-AC_CACHE_CHECK([for socklen_t in sys/socket.h],
+AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
 ac_cv_type_socklen_t,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
 [#include <sys/types.h>
@@ -551,8 +562,8 @@ AS_IF([test "$ac_cv_type_socklen_t" = no],
  [AC_DEFINE(socklen_t, int)])
 
 dnl Check for struct sockaddr_storage
-AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.])
-AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.])
+AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
+AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
   [AC_TRY_COMPILE(
     [#include <sys/types.h>
@@ -633,23 +644,13 @@ 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
-  if test "${THREAD_LIB}" = "error"; then
-    AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
-  fi
-  if test "${THREAD_LIB}" = "error"; then
-    AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
-  fi
-  if test "${THREAD_LIB}" = "error"; then
-    AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
-  fi
-  if test "${THREAD_LIB}" = "error"; then
-    AC_CHECK_FUNCS(pthread_mutex_lock)
-    THREAD_LIB=""
-  fi
 
-  VLC_ADD_LIBS([libvlccore libvlc vlc plugin],[${THREAD_LIB}])
+  VLC_SAVE_FLAGS
+  LIBS=""
+  AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
+    VLC_ADD_LIBS([libvlccore libvlc vlc plugin],[${LIBS}])
+  ])
+  VLC_RESTORE_FLAGS
 
   AC_CHECK_LIB(rt, clock_nanosleep, [
     VLC_ADD_LIBS([libvlccore],[-lrt])
@@ -698,7 +699,7 @@ if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
 fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
 
 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
-AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.])
+AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
 AC_CHECK_TYPE(ssize_t,, [
   AC_DEFINE(ssize_t, int)
 ])
@@ -879,11 +880,11 @@ AS_IF([test "${enable_coverage}" != "no"], [
   LDFLAGS="-lgcov ${LDFLAGS}"
 ])
 
-VLC_SAVE_FLAGS
-CFLAGS="${CFLAGS} -fvisibility=hidden"
-CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
-OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [
+  VLC_SAVE_FLAGS
+  CFLAGS="${CFLAGS} -fvisibility=hidden"
+  CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
+  OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
                  [ac_cv_c_visibility_hidden], [
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
@@ -1796,7 +1797,7 @@ fi
 dnl
 dnl  Blu-ray Disc Support with libbluray
 dnl
-PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2 libxml-2.0 >= 2.6 ], (libbluray for Blu-ray disc support ) )
+PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2.1], (libbluray for Blu-ray disc support ) )
 
 dnl
 dnl  OpenCV wrapper and example filters
@@ -3558,62 +3559,6 @@ dnl
 
 EXTEND_HELP_STRING([Interface plugins:])
 
-dnl
-dnl Skins2 module
-dnl
-AC_ARG_ENABLE(skins2,
-  [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
-AS_IF([test "${enable_skins2}" != "no"], [
-  have_skins_deps="yes"
-
-  dnl Win32
-  AS_IF([test "${SYS}" = "mingw32"], [
-    VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -Imodules/gui/skins2 -DWIN32_SKINS])
-    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
-    VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
-  dnl MacOS
-  ], [test "${SYS}" = "darwin"], [
-    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 -DMACOSX_SKINS])
-    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
-    VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
-  dnl Linux/Unix
-  ], [
-    PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
-    PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
-    PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
-    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 ${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
-    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
-    VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
-  ])
-
-  dnl we need freetype
-  AS_IF([test "${have_freetype}" != "yes"], [
-    have_skins_deps="no"
-  ])
-
-  AS_IF([test "${have_skins_deps}" = "no"], [
-    AS_IF([test "x${enable_skins2}" = "x"], [
-      AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
-    ], [
-      AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
-    ])
-    enable_skins2="no"
-  ], [
-    VLC_ADD_PLUGIN([skins2])
-    ALIASES="${ALIASES} svlc"
-    enable_skins2="yes"
-  ])
-])
-AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
-
-AC_ARG_ENABLE(libtar,
-  [  --enable-libtar         libtar support for skins2 (default auto)])
-AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
-  AC_CHECK_HEADERS(libtar.h, [
-    VLC_ADD_LIBS([skins2],[-ltar])
-  ])
-])
-
 dnl
 dnl Hildon UI
 dnl
@@ -3698,8 +3643,69 @@ AM_CONDITIONAL(ENABLE_QT4, [test "x$enable_qt4" != "xno"])
 dnl
 dnl Simple test for skins2 dependency
 dnl
-AS_IF([test "${enable_skins2}" != "no" && test "x$enable_qt4" = "xno"], [
-  AC_MSG_ERROR([The skins2 module depends on a the Qt4 development package. Without it you will not 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.])
+AS_IF([test "x$enable_qt4" = "xno"], [
+  AS_IF([test "${enable_skins2}" = "yes"], [
+    AC_MSG_ERROR([The skins2 module depends on the Qt4 interface. Without it you will not 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.])
+  ], [
+    enable_skins2="no"
+    AC_MSG_WARN([The skins2 module depends on the Qt4 interface, Qt4 is not built so skins2 is disabled.])
+  ])
+])
+
+dnl
+dnl Skins2 module
+dnl
+AC_ARG_ENABLE(skins2,
+  [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
+AS_IF([test "${enable_skins2}" != "no"], [
+  have_skins_deps="yes"
+
+  dnl Win32
+  AS_IF([test "${SYS}" = "mingw32"], [
+    VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -Imodules/gui/skins2 -DWIN32_SKINS])
+    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
+    VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
+  dnl MacOS
+  ], [test "${SYS}" = "darwin"], [
+    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 -DMACOSX_SKINS])
+    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
+    VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
+  dnl Linux/Unix
+  ], [
+    PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
+    PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
+    PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
+    VLC_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 ${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
+    VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
+    VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
+  ])
+
+  dnl we need freetype
+  AS_IF([test "${have_freetype}" != "yes"], [
+    have_skins_deps="no"
+  ])
+
+  AS_IF([test "${have_skins_deps}" = "no"], [
+    AS_IF([test "x${enable_skins2}" = "x"], [
+      AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
+    ], [
+      AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
+    ])
+    enable_skins2="no"
+  ], [
+    VLC_ADD_PLUGIN([skins2])
+    ALIASES="${ALIASES} svlc"
+    enable_skins2="yes"
+  ])
+])
+AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
+
+AC_ARG_ENABLE(libtar,
+  [  --enable-libtar         libtar support for skins2 (default auto)])
+AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
+  AC_CHECK_HEADERS(libtar.h, [
+    VLC_ADD_LIBS([skins2],[-ltar])
+  ])
 ])
 
 dnl
@@ -3747,31 +3753,27 @@ dnl
 dnl  ncurses module
 dnl
 AC_ARG_ENABLE(ncurses,
-  [  --disable-ncurses       ncurses interface support (default disabled)],
-  [if test "${enable_ncurses}" != "no"; then
-    AC_CHECK_HEADER(ncurses.h,
-      [AC_CHECK_LIB(ncursesw, mvprintw,
-        [VLC_ADD_PLUGIN([ncurses])
-        VLC_ADD_LIBS([ncurses],[-lncursesw])
+[AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
+if test "${enable_ncurses}" != "no"; then
+  VLC_SAVE_FLAGS
+  LIBS=""
+  AC_CHECK_HEADER(ncurses.h, [
+    AC_CHECK_LIB(ncursesw, mvprintw, [
+      AC_SEARCH_LIBS([tgetent], [ncursesw tinfow tinfo], [
+        VLC_ADD_PLUGIN([ncurses])
         ALIASES="${ALIASES} nvlc"
-        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 "${enable_ncurses}" = "yes"],
-                [AC_MSG_ERROR([tgetent not found in ncursesw tinfow tinfo]
-               )])])
-            ]
-          )
-        )
-        ],
-          [AS_IF([test "${enable_ncurses}" = "yes"], [
-            AC_MSG_ERROR([libncursesw not found])])]
-        )],
-        [AS_IF([test "${enable_ncurses}" = "yes"], [
-          AC_MSG_ERROR([ncurses.h not found])])]
-        )
-  fi]
-)
+        VLC_ADD_LIBS([ncurses],[-lncursesw ${LIBS}])
+      ], [
+        AS_IF([test "${enable_ncurses}" = "yes"], [AC_MSG_ERROR([tgetent not found])])
+      ])
+    ], [
+      AS_IF([test "${enable_ncurses}" = "yes"], [AC_MSG_ERROR([libncursesw not found])])
+    ])
+  ], [
+    AS_IF([test "${enable_ncurses}" = "yes"], [AC_MSG_ERROR([ncurses.h not found])])
+  ])
+  VLC_RESTORE_FLAGS
+fi
 
 dnl
 dnl  XOSD plugin
@@ -4057,7 +4059,7 @@ AC_ARG_WITH(kde-solid,
   AS_HELP_STRING([--with-kde-solid=PATH],
                  [KDE Solid actions directory (auto)]),, [
 
-if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" ; then
+if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" -a "${SYS}" != "darwin" ; then
   with_kde_solid="yes"
 fi
 ])
@@ -4172,6 +4174,7 @@ AC_CONFIG_FILES([
   modules/access/Makefile
   modules/access/bd/Makefile
   modules/access/dshow/Makefile
+  modules/access/dvb/Makefile
   modules/access/mms/Makefile
   modules/access/rtp/Makefile
   modules/access/rtsp/Makefile