* 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.
This commit is contained in:
Doug Evans
2011-05-09 21:49:57 +00:00
parent 673c2bbeab
commit 478aac75e4
10 changed files with 145 additions and 15 deletions

View File

@@ -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);