diff mbox series

Add target-zlib to top-level configure, use zlib from libphobos

Message ID CABOHX+cpCG1fayP+RcxM3v1aDEAjnHKcJmYDzQ_i0JFhzXJxmg@mail.gmail.com
State New
Headers show
Series Add target-zlib to top-level configure, use zlib from libphobos | expand

Commit Message

Iain Buclaw Jan. 21, 2019, 6:34 p.m. UTC
Hi,

Following on from the last, this adds target-zlib to target_libraries
and updates libphobos build scripts to link to libz_convenience.a.
The D front-end already has target-zlib in d/config-lang.in.

Is the top-level part OK?  I considered disabling target-zlib if
libphobos is not being built, but decided against unless it's
requested.

Comments

Richard Biener Jan. 28, 2019, 12:10 p.m. UTC | #1
On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>
> Hi,
>
> Following on from the last, this adds target-zlib to target_libraries
> and updates libphobos build scripts to link to libz_convenience.a.
> The D front-end already has target-zlib in d/config-lang.in.
>
> Is the top-level part OK?  I considered disabling target-zlib if
> libphobos is not being built, but decided against unless it's
> requested.

Hmm, you overload --with-system-zlib to apply to both host and target
(I guess it already applied to build), not sure if that's really desired?
I suppose libphobos is the first target library linking against zlib?

You are also falling back to in-tree zlib if --with-system-zlib was
specified but no zlib was found - I guess for cross builds that
will easily get not noticed...  The toplevel --with-system-zlib makes
it much harder and simply fails.

Joseph, does it make sense to do this?

Richard.

> --
> Iain
> ---
> ChangeLog:
>
> 2019-01-21  Iain Buclaw  <ibuclaw@gdcproject.org>
>
>     * configure.ac: configure.ac: Add target-zlib to target_libraries.
>     * configure: Regenerate.
>
> libphobos/ChangeLog:
>
> 2019-01-21  Iain Buclaw  <ibuclaw@gdcproject.org>
>
>     * m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_ZLIB): Use
>     libz_convenience.a if not using system zlib.
>     * Makefile.in: Regenerate.
>     * configure: Regenerate.
>     * libdruntime/Makefile.in: Regenerate.
>     * src/Makefile.am: Remove ZLIB_CSOURCES and AM_CFLAGS.
>     * src/Makefile.in: Regenerate.
>     * testsuite/Makefile.in: Regenerate.
>
> ---
Joseph Myers Jan. 28, 2019, 11:24 p.m. UTC | #2
On Mon, 28 Jan 2019, Richard Biener wrote:

> On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> >
> > Hi,
> >
> > Following on from the last, this adds target-zlib to target_libraries
> > and updates libphobos build scripts to link to libz_convenience.a.
> > The D front-end already has target-zlib in d/config-lang.in.
> >
> > Is the top-level part OK?  I considered disabling target-zlib if
> > libphobos is not being built, but decided against unless it's
> > requested.
> 
> Hmm, you overload --with-system-zlib to apply to both host and target
> (I guess it already applied to build), not sure if that's really desired?

I think it's best to keep this sort of option separate for host and 
target.

> You are also falling back to in-tree zlib if --with-system-zlib was
> specified but no zlib was found - I guess for cross builds that
> will easily get not noticed...  The toplevel --with-system-zlib makes
> it much harder and simply fails.

And I think failing is better if such an option is specified but zlib is 
not found.
Iain Buclaw Feb. 9, 2019, 9:37 a.m. UTC | #3
On Mon, 28 Jan 2019 at 13:10, Richard Biener <richard.guenther@gmail.com> wrote:
>
> On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> >
> > Hi,
> >
> > Following on from the last, this adds target-zlib to target_libraries
> > and updates libphobos build scripts to link to libz_convenience.a.
> > The D front-end already has target-zlib in d/config-lang.in.
> >
> > Is the top-level part OK?  I considered disabling target-zlib if
> > libphobos is not being built, but decided against unless it's
> > requested.
>
> Hmm, you overload --with-system-zlib to apply to both host and target
> (I guess it already applied to build), not sure if that's really desired?
> I suppose libphobos is the first target library linking against zlib?
>

Originally, libgcj linked to zlib.

> You are also falling back to in-tree zlib if --with-system-zlib was
> specified but no zlib was found - I guess for cross builds that
> will easily get not noticed...  The toplevel --with-system-zlib makes
> it much harder and simply fails.
>

OK, so keep --with-target-system-zlib to distinguish between the two?
Richard Biener Feb. 12, 2019, 9:40 a.m. UTC | #4
On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>
> On Mon, 28 Jan 2019 at 13:10, Richard Biener <richard.guenther@gmail.com> wrote:
> >
> > On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> > >
> > > Hi,
> > >
> > > Following on from the last, this adds target-zlib to target_libraries
> > > and updates libphobos build scripts to link to libz_convenience.a.
> > > The D front-end already has target-zlib in d/config-lang.in.
> > >
> > > Is the top-level part OK?  I considered disabling target-zlib if
> > > libphobos is not being built, but decided against unless it's
> > > requested.
> >
> > Hmm, you overload --with-system-zlib to apply to both host and target
> > (I guess it already applied to build), not sure if that's really desired?
> > I suppose libphobos is the first target library linking against zlib?
> >
>
> Originally, libgcj linked to zlib.
>
> > You are also falling back to in-tree zlib if --with-system-zlib was
> > specified but no zlib was found - I guess for cross builds that
> > will easily get not noticed...  The toplevel --with-system-zlib makes
> > it much harder and simply fails.
> >
>
> OK, so keep --with-target-system-zlib to distinguish between the two?

Yes, and fail if specificed but not found.

Richard.

> --
> Iain
Iain Buclaw Feb. 12, 2019, 8:54 p.m. UTC | #5
On Tue, 12 Feb 2019 at 10:40, Richard Biener <richard.guenther@gmail.com> wrote:
>
> On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> >
> > On Mon, 28 Jan 2019 at 13:10, Richard Biener <richard.guenther@gmail.com> wrote:
> > >
> > > On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> > > >
> > > > Hi,
> > > >
> > > > Following on from the last, this adds target-zlib to target_libraries
> > > > and updates libphobos build scripts to link to libz_convenience.a.
> > > > The D front-end already has target-zlib in d/config-lang.in.
> > > >
> > > > Is the top-level part OK?  I considered disabling target-zlib if
> > > > libphobos is not being built, but decided against unless it's
> > > > requested.
> > >
> > > Hmm, you overload --with-system-zlib to apply to both host and target
> > > (I guess it already applied to build), not sure if that's really desired?
> > > I suppose libphobos is the first target library linking against zlib?
> > >
> >
> > Originally, libgcj linked to zlib.
> >
> > > You are also falling back to in-tree zlib if --with-system-zlib was
> > > specified but no zlib was found - I guess for cross builds that
> > > will easily get not noticed...  The toplevel --with-system-zlib makes
> > > it much harder and simply fails.
> > >
> >
> > OK, so keep --with-target-system-zlib to distinguish between the two?
>
> Yes, and fail if specificed but not found.
>

