Newer
Older
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 -msse[2], 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 (1-4) optimizations (default auto)]),, [
i?86|x86_64)
enable_sse=yes
;;
*)
enable_sse=no
;;
esac
])
AS_IF([test "${enable_sse}" != "no"], [
ARCH="${ARCH} sse sse2"
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
CFLAGS="${CFLAGS} -msse"

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

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.]) ])
# SSE4.2
AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],

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

Rémi Denis-Courmont
committed
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
])
])
VLC_RESTORE_FLAGS
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"])
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
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"])
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
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])
])
ALTIVEC_CFLAGS=""
AS_IF([test "${enable_altivec}" = "yes"], [
ARCH="${ARCH} altivec";
VLC_SAVE_FLAGS
AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
[ac_cv_altivec_inline],
[AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[]],
[[asm volatile("vperm 0,1,2,3");]])],
[ac_cv_altivec_inline="yes"],
[CFLAGS="${CFLAGS} -Wa,-maltivec"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[]],
[[asm volatile("vperm 0,1,2,3");]])],
[ac_cv_altivec_inline="-Wa,-maltivec"],
ac_cv_altivec_inline=no)
VLC_RESTORE_FLAGS
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"], [
ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"

Rémi Denis-Courmont
committed
VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
Christophe Massiot
committed
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"], [
CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])

Rémi Denis-Courmont
committed
VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
ALTIVEC_CFLAGS="$ALTIVEC_CFLAGS ${ac_cv_c_altivec}"
VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec}])
AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
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])
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
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])