summaryrefslogtreecommitdiffstats
path: root/m4/ac_mysql.m4
blob: b5a5c0c91fcb43d73cea889c5c4141b42404cea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_SRC_TEST
dnl ---------------------------------------------------------------------------

dir_resolve() dnl {{{
{
  pwd=`pwd`
  cd "$1" 2>/dev/null || cd "${pwd}/${1}" 2>/dev/null
  if test "$?" = "0"
  then
    echo `pwd -P`
  else
    echo "$1"
  fi
}
dnl }}}

AC_DEFUN([MYSQL_SRC_TEST], [
  AC_MSG_CHECKING(for mysql source code)
  AC_ARG_WITH(mysql,
    [AS_HELP_STRING([--with-mysql=PATH], [MySQL src directory required to build.])],
    [
      ac_mysql_source_dir=`readlink -e "$withval"`
      HEADERS="include/my_dir.h include/mysql/plugin.h include/mysql.h include/mysql_version.h include/config.h include/my_config.h"
      for file in $HEADERS
      do
        if ! test -r "$ac_mysql_source_dir/$file"
        then
          AC_MSG_ERROR([Failed to find required header file $ac_mysql_source_dir/$file, check the path and make sure you've run './configure ..<options>.. && cd include && make' in MySQL 5.1 sources dir or 'cmake . && make' in MySQL 5.5 sources dir.])
        fi
      done
      AC_DEFINE([MYSQL_SRC], [1], [Source directory for MySQL])
      MYSQL_INC="-I$ac_mysql_source_dir/sql -I$ac_mysql_source_dir/include -I$ac_mysql_source_dir/regex -I$ac_mysql_source_dir -I$ac_mysql_source_dir/libbinlogevents/export -I$ac_mysql_source_dir/libbinlogevents/include -I$ac_mysql_source_dir/sql/auth"
      AC_MSG_RESULT(["$ac_mysql_source_dir"])
    ],
    [
      AC_MSG_ERROR(["No mysql source provided. Please specify --with-mysql=<mysql source dir>!"])
    ]
  )
])

dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_PLUGIN_DIR_TEST
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_PLUGIN_DIR_TEST], [
  AC_MSG_CHECKING([for mysql plugin dir])
  ac_mysql_plugin_dir=
  AC_ARG_WITH([mysql-plugindir],
    [AS_HELP_STRING([--with-mysql-plugindir=PATH], [MySQL plugin directory where plugin is to be copied to])],
    [
      ac_mysql_plugin_dir=`readlink -m "$withval"`
      MYSQL_PLUGIN_DIR="$ac_mysql_plugin_dir"
    ],
    [
      ac_mysql_plugin_dir="/usr/lib/mysql/plugin"
      MYSQL_PLUGIN_DIR="$ac_mysql_plugin_dir"
      AC_MSG_RESULT([--with-mysql-plugindir was not set. Using $ac_mysql_plugin_dir])
    ]
  )
])

dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_LIB_SERVICES : 5.5 services lib to add to linker
dnl ---------------------------------------------------------------------------

dnl AC_DEFUN([MYSQL_LIB_SERVICES_TEST], [
dnl   AC_MSG_CHECKING([for mysql libmysqlservices])
dnl   ac_mysql_libservices=
dnl   AC_ARG_WITH([mysql-libservices],
dnl     [AS_HELP_STRING([--with-mysql-libservices=PATH], [MySQL libmysqlservices.a location (relevant for 5.5 only)])],
dnl     [
dnl       ac_mysql_libservices=`readlink -e "$withval"`
dnl       if test -f "$ac_mysql_libservices"
dnl       then
dnl         MYSQL_LIBSERVICES="$ac_mysql_libservices"
dnl         AC_MSG_RESULT([yes: Using $ac_mysql_libservices])
dnl       else
dnl         AC_MSG_ERROR([invalid MySQL libmysqlservices : $ac_mysql_libservices])
dnl       fi
dnl     ],
dnl     [
dnl       if test -f "$ac_mysql_source_dir/VERSION"
dnl       then
dnl         source "$ac_mysql_source_dir/VERSION"
dnl         if test "$MYSQL_VERSION_MAJOR.$MYSQL_VERSION_MINOR" = "5.5"
dnl         then
dnl           AC_MSG_ERROR([no mysql-libservices. Required for MySQL 5.5])
dnl         fi
dnl       fi
dnl       ac_mysql_libservices=""
dnl       MYSQL_LIBSERVICES="$ac_mysql_libservices"
dnl       AC_MSG_RESULT([--with-mysql-libservices was not set.])
dnl     ]
dnl   )
dnl ])