From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17397 invoked by alias); 3 Dec 2009 22:59:04 -0000 Received: (qmail 17374 invoked by uid 22791); 3 Dec 2009 22:59:02 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,WEIRD_QUOTING X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Dec 2009 22:58:56 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E29052BAC5F for ; Thu, 3 Dec 2009 17:58:54 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id BVV41b33zxWc for ; Thu, 3 Dec 2009 17:58:54 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 927322BAC5E for ; Thu, 3 Dec 2009 17:58:54 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 51CCCF588A; Thu, 3 Dec 2009 14:58:52 -0800 (PST) Date: Thu, 03 Dec 2009 22:59:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA/commit] use libiconv.a instead of -liconv for in-tree libiconv Message-ID: <20091203225852.GG2877@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="y0ulUmNC+osPPQO6" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-12/txt/msg00036.txt.bz2 --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1001 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 * 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 --y0ulUmNC+osPPQO6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="in-tree-iconv.diff" Content-length: 5347 commit 652c50a2541d703fa1fccc04e7b23da06e0dd177 Author: Joel Brobecker 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 + 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 #include ], - [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 #include @@ -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" --y0ulUmNC+osPPQO6--