[vlc-devel] [PATCH] configure.ac: check newlocale against android_support

Alexandre Janniaux ajanni at videolabs.io
Fri May 8 14:09:01 CEST 2020


Hi,

This patch goes against previous discussion on similar
subject for Android and iOS:

https://mailman.videolan.org/pipermail/vlc-devel/2014-October/099937.html

However, given recent discussion about export autoconf
special variables to mask symbol and headers and all the
problem it involves during development, it feels necessary
to test those in configure time rather than hacking the
buildsystem with an external additional buildsystem.

In particular, this is needed to provide a way to sanely
configure and build a vlc android application without
depending on the vlc-android project, which would greatly
reduce the complexity for VLC core development.

I'm not sure this is the correct way to add the check though.
We could also pass and check the Android API version and
directly set the correct variables which might be much
easier, but felt hackish at the time I wrote this. Please
signal any smarter way if there is! :)

Regards,
--
Alexandre Janniaux
Videolabs

On Fri, May 08, 2020 at 01:35:42PM +0200, Alexandre Janniaux wrote:
> Android has uselocale through libandroid_support, which depends on
> libc++abi for new/delete operators as being a C++ library.
> ---
>  configure.ac | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 10ce6501eaf..0a01062b620 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -675,8 +675,15 @@ VLC_LIBRARY_SUFFIX
>  dnl Check for system libs needed
>  need_libc=false
>
> +dnl Android has uselocale through Android support on API < 21
> +AC_SEARCH_LIBS([uselocale], [android_support], [
> +  AS_IF([test "$ac_cv_search_newlocale" = "-landroid_support"], [
> +    AX_APPEND_FLAG([-landroid_support -lc++abi], [LDFLAGS]) ])
> +  AC_DEFINE([HAVE_USELOCALE], [1], [Define if uselocale() is available.])
> +],,[-lc++abi])
> +
>  dnl Check for usual libc functions
> -AC_CHECK_FUNCS([accept4 fcntl flock fstatat fstatvfs fork getmntent_r getenv getpwuid_r isatty memalign mkostemp mmap open_memstream newlocale pipe2 pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale])
> +AC_CHECK_FUNCS([accept4 fcntl flock fstatat fstatvfs fork getmntent_r getenv getpwuid_r isatty memalign mkostemp mmap open_memstream newlocale pipe2 pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime])
>  AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir flockfile fsync getdelim getpid lfind lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf])
>  AC_REPLACE_FUNCS([gettimeofday])
>  AC_CHECK_FUNC(fdatasync,,
> --
> 2.26.2
>


More information about the vlc-devel mailing list