After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 737532 - zlib and lzma libraries check via command line --with-zlib and --with-lzma options
zlib and lzma libraries check via command line --with-zlib and --with-lzma op...
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other HP-UX
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-09-28 15:57 UTC by Dmitriy
Modified: 2014-10-07 11:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
This is right configured libxml2 (96.31 KB, application/octet-stream)
2014-09-28 15:57 UTC, Dmitriy
Details
This is wrong configured libxml2 with original configure (96.23 KB, application/octet-stream)
2014-09-28 16:00 UTC, Dmitriy
Details

Description Dmitriy 2014-09-28 15:57:42 UTC
Created attachment 287295 [details]
This is right configured libxml2

Hi,
I got some troubles to compile libxml2 2.9.1 on HP-UX 11.31 with native compiler with enabled zlib support via --with-zlib=<path> mechanism but without installed zlib in system default /usr/lib. The main problem in AC_CHECK_LIB macro. It prepends searching library name before LIBS variable. LIBS was set correctly at the line 197 (where --with-zlib option is analyzing) but construction "-lz -L<correct path to zlib>/lib" returns library not found because there is no libz in my system path. If it would append serching library after LIBS, everything will fine. The same problem with --with-lzma option. Of course I can add correct path to CFLAGS or LDFLAGS environmant variables before calling configure but I think that the main problem in libxml's configure script because I specified the correct path to installed zlib.
My suggestion is add save, change and restore LDFLAGS before AC_CHECK_LIB call when functions gzread and lzma_code are searching inside action-if-found of AC_CHECK_HEADERS:

*** configure.in.back   2014-09-26 10:49:30.973018572 +0400
--- configure.in        2014-09-28 18:22:31.757395718 +0400
***************
*** 386,405 ****
      echo "Disabling compression support"
  else
      AC_CHECK_HEADERS(zlib.h,
!       AC_CHECK_LIB(z, gzread,[
!           AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
!           WITH_ZLIB=1
!           if test "x${Z_DIR}" != "x"; then
!               Z_CFLAGS="-I${Z_DIR}/include"
!               Z_LIBS="-L${Z_DIR}/lib -lz"
!               [case ${host} in
!                   *-*-solaris*)
!                       Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
!                       ;;
!               esac]
!           else
!               Z_LIBS="-lz"
!           fi]))
  fi
  
  AC_SUBST(Z_CFLAGS)
--- 386,409 ----
      echo "Disabling compression support"
  else
      AC_CHECK_HEADERS(zlib.h,
!                      [SAVE_LDFLAGS="${LDFLAGS}"
!                       LDFLAGS="-L${Z_DIR}/lib"
!                       AC_CHECK_LIB(z, gzread,
!                                    [AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
!                                     WITH_ZLIB=1
!                                     if test "x${Z_DIR}" != "x"
!                                     then
!                                         Z_CFLAGS="-I${Z_DIR}/include"
!                                         Z_LIBS="-L${Z_DIR}/lib -lz"
!                                         [case ${host} in
!                                             *-*-solaris*)
!                                                 Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
!                                                 ;;
!                                          esac]
!                                     else
!                                         Z_LIBS="-lz"
!                                     fi])
!                       LDFLAGS="${SAVE_LDFLAGS}"])
  fi
  
  AC_SUBST(Z_CFLAGS)
***************
*** 415,429 ****
      echo "Disabling compression support"
  else
      AC_CHECK_HEADERS(lzma.h,
!       AC_CHECK_LIB(lzma, lzma_code,[
!           AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
!           WITH_LZMA=1
!           if test "x${LZMA_DIR}" != "x"; then
!               LZMA_CFLAGS="-I${LZMA_DIR}/include"
!               LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
!           else
!               LZMA_LIBS="-llzma"
!           fi]))
  fi

  AC_SUBST(LZMA_CFLAGS)
--- 419,437 ----
      echo "Disabling compression support"
  else
      AC_CHECK_HEADERS(lzma.h,
!                      [SAVE_LDFLAGS="${LDFLAGS}"
!                       LDFLAGS="-L${LZMA_DIR}/lib"
!                       AC_CHECK_LIB(lzma, lzma_code,
!                                    [AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
!                                     WITH_LZMA=1
!                                     if test "x${LZMA_DIR}" != "x"
!                                     then
!                                         LZMA_CFLAGS="-I${LZMA_DIR}/include"
!                                         LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
!                                     else
!                                         LZMA_LIBS="-llzma"
!                                     fi])
!                       LDFLAGS="${SAVE_LDFLAGS}"])
  fi

  AC_SUBST(LZMA_CFLAGS)

Thanks, Dmitriy
Comment 1 Dmitriy 2014-09-28 16:00:15 UTC
Created attachment 287297 [details]
This is wrong configured libxml2 with original configure

It cause the build-time error:

Making all in .
 /bin/sh ./config.status
config.status: creating libxml2.spec
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating include/libxml/Makefile
config.status: creating doc/Makefile
config.status: creating doc/examples/Makefile
config.status: creating doc/devhelp/Makefile
config.status: creating example/Makefile
config.status: creating python/Makefile
config.status: creating python/tests/Makefile
config.status: creating xstc/Makefile
config.status: creating include/libxml/xmlversion.h
config.status: creating xml2-config
config.status: creating libxml-2.0.pc
config.status: creating libxml-2.0-uninstalled.pc
config.status: creating python/setup.py
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
  CC     SAX.lo
  CC     entities.lo
  CC     encoding.lo
  CC     error.lo
  CC     parserInternals.lo
"/build/hudson/fedc/build/libxml2/src/libxml2/parserInternals.c", line 36: error #2005-D: could not open source file "zlib.h"
  #include <zlib.h>
                   ^

1 error detected in the compilation of "/build/hudson/fedc/build/libxml2/src/libxml2/parserInternals.c".
*** Error exit code 1
Comment 2 Daniel Veillard 2014-10-07 11:03:14 UTC
Okay I think I understand the issue. I changed your patch to not realign
the testing blocks, hence making clear what the changes are (and BTW
patches should be provided as attachments it's way more convenient and
safe than cut an paste:-)

Resulting patch commited to git:

https://git.gnome.org/browse/libxml2/commit/?id=7dc24965092d7cc310908d6052913050e88ec072

 thanks !

Daniel