]> git.ipfire.org Git - thirdparty/pdns.git/blame - m4/pdns_with_mysql.m4
Merge pull request #12938 from omoerbeek/auth-coverty-time_t
[thirdparty/pdns.git] / m4 / pdns_with_mysql.m4
CommitLineData
bc70fc5a 1AC_DEFUN([PDNS_WITH_MYSQL],[
39653d75
RK
2 AC_ARG_WITH([mysql],
3 [AS_HELP_STRING([--with-mysql=<path>], [root directory path of MySQL installation])],
bc70fc5a 4 [
12078404
JS
5 if test "$withval" = "no"; then
6 modules_without_gmysql=$(echo $modules|sed -e 's/gmysql//;s/ */ /g;')
7 dynmodules_without_gmysql=$(echo $dynmodules|sed -e 's/gmysql//;s/ */ /g;')
8 AC_MSG_ERROR([instead of --without-mysql try --with-modules="$modules_without_gmysql" --with-dyn-modules="$dynmodules_without_gmysql"])
9 fi
10
339afd02 11 MYSQL_LIBS_check="$withval/lib/mysql $with_mysql/lib"
42ca21f4 12 MYSQL_CFLAGS_check="$withval/include/mysql"
bc70fc5a
RK
13 MYSQL_config_check="$withval/bin/mysql_config"
14 ],
15 [
339afd02 16 MYSQL_LIBS_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql /opt/mysql/lib/mysql \
bc70fc5a 17 /usr/lib/mysql /usr/lib64/mysql /usr/local/mysql/lib /usr/local/lib /opt/mysql/lib /usr/lib \
0949b8ae 18 /usr/sfw/lib/ $full_libdir"
42ca21f4 19 MYSQL_CFLAGS_check="/usr/local/mysql/include/mysql /usr/local/include/mysql \
bc70fc5a
RK
20 /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql /usr/sfw/include/mysql"
21 ]
22 )
23
39653d75
RK
24 AC_ARG_WITH([mysql-config],
25 [AS_HELP_STRING([--with-mysql-config=<path>], [file path to mysql_config])],
bc70fc5a
RK
26 [MYSQL_config_check=$withval]
27 )
28
39653d75
RK
29 AC_ARG_WITH([mysql-lib],
30 [AS_HELP_STRING([--with-mysql-lib=<path>], [directory path of MySQL library installation])],
bc70fc5a 31 [
339afd02 32 MYSQL_LIBS_check="$withval/lib/mysql $withval/mysql $withval"
bc70fc5a
RK
33 MYSQL_config_check="skip"
34 ]
35 )
36
39653d75
RK
37 AC_ARG_WITH([mysql-includes],
38 [AS_HELP_STRING([--with-mysql-includes=<path>], [directory path of MySQL header installation])],
bc70fc5a 39 [
42ca21f4 40 MYSQL_CFLAGS_check="$withval/include/mysql $withval/mysql $withval"
bc70fc5a
RK
41 MYSQL_config_check="skip"
42 ]
43 )
44
45 MYSQL_config=""
46 if test "x$MYSQL_config_check" != "xskip"; then
14cd3757 47 if test "x$MYSQL_config_check" = "x"; then
b180eb0d 48 AC_PATH_PROG([MYSQL_config], [mysql_config])
bc70fc5a 49 else
b180eb0d 50 AC_MSG_CHECKING([for $MYSQL_config_check])
bc70fc5a
RK
51 if test -x $MYSQL_config_check; then
52 MYSQL_config="$MYSQL_config_check"
b180eb0d 53 AC_MSG_RESULT([yes])
bc70fc5a
RK
54 else
55 MYSQL_config=""
56 AC_MSG_ERROR([not found])
57 fi
58 fi
59 fi
60
61 if test "x$MYSQL_config" != "x"; then
62 # use this to configure everything
339afd02 63 MYSQL_LIBS=`$MYSQL_config --libs`
42ca21f4 64 MYSQL_CFLAGS=`$MYSQL_config --include`
bc70fc5a
RK
65 else
66 AC_MSG_CHECKING([for MySQL library directory])
67 MYSQL_libdir=
339afd02 68 for m in $MYSQL_LIBS_check; do
bc70fc5a
RK
69 if test -d "$m" && \
70 (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
71 then
72 MYSQL_libdir=$m
73 break
74 fi
75 done
76 if test -z "$MYSQL_libdir"; then
339afd02 77 AC_MSG_ERROR([Did not find the mysql library dir in '$MYSQL_LIBS_check'])
bc70fc5a
RK
78 fi
79 case "$MYSQL_libdir" in
339afd02 80 /*) MYSQL_LIBS="-L$MYSQL_libdir -lmysqlclient"
bc70fc5a
RK
81 ;;
82 *) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.])
83 ;;
84 esac
85 AC_MSG_RESULT([$MYSQL_libdir])
339afd02 86 AC_SUBST(MYSQL_LIBS)
bc70fc5a 87 AC_MSG_CHECKING([for MySQL include directory])
42ca21f4
RK
88 MYSQL_CFLAGS=
89 for m in $MYSQL_CFLAGS_check; do
bc70fc5a
RK
90 if test -d "$m" && test -f "$m/mysql.h"
91 then
42ca21f4 92 MYSQL_CFLAGS="$m"
bc70fc5a
RK
93 break
94 fi
95 done
42ca21f4
RK
96 if test -z "$MYSQL_CFLAGS"; then
97 AC_MSG_ERROR([Did not find the mysql include dir in '$MYSQL_CFLAGS_check'])
bc70fc5a
RK
98 fi
99
42ca21f4
RK
100 case "$MYSQL_CFLAGS" in
101 /*) AC_MSG_RESULT($MYSQL_CFLAGS)
bc70fc5a 102 ;;
42ca21f4 103 *) AC_MSG_ERROR([The MySQL include directory ($MYSQL_CFLAGS) must be an absolute path.])
bc70fc5a
RK
104 ;;
105 esac
42ca21f4 106 MYSQL_CFLAGS="-I$MYSQL_CFLAGS"
bc70fc5a 107 fi
339afd02 108 AC_SUBST(MYSQL_LIBS)
42ca21f4 109 AC_SUBST(MYSQL_CFLAGS)
bc70fc5a
RK
110])
111