[vlc-devel] [PATCH] configure: Add a new test for <locale.h>

Rémi Denis-Courmont remi at remlab.net
Sun Feb 25 20:44:17 CET 2018


Le perjantaina 23. helmikuuta 2018, 10.25.14 EET Kamil Rytarowski a écrit :
> Don't simply assume that the uselocale() check is equivalent for the check
> of detecting the <locale.h> POSIX header.
> 
> The NetBSD system ships with POSIX <locale.h>, however without the
> uselocale() function.
> 
> Include <locale.h> in src/config/file.c for systems with detected <locale.h>
> instead of just for systems with detected uselocale() and not being
> __APPLE__. ---
>  configure.ac      | 3 +++
>  src/config/file.c | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 225bcae987..cb282b4732 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -852,6 +852,9 @@ AC_CHECK_HEADERS([features.h getopt.h linux/dccp.h
> linux/magic.h mntent.h sys/ev dnl  MacOS
>  AC_CHECK_HEADERS([xlocale.h])
> 
> +dnl  POSIX
> +AC_CHECK_HEADERS([locale.h])
> +
>  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,, [
> diff --git a/src/config/file.c b/src/config/file.c
> index 6270a6bc9d..16b9d55377 100644
> --- a/src/config/file.c
> +++ b/src/config/file.c
> @@ -32,7 +32,7 @@
>  #include <sys/stat.h>
>  #ifdef __APPLE__
>  #   include <xlocale.h>
> -#elif defined(HAVE_USELOCALE)
> +#elif defined(HAVE_LOCALE_H)
>  #include <locale.h>
>  #endif
>  #include <unistd.h>

Frankly, it makes zero sense to support newlocale() and not support 
uselocale() at the same time. And with that said, it is far simpler to replace 
HAVE_USELOCALE with HAVE_NEWLOCALE.

Checking for locale.h does not make much sense since it is assumed to be exist 
in many places already.

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list