* [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv
@ 2009-12-03 22:59 Joel Brobecker
2009-12-03 23:11 ` Daniel Jacobowitz
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Joel Brobecker @ 2009-12-03 22:59 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]
Hello,
As I mentioned earlier on IRC, we're building GDB with an in-tree
libiconv, and I discovered that the True64 handler does not pick up
libconv.a when using -liconv :-(. As a result, we ended up building
GDB with the system libiconv instead of the in-tree one.
Trivia: libiconv on Tru64 5.1 does not handle encoding ISO-8859-1.
Tru64 5.1B, on the other hand, seems to be OK with it...
The way I fixed the problem is to not depend on -l for in-tree
libiconv, and use BUILD_LIBICONV_LIBDIR/libinconv.a instead.
I will monitor AdaCore's nightly builds on all our platforms
for unexpected issues, but I thought I'd put this change out for
review early, in case there are any suggestions.
2009-12-03 Joel Brobecker <brobecker@adacore.com>
* acinclude.m4: Link against in-tree libiconv by adding
libiconv.a to the LIBS instead of using -liconv.
* configure: Regenerate.
Tested on x86_64-linux, by rebuilding GDB, with and without in-tree
libiconv.
--
Joel
[-- Attachment #2: in-tree-iconv.diff --]
[-- Type: text/x-diff, Size: 5347 bytes --]
commit 652c50a2541d703fa1fccc04e7b23da06e0dd177
Author: Joel Brobecker <brobecker@adacore.com>
Date: Thu Dec 3 14:49:21 2009 -0800
Use ../libiconv/[...]/libiconv.a instgead of using -liconv.
On Tru64, we noticed that there is a problem with linking against
the in-tree libiconv when available: The linker does not recognize
archives as libraries when linking with -liconv. So, we have to
use the path/to/libiconv/lib/libconv.a explicitly on the command
line instead. Since the latter should work on all platforms,
we now always use the .a when linking with the in-tree libiconv.
gdb/
* acinclude.m4: Link against in-tree libiconv by adding
libiconv.a to the LIBS instead of using -liconv.
* configure: Regenerate.
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index af4639b..3684c18 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -184,7 +184,7 @@ AC_DEFUN([AM_ICONV],
done
])
- BUILD_LIBICONV_LIBDIR="-L../libiconv/lib/.libs -L../libiconv/lib/_libs"
+ BUILD_LIBICONV_LIBDIRS="../libiconv/lib/.libs ../libiconv/lib/_libs"
BUILD_LIBICONV_INCLUDE="-I../libiconv/include"
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
@@ -195,20 +195,26 @@ AC_DEFUN([AM_ICONV],
# 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"
- am_save_CPPFLAGS="$CPPFLAGS"
- LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv"
- CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
- AC_TRY_LINK([#include <stdlib.h>
+ for lib_dir in $BUILD_LIBICONV_LIBDIRS; do
+ am_save_LIBS="$LIBS"
+ am_save_CPPFLAGS="$CPPFLAGS"
+ LIBS="$LIBS $lib_dir/libiconv.a"
+ 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"
+ [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"
+ if test "$am_cv_use_build_libiconv" = "yes"; then
+ BUILD_LIBICONV_LIBDIR=$lib_dir
+ break
+ fi
+ done
fi
# Next, try to find iconv in libc.
@@ -253,7 +259,8 @@ AC_DEFUN([AM_ICONV],
LIBICONV_INCLUDE=
fi
if test "$am_cv_use_build_libiconv" = yes; then
- LIBICONV_LIBDIR="$BUILD_LIBICONV_LIBDIR"
+ LIBICONV="$BUILD_LIBICONV_LIBDIR/libiconv.a"
+ LIBICONV_LIBDIR=""
LIBICONV_INCLUDE="$BUILD_LIBICONV_INCLUDE"
fi
CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE"
diff --git a/gdb/configure b/gdb/configure
index e74b64f..de8de91 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -8316,7 +8316,7 @@ if test "${with_libiconv_prefix+set}" = set; then :
fi
- BUILD_LIBICONV_LIBDIR="-L../libiconv/lib/.libs -L../libiconv/lib/_libs"
+ BUILD_LIBICONV_LIBDIRS="../libiconv/lib/.libs ../libiconv/lib/_libs"
BUILD_LIBICONV_INCLUDE="-I../libiconv/include"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
@@ -8332,11 +8332,12 @@ else
# 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"
- am_save_CPPFLAGS="$CPPFLAGS"
- LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv"
- CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ for lib_dir in $BUILD_LIBICONV_LIBDIRS; do
+ am_save_LIBS="$LIBS"
+ am_save_CPPFLAGS="$CPPFLAGS"
+ LIBS="$LIBS $lib_dir/libiconv.a"
+ CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <iconv.h>
@@ -8344,21 +8345,26 @@ int
main ()
{
iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
am_cv_use_build_libiconv=yes
- am_cv_lib_iconv=yes
- am_cv_func_iconv=yes
+ am_cv_lib_iconv=yes
+ am_cv_func_iconv=yes
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- LIBS="$am_save_LIBS"
- CPPFLAGS="$am_save_CPPFLAGS"
+ LIBS="$am_save_LIBS"
+ CPPFLAGS="$am_save_CPPFLAGS"
+ if test "$am_cv_use_build_libiconv" = "yes"; then
+ BUILD_LIBICONV_LIBDIR=$lib_dir
+ break
+ fi
+ done
fi
# Next, try to find iconv in libc.
@@ -8432,7 +8438,8 @@ $as_echo "$am_cv_func_iconv" >&6; }
LIBICONV_INCLUDE=
fi
if test "$am_cv_use_build_libiconv" = yes; then
- LIBICONV_LIBDIR="$BUILD_LIBICONV_LIBDIR"
+ LIBICONV="$BUILD_LIBICONV_LIBDIR/libiconv.a"
+ LIBICONV_LIBDIR=""
LIBICONV_INCLUDE="$BUILD_LIBICONV_INCLUDE"
fi
CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE"
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv
2009-12-03 22:59 [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv Joel Brobecker
@ 2009-12-03 23:11 ` Daniel Jacobowitz
2009-12-04 1:14 ` Tom Tromey
2009-12-04 1:12 ` Tom Tromey
2009-12-09 10:12 ` Joel Brobecker
2 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2009-12-03 23:11 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Thu, Dec 03, 2009 at 02:58:52PM -0800, Joel Brobecker wrote:
> 2009-12-03 Joel Brobecker <brobecker@adacore.com>
>
> * acinclude.m4: Link against in-tree libiconv by adding
> libiconv.a to the LIBS instead of using -liconv.
> * configure: Regenerate.
The file's not generated, but this specific routine is imported
(see the comment above it). If there isn't a newer one, please leave
a note that there are local changes. No idea if this is the first
such change or not...
I have no other comment.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv
2009-12-03 23:11 ` Daniel Jacobowitz
@ 2009-12-04 1:14 ` Tom Tromey
0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2009-12-04 1:14 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
Daniel> On Thu, Dec 03, 2009 at 02:58:52PM -0800, Joel Brobecker wrote:
>> 2009-12-03 Joel Brobecker <brobecker@adacore.com>
>>
>> * acinclude.m4: Link against in-tree libiconv by adding
>> libiconv.a to the LIBS instead of using -liconv.
>> * configure: Regenerate.
Daniel> The file's not generated, but this specific routine is imported
Daniel> (see the comment above it). If there isn't a newer one, please leave
Daniel> a note that there are local changes. No idea if this is the first
Daniel> such change or not...
Our copy is extensively hacked.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv
2009-12-03 22:59 [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv Joel Brobecker
2009-12-03 23:11 ` Daniel Jacobowitz
@ 2009-12-04 1:12 ` Tom Tromey
2009-12-04 3:28 ` Joel Brobecker
2009-12-09 10:12 ` Joel Brobecker
2 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-12-04 1:12 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> Trivia: libiconv on Tru64 5.1 does not handle encoding ISO-8859-1.
That sounds very strange, because I would expect libiconv to always have
this built in. Or do you mean that the native iconv doesn't handle
this?
Joel> I will monitor AdaCore's nightly builds on all our platforms
Joel> for unexpected issues, but I thought I'd put this change out for
Joel> review early, in case there are any suggestions.
It seems reasonable to me.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv
2009-12-04 1:12 ` Tom Tromey
@ 2009-12-04 3:28 ` Joel Brobecker
0 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2009-12-04 3:28 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> That sounds very strange, because I would expect libiconv to always have
> this built in. Or do you mean that the native iconv doesn't handle
> this?
Oops, yes, sorry, native iconv, not libiconv...
> It seems reasonable to me.
Thanks! If all goes well at AdaCore, I'll commit on our end.
I'll see about adding a comment about our copy being different
from the one we copied from.
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv
2009-12-03 22:59 [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv Joel Brobecker
2009-12-03 23:11 ` Daniel Jacobowitz
2009-12-04 1:12 ` Tom Tromey
@ 2009-12-09 10:12 ` Joel Brobecker
2 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2009-12-09 10:12 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 438 bytes --]
> 2009-12-03 Joel Brobecker <brobecker@adacore.com>
>
> * acinclude.m4: Link against in-tree libiconv by adding
> libiconv.a to the LIBS instead of using -liconv.
> * configure: Regenerate.
Now checked in. I also committed the following comment update,
following feedback from Daniel:
2009-12-09 Joel Brobecker <brobecker@adacore.com>
* acinclude.m4: Update comment.
Cheers,
--
Joel
[-- Attachment #2: iconv-configure-comment.diff --]
[-- Type: text/x-diff, Size: 480 bytes --]
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.33
diff -u -p -r1.33 acinclude.m4
--- acinclude.m4 9 Dec 2009 10:07:13 -0000 1.33
+++ acinclude.m4 9 Dec 2009 10:09:34 -0000
@@ -169,7 +169,8 @@ case "x$am_cv_prog_cc_stdc" in
esac
])
-dnl From Bruno Haible.
+dnl Originally from Bruno Haible, but with some modifications
+dnl for the GDB project.
AC_DEFUN([AM_ICONV],
[
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-12-09 10:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-03 22:59 [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv Joel Brobecker
2009-12-03 23:11 ` Daniel Jacobowitz
2009-12-04 1:14 ` Tom Tromey
2009-12-04 1:12 ` Tom Tromey
2009-12-04 3:28 ` Joel Brobecker
2009-12-09 10:12 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox