From patchwork Mon Aug 24 10:29:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 8399 Received: (qmail 100786 invoked by alias); 24 Aug 2015 10:29:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 100753 invoked by uid 89); 24 Aug 2015 10:29:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS, WEIRD_QUOTING autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 24 Aug 2015 10:29:19 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id BF16C461DD; Mon, 24 Aug 2015 10:29:17 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7OATFIm007999; Mon, 24 Aug 2015 06:29:16 -0400 Message-ID: <55DAF1FB.9080108@redhat.com> Date: Mon, 24 Aug 2015 11:29:15 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Yaakov Selkowitz , gcc-patches@gcc.gnu.org, "binutils@sourceware.org" , "gdb-patches@sourceware.org" CC: DJ Delorie Subject: Re: [PATCH] config: fix AM_ICONV for in-tree libiconv References: <1432934749.13692.9.camel@redhat.com> <55D8ABBA.3090208@redhat.com> <1440358616.9072.5.camel@redhat.com> In-Reply-To: <1440358616.9072.5.camel@redhat.com> On 08/23/2015 08:36 PM, Yaakov Selkowitz wrote: > On Sat, 2015-08-22 at 18:04 +0100, Pedro Alves wrote: >> I noticed that regenerating binutils/configure or gdb/configure >> undoes the libiconv changes done here: > [snip] >> However, that commit does not include any config/iconv.m4/AM_ICONV >> change. Looks like you forgot to attach the config/iconv.m4 patch, and >> then only the regeneration bits were pushed (both binutils-gdb git >> and gcc svn)? > > Looks like I forgot to repost that part of the patchset; attached. Pushed to both gcc svn and binutils-gdb git. Please confirm whether anything else might be missing in either repo. ------ From cfe101c6a8227b6b97ed2da85895db7d6083bfa6 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 24 Aug 2015 10:57:03 +0100 Subject: [PATCH] Missing parts of fixes for in-tree libiconv (Commit d23d1dff missed pushing the config/iconv.m4 change, and to regenerate binutils' configure.) Original description: This is the second in a series of patches to make a build with an in-tree GNU libiconv work as designed. Currently GDB is the only toolchain component which actually uses an in-tree libiconv. This patch modifies the common AM_ICONV to use an in-tree libiconv when present and not already provided by libc. (GDB's workaround uses an in-tree libiconv even when libc provides iconv(3); I'm not sure when or why that would be desirable.) config/ChangeLog: 2015-08-24 Yaakov Selkowitz * iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present. binutils/ChangeLog: 2015-08-24 Yaakov Selkowitz * configure: Regenerate. --- binutils/ChangeLog | 4 +++ binutils/configure | 93 +++++++++++++++++++++++++++++++++++++++--------------- config/ChangeLog | 4 +++ config/iconv.m4 | 47 +++++++++++++++++++++------ 4 files changed, 112 insertions(+), 36 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index caa0829..004d9a3 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2015-08-24 Yaakov Selkowitz + + * configure: Regenerate. + 2015-08-17 Alan Modra * configure: Regenerate. diff --git a/binutils/configure b/binutils/configure index c47d0f8..82572e8 100755 --- a/binutils/configure +++ b/binutils/configure @@ -14135,31 +14135,6 @@ fi - am_save_CPPFLAGS="$CPPFLAGS" - - for element in $INCICONV; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if test "${am_cv_func_iconv+set}" = set; then : @@ -14168,6 +14143,8 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no + am_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -14187,8 +14164,49 @@ if ac_fn_c_try_link "$LINENO"; then : fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + CPPFLAGS="$am_save_CPPFLAGS" + + if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then + for _libs in .libs _libs; do + am_save_CPPFLAGS="$CPPFLAGS" + am_save_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS -I../libiconv/include" + LIBS="$LIBS ../libiconv/lib/$_libs/libiconv.a" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + INCICONV="-I../libiconv/include" + LIBICONV='${top_builddir}'/../libiconv/lib/$_libs/libiconv.a + LTLIBICONV='${top_builddir}'/../libiconv/lib/libiconv.la + 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 + CPPFLAGS="$am_save_CPPFLAGS" + LIBS="$am_save_LIBS" + if test "$am_cv_func_iconv" = "yes"; then + break + fi + done + fi + if test "$am_cv_func_iconv" != yes; then + am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" + CPPFLAGS="$LIBS $INCICONV" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14210,6 +14228,7 @@ if ac_fn_c_try_link "$LINENO"; then : fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + CPPFLAGS="$am_save_CPPFLAGS" LIBS="$am_save_LIBS" fi @@ -14222,12 +14241,34 @@ $as_echo "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 $as_echo_n "checking how to link with libiconv... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 $as_echo "$LIBICONV" >&6; } else - CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi diff --git a/config/ChangeLog b/config/ChangeLog index 102fc47..6847cb9 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2015-08-24 Yaakov Selkowitz + + * iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present. + 2015-07-27 H.J. Lu Sync with GCC diff --git a/config/iconv.m4 b/config/iconv.m4 index c5f3579..5f9304a 100644 --- a/config/iconv.m4 +++ b/config/iconv.m4 @@ -7,6 +7,7 @@ dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. +dnl with modifications to support building with in-tree libiconv AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ @@ -28,24 +29,51 @@ AC_DEFUN([AM_ICONV_LINK], dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - dnl Add $INCICONV to CPPFLAGS before performing the following checks, - dnl because if the user has installed libiconv and not disabled its use - dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. - am_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no + dnl Add $INCICONV to CPPFLAGS before performing the first check, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. This first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCICONV" AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_func_iconv=yes) + CPPFLAGS="$am_save_CPPFLAGS" + + if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then + for _libs in .libs _libs; do + am_save_CPPFLAGS="$CPPFLAGS" + am_save_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS -I../libiconv/include" + LIBS="$LIBS ../libiconv/lib/$_libs/libiconv.a" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + INCICONV="-I../libiconv/include" + LIBICONV='${top_builddir}'/../libiconv/lib/$_libs/libiconv.a + LTLIBICONV='${top_builddir}'/../libiconv/lib/libiconv.la + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + CPPFLAGS="$am_save_CPPFLAGS" + LIBS="$am_save_LIBS" + if test "$am_cv_func_iconv" = "yes"; then + break + fi + done + fi + if test "$am_cv_func_iconv" != yes; then + am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" + CPPFLAGS="$LIBS $INCICONV" LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include #include ], @@ -54,6 +82,7 @@ AC_DEFUN([AM_ICONV_LINK], iconv_close(cd);], am_cv_lib_iconv=yes am_cv_func_iconv=yes) + CPPFLAGS="$am_save_CPPFLAGS" LIBS="$am_save_LIBS" fi ]) @@ -61,12 +90,10 @@ AC_DEFUN([AM_ICONV_LINK], AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) fi if test "$am_cv_lib_iconv" = yes; then + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else - dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV - dnl either. - CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi