Переглянути джерело

update config.m4 check zlib

viest 6 роки тому
батько
коміт
72a1b19a98
2 змінених файлів з 29 додано та 2 видалено
  1. 28 1
      config.m4
  2. 1 1
      library/src/packager.c

+ 28 - 1
config.m4

@@ -1,7 +1,33 @@
 PHP_ARG_WITH(xlsxwriter, xlswriter support,
 [  --with-xlswriter           Include xlswriter support])
 
-if test "$PHP_XLSWRITER" != "no"; then
+PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined,
+[  --with-zlib-dir=<DIR>   Define the location of zlib install directory], no, no)
+
+if test "$PHP_XLSWRITER" != "no" || $PHP_ZLIB_DIR != "no"; then
+
+    for i in /usr/local /usr $PHP_ZLIB_DIR; do
+        if test -f $i/include/zlib/zlib.h; then
+            ZLIB_DIR=$i
+            ZLIB_INCDIR=$i/include/zlib
+        elif test -f $i/include/zlib.h; then
+            ZLIB_DIR=$i
+            ZLIB_INCDIR=$i/include
+        fi
+    done
+
+    if test -z "$ZLIB_DIR"; then
+        AC_MSG_ERROR(Cannot find zlib)
+    fi
+
+    AC_MSG_CHECKING([for zlib version >= 1.2.8])
+
+    ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_INCDIR/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
+
+    if test `echo $ZLIB_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*1000000 + $2*10000 + $3*100}'` -lt 1020800; then
+        AC_MSG_ERROR([zlib version greater or equal to 1.2.8 required])
+    fi
+
     xls_writer_sources="
     library/third_party/minizip/ioapi.c \
     library/third_party/minizip/mztools.c \
@@ -41,6 +67,7 @@ if test "$PHP_XLSWRITER" != "no"; then
     fi
 
     PHP_ADD_INCLUDE($XLSWRITER_DIR/include)
+    PHP_ADD_INCLUDE($ZLIB_INCDIR)
 
     PHP_NEW_EXTENSION(xlswriter, $xls_writer_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
 

+ 1 - 1
library/src/packager.c

@@ -41,7 +41,7 @@ STATIC lxw_error _add_file_to_zip(lxw_packager *self, FILE * file,
 #ifdef USE_SYSTEM_MINIZIP
 #include "minizip/iowin32.h"
 #else
-#include "../third_party/minizip/iowin32.h"
+#include "iowin32.h"
 #endif
 
 zipFile