PATCH: Update --with-system-zlib

H.J. Lu
2015-04-01T12:04:30Z

[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]

On Tue, Mar 31, 2015 at 10:04 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Mar 31, 2015 at 10:01 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>> On 31 Mar 2015 09:56, H.J. Lu wrote:
>>> On Tue, Mar 31, 2015 at 9:41 AM, Mike Frysinger wrote:
>>> > On 31 Mar 2015 03:10, H.J. Lu wrote:
>>> >> On Mon, Mar 30, 2015 at 11:13 PM, Mike Frysinger wrote:
>>> >> > On 26 Mar 2015 08:57, H.J. Lu wrote:
>>> >> >> --- a/bfd/configure.ac
>>> >> >> +++ b/bfd/configure.ac
>>> >> >>
>>> >> >> -# Link in zlib if we can. This allows us to read compressed debug sections.
>>> >> >> -# This is used only by compress.c.
>>> >> >> -AM_ZLIB
>>> >> >> +# Use the system's zlib library.
>>> >> >> +zlibdir=-L../zlib
>>> >> >> +zlibinc="-I\$(srcdir)/../zlib"
>>> >> >> +AC_ARG_WITH(system-zlib,
>>> >> >> +[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
>>> >> >> +zlibdir=
>>> >> >> +zlibinc=
>>> >> >> +)
>>> >> >
>>> >> > this is wrong. the 3rd arg is whether the option was specified, not that the
>>> >> > option was disabled. you need to check $withval is equal to "no" (or not equal
>>> >> > to "yes").
>>> >>
>>> >> That is what gcc/configure.ac has and it works for me.
>>> >
>>> > then gcc/configure.ac is also broken. whether "it works for me" is
>>> > irrelevant -- simply read the code and you'll see it's wrong. if you
>>> > pass --without-system-zlib the code wrongly behaves as if you passed
>>> > --with-system-zlib.
>>> >
>>> > i mention this because it is breaking my test builds. not that that
>>> > really matters -- the code is clearly incorrect.
>>>
>>> We should fix zlib.m4 and use it in gcc/configure.ac.
>>
>> sure; i await your patches ;). i'm not trying to point fingers here for
>> pointing's sake -- binutils & gdb were working before and now they're broken,
>> and they broke due to the zlib patches you merged. so i think it's reasonable
>> to expect you to drive further fixes (probably across gcc) even though the bug
>> has existed in gcc for sometime.
>
> Sure. I have put it in my queue.
>
> Sorry for the inconvenience.
>

I checked the enclosed patches to update --with-system-zlib. They fix

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65645

in binutils-gdb tree and add --with-system-zlib to top level configure --help.

--
H.J.

