Skip to content

Commit 506f980

Browse files
fixes
1 parent 281fb1c commit 506f980

7 files changed

Lines changed: 56 additions & 98 deletions

File tree

.bzrignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,3 +1764,6 @@ unittest/examples/*.t
17641764
unittest/mysys/*.t
17651765
unittest/mytap/t/*.t
17661766
unittest/unit
1767+
compile
1768+
libmysqld/sql_builtin.cc
1769+
sql/sql_builtin.cc

Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
2424
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
2525
@readline_topdir@ sql-common \
2626
@thread_dirs@ pstack \
27-
@sql_union_dirs@ storage \
27+
@sql_union_dirs@ storage plugin \
2828
@sql_server@ scripts @man_dirs@ tests \
2929
netware @libmysqld_dirs@ \
3030
mysql-test support-files @tools_dirs@ \
31-
plugin unittest win
31+
unittest win
3232

3333
DIST_SUBDIRS = $(SUBDIRS) BUILD
3434

config/ac-macros/plugins.m4

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ AC_DEFUN([MYSQL_MODULE],[
3232

3333
AC_DEFUN([_MYSQL_MODULE],[
3434
m4_ifdef([$2], [
35-
AC_FATAL([[Duplicate MYSQL_MODULE declaration for ]][$3])
36-
],[ dnl
35+
AC_FATAL([Duplicate MYSQL_MODULE declaration for $3])
36+
],[
3737
m4_define([$2], [$1])
3838
_MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1])
3939
m4_define([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3])
@@ -57,13 +57,14 @@ AC_DEFUN([MYSQL_STORAGE_ENGINE],[
5757
MYSQL_MODULE([$1], [$3], [$4], [[$5]])
5858
MYSQL_MODULE_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE])
5959
ifelse([$2],[no],[],[
60-
_MYSQL_LEGACY_STORAGE_ENGINE([$1],m4_default([$2], [$1-storage-engine]))
60+
_MYSQL_LEGACY_STORAGE_ENGINE(
61+
m4_bpatsubst(m4_default([$2], [$1-storage-engine]), -, _))
6162
])
6263
])
6364

6465
AC_DEFUN([_MYSQL_LEGACY_STORAGE_ENGINE],[
65-
if test "[${with_]m4_bpatsubst($2, -, _)[+set}]" = set; then
66-
[with_module_]m4_bpatsubst($1, -, _)="[$with_]m4_bpatsubst($2, -, _)"
66+
if test "[${with_]$1[+set}]" = set; then
67+
[with_module_]$1="[$with_]$1"
6768
fi
6869
])
6970

@@ -188,7 +189,7 @@ dnl ---------------------------------------------------------------------------
188189
AC_DEFUN([MYSQL_MODULE_DEPENDS],[
189190
REQUIRE_PLUGIN([$1])
190191
ifelse($#, 0, [], $#, 1, [
191-
AC_FATAL([[bad number of arguments]])
192+
AC_FATAL([bad number of arguments])
192193
], $#, 2, [
193194
_MYSQL_MODULE_DEPEND([$1],[$2])
194195
],[
@@ -238,7 +239,8 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[
238239
_MYSQL_CHECK_PLUGIN_ARGS([$1])
239240
_MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
240241
_MYSQL_DO_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
241-
_MYSQL_POST_PLUGIN_FIXUP()
242+
AC_SUBST([mysql_se_dirs])
243+
AC_SUBST([mysql_pg_dirs])
242244
])
243245
])
244246
])
@@ -273,16 +275,19 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[
273275
AH_TEMPLATE($5, [Include ]$4[ into mysqld])
274276
])
275277
AC_MSG_CHECKING([whether to use ]$3)
278+
mysql_use_plugin_dir=""
276279
m4_ifdef([$10],[
277280
if test "[$mysql_module_]$2" = yes -a \
278281
"[$with_module_]$2" != no -o \
279282
"[$with_module_]$2" = yes; then
283+
AC_MSG_RESULT([error])
280284
AC_MSG_ERROR([disabled])
281285
fi
282286
AC_MSG_RESULT([no])
283287
],[
284288
m4_ifdef([$9],[
285289
if test "[$with_module_]$2" = no; then
290+
AC_MSG_RESULT([error])
286291
AC_MSG_ERROR([cannot disable mandatory module])
287292
fi
288293
[mysql_module_]$2=yes
@@ -295,7 +300,7 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[
295300
m4_ifdef([$8],[
296301
m4_ifdef([$6],[
297302
if test -d "$srcdir/$6" ; then
298-
mysql_plugin_dirs="$mysql_plugin_dirs $6"
303+
mysql_use_plugin_dir="$6"
299304
])
300305
AC_SUBST([plugin_]$2[_shared_target], "$8")
301306
AC_SUBST([plugin_]$2[_static_target], [""])
@@ -315,19 +320,19 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[
315320
m4_ifdef([$7],[
316321
ifelse(m4_bregexp($7, [^lib[^.]+\.a$]), -2, [
317322
m4_ifdef([$6],[
318-
mysql_plugin_dirs="$mysql_plugin_dirs $6"
323+
mysql_use_plugin_dir="$6"
319324
mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6"
320325
])
321326
mysql_plugin_libs="$mysql_plugin_libs
322327
[-l]m4_bregexp($7, [^lib\([^.]+\)], [\1])"
323328
], m4_bregexp($7, [^\\\$]), 0, [
324329
m4_ifdef([$6],[
325-
mysql_plugin_dirs="$mysql_plugin_dirs $6"
330+
mysql_use_plugin_dir="$6"
326331
])
327332
mysql_plugin_libs="$mysql_plugin_libs $7"
328333
], [
329334
m4_ifdef([$6],[
330-
mysql_plugin_dirs="$mysql_plugin_dirs $6"
335+
mysql_use_plugin_dir="$6"
331336
mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7"
332337
],[
333338
mysql_plugin_libs="$mysql_plugin_libs $7"
@@ -340,7 +345,8 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[
340345
AC_SUBST([plugin_]$2[_shared_target], [""])
341346
],[
342347
m4_ifdef([$6],[
343-
AC_FATAL([plugin directory specified without library for ]$3)
348+
AC_MSG_RESULT([error])
349+
AC_MSG_ERROR([Plugin $1 does not support static linking])
344350
],[
345351
m4_ifdef([$5],[
346352
AC_DEFINE($5)
@@ -353,6 +359,21 @@ AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[
353359
[with_module_]$2=yes
354360
AC_MSG_RESULT([yes])
355361
fi
362+
m4_ifdef([$6],[
363+
if test -n "$mysql_use_plugin_dir" ; then
364+
mysql_plugin_dirs="$mysql_plugin_dirs $6"
365+
if test -f "$srcdir/$6/configure" ; then
366+
other_configures="$other_configures $6/configure"
367+
else
368+
AC_CONFIG_FILES($6/Makefile)
369+
fi
370+
ifelse(m4_substr($6, 0, 8), [storage/],
371+
[mysql_se_dirs="$mysql_se_dirs ]m4_substr($6, 8)",
372+
m4_substr($6, 0, 7), [plugin/],
373+
[mysql_pg_dirs="$mysql_pg_dirs ]m4_substr($6, 7)",
374+
[AC_FATAL([don't know how to handle plugin dir ]$6)])
375+
fi
376+
])
356377
fi
357378
])
358379
])
@@ -409,10 +430,10 @@ AC_DEFUN([REQUIRE_PLUGIN],[
409430
define([_REQUIRE_PLUGIN],[
410431
ifdef([$2],[
411432
ifelse($2, [$1], [], [
412-
AC_FATAL([[Misspelt MYSQL_MODULE declaration for ]][$1])
433+
AC_FATAL([Misspelt MYSQL_MODULE declaration for $1])
413434
])
414435
],[
415-
AC_FATAL([[Missing MYSQL_MODULE declaration for ]][$1])
436+
AC_FATAL([Missing MYSQL_MODULE declaration for $1])
416437
])
417438
])
418439

@@ -455,7 +476,7 @@ AC_DEFUN([_MYSQL_PLUGAPPEND],[
455476

456477
AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[
457478
ifelse($#, 0, [], $#, 1, [
458-
AC_FATAL([[bad number of args]])
479+
AC_FATAL([bad number of args])
459480
], $#, 2, [
460481
_MYSQL_PLUGAPPEND_OPTONE([$1],[$2])
461482
],[
@@ -466,10 +487,10 @@ AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[
466487

467488
AC_DEFUN([_MYSQL_PLUGAPPEND_OPTONE],[
468489
ifelse([$2], [all], [
469-
AC_FATAL([[protected plugin group: all]])
490+
AC_FATAL([protected plugin group: all])
470491
],[
471492
ifelse([$2], [none], [
472-
AC_FATAL([[protected plugin group: none]])
493+
AC_FATAL([protected plugin group: none])
473494
],[
474495
_MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2])
475496
_MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [
@@ -516,7 +537,7 @@ AC_DEFUN([MYSQL_SHOW_PLUGIN],[
516537
])
517538

518539
AC_DEFUN([_MYSQL_SHOW_PLUGIN],[dnl
519-
=== Plugin: $3 ===
540+
=== $3 ===
520541
Module Name: [$1]
521542
Description: $4
522543
Supports build: _PLUGIN_BUILD_TYPE([$7],[$8])[]dnl
@@ -666,27 +687,4 @@ _MYSQL_MODULE_ARGS_CHECK(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
666687
_MYSQL_CHECK_DEPENDENCIES(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
667688
])
668689

669-
AC_DEFUN([_MYSQL_POST_PLUGIN_FIXUP],[
670-
for plugdir in $mysql_plugin_dirs; do
671-
case "$plugdir" in
672-
storage/* )
673-
mysql_se_dirs="$mysql_se_dirs `echo $plugdir | sed -e 's@^storage/@@'`"
674-
;;
675-
plugin/* )
676-
mysql_pg_dirs="$mysql_pg_dirs `echo $plugdir | sed -e 's@^plugin/@@'`"
677-
;;
678-
*)
679-
AC_MSG_ERROR([don't know how to handle plugin dir $plugdir])
680-
;;
681-
esac
682-
if test -f "$srcdir/$plugdir/configure" ; then
683-
other_configures="$other_configures $plugdir/configure"
684-
else
685-
ac_config_files="$ac_config_files $plugdir/Makefile"
686-
fi
687-
done
688-
AC_SUBST(mysql_se_dirs)
689-
AC_SUBST(mysql_pg_dirs)
690-
])
691-
692690
dnl ===========================================================================

configure.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine],
8787
MYSQL_MODULE(ftexample, [Simple Parser],
8888
[Simple full-text parser plugin])
8989
MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext])
90-
MYSQL_MODULE_STATIC(ftexample, [libftexample.a])
91-
MYSQL_MODULE_DYNAMIC(ftexample, [ft_example.la])
90+
MYSQL_MODULE_DYNAMIC(ftexample, [mypluglib.la])
9291

9392
MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine],
9493
[In memory hashed tables])
@@ -101,8 +100,6 @@ MYSQL_MODULE_DIRECTORY(innobase, [storage/innobase])
101100
MYSQL_MODULE_STATIC(innobase, [libinnobase.a])
102101
MYSQL_MODULE_ACTIONS(innobase, [
103102
AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
104-
AC_SUBST(innodb_includes)
105-
AC_SUBST(innodb_libs)
106103
AC_SUBST(innodb_system_libs)
107104
])
108105

plugin/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818

1919
AUTOMAKE_OPTIONS = foreign
2020

21+
# extra plugin example files are listed here, to
22+
# keep its Makefile.am cleaner as a template
2123
EXTRA_DIST = fulltext/configure.in
24+
2225
SUBDIRS = @mysql_pg_dirs@
2326

2427
# Don't update the files from bitkeeper

plugin/fulltext/Makefile.am

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,9 @@
11
#Makefile.am example for a plugin
22

3-
#MYSQL_MODULE(ftexample, [Simple Parser],
4-
# [Simple full-text parser plugin])
5-
#MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext])
6-
#MYSQL_MODULE_STATIC(ftexample, [libftexample.a])
7-
#MYSQL_MODULE_DYNAMIC(ftexample, [ft_example.la])
3+
pkglibdir=$(libdir)/mysql
4+
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include
5+
noinst_LTLIBRARIES= mypluglib.la
6+
#pkglib_LTLIBRARIES= mypluglib.la
7+
mypluglib_la_SOURCES= plugin_example.c
8+
mypluglib_la_LDFLAGS= -module -rpath $(pkglibdir)
89

9-
10-
#called from the top level Makefile
11-
12-
MYSQLDATAdir = $(localstatedir)
13-
MYSQLSHAREdir = $(pkgdatadir)
14-
MYSQLBASEdir= $(prefix)
15-
MYSQLLIBdir= $(pkglibdir)
16-
INCLUDES = -I$(top_srcdir)/include \
17-
-I$(top_srcdir)/regex \
18-
-I$(top_srcdir)/sql \
19-
-I$(srcdir)
20-
WRAPLIBS=
21-
22-
LDADD =
23-
24-
DEFS = @DEFS@
25-
26-
noinst_HEADERS =
27-
28-
EXTRA_LTLIBRARIES = ft_example.la
29-
pkglib_LTLIBRARIES = @plugin_ftexample_shared_target@
30-
ft_example_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
31-
ft_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
32-
ft_example_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
33-
ft_example_la_SOURCES = plugin_example.c
34-
35-
36-
EXTRA_LIBRARIES = libftexample.a
37-
noinst_LIBRARIES = @plugin_ftexample_static_target@
38-
libftexample_a_CXXFLAGS=$(AM_CFLAGS)
39-
libftexample_a_CFLAGS = $(AM_CFLAGS)
40-
libftexample_a_SOURCES= plugin_example.c
41-
42-
43-
# Don't update the files from bitkeeper
44-
%::SCCS/s.%

sql/sql_show.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin,
111111
CHARSET_INFO *cs= system_charset_info;
112112
char version_buf[20];
113113

114-
/* we normally hide all the built-in plugins */
115-
if (!plugin->plugin_dl && !thd->lex->verbose)
116-
return 0;
117-
118114
restore_record(table, s->default_values);
119115

120116
table->field[0]->store(plugin->name.str, plugin->name.length, cs);
@@ -123,7 +119,7 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin,
123119
make_version_string(version_buf, sizeof(version_buf), plug->version),
124120
cs);
125121

126-
122+
127123
switch (plugin->state)
128124
{
129125
/* case PLUGIN_IS_FREED: does not happen */
@@ -3042,12 +3038,8 @@ static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin,
30423038

30433039
int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond)
30443040
{
3045-
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
3046-
TABLE *table= tables->table;
3047-
CHARSET_INFO *scs= system_charset_info;
3048-
30493041
return plugin_foreach(thd, iter_schema_engines,
3050-
MYSQL_STORAGE_ENGINE_PLUGIN, table);
3042+
MYSQL_STORAGE_ENGINE_PLUGIN, tables->table);
30513043
}
30523044

30533045

0 commit comments

Comments
 (0)