Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-04-12 Thread Jeff Law
On 4/11/19 9:58 AM, Iain Buclaw wrote:
> On Sat, 6 Apr 2019 at 19:05, Iain Buclaw  wrote:
>>
>> On Sat, 6 Apr 2019 at 17:27, Matthias Klose  wrote:
>>>
>>> On 29.03.19 23:23, Iain Buclaw wrote:
 On Mon, 18 Feb 2019 at 14:26, Matthias Klose  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


Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-04-11 Thread Iain Buclaw
On Sat, 6 Apr 2019 at 19:05, Iain Buclaw  wrote:
>
> On Sat, 6 Apr 2019 at 17:27, Matthias Klose  wrote:
> >
> > On 29.03.19 23:23, Iain Buclaw wrote:
> > > On Mon, 18 Feb 2019 at 14:26, Matthias Klose  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.

-- 
Iain


Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-04-06 Thread Iain Buclaw
On Sat, 6 Apr 2019 at 17:27, Matthias Klose  wrote:
>
> On 29.03.19 23:23, Iain Buclaw wrote:
> > On Mon, 18 Feb 2019 at 14:26, Matthias Klose  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
---
ChangeLog:

2019-04-06  Iain Buclaw  

* configure.ac: Add target-zlib to target_libraries.
* configure: Regenerate.

gcc/ChangeLog:

2019-04-06  Iain Buclaw  

* doc/install.texi: Document --with-target-system-zlib.

libphobos/ChangeLog:

2019-04-06  Iain Buclaw  

* 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.

---
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/gcc/doc/install.texi b/gcc/doc/install.texi
index 8d7bee5f89b..3e749240dfe 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2344,6 +2344,18 @@ If none of these options are specified, the library is assumed in
 default locations.
 @end table
 
+@subheading D-Specific Options
+
+The following options apply to the build of the D runtime library.
+
+@table @code
+@item --with-target-system-zlib
+Use installed @samp{zlib} rather than that included with GCC@.  This needs
+to be available for each multilib variant, unless configured with
+@option{--with-target-system-zlib=@samp{auto}} in which case the GCC@ included
+@samp{zlib} is used when the system installed library is not available.
+@end table
+
 @html
 
 
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index e7c156aa5eb..1cd4117f2ee 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -241,6 +241,7 @@ LIBBACKTRACE = @LIBBACKTRACE@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIBZ = @LIBZ@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
diff --git a/libphobos/configure b/libphobos/configure
index d86934b59a5..906d472c039 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
@@ -1484,7 +1483,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
+  --with-target-system-zlib={yes,no,auto}
   use installed libz (default: no)
   --with-cross-host=HOST  configuring with a cross compiler
 
@@ -11499,7 +11498,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11502 "configure"
+#line 11501 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11605,7 +11604,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11608 "configure"
+#line 11607 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14864,79 +14863,94 @@ $as_echo "$druntime_cv_lib_sockets" >&6; }
   LIBS="$LIBS $druntime_cv_lib_sockets"
 
 
+  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
+
+  LIBZ=""
+
 
 # Check whether --with-target-system-zlib was given.
 if test "${with_target_system_zlib+set}" = set; then :
   withval=$with_target_system_zlib;
+else
+  with_target_system_zlib=no
 fi
 
 
-  system_zlib=false
-  if test "x$with_target_system_zlib" = "xyes"; then :
+  case "$with_target_system_zlib" in
+yes|no|auto) ;;
+*) as_fn_error $? "Invalid argument for 

Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-04-06 Thread Matthias Klose
On 29.03.19 23:23, Iain Buclaw wrote:
> On Mon, 18 Feb 2019 at 14:26, Matthias Klose  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.



Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-03-29 Thread Iain Buclaw
On Mon, 18 Feb 2019 at 14:26, Matthias Klose  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.

-- 
Iain
---
ChangeLog:

2019-03-29  Iain Buclaw  

* configure.ac: Add target-zlib to target_libraries.
* configure: Regenerate.

libphobos/ChangeLog:

2019-03-29  Iain Buclaw  

* m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_ZLIB): Use
libz_convienience.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.

---
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 e7c156aa5eb..1cd4117f2ee 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -241,6 +241,7 @@ LIBBACKTRACE = @LIBBACKTRACE@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIBZ = @LIBZ@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
diff --git a/libphobos/configure b/libphobos/configure
index d86934b59a5..906d472c039 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
@@ -1484,7 +1483,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
+  --with-target-system-zlib={yes,no,auto}
   use installed libz (default: no)
   --with-cross-host=HOST  configuring with a cross compiler
 
@@ -11499,7 +11498,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11502 "configure"
+#line 11501 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11605,7 +11604,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11608 "configure"
+#line 11607 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14864,79 +14863,94 @@ $as_echo "$druntime_cv_lib_sockets" >&6; }
   LIBS="$LIBS $druntime_cv_lib_sockets"
 
 