Updated patch.  Checked that it correctly fails when
--with-target-system-zlib and zlib missing.
Matthias Klose Feb. 16, 2019, 12:44 p.m. UTC | #6
On 12.02.19 21:54, Iain Buclaw wrote:
> On Tue, 12 Feb 2019 at 10:40, Richard Biener <richard.guenther@gmail.com> wrote:
>>
>> On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>>>
>>> On Mon, 28 Jan 2019 at 13:10, Richard Biener <richard.guenther@gmail.com> wrote:
>>>>
>>>> On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Following on from the last, this adds target-zlib to target_libraries
>>>>> and updates libphobos build scripts to link to libz_convenience.a.
>>>>> The D front-end already has target-zlib in d/config-lang.in.
>>>>>
>>>>> Is the top-level part OK?  I considered disabling target-zlib if
>>>>> libphobos is not being built, but decided against unless it's
>>>>> requested.
>>>>
>>>> Hmm, you overload --with-system-zlib to apply to both host and target
>>>> (I guess it already applied to build), not sure if that's really desired?
>>>> I suppose libphobos is the first target library linking against zlib?
>>>>
>>>
>>> Originally, libgcj linked to zlib.
>>>
>>>> You are also falling back to in-tree zlib if --with-system-zlib was
>>>> specified but no zlib was found - I guess for cross builds that
>>>> will easily get not noticed...  The toplevel --with-system-zlib makes
>>>> it much harder and simply fails.
>>>>
>>>
>>> OK, so keep --with-target-system-zlib to distinguish between the two?
>>
>> Yes, and fail if specificed but not found.
>>
> 
> Updated patch.  Checked that it correctly fails when
> --with-target-system-zlib and zlib missing.

For the GC enabled libobjc I added an --enable-objc-gc=auto to fall-back to the
in-tree library when no system library is found. Could you do the same for zlib?
There might be some multilib variants missing in distros.

Matthias
Iain Buclaw Feb. 17, 2019, 4:07 p.m. UTC | #7
On Sat, 16 Feb 2019 at 13:44, Matthias Klose <doko@ubuntu.com> wrote:
>
> On 12.02.19 21:54, Iain Buclaw wrote:
> > On Tue, 12 Feb 2019 at 10:40, Richard Biener <richard.guenther@gmail.com> wrote:
> >>
> >> On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> >>>
> >>> On Mon, 28 Jan 2019 at 13:10, Richard Biener <richard.guenther@gmail.com> wrote:
> >>>>
> >>>> On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> Following on from the last, this adds target-zlib to target_libraries
> >>>>> and updates libphobos build scripts to link to libz_convenience.a.
> >>>>> The D front-end already has target-zlib in d/config-lang.in.
> >>>>>
> >>>>> Is the top-level part OK?  I considered disabling target-zlib if
> >>>>> libphobos is not being built, but decided against unless it's
> >>>>> requested.
> >>>>
> >>>> Hmm, you overload --with-system-zlib to apply to both host and target
> >>>> (I guess it already applied to build), not sure if that's really desired?
> >>>> I suppose libphobos is the first target library linking against zlib?
> >>>>
> >>>
> >>> Originally, libgcj linked to zlib.
> >>>
> >>>> You are also falling back to in-tree zlib if --with-system-zlib was
> >>>> specified but no zlib was found - I guess for cross builds that
> >>>> will easily get not noticed...  The toplevel --with-system-zlib makes
> >>>> it much harder and simply fails.
> >>>>
> >>>
> >>> OK, so keep --with-target-system-zlib to distinguish between the two?
> >>
> >> Yes, and fail if specificed but not found.
> >>
> >
> > Updated patch.  Checked that it correctly fails when
> > --with-target-system-zlib and zlib missing.
>
> For the GC enabled libobjc I added an --enable-objc-gc=auto to fall-back to the
> in-tree library when no system library is found. Could you do the same for zlib?
> There might be some multilib variants missing in distros.
>

Granted that zlib is a standalone module within phobos, there's not
much trouble giving the option to disable it entirely.

Though I would prefer if the meaning of it were --with-target-system-zlib=auto.
Matthias Klose Feb. 18, 2019, 1:25 p.m. UTC | #8
On 17.02.19 17:07, Iain Buclaw wrote:
> On Sat, 16 Feb 2019 at 13:44, Matthias Klose <doko@ubuntu.com> wrote:
>>
>> On 12.02.19 21:54, Iain Buclaw wrote:
>>> On Tue, 12 Feb 2019 at 10:40, Richard Biener <richard.guenther@gmail.com> wrote:
>>>>
>>>> On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>>>>>
>>>>> On Mon, 28 Jan 2019 at 13:10, Richard Biener <richard.guenther@gmail.com> wrote:
>>>>>>
>>>>>> On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Following on from the last, this adds target-zlib to target_libraries
>>>>>>> and updates libphobos build scripts to link to libz_convenience.a.
>>>>>>> The D front-end already has target-zlib in d/config-lang.in.
>>>>>>>
>>>>>>> Is the top-level part OK?  I considered disabling target-zlib if
>>>>>>> libphobos is not being built, but decided against unless it's
>>>>>>> requested.
>>>>>>
>>>>>> Hmm, you overload --with-system-zlib to apply to both host and target
>>>>>> (I guess it already applied to build), not sure if that's really desired?
>>>>>> I suppose libphobos is the first target library linking against zlib?
>>>>>>
>>>>>
>>>>> Originally, libgcj linked to zlib.
>>>>>
>>>>>> You are also falling back to in-tree zlib if --with-system-zlib was
>>>>>> specified but no zlib was found - I guess for cross builds that
>>>>>> will easily get not noticed...  The toplevel --with-system-zlib makes
>>>>>> it much harder and simply fails.
>>>>>>
>>>>>
>>>>> OK, so keep --with-target-system-zlib to distinguish between the two?
>>>>
>>>> Yes, and fail if specificed but not found.
>>>>
>>>
>>> Updated patch.  Checked that it correctly fails when
>>> --with-target-system-zlib and zlib missing.
>>
>> For the GC enabled libobjc I added an --enable-objc-gc=auto to fall-back to the
>> in-tree library when no system library is found. Could you do the same for zlib?
>> There might be some multilib variants missing in distros.
>>
> 
> Granted that zlib is a standalone module within phobos, there's not
> much trouble giving the option to disable it entirely.
> 
> Though I would prefer if the meaning of it were --with-target-system-zlib=auto.

sorry, I didn't mean to propose to rename the option, so
--with-target-system-zlib=auto sounds fine.
Iain Buclaw March 29, 2019, 10:23 p.m. UTC | #9
On Mon, 18 Feb 2019 at 14:26, Matthias Klose <doko@ubuntu.com> wrote:
>
>
> sorry, I didn't mean to propose to rename the option, so
> --with-target-system-zlib=auto sounds fine.

OK, a bit belated, but here it is --with-target-system-zlib=auto.
Matthias Klose April 6, 2019, 3:27 p.m. UTC | #10
On 29.03.19 23:23, Iain Buclaw wrote:
> On Mon, 18 Feb 2019 at 14:26, Matthias Klose <doko@ubuntu.com> wrote:
>>
>>
>> sorry, I didn't mean to propose to rename the option, so
>> --with-target-system-zlib=auto sounds fine.
> 
> OK, a bit belated, but here it is --with-target-system-zlib=auto.

yes, this does the job.
Iain Buclaw April 6, 2019, 5:05 p.m. UTC | #11
On Sat, 6 Apr 2019 at 17:27, Matthias Klose <doko@ubuntu.com> wrote:
>
> On 29.03.19 23:23, Iain Buclaw wrote:
> > On Mon, 18 Feb 2019 at 14:26, Matthias Klose <doko@ubuntu.com> wrote:
> >>
> >>
> >> sorry, I didn't mean to propose to rename the option, so
> >> --with-target-system-zlib=auto sounds fine.
> >
> > OK, a bit belated, but here it is --with-target-system-zlib=auto.
>
> yes, this does the job.
>

Good.  I added documentation to install.texi.
Iain Buclaw April 11, 2019, 3:58 p.m. UTC | #12
On Sat, 6 Apr 2019 at 19:05, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>
> On Sat, 6 Apr 2019 at 17:27, Matthias Klose <doko@ubuntu.com> wrote:
> >
> > On 29.03.19 23:23, Iain Buclaw wrote:
> > > On Mon, 18 Feb 2019 at 14:26, Matthias Klose <doko@ubuntu.com> wrote:
> > >>
> > >>
> > >> sorry, I didn't mean to propose to rename the option, so
> > >> --with-target-system-zlib=auto sounds fine.
> > >
> > > OK, a bit belated, but here it is --with-target-system-zlib=auto.
> >
> > yes, this does the job.
> >
>
> Good.  I added documentation to install.texi.
>

Is this OK for trunk?  It's the only prerequisite for applying
subdir-objects to libphobos.
Jeff Law April 12, 2019, 4:24 p.m. UTC | #13
On 4/11/19 9:58 AM, Iain Buclaw wrote:
> On Sat, 6 Apr 2019 at 19:05, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>>
>> On Sat, 6 Apr 2019 at 17:27, Matthias Klose <doko@ubuntu.com> wrote:
>>>
>>> On 29.03.19 23:23, Iain Buclaw wrote:
>>>> On Mon, 18 Feb 2019 at 14:26, Matthias Klose <doko@ubuntu.com> wrote:
>>>>>
>>>>>
>>>>> sorry, I didn't mean to propose to rename the option, so
>>>>> --with-target-system-zlib=auto sounds fine.
>>>>
>>>> OK, a bit belated, but here it is --with-target-system-zlib=auto.
>>>
>>> yes, this does the job.
>>>
>>
>> Good.  I added documentation to install.texi.
>>
> 
> Is this OK for trunk?  It's the only prerequisite for applying
> subdir-objects to libphobos.
> 
Yes, it's fine for the trunk.
jeff
diff mbox series

Patch

diff --git a/configure b/configure
index adf4fda0f69..1c5f9b502a8 100755
--- a/configure
+++ b/configure
@@ -2813,7 +2813,8 @@  target_libraries="target-libgcc \
 		target-libobjc \
 		target-libada \
 		target-libgo \
-		target-libphobos"
+		target-libphobos \
+		target-zlib"
 
 # these tools are built using the target libraries, and are intended to
 # run only in the target environment
diff --git a/configure.ac b/configure.ac
index 87f2aee0500..cffccd37805 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,7 +163,8 @@  target_libraries="target-libgcc \
 		target-libobjc \
 		target-libada \
 		target-libgo \
-		target-libphobos"
+		target-libphobos \
+		target-zlib"
 
 # these tools are built using the target libraries, and are intended to
 # run only in the target environment
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index 3059196d75a..6a7793a75e8 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -15,7 +15,7 @@ 
 @SET_MAKE@
 
 # Makefile for the toplevel directory of the D Standard library.
-# Copyright (C) 2006-2018 Free Software Foundation, Inc.
+# Copyright (C) 2006-2019 Free Software Foundation, Inc.
 #
 # GCC is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -240,6 +240,7 @@  LIBBACKTRACE = @LIBBACKTRACE@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIBZ = @LIBZ@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
@@ -319,7 +320,6 @@  phobos_compiler_shared_flag = @phobos_compiler_shared_flag@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libphobos/configure b/libphobos/configure
index d247d9adc1f..4828c4a7927 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -640,8 +640,7 @@  gdc_include_dir
 libphobos_toolexeclibdir
 libphobos_toolexecdir
 gcc_version
-DRUNTIME_ZLIB_SYSTEM_FALSE
-DRUNTIME_ZLIB_SYSTEM_TRUE
+LIBZ
 BACKTRACE_SUPPORTS_THREADS
 BACKTRACE_USES_MALLOC
 BACKTRACE_SUPPORTED
@@ -782,7 +781,6 @@  infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -821,7 +819,7 @@  enable_unix
 enable_thread_lib
 with_libatomic
 with_libbacktrace
-with_target_system_zlib
+with_system_zlib
 with_cross_host
 enable_version_specific_runtime_libs
 '
@@ -868,7 +866,6 @@  datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1121,15 +1118,6 @@  do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1267,7 +1255,7 @@  fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1420,7 +1408,6 @@  Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1493,8 +1480,7 @@  Optional Packages:
   --without-libatomic     Do not use libatomic in core.atomic (default: auto)
   --without-libbacktrace  Do not use libbacktrace in core.runtime (default:
                           auto)
-  --with-target-system-zlib
-                          use installed libz (default: no)
+  --with-system-zlib      use installed libz (default: no)
   --with-cross-host=HOST  configuring with a cross compiler
 
 Some influential environment variables:
@@ -11508,7 +11494,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11511 "configure"
+#line 11497 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11614,7 +11600,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11617 "configure"
+#line 11603 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14729,79 +14715,97 @@  ac_compiler_gnu=$ac_cv_c_compiler_gnu
 fi
 
 
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-# Check whether --with-target-system-zlib was given.
-if test "${with_target_system_zlib+set}" = set; then :
-  withval=$with_target_system_zlib;
-fi
-
+  LIBZ=""
 
