mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
0de9a4abab
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
228 lines
5.7 KiB
Text
228 lines
5.7 KiB
Text
#
|
|
# Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved.
|
|
#
|
|
# 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; version 2 of the License.
|
|
#
|
|
# 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
|
|
#
|
|
|
|
MYSQL_STORAGE_ENGINE(xtradb, xtradb, [XtraDB Storage Engine],
|
|
[XtraDB - a drop-in replacement for InnoDB], [max,max-no-ndb])
|
|
MYSQL_PLUGIN_DIRECTORY(xtradb, [storage/xtradb])
|
|
MYSQL_PLUGIN_STATIC(xtradb, [libxtradb.la])
|
|
MYSQL_PLUGIN_DYNAMIC(xtradb, [ha_xtradb.la])
|
|
MYSQL_PLUGIN_ACTIONS(xtradb, [
|
|
with_plugin_innobase=$with_plugin_xtradb # for legacy code in configure.in
|
|
AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
|
|
AC_SUBST(innodb_system_libs)
|
|
AC_CHECK_HEADERS(aio.h sched.h)
|
|
AC_CHECK_SIZEOF(int, 4)
|
|
AC_CHECK_SIZEOF(long, 4)
|
|
AC_CHECK_SIZEOF(void*, 4)
|
|
AC_CHECK_FUNCS(sched_yield fdatasync localtime_r)
|
|
AC_C_BIGENDIAN
|
|
case "$target_os" in
|
|
lin*)
|
|
CFLAGS="$CFLAGS -DUNIV_LINUX";;
|
|
hpux10*)
|
|
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
|
|
hp*)
|
|
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
|
|
aix*)
|
|
CFLAGS="$CFLAGS -DUNIV_AIX";;
|
|
irix*|osf*|sysv5uw7*|openbsd*)
|
|
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
|
|
*solaris*|*SunOS*)
|
|
CFLAGS="$CFLAGS -DUNIV_SOLARIS";;
|
|
esac
|
|
|
|
INNODB_DYNAMIC_CFLAGS="-DMYSQL_DYNAMIC_PLUGIN"
|
|
|
|
case "$target_cpu" in
|
|
x86_64)
|
|
# The AMD64 ABI forbids absolute addresses in shared libraries
|
|
;;
|
|
*86)
|
|
# Use absolute addresses on IA-32
|
|
INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
|
|
;;
|
|
esac
|
|
AC_SUBST(INNODB_DYNAMIC_CFLAGS)
|
|
|
|
AC_MSG_CHECKING(whether GCC atomic builtins are available)
|
|
# either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
|
|
AC_TRY_RUN(
|
|
[
|
|
int main()
|
|
{
|
|
long x;
|
|
long y;
|
|
long res;
|
|
char c;
|
|
|
|
x = 10;
|
|
y = 123;
|
|
res = __sync_bool_compare_and_swap(&x, x, y);
|
|
if (!res || x != y) {
|
|
return(1);
|
|
}
|
|
|
|
x = 10;
|
|
y = 123;
|
|
res = __sync_bool_compare_and_swap(&x, x + 1, y);
|
|
if (res || x != 10) {
|
|
return(1);
|
|
}
|
|
|
|
x = 10;
|
|
y = 123;
|
|
res = __sync_add_and_fetch(&x, y);
|
|
if (res != 123 + 10 || x != 123 + 10) {
|
|
return(1);
|
|
}
|
|
|
|
c = 10;
|
|
res = __sync_lock_test_and_set(&c, 123);
|
|
if (res != 10 || c != 123) {
|
|
return(1);
|
|
}
|
|
|
|
return(0);
|
|
}
|
|
],
|
|
[
|
|
AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
|
|
[GCC atomic builtins are available])
|
|
AC_MSG_RESULT(yes)
|
|
],
|
|
[
|
|
AC_MSG_RESULT(no)
|
|
]
|
|
)
|
|
|
|
AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
|
|
# either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
|
|
AC_TRY_RUN(
|
|
[
|
|
#include <pthread.h>
|
|
#include <string.h>
|
|
|
|
int main(int argc, char** argv) {
|
|
pthread_t x1;
|
|
pthread_t x2;
|
|
pthread_t x3;
|
|
|
|
memset(&x1, 0x0, sizeof(x1));
|
|
memset(&x2, 0x0, sizeof(x2));
|
|
memset(&x3, 0x0, sizeof(x3));
|
|
|
|
__sync_bool_compare_and_swap(&x1, x2, x3);
|
|
|
|
return(0);
|
|
}
|
|
],
|
|
[
|
|
AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
|
|
[pthread_t can be used by GCC atomic builtins])
|
|
AC_MSG_RESULT(yes)
|
|
],
|
|
[
|
|
AC_MSG_RESULT(no)
|
|
]
|
|
)
|
|
|
|
AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
|
|
# either define HAVE_IB_SOLARIS_ATOMICS or not
|
|
AC_CHECK_FUNCS(atomic_add_long \
|
|
atomic_cas_32 \
|
|
atomic_cas_64 \
|
|
atomic_cas_ulong,
|
|
|
|
AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
|
|
[Define to 1 if Solaris libc atomic functions \
|
|
are available])
|
|
)
|
|
|
|
AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
|
|
# either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
|
|
AC_TRY_RUN(
|
|
[
|
|
#include <pthread.h>
|
|
#include <string.h>
|
|
|
|
int main(int argc, char** argv) {
|
|
pthread_t x1;
|
|
pthread_t x2;
|
|
pthread_t x3;
|
|
|
|
memset(&x1, 0x0, sizeof(x1));
|
|
memset(&x2, 0x0, sizeof(x2));
|
|
memset(&x3, 0x0, sizeof(x3));
|
|
|
|
if (sizeof(pthread_t) == 4) {
|
|
|
|
atomic_cas_32(&x1, x2, x3);
|
|
|
|
} else if (sizeof(pthread_t) == 8) {
|
|
|
|
atomic_cas_64(&x1, x2, x3);
|
|
|
|
} else {
|
|
|
|
return(1);
|
|
}
|
|
|
|
return(0);
|
|
}
|
|
],
|
|
[
|
|
AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
|
|
[pthread_t can be used by solaris atomics])
|
|
AC_MSG_RESULT(yes)
|
|
],
|
|
[
|
|
AC_MSG_RESULT(no)
|
|
]
|
|
)
|
|
|
|
# this is needed to know which one of atomic_cas_32() or atomic_cas_64()
|
|
# to use in the source
|
|
AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
|
|
|
|
# Check for x86 PAUSE instruction
|
|
AC_MSG_CHECKING(for x86 PAUSE instruction)
|
|
# We have to actually try running the test program, because of a bug
|
|
# in Solaris on x86_64, where it wrongly reports that PAUSE is not
|
|
# supported when trying to run an application. See
|
|
# http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
|
|
# We use ib_ prefix to avoid collisoins if this code is added to
|
|
# mysql's configure.in.
|
|
AC_TRY_RUN(
|
|
[
|
|
int main() {
|
|
__asm__ __volatile__ ("pause");
|
|
return(0);
|
|
}
|
|
],
|
|
[
|
|
AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
|
|
AC_MSG_RESULT(yes)
|
|
],
|
|
[
|
|
AC_MSG_RESULT(no)
|
|
],
|
|
[
|
|
AC_MSG_RESULT(no)
|
|
]
|
|
)
|
|
])
|
|
|
|
# vim: set ft=config:
|