Collection of DPF-based plugins for packaging
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.

71 lines
2.9KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_prog_mysql.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PROG_MYSQL
  8. #
  9. # DESCRIPTION
  10. #
  11. # Check for the program 'mysql' let script continue if exists & works pops
  12. # up error message if not.
  13. #
  14. # Testing of functionality is by invoking it with root password 'rootpass'
  15. # and a 'SELECT * FROM user' SQL statement. That SQL statement will select
  16. # all user information from the 'user' privileges table, and should work
  17. # on every proper MySQL server.
  18. #
  19. # Besides checking mysql, this macro also set these environment variables
  20. # upon completion:
  21. #
  22. # MYSQL = which mysql
  23. #
  24. # LICENSE
  25. #
  26. # Copyright (c) 2008 Gleen Salmon <gleensalmon@yahoo.com>
  27. #
  28. # This program is free software; you can redistribute it and/or modify it
  29. # under the terms of the GNU General Public License as published by the
  30. # Free Software Foundation; either version 2 of the License, or (at your
  31. # option) any later version.
  32. #
  33. # This program is distributed in the hope that it will be useful, but
  34. # WITHOUT ANY WARRANTY; without even the implied warranty of
  35. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  36. # Public License for more details.
  37. #
  38. # You should have received a copy of the GNU General Public License along
  39. # with this program. If not, see <https://www.gnu.org/licenses/>.
  40. #
  41. # As a special exception, the respective Autoconf Macro's copyright owner
  42. # gives unlimited permission to copy, distribute and modify the configure
  43. # scripts that are the output of Autoconf when processing the Macro. You
  44. # need not follow the terms of the GNU General Public License when using
  45. # or distributing such scripts, even though portions of the text of the
  46. # Macro appear in them. The GNU General Public License (GPL) does govern
  47. # all other use of the material that constitutes the Autoconf Macro.
  48. #
  49. # This special exception to the GPL applies to versions of the Autoconf
  50. # Macro released by the Autoconf Archive. When you make and distribute a
  51. # modified version of the Autoconf Macro, you may extend this special
  52. # exception to the GPL to apply to your modified version as well.
  53. #serial 6
  54. AU_ALIAS([AC_PROG_MYSQL], [AX_PROG_MYSQL])
  55. AC_DEFUN([AX_PROG_MYSQL],[
  56. AC_REQUIRE([AC_EXEEXT])dnl
  57. AC_PATH_PROG(MYSQL, mysql$EXEEXT, nocommand)
  58. if test "$MYSQL" = nocommand; then
  59. AC_MSG_ERROR([mysql not found in $PATH])
  60. fi
  61. AC_MSG_CHECKING([if mysql works])
  62. if echo 'SELECT * FROM user' | $MYSQL -u root -prootpass mysql > /dev/null; then
  63. AC_MSG_RESULT([yes])
  64. else
  65. AC_MSG_NOTICE([Before installation, set MySQL root password to rootpass; restore your root password afterwards.])
  66. AC_MSG_ERROR([mysql cannot execute SELECT with root password = rootpass])
  67. fi;dnl
  68. ])