-  system_zlib=false
-  if test "x$with_target_system_zlib" = "xyes"; then :
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5
-$as_echo_n "checking for deflate in -lz... " >&6; }
-if ${ac_cv_lib_z_deflate+:} false; then :
-  $as_echo_n "(cached) " >&6
+# Check whether --with-system-zlib was given.
+if test "${with_system_zlib+set}" = set; then :
+  withval=$with_system_zlib; system_zlib=yes
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  system_zlib=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 deflate ();
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for system zlib" >&5
+$as_echo_n "checking for system zlib... " >&6; }
+  save_LIBS=$LIBS
+  LIBS="$LIBS -lz"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <zlib.h>
 int
 main ()
 {
-return deflate ();
+gzopen("none", "rb")
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_z_deflate=yes
-else
-  ac_cv_lib_z_deflate=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5
-$as_echo "$ac_cv_lib_z_deflate" >&6; }
-if test "x$ac_cv_lib_z_deflate" = xyes; then :
 
-      system_zlib=yes
+      if test "$cross_compiling" = yes; then :
+          system_zlib_found=no
 
 else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-      as_fn_error $? "System zlib not found" "$LINENO" 5
+        #include <zlib.h>
+        int main() {
+          gzFile file = gzopen("none", "rb");
+          return 0;
+        }
 
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  system_zlib_found=yes
+else
+  system_zlib_found=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
 else
+  system_zlib_found=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LIBS=$save_LIBS
+
+  if test x$system_zlib = xyes; then
+    if test x$system_zlib_found = xyes; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found, disabled" >&5
+$as_echo "not found, disabled" >&6; }
+      system_zlib=no
+    fi
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not enabled" >&5
+$as_echo "not enabled" >&6; }
+  fi
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5
-$as_echo_n "checking for zlib... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: just compiled" >&5
-$as_echo "just compiled" >&6; }
+  if test x$system_zlib = xyes; then
+    LIBS="$LIBS -lz"
+  else
+    LIBZ=../../zlib/libz_convenience.la
+  fi
 
-fi
 
-   if test "$with_target_system_zlib" = yes; then
-  DRUNTIME_ZLIB_SYSTEM_TRUE=
-  DRUNTIME_ZLIB_SYSTEM_FALSE='#'
-else
-  DRUNTIME_ZLIB_SYSTEM_TRUE='#'
-  DRUNTIME_ZLIB_SYSTEM_FALSE=
-fi
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
@@ -15107,10 +15111,6 @@  if test -z "${DRUNTIME_OS_ARM_EABI_UNWINDER_TRUE}" && test -z "${DRUNTIME_OS_ARM
   as_fn_error $? "conditional \"DRUNTIME_OS_ARM_EABI_UNWINDER\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${DRUNTIME_ZLIB_SYSTEM_TRUE}" && test -z "${DRUNTIME_ZLIB_SYSTEM_FALSE}"; then
-  as_fn_error $? "conditional \"DRUNTIME_ZLIB_SYSTEM\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index d07a8f98099..5ced807c392 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -15,7 +15,7 @@ 
 @SET_MAKE@
 
 # Makefile for the D runtime library.
-# Copyright (C) 2012-2018 Free Software Foundation, Inc.
+# Copyright (C) 2012-2019 Free Software Foundation, Inc.
 #
 # GCC is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -577,6 +577,7 @@  LIBBACKTRACE = @LIBBACKTRACE@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIBZ = @LIBZ@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
@@ -656,7 +657,6 @@  phobos_compiler_shared_flag = @phobos_compiler_shared_flag@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libphobos/m4/druntime/libraries.m4 b/libphobos/m4/druntime/libraries.m4
index 17f93468b87..7fa36295cb8 100644
--- a/libphobos/m4/druntime/libraries.m4
+++ b/libphobos/m4/druntime/libraries.m4
@@ -45,28 +45,61 @@  AC_DEFUN([DRUNTIME_LIBRARIES_DLOPEN],
 # DRUNTIME_LIBRARIES_ZLIB
 # -----------------------
 # Allow specifying whether to use the system zlib or
-# compiling the zlib included in GCC. Define
-# DRUNTIME_ZLIB_SYSTEM conditional and add zlib to
-# LIBS if necessary.
+# compiling the zlib included in GCC.  Adds substitute
+# for LIBZ or adds zlib to LIBS if necessary.
 AC_DEFUN([DRUNTIME_LIBRARIES_ZLIB],
 [
-  AC_ARG_WITH(target-system-zlib,
-    AS_HELP_STRING([--with-target-system-zlib],
-                   [use installed libz (default: no)]))
-
-  system_zlib=false
-  AS_IF([test "x$with_target_system_zlib" = "xyes"], [
-    AC_CHECK_LIB([z], [deflate], [
-      system_zlib=yes
-    ], [
-      AC_MSG_ERROR([System zlib not found])
-    ])
-  ], [
-    AC_MSG_CHECKING([for zlib])
-    AC_MSG_RESULT([just compiled])
-  ])
+  AC_LANG_PUSH([C])
+  LIBZ=""
+
+  AC_ARG_WITH(system-zlib,
+    AS_HELP_STRING([--with-system-zlib],
+                   [use installed libz (default: no)]),
+              [system_zlib=yes],[system_zlib=no])
+
+  AC_MSG_CHECKING([for system zlib])
+  save_LIBS=$LIBS
+  LIBS="$LIBS -lz"
+  dnl the link test is not good enough for ARM32 multilib detection,
+  dnl first check to link, then to run
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([#include <zlib.h>],[gzopen("none", "rb")])],
+    [
+      AC_RUN_IFELSE([AC_LANG_SOURCE([[
+        #include <zlib.h>
+        int main() {
+          gzFile file = gzopen("none", "rb");
+          return 0;
+        }
+        ]])],
+        [system_zlib_found=yes],
+        [system_zlib_found=no],
+        dnl no system zlib for cross builds ...
+        [system_zlib_found=no]
+      )
+    ],
+    [system_zlib_found=no])
+  LIBS=$save_LIBS
+
+  if test x$system_zlib = xyes; then
+    if test x$system_zlib_found = xyes; then
+      AC_MSG_RESULT([found])
+    else
+      AC_MSG_RESULT([not found, disabled])
+      system_zlib=no
+    fi
+  else
+    AC_MSG_RESULT([not enabled])
+  fi
 
-  AM_CONDITIONAL([DRUNTIME_ZLIB_SYSTEM], [test "$with_target_system_zlib" = yes])
+  if test x$system_zlib = xyes; then
+    LIBS="$LIBS -lz"
+  else
+    LIBZ=../../zlib/libz_convenience.la
+  fi
+
+  AC_SUBST(LIBZ)
+  AC_LANG_POP([C])
 ])
 
 # DRUNTIME_LIBRARIES_ATOMIC
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 30896df1d94..c335ff023b0 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -22,9 +22,6 @@  include $(top_srcdir)/d_rules.am
 D_EXTRA_DFLAGS=-nostdinc -I $(srcdir) \
 	-I $(top_srcdir)/libdruntime -I ../libdruntime -I .
 
-# C flags for zlib compilation
-AM_CFLAGS=@DEFS@ -I. -I$(srcdir)/../libdruntime/gcc -I$(top_srcdir)/../zlib
-
 # D flags for compilation
 AM_DFLAGS=$(phobos_compiler_pic_flag)
 
@@ -39,11 +36,6 @@  PHOBOS_TEST_LOBJECTS = $(ALL_PHOBOS_COMPILE_DSOURCES:.d=.t.lo)
 PHOBOS_TEST_OBJECTS = $(ALL_PHOBOS_COMPILE_DSOURCES:.d=.t.o)
 
 # Main library build definitions
-if DRUNTIME_ZLIB_SYSTEM
-    ZLIB_SRC =
-else
-    ZLIB_SRC = $(ZLIB_CSOURCES)
-endif
 check_PROGRAMS =
 if ENABLE_SHARED
     check_LTLIBRARIES = libgphobos_t.la
@@ -55,26 +47,26 @@  endif
 
 toolexeclib_DATA = libgphobos.spec
 toolexeclib_LTLIBRARIES = libgphobos.la
-libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) $(ZLIB_SRC)
+libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
 libgphobos_la_LIBTOOLFLAGS =
 libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION)
-libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la
+libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la $(LIBZ)
 libgphobos_la_DEPENDENCIES = libgphobos.spec
 
 # For static unittest, link objects directly
-unittest_static_SOURCES = ../testsuite/test_runner.d $(ZLIB_SRC)
+unittest_static_SOURCES = ../testsuite/test_runner.d
 unittest_static_LIBTOOLFLAGS =
 unittest_static_LDFLAGS = -Xcompiler -nophoboslib -static-libtool-libs
 unittest_static_LDADD = $(PHOBOS_TEST_OBJECTS) \
-    ../libdruntime/libgdruntime.la
+    ../libdruntime/libgdruntime.la $(LIBZ)
 EXTRA_unittest_static_DEPENDENCIES = $(PHOBOS_TEST_OBJECTS)
 
 # For unittest with dynamic library
-libgphobos_t_la_SOURCES = $(ZLIB_SRC)
+libgphobos_t_la_SOURCES =
 libgphobos_t_la_LIBTOOLFLAGS =
 libgphobos_t_la_LDFLAGS = -Xcompiler -nophoboslib -rpath /foo -shared
 libgphobos_t_la_LIBADD = $(PHOBOS_TEST_LOBJECTS) \
-    ../libdruntime/libgdruntime.la
+    ../libdruntime/libgdruntime.la $(LIBZ)
 EXTRA_libgphobos_t_la_DEPENDENCIES = $(PHOBOS_TEST_LOBJECTS)
 
 # For unittest
@@ -101,16 +93,6 @@  install-data-local:
 	  fi ; \
 	done
 
