This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] config: fix AM_ICONV for in-tree libiconv
- From: Yaakov Selkowitz <yselkowi at redhat dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 01 Jul 2015 17:10:48 -0500
- Subject: Re: [PATCH] config: fix AM_ICONV for in-tree libiconv
- Authentication-results: sourceware.org; auth=none
- References: <1432934749 dot 13692 dot 9 dot camel at redhat dot com> <1435783562 dot 10408 dot 6 dot camel at redhat dot com>
On Wed, 2015-07-01 at 15:46 -0500, Yaakov Selkowitz wrote:
> On Fri, 2015-05-29 at 16:25 -0500, Yaakov Selkowitz wrote:
> > 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.)
> >
> > Once these two patches are merged in to each tree, I will follow with
> > patches to regenerate the various configure scripts and a few other
> > minor corresponding changes.
>
> This patch was bootstrapped in conjunction with the toplevel libiconv
> patch. I don't have write permissions to either repository, so please
> apply once approved.
Here is the regeneration patch for binutils/configure.
--
Yaakov Selkowitz
Associate Software Engineer, ARM
Red Hat, Inc.
2015-07-01 Yaakov Selkowitz <yselkowi@redhat.com>
binutils/
* configure: Regenerate.
diff --git a/binutils/configure b/binutils/configure
index 5db82d7..e875490 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 <stdlib.h>
@@ -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 <stdlib.h>
+#include <iconv.h>
+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