This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/8] Add --with-system-zlib in bfd


On Tue, Mar 31, 2015 at 5:15 AM, Pedro Alves <palves@redhat.com> wrote:
> On 03/31/2015 01:01 PM, H.J. Lu wrote:
>>> >
>>> >
>>> > They're all the same.  Just a couple doesn't define zlibdir or zlibinc.
>> If zlib.m4 is changed, I will use it and GCC can also use it. But I
>> don't know if other packages use zlib.m4.
>
> Please change it.  Packages not in the tree can replace zlib.m4 with
> something else if they need it, or adjust to the new body, and thus
> end up consistent with the rest of the toolchain.
>
> "git blame" shows that zlib.m4 was invented exactly to make
> sure bfd/gdb use the same zlib switches and checks:
>
>  https://sourceware.org/ml/binutils/2009-10/msg00600.html
>

These are changes I checked in.

Thanks.


-- 
H.J.
From fa1f5da0b6ff3622f9bf60e348e149b76920abba Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 05:53:39 -0700
Subject: [PATCH 1/7] Replace --with-zlib with --with-system-zlib

	* zlib.m4 (AM_ZLIB): Replace --with-zlib with --with-system-zlib.
---
 config/ChangeLog |  4 ++++
 config/zlib.m4   | 27 +++++++++++++--------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/config/ChangeLog b/config/ChangeLog
index 8a8386d..945f080 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* zlib.m4 (AM_ZLIB): Replace --with-zlib with --with-system-zlib.
+
 2015-03-16  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* isl.m4: Sync with GCC tree.
diff --git a/config/zlib.m4 b/config/zlib.m4
index b017499..3664295 100644
--- a/config/zlib.m4
+++ b/config/zlib.m4
@@ -1,18 +1,17 @@
-dnl A function to check for zlib availability.  zlib is used by default
-dnl unless the user configured with --disable-nls.
+dnl A function to check if the system's zlib library should be used.  The
+dnl builtin zlib dnl is used by default unless the user configured with
+dnl --with-system-zlib.
 
 AC_DEFUN([AM_ZLIB],
 [
-  # See if the user specified whether he wants zlib support or not.
-  AC_ARG_WITH(zlib,
-    [  --with-zlib             include zlib support (auto/yes/no) [default=auto]],
-    [], [with_zlib=auto])
-
-  if test "$with_zlib" != "no"; then
-    AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
-    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
-      AC_MSG_ERROR([zlib (libz) library was explicitly requested but not found])
-    fi
-  fi
+  # 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=
+  )
+  AC_SUBST(zlibdir)
+  AC_SUBST(zlibinc)
 ])
-
-- 
2.1.0

From 9ae46699504c63af285d40ad8856a29300d318e4 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 05:54:55 -0700
Subject: [PATCH 2/7] Revert the AM_ZLIB change in bfd

	* configure.ac: Revert the AM_ZLIB change.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.
---
 bfd/ChangeLog       |  8 ++++++++
 bfd/Makefile.in     |  3 ++-
 bfd/aclocal.m4      |  1 +
 bfd/configure       | 12 ++++++++----
 bfd/configure.ac    | 13 +++----------
 bfd/doc/Makefile.in |  3 ++-
 6 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 25bec34..52ee750 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* configure.ac: Revert the AM_ZLIB change.
+	* Makefile.in: Regenerated.
+	* aclocal.m4: Likewise.
+	* configure: Likewise.
+	* doc/Makefile.in: Likewise.
+
 2015-03-30  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/18169
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 92eb33d..aac3eb2 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -75,7 +75,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
index d9e743e..d3243c6 100644
--- a/bfd/aclocal.m4
+++ b/bfd/aclocal.m4
@@ -979,6 +979,7 @@ m4_include([../config/plugins.m4])
 m4_include([../config/po.m4])
 m4_include([../config/progtest.m4])
 m4_include([../config/stdint.m4])