-# Zlib sources when not using system libz
-ZLIB_CSOURCES=$(top_srcdir)/../zlib/adler32.c $(top_srcdir)/../zlib/compress.c \
-	$(top_srcdir)/../zlib/crc32.c $(top_srcdir)/../zlib/deflate.c \
-	$(top_srcdir)/../zlib/gzclose.c $(top_srcdir)/../zlib/gzlib.c \
-	$(top_srcdir)/../zlib/gzread.c $(top_srcdir)/../zlib/gzwrite.c \
-	$(top_srcdir)/../zlib/infback.c $(top_srcdir)/../zlib/inffast.c \
-	$(top_srcdir)/../zlib/inflate.c $(top_srcdir)/../zlib/inftrees.c \
-	$(top_srcdir)/../zlib/trees.c $(top_srcdir)/../zlib/uncompr.c \
-	$(top_srcdir)/../zlib/zutil.c
-
 # Source file definitions. Boring stuff, auto-generated with
 # https://gist.github.com/jpf91/8744acebc9dcf1e9d1a35cdff20afbb2
 # Can't use wildcards here:
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index f0c8f8760b4..2fcd0093fb4 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -145,6 +145,7 @@  am__uninstall_files_from_dir = { \
 am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
 	"$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
 am__dirstamp = $(am__leading_dot)dirstamp
 am__objects_1 = etc/c/curl.lo etc/c/sqlite3.lo etc/c/zlib.lo \
 	std/algorithm/comparison.lo std/algorithm/internal.lo \
@@ -219,18 +220,9 @@  am__objects_1 = etc/c/curl.lo etc/c/sqlite3.lo etc/c/zlib.lo \
 	std/windows/syserror.lo std/xml.lo std/zip.lo std/zlib.lo
 am__objects_2 = $(am__objects_1)
 am__objects_3 = $(am__objects_2)
-am__objects_4 = libgphobos_la-adler32.lo libgphobos_la-compress.lo \
-	libgphobos_la-crc32.lo libgphobos_la-deflate.lo \
-	libgphobos_la-gzclose.lo libgphobos_la-gzlib.lo \
-	libgphobos_la-gzread.lo libgphobos_la-gzwrite.lo \
-	libgphobos_la-infback.lo libgphobos_la-inffast.lo \
-	libgphobos_la-inflate.lo libgphobos_la-inftrees.lo \
-	libgphobos_la-trees.lo libgphobos_la-uncompr.lo \
-	libgphobos_la-zutil.lo
-@DRUNTIME_ZLIB_SYSTEM_FALSE@am__objects_5 = $(am__objects_4)
-am_libgphobos_la_OBJECTS = $(am__objects_3) $(am__objects_5)
+am_libgphobos_la_OBJECTS = $(am__objects_3)
 libgphobos_la_OBJECTS = $(am_libgphobos_la_OBJECTS)
-am__DEPENDENCIES_1 = etc/c/curl.t.lo etc/c/sqlite3.t.lo \
+am__DEPENDENCIES_2 = etc/c/curl.t.lo etc/c/sqlite3.t.lo \
 	etc/c/zlib.t.lo std/algorithm/comparison.t.lo \
 	std/algorithm/internal.t.lo std/algorithm/iteration.t.lo \
 	std/algorithm/mutation.t.lo std/algorithm/package.t.lo \
@@ -309,20 +301,11 @@  am__DEPENDENCIES_1 = etc/c/curl.t.lo etc/c/sqlite3.t.lo \
 	std/windows/charset.t.lo std/windows/registry.t.lo \
 	std/windows/syserror.t.lo std/xml.t.lo std/zip.t.lo \
 	std/zlib.t.lo
-am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
 am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
-libgphobos_t_la_DEPENDENCIES = $(am__DEPENDENCIES_3) \
-	../libdruntime/libgdruntime.la
-am__objects_6 = libgphobos_t_la-adler32.lo libgphobos_t_la-compress.lo \
-	libgphobos_t_la-crc32.lo libgphobos_t_la-deflate.lo \
-	libgphobos_t_la-gzclose.lo libgphobos_t_la-gzlib.lo \
-	libgphobos_t_la-gzread.lo libgphobos_t_la-gzwrite.lo \
-	libgphobos_t_la-infback.lo libgphobos_t_la-inffast.lo \
-	libgphobos_t_la-inflate.lo libgphobos_t_la-inftrees.lo \
-	libgphobos_t_la-trees.lo libgphobos_t_la-uncompr.lo \
-	libgphobos_t_la-zutil.lo
-@DRUNTIME_ZLIB_SYSTEM_FALSE@am__objects_7 = $(am__objects_6)
-am_libgphobos_t_la_OBJECTS = $(am__objects_7)
+am__DEPENDENCIES_4 = $(am__DEPENDENCIES_3)
+libgphobos_t_la_DEPENDENCIES = $(am__DEPENDENCIES_4) \
+	../libdruntime/libgdruntime.la $(am__DEPENDENCIES_1)
+am_libgphobos_t_la_OBJECTS =
 libgphobos_t_la_OBJECTS = $(am_libgphobos_t_la_OBJECTS)
 @ENABLE_SHARED_TRUE@am_libgphobos_t_la_rpath =
 @ENABLE_SHARED_TRUE@am__EXEEXT_1 = unittest$(EXEEXT)
@@ -330,16 +313,9 @@  libgphobos_t_la_OBJECTS = $(am_libgphobos_t_la_OBJECTS)
 am_unittest_OBJECTS = ../testsuite/test_runner.$(OBJEXT)
 unittest_OBJECTS = $(am_unittest_OBJECTS)
 unittest_DEPENDENCIES = libgphobos_t.la ../libdruntime/libgdruntime.la
-am__objects_8 = adler32.$(OBJEXT) compress.$(OBJEXT) crc32.$(OBJEXT) \
-	deflate.$(OBJEXT) gzclose.$(OBJEXT) gzlib.$(OBJEXT) \
-	gzread.$(OBJEXT) gzwrite.$(OBJEXT) infback.$(OBJEXT) \
-	inffast.$(OBJEXT) inflate.$(OBJEXT) inftrees.$(OBJEXT) \
-	trees.$(OBJEXT) uncompr.$(OBJEXT) zutil.$(OBJEXT)
-@DRUNTIME_ZLIB_SYSTEM_FALSE@am__objects_9 = $(am__objects_8)
-am_unittest_static_OBJECTS = ../testsuite/test_runner.$(OBJEXT) \
-	$(am__objects_9)
+am_unittest_static_OBJECTS = ../testsuite/test_runner.$(OBJEXT)
 unittest_static_OBJECTS = $(am_unittest_static_OBJECTS)
-am__DEPENDENCIES_4 = etc/c/curl.t.o etc/c/sqlite3.t.o etc/c/zlib.t.o \
+am__DEPENDENCIES_5 = etc/c/curl.t.o etc/c/sqlite3.t.o etc/c/zlib.t.o \
 	std/algorithm/comparison.t.o std/algorithm/internal.t.o \
 	std/algorithm/iteration.t.o std/algorithm/mutation.t.o \
 	std/algorithm/package.t.o std/algorithm/searching.t.o \
@@ -413,10 +389,10 @@  am__DEPENDENCIES_4 = etc/c/curl.t.o etc/c/sqlite3.t.o etc/c/zlib.t.o \
 	std/uri.t.o std/utf.t.o std/uuid.t.o std/variant.t.o \
 	std/windows/charset.t.o std/windows/registry.t.o \
 	std/windows/syserror.t.o std/xml.t.o std/zip.t.o std/zlib.t.o
-am__DEPENDENCIES_5 = $(am__DEPENDENCIES_4)
 am__DEPENDENCIES_6 = $(am__DEPENDENCIES_5)
-unittest_static_DEPENDENCIES = $(am__DEPENDENCIES_6) \
-	../libdruntime/libgdruntime.la
+am__DEPENDENCIES_7 = $(am__DEPENDENCIES_6)
+unittest_static_DEPENDENCIES = $(am__DEPENDENCIES_7) \
+	../libdruntime/libgdruntime.la $(am__DEPENDENCIES_1)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -432,12 +408,12 @@  am__v_at_1 =
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp =
 am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
@@ -531,6 +507,7 @@  LIBBACKTRACE = @LIBBACKTRACE@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIBZ = @LIBZ@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
@@ -610,7 +587,6 @@  phobos_compiler_shared_flag = @phobos_compiler_shared_flag@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -674,9 +650,6 @@  D_EXTRA_DFLAGS = -nostdinc -I $(srcdir) \
 	-I $(top_srcdir)/libdruntime -I ../libdruntime -I .
 
 
-# C flags for zlib compilation
-AM_CFLAGS = @DEFS@ -I. -I$(srcdir)/../libdruntime/gcc -I$(top_srcdir)/../zlib
-
 # D flags for compilation
 AM_DFLAGS = $(phobos_compiler_pic_flag)
 
@@ -688,34 +661,30 @@  ALL_PHOBOS_COMPILE_DSOURCES = $(PHOBOS_DSOURCES)
 ALL_PHOBOS_SOURCES = $(ALL_PHOBOS_COMPILE_DSOURCES)
 PHOBOS_TEST_LOBJECTS = $(ALL_PHOBOS_COMPILE_DSOURCES:.d=.t.lo)
 PHOBOS_TEST_OBJECTS = $(ALL_PHOBOS_COMPILE_DSOURCES:.d=.t.o)
-@DRUNTIME_ZLIB_SYSTEM_FALSE@ZLIB_SRC = $(ZLIB_CSOURCES)
-
-# Main library build definitions
-@DRUNTIME_ZLIB_SYSTEM_TRUE@ZLIB_SRC = 
 @ENABLE_SHARED_TRUE@check_LTLIBRARIES = libgphobos_t.la
 toolexeclib_DATA = libgphobos.spec
 toolexeclib_LTLIBRARIES = libgphobos.la
-libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) $(ZLIB_SRC)
+libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES)
 libgphobos_la_LIBTOOLFLAGS = 
 libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION)
-libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la
+libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la $(LIBZ)
 libgphobos_la_DEPENDENCIES = libgphobos.spec
 
 # For static unittest, link objects directly
-unittest_static_SOURCES = ../testsuite/test_runner.d $(ZLIB_SRC)
+unittest_static_SOURCES = ../testsuite/test_runner.d
 unittest_static_LIBTOOLFLAGS = 
 unittest_static_LDFLAGS = -Xcompiler -nophoboslib -static-libtool-libs
 unittest_static_LDADD = $(PHOBOS_TEST_OBJECTS) \
-    ../libdruntime/libgdruntime.la
+    ../libdruntime/libgdruntime.la $(LIBZ)
 
 EXTRA_unittest_static_DEPENDENCIES = $(PHOBOS_TEST_OBJECTS)
 
 # For unittest with dynamic library
-libgphobos_t_la_SOURCES = $(ZLIB_SRC)
+libgphobos_t_la_SOURCES = 
 libgphobos_t_la_LIBTOOLFLAGS = 
 libgphobos_t_la_LDFLAGS = -Xcompiler -nophoboslib -rpath /foo -shared
 libgphobos_t_la_LIBADD = $(PHOBOS_TEST_LOBJECTS) \
