Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
refactor zlib's spkg-configure, start on a macro for zlib.pc
Browse files Browse the repository at this point in the history
this is WIP.
  • Loading branch information
dimpase committed Dec 23, 2019
1 parent ad511a1 commit 73d0619
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions build/pkgs/zlib/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
AC_DEFUN([SAGE_ZLIB_GEN_PC],[dnl generate zlib.pc
AX_ABSOLUTE_HEADER([zlib.h])
AS_IF([test x$gl_cv_absolute_zlib_h = x], [
AC_MSG_ERROR(m4_normalize([
failed to find absolute path to zlib.h despite it being reported found
]))
])
AC_SUBST(SAGE_ZLIB_INCLUDE, [`AS_DIRNAME($gl_cv_absolute_zlib_h)`])
dnl now the same for the full path to libz...
dnl ...
])

SAGE_SPKG_CONFIGURE([zlib], [
AC_CHECK_LIB([z], [inflateEnd], [zlib_cv_libz=yes], [zlib_cv_libz=no])
AC_CHECK_HEADER([zlib.h], [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
if test "$zlib_cv_libz" = "yes" && test "$zlib_cv_zlib_h" = "yes"; then
PKG_CHECK_MODULES([LIBPNG], [libpng >= 1.2], [], [
dnl inflateValidate is needed for Sage's libpng, newer than 1.2; this ensures
dnl we have the minimum required for building zlib version
AC_CHECK_LIB([z], [inflateValidate], [], [sage_spkg_install_zlib=yes])
])
else
sage_spkg_install_zlib=yes
fi
PKG_CHECK_MODULES([ZLIBANDLIBPNG], [zlib libpng >= 1.2], [
AC_MSG_NOTICE([Use zlib and libpng from the system, pc files supplied.])
], [
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.9], [
dnl inflateValidate is needed for Sage's libpng, newer than 1.2; this ensures
dnl we have the minimum required for building zlib version
AC_MSG_NOTICE([Use zlib the system, pc file supplied.])
], [dnl no zlib.pc file. try to see if this zlib is still good
AC_CHECK_HEADER([zlib.h], [
AC_CHECK_LIB([z], [inflateEnd], [
PKG_CHECK_MODULES([LIBPNG], [libpng >= 1.2], [
dnl hope we found the zlib of system's libpng
SAGE_ZLIB_GEN_PC
], [
dnl inflateValidate is needed for Sage's libpng (cf. above)
AC_CHECK_LIB([z], [inflateValidate], [
dnl zlib is good enough to build Sage's libpng
SAGE_ZLIB_GEN_PC
], [sage_spkg_install_zlib=yes])
])
], [sage_spkg_install_zlib=yes])
], [sage_spkg_install_zlib=yes])
])
])
])

0 comments on commit 73d0619

Please sign in to comment.