summaryrefslogtreecommitdiff
path: root/gdb/charset.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2011-05-09 21:49:57 +0000
committerDoug Evans <dje@google.com>2011-05-09 21:49:57 +0000
commit478aac75e4114810db639e06a13e15547ec49e3d (patch)
treef9952574ed7f284c1a30ff2052208d9e398fa0fa /gdb/charset.c
parent673c2bbeab36a7240fc8b85e696fbad249fbf408 (diff)
downloadbinutils-gdb-478aac75e4114810db639e06a13e15547ec49e3d.tar.gz
* 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.
Diffstat (limited to 'gdb/charset.c')
-rw-r--r--gdb/charset.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gdb/charset.c b/gdb/charset.c
index a84085ac3a5..b85758b045e 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);