MySQL Internals Manual  /  Plugins  /  Autotools Plugin Macros

5.4 Autotools Plugin Macros

The following macros enable plugin support in the autotools configuration files.

  • Declaring a plugin:

MYSQL_PLUGIN(name, long-name, description [,configlist])

Each plugin is required to have MYSQL_PLUGIN() declared first. configlist is an optional argument that is a comma-separated list of configurations of which the module is a member. Example:

MYSQL_PLUGIN(ftexample, [Simple Parser], [Simple full-text parser plugin]) 
  • Declaring a storage engine plugin:

MYSQL_STORAGE_ENGINE(name, legacy-opt, long-name, description

This is a simple utility macro that calls MYSQL_PLUGIN. It performs the bare basics required to declare a storage engine plugin and provides support for handling the legacy configure command-line options. If legacy-opt is not specified, it will default to --with-name-storage-engine. Set the legacy-opt value to no if you do not want to handle any legacy option. This macro is roughly equivalent to:

MYSQL_PLUGIN(name, 'long-name, description)


MYSQL_STORAGE_ENGINE(berkeley, berkeley-db, [BerkeleyDB Storage Engine],
[Transactional Tables using BerkeleyDB], [max,max-no-ndb]) 
  • Declaring a C preprocessor variable:

MYSQL_PLUGIN_DEFINE(name, define-name) 

When a plugin will be included in a static build, this will set a preprocessor variable to 1. These preprocessor variables are defined in config.h. Example:

  • Declaring a source directory for a plugin:


Includes the specified directory into the build. If a file named configure is detected in the directory, it will be executed as part of the configure build otherwise it is assumed that there is a Makefile to be built in that directory. Currently, there is only support for plugin directories to be specified in the storage/ and plugin/ subdirectories. Example:

MYSQL_PLUGIN_DIRECTORY(archive, [storage/archive]) 
  • Declaring a static library name for a plugin:

MYSQL_PLUGIN_STATIC(name, dir-name) 

Sets the configure substitution @plugin_name_static_target@ to the supplied library name if the plugin is a static build. It also adds the library to the list of libraries to be linked into mysqld. It may either be just the name of the library (where, if there is a directory specified, the directory will be prepended for the link) or another make variable or substitution (in which case, it will be passed through as is). Example:

MYSQL_PLUGIN_STATIC(archive, [libarchive.a]) MYSQL_PLUGIN_STATIC(berkeley, [[\$(bdb_libs_with_path)]]) 
  • Declaring a dynamic library name for a plugin:

MYSQL_PLUGIN_DYNAMIC(name, dso-name) 

Sets the configure substitution @plugin_name_shared_target@ to the supplied dynamic shared object library name if the module is a dynamic build. Example:

  • Declaring a plugin as a mandatory module:


Mandatory plugins cannot be disabled. Example:

  • Declaring a plugin as disabled:


A disabled plugin will not be included in any build. If the plugin has been marked as MANDATORY, it will result in an autoconf error.

  • Declaring additional plugin configure actions:

MYSQL_PLUGIN_ACTIONS(name, configure-actions) 

This is useful if there are additional configure actions required for a plugin. The configure-actions argument may either be the name of an autoconf macro or more autoconf script. Example:

  • Declaring plugin dependencies:

MYSQL_PLUGIN_DEPENDS(name, dependencies) 

Declares all plugins, in a comma-separated list, that are required for the named plugin to be built. If the named plugin is selected, it will in turn enable all its dependencies. All plugins listed as a dependency must already have been declared with MYSQL_PLUGIN(). Example:

MYSQL_PLUGIN_DEPENDS(ndbcluster, [partition]) 
  • Performing the magic:


Actually performs the task of generating the shell scripts for configure based upon the declarations made previously. It emits the shell code necessary to check the options and sets the variables accordingly. Example:


Plugin-related configure errors:

  • When any plugin macro is called before MYSQL_PLUGIN() is declared for that plugin, configure aborts with an error.

  • When any of the plugins specified in the dependency list don't exist, configure aborts with an error.

  • When a mandatory plugin is specified in --without-plugin-PLUGIN, configure aborts with an error.

  • When a disabled plugin is specified in --with-modules=... or --with-plugin=PLUGIN, configure reports an error.

  • When an optional plugin that may only be built dynamically is specified in --with-plugins=... or --with-plugin-PLUGIN, configure emits a warning and continues to configure the plugin for dynamic build.

  • When an optional plugin that may only be built statically is specified neither in --with-plugins=... nor --without-plugin-PLUGIN, configure emits a warning but should proceed anyway.

Avoiding changes:

  • If a plugin source (which is located in a subdirectory of the storage/ or plugin/ directory) contains a file (for example, storage/example/, this file will be included as a part of This way, does not need to be modified to add a new plugin to the build.

  • A file may contain everything, particularly all MYSQL_PLUGIN_xxx macros as just described. The file does not need to specify MYSQL_PLUGIN_DIRECTORY; it is set automatically to the directory of the file.

Download this Manual
EPUB - 0.8Mb
User Comments
Sign Up Login You must be logged in to post a comment.