Files
mongo-php-driver/scripts/autotools/libmongoc/CheckCompression.m4
Jeremy Mikola 8dfe6c31ec PHPC-2256: Build configuration improvements (#1483)
* PHPC-2311: Note that with-libbson and with-libmongoc are deprecated

* PHPC-2312: MONGOC_ENABLE_SASL_GSSAPI is obsolete

* PHPC-1218: Use m4_include with base path for including m4 scripts

This removes the custom _include macro, which used sinclude on two different paths in order to support both shared and static builds. Unlike m4_sinclude, m4_include reports an error if the file is not found, so this also addresses the validation that was disabled to support PECL installs.

* PHPC-2300 and PHPC-2302: Fix configure output for bundled libbson/libmongoc versions

This was missed in 7ccb0949ba and 1c533ffa2d.

* PHPC-2225: Validate PHP_ARG_ENABLE and PHP_ARG_WITH configure options

Introduce a PHP_MONGODB_VALIDATE_ARG macro, which is called after processing a configure option.

PHP may still assign "yes" as a value during parsing, so map that to another value when necessary (e.g. selecting a crypto/TLS library).

* Add deprecation notice for --enable-system-ciphers in shared builds

* PHPC-2155: Remove prefixes for quoted shell variable references

* PHPC-1017: Allow configure options to be specified with PECL install

Introducing <configureoption> tags in package.xml means that PECL installs will now prompt for input. Non-interactive installs can still be achieved by either piping input (e.g. `yes '' | pecl install mongodb`) or explicitly specifying configure options (--configureoptions option for pecl install).

* Refer to update-submodule-sources.php in config.m4/w32 and fix macOS compatibility

* PHPC-2314: Require OpenSSL 1.0.1+ for libmongoc 1.24+

* PHPC-2315: Use PKG_CHECK_MODULES for detecting libmongoc system libs

* Remove superfluous AC_MSG_NOTICE output in CheckSSL.m4
2023-11-01 21:41:56 -04:00

145 lines
5.2 KiB
Plaintext

PHP_ARG_WITH([mongodb-snappy],
[whether to enable Snappy for compression],
[AS_HELP_STRING([--with-mongodb-snappy=@<:@auto/yes/no@:>@],
[MongoDB: Enable Snappy for compression [default=auto]])],
[auto],
[no])
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_SNAPPY], [auto yes no])
PHP_ARG_WITH([mongodb-zlib],
[whether to enable zlib for compression],
[AS_HELP_STRING([--with-mongodb-zlib=@<:@auto/system/bundled/no@:>@],
[MongoDB: Enable zlib for compression [default=auto]])],
[auto],
[no])
dnl PHP_ARG_WITH without a value assigns "yes". Treat it like "auto" since we
dnl fall back to bundled zlib if the system library isn't found
if test "$PHP_MONGODB_ZLIB" = "yes"; then
PHP_MONGODB_ZLIB="auto"
fi
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_ZLIB], [auto system bundled no])
PHP_ARG_WITH([mongodb-zstd],
[whether to enable zstd for compression],
[AS_HELP_STRING([--with-mongodb-zstd=@<:@auto/yes/no@:>@],
[MongoDB: Enable zstd for compression [default=auto]])],
[auto],
[no])
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_ZSTD], [auto yes no])
found_snappy="no"
found_zlib="no"
bundled_zlib="no"
found_zstd="no"
AS_IF([test "$PHP_MONGODB_SNAPPY" = "auto" -o "$PHP_MONGODB_SNAPPY" = "yes"],[
PKG_CHECK_MODULES([PHP_MONGODB_SNAPPY],[snappy],[
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_SNAPPY_CFLAGS"
PHP_EVAL_LIBLINE([$PHP_MONGODB_SNAPPY_LIBS],[MONGODB_SHARED_LIBADD])
found_snappy="yes"
],[
PHP_CHECK_LIBRARY([snappy],
[snappy_uncompress],
[have_snappy_lib="yes"],
[have_snappy_lib="no"])
AC_CHECK_HEADER([snappy-c.h],
[have_snappy_headers=yes],
[have_snappy_headers=no])
if test "$have_snappy_lib" = "yes" -a "$have_snappy_headers" = "yes"; then
PHP_ADD_LIBRARY([snappy],,[MONGODB_SHARED_LIBADD])
found_snappy="yes"
fi
])
if test "$PHP_MONGODB_SNAPPY" = "yes" -a "$found_snappy" = "no"; then
AC_MSG_ERROR([Snappy libraries and development headers could not be found])
fi
])
AS_IF([test "$PHP_MONGODB_ZLIB" = "auto" -o "$PHP_MONGODB_ZLIB" = "system"],[
PKG_CHECK_MODULES([PHP_MONGODB_ZLIB],[zlib],[
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_ZLIB_CFLAGS"
PHP_EVAL_LIBLINE([$PHP_MONGODB_ZLIB_LIBS],[MONGODB_SHARED_LIBADD])
found_zlib="yes"
],[
PHP_CHECK_LIBRARY([zlib],
[compress2],
[have_zlib_lib="yes"],
[have_zlib_lib="no"])
AC_CHECK_HEADER([zlib.h],
[have_zlib_headers=yes],
[have_zlib_headers=no])
if test "$have_zlib_lib" = "yes" -a "$have_zlib_headers" = "yes"; then
PHP_ADD_LIBRARY([z],,[MONGODB_SHARED_LIBADD])
found_zlib="yes"
fi
])
if test "$PHP_MONGODB_ZLIB" = "system" -a "$found_zlib" = "no"; then
AC_MSG_ERROR([zlib libraries and development headers could not be found])
fi
])
dnl Use libmongoc's bundled zlib if necessary
AS_IF([test "$found_zlib" = "no" -a \( "$PHP_MONGODB_ZLIB" = "auto" -o "$PHP_MONGODB_ZLIB" = "bundled" \)],[
AC_CHECK_HEADER([unistd.h],[PHP_MONGODB_ZLIB_CFLAGS="$PHP_MONGODB_ZLIB_CFLAGS -DHAVE_UNISTD_H"])
AC_CHECK_HEADER([stdarg.h],[PHP_MONGODB_ZLIB_CFLAGS="$PHP_MONGODB_ZLIB_CFLAGS -DHAVE_STDARG_H"])
bundled_zlib="yes"
])
AS_IF([test "$PHP_MONGODB_ZSTD" = "auto" -o "$PHP_MONGODB_ZSTD" = "yes"],[
PKG_CHECK_MODULES([PHP_MONGODB_ZSTD],[libzstd],[
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_ZSTD_CFLAGS"
PHP_EVAL_LIBLINE([$PHP_MONGODB_ZSTD_LIBS],[MONGODB_SHARED_LIBADD])
found_zstd="yes"
],[
PHP_CHECK_LIBRARY([zstd],
[ZSTD_compress],
[have_zstd_lib="yes"],
[have_zstd_lib="no"])
AC_CHECK_HEADER([zstd.h],
[have_zstd_headers=yes],
[have_zstd_headers=no])
if test "$have_zstd_lib" = "yes" -a "$have_zstd_headers" = "yes"; then
PHP_ADD_LIBRARY([zstd],,[MONGODB_SHARED_LIBADD])
found_zstd="yes"
fi
])
if test "$PHP_MONGODB_ZSTD" = "yes" -a "$found_zstd" = "no"; then
AC_MSG_ERROR([zstd libraries and development headers could not be found])
fi
])
if test "$found_snappy" = "yes" -o "$found_zlib" = "yes" -o "$bundled_zlib" = "yes" -o "$found_zstd" = "yes"; then
AC_SUBST(MONGOC_ENABLE_COMPRESSION, 1)
if test "$found_snappy" = "yes"; then
AC_SUBST(MONGOC_ENABLE_COMPRESSION_SNAPPY, 1)
else
AC_SUBST(MONGOC_ENABLE_COMPRESSION_SNAPPY, 0)
fi
if test "$found_zlib" = "yes" -o "$bundled_zlib" = "yes"; then
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZLIB, 1)
else
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZLIB, 0)
fi
if test "$found_zstd" = "yes"; then
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZSTD, 1)
else
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZSTD, 0)
fi
else
AC_SUBST(MONGOC_ENABLE_COMPRESSION, 0)
AC_SUBST(MONGOC_ENABLE_COMPRESSION_SNAPPY, 0)
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZLIB, 0)
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZSTD, 0)
fi