xref: /php-src/ext/zip/config.m4 (revision c180e9b4)
1PHP_ARG_WITH([zip],
2  [for zip archive read/write support],
3  [AS_HELP_STRING([--with-zip],
4    [Include Zip read/write support])])
5
6if test "$PHP_ZIP" != "no"; then
7  PKG_CHECK_MODULES([LIBZIP], [libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0])
8
9  PHP_EVAL_INCLINE($LIBZIP_CFLAGS)
10  PHP_EVAL_LIBLINE($LIBZIP_LIBS, ZIP_SHARED_LIBADD)
11
12  PHP_CHECK_LIBRARY(zip, zip_file_set_mtime,
13  [
14    AC_DEFINE(HAVE_SET_MTIME, 1, [Libzip >= 1.0.0 with zip_file_set_mtime])
15  ], [
16    AC_MSG_WARN(Libzip >= 1.0.0 needed for setting mtime)
17  ], [
18    $LIBZIP_LIBS
19  ])
20
21  PHP_CHECK_LIBRARY(zip, zip_file_set_encryption,
22  [
23    AC_DEFINE(HAVE_ENCRYPTION, 1, [Libzip >= 1.2.0 with encryption support])
24  ], [
25    AC_MSG_WARN(Libzip >= 1.2.0 needed for encryption support)
26  ], [
27    $LIBZIP_LIBS
28  ])
29
30  PHP_CHECK_LIBRARY(zip, zip_libzip_version,
31  [
32    AC_DEFINE(HAVE_LIBZIP_VERSION, 1, [Libzip >= 1.3.1 with zip_libzip_version function])
33  ], [
34  ], [
35    $LIBZIP_LIBS
36  ])
37
38  PHP_CHECK_LIBRARY(zip, zip_register_progress_callback_with_state,
39  [
40    AC_DEFINE(HAVE_PROGRESS_CALLBACK, 1, [Libzip >= 1.3.0 with zip_register_progress_callback_with_state function])
41  ], [
42  ], [
43    $LIBZIP_LIBS
44  ])
45
46  PHP_CHECK_LIBRARY(zip, zip_register_cancel_callback_with_state,
47  [
48    AC_DEFINE(HAVE_CANCEL_CALLBACK, 1, [Libzip >= 1.6.0 with zip_register_cancel_callback_with_state function])
49  ], [
50  ], [
51    $LIBZIP_LIBS
52  ])
53
54  PHP_CHECK_LIBRARY(zip, zip_compression_method_supported,
55  [
56    AC_DEFINE(HAVE_METHOD_SUPPORTED, 1, [Libzip >= 1.7.0 with zip_*_method_supported functions])
57  ], [
58  ], [
59    $LIBZIP_LIBS
60  ])
61
62  AC_DEFINE(HAVE_ZIP,1,[ ])
63
64  PHP_ZIP_SOURCES="php_zip.c zip_stream.c"
65  PHP_NEW_EXTENSION(zip, $PHP_ZIP_SOURCES, $ext_shared)
66
67  PHP_SUBST(ZIP_SHARED_LIBADD)
68fi
69