List:Commits« Previous MessageNext Message »
From:antony Date:April 13 2006 7:05am
Subject:bk commit into 5.1 tree (acurtis:1.2328)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2328 06/04/12 22:04:39 acurtis@stripped +50 -0
  WL#3201
    " Configure support for server plugins "
  Initial commit for testing

  storage/blackhole/Makefile.am
    1.1 06/04/12 22:02:27 acurtis@stripped +51 -0
    New BitKeeper file ``storage/blackhole/Makefile.am''

  sql/sql_builtin.cc.in
    1.1 06/04/12 22:02:27 acurtis@stripped +16 -0
    New BitKeeper file ``sql/sql_builtin.cc.in''

  config/ac-macros/plugins.m4
    1.1 06/04/12 22:02:27 acurtis@stripped +535 -0
    New BitKeeper file ``config/ac-macros/plugins.m4''

  storage/innobase/Makefile.am
    1.11 06/04/12 22:02:27 acurtis@stripped +29 -0
    WL#3201
      Lets make life easier and reduce innodb into a single library file

  storage/example/ha_example.cc
    1.35 06/04/12 22:02:27 acurtis@stripped +3 -3
    WL#3201
      remove conditional compilation on MYSQL_PLUGIN
      mysql_declare_plugin macro change

  storage/csv/ha_tina.cc
    1.43 06/04/12 22:02:27 acurtis@stripped +3 -3
    WL#3201
      remove conditional compilation on MYSQL_PLUGIN
      mysql_declare_plugin macro change

  storage/csv/Makefile.am
    1.7 06/04/12 22:02:27 acurtis@stripped +9 -4
    WL#3201
      setup as plugin makefile

  storage/blackhole/ha_blackhole.cc
    1.31 06/04/12 22:02:27 acurtis@stripped +14 -0
    WL#3201
      convert into a plugin

  storage/blackhole/Makefile.am
    1.0 06/04/12 22:02:27 acurtis@stripped +0 -0
    BitKeeper file /home/antony/work2/wl3201.3/storage/blackhole/Makefile.am

  storage/bdb/Makefile.in
    1.11 06/04/12 22:02:27 acurtis@stripped +12 -3
    WL#3201
      setup as plugin makefile

  storage/archive/ha_archive.h
    1.44 06/04/12 22:02:27 acurtis@stripped +1 -1
    WL#3201
      azlib.h now in local dir

  storage/archive/ha_archive.cc
    1.87 06/04/12 22:02:27 acurtis@stripped +36 -14
    WL#3201
      Convert into a plugin

  storage/archive/Makefile.am
    1.4 06/04/12 22:02:27 acurtis@stripped +39 -11
    WL#3201
      setup as plugin makefile

  sql/sql_builtin.cc.in
    1.0 06/04/12 22:02:27 acurtis@stripped +0 -0
    BitKeeper file /home/antony/work2/wl3201.3/sql/sql_builtin.cc.in

  config/ac-macros/plugins.m4
    1.0 06/04/12 22:02:27 acurtis@stripped +0 -0
    BitKeeper file /home/antony/work2/wl3201.3/config/ac-macros/plugins.m4

  sql/sql_yacc.yy
    1.489 06/04/12 22:02:26 acurtis@stripped +1 -1
    WL#3201
      SHOW FULL PLUGIN

  sql/sql_show.cc
    1.327 06/04/12 22:02:26 acurtis@stripped +28 -17
    WL#3201
      Fix to use plugin_foreach()

  sql/sql_plugin.cc
    1.18 06/04/12 22:02:26 acurtis@stripped +64 -11
    WL#3201
      All compiled in plugins are in mysqld_builtins[]
      add funcs for plugin finalization
      install builtin plugins on initialization
      

  sql/sql_delete.cc
    1.181 06/04/12 22:02:26 acurtis@stripped +2 -0
    WL#3201
      conditionally include ha_innodb.h

  sql/partition_info.cc
    1.10 06/04/12 22:02:26 acurtis@stripped +2 -1
    WL#3201
      conditionally compile content

  sql/mysqld.cc
    1.555 06/04/12 22:02:26 acurtis@stripped +13 -17
    WL#3201
      remove ha_register_builtin_plugins()
      alter init order so that storage engines are initialized before first use

  sql/log.cc
    1.204 06/04/12 22:02:26 acurtis@stripped +15 -0
    WL#3201
      make into a plugin

  sql/handler.h
    1.202 06/04/12 22:02:26 acurtis@stripped +3 -2
    WL#3201
      new DB_TYPE_FIRST_DYNAMIC
      new func ha_finalize_handlerton()
      remove ha_register_builtin_plugins()

  sql/handler.cc
    1.227 06/04/12 22:02:26 acurtis@stripped +71 -82
    WL#3201
      Simplify how storage engines are found by db_type
      (hopefully we can get rid of it soon)
      Code cleanup

  sql/ha_partition.cc
    1.46 06/04/12 22:02:26 acurtis@stripped +19 -0
    WL#3201
      make into a plugin
      conditionally compile content

  sql/ha_ndbcluster_binlog.cc
    1.42 06/04/12 22:02:26 acurtis@stripped +2 -0
    WL#3201
      make into a plugin
      conditionally compile content

  sql/ha_ndbcluster.cc
    1.296 06/04/12 22:02:26 acurtis@stripped +19 -0
    WL#3201
      make into a plugin
      conditionally compile content

  sql/ha_myisammrg.cc
    1.84 06/04/12 22:02:26 acurtis@stripped +15 -0
    WL#3201
      make into a plugin

  sql/ha_myisam.cc
    1.176 06/04/12 22:02:26 acurtis@stripped +16 -0
    WL#3201
      make into a plugin

  sql/ha_innodb.cc
    1.269 06/04/12 22:02:26 acurtis@stripped +17 -0
    WL#3201
      make into a plugin
      conditionally compile content

  sql/ha_heap.cc
    1.87 06/04/12 22:02:26 acurtis@stripped +13 -0
    WL#3201
      make into a plugin

  sql/ha_federated.cc
    1.57 06/04/12 22:02:26 acurtis@stripped +19 -0
    WL#3201
      make into a plugin
      conditionally compile content

  sql/ha_berkeley.cc
    1.174 06/04/12 22:02:25 acurtis@stripped +18 -0
    WL#3201
      make into a plugin
      conditionally compile content

  sql/Makefile.am
    1.136 06/04/12 22:02:25 acurtis@stripped +10 -11
    WL#3201
      Storage engine files still left in sql subdir are not conditionally
      compiled. Should move them out soon,

  plugin/fulltext/plugin_example.c
    1.9 06/04/12 22:02:25 acurtis@stripped +1 -1
    WL#3201
      change to mysql_declare_plugin macro

  plugin/fulltext/Makefile.am
    1.5 06/04/12 22:02:25 acurtis@stripped +41 -6
    WL#3201
      update makefile

  plugin/Makefile.am
    1.2 06/04/12 22:02:25 acurtis@stripped +27 -1
    WL#3201
      update makefile

  libmysqld/Makefile.am
    1.84 06/04/12 22:02:25 acurtis@stripped +7 -9
    WL#3201
      Storage engine files still left in sql subdir are not conditionally
      compiled. Should move them out soon,

  include/mysql/plugin.h
    1.12 06/04/12 22:02:25 acurtis@stripped +18 -3
    WL#3201
      support static and dynamic build - MYSQL_DYNAMIC_PLUGIN

  configure.in
    1.360 06/04/12 22:02:25 acurtis@stripped +88 -78
    WL#3201
      out with storage.m4, in with plugins.m4
      change how plugins are declared

  config/ac-macros/ha_ndbcluster.m4
    1.14 06/04/12 22:02:25 acurtis@stripped +2 -0
    WL#3201
      Split big macro

  config/ac-macros/ha_berkeley.m4
    1.5 06/04/12 22:02:25 acurtis@stripped +0 -1
    WL#3201
      Makefile is always made

  Makefile.am
    1.87 06/04/12 22:02:25 acurtis@stripped +1 -2
    WL#3201
      changes in build subst names

  BUILD/SETUP.sh
    1.58 06/04/12 22:02:25 acurtis@stripped +3 -12
    WL#3201
      Changes in configure arguments

  BitKeeper/deleted/.del-ha_tina.m4~f658506ebbc113ca
    1.3 06/04/12 21:42:03 acurtis@stripped +0 -0
    Delete: config/ac-macros/ha_tina.m4

  BitKeeper/deleted/.del-ha_partition.m4~bc57067550be5f89
    1.4 06/04/12 21:41:58 acurtis@stripped +0 -0
    Delete: config/ac-macros/ha_partition.m4

  BitKeeper/deleted/.del-ha_innodb.m4~6f141fb5b80c1f39
    1.4 06/04/12 21:41:47 acurtis@stripped +0 -0
    Delete: config/ac-macros/ha_innodb.m4

  BitKeeper/deleted/.del-ha_federated.m4~7acddd58286acfd6
    1.3 06/04/12 21:41:33 acurtis@stripped +0 -0
    Delete: config/ac-macros/ha_federated.m4

  BitKeeper/deleted/.del-ha_example.m4~1dfb268163297708
    1.3 06/04/12 21:41:26 acurtis@stripped +0 -0
    Delete: config/ac-macros/ha_example.m4

  BitKeeper/deleted/.del-ha_blackhole.m4~8ed06eb91f6420ed
    1.2 06/04/12 21:41:21 acurtis@stripped +0 -0
    Delete: config/ac-macros/ha_blackhole.m4

  BitKeeper/deleted/.del-ha_archive.m4~a07fac7110b39294
    1.3 06/04/12 21:41:16 acurtis@stripped +0 -0
    Delete: config/ac-macros/ha_archive.m4

  BitKeeper/deleted/.del-storage.m4~24bf2fffdaa328ad
    1.5 06/04/12 21:40:35 acurtis@stripped +137 -35
    Delete: config/ac-macros/storage.m4

  storage/blackhole/ha_blackhole.cc
    1.30 06/04/11 22:29:27 acurtis@stripped +0 -0
    Rename: sql/ha_blackhole.cc -> storage/blackhole/ha_blackhole.cc

  storage/blackhole/ha_blackhole.h
    1.8 06/04/11 22:29:24 acurtis@stripped +0 -0
    Rename: sql/ha_blackhole.h -> storage/blackhole/ha_blackhole.h

  storage/archive/ha_archive.cc
    1.86 06/04/11 22:28:19 acurtis@stripped +0 -0
    Rename: sql/ha_archive.cc -> storage/archive/ha_archive.cc

  storage/archive/ha_archive.h
    1.43 06/04/11 22:28:15 acurtis@stripped +0 -0
    Rename: sql/ha_archive.h -> storage/archive/ha_archive.h

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	acurtis
# Host:	localhost.(none)
# Root:	/home/antony/work2/wl3201.3

--- 1.86/Makefile.am	2006-04-11 00:11:26 -07:00
+++ 1.87/Makefile.am	2006-04-12 22:02:25 -07:00
@@ -24,9 +24,8 @@ EXTRA_DIST =		INSTALL-SOURCE INSTALL-WIN
 SUBDIRS =		. include @docs_dirs@ @zlib_dir@ @yassl_dir@ \
 			@readline_topdir@ sql-common \
 			@thread_dirs@ pstack \
-			@sql_union_dirs@ @mysql_se_dirs@ \
+			@sql_union_dirs@ @mysql_plugin_dirs@ \
 			@sql_server@ scripts @man_dirs@ tests \
-			@mysql_se_plugins@ \
 			netware @libmysqld_dirs@ \
 			@bench_dirs@ support-files @tools_dirs@ \
 			plugin win

--- 1.359/configure.in	2006-04-10 16:41:03 -07:00
+++ 1.360/configure.in	2006-04-12 22:02:25 -07:00
@@ -31,7 +31,7 @@ sinclude(config/ac-macros/alloca.m4)
 sinclude(config/ac-macros/check_cpu.m4)
 sinclude(config/ac-macros/character_sets.m4)
 sinclude(config/ac-macros/compiler_flag.m4)
-sinclude(config/ac-macros/storage.m4)
+sinclude(config/ac-macros/plugins.m4)
 sinclude(config/ac-macros/ha_berkeley.m4)
 sinclude(config/ac-macros/ha_ndbcluster.m4)
 sinclude(config/ac-macros/large_file.m4)
@@ -48,6 +48,74 @@ czech danish dutch english estonian fren
 italian japanese korean norwegian norwegian-ny polish portuguese \
 romanian russian serbian slovak spanish swedish ukrainian"
 
+#--------------------------------------------------------------------
+# Declare our plugin modules
+#--------------------------------------------------------------------
+
+MYSQL_STORAGE_ENGINE(archive,   [Archive Storage Engine],
+        [Archive Storage Engine], [max,max-no-ndb])
+MYSQL_MODULE_DIRECTORY(archive, [storage/archive])
+MYSQL_MODULE_STATIC(archive,    [libarchive.a])
+MYSQL_MODULE_DYNAMIC(archive,   [ha_archive.la])
+
+MYSQL_STORAGE_ENGINE(berkeley,  [BerkeleyDB Storage Engine],
+        [Transactional Tables using BerkeleyDB], [max,max-no-ndb])
+MYSQL_MODULE_DIRECTORY(berkeley,[storage/bdb])
+MYSQL_MODULE_STATIC(berkeley,   [libdb.a])
+MYSQL_MODULE_ACTIONS(berkeley,  [MYSQL_SETUP_BERKELEY_DB])
+
+MYSQL_STORAGE_ENGINE(blackhole, [Blackhole Storage Engine],
+        [Basic Write-only Read-never tables], [max,max-no-ndb])
+MYSQL_MODULE_DIRECTORY(blackhole, [storage/blackhole])
+MYSQL_MODULE_STATIC(blackhole,  [libblackhole.a])
+MYSQL_MODULE_DYNAMIC(blackhole, [ha_blackhole.la])
+
+MYSQL_STORAGE_ENGINE(csv,       [CSV Storage Engine],
+        [Stores tables in text CSV format])
+MYSQL_MODULE_DIRECTORY(csv,     [storage/csv])
+MYSQL_MODULE_STATIC(csv,        [libcsv.a])
+
+MYSQL_STORAGE_ENGINE(example,   [Example Storage Engine],
+        [Skeleton for Storage Engines for developers], [max,max-no-ndb])
+MYSQL_MODULE_DIRECTORY(example, [storage/example])
+MYSQL_MODULE_STATIC(example,    [libexample.a])
+MYSQL_MODULE_DYNAMIC(example,   [ha_example.la])
+
+MYSQL_STORAGE_ENGINE(federated, [Federated Storage Engine],
+        [Connects to tables on remote MySQL servers], [max,max-no-ndb])
+
+MYSQL_MODULE(ftexample,         [Simple Parser],
+        [Simple full-text parser plugin])
+MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext])
+MYSQL_MODULE_STATIC(ftexample,  [libftexample.a])
+MYSQL_MODULE_DYNAMIC(ftexample, [ft_example.la])
+
+MYSQL_STORAGE_ENGINE(innobase,  [InnoDB Storage Engine],
+        [Transactional Tables using InnoDB], [max,max-no-ndb])
+MYSQL_MODULE_DIRECTORY(innobase, [storage/innobase])
+MYSQL_MODULE_STATIC(innobase,   [libinnobase.a])
+MYSQL_MODULE_ACTIONS(innobase,  [
+  AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
+  AC_SUBST(innodb_includes)
+  AC_SUBST(innodb_libs)
+  AC_SUBST(innodb_system_libs)
+  other_configures="$other_configures storage/innobase/configure"
+])
+
+MYSQL_STORAGE_ENGINE(ndbcluster, [Cluster Storage Engine],
+        [High Availability Clustered tables], [max])
+MYSQL_MODULE_DIRECTORY(ndbcluster, [storage/ndb])
+MYSQL_MODULE_STATIC(ndbcluster, [libndb.a])
+MYSQL_MODULE_ACTIONS(ndbcluster, [MYSQL_SETUP_NDBCLUSTER])
+
+MYSQL_STORAGE_ENGINE(partition, [Partition Engine],
+        [MySQL Table Partitioning Engine], [max,max-no-ndb])
+
+MYSQL_MODULE_MANDATORY(csv) dnl Used for logging
+
+dnl -- ndbcluster requires partition to be enabled
+MYSQL_MODULE_DEPENDS(ndbcluster,[partition])
+
 #####
 #####
 
@@ -672,6 +740,16 @@ MYSQL_SYS_LARGEFILE
 AC_TYPE_SIZE_T
 
 #--------------------------------------------------------------------
+# Check for requested features
+#--------------------------------------------------------------------
+
+MYSQL_CHECK_BIG_TABLES
+MYSQL_CHECK_MAX_INDEXES
+MYSQL_CHECK_REPLICATION
+
+MYSQL_CONFIGURE_PLUGINS([none])
+
+#--------------------------------------------------------------------
 # Check for system header files
 #--------------------------------------------------------------------
 
@@ -2416,74 +2494,6 @@ AC_SUBST(readline_basedir)
 AC_SUBST(readline_link)
 AC_SUBST(readline_h_ln_cmd)
 
-MYSQL_CHECK_BIG_TABLES
-MYSQL_CHECK_MAX_INDEXES
-MYSQL_CHECK_REPLICATION
-
-MYSQL_STORAGE_ENGINE(innobase,,innodb,,,,storage/innobase,ha_innodb.o,[ dnl
-  \$(top_builddir)/storage/innobase/usr/libusr.a dnl
-  \$(top_builddir)/storage/innobase/srv/libsrv.a dnl
-  \$(top_builddir)/storage/innobase/dict/libdict.a dnl
-  \$(top_builddir)/storage/innobase/que/libque.a dnl
-  \$(top_builddir)/storage/innobase/srv/libsrv.a dnl
-  \$(top_builddir)/storage/innobase/ibuf/libibuf.a dnl
-  \$(top_builddir)/storage/innobase/row/librow.a dnl
-  \$(top_builddir)/storage/innobase/pars/libpars.a dnl
-  \$(top_builddir)/storage/innobase/btr/libbtr.a dnl
-  \$(top_builddir)/storage/innobase/trx/libtrx.a dnl
-  \$(top_builddir)/storage/innobase/read/libread.a dnl
-  \$(top_builddir)/storage/innobase/usr/libusr.a dnl
-  \$(top_builddir)/storage/innobase/buf/libbuf.a dnl
-  \$(top_builddir)/storage/innobase/ibuf/libibuf.a dnl
-  \$(top_builddir)/storage/innobase/eval/libeval.a dnl
-  \$(top_builddir)/storage/innobase/log/liblog.a dnl
-  \$(top_builddir)/storage/innobase/fsp/libfsp.a dnl
-  \$(top_builddir)/storage/innobase/fut/libfut.a dnl
-  \$(top_builddir)/storage/innobase/fil/libfil.a dnl
-  \$(top_builddir)/storage/innobase/lock/liblock.a dnl
-  \$(top_builddir)/storage/innobase/mtr/libmtr.a dnl
-  \$(top_builddir)/storage/innobase/page/libpage.a dnl
-  \$(top_builddir)/storage/innobase/rem/librem.a dnl
-  \$(top_builddir)/storage/innobase/thr/libthr.a dnl
-  \$(top_builddir)/storage/innobase/sync/libsync.a dnl
-  \$(top_builddir)/storage/innobase/data/libdata.a dnl
-  \$(top_builddir)/storage/innobase/mach/libmach.a dnl
-  \$(top_builddir)/storage/innobase/ha/libha.a dnl
-  \$(top_builddir)/storage/innobase/dyn/libdyn.a dnl
-  \$(top_builddir)/storage/innobase/mem/libmem.a dnl
-  \$(top_builddir)/storage/innobase/sync/libsync.a dnl
-  \$(top_builddir)/storage/innobase/ut/libut.a dnl
-  \$(top_builddir)/storage/innobase/os/libos.a dnl
-  \$(top_builddir)/storage/innobase/ut/libut.a],[
-  AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
-  AC_SUBST(innodb_includes)
-  AC_SUBST(innodb_libs)
-  AC_SUBST(innodb_system_libs)
-  other_configures="$other_configures storage/innobase/configure"
-])
-
-MYSQL_STORAGE_ENGINE(berkeley,,berkeley-db,,,,storage/bdb,,,[
-  MYSQL_SETUP_BERKELEY_DB
-])
-MYSQL_STORAGE_ENGINE(example,,,,,,storage/example,no,
- \$(top_builddir)/storage/example/libexample.a,[
-  AC_CONFIG_FILES(storage/example/Makefile)
-])
-MYSQL_STORAGE_ENGINE(archive,,,,,,storage/archive,,
- \$(top_builddir)/storage/archive/libarchive.a, [
-  AC_CONFIG_FILES(storage/archive/Makefile)
-])
-MYSQL_STORAGE_ENGINE(csv,,,"yes",,tina_hton,storage/csv,no,
-  \$(top_builddir)/storage/csv/libcsv.a,[
-  AC_CONFIG_FILES(storage/csv/Makefile)
-])
-MYSQL_STORAGE_ENGINE(blackhole)
-MYSQL_STORAGE_ENGINE(federated)
-MYSQL_STORAGE_ENGINE(ndbcluster,,ndbcluster,,,,storage/ndb,,,[
-  MYSQL_SETUP_NDBCLUSTER
-])
-MYSQL_STORAGE_ENGINE(partition,,partition)
-
 # If we have threads generate some library functions and test programs
 sql_server_dirs=
 sql_server=
@@ -2539,7 +2549,7 @@ then
   AC_SUBST(THREAD_LOBJECTS)
   server_scripts="mysqld_safe mysql_install_db"
   sql_server_dirs="strings mysys dbug extra regex"
-  mysql_se_dirs="storage/myisam storage/myisammrg storage/heap $mysql_se_dirs"
+  mysql_plugin_dirs="storage/myisam storage/myisammrg storage/heap $mysql_plugin_dirs"
   sql_server="$sql_server vio sql"
 fi
 
@@ -2555,12 +2565,9 @@ AC_SUBST(sql_server)
 AC_SUBST(thread_dirs)
 AC_SUBST(server_scripts)
 
-AC_SUBST(mysql_se_dirs)
-AC_SUBST(mysql_se_libs)
-AC_SUBST(mysql_se_objs)
-AC_SUBST(mysql_se_htons)
-AC_SUBST(mysql_se_decls)
-AC_SUBST(mysql_se_plugins)
+AC_SUBST(mysql_plugin_dirs)
+AC_SUBST(mysql_plugin_libs)
+AC_SUBST(mysql_plugin_defs)
 
 
 # Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
@@ -2602,12 +2609,15 @@ AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTION
 
 # Output results
 AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
- strings/Makefile regex/Makefile storage/Makefile storage/heap/Makefile dnl
+ strings/Makefile regex/Makefile dnl
+ storage/Makefile dnl
+ storage/archive/Makefile storage/bdb/Makefile storage/blackhole/Makefile dnl
+ storage/csv/Makefile storage/example/Makefile storage/heap/Makefile dnl
  storage/myisam/Makefile storage/myisammrg/Makefile dnl
  man/Makefile BUILD/Makefile vio/Makefile dnl
  libmysql/Makefile client/Makefile dnl
  pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
- sql/handlerton.cc sql-common/Makefile SSL/Makefile dnl
+ sql/sql_builtin.cc sql-common/Makefile SSL/Makefile dnl
  dbug/Makefile scripts/Makefile dnl
  include/Makefile sql-bench/Makefile dnl
  server-tools/Makefile server-tools/instance-manager/Makefile dnl

--- 1.135/sql/Makefile.am	2006-03-28 03:53:14 -08:00
+++ 1.136/sql/Makefile.am	2006-04-12 22:02:25 -07:00
@@ -41,7 +41,7 @@ LDADD =			$(top_builddir)/storage/myisam
 
 mysqld_LDADD =		@MYSQLD_EXTRA_LDFLAGS@ \
 			@pstack_libs@ \
-			@mysql_se_objs@ @mysql_se_libs@ \
+			@mysql_plugin_libs@ \
 			$(LDADD)  $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \
                         @yassl_libs@ @openssl_libs@
 noinst_HEADERS =	item.h item_func.h item_sum.h item_cmpfunc.h \
@@ -66,7 +66,10 @@ noinst_HEADERS =	item.h item_func.h item
 			parse_file.h sql_view.h	sql_trigger.h \
 			sql_array.h sql_cursor.h event.h event_priv.h \
 			sql_plugin.h authors.h sql_partition.h \
-                        partition_info.h partition_element.h
+                        partition_info.h partition_element.h \
+			ha_partition.h ha_innodb.h  ha_berkeley.h \
+			ha_federated.h  ha_ndbcluster.h \
+			ha_ndbcluster_binlog.h ha_ndbcluster_tables.h
 mysqld_SOURCES =	sql_lex.cc sql_handler.cc sql_partition.cc \
 			item.cc item_sum.cc item_buff.cc item_func.cc \
 			item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
@@ -102,15 +105,10 @@ mysqld_SOURCES =	sql_lex.cc sql_handler.
 			sp_cache.cc parse_file.cc sql_trigger.cc \
                         event_executor.cc event.cc event_timed.cc \
 			sql_plugin.cc sql_binlog.cc \
-			handlerton.cc sql_tablespace.cc partition_info.cc
-EXTRA_mysqld_SOURCES =	ha_innodb.cc ha_berkeley.cc ha_archive.cc \
-			ha_innodb.h  ha_berkeley.h  ha_archive.h \
-			ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \
-			ha_blackhole.h  ha_federated.h  ha_ndbcluster.h \
-			ha_ndbcluster_binlog.cc ha_ndbcluster_binlog.h \
-			ha_ndbcluster_tables.h \
-			ha_partition.cc ha_partition.h
-mysqld_DEPENDENCIES =	@mysql_se_objs@
+			sql_builtin.cc sql_tablespace.cc partition_info.cc \
+			ha_partition.cc ha_innodb.cc ha_berkeley.cc \
+			ha_federated.cc ha_ndbcluster.cc ha_ndbcluster_binlog.cc 
+
 gen_lex_hash_SOURCES =	gen_lex_hash.cc
 gen_lex_hash_LDADD =	$(LDADD) $(CXXLDFLAGS)
 mysql_tzinfo_to_sql_SOURCES =   mysql_tzinfo_to_sql.cc
@@ -162,6 +160,7 @@ sql_yacc.o:	sql_yacc.cc sql_yacc.h $(HEA
 lex_hash.h:	gen_lex_hash$(EXEEXT)
 		./gen_lex_hash$(EXEEXT) > $@
 
+# the following will eventually be moved out of this directory
 ha_berkeley.o:	ha_berkeley.cc ha_berkeley.h
 		$(CXXCOMPILE) @bdb_includes@ $(LM_CFLAGS) -c $<
 

--- 1.173/sql/ha_berkeley.cc	2006-03-29 03:27:30 -08:00
+++ 1.174/sql/ha_berkeley.cc	2006-04-12 22:02:25 -07:00
@@ -56,10 +56,14 @@
 #include <m_ctype.h>
 #include <myisampack.h>
 #include <hash.h>
+
+#ifdef WITH_BERKELEY_STORAGE_ENGINE
 #include "ha_berkeley.h"
 #include "sql_manager.h"
 #include <stdarg.h>
 
+#include <mysql/plugin.h>
+
 #define HA_BERKELEY_ROWS_IN_TABLE 10000 /* to get optimization right */
 #define HA_BERKELEY_RANGE_COUNT   100
 #define HA_BERKELEY_MAX_ROWS	  10000000 /* Max rows in table */
@@ -2725,3 +2729,17 @@ bool ha_berkeley::check_if_incompatible_
 }
 
 
+mysql_declare_plugin(berkeley)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &berkeley_hton,
+  berkeley_hton.name,
+  "MySQL AB",
+  "BerkeleyDB Storage Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
+
+#endif

--- 1.86/sql/ha_heap.cc	2006-03-31 23:38:27 -08:00
+++ 1.87/sql/ha_heap.cc	2006-04-12 22:02:26 -07:00
@@ -706,3 +706,16 @@ bool ha_heap::check_if_incompatible_data
     return COMPATIBLE_DATA_NO;
   return COMPATIBLE_DATA_YES;
 }
+
+mysql_declare_plugin(heap)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &heap_hton,
+  heap_hton.name,
+  NULL,
+  heap_hton.comment,
+  NULL,
+  NULL,
+  0
+}
+mysql_declare_plugin_end;

--- 1.175/sql/ha_myisam.cc	2006-03-29 03:27:30 -08:00
+++ 1.176/sql/ha_myisam.cc	2006-04-12 22:02:26 -07:00
@@ -31,6 +31,8 @@
 #include "../storage/myisam/rt_index.h"
 #endif
 
+#include <mysql/plugin.h>
+
 ulong myisam_recover_options= HA_RECOVER_NONE;
 
 /* bits in myisam_recover_options */
@@ -1787,3 +1789,17 @@ bool ha_myisam::check_if_incompatible_da
     return COMPATIBLE_DATA_NO;
   return COMPATIBLE_DATA_YES;
 }
+
+
+mysql_declare_plugin(myisam)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &myisam_hton,
+  myisam_hton.name,
+  "MySQL AB",
+  "MyISAM Storage Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;

--- 1.83/sql/ha_myisammrg.cc	2006-03-29 03:27:30 -08:00
+++ 1.84/sql/ha_myisammrg.cc	2006-04-12 22:02:26 -07:00
@@ -28,6 +28,8 @@
 #include "../storage/myisammrg/myrg_def.h"
 #endif
 
+#include <mysql/plugin.h>
+
 /*****************************************************************************
 ** MyISAM MERGE tables
 *****************************************************************************/
@@ -573,3 +575,16 @@ bool ha_myisammrg::check_if_incompatible
   */
   return COMPATIBLE_DATA_NO;
 }
+
+mysql_declare_plugin(myisammrg)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &myisammrg_hton,
+  myisammrg_hton.name,
+  "MySQL AB",
+  "MyISAMMRG Storage Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;

--- 1.226/sql/handler.cc	2006-03-31 03:34:20 -08:00
+++ 1.227/sql/handler.cc	2006-04-12 22:02:26 -07:00
@@ -35,6 +35,7 @@
 #define NDB_MAX_ATTRIBUTES_IN_TABLE 128
 #include "ha_ndbcluster.h"
 #endif
+
 #ifdef WITH_PARTITION_STORAGE_ENGINE
 #include "ha_partition.h"
 #endif
@@ -43,7 +44,7 @@
 #include "ha_innodb.h"
 #endif
 
-extern handlerton *sys_table_types[];
+static handlerton *installed_htons[128];
 
 #define BITMAP_STACKBUF_SIZE (128/8)
 
@@ -138,30 +139,8 @@ handlerton *ha_resolve_by_name(THD *thd,
 }
 
 
-struct plugin_find_dbtype_st
-{
-  enum legacy_db_type db_type;
-  handlerton *hton;
-};
-
-
-static my_bool plugin_find_dbtype(THD *unused, st_plugin_int *plugin,
-                                  void *arg)
-{
-  handlerton *types= (handlerton *) plugin->plugin->info;
-  if (types->db_type == ((struct plugin_find_dbtype_st *)arg)->db_type)
-  {
-    ((struct plugin_find_dbtype_st *)arg)->hton= types;
-    return TRUE;
-  }
-  return FALSE;
-}
-
-
 const char *ha_get_storage_engine(enum legacy_db_type db_type)
 {
-  struct plugin_find_dbtype_st info;
-  
   switch (db_type)
   {
   case DB_TYPE_DEFAULT:
@@ -169,13 +148,10 @@ const char *ha_get_storage_engine(enum l
   case DB_TYPE_UNKNOWN:
     return "UNKNOWN";
   default:
-    info.db_type= db_type;
-
-    if (!plugin_foreach(NULL, plugin_find_dbtype, 
-                        MYSQL_STORAGE_ENGINE_PLUGIN, &info))
+    if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT &&
+        installed_htons[db_type])
+      return installed_htons[db_type]->name;
       return "*NONE*";
-
-    return info.hton->name;
   }
 }
 
@@ -190,8 +166,6 @@ static handler *create_default(TABLE_SHA
 
 handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
 {
-  struct plugin_find_dbtype_st info;
-
   switch (db_type)
   {
   case DB_TYPE_DEFAULT:
@@ -202,12 +176,9 @@ handlerton *ha_resolve_by_legacy_type(TH
   case DB_TYPE_UNKNOWN:
     return NULL;
   default:
-    info.db_type= db_type;
-    if (!plugin_foreach(NULL, plugin_find_dbtype, 
-                        MYSQL_STORAGE_ENGINE_PLUGIN, &info))
+    if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT)
+      return installed_htons[db_type];
       return NULL;
-
-    return info.hton;
   }
 }
 
@@ -394,32 +365,77 @@ static int ha_finish_errors(void)
 }
 
 
-static void ha_was_inited_ok(handlerton *ht)
+int ha_finalize_handlerton(st_plugin_int *plugin)
 {
-  uint tmp= ht->savepoint_offset;
-  ht->savepoint_offset= savepoint_alloc_size;
-  savepoint_alloc_size+= tmp;
-  ht->slot= total_ha++;
-  if (ht->prepare)
-    total_ha_2pc++;
+  handlerton *hton;
+  DBUG_ENTER("ha_finalize_handlerton");
+
+  if (!(hton= (handlerton *) plugin->plugin->info))
+    DBUG_RETURN(1);
+
+  switch (hton->state)
+  {
+  case SHOW_OPTION_NO:
+  case SHOW_OPTION_DISABLED:
+    break;
+  case SHOW_OPTION_YES:
+    if (hton->panic && hton->panic(HA_PANIC_CLOSE))
+      DBUG_RETURN(1);
+    if (installed_htons[hton->db_type] == hton)
+      installed_htons[hton->db_type]= NULL;
+    break;
+  };
+  DBUG_RETURN(0);
 }
 
 
-int ha_initialize_handlerton(handlerton *hton)
+int ha_initialize_handlerton(st_plugin_int *plugin)
 {
+  handlerton *hton;
   DBUG_ENTER("ha_initialize_handlerton");
 
-  if (hton == NULL)
+  if (!(hton= (handlerton *) plugin->plugin->info))
     DBUG_RETURN(1);
 
-  switch (hton->state)
-  {
+  /* for the sake of sanity, we set the handlerton name to be the
+     same as the plugin name */
+  hton->name= plugin->name.str;
+
+
+  switch (hton->state) {
   case SHOW_OPTION_NO:
     break;
   case SHOW_OPTION_YES:
     if (!hton->init || !hton->init())
     {
-      ha_was_inited_ok(hton);
+      uint tmp= hton->savepoint_offset;
+      hton->savepoint_offset= savepoint_alloc_size;
+      savepoint_alloc_size+= tmp;
+      hton->slot= total_ha++;
+      if (hton->prepare)
+        total_ha_2pc++;
+        
+      /* now check the db_type for conflict */
+      if (hton->db_type <= DB_TYPE_UNKNOWN || 
+          hton->db_type >= DB_TYPE_DEFAULT ||
+          installed_htons[hton->db_type])
+      {
+        int idx= (int) DB_TYPE_FIRST_DYNAMIC;
+        
+        while (idx < (int) DB_TYPE_DEFAULT && installed_htons[idx])
+          idx++;
+
+        if (idx == (int) DB_TYPE_DEFAULT)
+        {
+          sql_print_warning("Too many storage engines!");
+          DBUG_RETURN(1);
+        }
+        if (hton->db_type != DB_TYPE_UNKNOWN)
+          sql_print_warning("Storage engine '%s' has conflicting typecode. "
+                            "Assigning value %d.", hton->name, idx);
+        hton->db_type= (enum legacy_db_type) idx;
+      }
+      installed_htons[hton->db_type]= hton;
       break;
     }
     /* fall through */
@@ -436,7 +452,7 @@ static my_bool init_handlerton(THD *unus
 {
   if (plugin->state == PLUGIN_IS_UNINITIALIZED)
   {
-    ha_initialize_handlerton((handlerton *) plugin->plugin->info);
+    ha_initialize_handlerton(plugin);
     plugin->state= PLUGIN_IS_READY;
   }
   return FALSE;
@@ -447,12 +463,15 @@ int ha_init()
 {
   int error= 0;
   total_ha= savepoint_alloc_size= 0;
+  DBUG_ENTER("ha_init");
+
+  bzero(installed_htons, sizeof(installed_htons));
 
   if (ha_init_errors())
-    return 1;
+    DBUG_RETURN(1);
 
   if (plugin_foreach(NULL, init_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0))
-    return 1;
+    DBUG_RETURN(1);
 
   DBUG_ASSERT(total_ha < MAX_HA);
   /*
@@ -462,37 +481,7 @@ int ha_init()
   */
   opt_using_transactions= total_ha>(ulong)opt_bin_log;
   savepoint_alloc_size+= sizeof(SAVEPOINT);
-  return error;
-}
-
-
-int ha_register_builtin_plugins()
-{
-  handlerton **hton;
-  uint size= 0;
-  struct st_mysql_plugin *plugin;
-  DBUG_ENTER("ha_register_builtin_plugins");
-
-  for (hton= sys_table_types; *hton; hton++)
-    size+= sizeof(struct st_mysql_plugin);
-  
-  if (!(plugin= (struct st_mysql_plugin *)
-        my_once_alloc(size, MYF(MY_WME | MY_ZEROFILL))))
-    DBUG_RETURN(1);
-  
-  for (hton= sys_table_types; *hton; hton++, plugin++)
-  {
-    plugin->type= MYSQL_STORAGE_ENGINE_PLUGIN;
-    plugin->info= *hton;
-    plugin->version= 0;
-    plugin->name= (*hton)->name;
-    plugin->author= NULL;
-    plugin->descr= (*hton)->comment;
-    
-    if (plugin_register_builtin(plugin))
-      DBUG_RETURN(1);
-  }
-  DBUG_RETURN(0);
+  DBUG_RETURN(error);
 }
 
 

--- 1.201/sql/handler.h	2006-04-11 05:06:15 -07:00
+++ 1.202/sql/handler.h	2006-04-12 22:02:26 -07:00
@@ -233,6 +233,7 @@ enum legacy_db_type
   DB_TYPE_BLACKHOLE_DB,
   DB_TYPE_PARTITION_DB,
   DB_TYPE_BINLOG,
+  DB_TYPE_FIRST_DYNAMIC=32,
   DB_TYPE_DEFAULT=127 // Must be last
 };
 
@@ -1545,8 +1546,8 @@ static inline bool ha_storage_engine_is_
 
 /* basic stuff */
 int ha_init(void);
-int ha_register_builtin_plugins();
-int ha_initialize_handlerton(handlerton *hton);
+int ha_initialize_handlerton(st_plugin_int *plugin);
+int ha_finalize_handlerton(st_plugin_int *plugin);
 
 TYPELIB *ha_known_exts(void);
 int ha_panic(enum ha_panic_function flag);

--- 1.203/sql/log.cc	2006-04-10 14:03:33 -07:00
+++ 1.204/sql/log.cc	2006-04-12 22:02:26 -07:00
@@ -34,6 +34,8 @@
 #include "message.h"
 #endif
 
+#include <mysql/plugin.h>
+
 /* max size of the log message */
 #define MAX_LOG_BUFFER_SIZE 1024
 #define MAX_USER_HOST_SIZE 512
@@ -4331,3 +4333,16 @@ err1:
   return 1;
 }
 
+
+mysql_declare_plugin(binlog)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &binlog_hton,
+  binlog_hton.name,
+  "MySQL AB",
+  "Binlog Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;

--- 1.554/sql/mysqld.cc	2006-04-10 08:54:36 -07:00
+++ 1.555/sql/mysqld.cc	2006-04-12 22:02:26 -07:00
@@ -2703,12 +2703,6 @@ static int init_common_variables(const c
     return 1;
   }
 
-  if (ha_register_builtin_plugins())
-  {
-    sql_print_error("Failed to register built-in storage engines.");
-    return 1;
-  }
-
   load_defaults(conf_file_name, groups, &argc, &argv);
   defaults_argv=argv;
   get_options(argc,argv);
@@ -3077,6 +3071,19 @@ static int init_server_components()
     }
   }
 
+  if (xid_cache_init())
+  {
+    sql_print_error("Out of memory");
+    unireg_abort(1);
+  }
+
+  /* We have to initialize the storage engines before CSV logging */
+  if (ha_init())
+  {
+    sql_print_error("Can't init databases");
+    unireg_abort(1);
+  }
+
 #ifdef WITH_CSV_STORAGE_ENGINE
   if (opt_bootstrap)
     log_output_options= LOG_FILE;
@@ -3238,17 +3245,6 @@ server.");
       INSERT ... SELECT. This will change when we have row level logging.
     */
     using_update_log=1;
-  }
-
-  if (xid_cache_init())
-  {
-    sql_print_error("Out of memory");
-    unireg_abort(1);
-  }
-  if (ha_init())
-  {
-    sql_print_error("Can't init databases");
-    unireg_abort(1);
   }
 
   /*

--- 1.180/sql/sql_delete.cc	2006-04-11 03:15:49 -07:00
+++ 1.181/sql/sql_delete.cc	2006-04-12 22:02:26 -07:00
@@ -21,7 +21,9 @@
 */
 
 #include "mysql_priv.h"
+#ifdef WITH_INNOBASE_STORAGE_ENGINE
 #include "ha_innodb.h"
+#endif
 #include "sql_select.h"
 #include "sp_head.h"
 #include "sql_trigger.h"

--- 1.326/sql/sql_show.cc	2006-04-10 10:48:53 -07:00
+++ 1.327/sql/sql_show.cc	2006-04-12 22:02:26 -07:00
@@ -111,6 +111,10 @@ static my_bool show_plugins(THD *thd, st
   CHARSET_INFO *cs= system_charset_info;
   char version_buf[20];
 
+  /* we normally hide all the built-in plugins */
+  if (!plugin->plugin_dl && !thd->lex->verbose)
+    return 0;
+
   restore_record(table, s->default_values);
 
   table->field[0]->store(plugin->name.str, plugin->name.length, cs);
@@ -3000,43 +3004,50 @@ int fill_schema_charsets(THD *thd, TABLE
 }
 
 
-int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond)
+static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin,
+                                   void *ptable)
 {
+  TABLE *table= (TABLE *) ptable;
+  handlerton *hton= (handlerton *) plugin->plugin->info;
   const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
-  TABLE *table= tables->table;
   CHARSET_INFO *scs= system_charset_info;
-  handlerton **types;
-
-  DBUG_ENTER("fill_schema_engines");
+  DBUG_ENTER("iter_schema_engines");
 
-  for (types= sys_table_types; *types; types++)
+  if (!(hton->flags & HTON_HIDDEN))
   {
-    if ((*types)->flags & HTON_HIDDEN)
-      continue;
-
     if (!(wild && wild[0] &&
-          wild_case_compare(scs, (*types)->name,wild)))
+          wild_case_compare(scs, hton->name,wild)))
     {
       const char *tmp;
       restore_record(table, s->default_values);
 
-      table->field[0]->store((*types)->name, strlen((*types)->name), scs);
-      tmp= (*types)->state ? "DISABLED" : "ENABLED";
+      table->field[0]->store(hton->name, strlen(hton->name), scs);
+      tmp= hton->state ? "DISABLED" : "ENABLED";
       table->field[1]->store( tmp, strlen(tmp), scs);
-      table->field[2]->store((*types)->comment, strlen((*types)->comment),
scs);
-      tmp= (*types)->commit ? "YES" : "NO";
+      table->field[2]->store(hton->comment, strlen(hton->comment), scs);
+      tmp= hton->commit ? "YES" : "NO";
       table->field[3]->store( tmp, strlen(tmp), scs);
-      tmp= (*types)->prepare ? "YES" : "NO";
+      tmp= hton->prepare ? "YES" : "NO";
       table->field[4]->store( tmp, strlen(tmp), scs);
-      tmp= (*types)->savepoint_set ? "YES" : "NO";
+      tmp= hton->savepoint_set ? "YES" : "NO";
       table->field[5]->store( tmp, strlen(tmp), scs);
 
       if (schema_table_store_record(thd, table))
         DBUG_RETURN(1);
     }
   }
-
   DBUG_RETURN(0);
+}
+
+
+int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
+  TABLE *table= tables->table;
+  CHARSET_INFO *scs= system_charset_info;
+
+  return plugin_foreach(thd, iter_schema_engines, 
+                        MYSQL_STORAGE_ENGINE_PLUGIN, table);
 }
 
 

--- 1.488/sql/sql_yacc.yy	2006-04-10 10:48:53 -07:00
+++ 1.489/sql/sql_yacc.yy	2006-04-12 22:02:26 -07:00
@@ -8173,7 +8173,7 @@ show_param:
             if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES))
               YYABORT;
 	  }
-        | PLUGIN_SYM
+        | opt_full PLUGIN_SYM
 	  {
 	    LEX *lex= Lex;
 	    WARN_DEPRECATED(yythd, "5.2", "SHOW PLUGIN", "'SHOW PLUGINS'");

--- 1.4/config/ac-macros/storage.m4	2006-01-19 13:40:51 -08:00
+++ 1.5/BitKeeper/deleted/.del-storage.m4~24bf2fffdaa328ad	2006-04-12 21:40:35 -07:00
@@ -1,55 +1,157 @@
 dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_STORAGE_ENGINE
+dnl Macro: MYSQL_STATIC_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 &builtin_xxx, to the list of static plugins
 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 ---------------------------------------------------------------------------
+dnl Macro: MYSQL_PLUGIN_STORAGE_ENGINE
+dnl
+dnl What it does:
+dnl   creates --with-xxx configure option
+dnl   creates --with-xxx-plugin configure option
+dnl   creates --with-xxx-shared configure option
+dnl   adds HAVE_XXX to config.h
+dnl   appends &builtin_xxx, to the list of static plugins
+dnl   appends a dir to the list of source directories
+dnl
+dnl  all names above are configurable with reasonable defaults.
+dnl
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([MYSQL_PLUGIN_STORAGE_ENGINE],
+[_MYSQL_PLUGIN_STORAGE_ENGINE(
+[$1], 
+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], [storage/$1]),                 dnl default path
+[$6]
+)])
+
+AC_DEFUN([MYSQL_STATIC_STORAGE_ENGINE],
+[_MYSQL_STATIC_STORAGE_ENGINE(
+[$1], 
+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], [storage/$1]),                 dnl default path
+[$6]
+)])
+
+
+dnl ---------------------------------------------------------------------------
+
+
+AC_DEFUN([_MYSQL_PLUGIN_STORAGE_ENGINE],
+[__MYSQL_PLUGIN_STORAGE_ENGINE(
+[$1], [$2], [$3], [$4], [$5], 
+[WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE], 
+m4_bpatsubst([$3], -, _), [$6]
+)])
+
+
+AC_DEFUN([__MYSQL_PLUGIN_STORAGE_ENGINE],
+[_CHECK_STORAGE_ENGINE(
+[$1], [$2], [$3], [$4], [$5], [$6], [$7], [$8],
+[AC_ARG_WITH([$3-shared], AS_HELP_STRING([--with-$3-shared],
+             [build $2 as a shared library (default is no)]),
+             [], [ [with_$7_shared]=['no']])
+ AC_ARG_WITH([$3-plugin], AS_HELP_STRING([--with-$3-plugin],
+             [build $2 as a plugin module, setting this option to yes implies
--with-$3-shared (default is no)]),
+             [], [ [with_$7_plugin]=['no']])],
+[AC_CACHE_CHECK([whether to build $2 as a plugin module],
+                [mysql_cv_use_$7_plugin], 
+                [mysql_cv_use_$7_plugin]=[$with_$7_plugin])
+ if test "[$mysql_cv_use_$7_plugin]" == "yes"; then
+   [mysql_cv_use_$7_shared]="yes"
+ fi
+ AC_CACHE_CHECK([whether to build $2 as a shared library],
+                [mysql_cv_use_$7_shared],
+                [mysql_cv_use_$7_shared]=[$with_$7_shared])]
+)])
+
 
-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_STATIC_STORAGE_ENGINE],
+[_CHECK_STORAGE_ENGINE(
+[$1], [$2], [$3], [$4], [$5], 
+[WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE], 
+m4_bpatsubst([$3], -, _), [$6], [],
+[[mysql_cv_use_]m4_bpatsubst([$3], -, _)[_plugin]="no"
+ [mysql_cv_use_]m4_bpatsubst([$3], -, _)[_shared]="no"]
 )])
 
-AC_DEFUN([_MYSQL_STORAGE_ENGINE],
+
+dnl ---------------------------------------------------------------------------
+
+
+AC_DEFUN([STORAGE_ENGINE_BADOPT],
+[AC_MSG_ERROR([Invalid option for --with-$1. See the Installation chapter in the
Reference Manual.])])
+
+
+AC_DEFUN([_CHECK_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"
+            [], [ [with_$7]=['$4']])
+$9
+
+AC_CACHE_CHECK([whether to use $2], [mysql_cv_use_$7],
+               [mysql_cv_use_$7]=[$with_$7])
+
+AH_TEMPLATE([$6], [Build $2])
+
+[ha_$1_static_target]=""
+[ha_$1_shared_target]=""
+
+if test "[$mysql_cv_use_$7]" == "yes"; then
+  [ha_$1_libs]="no"
+
+  $10
+
+  if test "[$mysql_cv_use_$7_shared]" == "no"; then       
+    [ha_$1_target]="lib$1.a"
+    [ha_$1_static_target]="[$ha_$1_target]"
+  elif test "[$mysql_cv_use_$7_shared]" == "yes"; then
+    [ha_$1_target]="ha_$1.la"
+    [ha_$1_shared_target]="[$ha_$1_target]"
+  else
+    STORAGE_ENGINE_BADOPT([$3-shared])
   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
+
+  if test "[$5]" != "no"; then
+    mysql_se_dirs="$mysql_se_dirs $5"
+  fi
+
+  if test "[$mysql_cv_use_$7_plugin]" == "no"; then
+    AC_DEFINE([$6])
+    if test "[$ha_$1_target]" != "no" -a "[$5]" != "no"; then
+      [ha_$1_libs]="\$(top_builddir)/$5/[$ha_$1_target]"
+    fi
+    mysql_builtin_plugins="[builtin_$1_plugin], $mysql_builtin_plugins"
+  elif test "[$mysql_cv_use_$7_plugin]" != "yes" -o \
+            "[$mysql_cv_use_$7_shared]" == "no"; then
+    STORAGE_ENGINE_BADOPT([$3-plugin])
+  fi  
+
+  $8
+  
+  if test "[$ha_$1_libs]" != "no"; then
+    mysql_se_libs="$mysql_se_libs [$ha_$1_libs]"
+  fi
+
+elif test "[$mysql_cv_use_$7]" != "no"; then
+  STORAGE_ENGINE_BADOPT([$3])
 fi
+
+AC_SUBST([ha_$1_static_target])
+AC_SUBST([ha_$1_shared_target])
+
 ])
+
 
 dnl ---------------------------------------------------------------------------
--- New file ---
+++ config/ac-macros/plugins.m4	06/04/12 22:02:27
dnl ===========================================================================
dnl Support for plugable mysql server modules
dnl ===========================================================================
dnl
dnl WorkLog#3201
dnl
dnl Framework for pluggable static and dynamic modules for mysql
dnl
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE
dnl
dnl Syntax:
dnl   MYSQL_MODULE([name],[Plugin module name],
dnl                [Plugin module description],
dnl                [group,group...])
dnl   
dnl What it does:
dnl   First declaration for a plugin module (mandatory).
dnl   Adds module as member to configuration groups (if specified)
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE],[ dnl
 _MYSQL_MODULE(
  [$1],
  [__MYSQL_MODULE_]AS_TR_CPP([$1])[__],
  m4_default([$2], [$1 plugin]),
  m4_default([$3], [plugin for $1]),
  m4_default([$4], []),
 ) dnl
])

AC_DEFUN([_MYSQL_MODULE],[ dnl
 m4_ifdef([$2], [ dnl
  AC_FATAL([[Duplicate MYSQL_MODULE declaration for ]][$3]) dnl
 ],[ dnl 
  m4_define([$2], [$1]) dnl
  _MYSQL_PLUGAPPEND([__mysql_plugin_list__],[$1]) dnl
  AC_DEFUN([MYSQL_MODULE_NAME_]AS_TR_CPP([$1]), [$3]) dnl
  AC_DEFUN([MYSQL_MODULE_DESC_]AS_TR_CPP([$1]), [$4]) dnl
  ifelse([$5], [], [], [ dnl
   _MYSQL_PLUGAPPEND_OPTS([$1], $5) dnl
  ]) dnl
 ]) dnl
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_STORAGE_ENGINE
dnl
dnl What it does:
dnl   Short cut for storage engine declarations
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_STORAGE_ENGINE],[ dnl
 MYSQL_MODULE([$1], [$2], [$3], [[$4]]) dnl
 MYSQL_MODULE_DEFINE([$1], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]) dnl
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE_DEFINE
dnl
dnl What it does:
dnl   When a plugin module is to be statically linked, define the C macro
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE_DEFINE],[ dnl
 REQUIRE_PLUGIN([$1]) dnl
 AC_DEFUN([MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]), [$2]) dnl
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE_DIRECTORY
dnl
dnl What it does:
dnl   Adds a directory to the build process
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE_DIRECTORY],[ dnl
 REQUIRE_PLUGIN([$1]) dnl
 AC_DEFUN([MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]), [$2]) dnl
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE_STATIC
dnl
dnl What it does:
dnl   Declare the name for the static library 
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE_STATIC],[ dnl
 REQUIRE_PLUGIN([$1]) dnl
 AC_DEFUN([MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]), [$2]) dnl
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE_DYNAMIC
dnl
dnl What it does:
dnl   Declare the name for the shared library
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE_DYNAMIC],[ dnl
 REQUIRE_PLUGIN([$1]) dnl
 AC_DEFUN([MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]), [$2]) dnl
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE_MANDATORY
dnl
dnl What it does:
dnl   Marks the specified plugin as a mandatory module
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE_MANDATORY],[ dnl
 REQUIRE_PLUGIN([$1]) dnl
 _MYSQL_MODULE_MANDATORY([$1],
  [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1])
 ) dnl
])

AC_DEFUN([_MYSQL_MODULE_MANDATORY],[ dnl
 m4_define([$2], [yes]) dnl
 m4_ifdef([$3], [ dnl
  AC_WARNING([syntax],[Mandatory plugin $1 has been disabled]) dnl
  m4_undefine([$2]) dnl
 ]) dnl
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE_DISABLED
dnl
dnl What it does:
dnl   Marks the specified plugin as a disabled module
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE_DISABLED],[ dnl
 REQUIRE_PLUGIN([$1]) dnl
 _MYSQL_MODULE_DISABLED([$1], 
  [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1])
 ) dnl
])

AC_DEFUN([_MYSQL_MODULE_DISABLED],[ dnl
 m4_define([$2], [yes]) dnl
 m4_ifdef([$3], [ dnl
  AC_FATAL([attempt to disable mandatory plugin $1]) dnl
  m4_undefine([$2]) dnl
 ]) dnl
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE_DEPENDS
dnl
dnl What it does:
dnl   
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE_DEPENDS],[ dnl
 REQUIRE_PLUGIN([$1]) dnl
 ifelse($#, 0, [], $#, 1, [ dnl
  AC_FATAL([[bad number of arguments]]) dnl
 ], $#, 2, [ dnl
  _MYSQL_MODULE_DEPEND([$1],[$2]) dnl
 ],[ dnl
  _MYSQL_MODULE_DEPEND([$1],[$2]) dnl
  MYSQL_MODULE_DEPENDS([$1], m4_shift(m4_shift($@))) dnl
 ])
])

AC_DEFUN([_MYSQL_MODULE_DEPEND],[ dnl
 REQUIRE_PLUGIN([$2]) dnl
 dnl do some more stuff here,
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_MODULE_ACTIONS
dnl
dnl What it does:
dnl   Declares additional actions required to configure the module
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_MODULE_ACTIONS],[ dnl
 REQUIRE_PLUGIN([$1]) dnl
 m4_ifdef([$2],[ dnl
   m4_define([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]),m4_defn([$2])) dnl
 ],[ dnl
   AC_DEFUN([MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]), [$2]) dnl
 ])
])


dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CONFIGURE_PLUGINS
dnl
dnl What it does:
dnl   Called last, emits all required shell code to configure the modules
dnl
dnl ---------------------------------------------------------------------------

AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ dnl
 m4_ifdef([__mysql_plugin_configured__],[ dnl
   AC_FATAL([cannot call [MYSQL_CONFIGURE_PLUGINS] multiple times]) dnl
 ],[ dnl
   m4_define([__mysql_plugin_configured__],[done]) dnl
   m4_ifdef([__mysql_plugin_list__],[ dnl
    _MYSQL_CHECK_PLUGIN_ARGS([none])
    _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
   ]) dnl
 ]) dnl
])

AC_DEFUN([_MYSQL_CONFIGURE_PLUGINS],[ dnl
 ifelse($#, 0, [], $#, 1, [ dnl
  _MYSQL_CHECK_PLUGIN([$1])
 ],[ dnl
  _MYSQL_CHECK_PLUGIN([$1])
  _MYSQL_CONFIGURE_PLUGINS(m4_shift($@)) dnl
 ])
])

AC_DEFUN([_MYSQL_CHECK_PLUGIN],[ dnl
 _DO_MYSQL_CHECK_PLUGIN(
  [$1],
  [$1-plugin],
  [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])
 ) dnl
])

AC_DEFUN([_DO_MYSQL_CHECK_PLUGIN],[ dnl
 m4_ifdef([$5],[ dnl
  AH_TEMPLATE($5, [Include ]$4[ into mysqld])
 ])
 AC_MSG_CHECKING([whether to use ]$3)
 m4_ifdef([$10],[ dnl
  AC_MSG_RESULT([disabled])
 ],[ dnl
  m4_ifdef([$9],[ dnl
   if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "no"; then
     AC_MSG_ERROR([cannot disable mandatory module])
   fi
   [mysql_module_]m4_bpatsubst([$1], -, _)="yes"
  ])
  if test "[$with_module_]m4_bpatsubst([$1], -, _)" != "no"; then
    if test "[$mysql_module_]m4_bpatsubst([$1], -, _)" != "yes" -a \
            "[$with_module_]m4_bpatsubst([$1], -, _)" != "yes"; then dnl
      m4_ifdef([$8],[ dnl
       m4_ifdef([$6],[
        mysql_plugin_dirs="$mysql_plugin_dirs $6" dnl
       ])
       AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], "$8")
       AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], [""])
       [with_module_]m4_bpatsubst([$1], -, _)="yes"
      ],[ dnl
       AC_MSG_RESULT([cannot build dynamically])
       [with_module_]m4_bpatsubst([$1], -, _)="no"
      ])
    else
      m4_ifdef([$7],[ dnl
       ifelse(m4_bregexp($7,[^lib[^.]\.\(a\|la\|so\)]), -1, [ dnl
        m4_ifdef([$6],[
         mysql_plugin_dirs="$mysql_plugin_dirs $6"
         mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7" dnl
        ],[ dnl
         mysql_plugin_libs="$mysql_plugin_libs $7"
        ])
       ],[ dnl
        m4_ifdef([$6],[
         mysql_plugin_dirs="$mysql_plugin_dirs $6"
         mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6" dnl
        ])
        mysql_plugin_libs="$mysql_plugin_libs [-l]m4_bregexp($7,
                      [^lib\([^.]\)\.\(a\|la\|so\)],[\1])"
       ])
       m4_ifdef([$5],[ dnl
        AC_DEFINE($5) dnl
       ])
       AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], "$7")
       AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], [""])
      ],[ dnl
       m4_ifdef([$6],[ dnl
        AC_FATAL([plugin directory specified without library for ]$3)
       ],[ dnl
        m4_ifdef([$5],[
         AC_DEFINE($5)
         AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_static_target], ["yes"])
         AC_SUBST([plugin_]m4_bpatsubst([$1], -, _)[_shared_target], [""])
        ]) dnl
       ]) dnl
      ])
      mysql_plugin_defs="$mysql_plugin_defs, [builtin_]m4_bpatsubst([$2], -, _)"
      [with_module_]m4_bpatsubst([$1], -, _)="yes"
    fi
  else
    AC_MSG_RESULT([no])
  fi

  if test "[$with_module_]m4_bpatsubst([$1], -, _)" == "yes"; then
    if test "[$plugin_]m4_bpatsubst([$1], -, _)[_static_target]" != ""; then
      AC_MSG_RESULT([static])
    elif test "[$plugin_]m4_bpatsubst([$1], -, _)[_shared_target]" != ""; then
      AC_MSG_RESULT([plugin])
    else
      AC_MSG_ERROR([thats strange])
    fi
    $11
  fi
 ]) dnl
])



dnl ===========================================================================
dnl  Private helper macros
dnl ===========================================================================


AC_DEFUN([REQUIRE_PLUGIN],[ dnl
 _REQUIRE_PLUGIN([$1], [__MYSQL_MODULE_]AS_TR_CPP([$1])[__]) dnl
])

define([_REQUIRE_PLUGIN],[ dnl
 ifdef([$2],[ dnl
  ifelse($2, [$1], [], [ dnl
   AC_FATAL([[Misspelt MYSQL_MODULE declaration for ]][$1]) dnl
  ]) dnl
 ],[ dnl
  AC_FATAL([[Missing MYSQL_MODULE declaration for ]][$1]) dnl
 ])
])


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


AC_DEFUN([_MYSQL_MODULE_META_CHECK], [ifelse($#, 0, [], $#, 1, dnl
[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) dnl
], dnl
[_MYSQL_CHECK_PLUGIN_META([$1], [__mysql_]m4_bpatsubst($1, -, _)[_plugins__]) dnl
_MYSQL_MODULE_META_CHECK(m4_shift($@))]) dnl
])

AC_DEFUN([_MYSQL_CHECK_PLUGIN_META], [
  elif test "$with_modules" == "[$1]"; then dnl
m4_ifdef([$2], [
    with_modules="m4_bpatsubst($2, :, [,])" dnl
],[
    with_modules="" dnl
]) dnl
])


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


AC_DEFUN([_MYSQL_PLUGAPPEND],[ dnl
 m4_ifdef([$1],[ dnl
  m4_define([__plugin_append_tmp__], m4_defn([$1])) dnl
  m4_undefine([$1]) dnl
  m4_define([$1], __plugin_append_tmp__[:$2]) dnl
  m4_undefine([__plugin_append_tmp__]) dnl
 ],[ dnl
  m4_define([$1], [$2]) dnl
  $3
 ]) dnl
])

AC_DEFUN([_MYSQL_PLUGAPPEND_OPTS],[ dnl
 ifelse($#, 0, [], $#, 1, [ dnl
  AC_FATAL([[bad number of args]])
 ], $#, 2, [ dnl
  _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) dnl
 ],[ dnl
  _MYSQL_PLUGAPPEND_OPTONE([$1],[$2]) dnl
  _MYSQL_PLUGAPPEND_OPTS([$1], m4_shift(m4_shift($@)))
 ])
])

AC_DEFUN([_MYSQL_PLUGAPPEND_OPTONE],[ dnl
 ifelse([$2], [all], [ dnl
  AC_FATAL([[protected plugin group: all]]) dnl
 ],[ dnl
  ifelse([$2], [none], [ dnl
   AC_FATAL([[protected plugin group: none]]) dnl
  ],[ dnl
   _MYSQL_PLUGAPPEND([__mysql_$1_configs__],[$2]) dnl
   _MYSQL_PLUGAPPEND([__mysql_]m4_bpatsubst($2, -, _)[_plugins__],[$1], [ dnl
    _MYSQL_PLUGAPPEND([__mysql_metaplugin_list__],[$2]) dnl
   ]) dnl
  ]) dnl
 ]) dnl
])


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


AC_DEFUN([MYSQL_LIST_PLUGINS],[ dnl
 m4_ifdef([__mysql_plugin_list__],[ dnl
  _MYSQL_LIST_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) dnl
 ]) dnl
])

AC_DEFUN([_MYSQL_LIST_PLUGINS],[ dnl
 ifelse($#, 0, [], $#, 1, [ dnl
  MYSQL_SHOW_PLUGIN([$1]) dnl
 ],[ dnl
  MYSQL_SHOW_PLUGIN([$1]) dnl
  _MYSQL_LIST_PLUGINS(m4_shift($@)) dnl
 ]) dnl
])

AC_DEFUN([MYSQL_SHOW_PLUGIN],[ dnl
 _MYSQL_SHOW_PLUGIN(
  [$1],
  [$1-plugin],
  [MYSQL_MODULE_NAME_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DESC_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DEFINE_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DIRECTORY_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_STATIC_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DYNAMIC_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_MANDATORY_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]),
  [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1]),
  __mysql_[$1]_configs__,
 )
])

AC_DEFUN([_MYSQL_SHOW_PLUGIN],[
        === $3 plugin ===
        Module Name:      [$1]
        Description:      $4
        Build type:       _PLUGIN_BUILD_TYPE([$7],[$8]) dnl
m4_ifdef([$12],[
        Configuration:    m4_bpatsubst($12, :, [, ])]) dnl
m4_ifdef([$10],[
        Status:           disabled], [ dnl
m4_ifdef([$9],[
        Status:           mandatory])])])

AC_DEFUN([_PLUGIN_BUILD_TYPE], dnl
[m4_ifdef([$1],[ifelse($1,[no],[],[static ]m4_ifdef([$2],[and dnl
]))])[]m4_ifdef([$2],[dynamic],[m4_ifdef([$1],[],[static])])])


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


AC_DEFUN([_MYSQL_MODULE_ARGS_CHECK],[ dnl
 ifelse($#, 0, [], $#, 1, [ dnl
  _MYSQL_CHECK_PLUGIN_ARG([$1],
   [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]),
   [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) dnl
 ],[ dnl
  _MYSQL_CHECK_PLUGIN_ARG([$1],
   [MYSQL_MODULE_DISABLED_]AS_TR_CPP([$1]),
   [MYSQL_MODULE_ACTIONS_]AS_TR_CPP([$1])) dnl
  _MYSQL_MODULE_ARGS_CHECK(m4_shift($@)) dnl
 ]) dnl
])

AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARG],[ dnl
m4_ifdef([$3], [], [AC_DEFUN([$3],[ ])])
    elif test "$plugin" == "[$1]"; then dnl
m4_ifdef([$2],[
      AC_MSG_ERROR([plugin $1 is disabled]) dnl
],[
      [mysql_module_]m4_bpatsubst([$1], -, _)="yes" dnl
]) dnl
])

AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARGS],[ dnl
 AC_ARG_WITH([modules], 
  [  --with-modules=PLUGIN[[,PLUGIN...]]
                          Select plugin modules for linking into mysqld
                          May be list of modules or a configuration name
                          (default is: $1)
                          Available plugin configurations are:
                          m4_ifdef([__mysql_metaplugin_list__], dnl
[m4_bpatsubst(none:all:__mysql_metaplugin_list__, :, [, ])], dnl
[none, all])
                          Available plugin modules are:
 m4_indir([MYSQL_LIST_PLUGINS])],[], [ with_modules=['$1']])

  AC_MSG_CHECKING([requested plugin modules to configure])
  if test "$with_modules" == "all"; then
    with_modules="m4_bpatsubst(__mysql_plugin_list__, :, [,])"
  elif test "$with_modules" == "none"; then
    with_modules="" dnl
m4_ifdef([__mysql_metaplugin_list__],[ dnl
_MYSQL_MODULE_META_CHECK(m4_bpatsubst(__mysql_metaplugin_list__, :, [,])) dnl
])
  fi
  AC_MSG_RESULT(["$with_modules"])

  for plugin in `echo $with_modules | tr ",.:;" "    "`; do
    if test "$plugin" == "all" -o "$plugin" == "none"; then
      AC_MSG_ERROR([bad module name: $plugin]) dnl
_MYSQL_MODULE_ARGS_CHECK(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
    else
      AC_MSG_ERROR([unknown plugin module: $plugin])
    fi
  done 
])


dnl ===========================================================================

--- New file ---
+++ sql/sql_builtin.cc.in	06/04/12 22:02:27

#include <mysql/plugin.h>

typedef struct st_mysql_plugin builtin_plugin[];

extern builtin_plugin 
  builtin_heap_plugin, builtin_myisam_plugin, builtin_myisammrg_plugin,
  builtin_binlog_plugin@mysql_plugin_defs@;

struct st_mysql_plugin *mysqld_builtins[]=
{
  builtin_heap_plugin, builtin_myisam_plugin, 
  builtin_myisammrg_plugin@mysql_plugin_defs@,
  builtin_binlog_plugin,(struct st_mysql_plugin *)0
};


--- New file ---
+++ storage/blackhole/Makefile.am	06/04/12 22:02:27
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#called from the top level Makefile

MYSQLDATAdir =          $(localstatedir)
MYSQLSHAREdir =         $(pkgdatadir)
MYSQLBASEdir=           $(prefix)
MYSQLLIBdir=            $(pkglibdir)
INCLUDES =              -I$(top_srcdir)/include \
			-I$(top_srcdir)/regex \
			-I$(top_srcdir)/sql \
                        -I$(srcdir)
WRAPLIBS=

LDADD =

DEFS =                  @DEFS@

noinst_HEADERS =	ha_blackhole.h

EXTRA_LTLIBRARIES =	ha_blackhole.la
pkglib_LTLIBRARIES =	@plugin_blackhole_shared_target@
ha_blackhole_la_LDFLAGS=-module -rpath $(MYSQLLIBdir)
ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_blackhole_la_CFLAGS=	$(AM_CFLAGS)
ha_blackhole_la_SOURCES=ha_blackhole.cc


EXTRA_LIBRARIES =	libblackhole.a
noinst_LIBRARIES =	@plugin_blackhole_static_target@
libblackhole_a_CXXFLAGS=$(AM_CFLAGS)
libblackhole_a_CFLAGS =	$(AM_CFLAGS)
libblackhole_a_SOURCES=	ha_blackhole.cc


# Don't update the files from bitkeeper
%::SCCS/s.%


--- 1.6/storage/csv/Makefile.am	2006-02-22 11:22:50 -08:00
+++ 1.7/storage/csv/Makefile.am	2006-04-12 22:02:27 -07:00
@@ -25,15 +25,20 @@ INCLUDES =              -I$(top_builddir
 			-I$(top_srcdir)/regex \
 			-I$(top_srcdir)/sql \
                         -I$(srcdir)
-
-pkglib_LIBRARIES =	libcsv.a
-
 LDADD =
 
 DEFS =	@DEFS@
+noinst_HEADERS	  =	ha_tina.h
+
+EXTRA_LTLIBRARIES =	ha_csv.la
+pkglib_LTLIBRARIES =	@plugin_csv_shared_target@
+ha_csv_la_LDFLAGS =	-module -rpath $(MYSQLLIBdir)
+ha_csv_la_CXXFLAGS =	$(AM_CFLAGS) -DMYSQL_PLUGIN
+ha_csv_la_SOURCES =	ha_tina.cc
 
+EXTRA_LIBRARIES =	libcsv.a
+noinst_LIBRARIES =	@plugin_csv_static_target@
 libcsv_a_CXXFLAGS =	$(AM_CFLAGS)
-noinst_HEADERS = 	ha_tina.h
 libcsv_a_SOURCES =	ha_tina.cc
 
 # Don't update the files from bitkeeper

--- 1.4/config/ac-macros/ha_berkeley.m4	2005-11-07 07:24:33 -08:00
+++ 1.5/config/ac-macros/ha_berkeley.m4	2006-04-12 22:02:25 -07:00
@@ -125,7 +125,6 @@ AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [
   AC_SUBST(bdb_includes)
   AC_SUBST(bdb_libs)
   AC_SUBST(bdb_libs_with_path)
-  AC_CONFIG_FILES(storage/bdb/Makefile)
 ])
 
 AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [

--- 1.13/config/ac-macros/ha_ndbcluster.m4	2006-02-15 12:04:36 -08:00
+++ 1.14/config/ac-macros/ha_ndbcluster.m4	2006-04-12 22:02:25 -07:00
@@ -310,7 +310,9 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
 
   AC_SUBST(NDB_DEFS)
   AC_SUBST(ndb_cxxflags_fix)
+])
 
+AC_DEFUN([NDBCLUSTER_CONFIG_FILES], [
   AC_CONFIG_FILES(storage/ndb/Makefile storage/ndb/include/Makefile dnl
    storage/ndb/src/Makefile storage/ndb/src/common/Makefile dnl
    storage/ndb/docs/Makefile dnl

--- 1.85/sql/ha_archive.cc	2006-03-29 03:27:30 -08:00
+++ 1.87/storage/archive/ha_archive.cc	2006-04-12 22:02:27 -07:00
@@ -19,10 +19,13 @@
 #endif
 
 #include "mysql_priv.h"
+#include <myisam.h>
 
 #include "ha_archive.h"
 #include <my_dir.h>
 
+#include <mysql/plugin.h>
+
 /*
   First, if you want to understand storage engines you should look at 
   ha_example.cc and ha_example.h. 
@@ -216,6 +219,8 @@ static byte* archive_get_key(ARCHIVE_SHA
 bool archive_db_init()
 {
   DBUG_ENTER("archive_db_init");
+  if (archive_inited)
+    DBUG_RETURN(FALSE);
   if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
     goto error;
   if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
@@ -229,7 +234,6 @@ bool archive_db_init()
     DBUG_RETURN(FALSE);
   }
 error:
-  have_archive_db= SHOW_OPTION_DISABLED;	// If we couldn't use handler
   DBUG_RETURN(TRUE);
 }
 
@@ -237,14 +241,14 @@ error:
   Release the archive handler.
 
   SYNOPSIS
-    archive_db_end()
+    archive_db_done()
     void
 
   RETURN
     FALSE       OK
 */
 
-int archive_db_end(ha_panic_function type)
+int archive_db_done()
 {
   if (archive_inited)
   {
@@ -255,6 +259,12 @@ int archive_db_end(ha_panic_function typ
   return 0;
 }
 
+
+int archive_db_end(ha_panic_function type)
+{
+  return archive_db_done();
+}
+
 ha_archive::ha_archive(TABLE_SHARE *table_arg)
   :handler(&archive_hton, table_arg), delayed_insert(0), bulk_insert(0)
 {
@@ -781,7 +791,7 @@ int ha_archive::write_row(byte *buf)
   if (share->crashed)
       DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
 
-  statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
+  ha_statistic_increment(&SSV::ha_write_count);
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
     table->timestamp_field->set_time();
   pthread_mutex_lock(&share->mutex);
@@ -1098,8 +1108,7 @@ int ha_archive::rnd_next(byte *buf)
     DBUG_RETURN(HA_ERR_END_OF_FILE);
   scan_rows--;
 
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
   current_position= aztell(&archive);
   rc= get_row(&archive, buf);
 
@@ -1135,8 +1144,7 @@ void ha_archive::position(const byte *re
 int ha_archive::rnd_pos(byte * buf, byte *pos)
 {
   DBUG_ENTER("ha_archive::rnd_pos");
-  statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
-		      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
   current_position= (my_off_t)my_get_ptr(pos, ref_length);
   (void)azseek(&archive, current_position, SEEK_SET);
 
@@ -1320,8 +1328,8 @@ THR_LOCK_DATA **ha_archive::store_lock(T
     */
 
     if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
-         lock_type <= TL_WRITE) && !thd->in_lock_tables
-        && !thd->tablespace_op)
+         lock_type <= TL_WRITE) && !thd_in_lock_tables(thd)
+        && !thd_tablespace_op(thd))
       lock_type = TL_WRITE_ALLOW_WRITE;
 
     /* 
@@ -1332,7 +1340,7 @@ THR_LOCK_DATA **ha_archive::store_lock(T
       concurrent inserts to t2. 
     */
 
-    if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables) 
+    if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd)) 
       lock_type = TL_READ;
 
     lock.type=lock_type;
@@ -1443,11 +1451,11 @@ int ha_archive::check(THD* thd, HA_CHECK
 {
   int rc= 0;
   byte *buf; 
-  const char *old_proc_info=thd->proc_info;
+  const char *old_proc_info;
   ha_rows count= share->rows_recorded;
   DBUG_ENTER("ha_archive::check");
 
-  thd->proc_info= "Checking table";
+  old_proc_info= thd_proc_info(thd, "Checking table");
   /* Flush any waiting data */
   azflush(&(share->archive_write), Z_SYNC_FLUSH);
   share->forced_flushes++;
@@ -1472,7 +1480,7 @@ int ha_archive::check(THD* thd, HA_CHECK
 
   my_free((char*)buf, MYF(0));
 
-  thd->proc_info= old_proc_info;
+  thd_proc_info(thd, old_proc_info);
 
   if ((rc && rc != HA_ERR_END_OF_FILE) || count)  
   {
@@ -1497,3 +1505,17 @@ bool ha_archive::check_and_repair(THD *t
 
   DBUG_RETURN(repair(thd, &check_opt));
 }
+
+
+mysql_declare_plugin(archive)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &archive_hton,
+  archive_hton.name,
+  "Brian Aker, MySQL AB",
+  "Archive Storage Engine",
+  NULL, /* Plugin Init */
+  archive_db_done, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;

--- 1.42/sql/ha_archive.h	2006-02-15 00:59:20 -08:00
+++ 1.44/storage/archive/ha_archive.h	2006-04-12 22:02:27 -07:00
@@ -19,7 +19,7 @@
 #endif
 
 #include <zlib.h>
-#include "../storage/archive/azlib.h"
+#include "azlib.h"
 
 /*
   Please read ha_archive.cc first. If you are looking for more general

--- 1.42/storage/csv/ha_tina.cc	2006-04-11 03:38:16 -07:00
+++ 1.43/storage/csv/ha_tina.cc	2006-04-12 22:02:27 -07:00
@@ -1398,8 +1398,8 @@ bool ha_tina::check_if_incompatible_data
   return COMPATIBLE_DATA_YES;
 }
 
-#ifdef MYSQL_PLUGIN
-mysql_declare_plugin
+
+mysql_declare_plugin(csv)
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
   &tina_hton,
@@ -1411,4 +1411,4 @@ mysql_declare_plugin
   0x0100 /* 1.0 */,
 }
 mysql_declare_plugin_end;
-#endif
+

--- 1.34/storage/example/ha_example.cc	2006-03-28 14:34:22 -08:00
+++ 1.35/storage/example/ha_example.cc	2006-04-12 22:02:27 -07:00
@@ -726,8 +726,8 @@ int ha_example::create(const char *name,
   DBUG_RETURN(0);
 }
 
-#ifdef MYSQL_PLUGIN
-mysql_declare_plugin
+
+mysql_declare_plugin(example)
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
   &example_hton,
@@ -739,4 +739,4 @@ mysql_declare_plugin
   0x0001 /* 0.1 */,
 }
 mysql_declare_plugin_end;
-#endif
+

--- 1.29/sql/ha_blackhole.cc	2006-03-29 03:27:30 -08:00
+++ 1.31/storage/blackhole/ha_blackhole.cc	2006-04-12 22:02:27 -07:00
@@ -22,6 +22,8 @@
 #include "mysql_priv.h"
 #include "ha_blackhole.h"
 
+#include <mysql/plugin.h>
+
 /* Static declarations for handlerton */
 
 static handler *blackhole_create_handler(TABLE_SHARE *table);
@@ -250,3 +252,15 @@ int ha_blackhole::index_last(byte * buf)
   DBUG_RETURN(HA_ERR_END_OF_FILE);
 }
 
+mysql_declare_plugin(blackhole)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &blackhole_hton,
+  blackhole_hton.name,
+  "MySQL AB",
+  "Blackhole Storage Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;

--- 1.3/storage/archive/Makefile.am	2006-03-24 13:50:47 -08:00
+++ 1.4/storage/archive/Makefile.am	2006-04-12 22:02:27 -07:00
@@ -14,20 +14,48 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-INCLUDES =		-I$(top_builddir)/include -I$(top_srcdir)/include \
-			@ZLIB_INCLUDES@
+#called from the top level Makefile
 
-LDADD =			libarchive.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a \
-			@ZLIB_LIBS@
-pkglib_LIBRARIES =	libarchive.a
+MYSQLDATAdir =          $(localstatedir)
+MYSQLSHAREdir =         $(pkgdatadir)
+MYSQLBASEdir=           $(prefix)
+MYSQLLIBdir=            $(pkglibdir)
+INCLUDES =              -I$(top_srcdir)/include \
+			-I$(top_srcdir)/regex \
+			-I$(top_srcdir)/sql \
+                        -I$(srcdir) @ZLIB_INCLUDES@
+WRAPLIBS=
+
+LDADD =
+
+DEFS =                  @DEFS@
+
+noinst_HEADERS =	ha_archive.h azlib.h
 noinst_PROGRAMS	=	archive_test
+
+EXTRA_LTLIBRARIES =	ha_archive.la
+pkglib_LTLIBRARIES =	@plugin_archive_shared_target@
+ha_archive_la_LDFLAGS =	-module -rpath $(MYSQLLIBdir)
+ha_archive_la_CXXFLAGS=	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+ha_archive_la_CFLAGS =	$(AM_CFLAGS)
+ha_archive_la_SOURCES =	ha_archive.cc azio.c
+
+
+EXTRA_LIBRARIES =	libarchive.a
+noinst_LIBRARIES =	@plugin_archive_static_target@
+libarchive_a_CXXFLAGS =	$(AM_CFLAGS)
+libarchive_a_CFLAGS =	$(AM_CFLAGS)
+libarchive_a_SOURCES =	ha_archive.cc azio.c
+
+
+archive_test_SOURCES =	archive_test.c azio.c
+archive_test_CFLAGS =	$(AM_CFLAGS)
+archive_test_LDADD =	$(top_srcdir)/mysys/libmysys.a \
+			$(top_srcdir)/dbug/libdbug.a \
+			$(top_srcdir)/strings/libmystrings.a \
+			@ZLIB_LIBS@
 archive_test_LDFLAGS = @NOINST_LDFLAGS@
-noinst_HEADERS =	azlib.h
-libarchive_a_SOURCES =	azio.c
-EXTRA_DIST =		cmakelists.txt
+
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

--- 1.295/sql/ha_ndbcluster.cc	2006-04-11 05:20:55 -07:00
+++ 1.296/sql/ha_ndbcluster.cc	2006-04-12 22:02:26 -07:00
@@ -27,6 +27,7 @@
 #include "mysql_priv.h"
 
 #include <my_dir.h>
+#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
 #include "ha_ndbcluster.h"
 #include <ndbapi/NdbApi.hpp>
 #include <ndbapi/NdbScanFilter.hpp>
@@ -36,6 +37,8 @@
 #include "ha_ndbcluster_binlog.h"
 #include "ha_ndbcluster_tables.h"
 
+#include <mysql/plugin.h>
+
 #ifdef ndb_dynamite
 #undef assert
 #define assert(x) do { if(x) break; ::printf("%s %d: assert failed: %s\n", __FILE__,
__LINE__, #x); ::fflush(stdout); ::signal(SIGABRT,SIG_DFL); ::abort();
::kill(::getpid(),6); ::kill(::getpid(),9); } while (0)
@@ -10146,3 +10149,19 @@ static int ndbcluster_fill_files_table(T
   }
   DBUG_RETURN(0);
 }
+
+
+mysql_declare_plugin(ndbcluster)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &ndbcluster_hton,
+  ndbcluster_hton.name,
+  "MySQL AB",
+  "NDB Storage Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
+
+#endif

--- 1.10/storage/innobase/Makefile.am	2006-03-24 13:50:47 -08:00
+++ 1.11/storage/innobase/Makefile.am	2006-04-12 22:02:27 -07:00
@@ -79,5 +79,34 @@ EXTRA_DIST = 	include/btr0btr.h include/
 		include/ut0sort.h include/ut0ut.h include/ut0ut.ic \
 		cmakelists.txt
 
+noinst_LIBRARIES =	libinnobase.a
+libinnobase_a_LIBADD =	usr/libusr.a srv/libsrv.a dict/libdict.a \
+			que/libque.a srv/libsrv.a ibuf/libibuf.a \
+			row/librow.a pars/libpars.a btr/libbtr.a \
+			trx/libtrx.a read/libread.a usr/libusr.a \
+			buf/libbuf.a ibuf/libibuf.a eval/libeval.a \
+			log/liblog.a fsp/libfsp.a fut/libfut.a \
+			fil/libfil.a lock/liblock.a mtr/libmtr.a \
+			page/libpage.a rem/librem.a thr/libthr.a \
+			sync/libsync.a data/libdata.a mach/libmach.a \
+			ha/libha.a dyn/libdyn.a mem/libmem.a \
+			ut/libut.a os/libos.a ut/libut.a
+libinnobase_a_SOURCES =	
+
+
+libinnobase.a:		$(libinnobase_a_LIBADD)
+		-rm -f $@
+		if test "$(host_os)" = "netware" ; \
+		then \
+		  $(libmysqld_a_AR) $@ $(libinnobase_a_LIBADD) ; \
+		else \
+		  (for arc in $(libinnobase_a_LIBADD); do \
+		    arpath=`echo $$arc|sed 's|[^/]*$$||'`; \
+		    $(AR) t $$arc|xargs -n 1 find $$arpath -name; \
+		    $(AR) t $$arc|xargs -n 1 find `dirname $$arpath` -path \*/`basename $$arpath`/\*
-name; \
+		  done ) | sort -u | xargs $(AR) cq $@ ; \
+		  $(RANLIB) $@	; \
+		fi
+
 # Don't update the files from bitkeeper
 %::SCCS/s.%

--- 1.268/sql/ha_innodb.cc	2006-03-31 16:23:19 -08:00
+++ 1.269/sql/ha_innodb.cc	2006-04-12 22:02:26 -07:00
@@ -42,6 +42,7 @@ have disables the InnoDB inlining in thi
 
 #define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1))
 
+#ifdef WITH_INNOBASE_STORAGE_ENGINE
 #include "ha_innodb.h"
 
 pthread_mutex_t innobase_share_mutex,	/* to protect innobase_open_files */
@@ -7533,3 +7534,19 @@ bool ha_innobase::check_if_incompatible_
 
 	return COMPATIBLE_DATA_YES;
 }
+
+
+mysql_declare_plugin(innobase)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &innobase_hton,
+  innobase_hton.name,
+  "Innobase OY",
+  "InnoDB Storage Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
+
+#endif

--- 1.11/include/mysql/plugin.h	2006-02-14 13:56:53 -08:00
+++ 1.12/include/mysql/plugin.h	2006-04-12 22:02:25 -07:00
@@ -37,10 +37,25 @@
   be a st_mysql_plugin struct for each plugin to be declared.
 */
 
-#define mysql_declare_plugin                                          \
-int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \
-int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define __DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS)                         \
+int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION;                                  \
+int PSIZE= sizeof(struct st_mysql_plugin);                                    \
+struct st_mysql_plugin DECLS[]= {
+#else
+#define __DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS)                         \
+int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION;         \
+int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin);          \
 struct st_mysql_plugin _mysql_plugin_declarations_[]= {
+#endif
+
+#define _DECLARE_PLUGIN(NAME) \
+__DECLARE_PLUGIN(NAME, builtin_ ## NAME ## _plugin_interface_version, \
+                 builtin_ ## NAME ## _sizeof_struct_st_plugin, \
+                 builtin_ ## NAME ## _plugin)
+
+#define mysql_declare_plugin(NAME) _DECLARE_PLUGIN(NAME)
 #define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0}}
 
 /*

--- 1.17/sql/sql_plugin.cc	2006-03-29 03:27:31 -08:00
+++ 1.18/sql/sql_plugin.cc	2006-04-12 22:02:26 -07:00
@@ -19,6 +19,8 @@
 #define REPORT_TO_LOG  1
 #define REPORT_TO_USER 2
 
+extern struct st_mysql_plugin *mysqld_builtins[];
+
 char *opt_plugin_dir_ptr;
 char opt_plugin_dir[FN_REFLEN];
 LEX_STRING plugin_type_names[]=
@@ -540,6 +542,53 @@ err:
   DBUG_RETURN(1);
 }
 
+static int plugin_finalize(THD *thd, struct st_plugin_int *plugin)
+{
+  int rc;
+  DBUG_ENTER("plugin_finalize");
+  
+  if (plugin->ref_count)
+  {
+    push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+                 "Plugin is busy and will be uninstalled on shutdown");
+    goto err;
+  }
+  
+  switch (plugin->plugin->type)
+  {
+  case MYSQL_STORAGE_ENGINE_PLUGIN:
+    if (ha_finalize_handlerton(plugin))
+    {
+      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+                   "Storage engine shutdown failed. "
+                   "It will be uninstalled on shutdown");
+      sql_print_warning("Storage engine '%s' shutdown failed. "
+                        "It will be uninstalled on shutdown", plugin->name.str);
+      goto err;
+    }
+    break;
+  default:
+    break;
+  }
+
+  if (plugin->plugin->deinit)
+  {
+    if ((rc= plugin->plugin->deinit()))
+    {
+      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+                   "Plugin deinit failed. "
+                   "It will be uninstalled on shutdown");
+      sql_print_warning("Plugin '%s' deinit failed. "
+                        "It will be uninstalled on shutdown", plugin->name.str);
+      goto err;
+    }
+  }
+  
+  DBUG_RETURN(0);
+err:
+  DBUG_RETURN(1);
+}
+
 static void plugin_call_initializer(void)
 {
   uint i;
@@ -598,6 +647,8 @@ static byte *get_hash_key(const byte *bu
 int plugin_init(void)
 {
   int i;
+  struct st_mysql_plugin **builtins;
+  struct st_mysql_plugin *plugin;
   DBUG_ENTER("plugin_init");
 
   if (initialized)
@@ -617,6 +668,16 @@ int plugin_init(void)
                   get_hash_key, NULL, 0))
       goto err;
   }
+  
+  /* Register all the built-in plugins */
+  for (builtins= mysqld_builtins; *builtins; builtins++)
+  {
+    for (plugin= *builtins; plugin->info; plugin++)
+    {
+      if (plugin_register_builtin(plugin))
+        goto err;
+    }
+  }
 
   initialized= 1;
 
@@ -823,18 +884,10 @@ my_bool mysql_uninstall_plugin(THD *thd,
     goto err;
   }
 
-  if (plugin->ref_count)
-  {
-    plugin->state= PLUGIN_IS_DELETED;
-    push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
-                 "Plugin is not deleted, waiting on tables.");
-  }
-  else
-  {
-    if (plugin->plugin->deinit)
-      plugin->plugin->deinit();
+  if (!plugin_finalize(thd, plugin))
     plugin_del(name);
-  }
+  else
+    plugin->state= PLUGIN_IS_DELETED;
 
   table->field[0]->store(name->str, name->length, system_charset_info);
   table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);

--- 1.83/libmysqld/Makefile.am	2006-04-07 19:29:01 -07:00
+++ 1.84/libmysqld/Makefile.am	2006-04-12 22:02:25 -07:00
@@ -66,16 +66,15 @@ sqlsources = derror.cc field.cc field_co
 	sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
 	parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
         event_executor.cc event.cc event_timed.cc \
-        rpl_filter.cc sql_partition.cc handlerton.cc sql_plugin.cc \
+        rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
         sql_tablespace.cc \
-        rpl_injector.cc my_user.c partition_info.cc
+        rpl_injector.cc my_user.c partition_info.cc \
+        ha_innodb.cc ha_berkeley.cc \
+	ha_federated.cc ha_ndbcluster.cc \
+	ha_ndbcluster_binlog.cc \
+	ha_partition.cc
 
 libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
-EXTRA_libmysqld_a_SOURCES =	ha_innodb.cc ha_berkeley.cc ha_archive.cc \
-			ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \
-			ha_ndbcluster_binlog.cc \
-			ha_partition.cc
-libmysqld_a_DEPENDENCIES= @mysql_se_objs@
 libmysqld_a_SOURCES=
 
 sqlstoragesources =	$(EXTRA_libmysqld_a_SOURCES)
@@ -87,13 +86,12 @@ sql_yacc.cc sql_yacc.h: $(top_srcdir)/sq
 INC_LIB=	$(top_builddir)/regex/libregex.a \
 		$(top_builddir)/storage/myisam/libmyisam.a \
 		$(top_builddir)/storage/myisammrg/libmyisammrg.a \
-		$(top_builddir)/storage/archive/libarchive.a \
 		$(top_builddir)/storage/heap/libheap.a \
 		$(top_builddir)/mysys/libmysys.a \
 		$(top_builddir)/strings/libmystrings.a \
 		$(top_builddir)/dbug/libdbug.a \
 		$(top_builddir)/vio/libvio.a \
-		@mysql_se_libs@ \
+		@mysql_plugin_libs@ \
 		$(yassl_las)
 
 if HAVE_YASSL

--- 1.45/sql/ha_partition.cc	2006-04-11 06:47:55 -07:00
+++ 1.46/sql/ha_partition.cc	2006-04-12 22:02:26 -07:00
@@ -54,8 +54,11 @@
 
 #include "mysql_priv.h"
 
+#ifdef WITH_PARTITION_STORAGE_ENGINE
 #include "ha_partition.h"
 
+#include <mysql/plugin.h>
+
 static const char *ha_par_ext= ".par";
 #ifdef NOT_USED
 static int free_share(PARTITION_SHARE * share);
@@ -5487,3 +5490,19 @@ static int free_share(PARTITION_SHARE *s
   return 0;
 }
 #endif /* NOT_USED */
+
+
+mysql_declare_plugin(partition)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &partition_hton,
+  partition_hton.name,
+  "Mikael Ronstrom, MySQL AB",
+  "Partitioning Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
+
+#endif

--- 1.56/sql/ha_federated.cc	2006-03-29 03:27:30 -08:00
+++ 1.57/sql/ha_federated.cc	2006-04-12 22:02:26 -07:00
@@ -351,9 +351,13 @@
 #pragma implementation                          // gcc: Class implementation
 #endif
 
+#ifdef WITH_FEDERATED_STORAGE_ENGINE
 #include "ha_federated.h"
 
 #include "m_string.h"
+
+#include <mysql/plugin.h>
+
 /* Variables for federated share methods */
 static HASH federated_open_tables;              // To track open tables
 pthread_mutex_t federated_mutex;                // To init the hash
@@ -2804,3 +2808,18 @@ int ha_federated::execute_simple_query(c
   DBUG_RETURN(0);
 }
 
+
+mysql_declare_plugin(federated)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &federated_hton,
+  federated_hton.name,
+  "Patrick Galbraith and Brian Aker, MySQL AB",
+  "Federated Storage Engine",
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;
+
+#endif

--- 1.9/sql/partition_info.cc	2006-04-10 10:48:52 -07:00
+++ 1.10/sql/partition_info.cc	2006-04-12 22:02:26 -07:00
@@ -21,9 +21,10 @@
 #endif
 
 #include "mysql_priv.h"
-#include "ha_partition.h"
 
 #ifdef WITH_PARTITION_STORAGE_ENGINE
+#include "ha_partition.h"
+
 
 partition_info *partition_info::get_clone()
 {

--- 1.1/plugin/Makefile.am	2005-12-28 04:05:20 -08:00
+++ 1.2/plugin/Makefile.am	2006-04-12 22:02:25 -07:00
@@ -1 +1,27 @@
-SUBDIRS= fulltext
+# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+# Process this file with automake to create Makefile.in
+
+AUTOMAKE_OPTIONS =	foreign
+
+# These are built from source in the Docs directory
+EXTRA_DIST =		
+SUBDIRS =	
+DIST_SUBDIRS = . fulltext
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%

--- 1.4/plugin/fulltext/Makefile.am	2006-04-06 07:07:30 -07:00
+++ 1.5/plugin/fulltext/Makefile.am	2006-04-12 22:02:25 -07:00
@@ -1,9 +1,44 @@
 #Makefile.am example for a plugin
 
-pkglibdir=$(libdir)/mysql
-INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include
-noinst_LTLIBRARIES= mypluglib.la
-#pkglib_LTLIBRARIES= mypluglib.la
-mypluglib_la_SOURCES= plugin_example.c
-mypluglib_la_LDFLAGS= -module -rpath $(pkglibdir)
+#MYSQL_MODULE(ftexample,         [Simple Parser],
+#        [Simple full-text parser plugin])
+#MYSQL_MODULE_DIRECTORY(ftexample, [plugin/fulltext])
+#MYSQL_MODULE_STATIC(ftexample,  [libftexample.a])
+#MYSQL_MODULE_DYNAMIC(ftexample, [ft_example.la])
 
+
+#called from the top level Makefile
+
+MYSQLDATAdir =          $(localstatedir)
+MYSQLSHAREdir =         $(pkgdatadir)
+MYSQLBASEdir=           $(prefix)
+MYSQLLIBdir=            $(pkglibdir)
+INCLUDES =              -I$(top_srcdir)/include \
+			-I$(top_srcdir)/regex \
+			-I$(top_srcdir)/sql \
+                        -I$(srcdir)
+WRAPLIBS=
+
+LDADD =
+
+DEFS =                  @DEFS@
+
+noinst_HEADERS =	
+
+EXTRA_LTLIBRARIES =	ft_example.la
+pkglib_LTLIBRARIES =	@plugin_ftexample_shared_target@
+ft_example_la_LDFLAGS =	-module -rpath $(MYSQLLIBdir)
+ft_example_la_CXXFLAGS=	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+ft_example_la_CFLAGS=	$(AM_CFLAGS)
+ft_example_la_SOURCES =	plugin_example.c
+
+
+EXTRA_LIBRARIES =	libftexample.a
+noinst_LIBRARIES =	@plugin_ftexample_static_target@
+libftexample_a_CXXFLAGS=$(AM_CFLAGS)
+libftexample_a_CFLAGS =	$(AM_CFLAGS)
+libftexample_a_SOURCES=	plugin_example.c
+
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%

--- 1.8/plugin/fulltext/plugin_example.c	2006-04-07 13:35:48 -07:00
+++ 1.9/plugin/fulltext/plugin_example.c	2006-04-12 22:02:25 -07:00
@@ -216,7 +216,7 @@ static struct st_mysql_show_var simple_s
   Plugin library descriptor
 */
 
-mysql_declare_plugin
+mysql_declare_plugin(ftexample)
 {
   MYSQL_FTPARSER_PLUGIN,      /* type                            */
   &simple_parser_descriptor,  /* descriptor                      */

--- 1.57/BUILD/SETUP.sh	2006-04-06 15:25:46 -07:00
+++ 1.58/BUILD/SETUP.sh	2006-04-12 22:02:25 -07:00
@@ -146,18 +146,9 @@ static_link="$static_link --with-client-
 local_infile_configs="--enable-local-infile"
 
 
-max_configs="--with-innodb --with-berkeley-db"
-max_configs="$max_configs --with-archive-storage-engine"
-max_configs="$max_configs --with-big-tables"
-max_configs="$max_configs --with-blackhole-storage-engine"
-max_configs="$max_configs --with-federated-storage-engine"
-max_configs="$max_configs --with-csv-storage-engine"
-max_configs="$max_configs --with-example-storage-engine"
-max_configs="$max_configs --with-partition $SSL_LIBRARY"
-
-max_no_embedded_configs="$max_configs --with-ndbcluster"
-max_no_ndb_configs="$max_configs --without-ndbcluster --with-embedded-server"
-max_configs="$max_configs --with-ndbcluster --with-embedded-server"
+max_no_embedded_configs="$SSL_LIBRARY --with-modules=max"
+max_no_ndb_configs="$SSL_LIBRARY --with-modules=max-no-ndb --with-embedded-server"
+max_configs="$SSL_LIBRARY --with-modules=max --with-embedded-server"
 
 #
 # CPU and platform specific compilation flags.

--- 1.10/storage/bdb/Makefile.in	2006-03-24 13:50:47 -08:00
+++ 1.11/storage/bdb/Makefile.in	2006-04-12 22:02:27 -07:00
@@ -19,6 +19,9 @@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
+bdb_libs_with_path = @bdb_libs_with_path@
+plugin_berkeley_static_target = @plugin_berkeley_static_target@
+LN = @LN@
 
 # distdir and top_distdir are set by the calling Makefile
 
@@ -33,14 +36,20 @@ subdirs = btree build_win32 clib common 
 
 @SET_MAKE@
 
-all:
+all:    @plugin_berkeley_static_target@
+
+libdb.a:
 	cd $(bdb_build) && $(MAKE) all
+	rm -f $(srcdir)/libdb.a
+	$(LN) -sf $(top_srcdir)/$(bdb_libs_with_path) $(srcdir)/libdb.a
 
 clean:
-	cd $(bdb_build) && $(MAKE) clean
+	rm -f $(srcdir)/libdb.a
+	-cd $(bdb_build) && $(MAKE) clean
 
 distclean:
-	cd $(bdb_build) && $(MAKE) distclean
+	rm -f $(srcdir)/libdb.a
+	-cd $(bdb_build) && $(MAKE) distclean
 
 # May want to fix this, and MYSQL/configure, to install things
 install dvi check installcheck:

--- 1.41/sql/ha_ndbcluster_binlog.cc	2006-04-03 10:11:11 -07:00
+++ 1.42/sql/ha_ndbcluster_binlog.cc	2006-04-12 22:02:26 -07:00
@@ -16,6 +16,7 @@
 */
 
 #include "mysql_priv.h"
+#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
 #include "ha_ndbcluster.h"
 
 #ifdef HAVE_NDB_BINLOG
@@ -3510,3 +3511,4 @@ ndbcluster_show_status_binlog(THD* thd, 
 }
 
 #endif /* HAVE_NDB_BINLOG */
+#endif
Thread
bk commit into 5.1 tree (acurtis:1.2328)antony13 Apr