@@ -144,6 +144,11 @@ BFD = $(BFD_DIR)/libbfd.a
BFD_SRC = $(srcdir)/$(BFD_DIR)
BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC)
+# 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
+
# Where is the decnumber library? Typically in ../libdecnumber.
LIBDECNUMBER_DIR = ../libdecnumber
LIBDECNUMBER = $(LIBDECNUMBER_DIR)/libdecnumber.a
@@ -578,7 +583,7 @@ INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) $(LDFLAGS) $(CONFIG_
# Libraries and corresponding dependencies for compiling gdb.
# XM_CLIBS, defined in *config files, have host-dependent libs.
# LIBIBERTY appears twice on purpose.
-CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
+CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(ZLIB) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
$(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) \
@LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) \
@@ -1551,8 +1556,7 @@ aclocal_m4_deps = \
../config/tcl.m4 \
../config/depstand.m4 \
../config/lcmessage.m4 \
- ../config/codeset.m4 \
- ../config/zlib.m4
+ ../config/codeset.m4
$(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
@@ -53,8 +53,6 @@ sinclude([../config/lcmessage.m4])
dnl For AM_LANGINFO_CODESET.
sinclude([../config/codeset.m4])
-sinclude([../config/zlib.m4])
-
m4_include([common/common.m4])
dnl For libiberty_INIT.
@@ -467,7 +465,11 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [
CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
- LIBS="-lbfd -liberty $intl $LIBS"
+ if test -f ../zlib/Makefile; then
+ LIBS="-lbfd -L../zlib -lz -liberty $intl $LIBS"
+ else
+ LIBS="-lbfd -lz -liberty $intl $LIBS"
+ fi
AC_CACHE_CHECK([$1], [$2],
[AC_TRY_LINK(
[#include <stdlib.h>
@@ -582,9 +582,6 @@
/* Define to 1 if you have the `XML_StopParser' function. */
#undef HAVE_XML_STOPPARSER
-/* Define to 1 if you have the <zlib.h> header file. */
-#undef HAVE_ZLIB_H
-
/* Define to 1 if your system has the _etext variable. */
#undef HAVE__ETEXT
@@ -680,6 +680,7 @@ READLINE_TEXI_INCFLAG
READLINE_CFLAGS
READLINE_DEPS
READLINE
+zlibdir
MIG
WINDRES
DLLTOOL
@@ -817,7 +818,7 @@ with_curses
enable_profiling
with_pkgversion
with_bugurl
-with_zlib
+with_system_zlib
with_libiconv_prefix
with_iconv_bin
with_system_readline
@@ -1536,7 +1537,7 @@ Optional Packages:
library
--with-pkgversion=PKG Use PKG in the version string in place of "GDB"
--with-bugurl=URL Direct users to URL to report a bug
- --with-zlib include zlib support (auto/yes/no) default=auto
+ --with-system-zlib use installed libz
--with-libiconv-prefix=DIR
search for libiconv in DIR/include and DIR/lib
--with-iconv-bin=PATH specify where to find the iconv program
@@ -7015,90 +7016,15 @@ if test "$ac_res" != no; then :
fi
-# Link in zlib if we can. This allows us to read compressed debug sections.
+# Use the system's zlib library.
+zlibdir=-L../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=
-# 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
# On FreeBSD we may need libutil for kinfo_getvmmap (used by fbsd-nat.c).
@@ -13598,7 +13524,11 @@ esac
CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
- LIBS="-lbfd -liberty $intl $LIBS"
+ if test -f ../zlib/Makefile; then
+ LIBS="-lbfd -L../zlib -lz -liberty $intl $LIBS"
+ else
+ LIBS="-lbfd -lz -liberty $intl $LIBS"
+ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5
$as_echo_n "checking for ELF support in BFD... " >&6; }
if test "${gdb_cv_var_elf+set}" = set; then :
@@ -13708,7 +13638,11 @@ fi
CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
- LIBS="-lbfd -liberty $intl $LIBS"
+ if test -f ../zlib/Makefile; then
+ LIBS="-lbfd -L../zlib -lz -liberty $intl $LIBS"
+ else
+ LIBS="-lbfd -lz -liberty $intl $LIBS"
+ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5
$as_echo_n "checking for Mach-O support in BFD... " >&6; }
if test "${gdb_cv_var_macho+set}" = set; then :
@@ -531,8 +531,13 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
# Some systems (e.g. Solaris) have `socketpair' in libsocket.
AC_SEARCH_LIBS(socketpair, socket)
-# Link in zlib if we can. This allows us to read compressed debug sections.
-AM_ZLIB
+# Use the system's zlib library.
+zlibdir=-L../zlib
+AC_ARG_WITH(system-zlib,
+[AS_HELP_STRING([--with-system-zlib], [use installed libz])],
+zlibdir=
+)
+AC_SUBST(zlibdir)
# On FreeBSD we may need libutil for kinfo_getvmmap (used by fbsd-nat.c).
AC_SEARCH_LIBS(kinfo_getvmmap, util,
@@ -24,9 +24,6 @@
#include "hashtab.h"
#include "filestuff.h"
#include "vec.h"
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
#ifdef HAVE_MMAP
#include <sys/mman.h>
#ifndef MAP_FAILED
@@ -1316,15 +1316,6 @@ This GDB was configured as follows:\n\
fprintf_filtered (stream, _("\
--with-system-gdbinit=%s%s\n\
"), SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE ? " (relocatable)" : "");
-#if HAVE_ZLIB_H
- fprintf_filtered (stream, _("\
- --with-zlib\n\
-"));
-#else
- fprintf_filtered (stream, _("\
- --without-zlib\n\
-"));
-#endif
#if HAVE_LIBBABELTRACE
fprintf_filtered (stream, _("\
--with-babeltrace\n\