From: Yaakov Selkowitz <yselkowi@redhat.com>
To: gcc-patches@gcc.gnu.org,
"binutils@sourceware.org" <binutils@sourceware.org>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: DJ Delorie <dj@redhat.com>
Subject: Re: [PATCH] config: fix AM_ICONV for in-tree libiconv
Date: Sun, 23 Aug 2015 19:37:00 -0000 [thread overview]
Message-ID: <1440358616.9072.5.camel@redhat.com> (raw)
In-Reply-To: <55D8ABBA.3090208@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 535 bytes --]
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.
--
Yaakov Selkowitz
Associate Software Engineer, ARM
Red Hat, Inc.
[-- Attachment #2: 0002-config-libiconv.patch --]
[-- Type: text/x-patch, Size: 3452 bytes --]
2015-07-01 Yaakov Selkowitz <yselkowi@redhat.com>
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 <stdlib.h>
#include <iconv.h>],
[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 <stdlib.h>
+#include <iconv.h>],
+ [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 <stdlib.h>
#include <iconv.h>],
@@ -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
next prev parent reply other threads:[~2015-08-23 19:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-29 21:25 Yaakov Selkowitz
2015-07-01 20:46 ` Yaakov Selkowitz
2015-07-01 20:52 ` Yaakov Selkowitz
2015-07-01 20:53 ` Yaakov Selkowitz
2015-07-01 22:13 ` Yaakov Selkowitz
2015-08-22 17:05 ` Pedro Alves
2015-08-23 19:37 ` Yaakov Selkowitz [this message]
2015-08-24 10:29 ` Pedro Alves
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=1440358616.9072.5.camel@redhat.com \
--to=yselkowi@redhat.com \
--cc=binutils@sourceware.org \
--cc=dj@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).