Skip to content

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented May 12, 2020

@jmikola jmikola requested a review from alcaeus May 12, 2020 19:23
found_zstd="yes"
],[
PHP_CHECK_LIBRARY([zstd],
[ZSTD_compress],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was trivial to copy the fallback detection when pkg-config is not available. This API comes from the zstd documentation and you'll find the example closely resembles what we do for snappy above.

One difference is that the pkg-config name is "libzstd", while the shared library itself is simply "zstd".

@@ -59,10 +80,14 @@ if test "$found_snappy" = "yes" -o "$found_zlib" = "yes" -o "$bundled_zlib" = "y
else
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZLIB, 0)
fi
if test "$found_zstd" = "yes"; then
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZSTD, 1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we don't have any build flags for compression (we just link whatever is available) nor do we have Evergreen environments w/ and w/o these libs, I did both detection branches (pkg-config and the fallback) locally.

On Ubuntu, the relevant packages are libzstd-dev and libzstd1. I first ran configure and verified that the pkg-config branch picked up "libzstd" and added -lzstd to our link flags. Relevant configure output is simply:

checking for PHP_MONGODB_ZSTD... yes

I then modified the M4 script to fail the pkg-config check by adding a typo in the "libzstd" package name to verify that the PHP_CHECK_LIBRARY and AC_CHECK_HEADER fallback successfully added the same link flag. The configure output in this case changes to:

checking for PHP_MONGODB_ZSTD... no
checking for ZSTD_compress in -lzstd... yes
checking zstd.h usability... yes
checking zstd.h presence... yes
checking for zstd.h... yes

@jmikola jmikola merged commit 2305e98 into mongodb:v1.8 May 13, 2020
@jmikola jmikola deleted the 1.8-phpc-1313 branch May 13, 2020 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants