Newer
Older
[ac_cv_cxx_locale_t=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <locale>]], [[locale_t loc;]])],
[ac_cv_cxx_locale_t=yes],[])])
if test "${ac_cv_cxx_locale_t}" != "no"; then
AC_DEFINE(HAVE_CXX_LOCALE_T, 1, Define to 1 if C++ headers define locale_t)
fi
AC_LANG_POP(C++)
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.]) dnl ` (fix VIM syntax highlight
AC_CHECK_TYPE(ssize_t,, [
AC_DEFINE(ssize_t, int)
])
dnl It seems that autoconf detects pkg-config only during the first
dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
dnl it is nested within a conditional block, so it was not working right.
AS_IF([test -n "${PKG_CONFIG}" ],[
AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
PKG_CONFIG="${PKG_CONFIG} --static"
])
])
dnl Check for zlib.h and -lz if available
have_zlib="no"
AC_CHECK_HEADERS([zlib.h], [
AC_CHECK_LIB([z], [inflate], [
have_zlib=yes
AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if you have zlib.])
LIBZ="-lz"
])
AM_CONDITIONAL([HAVE_ZLIB], [ test "${have_zlib}" = "yes" ])
dnl
dnl Domain name i18n support via GNU libidn
dnl
PKG_CHECK_MODULES([IDN], [libidn], [
have_libidn="yes"
AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
], [
have_libidn="no"
])
dnl Check for dbus
AC_ARG_ENABLE([dbus],
AS_HELP_STRING([--enable-dbus],
[compile D-Bus message bus support (default enabled)]))
have_dbus="no"
AS_IF([test "${enable_dbus}" != "no"], [
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
have_dbus="yes"
], [
AS_IF([test -n "${enable_dbus}"], [
AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
], [
AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
])
])
])
AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
dnl Check for systemd
PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [
have_systemd="yes"
], [
AC_MSG_WARN([${SYSTEMD_PKG_ERRORS}.])
])
AM_CONDITIONAL([HAVE_SYSTEMD], [test "${have_systemd}" = "yes"])
EXTEND_HELP_STRING([Optimization options:])
dnl
dnl Compiler warnings
dnl
AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -Wformat -Wformat-security -Wduplicated-branches -Wduplicated-cond], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -Wformat -Wformat-security -Wduplicated-branches -Wduplicated-cond], [CXXFLAGS])
dnl -Werror-implicit-function-declaration is used for the if_nametoindex detection with winstore
AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Werror-implicit-function-declaration -Winit-self -Wlogical-op -Wshadow=local -Wmultistatement-macros], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-pipe], [CFLAGS])
dnl UWP forbidden checks
AS_IF([test "${SYS}" = "mingw32"], [
AC_MSG_CHECKING(for if_nametoindex availability)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <windows.h>
#if defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 6
# include <wincrypt.h>
#endif
#include <iphlpapi.h>
static void test (void) {
if_nametoindex("");
}
]],[[;]])
],[
AC_MSG_RESULT([present])
AC_DEFINE([HAVE_IF_NAMETOINDEX], [1], [Define to 1 if you have if_nametoindex function])
],[
AC_MSG_RESULT([not present])
])
])
dnl
dnl Debugging mode
dnl
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--disable-debug],
[disable run-time assertions (default enabled)]),,
[enable_debug="yes"])
AH_TEMPLATE(NDEBUG,
[Define to 1 if debug code should NOT be compiled])
AS_IF([test "${enable_debug}" != "no"], [
AC_CHECK_HEADERS([valgrind/valgrind.h])
], [
AC_DEFINE(NDEBUG)
])
dnl
dnl Profiling
dnl
AC_ARG_ENABLE([gprof],
AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)]),,
[enable_gprof="no"])
AS_IF([test "${enable_gprof}" != "no"], [
CFLAGS="${CFLAGS} -pg"
CXXFLAGS="${CXXFLAGS} -pg"
OBJCFLAGS="${OBJCFLAGS} -pg"
LDFLAGS="${LDFLAGS} -pg"
])
AC_ARG_ENABLE([cprof],
AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)]),,
[enable_cprof="no"])
AS_IF([test "${enable_gprof}" != "no"], [
CFLAGS="${CFLAGS} -finstrument-functions"
CXXFLAGS="${CXXFLAGS} -finstrument-functions"
OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
LDFLAGS="${LDFLAGS} -finstrument-functions"
])
dnl
dnl Test coverage
dnl
AC_ARG_ENABLE([coverage],
AS_HELP_STRING([--enable-coverage],
[build for test coverage (default disabled)]),,
[enable_coverage="no"])
AS_IF([test "${enable_coverage}" != "no"], [
CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
LDFLAGS="-lgcov ${LDFLAGS}"
])
AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
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()], [
ac_cv_c_visibility_hidden=yes
], [
ac_cv_c_visibility_hidden=no
])
])
AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
dnl
dnl Sanitizer flags
dnl
AC_ARG_WITH([sanitizer],
AS_HELP_STRING([--with-sanitizer=(address/memory/undefined/thread)],
[build with sanitizer flags (default disabled)]),
[],
[with_sanitizer=no])
AS_VAR_IF(with_sanitizer, no, [], [
AX_CHECK_COMPILE_FLAG([-fsanitize=${with_sanitizer}], [
AX_APPEND_FLAG([-fsanitize=${with_sanitizer}])
AX_APPEND_FLAG([-fsanitize=${with_sanitizer}], [CXXFLAGS])
AX_APPEND_FLAG([-fsanitize=${with_sanitizer}], [LDFLAGS])
], [
AC_MSG_ERROR(["-fsanitize=${with_sanitizer} not supported!"])
])
AX_APPEND_FLAG([-g])
AX_APPEND_FLAG([-g], [CXXFLAGS])
AS_IF([test -z "${with_sanitizer##*address*}" ], [
AX_APPEND_COMPILE_FLAGS([-fsanitize-address-use-after-scope -fno-omit-frame-pointer -fsanitize=pointer-compare -fsanitize=pointer-subtract])
AX_APPEND_COMPILE_FLAGS([-fsanitize-address-use-after-scope -fno-omit-frame-pointer -fsanitize=pointer-compare -fsanitize=pointer-subtract], [CXXFLAGS])
dnl
dnl Enable/disable optimizations
dnl
AC_ARG_ENABLE([optimizations],
AS_HELP_STRING([--disable-optimizations],
[disable compiler optimizations (default enabled)]),,
[enable_optimizations="yes"])
AS_IF([test "${enable_optimizations}" != "no"], [
dnl -O3 only in production builds
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -O3"
CXXFLAGS="${CXXFLAGS} -O3"
OBJCFLAGS="${OBJCFLAGS} -O3"
AC_CACHE_CHECK([if $CC accepts -O3], [ac_cv_c_o3], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
dnl Check for fast maths
AX_APPEND_COMPILE_FLAGS([-fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range], [CXXFLAGS])
AH_BOTTOM([
#if defined(_MSC_VER) && !defined(__clang__)
# pragma fenv_access(off)
# pragma fp_contract(on)
#elif defined(__GNUC__)
/* Not supported so far */
#else
# pragma STDC FENV_ACCESS OFF
# pragma STDC FP_CONTRACT ON
#endif
])
dnl Check for -funroll-loops
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -funroll-loops"
CXXFLAGS="${CXXFLAGS} -funroll-loops"
OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
ac_cv_c_unroll_loops=yes
], [
ac_cv_c_unroll_loops=no
])
])
AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
AS_IF([test "$enable_debug" = "no"], [
dnl Check for -fomit-frame-pointer
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -fomit-frame-pointer"
CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
[ac_cv_c_omit_frame_pointer], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
ac_cv_c_omit_frame_pointer=yes
], [
ac_cv_c_omit_frame_pointer=no
])
])
AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
AC_ARG_ENABLE([ssp],
AS_HELP_STRING([--disable-ssp],
[disable stack smashing protection (default enabled for optimized builds)]), [],
[enable_ssp="yes"])
AS_IF([test "${enable_ssp}" != "no" -a "${enable_optimizations}" != "no"], [
VLC_SAVE_FLAGS
AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])
AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong], [CXXFLAGS])
dnl Win32 requires linking to ssp for stack-protection
AS_IF([test "${SYS}" = "mingw32"], [
LDFLAGS="${LDFLAGS} -lssp"
AC_CACHE_CHECK([if linker supports stack protectors], [ac_cv_ld_ssp], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[char buf[100]; fgets(buf, sizeof(buf), stdin);]])],[
ac_cv_ld_ssp="yes"
], [
ac_cv_ld_ssp="no"
])
])
AS_IF([test "${ac_cv_ld_ssp}" = "no"], [VLC_RESTORE_FLAGS])
])
VLC_SAVE_FLAGS
LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[
ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
], [
ac_cv_ld_bsymbolic=""
])
])
VLC_RESTORE_FLAGS
SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
VLC_SAVE_FLAGS
LDFLAGS="${LDFLAGS} -Wl,-z,defs"
AC_CACHE_CHECK([if linker supports -z,defs], [ac_cv_ld_z_defs], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[
ac_cv_ld_z_defs="yes"
], [
ac_cv_ld_z_defs="no"
])
])
AS_IF([test "${ac_cv_ld_z_defs}" = "no"], [VLC_RESTORE_FLAGS])
damienf
committed
dnl Check for __attribute__((packed))
AC_CACHE_CHECK([for __attribute__((packed))],
[ac_cv_c_attribute_packed],
[ac_cv_c_attribute_packed=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
[[struct __attribute__((__packed__)) foo { int a; } b; (void)b;]])],
[ac_cv_c_attribute_packed=yes],[])])
if test "${ac_cv_c_attribute_packed}" != "no"; then
AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
fi
Samuel Hocevar
committed
ARCH=unknown
;;
armv*)
ARCH="arm"
host_cpu="arm"
;;
Samuel Hocevar
committed
*)
Samuel Hocevar
committed
;;
esac
dnl Check for backtrace() support
AC_CHECK_FUNCS([backtrace],, [
AC_CHECK_LIB([execinfo], [backtrace], [
LIBEXECINFO="-lexecinfo"])
])
AC_SUBST(LIBEXECINFO)
dnl We need support for -msse2, we need <emmintrin.h>, and we also need a
dnl working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
AC_ARG_ENABLE([sse],
AS_HELP_STRING([--disable-sse],
[disable SSE (2-4) optimizations (default auto)]),, [
i?86|x86_64)
enable_sse=yes
;;
*)
enable_sse=no
;;
esac
])
AS_IF([test "${enable_sse}" != "no"], [
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -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
])
])
VLC_RESTORE_FLAGS
AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
VLC_SAVE_FLAGS

Rémi Denis-Courmont
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.])

Rémi Denis-Courmont
committed
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.]) ])

Rémi Denis-Courmont
committed
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],

Rémi Denis-Courmont
committed
[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.]) ])
VLC_RESTORE_FLAGS
AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
dnl We need support for -mavx[2], we need <immintrin.h>, and we also need a
dnl working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
AC_ARG_ENABLE([avx],
AS_HELP_STRING([--disable-avx],
[disable AVX (1-2) optimizations (default auto)]),, [
case "${host_cpu}" in
i?86|x86_64)
enable_avx=yes
;;
*)
enable_avx=no
;;
esac
])
have_avx2="no"
AS_IF([test "${enable_avx}" != "no"], [
ARCH="${ARCH} avx avx2"
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -mavx2"
AC_CACHE_CHECK([if $CC groks AVX2 intrinsics], [ac_cv_c_avx2_intrinsics], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
[#include <immintrin.h>
#include <stdint.h>
uint64_t frobzor;]], [
[__m256i a, b, c;
a = b = c = _mm256_set1_epi64x((int64_t)frobzor);
a = _mm256_slli_epi16(a, 3);
a = _mm256_adds_epi16(a, b);
c = _mm256_srli_epi16(c, 8);
c = _mm256_slli_epi16(c, 3);
b = _mm256_adds_epi16(b, c);
a = _mm256_unpacklo_epi8(a, b);
frobzor = (uint64_t)_mm256_extract_epi64(a, 0);]])], [
ac_cv_c_avx2_intrinsics=yes
], [
ac_cv_c_avx2_intrinsics=no
])
])
VLC_RESTORE_FLAGS
AS_IF([test "${ac_cv_c_avx2_intrinsics}" != "no"], [
AC_DEFINE(HAVE_AVX2_INTRINSICS, 1, [Define to 1 if AVX2 intrinsics are available.])
])
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -mavx"
AC_CACHE_CHECK([if $CC groks AVX inline assembly], [ac_cv_avx_inline], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
void *p;
asm volatile("vxorps %%ymm1,%%ymm2,%%ymm3"::"r"(p):"ymm1", "ymm2", "ymm3");
]])
], [
ac_cv_avx_inline=yes
], [
ac_cv_avx_inline=no
])
])
AS_IF([test "${ac_cv_avx_inline}" != "no" -a "${SYS}" != "solaris"], [
AC_DEFINE(CAN_COMPILE_AVX, 1, [Define to 1 if AVX inline assembly is available.])
])
AC_CACHE_CHECK([if $CC groks AVX2 inline assembly], [ac_cv_avx2_inline], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
void *p;
asm volatile("vpunpckhqdq %%ymm1,%%ymm2,%%ymm3"::"r"(p):"ymm1", "ymm2", "ymm3");
]])
], [
ac_cv_avx2_inline=yes
], [
ac_cv_avx2_inline=no
])
])
AS_IF([test "${ac_cv_avx2_inline}" != "no" -a "${SYS}" != "solaris"], [
AC_DEFINE(CAN_COMPILE_AVX2, 1, [Define to 1 if AVX2 inline assembly is available.])
have_avx2="yes"
])
])
AM_CONDITIONAL([HAVE_AVX2], [test "$have_avx2" = "yes"])
AC_ARG_ENABLE([neon],
AS_HELP_STRING([--disable-neon],
[disable ARM NEON optimizations (default auto)]),, [
case "${host_cpu}" in
"arm")
enable_neon="32"
;;
"aarch64")
enable_neon="64"
;;
*)
enable_neon="no"
;;
esac
])
AS_IF([test "${enable_neon}" != "no"], [
VLC_SAVE_FLAGS
AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
AS_IF([test "${enable_neon}" != "64"], [
CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(,[[
asm volatile("vqmovun.s64 d0, q1":::"d0");
]])
], [
ac_cv_arm_neon="32"
], [
ac_cv_arm_neon="no"
])
CFLAGS="${CFLAGS} -march=armv8-a+simd"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(,[[
asm volatile("uhadd v0.8b, v0.8b, v1.8b":::"v0");
]])
], [
ac_cv_arm_neon="64"
], [
ac_cv_arm_neon="no"
])
AM_CONDITIONAL([HAVE_NEON], [test "${ac_cv_arm_neon}" = "32"])
AM_CONDITIONAL([HAVE_ARM64], [test "${ac_cv_arm_neon}" = "64"])
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
AC_ARG_ENABLE([sve],
AS_HELP_STRING([--disable-sve],
[disable ARM SVE optimizations (default auto)]),, [
AS_IF([test "${host_cpu}" = "aarch64"], [enable_sve="yes"] ,[enable_sve="no"])
])
AS_IF([test "${enable_sve}" != "no"], [
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -march=armv8-a+sve"
AC_CACHE_CHECK([if $CCAS groks ARM SVE assembly], [ac_cv_arm_sve], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(,[[
asm volatile("ptrue p0.s" ::: "p0");
]])
], [
ac_cv_arm_sve="yes"
], [
ac_cv_arm_sve="no"
])
])
VLC_RESTORE_FLAGS
])
AM_CONDITIONAL([HAVE_SVE], [test "${ac_cv_arm_sve}" = "yes"])
AC_ARG_ENABLE([branch-protection],
AS_HELP_STRING([--disable-branch-protection],
[disable AArch64 branch protection (default auto)]),, [
AS_IF([test "${host_cpu}" = "aarch64"],
[enable_branch_protection="yes"], [enable_branch_protection="no"])
AS_IF([test "${enable_branch_protection}" != "no"], [
AX_CHECK_COMPILE_FLAG([-mbranch-protection=standard], [
AX_APPEND_FLAG([-mbranch-protection=standard], [CFLAGS])
AX_APPEND_FLAG([-mbranch-protection=standard], [CXXFLAGS])
AC_ARG_ENABLE([altivec],
AS_HELP_STRING([--disable-altivec],
[disable AltiVec optimizations (default auto)]),, [
AS_CASE("${host_cpu}", [powerpc*],
[enable_altivec=yes], [enable_altivec=no])
])
AS_IF([test "${enable_altivec}" = "yes"], [
ARCH="${ARCH} altivec";
VLC_SAVE_FLAGS
AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
[ac_cv_c_altivec], [
CFLAGS="${CFLAGS} -maltivec"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
[#include <altivec.h>]], [
[vec_ld(0, (unsigned char *)0);]])], [
ac_cv_c_altivec="-maltivec"
], [
ac_cv_c_altivec="no"
])
VLC_RESTORE_FLAGS
AS_IF([test "${ac_cv_c_altivec}" != "no"], [
AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
AC_ARG_ENABLE([rvv],
AS_HELP_STRING([--disable-rvv],
[disable RISC-V Vector extension (default auto)]),, [
AS_CASE([${host_cpu}], [riscv*], [enable_rvv="yes"], [enable_rvv="no"])
])
AS_IF([test "${enable_rvv}" != "no"], [
AC_CACHE_CHECK([if $CCAS groks RISC-V V assembly], [ac_cv_riscv_v], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(,[[
asm volatile(".option arch, +v\nvsetvli x0, x0, e8");
]])
], [
ac_cv_riscv_v="yes"
], [
ac_cv_riscv_v="no"
])
])
])
AM_CONDITIONAL([HAVE_RVV], [test "${ac_cv_riscv_v}" = "yes"])
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
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,
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"])
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.2, [ have_lua=yes ], [:])
AS_IF([test "${have_lua}" != "yes"], [
AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
PKG_CHECK_MODULES(LUA, lua5.1, [ have_lua=yes ], [:]) ])
AS_IF([test "${have_lua}" != "yes"], [
AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
PKG_CHECK_MODULES(LUA, lua >= 5.1, [ have_lua=yes ], [:]) ])
AS_IF([test "${have_lua}" != "yes"], [
AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
have_lua_lib=no
AC_CHECK_LIB( lua5.2 , luaL_newstate, [
LUA_LIBS="-llua5.2"
have_lua_lib=yes], [])
AS_IF([test "${have_lua_lib}" != "yes"], [
AC_CHECK_LIB( lua5.1 , luaL_newstate, [
LUA_LIBS="-llua5.1"
have_lua_lib=yes], [] ) ])
AS_IF([test "${have_lua_lib}" != "yes"], [
AC_CHECK_LIB( lua51 , luaL_newstate, [
LUA_LIBS="-llua51"
have_lua_lib=yes], [] ) ])
AS_IF([test "${have_lua_lib}" != "yes"], [
AC_CHECK_LIB( lua , luaL_newstate,
[LUA_LIBS="-llua"
have_lua_lib=yes],
[ have_lua=no ], [-lm] ) ])
dnl If we found any lib, check that we have the headers too
AS_IF([test "${have_lua_lib}" = "yes"], [
AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h], [ have_lua=yes ], []) ])
])
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.])

Konstantin Pavlov
committed
fi

Rémi Denis-Courmont
committed
AC_ARG_VAR([LUAC], [LUA byte compiler])
AS_IF([test -z "$LUAC"], [
AC_CHECK_TOOL(LUAC, [luac], [false])
])

Rémi Denis-Courmont
committed
AC_MSG_ERROR([Could not find the LUA byte compiler.])
])
AS_IF([test -d "${CONTRIB_DIR}" -a -f "${CONTRIB_DIR}/lib/liblua.a" -a `echo|${LUAC} -o - -|od -j 8 -N 2 -t x2|head -n 1|tr -s ' '|cut -d' ' -f2` != 0404], [
AC_MSG_ERROR([You need 32-bits luac when using lua from contrib.])
AM_CONDITIONAL([BUILD_LUA], [test "${have_lua}" = "yes"])
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"])
dnl
dnl Addons manager storage and repositories modules
dnl
AC_ARG_ENABLE([addonmanagermodules],
AS_HELP_STRING([--disable-addonmanagermodules],
[disable the addons manager modules (default enabled)]))
if test "${enable_addonmanagermodules}" != "no"
then
AC_DEFINE(ENABLE_ADDONMANAGERMODULES, 1, [Define if you want the addons manager modules])
fi
AM_CONDITIONAL([ENABLE_ADDONMANAGERMODULES], [test "${enable_addonmanagermodules}" != "no"])
dnl
dnl libarchive access module
dnl
PKG_ENABLE_MODULES_VLC([ARCHIVE], [archive], [libarchive >= 3.1.0], (libarchive support), [auto])
dnl
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}"], [
PKG_CHECK_MODULES(LIVE555, live555, [
VLC_ADD_PLUGIN([live555])
VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
AC_LANG_PUSH(C++)
VLC_SAVE_FLAGS
dnl detect include paths
AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment/UsageEnvironment.hh"], [
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}" != "os2"], [
LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
], [
LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
])
dnl CPP Flags
AS_IF([test "${SYS}" = "solaris"], [
CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
])
CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
dnl version check
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([live555 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"
])
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}])
VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
AC_CHECK_LIB([liveMedia_pic], [main], [
VLC_ADD_PLUGIN([live555])
VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
],[
VLC_ADD_PLUGIN([live555])
VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
],[],[${other_libs}])
],[${other_libs_pic}])
])
VLC_RESTORE_FLAGS
AC_LANG_POP(C++)
])
])

Jean-Paul Saman
committed
dnl
dnl IIDC and DV FireWire input modules

Jean-Paul Saman
committed
dnl
PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
dnl
dnl - linsys modules: access module check for libzvbi
dnl
AC_ARG_ENABLE([linsys],
AS_HELP_STRING([--enable-linsys],
[Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)]))
AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
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 > 6.0.0], [dvdread input module], [auto])
dnl libdvdnav plugin
PKG_ENABLE_MODULES_VLC([DVDNAV], [], [dvdnav >= 6.0.0], [DVD with navigation input module (dvdnav)], [auto])
dnl
dnl Blu-ray Disc Support with libbluray
dnl
PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.6.2], (libbluray for Blu-ray disc support ) )
dnl
dnl OpenCV wrapper and example filters
dnl
PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
dnl
dnl libsmbclient plugin
dnl
PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smbc], [smbclient], (SMB/CIFS support), [auto])
dnl
dnl liBDSM access module
dnl
PKG_HAVE_WITH_MODULES([DSM], [libdsm >= 0.2.0], [libdsm SMB/CIFS access/sd module], [auto])
PKG_ENABLE_MODULES_VLC([SFTP], [sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
PKG_ENABLE_MODULES_VLC([NFS], [nfs], [libnfs >= 1.10.0], (support nfs protocol via libnfs), [auto])
PKG_ENABLE_MODULES_VLC([SMB2], [smb2], [libsmb2 >= 3.0.0], (support smb2 protocol via libsmb2), [auto])
AC_ARG_ENABLE([v4l2], AS_HELP_STRING([--disable-v4l2],
[disable Video4Linux version 2 (default auto)]))