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.

125 lines
5.1 KiB

  1. # patch by Kris Karas fom
  2. # https://bz.apache.org/bugzilla/attachment.cgi?id=35326&action=diff
  3. --- a/build/dbd.m4
  4. +++ b/build/dbd.m4
  5. @@ -163,10 +163,15 @@ AC_DEFUN([APU_CHECK_DBD_MYSQL], [
  6. old_cppflags="$CPPFLAGS"
  7. old_ldflags="$LDFLAGS"
  8. + my_library="mysqlclient"
  9. +
  10. AC_ARG_WITH([mysql], APR_HELP_STRING([--with-mysql=DIR], [enable MySQL DBD driver]),
  11. [
  12. if test "$withval" = "yes"; then
  13. AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
  14. + if test "x$MYSQL_CONFIG" = "x"; then
  15. + AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config])
  16. + fi
  17. if test "x$MYSQL_CONFIG" != 'x'; then
  18. mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
  19. mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
  20. @@ -174,32 +179,40 @@ AC_DEFUN([APU_CHECK_DBD_MYSQL], [
  21. APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
  22. APR_ADDTO(LIBS, [$mysql_LIBS])
  23. +
  24. + if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
  25. + my_library="mariadb"
  26. + fi
  27. fi
  28. - AC_CHECK_HEADERS([mysql.h my_global.h my_sys.h],
  29. - AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
  30. - [apu_have_mysql=0; break],
  31. - [#include <my_global.h>])
  32. - if test "$apu_have_mysql" = "0"; then
  33. - AC_CHECK_HEADERS([mysql/mysql.h mysql/my_global.h mysql/my_sys.h],
  34. - AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
  35. - [apu_have_mysql=0; break],
  36. - [#include <mysql/my_global.h>])
  37. + AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
  38. + if test "$apr_have_mysql" = "0"; then
  39. + AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
  40. fi
  41. - if test "$apu_have_mysql" != "0" && test "x$MYSQL_CONFIG" != 'x'; then
  42. - APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
  43. + if test "$apr_have_mysql" = "1"; then
  44. + AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
  45. + AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
  46. + fi
  47. + if test "$apu_have_mysql" = "1" && test "x$MYSQL_CONFIG" != 'x'; then
  48. + APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
  49. fi
  50. elif test "$withval" = "no"; then
  51. :
  52. else
  53. AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
  54. + if test "x$MYSQL_CONFIG" = "x"; then
  55. + AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config],,[$withval/bin])
  56. + fi
  57. if test "x$MYSQL_CONFIG" != 'x'; then
  58. - mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
  59. - mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
  60. - mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
  61. + mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
  62. + mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
  63. + mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
  64. + if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
  65. + my_library="mariadb"
  66. + fi
  67. else
  68. - mysql_CPPFLAGS="-I$withval/include"
  69. - mysql_LDFLAGS="-L$withval/lib "
  70. + mysql_CPPFLAGS="-I$withval/include"
  71. + mysql_LDFLAGS="-L$withval/lib "
  72. fi
  73. APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
  74. @@ -207,18 +220,15 @@ AC_DEFUN([APU_CHECK_DBD_MYSQL], [
  75. APR_ADDTO(LIBS, [$mysql_LIBS])
  76. AC_MSG_NOTICE(checking for mysql in $withval)
  77. - AC_CHECK_HEADERS([mysql.h my_global.h my_sys.h],
  78. - AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
  79. - [apu_have_mysql=0; break],
  80. - [#include <my_global.h>])
  81. -
  82. - if test "$apu_have_mysql" != "1"; then
  83. - AC_CHECK_HEADERS([mysql/mysql.h mysql/my_global.h mysql/my_sys.h],
  84. - AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
  85. - [apu_have_mysql=0; break],
  86. - [#include <mysql/my_global.h>])
  87. + AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
  88. + if test "$apr_have_mysql" = "0"; then
  89. + AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
  90. + fi
  91. + if test "$apr_have_mysql" = "1"; then
  92. + AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
  93. + AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
  94. fi
  95. - if test "$apu_have_mysql" != "0"; then
  96. + if test "$apu_have_mysql" = "1"; then
  97. APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
  98. fi
  99. fi
  100. @@ -229,7 +239,7 @@ AC_DEFUN([APU_CHECK_DBD_MYSQL], [
  101. dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
  102. dnl we know the library is there.
  103. if test "$apu_have_mysql" = "1"; then
  104. - APR_ADDTO(LDADD_dbd_mysql, [$mysql_LDFLAGS -lmysqlclient $mysql_LIBS])
  105. + APR_ADDTO(LDADD_dbd_mysql, [$mysql_LDFLAGS -l$my_library $mysql_LIBS])
  106. fi
  107. AC_SUBST(LDADD_dbd_mysql)
  108. --- a/dbd/apr_dbd_mysql.c
  109. +++ b/dbd/apr_dbd_mysql.c
  110. @@ -1262,7 +1262,9 @@ static apr_status_t thread_end(void *dat
  111. static void dbd_mysql_init(apr_pool_t *pool)
  112. {
  113. +#if MYSQL_VERSION_ID < 100000
  114. my_init();
  115. +#endif
  116. mysql_thread_init();
  117. /* FIXME: this is a guess; find out what it really does */