Brotli: fix build after recent changes in libbrotli. Headers are now in <brotli/...> and not <brotli/enc/...>. Change-Id: Id1d70792df5b21b3c5ba6d66eb942eece725df7c Signed-off-by: Piotr Sikora <piotrsikora@google.com> Reviewed-on: https://nginx-review.googlesource.com/2481 Reviewed-by: Lizan Zhou <zlizan@google.com>
diff --git a/config b/config index 2425833..8b240c5 100644 --- a/config +++ b/config
@@ -57,9 +57,11 @@ # filter module (depends on Brotli library) # +# <brotli/encode.h> + ngx_feature_name= ngx_feature_run=no -ngx_feature_incs="#include <brotli/enc/encode.h>" +ngx_feature_incs="#include <brotli/encode.h>" ngx_feature_test="BrotliEncoderCreateInstance(NULL, NULL, NULL)" # auto-discovery @@ -104,6 +106,57 @@ . auto/feature fi +# <brotli/enc/encode.h> + +if [ $ngx_found = no ]; then + ngx_feature_name=NGX_HAVE_BROTLI_ENC_ENCODE_H + ngx_feature_run=no + ngx_feature_incs="#include <brotli/enc/encode.h>" + ngx_feature_test="BrotliEncoderCreateInstance(NULL, NULL, NULL)" + + # auto-discovery + ngx_feature="Brotli library" + ngx_feature_path= + ngx_feature_libs="-lbrotlienc -lm" + . auto/feature +fi + +if [ $ngx_found = no ]; then + # FreeBSD, OpenBSD + ngx_feature="Brotli library in /usr/local/" + ngx_feature_path="/usr/local/include" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lbrotlienc -lm" + else + ngx_feature_libs="-L/usr/local/lib -lbrotlienc -lm" + fi + . auto/feature +fi + +if [ $ngx_found = no ]; then + # NetBSD + ngx_feature="Brotli library in /usr/pkg/" + ngx_feature_path="/usr/pkg/include" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lbrotlienc -lm" + else + ngx_feature_libs="-L/usr/pkg/lib -lbrotlienc -lm" + fi + . auto/feature +fi + +if [ $ngx_found = no ]; then + # MacPorts + ngx_feature="Brotli library in /opt/local/" + ngx_feature_path="/opt/local/include" + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lbrotlienc -lm" + else + ngx_feature_libs="-L/opt/local/lib -lbrotlienc -lm" + fi + . auto/feature +fi + if [ $ngx_found = no ]; then echo "$0: error: ngx_brotli filter module requires Brotli library." exit 1
diff --git a/src/ngx_http_brotli_filter_module.c b/src/ngx_http_brotli_filter_module.c index af7f322..bfa18ed 100644 --- a/src/ngx_http_brotli_filter_module.c +++ b/src/ngx_http_brotli_filter_module.c
@@ -10,10 +10,10 @@ #include <ngx_core.h> #include <ngx_http.h> -#if (NGX_BAZEL) -#include <brotli/encode.h> -#else +#if (NGX_HAVE_BROTLI_ENC_ENCODE_H) #include <brotli/enc/encode.h> +#else +#include <brotli/encode.h> #endif