summaryrefslogtreecommitdiffhomepage
path: root/auto/compression
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2024-11-20 16:47:06 +0000
committerAndrew Clayton <a.clayton@nginx.com>2025-04-14 18:11:53 +0100
commitc9b2ecd28407538d3ef0b48bba944440695196ed (patch)
tree4138739ecd81a804b736d68c820b338e621f3218 /auto/compression
parent804ca81fd958cd29bd52296063224fc73d40c42f (diff)
downloadunit-c9b2ecd28407538d3ef0b48bba944440695196ed.tar.gz
unit-c9b2ecd28407538d3ef0b48bba944440695196ed.tar.bz2
http: Wire up HTTP compression to the build system
This allows to actually build unit with support for zlib, zstd and brotli compression. Any or all can be specified. E.g. $ ./configure --zlib ... $ ./configure --zlib --zstd --brotli ... During configure you will see if support for the requested compressions has been found and what version of the library is being used. E.g. ... checking for zlib ... found + zlib version: 1.3.1.zlib-ng checking for zstd ... found + zstd version: 1.5.6 checking for brotli ... found + brotli version: 1.1.0 ... Unit configuration summary: ... zlib support: .............. YES zstd support: .............. YES brotli support: ............ YES ... Co-authored-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'auto/compression')
-rw-r--r--auto/compression96
1 files changed, 96 insertions, 0 deletions
diff --git a/auto/compression b/auto/compression
new file mode 100644
index 00000000..684242f2
--- /dev/null
+++ b/auto/compression
@@ -0,0 +1,96 @@
+
+# Copyright (C) Alejandro Colomar
+# Copyright (C) Andrew Clayton
+# Copyright (C) NGINX, Inc.
+
+
+NXT_HAVE_ZLIB=no
+NXT_ZLIB_CFLAGS=
+NXT_ZLIB_LIBS=
+
+NXT_HAVE_ZSTD=no
+NXT_ZSTD_CFLAGS=
+NXT_ZSTD_LIBS=
+
+NXT_HAVE_BROTLI=no
+NXT_BROTLI_CFLAGS=
+NXT_BROTLI_LIBS=
+
+
+if [ $NXT_ZLIB = YES ]; then
+ NXT_ZLIB_CFLAGS="$(pkgconf --cflags-only-I zlib 2>/dev/null || echo "")"
+ NXT_ZLIB_LIBS="$(pkgconf --libs zlib 2>/dev/null || echo "-lz")"
+
+ nxt_feature="zlib"
+ nxt_feature_name=NXT_HAVE_ZLIB
+ nxt_feature_run=no
+ nxt_feature_incs=$NXT_ZLIB_CFLAGS
+ nxt_feature_libs=$NXT_ZLIB_LIBS
+ nxt_feature_test="#include <stdio.h>
+
+ #include <zlib.h>
+
+ int main(void) {
+ puts(zlibVersion());
+ return 0;
+ }"
+ . auto/feature
+
+ if [ $nxt_found = yes ]; then
+ NXT_HAVE_ZLIB=YES
+ echo " + zlib version: $(pkgconf --modversion zlib)"
+ fi
+fi
+
+
+if [ $NXT_ZSTD = YES ]; then
+ NXT_ZSTD_CFLAGS="$(pkgconf --cflags-only-I libzstd 2>/dev/null || echo "")"
+ NXT_ZSTD_LIBS="$(pkgconf --libs libzstd 2>/dev/null || echo "-lzstd")"
+
+ nxt_feature="zstd"
+ nxt_feature_name=NXT_HAVE_ZSTD
+ nxt_feature_run=no
+ nxt_feature_incs=$NXT_ZSTD_CFLAGS
+ nxt_feature_libs=$NXT_ZSTD_LIBS
+ nxt_feature_test="#include <stdio.h>
+
+ #include <zstd.h>
+
+ int main(void) {
+ printf(\"zstd version: %u\n\", ZSTD_versionNumber());
+ return 0;
+ }"
+ . auto/feature
+
+ if [ $nxt_found = yes ]; then
+ NXT_HAVE_ZSTD=YES
+ echo " + zstd version: $(pkgconf --modversion libzstd)"
+ fi
+fi
+
+
+if [ $NXT_BROTLI = YES ]; then
+ NXT_BROTLI_CFLAGS="$(pkgconf --cflags-only-I libbrotlienc 2>/dev/null || echo "")"
+ NXT_BROTLI_LIBS="$(pkgconf --libs libbrotlienc 2>/dev/null || echo "-lbrotlienc")"
+
+ nxt_feature="brotli"
+ nxt_feature_name=NXT_HAVE_BROTLI
+ nxt_feature_run=no
+ nxt_feature_incs=$NXT_BROTLI_CFLAGS
+ nxt_feature_libs=$NXT_BROTLI_LIBS
+ nxt_feature_test="#include <stdio.h>
+
+ #include <brotli/encode.h>
+
+ int main(void) {
+ printf(\"brotli version: %d\n\",
+ BrotliEncoderVersion());
+ return 0;
+ }"
+ . auto/feature
+
+ if [ $nxt_found = yes ]; then
+ NXT_HAVE_BROTLI=YES
+ echo " + brotli version: $(pkgconf --modversion libbrotlienc)"
+ fi
+fi