# DP: Build zlib in any case to have a fall back for missing libz multilibs Index: b/src/libphobos/configure.ac =================================================================== --- a/src/libphobos/configure.ac +++ b/src/libphobos/configure.ac @@ -104,6 +104,7 @@ WITH_LOCAL_DRUNTIME([ DRUNTIME_LIBBACKTRACE_SETUP DRUNTIME_INSTALL_DIRECTORIES +dnl fake change to regenerate the configure file # Add dependencies for libgphobos.spec file LIBS="$LIBS $LIBADD_DLOPEN" Index: b/src/libphobos/m4/druntime/libraries.m4 =================================================================== --- a/src/libphobos/m4/druntime/libraries.m4 +++ b/src/libphobos/m4/druntime/libraries.m4 @@ -39,18 +39,44 @@ AC_DEFUN([DRUNTIME_LIBRARIES_ZLIB], [ AC_ARG_WITH(target-system-zlib, AS_HELP_STRING([--with-target-system-zlib], - [use installed libz (default: no)])) + [use installed libz (default: no)]), + [system_zlib=yes],[system_zlib=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_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_LANG_PUSH(C) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include ],[gzopen("none", "rb")])], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + 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 + AC_LANG_POP AM_CONDITIONAL([DRUNTIME_ZLIB_SYSTEM], [test "$with_target_system_zlib" = yes]) ])