Hi Norm,

Actually, log2 is not needed. It's cmake that forces it on us.
Look at fast_log.h line 131

#if (defined(_MSC_VER) && _MSC_VER <= 1700) || \
    (defined(__ANDROID_API__) && __ANDROID_API__ < 18)
  /* Visual Studio 2012 and Android API levels < 18 do not have the log2()
   * function defined, so we use log() and a multiplication instead. */
  return log((double)v) * LOG_2_INV;
#else
  return log2((double)v);
#endif

You may define _MSC_VER=1 at the command line when compiling and it should work for you. In CMakeList.txt I just remove the check for log2(), lines 96-113, before using.

Cheers,
G

On 11/27/2016 3:38 AM, NormW wrote:
G/E,
After some head scratching/bashing and research:

Brotli.lib has several places that use log2(), which was not defined in C89 (AFAIK), although the function could be kludged easily enough as it uses C89 functions in its own routine.

Although NetWare was derived using a C89 compiler, its math.h shows signs of its early development, in that a number of MATHs macro's resolve not to values but to LibC functions, which means they can't be used in 'const' assignments... hence const XXXX = INFINITY fails to compile. (It was on the ToDo list it seems but the ship sank before it made the top of the list.) Tweaking math.h while possible, doesn't make for much sense, but mod_brotli does at least compile without issue; well almost.

The only C89 issue (AFAICT) is the following patch, which should allow any other C89 (with a more up to date OS ;-( ) to compile it, which NetWare's CW can do for the likes of Apache2, Lua, Zlib, NGHTTP2, OSSL and a bunch of others.

Index: modules/filters/mod_brotli.c
===================================================================
--- modules/filters/mod_brotli.c    (revision 1771539)
+++ modules/filters/mod_brotli.c    (working copy)
@@ -240,7 +240,7 @@
             output = BrotliEncoderTakeOutput(ctx->state, &output_len);
             ctx->total_out += output_len;

-            b = apr_bucket_transient_create(output, output_len,
+ b = apr_bucket_transient_create((const char *)output, output_len,
ctx->bb->bucket_alloc);
             APR_BRIGADE_INSERT_TAIL(ctx->bb, b);

@@ -289,7 +289,7 @@
         output = BrotliEncoderTakeOutput(ctx->state, &output_len);
         ctx->total_out += output_len;

-        b = apr_bucket_heap_create(output, output_len, NULL,
+ b = apr_bucket_heap_create((const char *)output, output_len, NULL,
ctx->bb->bucket_alloc);
         APR_BRIGADE_INSERT_TAIL(ctx->bb, b);
     }
Norm


Reply via email to