Add --with-system-zlib in binutils
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 31 Mar 2015 10:53:41 +0000 (03:53 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 31 Mar 2015 10:53:55 +0000 (03:53 -0700)
This patch adds --with-system-zlib and remove --with-zlib in binutils.

* Makefile.am (ZLIB): New.
(ZLIBINC): Likewise.
(AM_CFLAGS): Add $(ZLIBINC).
(readelf_LDADD): Add $(ZLIB).
* configure.ac (AM_ZLIB): Removed.
(zlibdir): New.  AC_SUBST.
(zlibinc): Likewise.
Add --with-system-zlib.
* readelf.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
(uncompress_section_contents): Don't check HAVE_ZLIB_H.
* Makefile.in: Regenerated.
* config.in: Likewise.
* configure: Likewise.

binutils/ChangeLog
binutils/Makefile.am
binutils/Makefile.in
binutils/config.in
binutils/configure
binutils/configure.ac
binutils/doc/Makefile.in
binutils/readelf.c

index a3249ad47d15d755c09c579268bf2568bb1854e3..e0a3d51ce8137b4f61abebb9bb8b4d88b4a8648e 100644 (file)
@@ -1,3 +1,17 @@
+2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * Makefile.am (ZLIB): New.
+       (ZLIBINC): Likewise.
+       (AM_CFLAGS): Add $(ZLIBINC).
+       (readelf_LDADD): Add $(ZLIB).
+       * configure.ac (AM_ZLIB): Removed.
+       (zlibdir): New.  AC_SUBST.
+       (zlibinc): Likewise.
+       Add --with-system-zlib.
+       * Makefile.in: Regenerated.
+       * config.in: Likewise.
+       * configure: Likewise.
+
 2015-03-19  Nick Clifton  <nickc@redhat.com>
 
        * readelf.c (get_machine_flags): Decode RL78's G13 and G14 flags.
index 51dd8e41b5bedc8b51f14f7ebf5b2b582289346f..b55dbd69076a32130195d8f2d44e6c7031c1860b 100644 (file)
@@ -40,9 +40,15 @@ LEXLIB = @LEXLIB@
 am__skiplex =
 am__skipyacc =
 
+# This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
+# -I../zlib, unless we were configured with --with-system-zlib, in which
+# case both are empty.
+ZLIB = @zlibdir@ -lz
+ZLIBINC = @zlibinc@
+
 WARN_CFLAGS = @WARN_CFLAGS@
 NO_WERROR = @NO_WERROR@
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
 LIBICONV = @LIBICONV@
 
 # these two are almost the same program
@@ -230,7 +236,7 @@ objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
 strings_SOURCES = strings.c $(BULIBS)
 
 readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c $(ELFLIBS)
-readelf_LDADD   = $(LIBINTL) $(LIBIBERTY)
+readelf_LDADD   = $(LIBINTL) $(LIBIBERTY) $(ZLIB)
 
 elfedit_SOURCES = elfedit.c version.c $(ELFLIBS)
 elfedit_LDADD = $(LIBINTL) $(LIBIBERTY)
index aaf4d51cbe126ccc59934f301af5d80e3ab7afc1..d675b793a0a1d3d883e963a7d29c3b3f9703f6bc 100644 (file)
@@ -73,7 +73,6 @@ DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
        rcparse.h rcparse.c $(srcdir)/../depcomp $(srcdir)/../ylwrap
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
-       $(top_srcdir)/../config/zlib.m4 \
        $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/depstand.m4 \
        $(top_srcdir)/../config/gettext-sister.m4 \
@@ -432,6 +431,8 @@ target_vendor = @target_vendor@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+zlibdir = @zlibdir@
+zlibinc = @zlibinc@
 AUTOMAKE_OPTIONS = dejagnu no-dist foreign
 ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
 SUBDIRS = doc po
@@ -441,7 +442,13 @@ tooldir = $(exec_prefix)/$(target_alias)
 # maintainer mode is disabled.  Avoid this.
 am__skiplex = 
 am__skipyacc = 
-AM_CFLAGS = $(WARN_CFLAGS)
+
+# This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
+# -I../zlib, unless we were configured with --with-system-zlib, in which
+# case both are empty.
+ZLIB = @zlibdir@ -lz
+ZLIBINC = @zlibinc@
+AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
 
 # these two are almost the same program
 AR_PROG = ar
@@ -575,7 +582,7 @@ size_SOURCES = size.c $(BULIBS)
 objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
 strings_SOURCES = strings.c $(BULIBS)
 readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c $(ELFLIBS)
-readelf_LDADD = $(LIBINTL) $(LIBIBERTY)
+readelf_LDADD = $(LIBINTL) $(LIBIBERTY) $(ZLIB)
 elfedit_SOURCES = elfedit.c version.c $(ELFLIBS)
 elfedit_LDADD = $(LIBINTL) $(LIBIBERTY)
 strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
index a0ed03427a14e6dbca237e5682499d752305ba06..5174d3e0ecf04335753668155978361c6fced13f 100644 (file)
 /* Define to 1 if you have the <windows.h> header file. */
 #undef HAVE_WINDOWS_H
 
-/* Define to 1 if you have the <zlib.h> header file. */
-#undef HAVE_ZLIB_H
-
 /* Define as const if the declaration of iconv() needs const. */
 #undef ICONV_CONST
 
index b960c1979a5d8ea5217c1bf59d9795b5cc80c5c1..ad3948c8b469981f01bac9b379421f7620fde887 100755 (executable)
@@ -618,6 +618,8 @@ BUILD_NLMCONV
 NLMCONV_DEFS
 LTLIBICONV
 LIBICONV
+zlibinc
+zlibdir
 ALLOCA
 DEMANGLER_NAME
 EXEEXT_FOR_BUILD
@@ -777,7 +779,7 @@ enable_werror
 enable_build_warnings
 enable_nls
 enable_maintainer_mode
-with_zlib
+with_system_zlib
 enable_rpath
 with_libiconv_prefix
 '
@@ -1439,7 +1441,7 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-zlib             include zlib support (auto/yes/no) default=auto
+  --with-system-zlib      use installed libz
   --with-gnu-ld           assume the C compiler uses GNU ld default=no
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
@@ -11219,7 +11221,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11222 "configure"
+#line 11224 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11325,7 +11327,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11328 "configure"
+#line 11330 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13536,92 +13538,18 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-# 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"
 
-  # See if the user specified whether he wants zlib support or not.
+# Check whether --with-system-zlib was given.
+if test "${with_system_zlib+set}" = set; then :
+  withval=$with_system_zlib; zlibdir=
+zlibinc=
 
-# Check whether --with-zlib was given.
-if test "${with_zlib+set}" = set; then :
-  withval=$with_zlib;
-else
-  with_zlib=auto
 fi
 
 
-  if test "$with_zlib" != "no"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5
-$as_echo_n "checking for library containing zlibVersion... " >&6; }
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char zlibVersion ();
-int
-main ()
-{
-return zlibVersion ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' z; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_zlibVersion=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if test "${ac_cv_search_zlibVersion+set}" = set; then :
-  break
-fi
-done
-if test "${ac_cv_search_zlibVersion+set}" = set; then :
-
-else
-  ac_cv_search_zlibVersion=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5
-$as_echo "$ac_cv_search_zlibVersion" >&6; }
-ac_res=$ac_cv_search_zlibVersion
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  for ac_header in zlib.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_zlib_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_ZLIB_H 1
-_ACEOF
-
-fi
-
-done
-
-fi
-
-    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
-      as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
-    fi
-  fi
 
 
 