-    ../libdruntime/libgdruntime.la
+    ../libdruntime/libgdruntime.la $(LIBZ)
 
 EXTRA_libgphobos_t_la_DEPENDENCIES = $(PHOBOS_TEST_LOBJECTS)
 
@@ -725,17 +694,6 @@  unittest_LIBTOOLFLAGS =
 unittest_LDFLAGS = -Xcompiler -nophoboslib -shared
 unittest_LDADD = libgphobos_t.la ../libdruntime/libgdruntime.la
 
-# Zlib sources when not using system libz
-ZLIB_CSOURCES = $(top_srcdir)/../zlib/adler32.c $(top_srcdir)/../zlib/compress.c \
-	$(top_srcdir)/../zlib/crc32.c $(top_srcdir)/../zlib/deflate.c \
-	$(top_srcdir)/../zlib/gzclose.c $(top_srcdir)/../zlib/gzlib.c \
-	$(top_srcdir)/../zlib/gzread.c $(top_srcdir)/../zlib/gzwrite.c \
-	$(top_srcdir)/../zlib/infback.c $(top_srcdir)/../zlib/inffast.c \
-	$(top_srcdir)/../zlib/inflate.c $(top_srcdir)/../zlib/inftrees.c \
-	$(top_srcdir)/../zlib/trees.c $(top_srcdir)/../zlib/uncompr.c \
-	$(top_srcdir)/../zlib/zutil.c
-
-
 # Source file definitions. Boring stuff, auto-generated with
 # https://gist.github.com/jpf91/8744acebc9dcf1e9d1a35cdff20afbb2
 # Can't use wildcards here:
