[RFA] Add support for --without-zlib (take 2)

Joel Brobecker brobecker@adacore.com
Mon Nov 9 23:29:00 GMT 2009


Binutils Maintainers, ping?

Thank you,
-- 
Joel

On Mon, Nov 02, 2009 at 03:23:19PM -0800, Joel Brobecker wrote:
> Here is a new set of patches for both binutils and GDB that introduce
> --with-zlib/--without-lib, whose intent it allow someone to a user
> the dependency on zlib.
> 
> There is no documentation for now, as I just want to make sure that
> the option is accepted as is before writing it. Jan Kratochvil has
> rewritten most of AM_ZLIB in the new config/zlib.m4 file, so I'll
> make sure to put him on the blame list (aka ChangeLog).
> 
> Tom: I tried to think about how to integrate ourselves better with
> GCC's configure option (--with-system-zlib), but I couldn't think
> of anything nice.  I think GCC should have implemented optional
> in-tree support the way you did for iconv. For now, I'm still proposing
> --with-zlib unless someone offers a better suggestion, which I am
> of course willing to implement.
> 
> Tested on x86_64-linux (--with-zlib, --without-zlib, default).
> 
> I'd like approval on the binutils side.  On the GDB side, I am planning
> on checking everything in if there are no objections and the binutils
> part is approved.
> 
> Thanks,
> -- 
> Joel

> config/
> 
>      * zlib.m4: New file.
> 
> ---
>  config/zlib.m4 |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
>  create mode 100644 config/zlib.m4
> 
> diff --git a/config/zlib.m4 b/config/zlib.m4
> new file mode 100644
> index 0000000..b58228a
> --- /dev/null
> +++ b/config/zlib.m4
> @@ -0,0 +1,18 @@
> +dnl A function to check for zlib availability.  zlib is used by default
> +dnl unless the user configured with --disable-nls.
> +
> +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)],
> +    [], [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
> +])
> +
> -- 
> 1.6.0.4
> 

