Skip to content
Snippets Groups Projects
configure.ac 127 KiB
Newer Older
  CFLAGS="${CFLAGS} -bundle -undefined error"
  AC_CACHE_CHECK([if $CC accepts -bundle -undefined error],
    [ac_cv_ld_darwin], [
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
      ac_cv_ld_darwin=yes
    ], [
      ac_cv_ld_darwin=no
    ])
  ])
  AS_IF([test "${ac_cv_ld_darwin}" != "no"], [
    VLC_ADD_LDFLAGS([plugin],[-bundle -undefined error])
Samuel Hocevar's avatar
 
Samuel Hocevar committed

dnl Checks for __attribute__(aligned()) directive
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -Werror"
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
    [ac_cv_c_attribute_aligned],
    [ac_cv_c_attribute_aligned=0
    for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
        AC_TRY_COMPILE([],
        [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
        [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
if test "${ac_cv_c_attribute_aligned}" != "0"; then
    AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
        [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
AC_CACHE_CHECK([for __attribute__((packed))],
  [ac_cv_c_attribute_packed],
  [ac_cv_c_attribute_packed=no
   AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
if test "${ac_cv_c_attribute_packed}" != "no"; then
  AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
fi

Samuel Hocevar's avatar
 
Samuel Hocevar committed
dnl
dnl  Check the CPU
dnl
case "${host_cpu}" in
    ARCH="${host_cpu}"
dnl Check for backtrace() support
AC_CHECK_HEADERS(execinfo.h)
AC_CHECK_FUNCS(backtrace)

Samuel Hocevar's avatar
 
Samuel Hocevar committed
dnl
dnl  default modules
dnl
ALIASES="${ALIASES} cvlc rvlc"
gbazin's avatar
 
gbazin committed

dnl
dnl Some plugins aren't useful on some platforms
dnl
if test "${SYS}" = "os2"; then
    VLC_ADD_PLUGIN([dynamicoverlay])
elif test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
    VLC_ADD_PLUGIN([dynamicoverlay access_shm])
elif test "${SYS}" != "mingwce"; then
    VLC_ADD_PLUGIN([access_smb dmo globalhotkeys])
    VLC_ADD_LIBS([dmo],[-lole32 -luuid])
gbazin's avatar
 
gbazin committed
fi
if test "${SYS}" = "darwin"; then
    VLC_ADD_LIBS([quartztext],[-Wl,-framework,ApplicationServices])
Samuel Hocevar's avatar
 
Samuel Hocevar committed
dnl
dnl  Accelerated modules
dnl

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_HELP_STRING([--disable-mmx],
    [disable MMX optimizations (default auto)])],,[
  case "${host_cpu}" in
    i?86|x86_64)
      enable_mmx="yes"
      ;;
    *)
      enable_mmx="no"
      ;;
  esac
])
AS_IF([test "${enable_mmx}" != "no"], [
  ARCH="${ARCH} mmx"
  VLC_SAVE_FLAGS
  CFLAGS="${CFLAGS} -O -mmmx"
  AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
[#include <mmintrin.h>
#include <stdint.h>
uint64_t frobzor;]], [
[__m64 a, b, c;
a = b = c = (__m64)frobzor;
a = _mm_slli_pi16(a, 3);
a = _mm_adds_pi16(a, b);
c = _mm_srli_pi16(c, 8);
c = _mm_slli_pi16(c, 3);
b = _mm_adds_pi16(b, c);
a = _mm_unpacklo_pi8(a, b);
frobzor = (uint64_t)a;]])], [
      ac_cv_c_mmx_intrinsics=yes
    ], [
      ac_cv_c_mmx_intrinsics=no
    ])
  ])
  AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
    AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
  VLC_SAVE_FLAGS
  CFLAGS="${CFLAGS} -mmmx"
  AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
    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.])
  ])

  AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
                 [ac_cv_mmxext_inline], [
    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.])
AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
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_HELP_STRING([--disable-sse],
    [disable SSE (1-4) optimizations (default auto)])],, [
  case "${host_cpu}" in
have_sse2="no"
AS_IF([test "${enable_sse}" != "no"], [
  ARCH="${ARCH} sse sse2"

  VLC_SAVE_FLAGS
  CFLAGS="${CFLAGS} -O -msse2"
  AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
[#include <emmintrin.h>
#include <stdint.h>
uint64_t frobzor;]], [
[__m128i a, b, c;
a = b = c = _mm_set1_epi64((__m64)frobzor);
a = _mm_slli_epi16(a, 3);
a = _mm_adds_epi16(a, b);
c = _mm_srli_epi16(c, 8);
c = _mm_slli_epi16(c, 3);
b = _mm_adds_epi16(b, c);
a = _mm_unpacklo_epi8(a, b);
frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
      ac_cv_c_sse2_intrinsics=yes
    ], [
      ac_cv_c_sse2_intrinsics=no
    ])
  AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
    AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
Samuel Hocevar's avatar
 
Samuel Hocevar committed

  VLC_SAVE_FLAGS
  CFLAGS="${CFLAGS} -msse"
  AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
    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.])
Samuel Hocevar's avatar
 
Samuel Hocevar committed

  AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
    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.])
    have_sse2="yes"
  AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
    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.]) ])
  AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
    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], [
    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], [
    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.]) ])
  AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
    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.]) ])
AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -mmmx"
AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
  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.])
AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
  [AS_HELP_STRING([--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"], [
  VLC_SAVE_FLAGS
  CFLAGS="${CFLAGS} -mfpu=neon"
  AC_CACHE_CHECK([if $CC groks NEON inline assembly], [ac_cv_neon_inline], [
    AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM(,[[
asm volatile("vqmovun.s64 d0, q1":::"d0");
asm volatile("ssat r0, #1, r0":::"r0"); /* assume ARMv6 */
      ac_cv_neon_inline="-mfpu=neon"
  AS_IF([test "$ac_cv_neon_inline" != "no"], [
    NEON_CFLAGS="$ac_cv_neon_inline"
    AC_DEFINE([CAN_COMPILE_NEON], 1, [Define to 1 if NEON (and ARMv6) assembly is available with NEON_CFLAGS.])
], [
  ac_cv_neon_inline="no"
AC_SUBST(NEON_CFLAGS)
AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_neon_inline}" != "no"])
AC_ARG_ENABLE(altivec,
  [AS_HELP_STRING([--disable-altivec],
    [disable AltiVec optimizations (default auto)])],, [
  AS_IF([test "${host_cpu}" = "powerpc"],
        [enable_altivec=yes], [enable_altivec=no])
])
AS_IF([test "${enable_altivec}" = "yes"], [
  ARCH="${ARCH} altivec";
  AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
    [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
         ac_cv_altivec_inline="yes",
Samuel Hocevar's avatar
 
Samuel Hocevar committed
          AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
            [ac_cv_altivec_inline="-Wa,-m7400"],
            ac_cv_altivec_inline=no)
  AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
    AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
              [Define to 1 if AltiVec inline assembly is available.])
    AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
      VLC_ADD_CFLAGS([memcpyaltivec],[${ac_cv_altivec_inline}])
      VLC_ADD_CFLAGS([i420_yuy2_altivec],[${ac_cv_altivec_inline}])
      VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
dnl The AltiVec C extensions
dnl
dnl There are several possible cases:
dnl - OS X PPC, gcc 4.x: use -mpim-altivec -force_cpusubtype_ALL, don't
dnl                      need <altivec.h>
dnl - OS X PPC, gcc 3.x: need -faltivec, don't need <altivec.h>
dnl - Linux PPC, gcc 3.4, 4.x: need <altivec.h> which requires -maltivec
dnl - Linux PPC, gcc 3.3: need <altivec.h> and -maltivec -mabi=altivec
dnl - Linux PPC, gcc 3.x: need <altivec.h> and -fvec
dnl - Others: test should fail
  AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
  [# OS X/PPC test (gcc 4.x)
   CFLAGS="${CFLAGS} -mpim-altivec -force_cpusubtype_ALL"
   AC_TRY_COMPILE([vector unsigned char foo;],
     [vec_ld(0, (unsigned char *)0);],
     [ac_cv_c_altivec="-mpim-altivec -force_cpusubtype_ALL"],
     [# OS X/PPC test (gcc 3.x)
      AC_TRY_COMPILE([vector unsigned char foo;],
        [vec_ld(1 * sizeof(vector float), (unsigned char *)0);],
        [ac_cv_c_altivec="-faltivec"],
        dnl Below this are the Linux tests
        [# Linux/PPC test (gcc 4.x)
         AC_TRY_COMPILE([#include <altivec.h>],
           [vec_ld(0, (unsigned char *)0);],
           [ac_cv_c_altivec="-maltivec"],
           [# Linux/PPC test (gcc 3.3)
            CFLAGS="${CFLAGS} -maltivec -mabi=altivec"
            AC_TRY_COMPILE([#include <altivec.h>],
              [vec_ld(0, (unsigned char *)0);],
              [ac_cv_c_altivec=""
               ac_cv_c_altivec_abi="-maltivec -mabi=altivec"],
              [# Linux/PPC test (gcc 3.3)
               AC_TRY_COMPILE([#include <altivec.h>],
                 [vec_ld(0, (unsigned char *)0);],
                 [ac_cv_c_altivec="-fvec"],
                 [ac_cv_c_altivec=no])
              ])
           ])
        ])
     ])
  ])
  AS_IF([test "${ac_cv_c_altivec}" != "no"], [
    CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
    AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
    VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
    VLC_ADD_CFLAGS([i420_yuy2_altivec memcpyaltivec deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
  VLC_SAVE_FLAGS
  LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
  AC_CACHE_CHECK([if linker needs -framework vecLib],
    [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
  VLC_RESTORE_FLAGS
  AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
    VLC_ADD_LIBS([libvlccore memcpyaltivec],[-Wl,-framework,vecLib])
AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
Samuel Hocevar's avatar
 
Samuel Hocevar committed

Samuel Hocevar's avatar
 
Samuel Hocevar committed
dnl
Samuel Hocevar's avatar
 
Samuel Hocevar committed
dnl
  [AS_HELP_STRING([--with-tuning=ARCH],
    [tune compilation for an architecture (default varies)])])
Samuel Hocevar's avatar
Samuel Hocevar committed
if test -n "${with_tuning}"; then
    if test "${with_tuning}" != "no"; then
        CFLAGS_TUNING="-mtune=${with_tuning}"
    fi
    if test "${SYS}" = "darwin" -a "${host_cpu}" = "i686"; then
        CFLAGS_TUNING="-march=prescott -mtune=generic"
    elif test "${SYS}" = "darwin" -a "${host_cpu}" = "x86_64"; then
        CFLAGS_TUNING="-march=core2 -mtune=core2"
    elif test "${host_cpu}" = "i686" -o "${host_cpu}" = "i586" -o "${host_cpu}" = "i486" -o "${host_cpu}" = "i386"; then
        CFLAGS_TUNING="-mtune=pentium2"
    elif test "${host_cpu}" = "x86_64"; then
        CFLAGS_TUNING="-mtune=athlon64"
    elif test "${host_cpu}" = "powerpc"; then
dnl NOTE: this can't be cached cleanly
AS_IF([test -n "${CFLAGS_TUNING}"], [
  VLC_SAVE_FLAGS
  CFLAGS="${CFLAGS} ${CFLAGS_TUNING}"
  AC_MSG_CHECKING([whether $CC accepts ${CFLAGS_TUNING}])
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], [
    VLC_RESTORE_FLAGS
    AC_MSG_RESULT([no])
    AS_IF([test "${with_tuning}"], [AC_MSG_ERROR([requested tuning not supported])])
Samuel Hocevar's avatar
 
Samuel Hocevar committed

dnl
dnl  Memory usage
dnl
AC_ARG_ENABLE(optimize-memory,
  [AS_HELP_STRING([--enable-optimize-memory],
    [optimize memory usage over performance])])
if test "${enable_optimize_memory}" = "yes"; then
  AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
fi

Pierre Ynard's avatar
Pierre Ynard committed
dnl Allow running as root (useful for people running on embedded platforms)
AC_ARG_ENABLE(run-as-root,
  [AS_HELP_STRING([--enable-run-as-root],
    [allow running VLC as root (default disabled)])])
AS_IF([test "${enable_run_as_root}" = "yes"],[
    AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
Pierre Ynard's avatar
Pierre Ynard committed
              [Define to 1 to allow running VLC as root (uid 0).])
dnl
dnl Stream output
dnl
AC_ARG_ENABLE(sout,
  [AS_HELP_STRING([--disable-sout],
    [disable streaming output (default enabled)])])
AS_IF([test "${enable_sout}" != "no"], [
  AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
])
AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
dnl Lua modules
AC_ARG_ENABLE(lua,
  [AS_HELP_STRING([--disable-lua],
    [disable LUA scripting support (default enabled)])])
if test "${enable_lua}" != "no"
then
  PKG_CHECK_MODULES(LUA, lua5.1,
    AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
    PKG_CHECK_MODULES(LUA, lua >= 5.1,
      [ have_lua=yes ],
        AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
Christophe Mutricy's avatar
Christophe Mutricy committed
          [LUA_LIBS="-llua5.1"],
dionoea's avatar
dionoea committed
            [LUA_LIBS="-llua51"],
            AC_CHECK_LIB( lua , luaL_newstate,
              [LUA_LIBS="-llua"],
              [ have_lua=no
              ], [-lm])
  if test "x${have_lua}" = "xyes" ;  then
     VLC_ADD_LIBS([lua],[$LUA_LIBS])
     VLC_ADD_CFLAGS([lua],[$LUA_CFLAGS])
  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.])
  AC_ARG_VAR([LUAC], [LUA byte compiler])
  AC_PATH_PROGS(LUAC,[${LUAC} luac], [false])
  AS_IF([test "${LUAC}" = "false"], [
    AC_MSG_ERROR([Could not find the LUA byte compiler.])
  ])
AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
dnl
dnl HTTP daemon
dnl
AC_ARG_ENABLE(httpd,
  [AS_HELP_STRING([--disable-httpd],
    [disable the built-in HTTP server (default enabled)])])
if test "${enable_httpd}" != "no"
then
Ilkka Ollakka's avatar
Ilkka Ollakka committed
  AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
dnl
dnl VideoLAN manager
dnl
AC_ARG_ENABLE(vlm,
  [AS_HELP_STRING([--disable-vlm],
    [disable the stream manager (default enabled)])],,
  [enable_vlm="${enable_sout}"])
AS_IF([test "${enable_vlm}" != "no"], [
  AS_IF([test "${enable_sout}" = "no"], [
    AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
  ])
  AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
])
AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
Samuel Hocevar's avatar
 
Samuel Hocevar committed
dnl
Samuel Hocevar's avatar
 
Samuel Hocevar committed
dnl  Input plugins
Samuel Hocevar's avatar
 
Samuel Hocevar committed
dnl

EXTEND_HELP_STRING([Input plugins:])
Samuel Hocevar's avatar
 
Samuel Hocevar committed

dnl
dnl libproxy support
dnl
AC_ARG_ENABLE(libproxy,
  [AS_HELP_STRING([--enable-libproxy],[support libproxy (default auto)])])
AS_IF([test "${enable_libproxy}" != "no"], [
  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 -n "${enable_libproxy}"], [
      AC_MSG_ERROR([${LIBPROXY_PKG_ERRORS}.])
dnl  live555 input
AC_ARG_ENABLE(live555,
  [AS_HELP_STRING([--enable-live555],
    [enable RTSP input through live555 (default enabled)])])
AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
  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 1324598400 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 < 1324598400)
# 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 2011.12.23 or later is required to proceed.
You can get an updated one from http://www.live555.com/liveMedia .])
    AS_IF([test -n "${enable_live555}"], [
      AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
    ])
  ], [
    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])
      VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
    ],[
      AC_CHECK_LIB(liveMedia, main, [
        VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
      ],[],[${other_libs}])],[${other_libs_pic}])
  ])
dnl - special access module for dc1394 input
dnl - dv module: digital video module check for libraw1394
dnl - linsys modules: access module check for libzvbi
PKG_ENABLE_MODULES_VLC([DC1394], [], [libraw1394 >= 2.0.1 libdc1394-2 >= 2.1.0], [dc1394 access module], [auto])
Christophe Mutricy's avatar
Christophe Mutricy committed
PKG_ENABLE_MODULES_VLC([DV], [access_dv], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV input module], [auto])
AC_ARG_ENABLE(linsys,
  [AS_HELP_STRING([--enable-linsys],
    [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
if test "$SYS" = "linux" -a "${enable_linsys}" != "no"; then
  VLC_ADD_PLUGIN([linsys_hdsdi])
  PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28],
    [ VLC_ADD_LIBS([linsys_sdi],[$LINSYS_SDI_LIBS])
      VLC_ADD_CFLAGS([linsys_sdi],[$LINSYS_SDI_CFLAGS])
      VLC_ADD_PLUGIN([linsys_sdi]) ],
    [AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])]
dnl
dnl dvdread module: check for libdvdread
dnl
PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread], [dvdread input module], [auto])
gbazin's avatar
 
gbazin committed
dnl
gbazin's avatar
 
gbazin committed
dnl
AC_ARG_ENABLE(dvdnav,
  [AS_HELP_STRING([--disable-dvdnav],
    [disable DVD navigation with libdvdnav (default auto)])])
if test "${enable_dvdnav}" != "no"
gbazin's avatar
 
gbazin committed
then
  PKG_CHECK_MODULES(DVDNAV, dvdnav, [
    VLC_ADD_PLUGIN([dvdnav])
    VLC_ADD_CFLAGS([dvdnav],[${DVDNAV_CFLAGS}])
    VLC_ADD_LIBS([dvdnav],[${DVDNAV_LIBS}])
    AC_CHECK_LIB(dvdnav, dvdnav_get_video_resolution,
      AC_DEFINE(HAVE_DVDNAV_GET_VIDEO_RESOLUTION, 1, [Define if you have dvdnav_get_video_resolution.]),
        [], [${LIBS_dvdnav}])
    AC_CHECK_LIB(dvdnav, dvdnav_describe_title_chapters,
      AC_DEFINE(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS, 1, [Define if you have dvdnav_describe_title_chapters.]),
        [], [${LIBS_dvdnav}])],
      [AC_MSG_WARN([${DVDNAV_PKG_ERRORS}.])])
gbazin's avatar
 
gbazin committed
fi

gbazin's avatar
 
gbazin committed
dnl
dnl  Windows DirectShow access module
dnl
AC_ARG_ENABLE(dshow,
  [AS_HELP_STRING([--disable-dshow],
    [support DirectShow (default auto)])])
gbazin's avatar
 
gbazin committed
if test "${enable_dshow}" != "no"
then
  if test "${SYS}" = "mingw32"
gbazin's avatar
 
gbazin committed
  then
gbazin's avatar
 
gbazin committed
      AC_CHECK_HEADERS(dshow.h,
      [ VLC_ADD_PLUGIN([dshow])
        VLC_ADD_CXXFLAGS([dshow],[])
        VLC_ADD_LIBS([dshow],[-lole32 -loleaut32 -luuid -lstrmiids -lksuser])])
gbazin's avatar
 
gbazin committed
  fi
fi

dnl
dnl  Blu-ray Disc Support with libbluray
dnl
PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2.1], (libbluray for Blu-ray disc support ) )
dnl
dnl  OpenCV wrapper and example filters
dnl
PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv], (OpenCV (computer vision) filter), [off])
dnl
dnl  libsmbclient plugin
dnl
AC_ARG_ENABLE(smb,
  [AS_HELP_STRING([--disable-smb], [disable SMB/CIFS support (default auto)])])
if test "${enable_smb}" != "no"; then
  AC_CHECK_HEADERS(libsmbclient.h,
    [ VLC_ADD_PLUGIN([access_smb])
      VLC_ADD_LIBS([access_smb],[-lsmbclient]) ],
    [ if test -n "${enable_smb}"; then
        AC_MSG_ERROR([cannot find libsmbclient headers])
     fi ])
ivoire's avatar
ivoire committed

dnl
dnl sftp access support
dnl
AC_ARG_ENABLE(sftp,
  [AS_HELP_STRING([--enable-sftp],
    [support SFTP file transfer via libssh2 (default disabled)])])
ivoire's avatar
ivoire committed
if test "${enable_sftp}" = "yes"; then
  AC_CHECK_HEADERS(libssh2.h, [
    VLC_ADD_PLUGIN([access_sftp])
    VLC_ADD_LIBS([access_sftp], [-lssh2])
  ])
fi

dnl  Video4Linux 2
AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
  [disable Video4Linux version 2 (default auto)])])
AC_ARG_ENABLE(pvr, [AS_HELP_STRING([--enable-pvr],
  [support PVR V4L2 cards (default disabled)])])
have_v4l2="no"
AS_IF([test "$enable_v4l2" != "no"], [
  AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
    have_v4l2="yes"
  ])
])
AS_IF([test "$have_v4l2" = "yes"], [
  PKG_CHECK_MODULES(LIBV4L2, libv4l2, [
    AC_DEFINE(HAVE_LIBV4L2, 1, [Define to 1 if libv4l2 is available])
  ], [
    AC_MSG_WARN([${LIBV4L2_PKG_ERRORS}.])
  ])
  AS_IF([test "${enable_pvr}" = "yes"], [
    VLC_ADD_PLUGIN([pvr])
  ])
])
AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
dnl
dnl special access module for Blackmagic SDI cards
dnl
AC_ARG_ENABLE(decklink,
  [AS_HELP_STRING([--disable-decklink],
    [disable Blackmagic DeckLink SDI input (default auto)])])
AC_ARG_WITH(decklink_sdk,
  [AS_HELP_STRING[--with-decklink-sdk=DIR],
    [                        location of Blackmagic DeckLink SDI SDK])])
if test "${enable_decklink}" != "no"
then
  if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
  then
    VLC_ADD_CPPFLAGS([decklink],[-I${with_decklink_sdk}/include])
  fi
  VLC_SAVE_FLAGS
  CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
  AC_LANG_PUSH(C++)
  AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
    VLC_ADD_PLUGIN([decklink])
  ],[AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)])
  AC_LANG_POP(C++)
