From eade1efc7740af1e036e2238189ec1e2c54adc80 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak Date: Thu, 11 Jun 2015 21:21:10 +0000 Subject: [PATCH] [eglib] Prefer to 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 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eglib/src/gunicode.c b/eglib/src/gunicode.c index c3a9000f8d2..e6f4b925b61 100644 --- a/eglib/src/gunicode.c +++ b/eglib/src/gunicode.c @@ -219,10 +219,10 @@ g_get_charset (G_CONST_RETURN char **charset) is_utf8 = FALSE; #else /* These shouldn't be heap allocated */ -#if HAVE_LOCALCHARSET_H - my_charset = locale_charset (); -#elif defined(HAVE_LANGINFO_H) +#if defined(HAVE_LANGINFO_H) my_charset = nl_langinfo (CODESET); +#elif defined(HAVE_LOCALCHARSET_H) + my_charset = locale_charset (); #else my_charset = "UTF-8"; #endif -- 2.25.1