Skip to content

PHPC-2236: Allow compression libraries to be configured at build time #1438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Jun 21, 2023

https://jira.mongodb.org/browse/PHPC-2236

This introduces several configure options:

  --with-mongodb-snappy=[auto/yes/no]
  --with-mongodb-zlib=[auto/yes/system/bundled/no]
  --with-mongodb-zstd=[auto/yes/no]

The "auto", "yes", and "no" options behave like existing options: "auto" attempts to use a library but allows it to not be found; "yes" requires a library and errors if it's not found; "no" disables a library.

The "system" and "bundled" options for zlib function like "yes", but for using the system library or bundled zlib sources in libmongoc, respectively. Since bundled sources are always available, configuring zlib with "auto", "yes", or "bundled" should never fail.

@jmikola jmikola requested a review from alcaeus June 21, 2023 06:17
fi
])

if test "$PHP_MONGODB_SNAPPY" = "yes" -a "$found_snappy" = "no"; then
Copy link
Member Author

Choose a reason for hiding this comment

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

I have system libraries for all three compression libraries. Rather than remove them, I tested this by flipping this (and related conditionals) to "$found_snappy" = "yes" and checking for an error when the system library was picked up.

I also tested "system" and "bundled" interactions for zlib.

When system libraries are found, you'll see the following configure output:

checking for PHP_MONGODB_SNAPPY... yes
checking for PHP_MONGODB_ZLIB... yes
checking for PHP_MONGODB_ZSTD... yes

...

MONGODB_SHARED_LIBADD                            : -lsnappy -lz -lzstd

Using bundled zlib doesn't result in any configure output, so to test that you'll want to check the definitions in the generated mongoc-config.h output file (e.g. MONGOC_ENABLE_COMPRESSION_X).

Compiling the driver and checking phpinfo() output also works.

This introduces several configure options:

  --with-mongodb-snappy=[auto/yes/no]
  --with-mongodb-zlib=[auto/yes/system/bundled/no]
  --with-mongodb-zstd=[auto/yes/no]

The "auto", "yes", and "no" options behave like existing options: "auto" attempts to use a library but allows it to not be found; "yes" requires a library and errors if it's not found; "no" disables a library.

The "system" and "bundled" options for zlib function like "yes", but for using the system library or bundled zlib sources in libmongoc, respectively. Since bundled sources are always available, configuring zlib with "auto", "yes", or "bundled" should never fail.
Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

LGTM. Seeing these new configure options made me think that we may want to mention those in the documentation. There are no other configure options mentioned there right now, so I defer to you whether we want to have these options documented.

@alcaeus alcaeus merged commit c4d1951 into mongodb:master Jun 22, 2023
@jmikola jmikola deleted the phpc-2236 branch June 22, 2023 16:40
@jmikola
Copy link
Member Author

jmikola commented Jun 22, 2023

There are no other configure options mentioned there right now, so I defer to you whether we want to have these options documented.

Made a note of that in PHPC-1017.

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