aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/configure.in7
-rw-r--r--erts/emulator/drivers/common/zlib_drv.c7
2 files changed, 14 insertions, 0 deletions
diff --git a/erts/configure.in b/erts/configure.in
index c5b08547cb..d2a2cca758 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -1354,6 +1354,8 @@ AC_ARG_ENABLE(builtin-zlib,
Z_LIB=
if test "x$enable_builtin_zlib" = "xyes"; then
+ AC_DEFINE(HAVE_ZLIB_INFLATEGETDICTIONARY, 1,
+ [Define if your zlib version defines inflateGetDictionary.])
AC_MSG_NOTICE([Using our own built-in zlib source])
else
AC_MSG_CHECKING(for zlib 1.2.5 or higher)
@@ -1380,6 +1382,11 @@ error
AC_MSG_RESULT(no)
])
LIBS=$zlib_save_LIBS
+
+AC_MSG_CHECKING(for zlib inflateGetDictionary presence)
+AC_SEARCH_LIBS(inflateGetDictionary, [z],
+ AC_DEFINE(HAVE_ZLIB_INFLATEGETDICTIONARY, 1,
+ [Define if your zlib version defines inflateGetDictionary.]))
fi
AC_SUBST(Z_LIB)
diff --git a/erts/emulator/drivers/common/zlib_drv.c b/erts/emulator/drivers/common/zlib_drv.c
index acbe675c41..066cf87c9d 100644
--- a/erts/emulator/drivers/common/zlib_drv.c
+++ b/erts/emulator/drivers/common/zlib_drv.c
@@ -252,6 +252,7 @@ static int zlib_output(ZLibData* d)
return zlib_output_init(d);
}
+#ifdef HAVE_ZLIB_INFLATEGETDICTIONARY
static int zlib_inflate_get_dictionary(ZLibData* d)
{
ErlDrvBinary* dbin = driver_alloc_binary(INFL_DICT_SZ);
@@ -263,6 +264,7 @@ static int zlib_inflate_get_dictionary(ZLibData* d)
driver_free_binary(dbin);
return res;
}
+#endif
static int zlib_inflate(ZLibData* d, int flush)
{
@@ -603,9 +605,14 @@ static ErlDrvSSizeT zlib_ctl(ErlDrvData drv_data, unsigned int command, char *bu
return zlib_return(res, rbuf, rlen);
case INFLATE_GETDICT:
+#ifdef HAVE_ZLIB_INFLATEGETDICTIONARY
if (d->state != ST_INFLATE) goto badarg;
res = zlib_inflate_get_dictionary(d);
return zlib_return(res, rbuf, rlen);
+#else
+ errno = ENOTSUP;
+ return zlib_return(Z_ERRNO, rbuf, rlen);
+#endif
case INFLATE_SYNC:
if (d->state != ST_INFLATE) goto badarg;