+  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
+
+  LIBZ=""
+
 
 # Check whether --with-target-system-zlib was given.
 if test "${with_target_system_zlib+set}" = set; then :
   withval=$with_target_system_zlib;
+else
+  with_target_system_zlib=no
 fi
 
 
-  system_zlib=false
-  if test "x$with_target_system_zlib" = "xyes"; then :
+  case "$with_target_system_zlib" in
+yes|no|auto) ;;
+*) as_fn_error $? "Invalid argument for --with-target-system-zlib" "$LINENO" 5 ;;
+  esac
 
-{ $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
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  { $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.  */
-
-/* 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 ();
+#include 
 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 

Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-02-18 Thread Matthias Klose
On 17.02.19 17:07, Iain Buclaw wrote:
> On Sat, 16 Feb 2019 at 13:44, Matthias Klose  wrote:
>>
>> On 12.02.19 21:54, Iain Buclaw wrote:
>>> On Tue, 12 Feb 2019 at 10:40, Richard Biener  
>>> wrote:

 On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw  wrote:
>
> On Mon, 28 Jan 2019 at 13:10, Richard Biener  
> wrote:
>>
>> On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw  
>> 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.


Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-02-17 Thread Iain Buclaw
On Sat, 16 Feb 2019 at 13:44, Matthias Klose  wrote:
>
> On 12.02.19 21:54, Iain Buclaw wrote:
> > On Tue, 12 Feb 2019 at 10:40, Richard Biener  
> > wrote:
> >>
> >> On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw  wrote:
> >>>
> >>> On Mon, 28 Jan 2019 at 13:10, Richard Biener  
> >>> wrote:
> 
>  On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw  
>  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.

-- 
Iain


Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-02-16 Thread Matthias Klose
On 12.02.19 21:54, Iain Buclaw wrote:
> On Tue, 12 Feb 2019 at 10:40, Richard Biener  
> wrote:
>>
>> On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw  wrote:
>>>
>>> On Mon, 28 Jan 2019 at 13:10, Richard Biener  
>>> wrote:

 On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw  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


Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-02-12 Thread Iain Buclaw
On Tue, 12 Feb 2019 at 10:40, Richard Biener  wrote:
>
> On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw  wrote:
> >
> > On Mon, 28 Jan 2019 at 13:10, Richard Biener  
> > wrote:
> > >
> > > On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw  
> > > 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.

-- 
Iain

---
ChangeLog:

2019-02-12  Iain Buclaw  

* configure.ac: configure.ac: Add target-zlib to target_libraries.
* configure: Regenerate.

libphobos/ChangeLog:

2019-02-12  Iain Buclaw  

* 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.
---
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 87eaf28aba7..6a7793a75e8 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -240,6 +240,7 @@ LIBBACKTRACE = @LIBBACKTRACE@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIBZ = @LIBZ@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
diff --git a/libphobos/configure b/libphobos/configure
index 9f96ad5d190..252ec6ad718 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -3,7 +3,7 @@
 # Generated by GNU Autoconf 2.69 for package-unused version-unused.
 #
 #
-# Copyright (C) 1992-2019 Free Software Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -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
@@ -1568,7 +1567,7 @@ if $ac_init_version; then
 package-unused configure version-unused
 generated by GNU Autoconf 2.69
 
-Copyright (C) 2012-2019 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -14717,79 +14716,95 @@ 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
+
+  LIBZ=""
+
 
 # Check whether --with-target-system-zlib was given.
 if test "${with_target_system_zlib+set}" = set; then :
-  withval=$with_target_system_zlib;
+  withval=$with_target_system_zlib; system_zlib=yes
+else
+  system_zlib=no
 fi
 
 
-  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

Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-02-12 Thread Richard Biener
On Sat, Feb 9, 2019 at 10:37 AM Iain Buclaw  wrote:
>
> On Mon, 28 Jan 2019 at 13:10, Richard Biener  
> wrote:
> >
> > On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw  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


Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-02-09 Thread Iain Buclaw
On Mon, 28 Jan 2019 at 13:10, Richard Biener  wrote:
>
> On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw  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?

-- 
Iain


Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-01-28 Thread Joseph Myers
On Mon, 28 Jan 2019, Richard Biener wrote:

> On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw  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.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCH] Add target-zlib to top-level configure, use zlib from libphobos

2019-01-28 Thread Richard Biener
On Mon, Jan 21, 2019 at 7:35 PM Iain Buclaw  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  
>
> * configure.ac: configure.ac: Add target-zlib to target_libraries.
> * configure: Regenerate.
>
> libphobos/ChangeLog:
>
> 2019-01-21  Iain Buclaw  
>
> * 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.
>
> ---


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

2019-01-21 Thread Iain Buclaw
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.

-- 
Iain
---
ChangeLog:

2019-01-21  Iain Buclaw  

* configure.ac: configure.ac: Add target-zlib to target_libraries.
* configure: Regenerate.

libphobos/ChangeLog:

2019-01-21  Iain Buclaw  

* 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.

---
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=DIRread-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIRmodifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR   modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIRobject code