summaryrefslogtreecommitdiff
path: root/config/ac-macros/storage.m4
blob: 4148aed818dd0fff43eed5a5c136a7cb7b328a3b (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
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_STORAGE_ENGINE
dnl
dnl What it does:
dnl   creates --with-xxx configure option
dnl   adds HAVE_XXX to config.h
dnl   appends &xxx_hton, to the list of hanldertons
dnl   appends a dir to the list of source directories
dnl   appends ha_xxx.cc to the list of handler files
dnl
dnl  all names above are configurable with reasonable defaults.
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_STORAGE_ENGINE],
[_MYSQL_STORAGE_ENGINE(
[$1],                                dnl name
m4_default([$2], [$1 storage engine]),    dnl verbose name
m4_default([$3], [$1-storage-engine]),    dnl with-name
m4_default([$4], no),                     dnl default
m4_default([$5], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]),
m4_default([$6], $1[_hton]),              dnl hton
m4_default([$7], []),                     dnl path to the code
m4_default([$8], [ha_$1.o]),             dnl path to the handler in
m4_default([$9], []),                    dnl path to extra libraries
[$10],                                     dnl code-if-set
)])

AC_DEFUN([_MYSQL_STORAGE_ENGINE],
[
AC_ARG_WITH([$3], AS_HELP_STRING([--with-$3], [enable $2 (default is $4)]),
[], [ [with_]m4_bpatsubst([$3], -, _)=['$4']])
AC_CACHE_CHECK([whether to use $2], [mysql_cv_use_]m4_bpatsubst([$3], -, _),
[mysql_cv_use_]m4_bpatsubst([$3], -, _)=[$with_]m4_bpatsubst([$3], -, _))
AH_TEMPLATE([$5], [Build $2])
if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != no; then
if test "$6" != "no"
then
  AC_DEFINE([$5])
  mysql_se_decls="${mysql_se_decls},$6"
  mysql_se_htons="${mysql_se_htons},&$6"
  if test "$8" != "no"
  then
    mysql_se_objs="$mysql_se_objs $8"
  fi
  mysql_se_dirs="$mysql_se_dirs $7"
  mysql_se_libs="$mysql_se_libs $9"
else
  mysql_se_plugins="$mysql_se_plugins $7"
fi
$10
fi
])

dnl ---------------------------------------------------------------------------