bigben's avatar
bigben committed
dnl
dnl  gnomeVFS access module
dnl
PKG_ENABLE_MODULES_VLC([GNOMEVFS], [access_gnomevfs], [gnome-vfs-2.0], [GnomeVFS access module], [auto])
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
dnl  VCDX modules
  [AS_HELP_STRING([--enable-vcdx],
    [navigate VCD with libvcdinfo (default disabled)])])
if test "${enable_vcdx}" = "yes"
then
    PKG_CHECK_MODULES(LIBCDIO, [libcdio >= 0.78.2 libiso9660 >= 0.72],
      [VLC_ADD_LIBS([vcdx],[$LIBCDIO_LIBS])
         VLC_ADD_CFLAGS([vcdx],[$LIBCDIO_CFLAGS])],
        [AC_MSG_ERROR([${LIBCDIO_PKG_ERRORS} (required for vcdx plugin).])])
    PKG_CHECK_MODULES(LIBVCDINFO, libvcdinfo >= 0.7.22,
        [VLC_ADD_LIBS([vcdx],[$LIBVCDINFO_LIBS])
         VLC_ADD_CFLAGS([vcdx],[$LIBVCDINFO_CFLAGS])],
      [AC_MSG_ERROR([${LIBVCDINFO_PKG_ERRORS} (required for vcdx plugin).])])
    VLC_ADD_PLUGIN([vcdx])
