From 478aac75e4114810db639e06a13e15547ec49e3d Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Mon, 9 May 2011 21:49:57 +0000 Subject: * NEWS: Mention --with-iconv-bin. * configure.ac: New option --with-iconv-bin. * configure: Regenerate. * config.in: Regenerate. * defs.h (relocate_gdb_directory): Declare. * main.c (relocate_gdb_directory): Renamed from relocate_directory, removed progname parameter, and exported. All callers updated. * charset.c (find_charset_names): Use --with-iconv-bin if specified. doc/ * gdb.texinfo (Requirements): Fix typo. Mention --with-iconv-bin. --- gdb/charset.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'gdb/charset.c') diff --git a/gdb/charset.c b/gdb/charset.c index a84085a..b85758b 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -799,7 +799,9 @@ find_charset_names (void) char *args[3]; int err, status; int fail = 1; + int flags; struct gdb_environ *iconv_env; + char *iconv_program; /* Older iconvs, e.g. 2.2.2, don't omit the intro text if stdout is not a tty. We need to recognize it and ignore it. This text is @@ -811,12 +813,26 @@ find_charset_names (void) child = pex_init (PEX_USE_PIPES, "iconv", NULL); - args[0] = "iconv"; +#ifdef ICONV_BIN + { + char *iconv_dir = relocate_gdb_directory (ICONV_BIN, + ICONV_BIN_RELOCATABLE); + iconv_program = concat (iconv_dir, SLASH_STRING, "iconv", NULL); + xfree (iconv_dir); + } +#else + iconv_program = xstrdup ("iconv"); +#endif + args[0] = iconv_program; args[1] = "-l"; args[2] = NULL; + flags = PEX_STDERR_TO_STDOUT; +#ifndef ICONV_BIN + flags |= PEX_SEARCH; +#endif /* Note that we simply ignore errors here. */ - if (!pex_run_in_environment (child, PEX_SEARCH | PEX_STDERR_TO_STDOUT, - "iconv", args, environ_vector (iconv_env), + if (!pex_run_in_environment (child, flags, + args[0], args, environ_vector (iconv_env), NULL, NULL, &err)) { FILE *in = pex_read_output (child, 0); @@ -888,6 +904,7 @@ find_charset_names (void) } + xfree (iconv_program); pex_free (child); free_environ (iconv_env); -- cgit v1.1