Go to file
Yaakov Selkowitz d485982286 Missing parts of fixes for in-tree libiconv
(The previous iconv-related commit missed the config/iconv.m4 change.)

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  <yselkowi@redhat.com>

	* iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present.
---
 config/ChangeLog   |  4 +++
 config/iconv.m4    | 47 +++++++++++++++++++++------
 4 files changed, 112 insertions(+), 36 deletions(-)

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 <stdlib.h>
 #include <iconv.h>],
       [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 <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 @@ 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
-- 
1.9.3

From-SVN: r227118
2015-08-24 10:24:52 +00:00
INSTALL README: Do not mention CVS. 2014-10-12 15:05:28 +00:00
boehm-gc re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
config Missing parts of fixes for in-tree libiconv 2015-08-24 10:24:52 +00:00
contrib texi2pod.pl: Escape braces in regexp involving @strong{...}. 2015-08-04 18:15:45 +02:00
fixincludes inclhack.def (aix_stdio_inline): New fix. 2015-08-14 07:17:29 -04:00
gcc Remove the hack for AARCH64_EXTRA_TUNE_ALL. 2015-08-24 02:56:48 -07:00
gnattools configure.ac (*-*-dragonfly*): New configuration. 2015-06-08 07:27:56 +00:00
gotools gotools: Bump to automake 1.11.6 2015-05-13 10:59:14 +00:00
include DWARF2: add extensions to handle biased types 2015-08-14 09:48:13 +00:00
intl Makefile.def (libiconv): Define bootstrap=true. 2015-08-07 01:13:52 -04:00
libada re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin; causes bootstrap fail building libcc1.) 2015-04-10 06:43:52 +00:00
libatomic configure.tgt: Add *-*-dragonfly to supported targets. 2015-07-14 16:36:51 +01:00
libbacktrace dwarf.c (read_function_entry): Add vec_inlined parameter. 2015-08-13 22:56:01 +00:00
libcc1 hash-traits.h (free_ptr_hash): New class. 2015-06-25 17:06:24 +00:00
libcilkrts libcilkrts: Bump to automake 1.11.6 2015-05-13 11:01:24 +00:00
libcpp Makefile.def (libiconv): Define bootstrap=true. 2015-08-07 01:13:52 -04:00
libdecnumber IA MCU psABI support: changes to libraries 2015-06-30 09:42:07 -07:00
libffi libffi: Bump to automake 1.11.6 2015-05-13 11:23:24 +00:00
libgcc xtensa: fix _Unwind_GetCFA 2015-08-18 01:08:22 +00:00
libgfortran re PR libfortran/54572 (Use libbacktrace library) 2015-08-23 21:50:30 +00:00
libgo libgo/testsuite: another fix for killing the sleep process 2015-08-20 17:10:45 +00:00
libgomp [PR libgomp/65742, PR middle-end/66332] libgomp: Remove plugin for non-shared memory host execution 2015-08-10 18:48:26 +02:00
libiberty cp-demangle.c (d_abi_tags): Preserve di->last_name across any ABI tags. 2015-08-15 13:23:30 +00:00
libitm libitm: Don't redefine __always_inline in local_atomic. 2015-08-20 17:55:24 +00:00
libjava configure.ac (tools/gjdoc): Depend on CREATE_WRAPPERS. 2015-08-11 19:59:25 +02:00
libmpx linux-common.h (LINK_MPX): New. 2015-07-16 08:36:02 +00:00
libobjc re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
liboffloadmic re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
libquadmath Makefile.am (libquadmath_la_SOURCES): Add math/logbq.c. 2015-08-09 08:46:52 +00:00
libsanitizer Use fast unwinder for PowerPC 2015-07-29 06:32:09 +00:00
libssp libssp: Bump to automake 1.11.6 2015-05-13 11:12:39 +00:00
libstdc++-v3 libstdc++/67294 Don't run timed mutex tests on Darwin 2015-08-20 21:36:19 +01:00
libvtv re PR bootstrap/66521 (xgcc: cc1plus segfaults when compiling libstdc++-v3/src/c++11/ostream-inst.cc) 2015-08-01 18:17:39 -07:00
lto-plugin configure.ac: Add AC_USE_SYSTEM_EXTENSIONS. 2015-07-02 10:30:07 +02:00
maintainer-scripts update_version_svn: Add gcc-4_8-branch to IGNORE_BRANCHES. 2015-06-23 07:48:06 +00:00
zlib zlib: Bump to automake 1.11.6 2015-05-13 11:31:32 +00:00
.dir-locals.el * .dir-locals.el: Add. 2013-10-16 18:25:31 +00:00
.gitignore Local Vim config with GNU formatting. 2014-12-09 13:45:47 +00:00
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog re PR libfortran/54572 (Use libbacktrace library) 2015-08-23 21:50:30 +00:00
ChangeLog.jit Merger of dmalcolm/jit branch from git 2014-11-11 21:55:52 +00:00
ChangeLog.tree-ssa
MAINTAINERS MAINTAINERS: Add myself. 2015-08-20 10:12:06 +01:00
Makefile.def re PR libfortran/54572 (Use libbacktrace library) 2015-08-23 21:50:30 +00:00
Makefile.in re PR libfortran/54572 (Use libbacktrace library) 2015-08-23 21:50:30 +00:00
Makefile.tpl revert: configure.ac: Add -std=c++98 to stage1_cxxflags. 2015-05-21 13:05:33 -04:00
README * README: Document use of ranges of years in copyright notices. 2012-07-16 15:01:34 +01:00
compile Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
config-ml.in re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
config.guess * config.sub, config.guess: Import from upstream. 2015-07-28 10:57:40 +10:00
config.rpath
config.sub * config.sub, config.guess: Import from upstream. 2015-07-28 10:57:40 +10:00
configure Remove --with-host-libstdcxx 2015-08-12 15:13:35 +00:00
configure.ac Remove --with-host-libstdcxx 2015-08-12 15:13:35 +00:00
depcomp Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
install-sh Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
libtool-ldflags re PR sanitizer/56781 (boostrap-asan failure: fixincl fails to link (missing -lasan)) 2014-04-17 14:23:28 +02:00
libtool.m4 Always use PIC option with -shared in libtool 2014-11-21 08:49:17 -08:00
ltgcc.m4
ltmain.sh Ensure libgcc_s unwinder is always used on 64-bit Solaris 10+/x86 (PR target/59788) 2014-02-04 09:31:38 +00:00
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
mkdep
mkinstalldirs Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
move-if-change Update move-if-change from gnulib 2014-11-16 16:12:44 +00:00
symlink-tree
ylwrap Update from upstream Automake files. 2014-11-16 14:07:13 +00:00

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.