From patchwork Sun Aug 23 19:36:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaakov Selkowitz X-Patchwork-Id: 8394 Received: (qmail 1124 invoked by alias); 23 Aug 2015 19:37:00 -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 1094 invoked by uid 89); 23 Aug 2015 19:36:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.4 required=5.0 tests=AWL, BAYES_50, 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; Sun, 23 Aug 2015 19:36:58 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 7F69E461DC; Sun, 23 Aug 2015 19:36:57 +0000 (UTC) Received: from YAAKOV04.redhat.com (ovpn-116-27.rdu2.redhat.com [10.10.116.27]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7NJatSI030080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 23 Aug 2015 15:36:56 -0400 Message-ID: <1440358616.9072.5.camel@redhat.com> Subject: Re: [PATCH] config: fix AM_ICONV for in-tree libiconv From: Yaakov Selkowitz To: gcc-patches@gcc.gnu.org, "binutils@sourceware.org" , "gdb-patches@sourceware.org" Cc: DJ Delorie Date: Sun, 23 Aug 2015 14:36:56 -0500 In-Reply-To: <55D8ABBA.3090208@redhat.com> References: <1432934749.13692.9.camel@redhat.com> <55D8ABBA.3090208@redhat.com> Mime-Version: 1.0 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. 2015-07-01 Yaakov Selkowitz config/ * iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present. Index: config/iconv.m4 =================================================================== --- config/iconv.m4 (revision 223875) +++ config/iconv.m4 (working copy) @@ -7,6 +7,7 @@ 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,16 +29,15 @@ 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("",""); @@ -44,8 +44,36 @@ 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 @@ 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_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