dnl  Built-in CD-DA and VCD module
dnl
AC_ARG_ENABLE(vcd,
  [AS_HELP_STRING([--disable-vcd],
    [disable built-in VCD and CD-DA support (default enabled)])])
  [AS_HELP_STRING([--disable-libcddb],
    [disable CDDB for Audio CD (default enabled)])])
if test "${enable_vcd}" != "no"
Samuel Hocevar's avatar
 
Samuel Hocevar committed
then
  AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
Samuel Hocevar's avatar
 
Samuel Hocevar committed
  AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
    VLC_ADD_PLUGIN([vcd cdda])
Samuel Hocevar's avatar
 
Samuel Hocevar committed
  ])
  AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
  AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
    VLC_ADD_PLUGIN([vcd cdda])
    AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
  AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
  AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
    VLC_ADD_PLUGIN([vcd cdda])
    AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
  if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2"
Samuel Hocevar's avatar
 
Samuel Hocevar committed
  then
    VLC_ADD_PLUGIN([vcd cdda])
Samuel Hocevar's avatar
 
Samuel Hocevar committed
  fi
  if test "${SYS}" = "darwin"
Samuel Hocevar's avatar
 
Samuel Hocevar committed
  then
    VLC_ADD_PLUGIN([vcd cdda])
    VLC_ADD_LIBS([vcd vcdx cdda],[-Wl,-framework,IOKit,-framework,CoreFoundation])
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
    VLC_ADD_LIBS([vcdx cdda],[-liconv])
Samuel Hocevar's avatar
 
Samuel Hocevar committed
  fi

  if test "$enable_libcddb" != "no"; then
    PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
      HAVE_LIBCDDB=yes
      AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
      VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
      VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
      ],:
      [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
      HAVE_LIBCDDB=no])
  fi
dnl
dnl Linux DVB
dnl
AC_CACHE_CHECK([for Linux DVB version 5], [ac_cv_linux_s2api], [
  AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
[#include <linux/dvb/version.h>
#if (DVB_API_VERSION < 5)
EXPLODE
#endif]])], [
  ac_cv_linux_s2api=yes
], [
  ac_cv_linux_s2api=no
])])
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_s2api" = "yes"])
dnl
dnl  Screen capture module
dnl
AC_ARG_ENABLE(screen,
  [AS_HELP_STRING([--enable-screen],
    [disable screen capture (default enabled)])])
Eric Petit's avatar
Eric Petit committed
  if test "${SYS}" = "darwin"; then
    AC_CHECK_HEADERS(OpenGL/gl.h, [
      AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
        VLC_ADD_PLUGIN([screen])
        VLC_ADD_LIBS([screen],[-Wl,-framework,OpenGL,-framework,ApplicationServices])
Eric Petit's avatar
Eric Petit committed
  elif test "${SYS}" = "mingw32"; then
    VLC_ADD_PLUGIN([screen])
    VLC_ADD_LIBS([screen],[-lgdi32])
AC_ARG_ENABLE(realrtsp,
  [  --enable-realrtsp       Real RTSP module (default disabled)])
if test "${enable_realrtsp}" = "yes"; then
  VLC_ADD_PLUGIN([access_realrtsp])