> bfd/
> 
>      * acinclude.m4: Add include of ../config/zlib.m4.
>      * configure.in: AM_ZLIB to check for zlib support.
>      * configure: Regenerate.
> 
> ---
>  bfd/acinclude.m4 |    2 ++
>  bfd/configure    |   49 ++++++++++++++++++++++++++++++++++---------------
>  bfd/configure.in |    2 +-
>  3 files changed, 37 insertions(+), 16 deletions(-)
> 
> diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
> index aaa147e..d9813bd 100644
> --- a/bfd/acinclude.m4
> +++ b/bfd/acinclude.m4
> @@ -1,3 +1,5 @@
> +sinclude([../config/zlib.m4])
> +
>  dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
>  AC_DEFUN([BFD_BINARY_FOPEN],
>  [AC_REQUIRE([AC_CANONICAL_TARGET])
> diff --git a/bfd/configure.in b/bfd/configure.in
> index 7ca59b0..804a4d5 100644
> --- a/bfd/configure.in
> +++ b/bfd/configure.in
> @@ -225,7 +225,7 @@ AC_CHECK_DECLS(vsnprintf)
>  
>  # Link in zlib if we can.  This allows us to read compressed debug sections.
>  # This is used only by compress.c.
> -AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
> +AM_ZLIB
>  
>  # If we are configured native, pick a core file support file.
>  COREFILE=
> -- 
> 1.6.0.4
> 

> sim/
> 
>      * common/aclocal.m4: Add include of ../../config/zlib.m4.
>      * common/common.m4: Use AM_ZLIB to check for zlib support.
>      * ppc/configure.ac: Likewise.
>      * arm/configure, avr/configure, common/configure, cr16/configure,
>      cris/configure, d10v/configure, erc32/configure, frv/configure,
>      h8300/configure, iq2000/configure, lm32/configure, m32c/configure,
>      m32r/configure, m68hc11/configure, mcore/configure, microblaze/configure,
>      mips/configure, mn10300/configure, moxie/configure, ppc/configure,
>      sh/configure, sh64/configure, v850/configure: Regenerate.
> 
> ---
>  sim/arm/configure        |   26 +-
>  sim/avr/configure        |   26 +-
>  sim/common/aclocal.m4    |    1 +
>  sim/common/common.m4     |    2 +-
>  sim/common/configure     |   21 +-
>  sim/cr16/configure       |   26 +-
>  sim/cris/configure       |   26 +-
>  sim/d10v/configure       |   26 +-
>  sim/erc32/configure      |   26 +-
>  sim/frv/configure        |   26 +-
>  sim/h8300/configure      |   26 +-
>  sim/iq2000/configure     |   26 +-
>  sim/lm32/configure       |   26 +-
>  sim/m32c/configure       |   26 +-
>  sim/m32r/configure       |   26 +-
>  sim/m68hc11/configure    |   26 +-
>  sim/mcore/configure      |   26 +-
>  sim/microblaze/configure | 3748 ++++++++++++++++------------------------------
>  sim/mips/configure       |   26 +-
>  sim/mn10300/configure    |   26 +-
>  sim/moxie/configure      |   36 +-
>  sim/ppc/configure        |   21 +-
>  sim/ppc/configure.ac     |    2 +-
>  sim/sh/configure         |   26 +-
>  sim/sh64/configure       |   26 +-
>  sim/v850/configure       |   26 +-
>  26 files changed, 1841 insertions(+), 2484 deletions(-)
> 
> diff --git a/sim/common/aclocal.m4 b/sim/common/aclocal.m4
> index 7beaebd..9a6a4c8 100644
> --- a/sim/common/aclocal.m4
> +++ b/sim/common/aclocal.m4
> @@ -20,6 +20,7 @@
>  
>  # Include global overrides and fixes for Autoconf.
>  m4_include(../../config/override.m4)
> +sinclude([../../config/zlib.m4])
>  
>  AC_DEFUN([SIM_AC_COMMON],
>  [
> diff --git a/sim/common/common.m4 b/sim/common/common.m4
> index 215208d..97a2c61 100644
> --- a/sim/common/common.m4
> +++ b/sim/common/common.m4
> @@ -56,7 +56,7 @@ AC_CHECK_LIB(nsl, gethostbyname)
>  
>  # BFD conditionally uses zlib, so we must link it in if libbfd does, by
>  # using the same condition.
> -AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
> +AM_ZLIB
>  
>  . ${srcdir}/../../bfd/configure.host
>  
> diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
> index e8ccfe9..ae26d54 100644
> --- a/sim/ppc/configure.ac
> +++ b/sim/ppc/configure.ac
> @@ -668,7 +668,7 @@ AC_ARG_PROGRAM
>  
>  # BFD conditionally uses zlib, so we must link it in if libbfd does, by
>  # using the same condition.
> -AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
> +AM_ZLIB
>  
>  . ${srcdir}/../../bfd/configure.host
>  
> -- 
> 1.6.0.4
> 

> >From 4b1b9db70ab42f5589940c8eca85659cd66c96e8 Mon Sep 17 00:00:00 2001
> From: Joel Brobecker <brobecker@adacore.com>
> Date: Fri, 30 Oct 2009 10:22:55 -0700
> Subject: [PATCH] gdb/
>      * acinclude.m4: Include ../config/zlib.m4.
>      * configure.ac: Use AM_ZLIB to check for zlib support.
>      * configure: Regenerate.
> 
> ---
>  gdb/acinclude.m4 |    2 ++
>  gdb/configure    |   21 ++++++++++++++++++++-
>  gdb/configure.ac |    2 +-
>  3 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
> index c32e1ea..af4639b 100644
> --- a/gdb/acinclude.m4
> +++ b/gdb/acinclude.m4
> @@ -32,6 +32,8 @@ sinclude([../config/lcmessage.m4])
>  dnl For AM_LANGINFO_CODESET.
>  sinclude([../config/codeset.m4])
>  
> +sinclude([../config/zlib.m4])
> +
>  #
>  # Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
>  # makes configure think it's cross compiling. If --target wasn't used, then
> diff --git a/gdb/configure.ac b/gdb/configure.ac
> index b96caef..d3d4f1f 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -422,7 +422,7 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
>  AC_SEARCH_LIBS(socketpair, socket)
>  
>  # Link in zlib if we can.  This allows us to read compressed debug sections.
> -AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
> +AM_ZLIB
>  
>  # On HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c).
>  AC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl])
> -- 
> 1.6.0.4
> 



More information about the Binutils mailing list