From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFA/commit] prefer in-tree libiconv over the system libiconv
Date: Tue, 21 Apr 2009 21:00:00 -0000 [thread overview]
Message-ID: <20090421210032.GF23807@adacore.com> (raw)
In-Reply-To: <20090420213559.GS2904@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]
[switching to gdb-patches]
The more I kept thinking about it, the more it seemed to make sense
to me that we should use in-tree libiconv if present. Right now,
we automatically build it, but we cannot use the current configure
switch (--with-libiconv-prefix) to force GDB to use the libiconv
we just built. That means that an extra switch would be necessary,
not just convenient.
This patch implements this change. I've only tested it on GNU/Linux
at the moment, with and without in-tree libiconv. I get the expected
result both times. I'm checked this patch in AdaCore tree, and I should
get build results tomorrow.
2009-04-21 Joel Brobecker <brobecker@adacore.com>
* acinclude.m4 (AM_ICONV): Prefer in-tree libiconv if present over
system iconv.
* configure: Regenerate.
The diff seems awful, but all I did was move the block for ../libiconv
up before we check for iconv in the libc. And I made us check iconv
in libc only if we haven't found iconv in ../libiconv.
Any objection?
--
Joel
[-- Attachment #2: in-tree-iconv.diff --]
[-- Type: text/x-diff, Size: 3098 bytes --]
commit b29fa82cb5acbb4423a4515f694b22beb7622aa2
Author: Joel Brobecker <brobecker@adacore.com>
Date: Tue Apr 21 13:32:27 2009 -0700
* acinclude.m4 (AM_ICONV): Prefer in-tree libiconv if present over
system iconv.
* configure: Regenerate.
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 5e77230..320b7dd 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -189,47 +189,51 @@ AC_DEFUN([AM_ICONV],
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
am_cv_use_build_libiconv=no
- # First, try to find iconv in libc.
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
- am_cv_func_iconv=yes)
- # If iconv was not in libc, try -liconv. In this case, arrange to
- # look in the libiconv prefix, if it was specified by the user.
- if test "$am_cv_func_iconv" != yes; then
- am_save_CPPFLAGS="$CPPFLAGS"
+ # If libiconv is part of the build tree, then try using it over
+ # any system iconv.
+ if test -d ../libiconv; then
am_save_LIBS="$LIBS"
- if test -n "$LIBICONV_INCLUDE"; then
- CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE"
- LIBS="$LIBS $LIBICONV_LIBDIR"
- fi
- LIBS="$LIBS -liconv"
+ am_save_CPPFLAGS="$CPPFLAGS"
+ LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv"
+ CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
+ am_cv_use_build_libiconv=yes
am_cv_lib_iconv=yes
am_cv_func_iconv=yes)
LIBS="$am_save_LIBS"
CPPFLAGS="$am_save_CPPFLAGS"
fi
- # If that didn't work, try to find libiconv in the build tree.
- if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then
- am_save_LIBS="$LIBS"
+ # Next, try to find iconv in libc.
+ if test "$am_cv_func_iconv" != yes; then
+ AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+ [iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);],
+ am_cv_func_iconv=yes)
+ fi
+
+ # If iconv was not in libc, try -liconv. In this case, arrange to
+ # look in the libiconv prefix, if it was specified by the user.
+ if test "$am_cv_func_iconv" != yes; then
am_save_CPPFLAGS="$CPPFLAGS"
- LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv"
- CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
+ am_save_LIBS="$LIBS"
+ if test -n "$LIBICONV_INCLUDE"; then
+ CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE"
+ LIBS="$LIBS $LIBICONV_LIBDIR"
+ fi
+ LIBS="$LIBS -liconv"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
- am_cv_use_build_libiconv=yes
am_cv_lib_iconv=yes
am_cv_func_iconv=yes)
LIBS="$am_save_LIBS"
next parent reply other threads:[~2009-04-21 21:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090420183619.GB5858@adacore.com>
[not found] ` <m3fxg32fk6.fsf@fleche.redhat.com>
[not found] ` <20090420213559.GS2904@adacore.com>
2009-04-21 21:00 ` Joel Brobecker [this message]
2009-04-21 23:44 ` Tom Tromey
2009-04-22 16:22 ` Joel Brobecker
2009-04-22 17:13 ` Tom Tromey
2009-05-06 23:06 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090421210032.GF23807@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox