Macro: ac_check_mysql_db

Back to the Main Page. | # ac_check_mysql_db | Download the M4 Source.

Synopsis

  `AC_CHECK_MYSQL_DB`

Version

  1.1 (2002/09/12) Installed_Packages @ ac-archive-0.5.39

Author

  Gleen Salmon <gleensalmon@yahoo.com>

Description

  Check if the specified MySQL database exists, if yes set your environment variable to that database name else unset your environment variable

  Example:

  `AC_CHECK_MYSQL_DB(DBNAME, [fishmarket])`
  `if test x$DBNAME = xfishmarket; then`
  `bla..bla..bla..`
  `else`
  `bla..bla..bla..`
  `fi`

M4 Source Code

      AC_DEFUN([AC_CHECK_MYSQL_DB],[
      AC_REQUIRE([AC_PROG_MYSQLSHOW])dnl
      AC_MSG_CHECKING([for MySQL db $2])
      if $MYSQLSHOW -u root -prootpass $2 > /dev/null 2>&1; then
              $1=$2
              AC_MSG_RESULT([yes])
      else
              unset $1
              AC_MSG_RESULT([no])
      fi;dnl
      ])