You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
4.2 KiB

  1. dnl Define zlib paths to point at bundled zlib
  2. AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [
  3. ZLIB_INCLUDES="-I\$(top_srcdir)/zlib"
  4. ZLIB_LIBS="\$(top_builddir)/zlib/libz.la"
  5. dnl Omit -L$pkglibdir as it's always in the list of mysql_config deps.
  6. ZLIB_DEPS="-lz"
  7. zlib_dir="zlib"
  8. AC_SUBST([zlib_dir])
  9. mysql_cv_compress="yes"
  10. ])
  11. dnl Auxiliary macro to check for zlib at given path
  12. AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
  13. save_CPPFLAGS="$CPPFLAGS"
  14. save_LIBS="$LIBS"
  15. CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS"
  16. LIBS="$LIBS $ZLIB_LIBS"
  17. AC_CACHE_VAL([mysql_cv_compress],
  18. [AC_TRY_LINK([#include <zlib.h>],
  19. [return zlibCompileFlags();],
  20. [mysql_cv_compress="yes"
  21. AC_MSG_RESULT([ok])],
  22. [mysql_cv_compress="no"])
  23. ])
  24. CPPFLAGS="$save_CPPFLAGS"
  25. LIBS="$save_LIBS"
  26. ])
  27. dnl MYSQL_CHECK_ZLIB_WITH_COMPRESS
  28. dnl ------------------------------------------------------------------------
  29. dnl @synopsis MYSQL_CHECK_ZLIB_WITH_COMPRESS
  30. dnl
  31. dnl Provides the following configure options:
  32. dnl --with-zlib-dir=DIR
  33. dnl Possible DIR values are:
  34. dnl - "no" - the macro will disable use of compression functions
  35. dnl - "bundled" - means use zlib bundled along with MySQL sources
  36. dnl - empty, or not specified - the macro will try default system
  37. dnl library (if present), and in case of error will fall back to
  38. dnl bundled zlib
  39. dnl - zlib location prefix - given location prefix, the macro expects
  40. dnl to find the library headers in $prefix/include, and binaries in
  41. dnl $prefix/lib. If zlib headers or binaries weren't found at $prefix, the
  42. dnl macro bails out with error.
  43. dnl
  44. dnl If the library was found, this function #defines HAVE_COMPRESS
  45. dnl and configure variables ZLIB_INCLUDES (i.e. -I/path/to/zlib/include),
  46. dnl ZLIB_LIBS (i. e. -L/path/to/zlib/lib -lz) and ZLIB_DEPS which is
  47. dnl used in mysql_config and is always the same as ZLIB_LIBS except to
  48. dnl when we use the bundled zlib. In the latter case ZLIB_LIBS points to the
  49. dnl build dir ($top_builddir/zlib), while mysql_config must point to the
  50. dnl installation dir ($pkglibdir), so ZLIB_DEPS is set to point to
  51. dnl $pkglibdir.
  52. AC_DEFUN([MYSQL_CHECK_ZLIB_WITH_COMPRESS], [
  53. AC_MSG_CHECKING([for zlib compression library])
  54. case $SYSTEM_TYPE in
  55. *netware* | *modesto*)
  56. AC_MSG_RESULT(ok)
  57. AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
  58. ;;
  59. *)
  60. AC_ARG_WITH([zlib-dir],
  61. AC_HELP_STRING([--with-zlib-dir=DIR],
  62. [Provide MySQL with a custom location of
  63. compression library. Given DIR, zlib binary is
  64. assumed to be in $DIR/lib and header files
  65. in $DIR/include.]),
  66. [mysql_zlib_dir=${withval}],
  67. [mysql_zlib_dir=""])
  68. case "$mysql_zlib_dir" in
  69. "no")
  70. mysql_cv_compress="no"
  71. AC_MSG_RESULT([disabled])
  72. ;;
  73. "bundled")
  74. MYSQL_USE_BUNDLED_ZLIB
  75. AC_MSG_RESULT([using bundled zlib])
  76. ;;
  77. "")
  78. ZLIB_INCLUDES=""
  79. ZLIB_LIBS="-lz"
  80. MYSQL_CHECK_ZLIB_DIR
  81. if test "$mysql_cv_compress" = "no"; then
  82. MYSQL_USE_BUNDLED_ZLIB
  83. AC_MSG_RESULT([system-wide zlib not found, using one bundled with MySQL])
  84. fi
  85. ;;
  86. *)
  87. # Test for libz using all known library file endings
  88. if test \( -f "$mysql_zlib_dir/lib/libz.a" -o \
  89. -f "$mysql_zlib_dir/lib/libz.so" -o \
  90. -f "$mysql_zlib_dir/lib/libz.sl" -o \
  91. -f "$mysql_zlib_dir/lib/libz.dylib" \) \
  92. -a -f "$mysql_zlib_dir/include/zlib.h"; then
  93. ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
  94. ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
  95. MYSQL_CHECK_ZLIB_DIR
  96. fi
  97. if test "x$mysql_cv_compress" != "xyes"; then
  98. AC_MSG_ERROR([headers or binaries were not found in $mysql_zlib_dir/{include,lib}])
  99. fi
  100. ;;
  101. esac
  102. if test "$mysql_cv_compress" = "yes"; then
  103. if test "x$ZLIB_DEPS" = "x"; then
  104. ZLIB_DEPS="$ZLIB_LIBS"
  105. fi
  106. AC_SUBST([ZLIB_LIBS])
  107. AC_SUBST([ZLIB_DEPS])
  108. AC_SUBST([ZLIB_INCLUDES])
  109. AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
  110. fi
  111. ;;
  112. esac
  113. ])
  114. dnl ------------------------------------------------------------------------