On Mon, Mar 16, 2015 at 7:26 PM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Mon, Mar 16, 2015 at 4:43 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >> On Mon, Mar 16, 2015 at 4:41 PM, Joseph Myers <jos...@codesourcery.com> >> wrote: >>> On Mon, 16 Mar 2015, H.J. Lu wrote: >>> >>>> On Mon, Mar 16, 2015 at 3:50 PM, Joseph Myers <jos...@codesourcery.com> >>>> wrote: >>>> > On Fri, 13 Mar 2015, H.J. Lu wrote: >>>> > >>>> >> I am working on SHF_COMPRESSED support: >>>> >> >>>> >> http://www.sco.com/developers/gabi/latest/ch4.sheader.html >>>> >> >>>> >> I will import zlib from GCC source tree into binutils-gdb tree. But >>>> >> zlib >>>> >> failed to build as a target library in binutils-gdb. There is no need >>>> >> to >>>> >> build target libraries if not building gcc. OK for master? >>>> > >>>> > This is definitely wrong. newlib / libgloss is a target library that >>>> > certainly makes sense to build separately from GCC, and the toplevel >>>> > configure / build code should be identical in all three repositories >>>> > (GCC, >>>> > binutils-gdb, newlib-cygwin). >>>> >>>> We need to work out something to avoid building target libraries >>>> in binutils. >>> >>> I suggest not building zlib as a target library unless libgcj is also >>> being built as a target library, given that there should be no need to >>> built it as a target library in isolation. >>> >> >> The logic is there. But somehow it doesn't work for binutils. >> I will take another look. >> > > Here is a patch. It excludes target-zlib if target-libjava isn't built. > Tested in binutils and GCC with java. >
This version is more flexible to support future target libraries which depend on target zlib. -- H.J.
diff --git a/configure b/configure index 9e54319..b719d38 100755 --- a/configure +++ b/configure @@ -6554,6 +6551,15 @@ for i in ${target_configdirs_all} ; do fi done +# Exclude target-zlib if target-libjava isn't built. +case ${target_configdirs} in +*target-libjava*) + ;; +*) + target_configdirs="`echo ${target_configdirs} | sed -e 's/target-zlib//'`" + ;; +esac + # libiberty-linker-plugin is special: it doesn't have its own source directory, # so we have to add it after the preceding checks. if test x"$extra_linker_plugin_flags$extra_linker_plugin_configure_flags" != x diff --git a/configure.ac b/configure.ac index eaf4661..a4e4c7d 100644 --- a/configure.ac +++ b/configure.ac @@ -2251,6 +2248,15 @@ for i in ${target_configdirs_all} ; do fi done +# Exclude target-zlib if target-libjava isn't built. +case ${target_configdirs} in +*target-libjava*) + ;; +*) + target_configdirs="`echo ${target_configdirs} | sed -e 's/target-zlib//'`" + ;; +esac + # libiberty-linker-plugin is special: it doesn't have its own source directory, # so we have to add it after the preceding checks. if test x"$extra_linker_plugin_flags$extra_linker_plugin_configure_flags" != x