diff options
author | Calvin Buckley <calvin@cmpct.info> | 2018-08-12 03:02:34 +0300 |
---|---|---|
committer | Calvin Buckley <calvin@cmpct.info> | 2018-08-12 03:02:34 +0300 |
commit | b0ab59fa93c9e6f65fa4313cf4d3ec6d00c14cdd (patch) | |
tree | 04cbfacbaeaf6af2144d68788672536282dc43e9 /configure.ac | |
parent | 37b78f0640931681cd4043b63e42c7421982a52d (diff) |
Fix iconv in eglib, remove GNU libiconv-ism
iconv in eglib was broken due to a broken define. Also fix linking
of iconv when iconv isn't in libc.
Also remove the usage of a GNU libcharset specific function and rely
on a standard POSIX function that outputs the same value on every
modern Unixoid I've tried it on. (Ubuntu/macOS/i/FreeBSD)
This comment explains a lot of things for the latter:
```c
/*
* This function used used to use the "locale_charset" call in
* libiconv's libcharset library. However, this isn't always
* available on some systems, including ones with GNU libc. So,
* instead use a function that's a standard part of POSIX2008.
*
* nl_langinfo is in POSIX2008 and should be on any sane modern
* Unix. With a UTF-8 locale, it should return "UTF-8" - this
* has been verified with Ubuntu 18.04, FreeBSD 11, and i 7.3.
*
* The motivation for using locale_charset was likely due to
* the cruftiness of Unices back in ~2001; where you had to
* manually query environment variables, and the values were
* inconsistent between each other. Nowadays, if Linux, macOS,
* AIX/PASE, and FreeBSD can all return the same values for a
* UTF-8 locale, we can just use the value directly.
*
* It should be noted that by default, this function will give
* values for the "C" locale, unless `setlocale (LC_ALL, "")`
* is ran to init locales - driver.c in mini does this for us.
*/
```
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 6988629a8ee..0cd0ec940b6 100644 --- a/configure.ac +++ b/configure.ac @@ -1904,6 +1904,7 @@ if test x$host_win32 = xno; then AC_CHECK_FUNCS(getrlimit) AC_CHECK_FUNCS(prctl) AC_CHECK_FUNCS(arc4random) + AC_CHECK_FUNCS(nl_langinfo) AC_CHECK_FUNCS(sched_getaffinity) AC_CHECK_FUNCS(sched_setaffinity) @@ -4593,8 +4594,9 @@ if test $found_export_dynamic = no; then LDFLAGS="${old_ldflags}" fi -AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h localcharset.h sys/types.h sys/resource.h) -AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+=" -liconv -lcharset"])]) +AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h sys/types.h sys/resource.h) +dnl giconv.c will check on HAVE_ICONV_H but we need this for link time +AC_CHECK_LIB(iconv, iconv_open) AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0]) AC_SUBST(HAVE_ALLOCA_H) |