]> git.meshlink.io Git - meshlink/blob - m4/zlib.m4
Including system.h to define uint16_t
[meshlink] / m4 / zlib.m4
1 dnl Check to find the zlib headers/libraries
2
3 AC_DEFUN([MeshLink_ZLIB],
4 [
5   AC_ARG_ENABLE([zlib],
6     AS_HELP_STRING([--disable-zlib], [disable zlib compression support]))
7   AS_IF([test "x$enable_zlib" != "xno"], [
8   AC_DEFINE(HAVE_ZLIB, 1, [have zlib compression support])
9     AC_ARG_WITH(zlib,
10       AS_HELP_STRING([--with-zlib=DIR], [zlib base directory, or:]),
11       [zlib="$withval"
12        CPPFLAGS="$CPPFLAGS -I$withval/include"
13        LDFLAGS="$LDFLAGS -L$withval/lib"]
14     )
15
16     AC_ARG_WITH(zlib-include,
17       AS_HELP_STRING([--with-zlib-include=DIR], [zlib headers directory]),
18       [zlib_include="$withval"
19        CPPFLAGS="$CPPFLAGS -I$withval"]
20     )
21
22     AC_ARG_WITH(zlib-lib,
23       AS_HELP_STRING([--with-zlib-lib=DIR], [zlib library directory]),
24       [zlib_lib="$withval"
25        LDFLAGS="$LDFLAGS -L$withval"]
26     )
27
28     AC_CHECK_HEADERS(zlib.h,
29       [],
30       [AC_MSG_ERROR("zlib header files not found."); break]
31     )
32
33     AC_CHECK_LIB(z, compress2,
34       [LIBS="$LIBS -lz"],
35       [AC_MSG_ERROR("zlib libraries not found.")]
36     )
37   ])
38 ])