[eglib] Prefer <langinfo.h> to <localcharset.h>
authorMarcin Cieslak <saper@saper.info>
Thu, 11 Jun 2015 21:21:10 +0000 (21:21 +0000)
committerMarcin Cieslak <saper@saper.info>
Thu, 11 Jun 2015 22:49:08 +0000 (22:49 +0000)
commiteade1efc7740af1e036e2238189ec1e2c54adc80
treed30f86baddc9b4d4a9adcf58821007e53bfb9bff
parent9c3cdff186534d968fef911130bd86fcba11665a
[eglib] Prefer <langinfo.h> to <localcharset.h>

For platforms that have external libiconv
located in some non-default directory (e.g. /usr/local/lib)
it is very difficult to force libtool to pick
up a static libiconv.a when needed.

We currently build eglib as a static library,
and then we continue to link eglib (with -leglib)
to other binaries and libraries.

As -leglib is a static library, we should either

1) incorporate the contents of libiconv.a into
   libeglib.a (therefore we would _require_
   libiconv.a to be installed).

2) prepare stub libiconv.la file and provide it
   to all libeglib.a consumers as a dependency.

We should not just detect HAVE_LOCALCHARSET_H,
add it to CPPFLAGS and then continue without
linking libiconv properly as a static library;
This manifests with the error message during
linking:

   gunicode.c:223: undefined reference to `locale_charset'

This workaround makes us look for <langinfo.h>
first, which - if available - will be there in
the standard C library. This fixes the gunicode.c
problem for FreeBSD and similar platforms, that
may install GNU iconv as an add-on library.
eglib/src/gunicode.c