+m4_include([../config/zlib.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/bfd/configure b/bfd/configure
index b8f1b2b..2231e78 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -13853,20 +13853,24 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-# Use the system's zlib library.
-zlibdir=-L../zlib
-zlibinc="-I\$(srcdir)/../zlib"
+# Link in zlib if we can.  This allows us to read compressed debug sections.
+# This is used only by compress.c.
+
+  # Use the system's zlib library.
+  zlibdir=-L../zlib
+  zlibinc="-I\$(srcdir)/../zlib"
 
 # Check whether --with-system-zlib was given.
 if test "${with_system_zlib+set}" = set; then :
   withval=$with_system_zlib; zlibdir=
-zlibinc=
+  zlibinc=
 
 fi
 
 
 
 
+
 # If we are configured native, pick a core file support file.
 COREFILE=
 COREFLAG=
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 5426781..a1b2035 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -236,16 +236,9 @@ AC_CHECK_DECLS(snprintf)
 AC_CHECK_DECLS(vsnprintf)
 AC_CHECK_DECLS(strnlen)
 
-# 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=
-)
-AC_SUBST(zlibdir)
-AC_SUBST(zlibinc)
+# Link in zlib if we can.  This allows us to read compressed debug sections.
+# This is used only by compress.c.
+AM_ZLIB
 
 # If we are configured native, pick a core file support file.
 COREFILE=
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 6038113..cb9a214 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -71,7 +71,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
-- 
2.1.0

From ed2b5077eb36d82ad7763d76fdd8e82d15f72b7a Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 05:55:46 -0700
Subject: [PATCH 3/7] Revert the AM_ZLIB change in binutils

	* configure.ac: Revert the AM_ZLIB change.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
---
 binutils/ChangeLog    |  7 +++++++
 binutils/Makefile.in  |  6 +++---
 binutils/aclocal.m4   |  1 +
 binutils/configure    | 13 +++++++++----
 binutils/configure.ac | 14 ++++----------
 5 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e0a3d51..bd3890c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,12 @@
 2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* configure.ac: Revert the AM_ZLIB change.
+	* Makefile.in: Regenerated.
+	* aclocal.m4: Likewise.
+	* configure: Likewise.
+
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* Makefile.am (ZLIB): New.
 	(ZLIBINC): Likewise.
 	(AM_CFLAGS): Add $(ZLIBINC).
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index d675b79..2c4d81b 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -88,9 +88,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
diff --git a/binutils/aclocal.m4 b/binutils/aclocal.m4
index fd838a6..074b2ca 100644
--- a/binutils/aclocal.m4
+++ b/binutils/aclocal.m4
@@ -1006,6 +1006,7 @@ m4_include([../config/override.m4])
 m4_include([../config/plugins.m4])
 m4_include([../config/po.m4])
 m4_include([../config/progtest.m4])
+m4_include([../config/zlib.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/binutils/configure b/binutils/configure
index ad3948c..0fc173b 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -13538,14 +13538,18 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-# Use the system's zlib library.
-zlibdir=-L../zlib
-zlibinc="-I\$(srcdir)/../zlib"
+# Link in zlib if we can.  This allows us to read compressed debug
+# sections.  This is used only by readelf.c (objdump uses bfd for
+# reading compressed sections).
+
+  # Use the system's zlib library.
+  zlibdir=-L../zlib
+  zlibinc="-I\$(srcdir)/../zlib"
 
 # Check whether --with-system-zlib was given.
 if test "${with_system_zlib+set}" = set; then :
   withval=$with_system_zlib; zlibdir=
-zlibinc=
+  zlibinc=
 
 fi
 
@@ -13553,6 +13557,7 @@ fi
 
 
 
+
 case "${host}" in
 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
 
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 0677f9a..31864ec 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -201,16 +201,10 @@ fi
 AC_CHECK_DECLS([environ, fprintf, getc_unlocked, getenv,
 		sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
 
-# 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=
-)
-AC_SUBST(zlibdir)
-AC_SUBST(zlibinc)
+# Link in zlib if we can.  This allows us to read compressed debug
+# sections.  This is used only by readelf.c (objdump uses bfd for
+# reading compressed sections).
+AM_ZLIB
 
 BFD_BINARY_FOPEN
 
-- 
2.1.0

From 543b793377eb8c64f8c4e0e68cd3e6b39e857051 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 31 Mar 2015 05:55:18 -0700
Subject: [PATCH 4/7] Revert the AM_ZLIB change in gas

	* configure.ac: Revert the AM_ZLIB change.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
---
 gas/ChangeLog       |  7 +++++++
 gas/Makefile.in     | 10 ++++++----
 gas/aclocal.m4      |  1 +
 gas/configure       | 17 ++++++++++++-----
 gas/configure.ac    |  9 ++-------
 gas/doc/Makefile.in | 10 ++++++----
 6 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 4c2a20d..e5b1cd5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,12 @@
 2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* configure.ac: Revert the AM_ZLIB change.
+	* Makefile.in: Regenerated.
+	* aclocal.m4: Likewise.
+	* configure: Likewise.
+
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* Makefile.am (ZLIBINC): New.
 	(AM_CFLAGS): Add $(ZLIBINC).
 	* as.c: (show_usage): Don't check HAVE_ZLIB_H.
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 240d7d9..1efdb5c 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -77,10 +77,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
-	$(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../bfd/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -297,6 +298,7 @@ te_file = @te_file@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+zlibdir = @zlibdir@
 zlibinc = @zlibinc@
 AUTOMAKE_OPTIONS = 1.11 dejagnu foreign no-dist
 ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
diff --git a/gas/aclocal.m4 b/gas/aclocal.m4
index ea731ac..53da7c7 100644
--- a/gas/aclocal.m4
+++ b/gas/aclocal.m4
@@ -1002,6 +1002,7 @@ m4_include([../config/override.m4])
 m4_include([../config/plugins.m4])
 m4_include([../config/po.m4])
 m4_include([../config/progtest.m4])
+m4_include([../config/zlib.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/gas/configure b/gas/configure
index 07bcee0..002891d 100755
--- a/gas/configure
+++ b/gas/configure
@@ -603,6 +603,7 @@ am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
 zlibinc
+zlibdir
 LIBM
 ALLOCA
 GENINSRC_NEVER_FALSE
@@ -10968,7 +10969,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10971 "configure"
+#line 10972 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11074,7 +11075,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11077 "configure"
+#line 11078 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14320,17 +14321,23 @@ $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
  ;;
 esac
 
-# Use the system's zlib library.
-zlibinc="-I\$(srcdir)/../zlib"
+# Link in zlib if we can.  This allows us to write compressed debug sections.
+
+  # Use the system's zlib library.
+  zlibdir=-L../zlib
+  zlibinc="-I\$(srcdir)/../zlib"
 
 # Check whether --with-system-zlib was given.
 if test "${with_system_zlib+set}" = set; then :
-  withval=$with_system_zlib; zlibinc=
+  withval=$with_system_zlib; zlibdir=
+  zlibinc=
 
 fi
 
 
 
+
+
 # Support for VMS timestamps via cross compile
 
 if test "$ac_cv_header_time_h" = yes; then
diff --git a/gas/configure.ac b/gas/configure.ac
index fbe8c0b..8e05fb8 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -816,13 +816,8 @@ AC_CHECK_DECLS([free, getenv, malloc, mempcpy, realloc, stpcpy, strstr, vsnprint
 
 BFD_BINARY_FOPEN
 
-# Use the system's zlib library.
-zlibinc="-I\$(srcdir)/../zlib"
-AC_ARG_WITH(system-zlib,
-[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
-zlibinc=
-)
-AC_SUBST(zlibinc)
+# Link in zlib if we can.  This allows us to write compressed debug sections.
+AM_ZLIB
 
 # Support for VMS timestamps via cross compile
 
diff --git a/gas/doc/Makefile.in b/gas/doc/Makefile.in
index 49ddf94..3018dcc 100644
--- a/gas/doc/Makefile.in
+++ b/gas/doc/Makefile.in
@@ -68,10 +68,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
 	$(top_srcdir)/../config/plugins.m4 \
 	$(top_srcdir)/../config/po.m4 \
 	$(top_srcdir)/../config/progtest.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
-	$(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../bfd/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -266,6 +267,7 @@ te_file = @te_file@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+zlibdir = @zlibdir@
 zlibinc = @zlibinc@
 AUTOMAKE_OPTIONS = 1.8 cygnus
 
-- 
2.1.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]