This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

ping #3: [RFA] Add --with-libz-prefix option in config/zlib.m4


Yay? Nay?

Thank you.

On Wed, Jan 07, 2015 at 06:45:48PM +0400, Joel Brobecker wrote:
> Hello,
> 
> This patch enhances config/zlib.m4 to introduce an extra option
> --with-libz-prefix which allows us to provide the location of
> the zlib library we want to use during the build.
> 
> config/ChangeLog:
> 
>         * zlib.m4 (AM_ZLIB): Add --with-libz-prefix option support.
> 
> I didn't see any file in the GCC project that uses this macro,
> so for the GCC repository, the change to zlib.m4 is it. But
> I am also attaching to this email a copy of the patch that
> will be applied to the binutils-gdb.git repository, with all
> configury using this macro being re-generated - mostly for info,
> also as a heads-up to both binutils and GDB.
> 
> This was tested by regenerating all autoconf/automake files in
> the binutils-gdb project, and rebuilding GDB, using the following
> combinations:
> 
>   --with-zlib (system zlib used)
>   --with-libz-prefix=/zlib/prefix (specific zlib linked in)
>   --with-zlib --with-libz-prefix=/zlib/prefix (specific zlib linked in)
> 
>   --without-zlib (zlib support turned off)
>   --without-zlib --with-zlib-prefix (zlib support turned off)
> 
>   --with-zlib (no system zlib available, configure fails with expected error)
>   --with-zlib --with-libz-prefix=/invalid/zlib/prefix
>               (no system zlib, configure fails with same error)
> 
> OK to commit?
> 
> Thank you!
> -- 
> Joel
> 
> ---
>  config/zlib.m4 | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/config/zlib.m4 b/config/zlib.m4
> index b017499..1581124 100644
> --- a/config/zlib.m4
> +++ b/config/zlib.m4
> @@ -9,8 +9,15 @@ AC_DEFUN([AM_ZLIB],
>      [], [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_LIB_HAVE_LINKFLAGS([z], [], [#include "zlib.h";],
> +                          [int ret = deflateInit(NULL, 1);])
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      AC_CHECK_HEADERS(zlib.h)
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
>        AC_MSG_ERROR([zlib (libz) library was explicitly requested but not found])
>      fi
>    fi
> -- 
> 1.9.1

> >From 9dfb8ddb97c6dc56a5e1482e7029120d07dc07c8 Mon Sep 17 00:00:00 2001
> From: Joel Brobecker <brobecker@adacore.com>
> Date: Wed, 7 Jan 2015 14:47:51 +0400
> Subject: [PATCH] config/zlib.m4: Add support for --with-libz-prefix
> 
> This patch enhances config/zlib.m4 to introduce an extra option
> --with-libz-prefix which allows us to provide the location of
> the zlib library we want to use during the build.
> 
> config/ChangeLog:
> 
>         * zlib.m4 (AM_ZLIB): Add --with-libz-prefix option support.
> 
> bfd/ChangeLog:
> 
>         * Makefile.in, aclocal.m4, config.in, configure: Regenerate.
> 
> bfd/doc/ChangeLog:
> 
>         * doc/Makefile.in: Regenerate.
> 
> binutils/ChangeLog:
> 
>         * Makefile.in, config.in, configure: Regenerate.
> 
> binutils/doc/ChangeLog:
> 
>         * Makefile.in: Regenerate.
> 
> gas/ChangeLog:
> 
>         * Makefile.in, aclocal.m4, config.in, configure, doc/Makefile.in:
>         Regenerate.
> 
> gdb/ChangeLog:
> 
>         * config.in, configure: Regenerate.
> 
> gold/ChangeLog:
> 
>         * Makefile.in, aclocal.m4, config.in, configure,
>         testsuite/Makefile.in: Regenerate.
> 
> ld/ChangeLog:
> 
>         * Makefile.in, aclocal.m4, config.in, configure: Regenerate.
> 
> sim/common/ChangeLog:
> 
>         * acinclude.m4, config.in, configure: Regenerate.
> 
> sim/ppc/ChangeLog:
> 
>         * config.in, configure: Regenerate.
> 
> This was tested by regenerating all autoconf/automake files in
> the binutils-gdb project, and rebuilding GDB, using the following
> combinations:
> 
>   --with-zlib (system zlib used)
>   --with-libz-prefix=/zlib/prefix (specific zlib linked in)
>   --with-zlib --with-libz-prefix=/zlib/prefix (specific zlib linked in)
> 
>   --without-zlib (zlib support turned off)
>   --without-zlib --with-zlib-prefix (zlib support turned off)
> 
>   --with-zlib (no system zlib available, configure fails with expected error)
>       --with-zlib --with-libz-prefix=/invalid/zlib/prefix
>                   (no system zlib, configure fails with same error)
> ---
>  bfd/Makefile.in            |   6 +
>  bfd/aclocal.m4             |   3 +
>  bfd/config.in              |   3 +
>  bfd/configure              | 669 +++++++++++++++++++++++++++---
>  bfd/doc/Makefile.in        |   6 +
>  binutils/Makefile.in       |   3 +
>  binutils/config.in         |   3 +
>  binutils/configure         | 652 ++++++++++++++++++++++++------
>  binutils/doc/Makefile.in   |   3 +
>  config/zlib.m4             |  11 +-
>  gas/Makefile.in            |   6 +
>  gas/aclocal.m4             |   3 +
>  gas/config.in              |   3 +
>  gas/configure              | 669 +++++++++++++++++++++++++++---
>  gas/doc/Makefile.in        |   6 +
>  gdb/config.in              |   3 +
>  gdb/configure              | 986 ++++++++++++++++++++++++++++++++-------------
>  gold/Makefile.in           |   6 +
>  gold/aclocal.m4            |   3 +
>  gold/config.in             |   3 +
>  gold/configure             | 666 ++++++++++++++++++++++++++++--
>  gold/testsuite/Makefile.in |   6 +
>  ld/Makefile.in             |   6 +
>  ld/aclocal.m4              |   3 +
>  ld/config.in               |   3 +
>  ld/configure               | 669 +++++++++++++++++++++++++++---
>  sim/common/acinclude.m4    |   3 +
>  sim/common/config.in       |   3 +
>  sim/common/configure       | 671 +++++++++++++++++++++++++++---
>  sim/ppc/config.in          |   3 +
>  sim/ppc/configure          | 697 ++++++++++++++++++++++++++++++--
>  31 files changed, 5107 insertions(+), 670 deletions(-)
> 
> diff --git a/bfd/Makefile.in b/bfd/Makefile.in
> index 2c9435c..934d62a 100644
> --- a/bfd/Makefile.in
> +++ b/bfd/Makefile.in
> @@ -70,6 +70,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
>  	$(top_srcdir)/../config/gettext-sister.m4 \
>  	$(top_srcdir)/../config/largefile.m4 \
>  	$(top_srcdir)/../config/lead-dot.m4 \
> +	$(top_srcdir)/../config/lib-ld.m4 \
> +	$(top_srcdir)/../config/lib-link.m4 \
> +	$(top_srcdir)/../config/lib-prefix.m4 \
>  	$(top_srcdir)/../config/nls.m4 \
>  	$(top_srcdir)/../config/override.m4 \
>  	$(top_srcdir)/../config/plugins.m4 \
> @@ -204,6 +207,7 @@ FGREP = @FGREP@
>  GENCAT = @GENCAT@
>  GMSGFMT = @GMSGFMT@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  HDEFINES = @HDEFINES@
>  INCINTL = @INCINTL@
>  INSTALL = @INSTALL@
> @@ -220,9 +224,11 @@ LIBM = @LIBM@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LIBTOOL = @LIBTOOL@
> +LIBZ = @LIBZ@
>  LIPO = @LIPO@
>  LN_S = @LN_S@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MKDIR_P = @MKDIR_P@
> diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
> index d9e743e..358fe09 100644
> --- a/bfd/aclocal.m4
> +++ b/bfd/aclocal.m4
> @@ -973,6 +973,9 @@ m4_include([../config/depstand.m4])
>  m4_include([../config/gettext-sister.m4])
>  m4_include([../config/largefile.m4])
>  m4_include([../config/lead-dot.m4])
> +m4_include([../config/lib-ld.m4])
> +m4_include([../config/lib-link.m4])
> +m4_include([../config/lib-prefix.m4])
>  m4_include([../config/nls.m4])
>  m4_include([../config/override.m4])
>  m4_include([../config/plugins.m4])
> diff --git a/bfd/config.in b/bfd/config.in
> index b911bf6..cf1a97a 100644
> --- a/bfd/config.in
> +++ b/bfd/config.in
> @@ -125,6 +125,9 @@
>  /* Define to 1 if you have the <inttypes.h> header file. */
>  #undef HAVE_INTTYPES_H
>  
> +/* Define if you have the z library. */
> +#undef HAVE_LIBZ
> +
>  /* Define if <sys/procfs.h> has lwpstatus_t. */
>  #undef HAVE_LWPSTATUS_T
>  
> diff --git a/bfd/configure b/bfd/configure
> index f7a9e81..8c92742 100755
> --- a/bfd/configure
> +++ b/bfd/configure
> @@ -620,6 +620,9 @@ SHARED_LDFLAGS
>  LIBM
>  COREFLAG
>  COREFILE
> +LTLIBZ
> +LIBZ
> +HAVE_LIBZ
>  EXEEXT_FOR_BUILD
>  CC_FOR_BUILD
>  BFD_HOSTPTR_T
> @@ -798,6 +801,8 @@ enable_maintainer_mode
>  enable_install_libbfd
>  enable_nls
>  with_zlib
> +enable_rpath
> +with_libz_prefix
>  '
>        ac_precious_vars='build_alias
>  host_alias
> @@ -1449,6 +1454,7 @@ Optional Features:
>  			  (and sometimes confusing) to the casual installer
>    --enable-install-libbfd controls installation of libbfd and related headers
>    --disable-nls           do not use Native Language Support
> +  --disable-rpath         do not hardcode runtime library paths
>  
>  Optional Packages:
>    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
> @@ -1464,6 +1470,9 @@ Optional Packages:
>                            Binutils"
>    --with-bugurl=URL       Direct users to URL to report a bug
>    --with-zlib             include zlib support (auto/yes/no) default=auto
> +  --with-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libz-prefix[=DIR]  search for libz in DIR/include and DIR/lib
> +  --without-libz-prefix     don't search for libz in includedir and libdir
>  
>  Some influential environment variables:
>    CC          C compiler command
> @@ -11421,7 +11430,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 11424 "configure"
> +#line 11433 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -11527,7 +11536,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 11530 "configure"
> +#line 11539 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -13854,6 +13863,164 @@ _ACEOF
>  # Link in zlib if we can.  This allows us to read compressed debug sections.
>  # This is used only by compress.c.
>  
> +      if test "X$prefix" = "XNONE"; then
> +    acl_final_prefix="$ac_default_prefix"
> +  else
> +    acl_final_prefix="$prefix"
> +  fi
> +  if test "X$exec_prefix" = "XNONE"; then
> +    acl_final_exec_prefix='${prefix}'
> +  else
> +    acl_final_exec_prefix="$exec_prefix"
> +  fi
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-gnu-ld was given.
> +if test "${with_gnu_ld+set}" = set; then :
> +  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
> +else
> +  with_gnu_ld=no
> +fi
> +
> +# Prepare PATH_SEPARATOR.
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> +  echo "#! /bin/sh" >conf$$.sh
> +  echo  "exit 0"   >>conf$$.sh
> +  chmod +x conf$$.sh
> +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> +    PATH_SEPARATOR=';'
> +  else
> +    PATH_SEPARATOR=:
> +  fi
> +  rm -f conf$$.sh
> +fi
> +ac_prog=ld
> +if test "$GCC" = yes; then
> +  # Check if gcc -print-prog-name=ld gives a path.
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
> +$as_echo_n "checking for ld used by GCC... " >&6; }
> +  case $host in
> +  *-*-mingw*)
> +    # gcc leaves a trailing carriage return which upsets mingw
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> +  *)
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> +  esac
> +  case $ac_prog in
> +    # Accept absolute paths.
> +    [\\/]* | [A-Za-z]:[\\/]*)
> +      re_direlt='/[^/][^/]*/\.\./'
> +      # Canonicalize the path of ld
> +      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> +      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> +	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> +      done
> +      test -z "$LD" && LD="$ac_prog"
> +      ;;
> +  "")
> +    # If it fails, then pretend we aren't using GCC.
> +    ac_prog=ld
> +    ;;
> +  *)
> +    # If it is relative, then search for the first ld in PATH.
> +    with_gnu_ld=unknown
> +    ;;
> +  esac
> +elif test "$with_gnu_ld" = yes; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> +$as_echo_n "checking for GNU ld... " >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> +$as_echo_n "checking for non-GNU ld... " >&6; }
> +fi
> +if test "${acl_cv_path_LD+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$LD"; then
> +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
> +  for ac_dir in $PATH; do
> +    test -z "$ac_dir" && ac_dir=.
> +    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
> +      acl_cv_path_LD="$ac_dir/$ac_prog"
> +      # Check to see if the program is GNU ld.  I'd rather use --version,
> +      # but apparently some GNU ld's only accept -v.
> +      # Break only if it was the GNU/non-GNU ld that we prefer.
> +      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
> +	test "$with_gnu_ld" != no && break
> +      else
> +	test "$with_gnu_ld" != yes && break
> +      fi
> +    fi
> +  done
> +  IFS="$ac_save_ifs"
> +else
> +  acl_cv_path_LD="$LD" # Let the user override the test with a path.
> +fi
> +fi
> +
> +LD="$acl_cv_path_LD"
> +if test -n "$LD"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> +$as_echo "$LD" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
> +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> +if test "${acl_cv_prog_gnu_ld+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +  acl_cv_prog_gnu_ld=yes
> +else
> +  acl_cv_prog_gnu_ld=no
> +fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
> +$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> +with_gnu_ld=$acl_cv_prog_gnu_ld
> +
> +
> +
> +                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +$as_echo_n "checking for shared library run path origin... " >&6; }
> +if test "${acl_cv_rpath+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
> +    . ./conftest.sh
> +    rm -f ./conftest.sh
> +    acl_cv_rpath=done
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> +$as_echo "$acl_cv_rpath" >&6; }
> +  wl="$acl_cv_wl"
> +  libext="$acl_cv_libext"
> +  shlibext="$acl_cv_shlibext"
> +  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> +  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> +  hardcode_direct="$acl_cv_hardcode_direct"
> +  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> +    # Check whether --enable-rpath was given.
> +if test "${enable_rpath+set}" = set; then :
> +  enableval=$enable_rpath; :
> +else
> +  enable_rpath=yes
> +fi
> +
> +
> +
>    # See if the user specified whether he wants zlib support or not.
>  
>  # Check whether --with-zlib was given.
> @@ -13865,60 +14032,472 @@ 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 :
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libz-prefix was given.
> +if test "${with_libz_prefix+set}" = set; then :
> +  withval=$with_libz_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +      LIBZ=
> +  LTLIBZ=
> +  INCZ=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='z '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            else
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  else
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_a"
> +              else
> +                                                LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCZ="${INCZ}${INCZ:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBZ="${LIBZ}${LIBZ:+ }$dep"
> +                    LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +            LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name"
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCZ; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
> +$as_echo_n "checking for libz... " >&6; }
> +if test "${ac_cv_libz+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 ();
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBZ"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "zlib.h";
>  int
>  main ()
>  {
> -return zlibVersion ();
> +int ret = deflateInit(NULL, 1);
>    ;
>    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
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libz=yes
> +else
> +  ac_cv_libz=no
>  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 :
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
>  
> -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
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5
> +$as_echo "$ac_cv_libz" >&6; }
> +  if test "$ac_cv_libz" = yes; then
> +    HAVE_LIBZ=yes
> +
> +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5
> +$as_echo_n "checking how to link with libz... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5
> +$as_echo "$LIBZ" >&6; }
> +  else
> +    HAVE_LIBZ=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBZ=
> +    LTLIBZ=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      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 :
> @@ -13930,9 +14509,9 @@ fi
>  
>  done
>  
> -fi
> -
> -    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
>        as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
>      fi
>    fi
> diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
> index 3be6a5e..7257ed9 100644
> --- a/bfd/doc/Makefile.in
> +++ b/bfd/doc/Makefile.in
> @@ -66,6 +66,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
>  	$(top_srcdir)/../config/gettext-sister.m4 \
>  	$(top_srcdir)/../config/largefile.m4 \
>  	$(top_srcdir)/../config/lead-dot.m4 \
> +	$(top_srcdir)/../config/lib-ld.m4 \
> +	$(top_srcdir)/../config/lib-link.m4 \
> +	$(top_srcdir)/../config/lib-prefix.m4 \
>  	$(top_srcdir)/../config/nls.m4 \
>  	$(top_srcdir)/../config/override.m4 \
>  	$(top_srcdir)/../config/plugins.m4 \
> @@ -164,6 +167,7 @@ FGREP = @FGREP@
>  GENCAT = @GENCAT@
>  GMSGFMT = @GMSGFMT@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  HDEFINES = @HDEFINES@
>  INCINTL = @INCINTL@
>  INSTALL = @INSTALL@
> @@ -180,9 +184,11 @@ LIBM = @LIBM@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LIBTOOL = @LIBTOOL@
> +LIBZ = @LIBZ@
>  LIPO = @LIPO@
>  LN_S = @LN_S@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MKDIR_P = @MKDIR_P@
> diff --git a/binutils/Makefile.in b/binutils/Makefile.in
> index aaf4d51..05fb968 100644
> --- a/binutils/Makefile.in
> +++ b/binutils/Makefile.in
> @@ -316,6 +316,7 @@ FGREP = @FGREP@
>  GENCAT = @GENCAT@
>  GMSGFMT = @GMSGFMT@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  HDEFINES = @HDEFINES@
>  INCINTL = @INCINTL@
>  INSTALL = @INSTALL@
> @@ -335,10 +336,12 @@ LIBINTL_DEP = @LIBINTL_DEP@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LIBTOOL = @LIBTOOL@
> +LIBZ = @LIBZ@
>  LIPO = @LIPO@
>  LN_S = @LN_S@
>  LTLIBICONV = @LTLIBICONV@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MKDIR_P = @MKDIR_P@
> diff --git a/binutils/config.in b/binutils/config.in
> index a0ed034..dd7d832 100644
> --- a/binutils/config.in
> +++ b/binutils/config.in
> @@ -102,6 +102,9 @@
>  /* Define if your <locale.h> file defines LC_MESSAGES. */
>  #undef HAVE_LC_MESSAGES
>  
> +/* Define if you have the z library. */
> +#undef HAVE_LIBZ
> +
>  /* Define to 1 if you have the <limits.h> header file. */
>  #undef HAVE_LIMITS_H
>  
> diff --git a/binutils/configure b/binutils/configure
> index b960c19..8280dd8 100755
> --- a/binutils/configure
> +++ b/binutils/configure
> @@ -618,6 +618,9 @@ BUILD_NLMCONV
>  NLMCONV_DEFS
>  LTLIBICONV
>  LIBICONV
> +LTLIBZ
> +LIBZ
> +HAVE_LIBZ
>  ALLOCA
>  DEMANGLER_NAME
>  EXEEXT_FOR_BUILD
> @@ -779,6 +782,7 @@ enable_nls
>  enable_maintainer_mode
>  with_zlib
>  enable_rpath
> +with_libz_prefix
>  with_libiconv_prefix
>  '
>        ac_precious_vars='build_alias
> @@ -1441,6 +1445,8 @@ Optional Packages:
>    --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
>    --with-zlib             include zlib support (auto/yes/no) default=auto
>    --with-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libz-prefix[=DIR]  search for libz in DIR/include and DIR/lib
> +  --without-libz-prefix     don't search for libz in includedir and libdir
>    --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 +11225,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 11228 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -11325,7 +11331,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 11334 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -13540,121 +13546,6 @@ _ACEOF
>  # sections.  This is used only by readelf.c (objdump uses bfd for
>  # reading compressed sections).
>  
> -  # See if the user specified whether he wants zlib support or not.
> -
> -# 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
> -
> -
> -
> -case "${host}" in
> -*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
> -
> -$as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
> - ;;
> -esac
> -
> -# target-specific stuff:
> -
> -# Canonicalize the secondary target names.
> -if test -n "$enable_targets"; then
> -    for targ in `echo $enable_targets | sed 's/,/ /g'`
> -    do
> -	result=`$ac_config_sub $targ 2>/dev/null`
> -	if test -n "$result"; then
> -	    canon_targets="$canon_targets $result"
> -	else
> -	    # Allow targets that config.sub doesn't recognize, like "all".
> -	    canon_targets="$canon_targets $targ"
> -	fi
> -    done
> -fi
> -
> -ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
> -if test "x$ac_cv_header_iconv_h" = x""yes; then :
> -
> -fi
> -
> -
> -
>        if test "X$prefix" = "XNONE"; then
>      acl_final_prefix="$ac_default_prefix"
>    else
> @@ -13813,6 +13704,533 @@ fi
>  
>  
>  
> +  # See if the user specified whether he wants zlib support or not.
> +
> +# 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
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libz-prefix was given.
> +if test "${with_libz_prefix+set}" = set; then :
> +  withval=$with_libz_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +      LIBZ=
> +  LTLIBZ=
> +  INCZ=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='z '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            else
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  else
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_a"
> +              else
> +                                                LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCZ="${INCZ}${INCZ:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBZ="${LIBZ}${LIBZ:+ }$dep"
> +                    LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +            LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name"
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCZ; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
> +$as_echo_n "checking for libz... " >&6; }
> +if test "${ac_cv_libz+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBZ"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "zlib.h";
> +int
> +main ()
> +{
> +int ret = deflateInit(NULL, 1);
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libz=yes
> +else
> +  ac_cv_libz=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5
> +$as_echo "$ac_cv_libz" >&6; }
> +  if test "$ac_cv_libz" = yes; then
> +    HAVE_LIBZ=yes
> +
> +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5
> +$as_echo_n "checking how to link with libz... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5
> +$as_echo "$LIBZ" >&6; }
> +  else
> +    HAVE_LIBZ=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBZ=
> +    LTLIBZ=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      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
> +
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
> +      as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
> +    fi
> +  fi
> +
> +
> +
> +case "${host}" in
> +*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
> +
> +$as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
> + ;;
> +esac
> +
> +# target-specific stuff:
> +
> +# Canonicalize the secondary target names.
> +if test -n "$enable_targets"; then
> +    for targ in `echo $enable_targets | sed 's/,/ /g'`
> +    do
> +	result=`$ac_config_sub $targ 2>/dev/null`
> +	if test -n "$result"; then
> +	    canon_targets="$canon_targets $result"
> +	else
> +	    # Allow targets that config.sub doesn't recognize, like "all".
> +	    canon_targets="$canon_targets $targ"
> +	fi
> +    done
> +fi
> +
> +ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
> +if test "x$ac_cv_header_iconv_h" = x""yes; then :
> +
> +fi
> +
> +
> +
>  
>  
>  
> diff --git a/binutils/doc/Makefile.in b/binutils/doc/Makefile.in
> index c828aae..96657ed 100644
> --- a/binutils/doc/Makefile.in
> +++ b/binutils/doc/Makefile.in
> @@ -166,6 +166,7 @@ FGREP = @FGREP@
>  GENCAT = @GENCAT@
>  GMSGFMT = @GMSGFMT@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  HDEFINES = @HDEFINES@
>  INCINTL = @INCINTL@
>  INSTALL = @INSTALL@
> @@ -185,10 +186,12 @@ LIBINTL_DEP = @LIBINTL_DEP@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LIBTOOL = @LIBTOOL@
> +LIBZ = @LIBZ@
>  LIPO = @LIPO@
>  LN_S = @LN_S@
>  LTLIBICONV = @LTLIBICONV@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MKDIR_P = @MKDIR_P@
> diff --git a/config/zlib.m4 b/config/zlib.m4
> index b017499..1581124 100644
> --- a/config/zlib.m4
> +++ b/config/zlib.m4
> @@ -9,8 +9,15 @@ AC_DEFUN([AM_ZLIB],
>      [], [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_LIB_HAVE_LINKFLAGS([z], [], [#include "zlib.h";],
> +                          [int ret = deflateInit(NULL, 1);])
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      AC_CHECK_HEADERS(zlib.h)
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
>        AC_MSG_ERROR([zlib (libz) library was explicitly requested but not found])
>      fi
>    fi
> diff --git a/gas/Makefile.in b/gas/Makefile.in
> index f190714..dd21288 100644
> --- a/gas/Makefile.in
> +++ b/gas/Makefile.in
> @@ -73,6 +73,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
>  	$(top_srcdir)/../config/largefile.m4 \
>  	$(top_srcdir)/../config/lcmessage.m4 \
>  	$(top_srcdir)/../config/lead-dot.m4 \
> +	$(top_srcdir)/../config/lib-ld.m4 \
> +	$(top_srcdir)/../config/lib-link.m4 \
> +	$(top_srcdir)/../config/lib-prefix.m4 \
>  	$(top_srcdir)/../config/nls.m4 \
>  	$(top_srcdir)/../config/override.m4 \
>  	$(top_srcdir)/../config/plugins.m4 \
> @@ -181,6 +184,7 @@ GDBINIT = @GDBINIT@
>  GENCAT = @GENCAT@
>  GMSGFMT = @GMSGFMT@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  INCINTL = @INCINTL@
>  INSTALL = @INSTALL@
>  INSTALL_DATA = @INSTALL_DATA@
> @@ -199,9 +203,11 @@ LIBM = @LIBM@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LIBTOOL = @LIBTOOL@
> +LIBZ = @LIBZ@
>  LIPO = @LIPO@
>  LN_S = @LN_S@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MKDIR_P = @MKDIR_P@
> diff --git a/gas/aclocal.m4 b/gas/aclocal.m4
> index ea731ac..3d9deaf 100644
> --- a/gas/aclocal.m4
> +++ b/gas/aclocal.m4
> @@ -997,6 +997,9 @@ m4_include([../config/gettext-sister.m4])
>  m4_include([../config/largefile.m4])
>  m4_include([../config/lcmessage.m4])
>  m4_include([../config/lead-dot.m4])
> +m4_include([../config/lib-ld.m4])
> +m4_include([../config/lib-link.m4])
> +m4_include([../config/lib-prefix.m4])
>  m4_include([../config/nls.m4])
>  m4_include([../config/override.m4])
>  m4_include([../config/plugins.m4])
> diff --git a/gas/config.in b/gas/config.in
> index fef16ee..c326c74 100644
> --- a/gas/config.in
> +++ b/gas/config.in
> @@ -100,6 +100,9 @@
>  /* Define if your <locale.h> file defines LC_MESSAGES. */
>  #undef HAVE_LC_MESSAGES
>  
> +/* Define if you have the z library. */
> +#undef HAVE_LIBZ
> +
>  /* Define to 1 if you have the <limits.h> header file. */
>  #undef HAVE_LIMITS_H
>  
> diff --git a/gas/configure b/gas/configure
> index 75d8a52..7ebd36a 100755
> --- a/gas/configure
> +++ b/gas/configure
> @@ -602,6 +602,9 @@ ac_subst_vars='am__EXEEXT_FALSE
>  am__EXEEXT_TRUE
>  LTLIBOBJS
>  LIBOBJS
> +LTLIBZ
> +LIBZ
> +HAVE_LIBZ
>  LIBM
>  ALLOCA
>  GENINSRC_NEVER_FALSE
> @@ -767,6 +770,8 @@ enable_build_warnings
>  enable_nls
>  enable_maintainer_mode
>  with_zlib
> +enable_rpath
> +with_libz_prefix
>  '
>        ac_precious_vars='build_alias
>  host_alias
> @@ -1415,6 +1420,7 @@ Optional Features:
>    --disable-nls           do not use Native Language Support
>    --enable-maintainer-mode  enable make rules and dependencies not useful
>  			  (and sometimes confusing) to the casual installer
> +  --disable-rpath         do not hardcode runtime library paths
>  
>  Optional Packages:
>    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
> @@ -1423,6 +1429,9 @@ Optional Packages:
>                            both]
>    --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
>    --with-zlib             include zlib support (auto/yes/no) default=auto
> +  --with-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libz-prefix[=DIR]  search for libz in DIR/include and DIR/lib
> +  --without-libz-prefix     don't search for libz in includedir and libdir
>  
>  Some influential environment variables:
>    CC          C compiler command
> @@ -10967,7 +10976,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 10970 "configure"
> +#line 10979 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -11073,7 +11082,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 11076 "configure"
> +#line 11085 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -14321,6 +14330,164 @@ esac
>  
>  # Link in zlib if we can.  This allows us to write compressed debug sections.
>  
> +      if test "X$prefix" = "XNONE"; then
> +    acl_final_prefix="$ac_default_prefix"
> +  else
> +    acl_final_prefix="$prefix"
> +  fi
> +  if test "X$exec_prefix" = "XNONE"; then
> +    acl_final_exec_prefix='${prefix}'
> +  else
> +    acl_final_exec_prefix="$exec_prefix"
> +  fi
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-gnu-ld was given.
> +if test "${with_gnu_ld+set}" = set; then :
> +  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
> +else
> +  with_gnu_ld=no
> +fi
> +
> +# Prepare PATH_SEPARATOR.
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> +  echo "#! /bin/sh" >conf$$.sh
> +  echo  "exit 0"   >>conf$$.sh
> +  chmod +x conf$$.sh
> +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> +    PATH_SEPARATOR=';'
> +  else
> +    PATH_SEPARATOR=:
> +  fi
> +  rm -f conf$$.sh
> +fi
> +ac_prog=ld
> +if test "$GCC" = yes; then
> +  # Check if gcc -print-prog-name=ld gives a path.
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
> +$as_echo_n "checking for ld used by GCC... " >&6; }
> +  case $host in
> +  *-*-mingw*)
> +    # gcc leaves a trailing carriage return which upsets mingw
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> +  *)
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> +  esac
> +  case $ac_prog in
> +    # Accept absolute paths.
> +    [\\/]* | [A-Za-z]:[\\/]*)
> +      re_direlt='/[^/][^/]*/\.\./'
> +      # Canonicalize the path of ld
> +      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> +      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> +	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> +      done
> +      test -z "$LD" && LD="$ac_prog"
> +      ;;
> +  "")
> +    # If it fails, then pretend we aren't using GCC.
> +    ac_prog=ld
> +    ;;
> +  *)
> +    # If it is relative, then search for the first ld in PATH.
> +    with_gnu_ld=unknown
> +    ;;
> +  esac
> +elif test "$with_gnu_ld" = yes; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> +$as_echo_n "checking for GNU ld... " >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> +$as_echo_n "checking for non-GNU ld... " >&6; }
> +fi
> +if test "${acl_cv_path_LD+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$LD"; then
> +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
> +  for ac_dir in $PATH; do
> +    test -z "$ac_dir" && ac_dir=.
> +    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
> +      acl_cv_path_LD="$ac_dir/$ac_prog"
> +      # Check to see if the program is GNU ld.  I'd rather use --version,
> +      # but apparently some GNU ld's only accept -v.
> +      # Break only if it was the GNU/non-GNU ld that we prefer.
> +      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
> +	test "$with_gnu_ld" != no && break
> +      else
> +	test "$with_gnu_ld" != yes && break
> +      fi
> +    fi
> +  done
> +  IFS="$ac_save_ifs"
> +else
> +  acl_cv_path_LD="$LD" # Let the user override the test with a path.
> +fi
> +fi
> +
> +LD="$acl_cv_path_LD"
> +if test -n "$LD"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> +$as_echo "$LD" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
> +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> +if test "${acl_cv_prog_gnu_ld+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +  acl_cv_prog_gnu_ld=yes
> +else
> +  acl_cv_prog_gnu_ld=no
> +fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
> +$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> +with_gnu_ld=$acl_cv_prog_gnu_ld
> +
> +
> +
> +                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +$as_echo_n "checking for shared library run path origin... " >&6; }
> +if test "${acl_cv_rpath+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
> +    . ./conftest.sh
> +    rm -f ./conftest.sh
> +    acl_cv_rpath=done
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> +$as_echo "$acl_cv_rpath" >&6; }
> +  wl="$acl_cv_wl"
> +  libext="$acl_cv_libext"
> +  shlibext="$acl_cv_shlibext"
> +  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> +  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> +  hardcode_direct="$acl_cv_hardcode_direct"
> +  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> +    # Check whether --enable-rpath was given.
> +if test "${enable_rpath+set}" = set; then :
> +  enableval=$enable_rpath; :
> +else
> +  enable_rpath=yes
> +fi
> +
> +
> +
>    # See if the user specified whether he wants zlib support or not.
>  
>  # Check whether --with-zlib was given.
> @@ -14332,60 +14499,472 @@ 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 :
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libz-prefix was given.
> +if test "${with_libz_prefix+set}" = set; then :
> +  withval=$with_libz_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +      LIBZ=
> +  LTLIBZ=
> +  INCZ=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='z '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            else
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  else
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_a"
> +              else
> +                                                LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCZ="${INCZ}${INCZ:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBZ="${LIBZ}${LIBZ:+ }$dep"
> +                    LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +            LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name"
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCZ; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
> +$as_echo_n "checking for libz... " >&6; }
> +if test "${ac_cv_libz+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 ();
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBZ"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "zlib.h";
>  int
>  main ()
>  {
> -return zlibVersion ();
> +int ret = deflateInit(NULL, 1);
>    ;
>    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
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libz=yes
> +else
> +  ac_cv_libz=no
>  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 :
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
>  
> -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
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5
> +$as_echo "$ac_cv_libz" >&6; }
> +  if test "$ac_cv_libz" = yes; then
> +    HAVE_LIBZ=yes
> +
> +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5
> +$as_echo_n "checking how to link with libz... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5
> +$as_echo "$LIBZ" >&6; }
> +  else
> +    HAVE_LIBZ=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBZ=
> +    LTLIBZ=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      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 :
> @@ -14397,9 +14976,9 @@ fi
>  
>  done
>  
> -fi
> -
> -    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
>        as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
>      fi
>    fi
> diff --git a/gas/doc/Makefile.in b/gas/doc/Makefile.in
> index 02841d9..86d5a5d 100644
> --- a/gas/doc/Makefile.in
> +++ b/gas/doc/Makefile.in
> @@ -64,6 +64,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
>  	$(top_srcdir)/../config/largefile.m4 \
>  	$(top_srcdir)/../config/lcmessage.m4 \
>  	$(top_srcdir)/../config/lead-dot.m4 \
> +	$(top_srcdir)/../config/lib-ld.m4 \
> +	$(top_srcdir)/../config/lib-link.m4 \
> +	$(top_srcdir)/../config/lib-prefix.m4 \
>  	$(top_srcdir)/../config/nls.m4 \
>  	$(top_srcdir)/../config/override.m4 \
>  	$(top_srcdir)/../config/plugins.m4 \
> @@ -150,6 +153,7 @@ GDBINIT = @GDBINIT@
>  GENCAT = @GENCAT@
>  GMSGFMT = @GMSGFMT@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  INCINTL = @INCINTL@
>  INSTALL = @INSTALL@
>  INSTALL_DATA = @INSTALL_DATA@
> @@ -168,9 +172,11 @@ LIBM = @LIBM@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LIBTOOL = @LIBTOOL@
> +LIBZ = @LIBZ@
>  LIPO = @LIPO@
>  LN_S = @LN_S@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MKDIR_P = @MKDIR_P@
> diff --git a/gdb/config.in b/gdb/config.in
> index 9d3f32d..9b04c29 100644
> --- a/gdb/config.in
> +++ b/gdb/config.in
> @@ -213,6 +213,9 @@
>  /* Define to 1 if you have the `w' library (-lw). */
>  #undef HAVE_LIBW
>  
> +/* Define if you have the z library. */
> +#undef HAVE_LIBZ
> +
>  /* Define to 1 if you have the <linux/perf_event.h> header file. */
>  #undef HAVE_LINUX_PERF_EVENT_H
>  
> diff --git a/gdb/configure b/gdb/configure
> index 7ff74ba..0ae5c79 100755
> --- a/gdb/configure
> +++ b/gdb/configure
> @@ -680,6 +680,9 @@ READLINE_TEXI_INCFLAG
>  READLINE_CFLAGS
>  READLINE_DEPS
>  READLINE
> +LTLIBZ
> +LIBZ
> +HAVE_LIBZ
>  MIG
>  WINDRES
>  DLLTOOL
> @@ -813,13 +816,14 @@ enable_profiling
>  with_pkgversion
>  with_bugurl
>  with_zlib
> +with_gnu_ld
> +enable_rpath
> +with_libz_prefix
>  with_libiconv_prefix
>  with_iconv_bin
>  with_system_readline
>  with_jit_reader_dir
>  with_expat
> -with_gnu_ld
> -enable_rpath
>  with_libexpat_prefix
>  with_python
>  with_guile
> @@ -1528,6 +1532,9 @@ Optional Packages:
>    --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-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libz-prefix[=DIR]  search for libz in DIR/include and DIR/lib
> +  --without-libz-prefix     don't search for libz in includedir and libdir
>    --with-libiconv-prefix=DIR
>                            search for libiconv in DIR/include and DIR/lib
>    --with-iconv-bin=PATH   specify where to find the iconv program
> @@ -1535,7 +1542,6 @@ Optional Packages:
>    --with-jit-reader-dir=PATH
>                            directory to load the JIT readers from
>    --with-expat            include expat support (auto/yes/no)
> -  --with-gnu-ld           assume the C compiler uses GNU ld default=no
>    --with-libexpat-prefix[=DIR]  search for libexpat in DIR/include and DIR/lib
>    --without-libexpat-prefix     don't search for libexpat in includedir and libdir
>    --with-python[=PYTHON]  include python support
> @@ -6682,163 +6688,733 @@ fi
>  
>  # Link in zlib if we can.  This allows us to read compressed debug sections.
>  
> -  # See if the user specified whether he wants zlib support or not.
> -
> -# Check whether --with-zlib was given.
> -if test "${with_zlib+set}" = set; then :
> -  withval=$with_zlib;
> -else
> -  with_zlib=auto
> -fi
> +      if test "X$prefix" = "XNONE"; then
> +    acl_final_prefix="$ac_default_prefix"
> +  else
> +    acl_final_prefix="$prefix"
> +  fi
> +  if test "X$exec_prefix" = "XNONE"; then
> +    acl_final_exec_prefix='${prefix}'
> +  else
> +    acl_final_exec_prefix="$exec_prefix"
> +  fi
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> +  prefix="$acl_save_prefix"
>  
>  
> -  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
> +# Check whether --with-gnu-ld was given.
> +if test "${with_gnu_ld+set}" = set; then :
> +  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
>  else
> -  ac_func_search_save_LIBS=$LIBS
> -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> -/* end confdefs.h.  */
> +  with_gnu_ld=no
> +fi
>  
> -/* 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"
> +# Prepare PATH_SEPARATOR.
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> +  echo "#! /bin/sh" >conf$$.sh
> +  echo  "exit 0"   >>conf$$.sh
> +  chmod +x conf$$.sh
> +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> +    PATH_SEPARATOR=';'
>    else
> -    ac_res=-l$ac_lib
> -    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
> +    PATH_SEPARATOR=:
>    fi
> -  if ac_fn_c_try_link "$LINENO"; then :
> -  ac_cv_search_zlibVersion=$ac_res
> +  rm -f conf$$.sh
>  fi
> -rm -f core conftest.err conftest.$ac_objext \
> -    conftest$ac_exeext
> -  if test "${ac_cv_search_zlibVersion+set}" = set; then :
> -  break
> +ac_prog=ld
> +if test "$GCC" = yes; then
> +  # Check if gcc -print-prog-name=ld gives a path.
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
> +$as_echo_n "checking for ld used by GCC... " >&6; }
> +  case $host in
> +  *-*-mingw*)
> +    # gcc leaves a trailing carriage return which upsets mingw
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> +  *)
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> +  esac
> +  case $ac_prog in
> +    # Accept absolute paths.
> +    [\\/]* | [A-Za-z]:[\\/]*)
> +      re_direlt='/[^/][^/]*/\.\./'
> +      # Canonicalize the path of ld
> +      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> +      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> +	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> +      done
> +      test -z "$LD" && LD="$ac_prog"
> +      ;;
> +  "")
> +    # If it fails, then pretend we aren't using GCC.
> +    ac_prog=ld
> +    ;;
> +  *)
> +    # If it is relative, then search for the first ld in PATH.
> +    with_gnu_ld=unknown
> +    ;;
> +  esac
> +elif test "$with_gnu_ld" = yes; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> +$as_echo_n "checking for GNU ld... " >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> +$as_echo_n "checking for non-GNU ld... " >&6; }
>  fi
> -done
> -if test "${ac_cv_search_zlibVersion+set}" = set; then :
> -
> +if test "${acl_cv_path_LD+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$LD"; then
> +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
> +  for ac_dir in $PATH; do
> +    test -z "$ac_dir" && ac_dir=.
> +    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
> +      acl_cv_path_LD="$ac_dir/$ac_prog"
> +      # Check to see if the program is GNU ld.  I'd rather use --version,
> +      # but apparently some GNU ld's only accept -v.
> +      # Break only if it was the GNU/non-GNU ld that we prefer.
> +      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
> +	test "$with_gnu_ld" != no && break
> +      else
> +	test "$with_gnu_ld" != yes && break
> +      fi
> +    fi
> +  done
> +  IFS="$ac_save_ifs"
>  else
> -  ac_cv_search_zlibVersion=no
> +  acl_cv_path_LD="$LD" # Let the user override the test with a path.
>  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
>  
> +LD="$acl_cv_path_LD"
> +if test -n "$LD"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> +$as_echo "$LD" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
> +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> +if test "${acl_cv_prog_gnu_ld+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +  acl_cv_prog_gnu_ld=yes
> +else
> +  acl_cv_prog_gnu_ld=no
>  fi
> -
> -done
> -
>  fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
> +$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> +with_gnu_ld=$acl_cv_prog_gnu_ld
>  
> -    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 HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c).
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlgetmodinfo" >&5
> -$as_echo_n "checking for library containing dlgetmodinfo... " >&6; }
> -if test "${ac_cv_search_dlgetmodinfo+set}" = set; then :
> +                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +$as_echo_n "checking for shared library run path origin... " >&6; }
> +if test "${acl_cv_rpath+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 dlgetmodinfo ();
> -int
> -main ()
> -{
> -return dlgetmodinfo ();
> -  ;
> -  return 0;
> -}
> -_ACEOF
> -for ac_lib in '' dl xpdl; 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_dlgetmodinfo=$ac_res
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
> +    . ./conftest.sh
> +    rm -f ./conftest.sh
> +    acl_cv_rpath=done
> +
>  fi
> -rm -f core conftest.err conftest.$ac_objext \
> -    conftest$ac_exeext
> -  if test "${ac_cv_search_dlgetmodinfo+set}" = set; then :
> -  break
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> +$as_echo "$acl_cv_rpath" >&6; }
> +  wl="$acl_cv_wl"
> +  libext="$acl_cv_libext"
> +  shlibext="$acl_cv_shlibext"
> +  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> +  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> +  hardcode_direct="$acl_cv_hardcode_direct"
> +  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> +    # Check whether --enable-rpath was given.
> +if test "${enable_rpath+set}" = set; then :
> +  enableval=$enable_rpath; :
> +else
> +  enable_rpath=yes
>  fi
> -done
> -if test "${ac_cv_search_dlgetmodinfo+set}" = set; then :
>  
> +
> +
> +  # See if the user specified whether he wants zlib support or not.
> +
> +# Check whether --with-zlib was given.
> +if test "${with_zlib+set}" = set; then :
> +  withval=$with_zlib;
>  else
> -  ac_cv_search_dlgetmodinfo=no
> -fi
> -rm conftest.$ac_ext
> -LIBS=$ac_func_search_save_LIBS
> +  with_zlib=auto
>  fi
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlgetmodinfo" >&5
> -$as_echo "$ac_cv_search_dlgetmodinfo" >&6; }
> -ac_res=$ac_cv_search_dlgetmodinfo
> -if test "$ac_res" != no; then :
> -  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
>  
> -fi
>  
> +  if test "$with_zlib" != "no"; then
>  
>  
>  
>  
> -# Check whether --with-libiconv-prefix was given.
> -if test "${with_libiconv_prefix+set}" = set; then :
> -  withval=$with_libiconv_prefix;
> -    for dir in `echo "$withval" | tr : ' '`; do
> -      if test -d $dir/include; then LIBICONV_INCLUDE="-I$dir/include"; fi
> -      if test -d $dir/lib; then LIBICONV_LIBDIR="-L$dir/lib"; fi
> -    done
>  
> -fi
>  
>  
> -  BUILD_LIBICONV_LIBDIRS="../libiconv/lib/.libs ../libiconv/lib/_libs"
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libz-prefix was given.
> +if test "${with_libz_prefix+set}" = set; then :
> +  withval=$with_libz_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +      LIBZ=
> +  LTLIBZ=
> +  INCZ=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='z '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            else
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  else
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_a"
> +              else
> +                                                LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCZ="${INCZ}${INCZ:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBZ="${LIBZ}${LIBZ:+ }$dep"
> +                    LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +            LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name"
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCZ; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
> +$as_echo_n "checking for libz... " >&6; }
> +if test "${ac_cv_libz+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBZ"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "zlib.h";
> +int
> +main ()
> +{
> +int ret = deflateInit(NULL, 1);
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libz=yes
> +else
> +  ac_cv_libz=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5
> +$as_echo "$ac_cv_libz" >&6; }
> +  if test "$ac_cv_libz" = yes; then
> +    HAVE_LIBZ=yes
> +
> +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5
> +$as_echo_n "checking how to link with libz... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5
> +$as_echo "$LIBZ" >&6; }
> +  else
> +    HAVE_LIBZ=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBZ=
> +    LTLIBZ=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      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
> +
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
> +      as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
> +    fi
> +  fi
> +
> +
> +# On HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c).
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlgetmodinfo" >&5
> +$as_echo_n "checking for library containing dlgetmodinfo... " >&6; }
> +if test "${ac_cv_search_dlgetmodinfo+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 dlgetmodinfo ();
> +int
> +main ()
> +{
> +return dlgetmodinfo ();
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +for ac_lib in '' dl xpdl; 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_dlgetmodinfo=$ac_res
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext
> +  if test "${ac_cv_search_dlgetmodinfo+set}" = set; then :
> +  break
> +fi
> +done
> +if test "${ac_cv_search_dlgetmodinfo+set}" = set; then :
> +
> +else
> +  ac_cv_search_dlgetmodinfo=no
> +fi
> +rm conftest.$ac_ext
> +LIBS=$ac_func_search_save_LIBS
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlgetmodinfo" >&5
> +$as_echo "$ac_cv_search_dlgetmodinfo" >&6; }
> +ac_res=$ac_cv_search_dlgetmodinfo
> +if test "$ac_res" != no; then :
> +  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
> +
> +fi
> +
> +
> +
> +
> +
> +# Check whether --with-libiconv-prefix was given.
> +if test "${with_libiconv_prefix+set}" = set; then :
> +  withval=$with_libiconv_prefix;
> +    for dir in `echo "$withval" | tr : ' '`; do
> +      if test -d $dir/include; then LIBICONV_INCLUDE="-I$dir/include"; fi
> +      if test -d $dir/lib; then LIBICONV_LIBDIR="-L$dir/lib"; fi
> +    done
> +
> +fi
> +
> +
> +  BUILD_LIBICONV_LIBDIRS="../libiconv/lib/.libs ../libiconv/lib/_libs"
>    BUILD_LIBICONV_INCLUDE="-I../libiconv/include"
>  
>    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
> @@ -7519,164 +8095,6 @@ $as_echo "$as_me: WARNING: expat support disabled; some features may be unavaila
>    HAVE_LIBEXPAT=no
>  else
>  
> -      if test "X$prefix" = "XNONE"; then
> -    acl_final_prefix="$ac_default_prefix"
> -  else
> -    acl_final_prefix="$prefix"
> -  fi
> -  if test "X$exec_prefix" = "XNONE"; then
> -    acl_final_exec_prefix='${prefix}'
> -  else
> -    acl_final_exec_prefix="$exec_prefix"
> -  fi
> -  acl_save_prefix="$prefix"
> -  prefix="$acl_final_prefix"
> -  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> -  prefix="$acl_save_prefix"
> -
> -
> -# Check whether --with-gnu-ld was given.
> -if test "${with_gnu_ld+set}" = set; then :
> -  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
> -else
> -  with_gnu_ld=no
> -fi
> -
> -# Prepare PATH_SEPARATOR.
> -# The user is always right.
> -if test "${PATH_SEPARATOR+set}" != set; then
> -  echo "#! /bin/sh" >conf$$.sh
> -  echo  "exit 0"   >>conf$$.sh
> -  chmod +x conf$$.sh
> -  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> -    PATH_SEPARATOR=';'
> -  else
> -    PATH_SEPARATOR=:
> -  fi
> -  rm -f conf$$.sh
> -fi
> -ac_prog=ld
> -if test "$GCC" = yes; then
> -  # Check if gcc -print-prog-name=ld gives a path.
> -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
> -$as_echo_n "checking for ld used by GCC... " >&6; }
> -  case $host in
> -  *-*-mingw*)
> -    # gcc leaves a trailing carriage return which upsets mingw
> -    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> -  *)
> -    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> -  esac
> -  case $ac_prog in
> -    # Accept absolute paths.
> -    [\\/]* | [A-Za-z]:[\\/]*)
> -      re_direlt='/[^/][^/]*/\.\./'
> -      # Canonicalize the path of ld
> -      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> -      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> -	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> -      done
> -      test -z "$LD" && LD="$ac_prog"
> -      ;;
> -  "")
> -    # If it fails, then pretend we aren't using GCC.
> -    ac_prog=ld
> -    ;;
> -  *)
> -    # If it is relative, then search for the first ld in PATH.
> -    with_gnu_ld=unknown
> -    ;;
> -  esac
> -elif test "$with_gnu_ld" = yes; then
> -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> -$as_echo_n "checking for GNU ld... " >&6; }
> -else
> -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> -$as_echo_n "checking for non-GNU ld... " >&6; }
> -fi
> -if test "${acl_cv_path_LD+set}" = set; then :
> -  $as_echo_n "(cached) " >&6
> -else
> -  if test -z "$LD"; then
> -  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
> -  for ac_dir in $PATH; do
> -    test -z "$ac_dir" && ac_dir=.
> -    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
> -      acl_cv_path_LD="$ac_dir/$ac_prog"
> -      # Check to see if the program is GNU ld.  I'd rather use --version,
> -      # but apparently some GNU ld's only accept -v.
> -      # Break only if it was the GNU/non-GNU ld that we prefer.
> -      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
> -	test "$with_gnu_ld" != no && break
> -      else
> -	test "$with_gnu_ld" != yes && break
> -      fi
> -    fi
> -  done
> -  IFS="$ac_save_ifs"
> -else
> -  acl_cv_path_LD="$LD" # Let the user override the test with a path.
> -fi
> -fi
> -
> -LD="$acl_cv_path_LD"
> -if test -n "$LD"; then
> -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> -$as_echo "$LD" >&6; }
> -else
> -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> -$as_echo "no" >&6; }
> -fi
> -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
> -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> -if test "${acl_cv_prog_gnu_ld+set}" = set; then :
> -  $as_echo_n "(cached) " >&6
> -else
> -  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> -  acl_cv_prog_gnu_ld=yes
> -else
> -  acl_cv_prog_gnu_ld=no
> -fi
> -fi
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
> -$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> -with_gnu_ld=$acl_cv_prog_gnu_ld
> -
> -
> -
> -                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> -$as_echo_n "checking for shared library run path origin... " >&6; }
> -if test "${acl_cv_rpath+set}" = set; then :
> -  $as_echo_n "(cached) " >&6
> -else
> -
> -    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> -    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
> -    . ./conftest.sh
> -    rm -f ./conftest.sh
> -    acl_cv_rpath=done
> -
> -fi
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> -$as_echo "$acl_cv_rpath" >&6; }
> -  wl="$acl_cv_wl"
> -  libext="$acl_cv_libext"
> -  shlibext="$acl_cv_shlibext"
> -  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> -  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> -  hardcode_direct="$acl_cv_hardcode_direct"
> -  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> -    # Check whether --enable-rpath was given.
> -if test "${enable_rpath+set}" = set; then :
> -  enableval=$enable_rpath; :
> -else
> -  enable_rpath=yes
> -fi
> -
> -
> -
>  
>  
>  
> diff --git a/gold/Makefile.in b/gold/Makefile.in
> index cd4d165..01a7fee 100644
> --- a/gold/Makefile.in
> +++ b/gold/Makefile.in
> @@ -78,6 +78,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
>  	$(top_srcdir)/../config/gettext-sister.m4 \
>  	$(top_srcdir)/../config/lcmessage.m4 \
>  	$(top_srcdir)/../config/lead-dot.m4 \
> +	$(top_srcdir)/../config/lib-ld.m4 \
> +	$(top_srcdir)/../config/lib-link.m4 \
> +	$(top_srcdir)/../config/lib-prefix.m4 \
>  	$(top_srcdir)/../config/nls.m4 \
>  	$(top_srcdir)/../config/override.m4 \
>  	$(top_srcdir)/../config/po.m4 \
> @@ -301,6 +304,7 @@ GMSGFMT = @GMSGFMT@
>  GOLD_LDADD = @GOLD_LDADD@
>  GOLD_LDFLAGS = @GOLD_LDFLAGS@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  INCINTL = @INCINTL@
>  INSTALL = @INSTALL@
>  INSTALL_DATA = @INSTALL_DATA@
> @@ -314,8 +318,10 @@ LIBINTL = @LIBINTL@
>  LIBINTL_DEP = @LIBINTL_DEP@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
> +LIBZ = @LIBZ@
>  LN_S = @LN_S@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MERGE_CONSTANTS_FLAG = @MERGE_CONSTANTS_FLAG@
> diff --git a/gold/aclocal.m4 b/gold/aclocal.m4
> index 8321894..8444d1d 100644
> --- a/gold/aclocal.m4
> +++ b/gold/aclocal.m4
> @@ -984,6 +984,9 @@ m4_include([../config/depstand.m4])
>  m4_include([../config/gettext-sister.m4])
>  m4_include([../config/lcmessage.m4])
>  m4_include([../config/lead-dot.m4])
> +m4_include([../config/lib-ld.m4])
> +m4_include([../config/lib-link.m4])
> +m4_include([../config/lib-prefix.m4])
>  m4_include([../config/nls.m4])
>  m4_include([../config/override.m4])
>  m4_include([../config/po.m4])
> diff --git a/gold/config.in b/gold/config.in
> index be77810..1871eb5 100644
> --- a/gold/config.in
> +++ b/gold/config.in
> @@ -97,6 +97,9 @@
>  /* Define if your <locale.h> file defines LC_MESSAGES. */
>  #undef HAVE_LC_MESSAGES
>  
> +/* Define if you have the z library. */
> +#undef HAVE_LIBZ
> +
>  /* Define to 1 if you have the <locale.h> header file. */
>  #undef HAVE_LOCALE_H
>  
> diff --git a/gold/configure b/gold/configure
> index 23e4735..66554cd 100755
> --- a/gold/configure
> +++ b/gold/configure
> @@ -602,6 +602,9 @@ HAVE_PUBNAMES_FALSE
>  HAVE_PUBNAMES_TRUE
>  HAVE_ZLIB_FALSE
>  HAVE_ZLIB_TRUE
> +LTLIBZ
> +LIBZ
> +HAVE_LIBZ
>  LIBOBJS
>  LFS_CFLAGS
>  GOLD_LDADD
> @@ -797,6 +800,9 @@ enable_build_warnings
>  with_gold_ldflags
>  with_gold_ldadd
>  with_zlib
> +with_gnu_ld
> +enable_rpath
> +with_libz_prefix
>  enable_maintainer_mode
>  '
>        ac_precious_vars='build_alias
> @@ -1443,6 +1449,7 @@ Optional Features:
>    --disable-nls           do not use Native Language Support
>    --enable-werror         treat compile warnings as errors
>    --enable-build-warnings enable build-time compiler warnings
> +  --disable-rpath         do not hardcode runtime library paths
>    --enable-maintainer-mode  enable make rules and dependencies not useful
>  			  (and sometimes confusing) to the casual installer
>  
> @@ -1454,6 +1461,9 @@ Optional Packages:
>    --with-gold-ldflags=FLAGS  additional link flags for gold
>    --with-gold-ldadd=LIBS     additional libraries for gold
>    --with-zlib             include zlib support (auto/yes/no) default=auto
> +  --with-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libz-prefix[=DIR]  search for libz in DIR/include and DIR/lib
> +  --without-libz-prefix     don't search for libz in includedir and libdir
>  
>  Some influential environment variables:
>    CC          C compiler command
> @@ -6874,6 +6884,164 @@ fi
>  
>  # Link in zlib if we can.  This allows us to write compressed sections.
>  
> +      if test "X$prefix" = "XNONE"; then
> +    acl_final_prefix="$ac_default_prefix"
> +  else
> +    acl_final_prefix="$prefix"
> +  fi
> +  if test "X$exec_prefix" = "XNONE"; then
> +    acl_final_exec_prefix='${prefix}'
> +  else
> +    acl_final_exec_prefix="$exec_prefix"
> +  fi
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-gnu-ld was given.
> +if test "${with_gnu_ld+set}" = set; then :
> +  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
> +else
> +  with_gnu_ld=no
> +fi
> +
> +# Prepare PATH_SEPARATOR.
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> +  echo "#! /bin/sh" >conf$$.sh
> +  echo  "exit 0"   >>conf$$.sh
> +  chmod +x conf$$.sh
> +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> +    PATH_SEPARATOR=';'
> +  else
> +    PATH_SEPARATOR=:
> +  fi
> +  rm -f conf$$.sh
> +fi
> +ac_prog=ld
> +if test "$GCC" = yes; then
> +  # Check if gcc -print-prog-name=ld gives a path.
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
> +$as_echo_n "checking for ld used by GCC... " >&6; }
> +  case $host in
> +  *-*-mingw*)
> +    # gcc leaves a trailing carriage return which upsets mingw
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> +  *)
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> +  esac
> +  case $ac_prog in
> +    # Accept absolute paths.
> +    [\\/]* | [A-Za-z]:[\\/]*)
> +      re_direlt='/[^/][^/]*/\.\./'
> +      # Canonicalize the path of ld
> +      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> +      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> +	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> +      done
> +      test -z "$LD" && LD="$ac_prog"
> +      ;;
> +  "")
> +    # If it fails, then pretend we aren't using GCC.
> +    ac_prog=ld
> +    ;;
> +  *)
> +    # If it is relative, then search for the first ld in PATH.
> +    with_gnu_ld=unknown
> +    ;;
> +  esac
> +elif test "$with_gnu_ld" = yes; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> +$as_echo_n "checking for GNU ld... " >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> +$as_echo_n "checking for non-GNU ld... " >&6; }
> +fi
> +if test "${acl_cv_path_LD+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$LD"; then
> +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
> +  for ac_dir in $PATH; do
> +    test -z "$ac_dir" && ac_dir=.
> +    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
> +      acl_cv_path_LD="$ac_dir/$ac_prog"
> +      # Check to see if the program is GNU ld.  I'd rather use --version,
> +      # but apparently some GNU ld's only accept -v.
> +      # Break only if it was the GNU/non-GNU ld that we prefer.
> +      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
> +	test "$with_gnu_ld" != no && break
> +      else
> +	test "$with_gnu_ld" != yes && break
> +      fi
> +    fi
> +  done
> +  IFS="$ac_save_ifs"
> +else
> +  acl_cv_path_LD="$LD" # Let the user override the test with a path.
> +fi
> +fi
> +
> +LD="$acl_cv_path_LD"
> +if test -n "$LD"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> +$as_echo "$LD" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
> +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> +if test "${acl_cv_prog_gnu_ld+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +  acl_cv_prog_gnu_ld=yes
> +else
> +  acl_cv_prog_gnu_ld=no
> +fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
> +$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> +with_gnu_ld=$acl_cv_prog_gnu_ld
> +
> +
> +
> +                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +$as_echo_n "checking for shared library run path origin... " >&6; }
> +if test "${acl_cv_rpath+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
> +    . ./conftest.sh
> +    rm -f ./conftest.sh
> +    acl_cv_rpath=done
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> +$as_echo "$acl_cv_rpath" >&6; }
> +  wl="$acl_cv_wl"
> +  libext="$acl_cv_libext"
> +  shlibext="$acl_cv_shlibext"
> +  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> +  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> +  hardcode_direct="$acl_cv_hardcode_direct"
> +  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> +    # Check whether --enable-rpath was given.
> +if test "${enable_rpath+set}" = set; then :
> +  enableval=$enable_rpath; :
> +else
> +  enable_rpath=yes
> +fi
> +
> +
> +
>    # See if the user specified whether he wants zlib support or not.
>  
>  # Check whether --with-zlib was given.
> @@ -6885,60 +7053,472 @@ 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 :
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libz-prefix was given.
> +if test "${with_libz_prefix+set}" = set; then :
> +  withval=$with_libz_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +      LIBZ=
> +  LTLIBZ=
> +  INCZ=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='z '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            else
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  else
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_a"
> +              else
> +                                                LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCZ="${INCZ}${INCZ:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBZ="${LIBZ}${LIBZ:+ }$dep"
> +                    LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +            LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name"
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCZ; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
> +$as_echo_n "checking for libz... " >&6; }
> +if test "${ac_cv_libz+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 ();
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBZ"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "zlib.h";
>  int
>  main ()
>  {
> -return zlibVersion ();
> +int ret = deflateInit(NULL, 1);
>    ;
>    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
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libz=yes
> +else
> +  ac_cv_libz=no
>  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 :
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
>  
> -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
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5
> +$as_echo "$ac_cv_libz" >&6; }
> +  if test "$ac_cv_libz" = yes; then
> +    HAVE_LIBZ=yes
> +
> +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5
> +$as_echo_n "checking how to link with libz... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5
> +$as_echo "$LIBZ" >&6; }
> +  else
> +    HAVE_LIBZ=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBZ=
> +    LTLIBZ=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      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 :
> @@ -6950,9 +7530,9 @@ fi
>  
>  done
>  
> -fi
> -
> -    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
>        as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
>      fi
>    fi
> diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
> index d818570..14aa076 100644
> --- a/gold/testsuite/Makefile.in
> +++ b/gold/testsuite/Makefile.in
> @@ -756,6 +756,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
>  	$(top_srcdir)/../config/gettext-sister.m4 \
>  	$(top_srcdir)/../config/lcmessage.m4 \
>  	$(top_srcdir)/../config/lead-dot.m4 \
> +	$(top_srcdir)/../config/lib-ld.m4 \
> +	$(top_srcdir)/../config/lib-link.m4 \
> +	$(top_srcdir)/../config/lib-prefix.m4 \
>  	$(top_srcdir)/../config/nls.m4 \
>  	$(top_srcdir)/../config/override.m4 \
>  	$(top_srcdir)/../config/po.m4 \
> @@ -2055,6 +2058,7 @@ GMSGFMT = @GMSGFMT@
>  GOLD_LDADD = @GOLD_LDADD@
>  GOLD_LDFLAGS = @GOLD_LDFLAGS@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  INCINTL = @INCINTL@
>  INSTALL = @INSTALL@
>  INSTALL_DATA = @INSTALL_DATA@
> @@ -2068,8 +2072,10 @@ LIBINTL = @LIBINTL@
>  LIBINTL_DEP = @LIBINTL_DEP@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
> +LIBZ = @LIBZ@
>  LN_S = @LN_S@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MERGE_CONSTANTS_FLAG = @MERGE_CONSTANTS_FLAG@
> diff --git a/ld/Makefile.in b/ld/Makefile.in
> index 311452d..a54bc97 100644
> --- a/ld/Makefile.in
> +++ b/ld/Makefile.in
> @@ -75,6 +75,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
>  	$(top_srcdir)/../config/largefile.m4 \
>  	$(top_srcdir)/../config/lcmessage.m4 \
>  	$(top_srcdir)/../config/lead-dot.m4 \
> +	$(top_srcdir)/../config/lib-ld.m4 \
> +	$(top_srcdir)/../config/lib-link.m4 \
> +	$(top_srcdir)/../config/lib-prefix.m4 \
>  	$(top_srcdir)/../config/nls.m4 \
>  	$(top_srcdir)/../config/override.m4 \
>  	$(top_srcdir)/../config/plugins.m4 \
> @@ -226,6 +229,7 @@ FGREP = @FGREP@
>  GENCAT = @GENCAT@
>  GMSGFMT = @GMSGFMT@
>  GREP = @GREP@
> +HAVE_LIBZ = @HAVE_LIBZ@
>  HDEFINES = @HDEFINES@
>  
>  #stuff for self hosting (can be overridden in config file).
> @@ -250,6 +254,7 @@ LIBINTL_DEP = @LIBINTL_DEP@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LIBTOOL = @LIBTOOL@
> +LIBZ = @LIBZ@
>  
>  # Search path to override the default search path for -lfoo libraries.
>  # If LIB_PATH is empty, the ones in the script (if any) are left alone.
> @@ -262,6 +267,7 @@ LIB_PATH = @LIB_PATH@
>  LIPO = @LIPO@
>  LN_S = @LN_S@
>  LTLIBOBJS = @LTLIBOBJS@
> +LTLIBZ = @LTLIBZ@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
>  MKDIR_P = @MKDIR_P@
> diff --git a/ld/aclocal.m4 b/ld/aclocal.m4
> index 6585160..fed7950 100644
> --- a/ld/aclocal.m4
> +++ b/ld/aclocal.m4
> @@ -997,6 +997,9 @@ m4_include([../config/gettext-sister.m4])
>  m4_include([../config/largefile.m4])
>  m4_include([../config/lcmessage.m4])
>  m4_include([../config/lead-dot.m4])
> +m4_include([../config/lib-ld.m4])
> +m4_include([../config/lib-link.m4])
> +m4_include([../config/lib-prefix.m4])
>  m4_include([../config/nls.m4])
>  m4_include([../config/override.m4])
>  m4_include([../config/plugins.m4])
> diff --git a/ld/config.in b/ld/config.in
> index 2ab4844..226009e 100644
> --- a/ld/config.in
> +++ b/ld/config.in
> @@ -68,6 +68,9 @@
>  /* Define if your <locale.h> file defines LC_MESSAGES. */
>  #undef HAVE_LC_MESSAGES
>  
> +/* Define if you have the z library. */
> +#undef HAVE_LIBZ
> +
>  /* Define to 1 if you have the <limits.h> header file. */
>  #undef HAVE_LIMITS_H
>  
> diff --git a/ld/configure b/ld/configure
> index 8a7bd20..a0078da 100755
> --- a/ld/configure
> +++ b/ld/configure
> @@ -609,6 +609,9 @@ EMUL_EXTRA_OFILES
>  EMULATION_OFILES
>  EMUL
>  STRINGIFY
> +LTLIBZ
> +LIBZ
> +HAVE_LIBZ
>  enable_initfini_array
>  ENABLE_PLUGINS_FALSE
>  ENABLE_PLUGINS_TRUE
> @@ -790,6 +793,8 @@ enable_build_warnings
>  enable_nls
>  enable_initfini_array
>  with_zlib
> +enable_rpath
> +with_libz_prefix
>  '
>        ac_precious_vars='build_alias
>  host_alias
> @@ -1446,6 +1451,7 @@ Optional Features:
>    --enable-build-warnings enable build-time compiler warnings
>    --disable-nls           do not use Native Language Support
>    --enable-initfini-array	use .init_array/.fini_array sections
> +  --disable-rpath         do not hardcode runtime library paths
>  
>  Optional Packages:
>    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
> @@ -1456,6 +1462,9 @@ Optional Packages:
>    --with-lib-path=dir1:dir2...  set default LIB_PATH
>    --with-sysroot=DIR Search for usr/lib et al within DIR.
>    --with-zlib             include zlib support (auto/yes/no) default=auto
> +  --with-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libz-prefix[=DIR]  search for libz in DIR/include and DIR/lib
> +  --without-libz-prefix     don't search for libz in includedir and libdir
>  
>  Some influential environment variables:
>    CC          C compiler command
> @@ -11712,7 +11721,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 11715 "configure"
> +#line 11724 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -11818,7 +11827,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 11821 "configure"
> +#line 11830 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -16757,6 +16766,164 @@ _ACEOF
>  # Link in zlib if we can.  This is needed only for the bootstrap tests
>  # right now, since those tests use libbfd, which depends on zlib.
>  
> +      if test "X$prefix" = "XNONE"; then
> +    acl_final_prefix="$ac_default_prefix"
> +  else
> +    acl_final_prefix="$prefix"
> +  fi
> +  if test "X$exec_prefix" = "XNONE"; then
> +    acl_final_exec_prefix='${prefix}'
> +  else
> +    acl_final_exec_prefix="$exec_prefix"
> +  fi
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-gnu-ld was given.
> +if test "${with_gnu_ld+set}" = set; then :
> +  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
> +else
> +  with_gnu_ld=no
> +fi
> +
> +# Prepare PATH_SEPARATOR.
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> +  echo "#! /bin/sh" >conf$$.sh
> +  echo  "exit 0"   >>conf$$.sh
> +  chmod +x conf$$.sh
> +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> +    PATH_SEPARATOR=';'
> +  else
> +    PATH_SEPARATOR=:
> +  fi
> +  rm -f conf$$.sh
> +fi
> +ac_prog=ld
> +if test "$GCC" = yes; then
> +  # Check if gcc -print-prog-name=ld gives a path.
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
> +$as_echo_n "checking for ld used by GCC... " >&6; }
> +  case $host in
> +  *-*-mingw*)
> +    # gcc leaves a trailing carriage return which upsets mingw
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> +  *)
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> +  esac
> +  case $ac_prog in
> +    # Accept absolute paths.
> +    [\\/]* | [A-Za-z]:[\\/]*)
> +      re_direlt='/[^/][^/]*/\.\./'
> +      # Canonicalize the path of ld
> +      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> +      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> +	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> +      done
> +      test -z "$LD" && LD="$ac_prog"
> +      ;;
> +  "")
> +    # If it fails, then pretend we aren't using GCC.
> +    ac_prog=ld
> +    ;;
> +  *)
> +    # If it is relative, then search for the first ld in PATH.
> +    with_gnu_ld=unknown
> +    ;;
> +  esac
> +elif test "$with_gnu_ld" = yes; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> +$as_echo_n "checking for GNU ld... " >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> +$as_echo_n "checking for non-GNU ld... " >&6; }
> +fi
> +if test "${acl_cv_path_LD+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$LD"; then
> +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
> +  for ac_dir in $PATH; do
> +    test -z "$ac_dir" && ac_dir=.
> +    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
> +      acl_cv_path_LD="$ac_dir/$ac_prog"
> +      # Check to see if the program is GNU ld.  I'd rather use --version,
> +      # but apparently some GNU ld's only accept -v.
> +      # Break only if it was the GNU/non-GNU ld that we prefer.
> +      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
> +	test "$with_gnu_ld" != no && break
> +      else
> +	test "$with_gnu_ld" != yes && break
> +      fi
> +    fi
> +  done
> +  IFS="$ac_save_ifs"
> +else
> +  acl_cv_path_LD="$LD" # Let the user override the test with a path.
> +fi
> +fi
> +
> +LD="$acl_cv_path_LD"
> +if test -n "$LD"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> +$as_echo "$LD" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
> +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> +if test "${acl_cv_prog_gnu_ld+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +  acl_cv_prog_gnu_ld=yes
> +else
> +  acl_cv_prog_gnu_ld=no
> +fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
> +$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> +with_gnu_ld=$acl_cv_prog_gnu_ld
> +
> +
> +
> +                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +$as_echo_n "checking for shared library run path origin... " >&6; }
> +if test "${acl_cv_rpath+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
> +    . ./conftest.sh
> +    rm -f ./conftest.sh
> +    acl_cv_rpath=done
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> +$as_echo "$acl_cv_rpath" >&6; }
> +  wl="$acl_cv_wl"
> +  libext="$acl_cv_libext"
> +  shlibext="$acl_cv_shlibext"
> +  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> +  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> +  hardcode_direct="$acl_cv_hardcode_direct"
> +  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> +    # Check whether --enable-rpath was given.
> +if test "${enable_rpath+set}" = set; then :
> +  enableval=$enable_rpath; :
> +else
> +  enable_rpath=yes
> +fi
> +
> +
> +
>    # See if the user specified whether he wants zlib support or not.
>  
>  # Check whether --with-zlib was given.
> @@ -16768,60 +16935,472 @@ 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 :
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libz-prefix was given.
> +if test "${with_libz_prefix+set}" = set; then :
> +  withval=$with_libz_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +      LIBZ=
> +  LTLIBZ=
> +  INCZ=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='z '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            else
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  else
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_a"
> +              else
> +                                                LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCZ="${INCZ}${INCZ:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBZ="${LIBZ}${LIBZ:+ }$dep"
> +                    LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +            LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name"
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCZ; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
> +$as_echo_n "checking for libz... " >&6; }
> +if test "${ac_cv_libz+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 ();
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBZ"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "zlib.h";
>  int
>  main ()
>  {
> -return zlibVersion ();
> +int ret = deflateInit(NULL, 1);
>    ;
>    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
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libz=yes
> +else
> +  ac_cv_libz=no
>  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 :
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
>  
> -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
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5
> +$as_echo "$ac_cv_libz" >&6; }
> +  if test "$ac_cv_libz" = yes; then
> +    HAVE_LIBZ=yes
> +
> +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5
> +$as_echo_n "checking how to link with libz... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5
> +$as_echo "$LIBZ" >&6; }
> +  else
> +    HAVE_LIBZ=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBZ=
> +    LTLIBZ=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      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 :
> @@ -16833,9 +17412,9 @@ fi
>  
>  done
>  
> -fi
> -
> -    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
>        as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
>      fi
>    fi
> diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
> index f96ec35..430ae0e 100644
> --- a/sim/common/acinclude.m4
> +++ b/sim/common/acinclude.m4
> @@ -20,6 +20,9 @@
>  
>  # Include global overrides and fixes for Autoconf.
>  m4_include(../../config/override.m4)
> +m4_include([../../config/lib-ld.m4])
> +m4_include([../../config/lib-link.m4])
> +m4_include([../../config/lib-prefix.m4])
>  sinclude([../../config/zlib.m4])
>  m4_include([../../config/plugins.m4])
>  m4_include([../../libtool.m4])
> diff --git a/sim/common/config.in b/sim/common/config.in
> index 5b8ebd8..d6d595e 100644
> --- a/sim/common/config.in
> +++ b/sim/common/config.in
> @@ -31,6 +31,9 @@
>  /* Define to 1 if you have the `socket' library (-lsocket). */
>  #undef HAVE_LIBSOCKET
>  
> +/* Define if you have the z library. */
> +#undef HAVE_LIBZ
> +
>  /* Define to 1 if you have the `lstat' function. */
>  #undef HAVE_LSTAT
>  
> diff --git a/sim/common/configure b/sim/common/configure
> index add4c0f..16f6f28 100755
> --- a/sim/common/configure
> +++ b/sim/common/configure
> @@ -633,6 +633,9 @@ SED
>  LIBTOOL
>  PLUGINS_FALSE
>  PLUGINS_TRUE
> +LTLIBZ
> +LIBZ
> +HAVE_LIBZ
>  CATOBJEXT
>  GENCAT
>  INSTOBJEXT
> @@ -744,12 +747,14 @@ ac_subst_files=''
>  ac_user_opts='
>  enable_option_checking
>  with_zlib
> +with_gnu_ld
> +enable_rpath
> +with_libz_prefix
>  enable_plugins
>  enable_shared
>  enable_static
>  with_pic
>  enable_fast_install
> -with_gnu_ld
>  enable_libtool_lock
>  enable_maintainer_mode
>  enable_sim_bswap
> @@ -1388,6 +1393,7 @@ Optional Features:
>    --disable-option-checking  ignore unrecognized --enable/--with options
>    --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
>    --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
> +  --disable-rpath         do not hardcode runtime library paths
>    --enable-plugins        Enable support for plugins
>    --enable-shared[=PKGS]  build shared libraries [default=yes]
>    --enable-static[=PKGS]  build static libraries [default=yes]
> @@ -1407,6 +1413,9 @@ Optional Packages:
>    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
>    --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
>    --with-zlib             include zlib support (auto/yes/no) default=auto
> +  --with-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libz-prefix[=DIR]  search for libz in DIR/include and DIR/lib
> +  --without-libz-prefix     don't search for libz in includedir and libdir
>    --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]
> @@ -3788,6 +3797,164 @@ rmdir .tst 2>/dev/null
>  
>  DEPDIR="${am__leading_dot}deps"
>  
> +
> +      if test "X$prefix" = "XNONE"; then
> +    acl_final_prefix="$ac_default_prefix"
> +  else
> +    acl_final_prefix="$prefix"
> +  fi
> +  if test "X$exec_prefix" = "XNONE"; then
> +    acl_final_exec_prefix='${prefix}'
> +  else
> +    acl_final_exec_prefix="$exec_prefix"
> +  fi
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-gnu-ld was given.
> +if test "${with_gnu_ld+set}" = set; then :
> +  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
> +else
> +  with_gnu_ld=no
> +fi
> +
> +# Prepare PATH_SEPARATOR.
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> +  echo "#! /bin/sh" >conf$$.sh
> +  echo  "exit 0"   >>conf$$.sh
> +  chmod +x conf$$.sh
> +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> +    PATH_SEPARATOR=';'
> +  else
> +    PATH_SEPARATOR=:
> +  fi
> +  rm -f conf$$.sh
> +fi
> +ac_prog=ld
> +if test "$GCC" = yes; then
> +  # Check if gcc -print-prog-name=ld gives a path.
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
> +$as_echo_n "checking for ld used by GCC... " >&6; }
> +  case $host in
> +  *-*-mingw*)
> +    # gcc leaves a trailing carriage return which upsets mingw
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> +  *)
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> +  esac
> +  case $ac_prog in
> +    # Accept absolute paths.
> +    [\\/]* | [A-Za-z]:[\\/]*)
> +      re_direlt='/[^/][^/]*/\.\./'
> +      # Canonicalize the path of ld
> +      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> +      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> +	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> +      done
> +      test -z "$LD" && LD="$ac_prog"
> +      ;;
> +  "")
> +    # If it fails, then pretend we aren't using GCC.
> +    ac_prog=ld
> +    ;;
> +  *)
> +    # If it is relative, then search for the first ld in PATH.
> +    with_gnu_ld=unknown
> +    ;;
> +  esac
> +elif test "$with_gnu_ld" = yes; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> +$as_echo_n "checking for GNU ld... " >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> +$as_echo_n "checking for non-GNU ld... " >&6; }
> +fi
> +if test "${acl_cv_path_LD+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$LD"; then
> +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
> +  for ac_dir in $PATH; do
> +    test -z "$ac_dir" && ac_dir=.
> +    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
> +      acl_cv_path_LD="$ac_dir/$ac_prog"
> +      # Check to see if the program is GNU ld.  I'd rather use --version,
> +      # but apparently some GNU ld's only accept -v.
> +      # Break only if it was the GNU/non-GNU ld that we prefer.
> +      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
> +	test "$with_gnu_ld" != no && break
> +      else
> +	test "$with_gnu_ld" != yes && break
> +      fi
> +    fi
> +  done
> +  IFS="$ac_save_ifs"
> +else
> +  acl_cv_path_LD="$LD" # Let the user override the test with a path.
> +fi
> +fi
> +
> +LD="$acl_cv_path_LD"
> +if test -n "$LD"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> +$as_echo "$LD" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
> +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> +if test "${acl_cv_prog_gnu_ld+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +  acl_cv_prog_gnu_ld=yes
> +else
> +  acl_cv_prog_gnu_ld=no
> +fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
> +$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> +with_gnu_ld=$acl_cv_prog_gnu_ld
> +
> +
> +
> +                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +$as_echo_n "checking for shared library run path origin... " >&6; }
> +if test "${acl_cv_rpath+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
> +    . ./conftest.sh
> +    rm -f ./conftest.sh
> +    acl_cv_rpath=done
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> +$as_echo "$acl_cv_rpath" >&6; }
> +  wl="$acl_cv_wl"
> +  libext="$acl_cv_libext"
> +  shlibext="$acl_cv_shlibext"
> +  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> +  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> +  hardcode_direct="$acl_cv_hardcode_direct"
> +  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> +    # Check whether --enable-rpath was given.
> +if test "${enable_rpath+set}" = set; then :
> +  enableval=$enable_rpath; :
> +else
> +  enable_rpath=yes
> +fi
> +
> +
>  case `pwd` in
>    *\ * | *\	*)
>      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
> @@ -6962,60 +7129,472 @@ 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 :
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libz-prefix was given.
> +if test "${with_libz_prefix+set}" = set; then :
> +  withval=$with_libz_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +      LIBZ=
> +  LTLIBZ=
> +  INCZ=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='z '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            else
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  else
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_a"
> +              else
> +                                                LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCZ="${INCZ}${INCZ:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBZ="${LIBZ}${LIBZ:+ }$dep"
> +                    LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +            LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name"
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCZ; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
> +$as_echo_n "checking for libz... " >&6; }
> +if test "${ac_cv_libz+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 ();
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBZ"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "zlib.h";
>  int
>  main ()
>  {
> -return zlibVersion ();
> +int ret = deflateInit(NULL, 1);
>    ;
>    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
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libz=yes
> +else
> +  ac_cv_libz=no
>  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 :
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
>  
> -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
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5
> +$as_echo "$ac_cv_libz" >&6; }
> +  if test "$ac_cv_libz" = yes; then
> +    HAVE_LIBZ=yes
> +
> +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5
> +$as_echo_n "checking how to link with libz... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5
> +$as_echo "$LIBZ" >&6; }
> +  else
> +    HAVE_LIBZ=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBZ=
> +    LTLIBZ=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      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 :
> @@ -7027,9 +7606,9 @@ fi
>  
>  done
>  
> -fi
> -
> -    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
>        as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
>      fi
>    fi
> @@ -10623,7 +11202,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 10626 "configure"
> +#line 11205 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -10729,7 +11308,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 10732 "configure"
> +#line 11311 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> diff --git a/sim/ppc/config.in b/sim/ppc/config.in
> index b0c9e6f..32605bc 100644
> --- a/sim/ppc/config.in
> +++ b/sim/ppc/config.in
> @@ -106,6 +106,9 @@
>  /* Define to 1 if you have the `kill' function. */
>  #undef HAVE_KILL
>  
> +/* Define if you have the z library. */
> +#undef HAVE_LIBZ
> +
>  /* Define to 1 if you have the `link' function. */
>  #undef HAVE_LINK
>  
> diff --git a/sim/ppc/configure b/sim/ppc/configure
> index 5044383..6ec0fd0 100755
> --- a/sim/ppc/configure
> +++ b/sim/ppc/configure
> @@ -627,6 +627,9 @@ HDEFINES
>  CFLAGS_FOR_BUILD
>  CC_FOR_BUILD
>  LIBOBJS
> +LTLIBZ
> +LIBZ
> +HAVE_LIBZ
>  target_os
>  target_vendor
>  target_cpu
> @@ -767,6 +770,9 @@ enable_sim_xor_endian
>  with_pkgversion
>  with_bugurl
>  with_zlib
> +with_gnu_ld
> +enable_rpath
> +with_libz_prefix
>  enable_plugins
>  '
>        ac_precious_vars='build_alias
> @@ -1431,6 +1437,7 @@ Optional Features:
>    --enable-sim-trace			Specify whether tracing is supported.
>    --enable-sim-warnings=opts		Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o
>    --enable-sim-xor-endian=n		Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).
> +  --disable-rpath         do not hardcode runtime library paths
>    --enable-plugins        Enable support for plugins
>  
>  Optional Packages:
> @@ -1439,6 +1446,9 @@ Optional Packages:
>    --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-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libz-prefix[=DIR]  search for libz in DIR/include and DIR/lib
> +  --without-libz-prefix     don't search for libz in includedir and libdir
>  
>  Some influential environment variables:
>    CC          C compiler command
> @@ -2448,6 +2458,37 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
>  
>  
>  
> +# lib-ld.m4 serial 2 (gettext-0.12)
> +
> +
> +
> +
> +
> +
> +# lib-link.m4 serial 4 (gettext-0.12)
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +# lib-prefix.m4 serial 2 (gettext-0.12)
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
>  
>  
>  
> @@ -6817,6 +6858,164 @@ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
>  # BFD conditionally uses zlib, so we must link it in if libbfd does, by
>  # using the same condition.
>  
> +      if test "X$prefix" = "XNONE"; then
> +    acl_final_prefix="$ac_default_prefix"
> +  else
> +    acl_final_prefix="$prefix"
> +  fi
> +  if test "X$exec_prefix" = "XNONE"; then
> +    acl_final_exec_prefix='${prefix}'
> +  else
> +    acl_final_exec_prefix="$exec_prefix"
> +  fi
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-gnu-ld was given.
> +if test "${with_gnu_ld+set}" = set; then :
> +  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
> +else
> +  with_gnu_ld=no
> +fi
> +
> +# Prepare PATH_SEPARATOR.
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> +  echo "#! /bin/sh" >conf$$.sh
> +  echo  "exit 0"   >>conf$$.sh
> +  chmod +x conf$$.sh
> +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> +    PATH_SEPARATOR=';'
> +  else
> +    PATH_SEPARATOR=:
> +  fi
> +  rm -f conf$$.sh
> +fi
> +ac_prog=ld
> +if test "$GCC" = yes; then
> +  # Check if gcc -print-prog-name=ld gives a path.
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
> +$as_echo_n "checking for ld used by GCC... " >&6; }
> +  case $host in
> +  *-*-mingw*)
> +    # gcc leaves a trailing carriage return which upsets mingw
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> +  *)
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> +  esac
> +  case $ac_prog in
> +    # Accept absolute paths.
> +    [\\/]* | [A-Za-z]:[\\/]*)
> +      re_direlt='/[^/][^/]*/\.\./'
> +      # Canonicalize the path of ld
> +      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> +      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> +	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> +      done
> +      test -z "$LD" && LD="$ac_prog"
> +      ;;
> +  "")
> +    # If it fails, then pretend we aren't using GCC.
> +    ac_prog=ld
> +    ;;
> +  *)
> +    # If it is relative, then search for the first ld in PATH.
> +    with_gnu_ld=unknown
> +    ;;
> +  esac
> +elif test "$with_gnu_ld" = yes; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> +$as_echo_n "checking for GNU ld... " >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> +$as_echo_n "checking for non-GNU ld... " >&6; }
> +fi
> +if test "${acl_cv_path_LD+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$LD"; then
> +  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
> +  for ac_dir in $PATH; do
> +    test -z "$ac_dir" && ac_dir=.
> +    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
> +      acl_cv_path_LD="$ac_dir/$ac_prog"
> +      # Check to see if the program is GNU ld.  I'd rather use --version,
> +      # but apparently some GNU ld's only accept -v.
> +      # Break only if it was the GNU/non-GNU ld that we prefer.
> +      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
> +	test "$with_gnu_ld" != no && break
> +      else
> +	test "$with_gnu_ld" != yes && break
> +      fi
> +    fi
> +  done
> +  IFS="$ac_save_ifs"
> +else
> +  acl_cv_path_LD="$LD" # Let the user override the test with a path.
> +fi
> +fi
> +
> +LD="$acl_cv_path_LD"
> +if test -n "$LD"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> +$as_echo "$LD" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
> +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> +if test "${acl_cv_prog_gnu_ld+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
> +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
> +  acl_cv_prog_gnu_ld=yes
> +else
> +  acl_cv_prog_gnu_ld=no
> +fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
> +$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> +with_gnu_ld=$acl_cv_prog_gnu_ld
> +
> +
> +
> +                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
> +$as_echo_n "checking for shared library run path origin... " >&6; }
> +if test "${acl_cv_rpath+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
> +    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
> +    . ./conftest.sh
> +    rm -f ./conftest.sh
> +    acl_cv_rpath=done
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> +$as_echo "$acl_cv_rpath" >&6; }
> +  wl="$acl_cv_wl"
> +  libext="$acl_cv_libext"
> +  shlibext="$acl_cv_shlibext"
> +  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> +  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> +  hardcode_direct="$acl_cv_hardcode_direct"
> +  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> +    # Check whether --enable-rpath was given.
> +if test "${enable_rpath+set}" = set; then :
> +  enableval=$enable_rpath; :
> +else
> +  enable_rpath=yes
> +fi
> +
> +
> +
>    # See if the user specified whether he wants zlib support or not.
>  
>  # Check whether --with-zlib was given.
> @@ -6828,60 +7027,472 @@ 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 :
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libz-prefix was given.
> +if test "${with_libz_prefix+set}" = set; then :
> +  withval=$with_libz_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +      LIBZ=
> +  LTLIBZ=
> +  INCZ=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='z '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBZ="${LIBZ}${LIBZ:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            else
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  else
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBZ="${LIBZ}${LIBZ:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBZ="${LIBZ}${LIBZ:+ }$found_a"
> +              else
> +                                                LIBZ="${LIBZ}${LIBZ:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCZ="${INCZ}${INCZ:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBZ="${LIBZ}${LIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBZ; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBZ="${LIBZ}${LIBZ:+ }$dep"
> +                    LTLIBZ="${LTLIBZ}${LTLIBZ:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            LIBZ="${LIBZ}${LIBZ:+ }-l$name"
> +            LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-l$name"
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBZ="${LIBZ}${LIBZ:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBZ="${LTLIBZ}${LTLIBZ:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCZ; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
> +$as_echo_n "checking for libz... " >&6; }
> +if test "${ac_cv_libz+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 ();
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBZ"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "zlib.h";
>  int
>  main ()
>  {
> -return zlibVersion ();
> +int ret = deflateInit(NULL, 1);
>    ;
>    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
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libz=yes
> +else
> +  ac_cv_libz=no
>  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 :
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
>  
> -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
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libz" >&5
> +$as_echo "$ac_cv_libz" >&6; }
> +  if test "$ac_cv_libz" = yes; then
> +    HAVE_LIBZ=yes
> +
> +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libz" >&5
> +$as_echo_n "checking how to link with libz... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBZ" >&5
> +$as_echo "$LIBZ" >&6; }
> +  else
> +    HAVE_LIBZ=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBZ=
> +    LTLIBZ=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBZ" = "yes"; then
> +      # Make sure HAVE_ZLIB_H gets defined.  Some code uses that over
> +      # HAVE_LIBZ, since initially we were only defining HAVE_ZLIB_H.
> +      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 :
> @@ -6893,9 +7504,9 @@ fi
>  
>  done
>  
> -fi
> -
> -    if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then
> +      LIBS="$LIBS $LIBZ"
> +    fi
> +    if test "$with_zlib" = "yes" -a "$HAVE_LIBZ" != "yes"; then
>        as_fn_error "zlib (libz) library was explicitly requested but not found" "$LINENO" 5
>      fi
>    fi
> -- 
> 1.9.1
> 


-- 
Joel


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