2 dnl Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program; if not, write to the Free Software
15 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 AC_DEFUN([GNASH_PATH_MYSQL],
20 dnl Lool for the header
21 AC_ARG_WITH(mysql-incl, AC_HELP_STRING([--with-mysql-incl], [directory where mysql headers are]), with_mysql_incl=${withval})
22 AC_CACHE_VAL(ac_cv_path_mysql_incl,[
23 if test x"${with_mysql_incl}" != x ; then
24 if test -f ${with_mysql_incl}/mysql.h ; then
25 ac_cv_path_mysql_incl="-I`(cd ${with_mysql_incl}; pwd)`"
27 AC_MSG_ERROR([${with_mysql_incl} directory doesn't contain any headers])
32 if test x"${ac_cv_path_mysql_incl}" = x; then
33 AC_CHECK_PROG(mconfig, mysql_config, mysql_config)
35 if test x"${ac_cv_prog_mconfig}" = "x" ; then
36 AC_CHECK_PROG(mconfig, mysql-config, mysql-config)
39 if test x"${ac_cv_prog_mconfig}" != "x" ; then
40 ac_cv_path_mysql_incl=`${mconfig} --include`
43 AC_MSG_CHECKING([for MySQL headers])
44 if test x"${ac_cv_path_mysql_incl}" = x ; then
45 AC_MSG_CHECKING([for mysql header])
46 for i in $incllist; do
47 if test -f $i/mysql/mysql.h; then
48 ac_cv_path_mysql_incl="-I$i/mysql"
54 if test x"${ac_cv_path_mysql_incl}" != x ; then
55 MYSQL_CFLAGS="${ac_cv_path_mysql_incl}"
62 dnl Look for the library
63 AC_ARG_WITH(mysql-lib, AC_HELP_STRING([--with-mysql-lib], [directory where mysql libraries are]), with_mysql_lib=${withval})
64 AC_CACHE_VAL(ac_cv_path_mysql_lib,[
65 if test x"${with_mysql_lib}" != x ; then
66 if test -f ${with_mysql_lib}/libmysqlclient.a -o -f ${with_mysql_lib}/libmysqlclient.${shlibext}; then
67 ac_cv_path_mysql_lib="-L`(cd ${with_mysql_lib}; pwd)`"
69 AC_MSG_ERROR([${with_mysql_lib} directory doesn't contain mysql libraries.])
74 AC_MSG_CHECKING([for MySQL libraries])
75 if test x"${ac_cv_prog_mconfig}" != "x" ; then
76 ac_cv_path_mysql_lib=`${mconfig} --libs`
79 if test x"${ac_cv_path_mysql_lib}" = x; then #{
83 AC_CHECK_LIB(mysqlclient, mysql_init, [ac_cv_path_mysql_lib="-lmysqlclient"], [
84 for i in $libslist; do
85 if test -f $i/libmysqlclient.a -o -f $i/libmysqlclient.${shlibext}; then
87 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
88 ac_cv_path_mysql_lib="-L$i -lmysqlclient"
91 ac_cv_path_mysql_lib="-lmysqlclient"
97 AC_MSG_CHECKING([for MySQL client library])
101 if test x"${ac_cv_path_mysql_lib}" != x; then
102 AC_MSG_RESULT(${ac_cv_path_mysql_lib})
103 MYSQL_LIBS="${ac_cv_path_mysql_lib}"
109 if test x"${ac_cv_path_mysql_incl}" != x -a x"${ac_cv_path_mysql_lib}" != x; then
110 AC_DEFINE(HAVE_MYSQL, [], [Defined if you have MySQL installed])
112 AC_SUBST(MYSQL_CFLAGS)
119 # indent-tabs-mode: nil