index 31864ec9dc6eb7681ee78b745c06588f01e6c603..0677f9a6af8280b4d1132ed9a2167c6a4e2d9cd1 100644 (file)
@@ -201,10 +201,16 @@ fi
 AC_CHECK_DECLS([environ, fprintf, getc_unlocked, getenv,
                sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
 
-# 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
+# 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)
 
 BFD_BINARY_FOPEN
 
index c828aaed543af79621ea2b5571578572faba4fbe..53e40a5b27b2a6f34f820de8bdeeeb06ef1e78af 100644 (file)
@@ -56,7 +56,6 @@ subdir = doc
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
-       $(top_srcdir)/../config/zlib.m4 \
        $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/depstand.m4 \
        $(top_srcdir)/../config/gettext-sister.m4 \
@@ -280,6 +279,8 @@ target_vendor = @target_vendor@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+zlibdir = @zlibdir@
+zlibinc = @zlibinc@
 AUTOMAKE_OPTIONS = cygnus
 
 # What version of the manual you want; "all" includes everything
index adf2a919990ce75521775d2edcc2d1995ba949bb..17d4fd48413719f6d34e26e53db640a79746e320 100644 (file)
@@ -43,9 +43,7 @@
 #include "sysdep.h"
 #include <assert.h>
 #include <time.h>
-#ifdef HAVE_ZLIB_H
 #include <zlib.h>
-#endif
 #ifdef HAVE_WCHAR_H
 #include <wchar.h>
 #endif
@@ -11956,12 +11954,9 @@ dump_section_as_bytes (Elf_Internal_Shdr * section,
 /* Uncompresses a section that was compressed using zlib, in place.  */
 
 static int
-uncompress_section_contents (unsigned char **buffer ATTRIBUTE_UNUSED,
-                            dwarf_size_type *size ATTRIBUTE_UNUSED)
+uncompress_section_contents (unsigned char **buffer,
+                            dwarf_size_type *size)
 {
-#ifndef HAVE_ZLIB_H
-  return FALSE;
-#else
   dwarf_size_type compressed_size = *size;
   unsigned char * compressed_buffer = *buffer;
   dwarf_size_type uncompressed_size;
@@ -12022,7 +12017,6 @@ uncompress_section_contents (unsigned char **buffer ATTRIBUTE_UNUSED,
   /* Indicate decompression failure.  */
   *buffer = NULL;
   return 0;
-#endif  /* HAVE_ZLIB_H */
 }
 
 static int
This page took 0.038817 seconds and 4 git commands to generate.