[-- Attachment #2: 0001-Unset-zlibdir-zlibinc-only-for-with-system-zlib.patch --]
[-- Type: text/x-patch, Size: 1234 bytes --]

From 031f1448b68a9eae3392353857c7873f857c2221 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 1 Apr 2015 04:51:55 -0700
Subject: [PATCH 1/3] Unset zlibdir/zlibinc only for --with-system-zlib

* zlib.m4 (AM_ZLIB): Unset zlibdir and zlibinc only for
--with-system-zlib.
---
config/ChangeLog | 5 +++++
config/zlib.m4 | 6 ++++--
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/config/ChangeLog b/config/ChangeLog
index 945f080..6dc4998 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * zlib.m4 (AM_ZLIB): Unset zlibdir and zlibinc only for
+ --with-system-zlib.
+
2015-03-31 H.J. Lu <hongjiu.lu@intel.com>

* zlib.m4 (AM_ZLIB): Replace --with-zlib with --with-system-zlib.
diff --git a/config/zlib.m4 b/config/zlib.m4
index 3664295..aa3ac48 100644
--- a/config/zlib.m4
+++ b/config/zlib.m4
@@ -9,8 +9,10 @@ AC_DEFUN([AM_ZLIB],
zlibinc="-I\$(srcdir)/../zlib"
AC_ARG_WITH(system-zlib,
[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
- zlibdir=
- zlibinc=
+ if test x$with_system_zlib = xyes ; then
+ zlibdir=
+ zlibinc=
+ fi
)
AC_SUBST(zlibdir)
AC_SUBST(zlibinc)
--
2.1.0

[-- Attachment #3: 0002-Regenerate-configure-in-bfd-binutils-gas-gdb.patch --]
[-- Type: text/x-patch, Size: 3763 bytes --]

From afa59b79006af1572ceeebcd2ada5a13e483f6b1 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 1 Apr 2015 04:55:48 -0700
Subject: [PATCH 2/3] Regenerate configure in bfd/binutils/gas/gdb

bfd/

2015-04-01 H.J. Lu <hongjiu.lu@intel.com>

* configure: Regenerated.

binutils/

2015-04-01 H.J. Lu <hongjiu.lu@intel.com>

* configure: Regenerated.

gas/

2015-04-01 H.J. Lu <hongjiu.lu@intel.com>

* configure: Regenerated.

gdb/

2015-04-01 H.J. Lu <hongjiu.lu@intel.com>

* configure: Regenerated.
---
bfd/ChangeLog | 4 ++++
bfd/configure | 6 ++++--
binutils/ChangeLog | 4 ++++
binutils/configure | 6 ++++--
gas/ChangeLog | 4 ++++
gas/configure | 6 ++++--
gdb/ChangeLog | 4 ++++
gdb/configure | 6 ++++--
8 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 10ea6fc..5d3013a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
2015-03-31 Ed Schouten <ed@nuxi.nl>

* config.bfd (targ_defvec): Set to x86_64_elf64_cloudabi_vec
diff --git a/bfd/configure b/bfd/configure
index 777d74a..4f0bdd8 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -13862,8 +13862,10 @@ _ACEOF

# Check whether --with-system-zlib was given.
if test "${with_system_zlib+set}" = set; then :
- withval=$with_system_zlib; zlibdir=
- zlibinc=
+ withval=$with_system_zlib; if test x$with_system_zlib = xyes ; then
+ zlibdir=
+ zlibinc=
+ fi

fi

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index bd3890c..e369f6b 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
2015-03-31 H.J. Lu <hongjiu.lu@intel.com>

* configure.ac: Revert the AM_ZLIB change.
diff --git a/binutils/configure b/binutils/configure
index 0fc173b..c5e424e 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -13548,8 +13548,10 @@ _ACEOF

# Check whether --with-system-zlib was given.
if test "${with_system_zlib+set}" = set; then :
- withval=$with_system_zlib; zlibdir=
- zlibinc=
+ withval=$with_system_zlib; if test x$with_system_zlib = xyes ; then
+ zlibdir=
+ zlibinc=
+ fi

fi

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 7052c62..0c1f815 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
2015-03-31 Ed Schouten <ed@nuxi.nl>

* configure.tgt (fmt): Set to elf for *-*-cloudabi*.
diff --git a/gas/configure b/gas/configure
index 002891d..67cf1dc 100755
--- a/gas/configure
+++ b/gas/configure
@@ -14329,8 +14329,10 @@ esac

# Check whether --with-system-zlib was given.
if test "${with_system_zlib+set}" = set; then :
- withval=$with_system_zlib; zlibdir=
- zlibinc=
+ withval=$with_system_zlib; if test x$with_system_zlib = xyes ; then
+ zlibdir=
+ zlibinc=
+ fi

fi

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0416305..88e4a0c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
2015-03-31 Sergio Durigan Junior <sergiodj@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Oleg Nesterov <oleg@redhat.com>
diff --git a/gdb/configure b/gdb/configure
index d3d093d..3e031a5 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -7025,8 +7025,10 @@ fi

# Check whether --with-system-zlib was given.
if test "${with_system_zlib+set}" = set; then :
- withval=$with_system_zlib; zlibdir=
- zlibinc=
+ withval=$with_system_zlib; if test x$with_system_zlib = xyes ; then
+ zlibdir=
+ zlibinc=
+ fi

fi

--
2.1.0

[-- Attachment #4: 0003-Add-with-system-zlib-to-top-level-configure.patch --]
[-- Type: text/x-patch, Size: 2396 bytes --]

From cf39cfc52ebd683d55fc396a77355f34b5094c04 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 1 Apr 2015 04:57:28 -0700
Subject: [PATCH 3/3] Add --with-system-zlib to top level configure

The top level configure supports --with-system-zlib. This patch makes
configure --help to display --with-system-zlib.

* configure.ac: Add --with-system-zlib.
* configure: Regenerated.
---
ChangeLog | 5 +++++
configure | 8 ++++++++
configure.ac | 2 ++
3 files changed, 15 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 37450f4..457a6bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure.ac: Add --with-system-zlib.
+ * configure: Regenerated.
+
2015-03-31 H.J. Lu <hongjiu.lu@intel.com>

* src-release.sh: Don't configure with --with-target-subdir=.
diff --git a/configure b/configure
index b719d38..97250fa 100755
--- a/configure
+++ b/configure
@@ -747,6 +747,7 @@ ospace_frag'
ac_user_opts='
enable_option_checking
with_build_libsubdir
+with_system_zlib
enable_as_accelerator_for
enable_offload_targets
enable_gold
@@ -1518,6 +1519,7 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-build-libsubdir=DIR Directory where to find libraries for build system
+ --with-system-zlib use installed libz
--with-mpc=PATH specify prefix directory for installed MPC package.
Equivalent to --with-mpc-include=PATH/include plus
--with-mpc-lib=PATH/lib
@@ -2854,6 +2856,12 @@ if test x$with_gnu_as = xno ; then
fi

use_included_zlib=
+
+# Check whether --with-system-zlib was given.
+if test "${with_system_zlib+set}" = set; then :
+ withval=$with_system_zlib;
+fi
+
# Make sure we don't let ZLIB be added if we didn't want it.
if test x$with_system_zlib = xyes ; then
use_included_zlib=no
diff --git a/configure.ac b/configure.ac
index a4e4c7d..ef5f5b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,6 +245,8 @@ if test x$with_gnu_as = xno ; then
fi

use_included_zlib=
+AC_ARG_WITH(system-zlib,
+[AS_HELP_STRING([--with-system-zlib], [use installed libz])])
# Make sure we don't let ZLIB be added if we didn't want it.
if test x$with_system_zlib = xyes ; then
use_included_zlib=no
--
2.1.0