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)
34 AC_MSG_RESULT(${ac_cv_prog_mconfig})
36 if test x"${ac_cv_prog_mconfig}" = "x" ; then
37 AC_CHECK_PROG(mconfig, mysql-config, mysql-config)
40 if test x"${ac_cv_prog_mconfig}" != "x" ; then
41 ac_cv_path_mysql_incl=`${mconfig} --include`
44 AC_MSG_CHECKING([for MySQL headers])
45 if test x"${ac_cv_path_mysql_incl}" = x ; then
46 AC_MSG_CHECKING([for mysql header])
47 for i in $incllist; do
48 if test -f $i/mysql/mysql.h; then
49 ac_cv_path_mysql_incl="-I$i/mysql"
55 if test x"${ac_cv_path_mysql_incl}" != x ; then
56 MYSQL_CFLAGS="${ac_cv_path_mysql_incl}"
63 dnl Look for the library
64 AC_ARG_WITH(mysql-lib, AC_HELP_STRING([--with-mysql-lib], [directory where mysql libraries are]), with_mysql_lib=${withval})
65 AC_CACHE_VAL(ac_cv_path_mysql_lib,[
66 if test x"${with_mysql_lib}" != x ; then
67 if test -f ${with_mysql_lib}/libmysqlclient.a -o -f ${with_mysql_lib}/libmysqlclient.${shlibext}; then
68 ac_cv_path_mysql_lib="-L`(cd ${with_mysql_lib}; pwd)`"
70 AC_MSG_ERROR([${with_mysql_lib} directory doesn't contain mysql libraries.])
75 AC_MSG_CHECKING([for MySQL libraries])
76 if test x"${ac_cv_prog_mconfig}" != "x" ; then
77 ac_cv_path_mysql_lib=`${mconfig} --libs`
80 if test x"${ac_cv_path_mysql_lib}" = x; then #{
84 AC_CHECK_LIB(mysqlclient, mysql_init, [ac_cv_path_mysql_lib="-lmysqlclient"], [
85 for i in $libslist; do
86 if test -f $i/libmysqlclient.a -o -f $i/libmysqlclient.${shlibext}; then
88 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
89 ac_cv_path_mysql_lib="-L$i -lmysqlclient"
92 ac_cv_path_mysql_lib="-lmysqlclient"
98 AC_MSG_CHECKING([for MySQL client library])
99 AC_MSG_RESULT(${ac_cv_path_mysql_lib})
103 if test x"${ac_cv_path_mysql_lib}" != x; then
104 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