xref: /PHP-8.4/ext/zip/config.m4 (revision ca57d763)
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    [AC_DEFINE([HAVE_SET_MTIME], [1],
14      [Define to 1 if libzip library has the 'zip_file_set_mtime' function
15      (available since 1.0.0).])],
16    [AC_MSG_WARN([Libzip >= 1.0.0 needed for setting mtime])],
17    [$LIBZIP_LIBS])
18
19  PHP_CHECK_LIBRARY([zip], [zip_file_set_encryption],
20    [AC_DEFINE([HAVE_ENCRYPTION], [1],
21      [Define to 1 if libzip library has encryption support (available since
22      1.2.0).])],
23    [AC_MSG_WARN([Libzip >= 1.2.0 needed for encryption support])],
24    [$LIBZIP_LIBS])
25
26  PHP_CHECK_LIBRARY([zip], [zip_libzip_version],
27    [AC_DEFINE([HAVE_LIBZIP_VERSION], [1],
28      [Define to 1 if libzip library has the 'zip_libzip_version' function
29      (available since 1.3.1).])],
30    [],
31    [$LIBZIP_LIBS])
32
33  PHP_CHECK_LIBRARY([zip], [zip_register_progress_callback_with_state],
34    [AC_DEFINE([HAVE_PROGRESS_CALLBACK], [1],
35      [Define to 1 if libzip library has the
36      'zip_register_progress_callback_with_state' function (available since
37      1.3.0).])],
38    [],
39    [$LIBZIP_LIBS])
40
41  PHP_CHECK_LIBRARY([zip], [zip_register_cancel_callback_with_state],
42    [AC_DEFINE([HAVE_CANCEL_CALLBACK], [1],
43      [Define to 1 if libzip library has the
44      'zip_register_cancel_callback_with_state' function (available since
45      1.6.0).])],
46    [],
47    [$LIBZIP_LIBS])
48
49  PHP_CHECK_LIBRARY([zip], [zip_compression_method_supported],
50    [AC_DEFINE([HAVE_METHOD_SUPPORTED], [1],
51      [Define to 1 if libzip library has 'zip_*_method_supported' functions
52      (available since 1.7.0).])],
53    [],
54    [$LIBZIP_LIBS])
55
56  AC_DEFINE([HAVE_ZIP], [1],
57    [Define to 1 if the PHP extension 'zip' is available.])
58
59  PHP_NEW_EXTENSION([zip], [php_zip.c zip_stream.c], [$ext_shared])
60  PHP_ADD_EXTENSION_DEP(zip, pcre)
61
62  PHP_SUBST([ZIP_SHARED_LIBADD])
63fi
64