Add pre-depends for multi-arch mysql
[manu/libnss-mysql-bg.git] / acinclude.m4
1 dnl Copyright (C) 2002 Ben Goodwin
2 dnl This file is part of the nss-mysql library.
3 dnl
4 dnl The nss-mysql library is free software; you can redistribute it and/or
5 dnl modify it under the terms of the GNU General Public License as published
6 dnl by the Free Software Foundation; either version 2 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl The nss-mysql library 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
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with the nss-mysql library; if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 dnl
18 dnl $Id: acinclude.m4,v 1.10 2004/04/10 03:55:37 cinergi Exp $
19
20 AC_DEFUN([FIND_MYSQL],[
21
22 baselist="$with_mysql \
23           /usr \
24           /usr/local \
25           /usr/local/mysql \
26           /opt/local \
27           /opt/local/mysql"
28
29 AC_MSG_CHECKING([for MySQL headers])
30 for f in $baselist; do
31     if test -f "$f/include/mysql/mysql.h"
32     then
33         MYSQL_INC_DIR="$f/include/mysql"
34         break
35     fi
36
37     if test -f "$f/include/mysql.h"
38     then
39         MYSQL_INC_DIR="$f/include"
40         break
41     fi
42 done
43
44 if test -n "$MYSQL_INC_DIR"
45 then
46     AC_MSG_RESULT([$MYSQL_INC_DIR])
47     CPPFLAGS="-I $MYSQL_INC_DIR $CPPFLAGS"
48 else
49     AC_MSG_ERROR([Cannot locate MySQL headers.  Try using --with-mysql=DIR])
50 fi
51
52 AC_MSG_CHECKING([for MySQL libraries])
53 dnl Check for share first, then static, such that static
54 dnl will take precedence
55 for f in $baselist; do
56     if test -f "$f/lib/libmysqlclient.so"
57     then
58         MYSQL_LIB_DIR="$f/lib"
59         break
60     fi
61
62     if test -f "$f/lib/mysql/libmysqlclient.so"
63     then
64         MYSQL_LIB_DIR="$f/lib/mysql"
65         break
66     fi
67 done
68
69 for f in $baselist; do
70     if test -f "$f/lib/libmysqlclient.a"
71     then
72         MYSQL_LIB_DIR="$f/lib"
73         break
74     fi
75
76     if test -f "$f/lib/mysql/libmysqlclient.a"
77     then
78         MYSQL_LIB_DIR="$f/lib/mysql"
79         break
80     fi
81 done
82
83 if test -n "$MYSQL_LIB_DIR"
84 then
85     AC_MSG_RESULT([$MYSQL_LIB_DIR])
86     LDFLAGS="-L$MYSQL_LIB_DIR $LDFLAGS"
87 else
88     AC_MSG_ERROR([Cannot locate MySQL libraries.  Try using --with-mysql=DIR])
89 fi
90
91  ])
92