2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 AC_DEFUN([GNASH_PATH_MYSQL],
21 dnl Lool for the header
22 AC_ARG_WITH(mysql-incl, AC_HELP_STRING([--with-mysql-incl], [directory where mysql headers are]), with_mysql_incl=${withval})
23 AC_CACHE_VAL(ac_cv_path_mysql_incl,[
24 if test x"${with_mysql_incl}" != x ; then
25 if test -f ${with_mysql_incl}/mysql.h ; then
26 ac_cv_path_mysql_incl="-I`(cd ${with_mysql_incl}; pwd)`"
28 AC_MSG_ERROR([${with_mysql_incl} directory doesn't contain any headers])
33 if test x"${ac_cv_path_mysql_incl}" = x; then
34 AC_CHECK_PROG(mconfig, mysql_config, mysql_config)
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])
102 if test x"${ac_cv_path_mysql_lib}" != x; then
103 AC_MSG_RESULT(${ac_cv_path_mysql_lib})
104 MYSQL_LIBS="${ac_cv_path_mysql_lib}"
110 if test x"${ac_cv_path_mysql_incl}" != x -a x"${ac_cv_path_mysql_lib}" != x; then
111 AC_DEFINE(HAVE_MYSQL, [], [Defined if you have MySQL installed])
113 AC_SUBST(MYSQL_CFLAGS)
120 # indent-tabs-mode: nil