zlib.m4 1.0 KB

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