summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2010-11-17 13:24:20 +0100
committerunknown <knielsen@knielsen-hq.org>2010-11-17 13:24:20 +0100
commit0de9a4ababac1e7f510558dfd0bece894cf7e69c (patch)
treefbc0d0d24e490121b420145ac1f42970bfd0ea43 /config
parent7a28f61ded763f4778b5f595115a0b1fde2372a8 (diff)
downloadmariadb-git-0de9a4ababac1e7f510558dfd0bece894cf7e69c.tar.gz
MWL#74: Shared libmysqld.so library.
Switch makefiles to use libtool to build libmysqld.so, as well as all its dependencies. The previous MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() declaration is removed, as it does not work well with a libtool build. Instead, plugins that need it can specify an alternate object in MYSQL_PLUGIN_STATIC() that will be used for embedded library. The plugin must then take care itself of compiling the special object for embedded, rebuilding the source files previously listed in MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() with @plugin_embedded_defs@ in CFLAGS/CXXFLAGS. The extra target @XXX_embedded_static_target@ is available for the special object, this will be empty when --without-embedded-server. All in-tree plugins are changed to build their static targets with libtool. Additional plugins that want to work with libmysqld.so will need to be similarly modified to build with libtool (or otherwise provide an -fPIC object). Dynamically loaded plugins are not affected. The old libraries like libmysys.a, libmyisam.a and similar libraries, which were installed by `make install` though this is of little use, are still built and installed to not break package scripts etc. that expect them. These libraries are kept static to avoid introducing new .so dependencies. The patch also fixes a handfull of duplicate symbol linker errors, where we included some object twice during linking; these for one reason or another did not produce errors before but caused problems on some platforms with this patch (eg. Mac OS X linker is more strict for shared objects). This patch only does what is necessary to build libmysqld.so. There are some more cleanups that are possible now that we are using libtool more fully, which could done in subsequent patches (though we may not bother as we are switching from autotools to CMake anyway): - In libmysql_r/, we should be able to just link libmysys.la etc, instead of symlinking and re-compiling sources into the directory. - In libmysql/, we can similarly avoid symlinking and recompiling sources if we instead build a libmysys_nothread.la library with appropriate CFLAGS and link that. - In sql/, we can build a separate target libmysql_int.la with appropriate CFLAGS for embedded and use that in libmysqld/ instead of symlinking sources. - libmysys.a, libmyisam.a and similar libraries could be installed as .so also to save on code size; or alternatively could be not installed at all. client/Makefile.am: Updated for using libtool config/ac-macros/plugins.m4: Replace MUSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS with mechanism for plugins to specify alternate object for embedded. configure.in: Fix linking duplicate objects related to THREAD_LOBJECTS. dbug/Makefile.am: Updated for using libtool extra/Makefile.am: Fix relative paths. libmysqld/Makefile.am: Build libmysqld.la using libtool libmysqld/examples/Makefile.am: Updated to use libtool mysys/Makefile.am: Updated to use libtool. Fix linking duplicate objects related to THREAD_LOBJECTS. mysys/my_uuid.c: Fix conflicting global mutex name by making it static. regex/Makefile.am: Updated to use libtool sql/Makefile.am: Updated to use libtool sql/item_func.cc: Fix conflicting mutex name. sql/mysql_priv.h: Fix conflicting mutex name sql/mysqld.cc: Fix conflicting mutex name. Add missing call of my_uuid_end(). storage/archive/Makefile.am: Updated to use libtool storage/archive/plug.in: Updated to use libtool storage/blackhole/Makefile.am: Updated to use libtool storage/blackhole/plug.in: Updated to use libtool storage/csv/Makefile.am: Updated to use libtool storage/csv/plug.in: Updated to use libtool storage/example/Makefile.am: Updated to use libtool storage/federated/Makefile.am: Updated to use libtool storage/federated/plug.in: Updated to use libtool storage/federatedx/Makefile.am: Updated to use libtool storage/federatedx/plug.in: Updated to use libtool storage/heap/Makefile.am: Updated to use libtool storage/heap/plug.in: Updated to use libtool storage/innobase/Makefile.am: Updated to use libtool storage/innobase/plug.in.disabled: Updated to use libtool storage/innodb_plugin/Makefile.am: Updated to use libtool storage/maria/CMakeLists.txt: Fix linking duplicate object in maria_dump_log, causes failure on Mac OS X storage/maria/Makefile.am: Updated to use libtool Fix linking duplicate object in maria_dump_log, causes link failure on Mac OS X storage/maria/ma_loghandler.c: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/ma_loghandler.h: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/maria_dump_log.c: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/plug.in: Updated to use libtool storage/myisam/Makefile.am: Updated to use libtool storage/myisam/plug.in: Updated to use libtool storage/myisammrg/Makefile.am: Updated to use libtool storage/myisammrg/plug.in: Updated to use libtool storage/pbxt/plug.in: Updated to use libtool storage/pbxt/src/Makefile.am: Updated to use libtool storage/xtradb/Makefile.am: Updated to use libtool storage/xtradb/plug.in: Updated to use libtool strings/Makefile.am: Updated to use libtool unittest/unit.pl: Don't attempt to run libtool internal files as unit tests. vio/Makefile.am: Updated to use libtool
Diffstat (limited to 'config')
-rw-r--r--config/ac-macros/plugins.m4100
1 files changed, 57 insertions, 43 deletions
diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4
index 86481cd0aa9..8af9cacbb6d 100644
--- a/config/ac-macros/plugins.m4
+++ b/config/ac-macros/plugins.m4
@@ -115,18 +115,32 @@ dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_PLUGIN_STATIC
dnl
dnl SYNOPSIS
-dnl MYSQL_PLUGIN_STATIC([name],[libmyplugin.a])
+dnl MYSQL_PLUGIN_STATIC([name],[libmyplugin.a],[libmyplugin_embedded.a])
dnl
dnl DESCRIPTION
-dnl Declare the name for the static library
+dnl Declare the name for the static library
+dnl
+dnl Third argument is optional, only needed for special plugins that depend
+dnl on server internals and have source files that must be compiled specially
+dnl with -DEMBEDDED_LIBRARY for embedded server. If specified, the third
+dnl argument is used to link embedded server instead of the second.
dnl
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_PLUGIN_STATIC],[
MYSQL_REQUIRE_PLUGIN([$1])
m4_define([MYSQL_PLUGIN_STATIC_]AS_TR_CPP([$1]), [$2])
+ ifelse($#, 3, [
+ m4_define([MYSQL_PLUGIN_EMBEDDED_]AS_TR_CPP([$1]), [$3])
+ ])
])
+dnl ---------------------------------------------------------------------------
+dnl Substitution variable to use to compile source files specially for
+dnl embedded server.
+dnl To be used by plugins that have sources that depend on server internals.
+dnl ---------------------------------------------------------------------------
+AC_SUBST([plugin_embedded_defs], ["-DEMBEDDED_LIBRARY -DMYSQL_SERVER"])
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_PLUGIN_DYNAMIC
@@ -254,28 +268,6 @@ AC_DEFUN([MYSQL_PLUGIN_ACTIONS],[
])
dnl ---------------------------------------------------------------------------
-dnl Macro: MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS
-dnl
-dnl SYNOPSIS
-dnl MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS([name],[file name])
-dnl
-dnl DESCRIPTION
-dnl Some modules in plugins keep dependance on structures
-dnl declared in sql/ (THD class usually)
-dnl That has to be fixed in the future, but until then
-dnl we have to recompile these modules when we want to
-dnl to compile server parts with the different #defines
-dnl Normally it happens when we compile the embedded server
-dnl Thus one should mark such files in his handler using this macro
-dnl
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS],[
- MYSQL_REQUIRE_PLUGIN([$1])
- m4_define([MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS_]AS_TR_CPP([$1]), [$2])
-])
-
-dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CONFIGURE_PLUGINS
dnl
dnl SYNOPSIS
@@ -335,11 +327,25 @@ AC_DEFUN([_MYSQL_EMIT_CHECK_PLUGIN],[
[MYSQL_PLUGIN_DYNAMIC_]AS_TR_CPP([$1]),
[MYSQL_PLUGIN_MANDATORY_]AS_TR_CPP([$1]),
[MYSQL_PLUGIN_DISABLED_]AS_TR_CPP([$1]),
- [MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS_]AS_TR_CPP([$1]),
+ [MYSQL_PLUGIN_EMBEDDED_]AS_TR_CPP([$1]),
[MYSQL_PLUGIN_ACTIONS_]AS_TR_CPP([$1])
)
])
+dnl __MYSQL_EMIT_CHECK_PLUGIN arguments:
+dnl
+dnl 1 - plugin identifying name
+dnl 2 - plugin identifying name, with `-' replaced by `_'
+dnl 3 - plugin long name
+dnl 4 - plugin description
+dnl 5 - mysql_plugin_define (eg. WITH_xxx_STORAGE_ENGINE)
+dnl 6 - directory
+dnl 7 - static target (if supports static build)
+dnl 8 - dynamic target (if supports dynamic build)
+dnl 9 - mandatory flag
+dnl 10 - disabled flag
+dnl 11 - static target for libmysqld (if different from $7)
+dnl 12 - actions
AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[
m4_ifdef([$5],[
AH_TEMPLATE($5, [Include ]$4[ into mysqld])
@@ -414,6 +420,7 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[
])
AC_SUBST([plugin_]$2[_shared_target], "$8")
AC_SUBST([plugin_]$2[_static_target], [""])
+ AC_SUBST([plugin_]$2[_embedded_static_target], [""])
[with_plugin_]$2=yes
AC_MSG_RESULT([plugin])
m4_ifdef([$6],[
@@ -428,32 +435,47 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[
])
else
m4_ifdef([$7],[
- ifelse(m4_bregexp($7, [^lib[^.]+\.a$]), -2, [
-dnl change above "-2" to "0" to enable this section
-dnl Although this is "pretty", it breaks libmysqld build
- m4_ifdef([$6],[
- mysql_use_plugin_dir="$6"
- mysql_plugin_libs="$mysql_plugin_libs -L[\$(top_builddir)]/$6"
- ])
- mysql_plugin_libs="$mysql_plugin_libs dnl
-[-l]m4_bregexp($7, [^lib\([^.]+\)], [\1])"
- ], m4_bregexp($7, [^\\\$]), 0, [
+ ifelse(m4_bregexp($7, [^\\\$]), 0, [
m4_ifdef([$6],[
mysql_use_plugin_dir="$6"
])
mysql_plugin_libs="$mysql_plugin_libs $7"
+ m4_ifdef([$11],[
+ mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs $11"
+ ],[
+ mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs $7"
+ ])
], [
m4_ifdef([$6],[
mysql_use_plugin_dir="$6"
mysql_plugin_libs="$mysql_plugin_libs \$(top_builddir)/$6/$7"
+ m4_ifdef([$11],[
+ mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs \$(top_builddir)/$6/$11"
+ ],[
+ mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs \$(top_builddir)/$6/$7"
+ ])
],[
mysql_plugin_libs="$mysql_plugin_libs $7"
+ m4_ifdef([$11],[
+ mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs $11"
+ ],[
+ mysql_embedded_plugin_libs="$mysql_embedded_plugin_libs $7"
+ ])
])
])
m4_ifdef([$5],[
AC_DEFINE($5)
])
AC_SUBST([plugin_]$2[_static_target], "$7")
+ m4_ifdef([$11], [
+ if test "$with_embedded_server" = "yes"; then
+ AC_SUBST([plugin_]$2[_embedded_static_target], "$11")
+ else
+ AC_SUBST([plugin_]$2[_embedded_static_target], [""])
+ fi
+ ], [
+ AC_SUBST([plugin_]$2[_embedded_static_target], [""])
+ ])
AC_SUBST([plugin_]$2[_shared_target], [""])
],[
m4_ifdef([$6],[
@@ -470,14 +492,6 @@ dnl Although this is "pretty", it breaks libmysqld build
mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]"
[with_plugin_]$2=yes
AC_MSG_RESULT([yes])
- m4_ifdef([$11], [
- m4_foreach([plugin], [$11], [
- condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp(plugin, [[^/]+$], [\&])"
- condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp(plugin, [[^/]+\.], [\&o])"
- condition_dependent_plugin_links="$condition_dependent_plugin_links $6/plugin"
- condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp(plugin, [^.+[/$]], [\&])"
- ])
- ])
fi
fi