@@ -806,7 +764,7 @@  PHOBOS_DSOURCES = etc/c/curl.d etc/c/sqlite3.d etc/c/zlib.d \
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .d .lo .o .obj
+.SUFFIXES: .d .lo .o
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/d_rules.am $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -1181,195 +1139,6 @@  mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-.c.o:
-	$(AM_V_CC)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-	$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-	$(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
-
-libgphobos_la-adler32.lo: $(top_srcdir)/../zlib/adler32.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-adler32.lo `test -f '$(top_srcdir)/../zlib/adler32.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/adler32.c
-
-libgphobos_la-compress.lo: $(top_srcdir)/../zlib/compress.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-compress.lo `test -f '$(top_srcdir)/../zlib/compress.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/compress.c
-
-libgphobos_la-crc32.lo: $(top_srcdir)/../zlib/crc32.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-crc32.lo `test -f '$(top_srcdir)/../zlib/crc32.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/crc32.c
-
-libgphobos_la-deflate.lo: $(top_srcdir)/../zlib/deflate.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-deflate.lo `test -f '$(top_srcdir)/../zlib/deflate.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/deflate.c
-
-libgphobos_la-gzclose.lo: $(top_srcdir)/../zlib/gzclose.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-gzclose.lo `test -f '$(top_srcdir)/../zlib/gzclose.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzclose.c
-
-libgphobos_la-gzlib.lo: $(top_srcdir)/../zlib/gzlib.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-gzlib.lo `test -f '$(top_srcdir)/../zlib/gzlib.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzlib.c
-
-libgphobos_la-gzread.lo: $(top_srcdir)/../zlib/gzread.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-gzread.lo `test -f '$(top_srcdir)/../zlib/gzread.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzread.c
-
-libgphobos_la-gzwrite.lo: $(top_srcdir)/../zlib/gzwrite.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-gzwrite.lo `test -f '$(top_srcdir)/../zlib/gzwrite.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzwrite.c
-
-libgphobos_la-infback.lo: $(top_srcdir)/../zlib/infback.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-infback.lo `test -f '$(top_srcdir)/../zlib/infback.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/infback.c
-
-libgphobos_la-inffast.lo: $(top_srcdir)/../zlib/inffast.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-inffast.lo `test -f '$(top_srcdir)/../zlib/inffast.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inffast.c
-
-libgphobos_la-inflate.lo: $(top_srcdir)/../zlib/inflate.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-inflate.lo `test -f '$(top_srcdir)/../zlib/inflate.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inflate.c
-
-libgphobos_la-inftrees.lo: $(top_srcdir)/../zlib/inftrees.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-inftrees.lo `test -f '$(top_srcdir)/../zlib/inftrees.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inftrees.c
-
-libgphobos_la-trees.lo: $(top_srcdir)/../zlib/trees.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-trees.lo `test -f '$(top_srcdir)/../zlib/trees.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/trees.c
-
-libgphobos_la-uncompr.lo: $(top_srcdir)/../zlib/uncompr.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-uncompr.lo `test -f '$(top_srcdir)/../zlib/uncompr.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/uncompr.c
-
-libgphobos_la-zutil.lo: $(top_srcdir)/../zlib/zutil.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_la-zutil.lo `test -f '$(top_srcdir)/../zlib/zutil.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/zutil.c
-
-libgphobos_t_la-adler32.lo: $(top_srcdir)/../zlib/adler32.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-adler32.lo `test -f '$(top_srcdir)/../zlib/adler32.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/adler32.c
-
-libgphobos_t_la-compress.lo: $(top_srcdir)/../zlib/compress.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-compress.lo `test -f '$(top_srcdir)/../zlib/compress.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/compress.c
-
-libgphobos_t_la-crc32.lo: $(top_srcdir)/../zlib/crc32.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-crc32.lo `test -f '$(top_srcdir)/../zlib/crc32.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/crc32.c
-
-libgphobos_t_la-deflate.lo: $(top_srcdir)/../zlib/deflate.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-deflate.lo `test -f '$(top_srcdir)/../zlib/deflate.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/deflate.c
-
-libgphobos_t_la-gzclose.lo: $(top_srcdir)/../zlib/gzclose.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-gzclose.lo `test -f '$(top_srcdir)/../zlib/gzclose.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzclose.c
-
-libgphobos_t_la-gzlib.lo: $(top_srcdir)/../zlib/gzlib.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-gzlib.lo `test -f '$(top_srcdir)/../zlib/gzlib.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzlib.c
-
-libgphobos_t_la-gzread.lo: $(top_srcdir)/../zlib/gzread.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-gzread.lo `test -f '$(top_srcdir)/../zlib/gzread.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzread.c
-
-libgphobos_t_la-gzwrite.lo: $(top_srcdir)/../zlib/gzwrite.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-gzwrite.lo `test -f '$(top_srcdir)/../zlib/gzwrite.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzwrite.c
-
-libgphobos_t_la-infback.lo: $(top_srcdir)/../zlib/infback.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-infback.lo `test -f '$(top_srcdir)/../zlib/infback.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/infback.c
-
-libgphobos_t_la-inffast.lo: $(top_srcdir)/../zlib/inffast.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-inffast.lo `test -f '$(top_srcdir)/../zlib/inffast.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inffast.c
-
-libgphobos_t_la-inflate.lo: $(top_srcdir)/../zlib/inflate.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-inflate.lo `test -f '$(top_srcdir)/../zlib/inflate.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inflate.c
-
-libgphobos_t_la-inftrees.lo: $(top_srcdir)/../zlib/inftrees.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-inftrees.lo `test -f '$(top_srcdir)/../zlib/inftrees.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inftrees.c
-
-libgphobos_t_la-trees.lo: $(top_srcdir)/../zlib/trees.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-trees.lo `test -f '$(top_srcdir)/../zlib/trees.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/trees.c
-
-libgphobos_t_la-uncompr.lo: $(top_srcdir)/../zlib/uncompr.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-uncompr.lo `test -f '$(top_srcdir)/../zlib/uncompr.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/uncompr.c
-
-libgphobos_t_la-zutil.lo: $(top_srcdir)/../zlib/zutil.c
-	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgphobos_t_la-zutil.lo `test -f '$(top_srcdir)/../zlib/zutil.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/zutil.c
-
-adler32.o: $(top_srcdir)/../zlib/adler32.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adler32.o `test -f '$(top_srcdir)/../zlib/adler32.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/adler32.c
-
-adler32.obj: $(top_srcdir)/../zlib/adler32.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adler32.obj `if test -f '$(top_srcdir)/../zlib/adler32.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/adler32.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/adler32.c'; fi`
-
-compress.o: $(top_srcdir)/../zlib/compress.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o compress.o `test -f '$(top_srcdir)/../zlib/compress.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/compress.c
-
-compress.obj: $(top_srcdir)/../zlib/compress.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o compress.obj `if test -f '$(top_srcdir)/../zlib/compress.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/compress.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/compress.c'; fi`
-
-crc32.o: $(top_srcdir)/../zlib/crc32.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crc32.o `test -f '$(top_srcdir)/../zlib/crc32.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/crc32.c
-
-crc32.obj: $(top_srcdir)/../zlib/crc32.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crc32.obj `if test -f '$(top_srcdir)/../zlib/crc32.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/crc32.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/crc32.c'; fi`
-
-deflate.o: $(top_srcdir)/../zlib/deflate.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o deflate.o `test -f '$(top_srcdir)/../zlib/deflate.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/deflate.c
-
-deflate.obj: $(top_srcdir)/../zlib/deflate.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o deflate.obj `if test -f '$(top_srcdir)/../zlib/deflate.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/deflate.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/deflate.c'; fi`
-
-gzclose.o: $(top_srcdir)/../zlib/gzclose.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gzclose.o `test -f '$(top_srcdir)/../zlib/gzclose.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzclose.c
-
-gzclose.obj: $(top_srcdir)/../zlib/gzclose.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gzclose.obj `if test -f '$(top_srcdir)/../zlib/gzclose.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/gzclose.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/gzclose.c'; fi`
-
-gzlib.o: $(top_srcdir)/../zlib/gzlib.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gzlib.o `test -f '$(top_srcdir)/../zlib/gzlib.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzlib.c
-
-gzlib.obj: $(top_srcdir)/../zlib/gzlib.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gzlib.obj `if test -f '$(top_srcdir)/../zlib/gzlib.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/gzlib.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/gzlib.c'; fi`
-
-gzread.o: $(top_srcdir)/../zlib/gzread.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gzread.o `test -f '$(top_srcdir)/../zlib/gzread.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzread.c
-
-gzread.obj: $(top_srcdir)/../zlib/gzread.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gzread.obj `if test -f '$(top_srcdir)/../zlib/gzread.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/gzread.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/gzread.c'; fi`
-
-gzwrite.o: $(top_srcdir)/../zlib/gzwrite.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gzwrite.o `test -f '$(top_srcdir)/../zlib/gzwrite.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/gzwrite.c
-
-gzwrite.obj: $(top_srcdir)/../zlib/gzwrite.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gzwrite.obj `if test -f '$(top_srcdir)/../zlib/gzwrite.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/gzwrite.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/gzwrite.c'; fi`
-
-infback.o: $(top_srcdir)/../zlib/infback.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o infback.o `test -f '$(top_srcdir)/../zlib/infback.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/infback.c
-
-infback.obj: $(top_srcdir)/../zlib/infback.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o infback.obj `if test -f '$(top_srcdir)/../zlib/infback.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/infback.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/infback.c'; fi`
-
-inffast.o: $(top_srcdir)/../zlib/inffast.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inffast.o `test -f '$(top_srcdir)/../zlib/inffast.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inffast.c
-
-inffast.obj: $(top_srcdir)/../zlib/inffast.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inffast.obj `if test -f '$(top_srcdir)/../zlib/inffast.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/inffast.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/inffast.c'; fi`
-
-inflate.o: $(top_srcdir)/../zlib/inflate.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inflate.o `test -f '$(top_srcdir)/../zlib/inflate.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inflate.c
-
-inflate.obj: $(top_srcdir)/../zlib/inflate.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inflate.obj `if test -f '$(top_srcdir)/../zlib/inflate.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/inflate.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/inflate.c'; fi`
-
-inftrees.o: $(top_srcdir)/../zlib/inftrees.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inftrees.o `test -f '$(top_srcdir)/../zlib/inftrees.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/inftrees.c
-
-inftrees.obj: $(top_srcdir)/../zlib/inftrees.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inftrees.obj `if test -f '$(top_srcdir)/../zlib/inftrees.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/inftrees.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/inftrees.c'; fi`
-
-trees.o: $(top_srcdir)/../zlib/trees.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o trees.o `test -f '$(top_srcdir)/../zlib/trees.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/trees.c
-
-trees.obj: $(top_srcdir)/../zlib/trees.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o trees.obj `if test -f '$(top_srcdir)/../zlib/trees.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/trees.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/trees.c'; fi`
-
-uncompr.o: $(top_srcdir)/../zlib/uncompr.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncompr.o `test -f '$(top_srcdir)/../zlib/uncompr.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/uncompr.c
-
-uncompr.obj: $(top_srcdir)/../zlib/uncompr.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncompr.obj `if test -f '$(top_srcdir)/../zlib/uncompr.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/uncompr.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/uncompr.c'; fi`
-
-zutil.o: $(top_srcdir)/../zlib/zutil.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zutil.o `test -f '$(top_srcdir)/../zlib/zutil.c' || echo '$(srcdir)/'`$(top_srcdir)/../zlib/zutil.c
-
-zutil.obj: $(top_srcdir)/../zlib/zutil.c
-	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zutil.obj `if test -f '$(top_srcdir)/../zlib/zutil.c'; then $(CYGPATH_W) '$(top_srcdir)/../zlib/zutil.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../zlib/zutil.c'; fi`
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in
index 33950c5c953..fcc6c9e8abb 100644
--- a/libphobos/testsuite/Makefile.in
+++ b/libphobos/testsuite/Makefile.in
@@ -186,6 +186,7 @@  LIBBACKTRACE = @LIBBACKTRACE@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIBZ = @LIBZ@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
@@ -265,7 +266,6 @@  phobos_compiler_shared_flag = @phobos_compiler_shared_flag@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@