diff options
47 files changed, 541 insertions, 521 deletions
diff --git a/client/Makefile.am b/client/Makefile.am index ad32117ac35..a491ce364b6 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -74,8 +74,7 @@ mysqlimport_SOURCES= mysqlimport.c mysqlimport_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ - $(LIBMYSQLCLIENT_LA) \ - $(top_builddir)/mysys/libmysys.a + $(LIBMYSQLCLIENT_LA) mysqlshow_SOURCES= mysqlshow.c @@ -83,16 +82,15 @@ mysqlslap_SOURCES= mysqlslap.c mysqlslap_CFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ - $(LIBMYSQLCLIENT_LA) \ - $(top_builddir)/mysys/libmysys.a + $(LIBMYSQLCLIENT_LA) mysqltest_SOURCES= mysqltest.cc mysqltest_CXXFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ - $(LIBMYSQLCLIENT_LA) \ $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/regex/libregex.a \ + $(LIBMYSQLCLIENT_LA) \ + $(top_builddir)/regex/libregex.la $(CLIENT_THREAD_LIBS) mysql_upgrade_SOURCES= mysql_upgrade.c \ 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 diff --git a/configure.in b/configure.in index 785c7b1ca24..9a2309fc869 100644 --- a/configure.in +++ b/configure.in @@ -250,7 +250,7 @@ AC_PROG_LIBTOOL # Ensure that we have --preserve-dup-deps defines, otherwise we get link # problems of 'mysql' with CXX=g++ -LIBTOOL="$LIBTOOL --preserve-dup-deps" +#LIBTOOL="$LIBTOOL --preserve-dup-deps" AC_SUBST(LIBTOOL)dnl AC_SUBST(NM)dnl @@ -2521,9 +2521,8 @@ MYSQL_CHECK_LIBEVENT MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine], [Traditional non-transactional MySQL tables]) MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam]) -MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a]) +MYSQL_PLUGIN_STATIC(myisam, [libmyisam_s.la], [libmyisam_embedded.la]) MYSQL_PLUGIN_MANDATORY(myisam) dnl Default -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisam, [ha_myisam.cc]) MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support], [MySQL Partitioning Support], [max,max-no-ndb]) @@ -2846,9 +2845,6 @@ if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no" then AC_DEFINE([THREAD], [1], [Define if you want to have threaded code. This may be undef on client code]) - # Avoid _PROGRAMS names - THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o mf_keycaches.o waiting_threads.o" - AC_SUBST(THREAD_LOBJECTS) fi AM_CONDITIONAL(NEED_THREAD, test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no") @@ -2877,6 +2873,7 @@ AC_SUBST(server_scripts) AC_SUBST(mysql_plugin_dirs) AC_SUBST(mysql_plugin_libs) +AC_SUBST(mysql_embedded_plugin_libs) AC_SUBST(mysql_plugin_defs) diff --git a/dbug/Makefile.am b/dbug/Makefile.am index 528a6a02fbf..e8acb0ca2c0 100644 --- a/dbug/Makefile.am +++ b/dbug/Makefile.am @@ -16,10 +16,11 @@ # MA 02111-1307, USA INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a +LDADD = libdbug.a $(top_builddir)/mysys/libmysys.a $(top_builddir)/strings/libmystrings.a pkglib_LIBRARIES = libdbug.a +noinst_LTLIBRARIES = libdbug.la noinst_HEADERS = dbug_long.h -libdbug_a_SOURCES = dbug.c sanity.c +libdbug_la_SOURCES = dbug.c sanity.c EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \ user.r monty.doc dbug_add_tags.pl \ my_main.c main.c factorial.c dbug_analyze.c \ @@ -65,3 +66,7 @@ output5.r: factorial # a hack to have executable in builddir, not in srcdir tests-t: tests-t.pl cp -f $(srcdir)/tests-t.pl ./tests-t + +libdbug_a_SOURCES= +libdbug.a: libdbug.la + $(CP) .libs/libdbug.a $@ diff --git a/extra/Makefile.am b/extra/Makefile.am index 8d6d18f0031..9c66cedc013 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -15,8 +15,10 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/sql -LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ - ../dbug/libdbug.a ../strings/libmystrings.a \ +LDADD = @CLIENT_EXTRA_LDFLAGS@ \ + $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/strings/libmystrings.a \ + $(top_builddir)/dbug/libdbug.a \ $(ZLIB_LIBS) BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \ $(top_builddir)/include/sql_state.h \ diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 83af96c7b89..fdde891c81d 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -34,10 +34,10 @@ INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/sql/examples \ -I$(top_srcdir)/regex \ $(openssl_includes) @ZLIB_INCLUDES@ \ - @condition_dependent_plugin_includes@ + @condition_dependent_plugin_includes@ \ + @ndbcluster_includes@ -noinst_LIBRARIES = libmysqld_int.a -pkglib_LIBRARIES = libmysqld.a +pkglib_LTLIBRARIES = libmysqld.la SUBDIRS = . examples libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \ @@ -79,104 +79,28 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ rpl_injector.cc my_user.c partition_info.cc \ sql_servers.cc event_parse_data.cc opt_table_elimination.cc -libmysqld_int_a_SOURCES= $(libmysqld_sources) -nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources) -libmysqld_a_SOURCES= - -sqlstoragesources = $(EXTRA_libmysqld_a_SOURCES) -storagesources = @condition_dependent_plugin_modules@ -storageobjects = @condition_dependent_plugin_objects@ -storagesourceslinks = @condition_dependent_plugin_links@ - # automake misses these sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy # The following libraries should be included in libmysqld.a -INC_LIB= $(top_builddir)/regex/libregex.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/strings/libmystrings.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/vio/libvio.a \ - @NDB_SCI_LIBS@ \ - @mysql_plugin_libs@ \ +INC_LIB= $(top_builddir)/regex/libregex.la \ + $(top_builddir)/mysys/libmysys.la \ + $(top_builddir)/strings/libmystrings.la \ + $(top_builddir)/dbug/libdbug.la \ + $(top_builddir)/vio/libvio.la \ + @ndbcluster_libs@ @NDB_SCI_LIBS@ \ + @mysql_embedded_plugin_libs@ \ $(libevent_inc_libs) \ $(yassl_inc_libs) if HAVE_YASSL -yassl_inc_libs= $(top_builddir)/extra/yassl/src/.libs/libyassl.a \ - $(top_builddir)/extra/yassl/taocrypt/src/.libs/libtaocrypt.a +yassl_inc_libs= $(top_builddir)/extra/yassl/src/libyassl.la \ + $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la endif -# Storage engine specific compilation options -ha_ndbcluster.o:ha_ndbcluster.cc - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -ha_ndbcluster_cond.o:ha_ndbcluster_cond.cc - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -ha_ndbcluster_binlog.o: ha_ndbcluster_binlog.cc - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -# Until we can remove dependency on ha_ndbcluster.h -handler.o: handler.cc - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -# We need rules to compile these as no good way -# found to append fileslists that collected by configure -# to the sources list - -ha_federatedx.o:ha_federatedx.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -ha_heap.o:ha_heap.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -ha_innodb.o:ha_innodb.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -ha_myisam.o:ha_myisam.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -ha_myisammrg.o:ha_myisammrg.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - -# -# To make it easy for the end user to use the embedded library we -# generate a total libmysqld.a from all library files, - -# note - InnoDB libraries have circular dependencies, so in INC_LIB -# few libraries are present two times. Metrowerks linker doesn't like -# it at all. Traditional ar has no problems with it, but still there's no -# need to add the same file twice to the library, so 'sort -u' save us -# some time and spares unnecessary work. - -libmysqld.a: libmysqld_int.a $(INC_LIB) $(libmysqld_a_DEPENDENCIES) $(storageobjects) -if DARWIN_MWCC - mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects) -else - -rm -f libmysqld.a - if test "$(host_os)" = "netware" ; \ - then \ - $(libmysqld_a_AR) libmysqld.a $(INC_LIB) libmysqld_int.a $(storageobjects); \ - else \ - current_dir=`pwd`; \ - rm -rf tmp; mkdir tmp; \ - (for arc in $(INC_LIB) ./libmysqld_int.a; do \ - arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \ - artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \ - for F in `$(AR) t $$arc | grep -v SYMDEF`; do \ - if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \ - mkdir $$artmp; cd $$artmp > /dev/null; \ - $(AR) x ../../$$arc; \ - cd $$current_dir > /dev/null; \ - ls $$artmp/* | grep -v SYMDEF; \ - continue 2; fi; done; \ - done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a ; \ - $(AR) r libmysqld.a $(storageobjects); \ - $(RANLIB) libmysqld.a ; \ - rm -rf tmp; \ - fi -endif +libmysqld_la_SOURCES= $(libmysqld_sources) +nodist_libmysqld_la_SOURCES= $(libmysqlsources) $(sqlsources) +libmysqld_la_LIBADD = $(INC_LIB) ## XXX: any time the client interface changes, we'll need to bump ## the version info for libmysqld; however, it's possible for the @@ -184,7 +108,7 @@ endif ## libmysqlclient interface. Should we make a separate version ## string for the two? #libmysqld_la_LDFLAGS = -version-info @SHARED_LIB_VERSION@ -#CLEANFILES = $(libmysqld_la_LIBADD) libmysqld.la +#CLEANFILES = libmysqld.la BUILT_SOURCES = link_sources @@ -209,20 +133,6 @@ link_sources: @LN_CP_F@ $(top_builddir)/libmysql/$$f $$f; \ fi ; \ done; \ - if test -n "$(sqlstoragesources)" ; \ - then \ - for f in "$(sqlstoragesources)"; do \ - rm -f "$$f"; \ - @LN_CP_F@ `find $(srcdir)/../sql -name "$$f"` "$$f"; \ - done; \ - fi; \ - if test -n "$(storagesources)" ; \ - then \ - rm -f $(storagesources); \ - for f in $(storagesourceslinks); do \ - @LN_CP_F@ $(top_srcdir)/$$f . ; \ - done; \ - fi; \ rm -f client_settings.h; \ @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h \ client_settings.h; \ @@ -230,5 +140,5 @@ link_sources: clean-local: - rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlstoragesources) $(storagesources) | sed "s;\.lo;.c;g"`; \ + rm -f `echo $(sqlsources) $(libmysqlsources) | sed "s;\.lo;.c;g"`; \ rm -f client_settings.h diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am index fd37f362960..1ef216b286d 100644 --- a/libmysqld/examples/Makefile.am +++ b/libmysqld/examples/Makefile.am @@ -37,12 +37,13 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \ -I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \ $(openssl_includes) LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs) -LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \ - @NDB_SCI_LIBS@ +LDADD = @CLIENT_EXTRA_LDFLAGS@ \ + $(top_builddir)/libmysqld/libmysqld.la @LIBDL@ $(CXXLDFLAGS) \ + @ndbcluster_libs@ @NDB_SCI_LIBS@ mysqltest_embedded_LINK = $(CXXLINK) nodist_mysqltest_embedded_SOURCES = mysqltest.cc -mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a \ +mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.la \ @MYSQLD_EXTRA_LDFLAGS@ nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \ diff --git a/mysys/Makefile.am b/mysys/Makefile.am index dc0b2bfb84b..7d1c1ff062c 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -19,10 +19,11 @@ MYSQLBASEdir= $(prefix) INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \ -I$(top_srcdir)/include -I$(srcdir) pkglib_LIBRARIES = libmysys.a +noinst_LTLIBRARIES = libmysys.la LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a $(top_builddir)/dbug/libdbug.a noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h \ my_safehash.h -libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ +libmysys_la_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ mf_path.c mf_loadpath.c my_file.c \ my_open.c my_create.c my_dup.c my_seek.c my_read.c \ my_pread.c my_write.c my_getpagesize.c \ @@ -57,19 +58,22 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ my_memmem.c stacktrace.c \ my_windac.c my_access.c base64.c my_libwrap.c \ wqueue.c +libmysys_la_LDFLAGS = $(AM_LDFLAGS) @WRAPLIBS@ +libmysys_la_LIBADD = $(ZLIB_LIBS) if NEED_THREAD # mf_keycache is used only in the server, so it is safe to leave the file # out of the non-threaded library. # In fact, it will currently not compile without thread support. -libmysys_a_SOURCES += mf_keycache.c mf_keycaches.c +libmysys_la_SOURCES += thr_alarm.c thr_lock.c thr_mutex.c thr_rwlock.c \ + my_pthread.c my_thr_init.c waiting_threads.c \ + mf_keycache.c mf_keycaches.c endif EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ thr_mutex.c thr_rwlock.c waiting_threads.c \ CMakeLists.txt mf_soundex.c \ my_conio.c my_wincond.c my_winthread.c -libmysys_a_LIBADD = @THREAD_LOBJECTS@ # test_dir_DEPENDENCIES= $(LIBRARIES) # testhash_DEPENDENCIES= $(LIBRARIES) # test_charset_DEPENDENCIES= $(LIBRARIES) @@ -83,8 +87,6 @@ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \ -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \ @DEFS@ -libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@ - # I hope this always does the right thing. Otherwise this is only test programs FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ @@ -95,6 +97,10 @@ CLEANFILES = test_bitmap$(EXEEXT) test_priority_queue$(EXEEXT) \ testhash$(EXEEXT) test_gethwaddr$(EXEEXT) \ test_base64$(EXEEXT) test_thr_mutex$(EXEEXT) +libmysys_a_SOURCES= +libmysys.a: libmysys.la + $(CP) .libs/libmysys.a $@ + # # The CP .. RM stuff is to avoid problems with some compilers (like alpha ccc) # which automaticly removes the object files you use to compile a final program diff --git a/mysys/my_uuid.c b/mysys/my_uuid.c index f115806b4e9..e2372391b06 100644 --- a/mysys/my_uuid.c +++ b/mysys/my_uuid.c @@ -50,7 +50,7 @@ static ulonglong uuid_time= 0; static uchar uuid_suffix[2+6]; /* clock_seq and node */ #ifdef THREAD -pthread_mutex_t LOCK_uuid_generator; +static pthread_mutex_t LOCK_uuid_generator; #endif /* diff --git a/regex/Makefile.am b/regex/Makefile.am index 0fd62a777f6..6e46e537c4b 100644 --- a/regex/Makefile.am +++ b/regex/Makefile.am @@ -16,10 +16,10 @@ # MA 02111-1307, USA INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -noinst_LIBRARIES = libregex.a -LDADD= libregex.a $(top_builddir)/strings/libmystrings.a +noinst_LTLIBRARIES = libregex.la +LDADD= libregex.la $(top_builddir)/strings/libmystrings.la noinst_HEADERS = cclass.h cname.h regex2.h utils.h engine.c my_regex.h -libregex_a_SOURCES = regerror.c regcomp.c regexec.c regfree.c reginit.c +libregex_la_SOURCES = regerror.c regcomp.c regexec.c regfree.c reginit.c noinst_PROGRAMS = re re_SOURCES = split.c debug.c main.c re_LDFLAGS= @NOINST_LDFLAGS@ diff --git a/sql/Makefile.am b/sql/Makefile.am index 5dcbbb9815a..20eef1bb7d7 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -36,7 +36,7 @@ noinst_LTLIBRARIES= libndb.la \ SUPPORTING_LIBS = $(top_builddir)/vio/libvio.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/regex/libregex.a \ + $(top_builddir)/regex/libregex.la \ $(top_builddir)/strings/libmystrings.a mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) libndb.la LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@ diff --git a/sql/item_func.cc b/sql/item_func.cc index bc0dc60accf..65023e64313 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -6125,8 +6125,8 @@ void uuid_short_init() longlong Item_func_uuid_short::val_int() { ulonglong val; - pthread_mutex_lock(&LOCK_uuid_generator); + pthread_mutex_lock(&LOCK_short_uuid_generator); val= uuid_value++; - pthread_mutex_unlock(&LOCK_uuid_generator); + pthread_mutex_unlock(&LOCK_short_uuid_generator); return (longlong) val; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8b2cba4f9e6..5dedbfc3007 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2016,7 +2016,7 @@ extern FILE *stderror_file; extern pthread_key(MEM_ROOT**,THR_MALLOC); extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, LOCK_lock_db, LOCK_mapped_file,LOCK_user_locks, LOCK_status, - LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator, + LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator, LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock, LOCK_global_system_variables, LOCK_user_conn, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ebdf9dd7b38..c3d58349ad5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -693,7 +693,7 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count, LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received, LOCK_global_system_variables, LOCK_user_conn, LOCK_slave_list, LOCK_active_mi, - LOCK_connection_count, LOCK_uuid_generator; + LOCK_connection_count, LOCK_short_uuid_generator; /** The below lock protects access to two global server variables: max_prepared_stmt_count and prepared_stmt_count. These variables @@ -1406,6 +1406,7 @@ void clean_up(bool print_message) #ifdef HAVE_REPLICATION end_slave_list(); #endif + my_uuid_end(); delete binlog_filter; delete rpl_filter; #ifndef EMBEDDED_LIBRARY @@ -1512,7 +1513,7 @@ static void clean_up_mutexes() (void) rwlock_destroy(&LOCK_sys_init_connect); (void) rwlock_destroy(&LOCK_sys_init_slave); (void) pthread_mutex_destroy(&LOCK_global_system_variables); - (void) pthread_mutex_destroy(&LOCK_uuid_generator); + (void) pthread_mutex_destroy(&LOCK_short_uuid_generator); (void) rwlock_destroy(&LOCK_system_variables_hash); (void) pthread_mutex_destroy(&LOCK_global_read_lock); (void) pthread_mutex_destroy(&LOCK_prepared_stmt_count); @@ -3756,7 +3757,7 @@ static int init_thread_environment() (void) my_rwlock_init(&LOCK_system_variables_hash, NULL); (void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST); - (void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_short_uuid_generator, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_connection_count, MY_MUTEX_INIT_FAST); #ifdef HAVE_OPENSSL (void) pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST); diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index 254c95bf68b..1dbe101c2d6 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -33,7 +33,7 @@ DEFS = @DEFS@ noinst_HEADERS = ha_archive.h azlib.h noinst_PROGRAMS = archive_test archive_reader -EXTRA_LTLIBRARIES = ha_archive.la +EXTRA_LTLIBRARIES = libarchive.la ha_archive.la pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@ ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_archive_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN @@ -41,11 +41,10 @@ ha_archive_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_SOURCES = ha_archive.cc azio.c -EXTRA_LIBRARIES = libarchive.a -noinst_LIBRARIES = @plugin_archive_static_target@ -libarchive_a_CXXFLAGS = $(AM_CXXFLAGS) -libarchive_a_CFLAGS = $(AM_CFLAGS) -libarchive_a_SOURCES = ha_archive.cc azio.c +noinst_LTLIBRARIES = @plugin_archive_static_target@ +libarchive_la_CXXFLAGS = $(AM_CXXFLAGS) +libarchive_la_CFLAGS = $(AM_CFLAGS) +libarchive_la_SOURCES = ha_archive.cc azio.c archive_test_SOURCES = archive_test.c azio.c diff --git a/storage/archive/plug.in b/storage/archive/plug.in index 52131b12e6b..d19c29414e3 100644 --- a/storage/archive/plug.in +++ b/storage/archive/plug.in @@ -1,4 +1,4 @@ MYSQL_STORAGE_ENGINE(archive,, [Archive Storage Engine], [Archive Storage Engine], [max,max-no-ndb]) -MYSQL_PLUGIN_STATIC(archive, [libarchive.a]) +MYSQL_PLUGIN_STATIC(archive, [libarchive.la]) MYSQL_PLUGIN_DYNAMIC(archive, [ha_archive.la]) diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am index 148746a9336..6665898cae7 100644 --- a/storage/blackhole/Makefile.am +++ b/storage/blackhole/Makefile.am @@ -32,17 +32,16 @@ DEFS = @DEFS@ noinst_HEADERS = ha_blackhole.h -EXTRA_LTLIBRARIES = ha_blackhole.la +EXTRA_LTLIBRARIES = libblackhole.la ha_blackhole.la pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@ ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir) ha_blackhole_la_CXXFLAGS=-shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_SOURCES=ha_blackhole.cc -EXTRA_LIBRARIES = libblackhole.a -noinst_LIBRARIES = @plugin_blackhole_static_target@ -libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS) -libblackhole_a_SOURCES= ha_blackhole.cc +noinst_LTLIBRARIES = @plugin_blackhole_static_target@ +libblackhole_la_CXXFLAGS=$(AM_CXXFLAGS) +libblackhole_la_SOURCES= ha_blackhole.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/blackhole/plug.in b/storage/blackhole/plug.in index 725db0facba..2f3b120fa5d 100644 --- a/storage/blackhole/plug.in +++ b/storage/blackhole/plug.in @@ -1,6 +1,6 @@ MYSQL_STORAGE_ENGINE(blackhole,,[Blackhole Storage Engine], [Basic Write-only Read-never tables], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(blackhole, [storage/blackhole]) -MYSQL_PLUGIN_STATIC(blackhole, [libblackhole.a]) +MYSQL_PLUGIN_STATIC(blackhole, [libblackhole.la]) MYSQL_PLUGIN_DYNAMIC(blackhole, [ha_blackhole.la]) diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 75ad9062984..c711e4020fc 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -29,16 +29,15 @@ LDADD = DEFS = @DEFS@ noinst_HEADERS = ha_tina.h transparent_file.h -EXTRA_LTLIBRARIES = ha_csv.la +EXTRA_LTLIBRARIES = libcsv.la ha_csv.la pkglib_LTLIBRARIES = @plugin_csv_shared_target@ ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) ha_csv_la_CXXFLAGS = -shared $(AM_CXXFLAGS) -DMYSQL_PLUGIN ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc -EXTRA_LIBRARIES = libcsv.a -noinst_LIBRARIES = @plugin_csv_static_target@ -libcsv_a_CXXFLAGS = $(AM_CXXFLAGS) -libcsv_a_SOURCES = transparent_file.cc ha_tina.cc +noinst_LTLIBRARIES = @plugin_csv_static_target@ +libcsv_la_CXXFLAGS = $(AM_CXXFLAGS) +libcsv_la_SOURCES = transparent_file.cc ha_tina.cc EXTRA_DIST = CMakeLists.txt plug.in # Don't update the files from bitkeeper diff --git a/storage/csv/plug.in b/storage/csv/plug.in index bbc69680fcd..4ff32959fa2 100644 --- a/storage/csv/plug.in +++ b/storage/csv/plug.in @@ -1,5 +1,5 @@ MYSQL_STORAGE_ENGINE(csv,, [CSV Storage Engine], [Stores tables in text CSV format]) MYSQL_PLUGIN_DIRECTORY(csv, [storage/csv]) -MYSQL_PLUGIN_STATIC(csv, [libcsv.a]) +MYSQL_PLUGIN_STATIC(csv, [libcsv.la]) MYSQL_PLUGIN_MANDATORY(csv) dnl Used for logging diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index 158b58a2e4c..da80f518d13 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -32,16 +32,16 @@ DEFS = @DEFS@ noinst_HEADERS = ha_example.h -EXTRA_LTLIBRARIES = ha_example.la +EXTRA_LTLIBRARIES = libexample.la ha_example.la pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_example_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_SOURCES = ha_example.cc -EXTRA_LIBRARIES = libexample.a -noinst_LIBRARIES = @plugin_example_static_target@ -libexample_a_CXXFLAGS = $(AM_CXXFLAGS) -libexample_a_SOURCES= ha_example.cc + +noinst_LTLIBRARIES = @plugin_example_static_target@ +libexample_la_CXXFLAGS = $(AM_CXXFLAGS) +libexample_la_SOURCES= ha_example.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am index 414fb5b7d5f..290fb789a82 100644 --- a/storage/federated/Makefile.am +++ b/storage/federated/Makefile.am @@ -30,7 +30,7 @@ DEFS = @DEFS@ noinst_HEADERS = ha_federated.h -EXTRA_LTLIBRARIES = ha_federated.la +EXTRA_LTLIBRARIES = libfederated.la libfederated_embedded.la ha_federated.la pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@ ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_federated_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN @@ -38,10 +38,13 @@ ha_federated_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_SOURCES = ha_federated.cc $(top_srcdir)/mysys/string.c -EXTRA_LIBRARIES = libfederated.a -noinst_LIBRARIES = @plugin_federated_static_target@ -libfederated_a_CXXFLAGS = $(AM_CXXFLAGS) -libfederated_a_SOURCES= ha_federated.cc +noinst_LTLIBRARIES = @plugin_federated_static_target@ @plugin_federated_embedded_static_target@ +libfederated_la_CXXFLAGS = $(AM_CXXFLAGS) +libfederated_la_SOURCES= ha_federated.cc + +libfederated_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libfederated_embedded_la_CFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederated_embedded_la_SOURCES= ha_federated.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/federated/plug.in b/storage/federated/plug.in index 714888b2ebf..3db4a35de08 100644 --- a/storage/federated/plug.in +++ b/storage/federated/plug.in @@ -1,5 +1,4 @@ MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine], [Connects to tables on remote MySQL servers], []) -MYSQL_PLUGIN_STATIC(federated, [libfederated.a]) +MYSQL_PLUGIN_STATIC(federated, [libfederated.la], [libfederated_embedded.la]) MYSQL_PLUGIN_DYNAMIC(federated, [ha_federated.la]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federated, [ha_federated.cc]) diff --git a/storage/federatedx/Makefile.am b/storage/federatedx/Makefile.am index 1e76ac15266..d642ec2bb5d 100644 --- a/storage/federatedx/Makefile.am +++ b/storage/federatedx/Makefile.am @@ -17,20 +17,31 @@ DEFS = @DEFS@ noinst_HEADERS = ha_federatedx.h federatedx_probes.h -EXTRA_LTLIBRARIES = ha_federatedx.la +EXTRA_LTLIBRARIES = libfederatedx.la libfederatedx_common.la libfederatedx_embedded.la ha_federatedx.la pkgplugin_LTLIBRARIES = @plugin_federatedx_shared_target@ ha_federatedx_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_federatedx_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federatedx_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -EXTRA_LIBRARIES = libfederatedx.a -noinst_LIBRARIES = @plugin_federatedx_static_target@ -libfederatedx_a_CXXFLAGS = $(AM_CXXFLAGS) -libfederatedx_a_SOURCES= ha_federatedx.cc federatedx_txn.cc \ +noinst_LTLIBRARIES = @plugin_federatedx_static_target@ @plugin_federatedx_embedded_static_target@ +libfederatedx_common_la_CXXFLAGS = $(AM_CXXFLAGS) +libfederatedx_common_la_CFLAGS = $(AM_CFLAGS) +libfederatedx_common_la_SOURCES= federatedx_txn.cc \ federatedx_io.cc federatedx_io_null.cc \ federatedx_io_mysql.cc +libfederatedx_la_CXXFLAGS = $(AM_CFLAGS) +libfederatedx_la_CFLAGS = $(AM_CFLAGS) +libfederatedx_la_LIBADD = libfederatedx_common.la +libfederatedx_la_SOURCES= ha_federatedx.cc + +libfederatedx_embedded_la_CXXFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederatedx_embedded_la_CFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederatedx_embedded_la_LDFLAGS = $(AM_LDFLAGS) +libfederatedx_embedded_la_LIBADD = libfederatedx_common.la +libfederatedx_embedded_la_SOURCES= ha_federatedx.cc + EXTRA_DIST = CMakeLists.txt plug.in ha_federatedx.h \ federatedx_probes.h diff --git a/storage/federatedx/plug.in b/storage/federatedx/plug.in index 95afe270f4c..4a8a88e7280 100644 --- a/storage/federatedx/plug.in +++ b/storage/federatedx/plug.in @@ -1,5 +1,4 @@ MYSQL_STORAGE_ENGINE(federatedx,,[FederatedX Storage Engine], [FederatedX Storage Engine], [max,max-no-ndb]) MYSQL_PLUGIN_DYNAMIC(federatedx, [ha_federatedx.la]) -MYSQL_PLUGIN_STATIC(federatedx, [libfederatedx.a]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federatedx, [ha_federatedx.cc]) +MYSQL_PLUGIN_STATIC(federatedx, [libfederatedx.la], [libfederatedx_embedded.la]) diff --git a/storage/heap/Makefile.am b/storage/heap/Makefile.am index ec1445dea67..c896442728a 100644 --- a/storage/heap/Makefile.am +++ b/storage/heap/Makefile.am @@ -27,8 +27,11 @@ LDADD = DEFS = @DEFS@ pkglib_LIBRARIES = libheap.a +noinst_LTLIBRARIES = libheap.la libheap_s.la \ + @plugin_heap_embedded_static_target@ +EXTRA_LTLIBRARIES = libheap_embedded.la + noinst_PROGRAMS = hp_test1 hp_test2 -noinst_LIBRARIES = libheap.a hp_test1_LDFLAGS = @NOINST_LDFLAGS@ hp_test1_LDADD = libheap.a \ $(top_builddir)/mysys/libmysys.a \ @@ -40,14 +43,25 @@ hp_test2_LDADD = libheap.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a noinst_HEADERS = heapdef.h ha_heap.h -libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \ +libheap_la_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \ hp_rrnd.c hp_scan.c hp_update.c hp_write.c hp_delete.c \ hp_rsame.c hp_create.c hp_rename.c hp_rfirst.c \ hp_rnext.c hp_rlast.c hp_rprev.c hp_clear.c \ hp_rkey.c hp_block.c \ - ha_heap.cc \ hp_hash.c _check.c _rectest.c hp_static.c +libheap_s_la_SOURCES = ha_heap.cc +libheap_s_la_CFLAGS = $(AM_CFLAGS) +libheap_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libheap_s_la_LIBADD = libheap.la +libheap_embedded_la_SOURCES = ha_heap.cc +libheap_embedded_la_LIBADD = libheap.la +libheap_embedded_la_CXXFLAGS = @plugin_embedded_defs@ + +libheap_a_SOURCES= +libheap.a: libheap.la + $(CP) .libs/libheap.a $@ + EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/heap/plug.in b/storage/heap/plug.in index 50f31c60f2b..92ec01d3c88 100644 --- a/storage/heap/plug.in +++ b/storage/heap/plug.in @@ -1,7 +1,6 @@ MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine], [Volatile memory based tables]) MYSQL_PLUGIN_DIRECTORY(heap, [storage/heap]) -MYSQL_PLUGIN_STATIC(heap, [libheap.a]) +MYSQL_PLUGIN_STATIC(heap, [libheap_s.la], [libheap_embedded.la]) MYSQL_PLUGIN_MANDATORY(heap) dnl Memory tables -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(heap, [ha_heap.cc]) diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index 29ba83c0668..c2bbb98e73d 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -122,9 +122,8 @@ noinst_HEADERS= include/btr0btr.h include/btr0btr.ic \ include/ut0list.ic include/ut0wqueue.h \ include/ha_prototypes.h handler/ha_innodb.h -EXTRA_LIBRARIES= libinnobase.a -noinst_LIBRARIES= @plugin_innobase_static_target@ -libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ +noinst_LTLIBRARIES= @plugin_innobase_static_target@ +libinnobase_la_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ btr/btr0sea.c buf/buf0buf.c buf/buf0flu.c \ buf/buf0lru.c buf/buf0rea.c data/data0data.c \ data/data0type.c dict/dict0boot.c \ @@ -156,10 +155,10 @@ libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c \ handler/ha_innodb.cc -libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) -libinnobase_a_CFLAGS= $(AM_CFLAGS) +libinnobase_la_CXXFLAGS= $(AM_CXXFLAGS) +libinnobase_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_innodb.la +EXTRA_LTLIBRARIES= libinnobase.la ha_innodb.la pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) diff --git a/storage/innobase/plug.in.disabled b/storage/innobase/plug.in.disabled index de7302dd6cc..b18950b9c7a 100644 --- a/storage/innobase/plug.in.disabled +++ b/storage/innobase/plug.in.disabled @@ -1,7 +1,7 @@ MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], [Transactional Tables using InnoDB], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase]) -MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a]) +MYSQL_PLUGIN_STATIC(innobase, [libinnobase.la]) MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la]) MYSQL_PLUGIN_ACTIONS(innobase, [ AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) diff --git a/storage/innodb_plugin/Makefile.am b/storage/innodb_plugin/Makefile.am index 0d2c194a3f2..1b02b4eceb8 100644 --- a/storage/innodb_plugin/Makefile.am +++ b/storage/innodb_plugin/Makefile.am @@ -228,9 +228,8 @@ noinst_HEADERS= \ include/ut0wqueue.h \ mem/mem0dbg.c -EXTRA_LIBRARIES= libinnobase.a -noinst_LIBRARIES= @plugin_innodb_plugin_static_target@ -libinnobase_a_SOURCES= \ +noinst_LTLIBRARIES= @plugin_innodb_plugin_static_target@ +libinnobase_la_SOURCES= \ btr/btr0btr.c \ btr/btr0cur.c \ btr/btr0pcur.c \ @@ -325,16 +324,16 @@ libinnobase_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) -libinnobase_a_CFLAGS= $(AM_CFLAGS) +libinnobase_la_CXXFLAGS= $(AM_CXXFLAGS) +libinnobase_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_innodb_plugin.la +EXTRA_LTLIBRARIES= libinnobase.la ha_innodb_plugin.la pkgplugin_LTLIBRARIES= @plugin_innodb_plugin_shared_target@ ha_innodb_plugin_la_LDFLAGS= -module -rpath $(pkgplugindir) ha_innodb_plugin_la_CXXFLAGS= -shared $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_plugin_la_CFLAGS= -shared $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) -ha_innodb_plugin_la_SOURCES= $(libinnobase_a_SOURCES) +ha_innodb_plugin_la_SOURCES= $(libinnobase_la_SOURCES) EXTRA_DIST= CMakeLists.txt plug.in \ pars/make_bison.sh pars/make_flex.sh \ diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt index 22e0211f052..fe6570d9c03 100644 --- a/storage/maria/CMakeLists.txt +++ b/storage/maria/CMakeLists.txt @@ -65,9 +65,8 @@ TARGET_LINK_LIBRARIES(maria_read_log maria myisam mysys dbug strings zlib wsock3 ADD_EXECUTABLE(maria_pack maria_pack.c) TARGET_LINK_LIBRARIES(maria_pack maria myisam mysys dbug strings zlib wsock32) -ADD_EXECUTABLE(maria_dump_log ma_loghandler.c unittest/ma_loghandler_examples.c) +ADD_EXECUTABLE(maria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c) TARGET_LINK_LIBRARIES(maria_dump_log maria myisam mysys dbug strings zlib wsock32) -SET_TARGET_PROPERTIES(maria_dump_log PROPERTIES COMPILE_FLAGS "-DMARIA_DUMP_LOG") ADD_EXECUTABLE(ma_test1 ma_test1.c) TARGET_LINK_LIBRARIES(ma_test1 maria myisam mysys dbug strings zlib wsock32) diff --git a/storage/maria/Makefile.am b/storage/maria/Makefile.am index d38abe01bdc..5e78614f0ca 100644 --- a/storage/maria/Makefile.am +++ b/storage/maria/Makefile.am @@ -34,6 +34,9 @@ EXTRA_DIST = ma_test_all.sh ma_test_all.res ma_test_big.sh \ ma_ft_stem.c CMakeLists.txt plug.in ma_test_recovery pkgdata_DATA = pkglib_LIBRARIES = libmaria.a +noinst_LTLIBRARIES = libmaria.la libmaria_s.la \ + @plugin_maria_embedded_static_target@ +EXTRA_LTLIBRARIES = libmaria_embedded.la bin_PROGRAMS = maria_chk maria_pack maria_ftdump maria_read_log \ maria_dump_log maria_chk_DEPENDENCIES= $(LIBRARIES) @@ -58,13 +61,12 @@ maria_read_log_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ maria_dump_log_DEPENDENCIES=$(LIBRARIES) ma_loghandler.c -maria_dump_log_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.a \ +maria_dump_log_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.la \ $(top_builddir)/storage/myisam/libmyisam.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -maria_dump_log_SOURCES= ma_loghandler.c unittest/ma_loghandler_examples.c -maria_dump_log_CPPFLAGS= -DMARIA_DUMP_LOG +maria_dump_log_SOURCES= maria_dump_log.c unittest/ma_loghandler_examples.c noinst_PROGRAMS = ma_test1 ma_test2 ma_test3 ma_rt_test ma_sp_test noinst_HEADERS = maria_def.h ma_rt_index.h ma_rt_key.h ma_rt_mbr.h \ ma_sp_defs.h ma_fulltext.h ma_ftdefs.h ma_ft_test1.h \ @@ -112,7 +114,7 @@ ma_sp_test_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -libmaria_a_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ +libmaria_la_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ ma_rnext.c ma_rnext_same.c \ ma_search.c ma_page.c ma_key_recover.c ma_key.c \ ma_locking.c ma_state.c \ @@ -134,8 +136,20 @@ libmaria_a_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ ma_sp_key.c ma_control_file.c ma_loghandler.c \ ma_pagecache.c ma_pagecaches.c \ ma_checkpoint.c ma_recovery.c ma_commit.c \ - ma_pagecrc.c ma_recovery_util.c \ - ha_maria.cc + ma_pagecrc.c ma_recovery_util.c + +libmaria_s_la_SOURCES = ha_maria.cc +libmaria_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libmaria_s_la_LIBADD = libmaria.la +libmaria_embedded_la_SOURCES = ha_maria.cc +libmaria_embedded_la_LIBADD = libmaria.la +libmaria_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ + +libmaria_a_SOURCES= +libmaria.a: libmaria.la + $(CP) .libs/libmaria.a $@ + + CLEANFILES = test?.MA? FT?.MA? isam.log ma_test_all ma_rt_test.MA? sp_test.MA? maria_log_control maria_log.0000* SUFFIXES = .sh diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 1cc4140081a..423cd2f0dd7 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1086,34 +1086,14 @@ static my_bool translog_max_lsn_to_header(File file, LSN lsn) /* - Information from transaction log file header -*/ - -typedef struct st_loghandler_file_info -{ - /* - LSN_IMPOSSIBLE for current file (not finished file). - Maximum LSN of the record which parts stored in the - file. - */ - LSN max_lsn; - ulonglong timestamp; /* Time stamp */ - ulong maria_version; /* Version of maria loghandler */ - ulong mysql_version; /* Version of mysql server */ - ulong server_id; /* Server ID */ - ulong page_size; /* Loghandler page size */ - ulong file_number; /* Number of the file (from the file header) */ -} LOGHANDLER_FILE_INFO; - -/* @brief Extract hander file information from loghandler file page @param desc header information descriptor to be filled with information @param page_buff buffer with the page content */ -static void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, - uchar *page_buff) +void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, + uchar *page_buff) { uchar *ptr; @@ -3400,7 +3380,7 @@ my_bool translog_walk_filenames(const char *directory, @brief Fills table of dependence length of page header from page flags */ -static void translog_fill_overhead_table() +void translog_fill_overhead_table() { uint i; for (i= 0; i < TRANSLOG_FLAGS_NUM; i++) @@ -8322,156 +8302,6 @@ void translog_set_file_size(uint32 size) /** - Write debug information to log if we EXTRA_DEBUG is enabled -*/ - -my_bool translog_log_debug_info(TRN *trn __attribute__((unused)), - enum translog_debug_info_type type - __attribute__((unused)), - uchar *info __attribute__((unused)), - size_t length __attribute__((unused))) -{ -#ifdef EXTRA_DEBUG - LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2]; - uchar debug_type; - LSN lsn; - - if (!trn) - { - /* - We can't log the current transaction because we don't have - an active transaction. Use a temporary transaction object instead - */ - trn= &dummy_transaction_object; - } - debug_type= (uchar) type; - log_array[TRANSLOG_INTERNAL_PARTS + 0].str= &debug_type; - log_array[TRANSLOG_INTERNAL_PARTS + 0].length= 1; - log_array[TRANSLOG_INTERNAL_PARTS + 1].str= info; - log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length; - return translog_write_record(&lsn, LOGREC_DEBUG_INFO, - trn, NULL, - (translog_size_t) (1+ length), - sizeof(log_array)/sizeof(log_array[0]), - log_array, NULL, NULL); -#else - return 0; -#endif -} - - -#ifdef MARIA_DUMP_LOG -#include <my_getopt.h> -extern void translog_example_table_init(); -static const char *load_default_groups[]= { "maria_dump_log",0 }; -static void get_options(int *argc,char * * *argv); -#ifndef DBUG_OFF -#if defined(__WIN__) -const char *default_dbug_option= "d:t:i:O,\\maria_dump_log.trace"; -#else -const char *default_dbug_option= "d:t:i:o,/tmp/maria_dump_log.trace"; -#endif -#endif -static ulonglong opt_offset; -static ulong opt_pages; -static const char *opt_file= NULL; -static File handler= -1; -static my_bool opt_unit= 0; -static struct my_option my_long_options[] = -{ -#ifdef IMPLTMENTED - {"body", 'b', - "Print chunk body dump", - (uchar **) &opt_body, (uchar **) &opt_body, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif -#ifndef DBUG_OFF - {"debug", '#', "Output debug log. Often the argument is 'd:t:o,filename'.", - 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif - {"file", 'f', "Path to file which will be read", - (uchar**) &opt_file, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"help", '?', "Display this help and exit.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - { "offset", 'o', "Start reading log from this offset", - (uchar**) &opt_offset, (uchar**) &opt_offset, - 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, - { "pages", 'n', "Number of pages to read", - (uchar**) &opt_pages, (uchar**) &opt_pages, 0, - GET_ULONG, REQUIRED_ARG, (long) ~(ulong) 0, - (long) 1, (long) ~(ulong) 0, (long) 0, - (long) 1, 0}, - {"unit-test", 'U', - "Use unit test record table (for logs created by unittests", - (uchar **) &opt_unit, (uchar **) &opt_unit, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"version", 'V', "Print version and exit.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} -}; - - -static void print_version(void) -{ - VOID(printf("%s Ver 1.0 for %s on %s\n", - my_progname_short, SYSTEM_TYPE, MACHINE_TYPE)); - NETWARE_SET_SCREEN_MODE(1); -} - - -static void usage(void) -{ - print_version(); - puts("Copyright (C) 2008 MySQL AB"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); - puts("and you are welcome to modify and redistribute it under the GPL license\n"); - - puts("Dump content of maria log pages."); - VOID(printf("\nUsage: %s -f file OPTIONS\n", my_progname_short)); - my_print_help(my_long_options); - print_defaults("my", load_default_groups); - my_print_variables(my_long_options); -} - - -static my_bool -get_one_option(int optid __attribute__((unused)), - const struct my_option *opt __attribute__((unused)), - char *argument __attribute__((unused))) -{ - switch (optid) { - case '?': - usage(); - exit(0); - case 'V': - print_version(); - exit(0); -#ifndef DBUG_OFF - case '#': - DBUG_SET_INITIAL(argument ? argument : default_dbug_option); - break; -#endif - } - return 0; -} - - -static void get_options(int *argc,char ***argv) -{ - int ho_error; - - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) - exit(ho_error); - - if (opt_file == NULL) - { - usage(); - exit(1); - } -} - - -/** @brief Dump information about file header page. */ @@ -8655,7 +8485,7 @@ static uchar *dump_chunk(uchar *buffer, uchar *ptr) @brief Dump information about page with data. */ -static void dump_datapage(uchar *buffer) +static void dump_datapage(uchar *buffer, File handler) { uchar *ptr; ulong offset; @@ -8736,79 +8566,51 @@ static void dump_datapage(uchar *buffer) @brief Dump information about page. */ -static void dump_page(uchar *buffer) +void dump_page(uchar *buffer, File handler) { - printf("Page by offset %llu (0x%llx)\n", opt_offset, opt_offset); if (strncmp((char*)maria_trans_file_magic, (char*)buffer, sizeof(maria_trans_file_magic)) == 0) { dump_header_page(buffer); } - dump_datapage(buffer); + dump_datapage(buffer, handler); } /** - @brief maria_dump_log main function. + Write debug information to log if we EXTRA_DEBUG is enabled */ -int main(int argc, char **argv) +my_bool translog_log_debug_info(TRN *trn __attribute__((unused)), + enum translog_debug_info_type type + __attribute__((unused)), + uchar *info __attribute__((unused)), + size_t length __attribute__((unused))) { - char **default_argv; - uchar buffer[TRANSLOG_PAGE_SIZE]; - MY_INIT(argv[0]); - - load_defaults("my", load_default_groups, &argc, &argv); - default_argv= argv; - get_options(&argc, &argv); - - if (opt_unit) - translog_example_table_init(); - else - translog_table_init(); - translog_fill_overhead_table(); - - maria_data_root= (char *)"."; +#ifdef EXTRA_DEBUG + LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2]; + uchar debug_type; + LSN lsn; - if ((handler= my_open(opt_file, O_RDONLY, MYF(MY_WME))) < 0) - { - fprintf(stderr, "Can't open file: '%s' errno: %d\n", - opt_file, my_errno); - goto err; - } - if (my_seek(handler, opt_offset, SEEK_SET, MYF(MY_WME)) != - opt_offset) - { - fprintf(stderr, "Can't set position %lld file: '%s' errno: %d\n", - opt_offset, opt_file, my_errno); - goto err; - } - for (; - opt_pages; - opt_offset+= TRANSLOG_PAGE_SIZE, opt_pages--) + if (!trn) { - if (my_pread(handler, buffer, TRANSLOG_PAGE_SIZE, opt_offset, - MYF(MY_NABP))) - { - if (my_errno == HA_ERR_FILE_TOO_SHORT) - goto end; - fprintf(stderr, "Can't read page at position %lld file: '%s' " - "errno: %d\n", opt_offset, opt_file, my_errno); - goto err; - } - dump_page(buffer); + /* + We can't log the current transaction because we don't have + an active transaction. Use a temporary transaction object instead + */ + trn= &dummy_transaction_object; } - -end: - my_close(handler, MYF(0)); - free_defaults(default_argv); - exit(0); - return 0; /* No compiler warning */ - -err: - my_close(handler, MYF(0)); - fprintf(stderr, "%s: FAILED\n", my_progname_short); - free_defaults(default_argv); - exit(1); -} + debug_type= (uchar) type; + log_array[TRANSLOG_INTERNAL_PARTS + 0].str= &debug_type; + log_array[TRANSLOG_INTERNAL_PARTS + 0].length= 1; + log_array[TRANSLOG_INTERNAL_PARTS + 1].str= info; + log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length; + return translog_write_record(&lsn, LOGREC_DEBUG_INFO, + trn, NULL, + (translog_size_t) (1+ length), + sizeof(log_array)/sizeof(log_array[0]), + log_array, NULL, NULL); +#else + return 0; #endif +} diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h index 1040d07997a..c22d361d142 100644 --- a/storage/maria/ma_loghandler.h +++ b/storage/maria/ma_loghandler.h @@ -358,6 +358,7 @@ translog_assign_id_to_share_from_recovery(struct st_maria_share *share, extern my_bool translog_walk_filenames(const char *directory, my_bool (*callback)(const char *, const char *)); +extern void dump_page(uchar *buffer, File handler); extern my_bool translog_log_debug_info(TRN *trn, enum translog_debug_info_type type, uchar *info, size_t length); @@ -376,8 +377,31 @@ extern enum enum_translog_status translog_status; ma_loghandler_for_recovery.h ? */ +/* + Information from transaction log file header +*/ + +typedef struct st_loghandler_file_info +{ + /* + LSN_IMPOSSIBLE for current file (not finished file). + Maximum LSN of the record which parts stored in the + file. + */ + LSN max_lsn; + ulonglong timestamp; /* Time stamp */ + ulong maria_version; /* Version of maria loghandler */ + ulong mysql_version; /* Version of mysql server */ + ulong server_id; /* Server ID */ + ulong page_size; /* Loghandler page size */ + ulong file_number; /* Number of the file (from the file header) */ +} LOGHANDLER_FILE_INFO; + #define SHARE_ID_MAX 65535 /* array's size */ +extern void translog_fill_overhead_table(); +extern void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, + uchar *page_buff); extern LSN translog_first_lsn_in_log(); extern LSN translog_first_theoretical_lsn(); extern LSN translog_next_LSN(TRANSLOG_ADDRESS addr, TRANSLOG_ADDRESS horizon); diff --git a/storage/maria/maria_dump_log.c b/storage/maria/maria_dump_log.c new file mode 100644 index 00000000000..bc7ec566462 --- /dev/null +++ b/storage/maria/maria_dump_log.c @@ -0,0 +1,190 @@ +/* Copyright (C) 2007 MySQL AB & Sanja Belkin + + 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 */ + +#include "maria_def.h" +#include <my_getopt.h> +extern void translog_example_table_init(); +static const char *load_default_groups[]= { "maria_dump_log",0 }; +static void get_options(int *argc,char * * *argv); +#ifndef DBUG_OFF +#if defined(__WIN__) +const char *default_dbug_option= "d:t:i:O,\\maria_dump_log.trace"; +#else +const char *default_dbug_option= "d:t:i:o,/tmp/maria_dump_log.trace"; +#endif +#endif +static ulonglong opt_offset; +static ulong opt_pages; +static const char *opt_file= NULL; +static File handler= -1; +static my_bool opt_unit= 0; +static struct my_option my_long_options[] = +{ +#ifdef IMPLTMENTED + {"body", 'b', + "Print chunk body dump", + (uchar **) &opt_body, (uchar **) &opt_body, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif +#ifndef DBUG_OFF + {"debug", '#', "Output debug log. Often the argument is 'd:t:o,filename'.", + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, +#endif + {"file", 'f', "Path to file which will be read", + (uchar**) &opt_file, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"help", '?', "Display this help and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { "offset", 'o', "Start reading log from this offset", + (uchar**) &opt_offset, (uchar**) &opt_offset, + 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, + { "pages", 'n', "Number of pages to read", + (uchar**) &opt_pages, (uchar**) &opt_pages, 0, + GET_ULONG, REQUIRED_ARG, (long) ~(ulong) 0, + (long) 1, (long) ~(ulong) 0, (long) 0, + (long) 1, 0}, + {"unit-test", 'U', + "Use unit test record table (for logs created by unittests", + (uchar **) &opt_unit, (uchar **) &opt_unit, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Print version and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} +}; + + +static void print_version(void) +{ + VOID(printf("%s Ver 1.0 for %s on %s\n", + my_progname_short, SYSTEM_TYPE, MACHINE_TYPE)); + NETWARE_SET_SCREEN_MODE(1); +} + + +static void usage(void) +{ + print_version(); + puts("Copyright (C) 2008 MySQL AB"); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); + puts("and you are welcome to modify and redistribute it under the GPL license\n"); + + puts("Dump content of maria log pages."); + VOID(printf("\nUsage: %s -f file OPTIONS\n", my_progname_short)); + my_print_help(my_long_options); + print_defaults("my", load_default_groups); + my_print_variables(my_long_options); +} + + +static my_bool +get_one_option(int optid __attribute__((unused)), + const struct my_option *opt __attribute__((unused)), + char *argument __attribute__((unused))) +{ + switch (optid) { + case '?': + usage(); + exit(0); + case 'V': + print_version(); + exit(0); +#ifndef DBUG_OFF + case '#': + DBUG_SET_INITIAL(argument ? argument : default_dbug_option); + break; +#endif + } + return 0; +} + + +static void get_options(int *argc,char ***argv) +{ + int ho_error; + + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + exit(ho_error); + + if (opt_file == NULL) + { + usage(); + exit(1); + } +} + + +/** + @brief maria_dump_log main function. +*/ + +int main(int argc, char **argv) +{ + char **default_argv; + uchar buffer[TRANSLOG_PAGE_SIZE]; + MY_INIT(argv[0]); + + load_defaults("my", load_default_groups, &argc, &argv); + default_argv= argv; + get_options(&argc, &argv); + + if (opt_unit) + translog_example_table_init(); + else + translog_table_init(); + translog_fill_overhead_table(); + + maria_data_root= (char *)"."; + + if ((handler= my_open(opt_file, O_RDONLY, MYF(MY_WME))) < 0) + { + fprintf(stderr, "Can't open file: '%s' errno: %d\n", + opt_file, my_errno); + goto err; + } + if (my_seek(handler, opt_offset, SEEK_SET, MYF(MY_WME)) != + opt_offset) + { + fprintf(stderr, "Can't set position %lld file: '%s' errno: %d\n", + opt_offset, opt_file, my_errno); + goto err; + } + for (; + opt_pages; + opt_offset+= TRANSLOG_PAGE_SIZE, opt_pages--) + { + if (my_pread(handler, buffer, TRANSLOG_PAGE_SIZE, opt_offset, + MYF(MY_NABP))) + { + if (my_errno == HA_ERR_FILE_TOO_SHORT) + goto end; + fprintf(stderr, "Can't read page at position %lld file: '%s' " + "errno: %d\n", opt_offset, opt_file, my_errno); + goto err; + } + printf("Page by offset %llu (0x%llx)\n", opt_offset, opt_offset); + dump_page(buffer, handler); + } + +end: + my_close(handler, MYF(0)); + free_defaults(default_argv); + exit(0); + return 0; /* No compiler warning */ + +err: + my_close(handler, MYF(0)); + fprintf(stderr, "%s: FAILED\n", my_progname_short); + free_defaults(default_argv); + exit(1); +} diff --git a/storage/maria/plug.in b/storage/maria/plug.in index 686c8361a87..bdf1ca7a5bf 100644 --- a/storage/maria/plug.in +++ b/storage/maria/plug.in @@ -1,10 +1,9 @@ MYSQL_STORAGE_ENGINE(maria,, [Maria Storage Engine], [Crash-safe tables with MyISAM heritage], [default,max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(maria, [storage/maria]) -MYSQL_PLUGIN_STATIC(maria, [libmaria.a]) +MYSQL_PLUGIN_STATIC(maria, [libmaria_s.la], [libmaria_embedded.la]) # Maria will probably go first into max builds, not all builds, # so we don't declare it mandatory. -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(maria, [ha_maria.cc]) MYSQL_PLUGIN_ACTIONS(maria, [ # AC_CONFIG_FILES(storage/maria/unittest/Makefile) diff --git a/storage/myisam/Makefile.am b/storage/myisam/Makefile.am index ea942672856..8f3d51c4886 100644 --- a/storage/myisam/Makefile.am +++ b/storage/myisam/Makefile.am @@ -31,6 +31,10 @@ EXTRA_DIST = mi_test_all.sh mi_test_all.res ft_stem.c CMakeLists.txt plug.in pkgdata_DATA = pkglib_LIBRARIES = libmyisam.a +noinst_LTLIBRARIES = libmyisam.la libmyisam_s.la \ + @plugin_myisam_embedded_static_target@ +EXTRA_LTLIBRARIES = libmyisam_embedded.la + bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump myisamchk_DEPENDENCIES= $(LIBRARIES) myisamchk_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ @@ -83,7 +87,8 @@ sp_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \ + +libmyisam_la_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \ mi_rnext.c mi_rnext_same.c \ mi_search.c mi_page.c mi_key.c mi_locking.c \ mi_rrnd.c mi_scan.c mi_cache.c \ @@ -98,8 +103,19 @@ libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \ mi_keycache.c mi_preload.c \ ft_parser.c ft_stopwords.c ft_static.c \ ft_update.c ft_boolean_search.c ft_nlq_search.c \ - sort.c ha_myisam.cc ft_myisam.c \ + sort.c ft_myisam.c \ rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c +libmyisam_s_la_SOURCES = ha_myisam.cc +libmyisam_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libmyisam_s_la_LIBADD = libmyisam.la +libmyisam_embedded_la_SOURCES = ha_myisam.cc +libmyisam_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libmyisam_embedded_la_LIBADD = libmyisam.la + +libmyisam_a_SOURCES= +libmyisam.a: libmyisam.la + $(CP) .libs/libmyisam.a $@ + CLEANFILES = test?.MY? FT?.MY? isam.log mi_test_all rt_test.MY? sp_test.MY? # Move to automake rules ? diff --git a/storage/myisam/plug.in b/storage/myisam/plug.in index e92b5e56d7f..95b29336493 100644 --- a/storage/myisam/plug.in +++ b/storage/myisam/plug.in @@ -1,7 +1,6 @@ dnl MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine], dnl [Traditional non-transactional MySQL tables]) dnl MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam]) -dnl MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a]) +dnl MYSQL_PLUGIN_STATIC(myisam, [libmyisam_s.la], [libmyisam_embedded.la]) dnl MYSQL_PLUGIN_MANDATORY(myisam) dnl Default -dnl MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisam, [ha_myisam.cc]) diff --git a/storage/myisammrg/Makefile.am b/storage/myisammrg/Makefile.am index 1ca51bc9d03..66fd2402646 100644 --- a/storage/myisammrg/Makefile.am +++ b/storage/myisammrg/Makefile.am @@ -27,16 +27,26 @@ LDADD = DEFS = @DEFS@ pkglib_LIBRARIES = libmyisammrg.a +noinst_LTLIBRARIES = libmyisammrg.la libmyisammrg_s.la \ + @plugin_myisammrg_embedded_static_target@ +EXTRA_LTLIBRARIES = libmyisammrg_embedded.la noinst_HEADERS = myrg_def.h ha_myisammrg.h -noinst_LIBRARIES = libmyisammrg.a -libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ +libmyisammrg_la_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ myrg_rrnd.c myrg_update.c myrg_delete.c myrg_rsame.c \ myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \ myrg_rkey.c myrg_rfirst.c myrg_rlast.c myrg_rnext.c \ myrg_rprev.c myrg_queue.c myrg_write.c myrg_range.c \ - ha_myisammrg.cc \ myrg_rnext_same.c myrg_records.c +libmyisammrg_s_la_SOURCES = ha_myisammrg.cc +libmyisammrg_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libmyisammrg_s_la_LIBADD = libmyisammrg.la +libmyisammrg_embedded_la_SOURCES = ha_myisammrg.cc +libmyisammrg_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libmyisammrg_embedded_la_LIBADD = libmyisammrg.la +libmyisammrg_a_SOURCES= +libmyisammrg.a: libmyisammrg.la + $(CP) .libs/libmyisammrg.a $@ EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/myisammrg/plug.in b/storage/myisammrg/plug.in index 1f94e07d881..a2654373fba 100644 --- a/storage/myisammrg/plug.in +++ b/storage/myisammrg/plug.in @@ -1,6 +1,5 @@ MYSQL_STORAGE_ENGINE(myisammrg,no,[MyISAM MERGE Engine], [Merge multiple MySQL tables into one]) MYSQL_PLUGIN_DIRECTORY(myisammrg,[storage/myisammrg]) -MYSQL_PLUGIN_STATIC(myisammrg, [libmyisammrg.a]) +MYSQL_PLUGIN_STATIC(myisammrg, [libmyisammrg_s.la], [libmyisammrg_embedded.la]) MYSQL_PLUGIN_MANDATORY(myisammrg) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisammrg, [ha_myisammrg.cc]) diff --git a/storage/pbxt/plug.in b/storage/pbxt/plug.in index 02c5d8adcbe..c0dc06d9702 100644 --- a/storage/pbxt/plug.in +++ b/storage/pbxt/plug.in @@ -1,8 +1,7 @@ MYSQL_STORAGE_ENGINE(pbxt,no, [PBXT Storage Engine], [MVCC-based transactional engine], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(pbxt, [storage/pbxt]) -MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt.a]) +MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt_s.la], [src/libpbxt_s_embedded.la]) MYSQL_PLUGIN_ACTIONS(pbxt, [ # AC_CONFIG_FILES(storage/pbxt/src/Makefile) ]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(pbxt, [[src/ha_pbxt.cc],[src/myxt_xt.cc],[src/discover_xt.cc]]) diff --git a/storage/pbxt/src/Makefile.am b/storage/pbxt/src/Makefile.am index fc4c4ef8f1e..4c5467d24d0 100644 --- a/storage/pbxt/src/Makefile.am +++ b/storage/pbxt/src/Makefile.am @@ -26,25 +26,31 @@ noinst_HEADERS = bsearch_xt.h cache_xt.h ccutils_xt.h database_xt.h \ pbms.h xt_config.h xt_defs.h xt_errno.h locklist_xt.h EXTRA_LTLIBRARIES = libpbxt.la -libpbxt_la_SOURCES = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \ +non_mysql_internal_sources = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \ datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \ - ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \ - memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \ + heap_xt.cc index_xt.cc linklist_xt.cc \ + memory_xt.cc pthread_xt.cc restart_xt.cc \ sortedlist_xt.cc strutil_xt.cc \ tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \ - systab_xt.cc ha_xtsys.cc discover_xt.cc backup_xt.cc \ + systab_xt.cc ha_xtsys.cc backup_xt.cc \ util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc - -libpbxt_la_LDFLAGS = -module +mysql_internal_sources = ha_pbxt.cc myxt_xt.cc discover_xt.cc +libpbxt_la_SOURCES = $(non_mysql_internal_sources) $(mysql_internal_sources) # These are the warning Drizzle uses: # DRIZZLE_WARNINGS = -W -Wall -Wextra -pedantic -Wundef -Wredundant-decls -Wno-strict-aliasing -Wno-long-long -Wno-unused-parameter -libpbxt_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -libpbxt_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99 +libpbxt_la_CXXFLAGS = -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libpbxt_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99 +libpbxt_la_LDFLAGS = -module + +noinst_LTLIBRARIES = libpbxt_s.la libpbxt_s_embedded.la libpbxt_s_common.la -EXTRA_LIBRARIES = libpbxt.a -noinst_LIBRARIES = libpbxt.a -libpbxt_a_SOURCES = $(libpbxt_la_SOURCES) +libpbxt_s_common_la_SOURCES = $(non_mysql_internal_sources) +libpbxt_s_la_SOURCES = $(mysql_internal_sources) +libpbxt_s_la_LIBADD = libpbxt_s_common.la +libpbxt_s_embedded_la_SOURCES = $(mysql_internal_sources) +libpbxt_s_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libpbxt_s_embedded_la_LIBADD = libpbxt_s_common.la EXTRA_DIST = pbms_enabled.cc win_inttypes.h diff --git a/storage/xtradb/Makefile.am b/storage/xtradb/Makefile.am index 7dffdacbcf1..abc24b0e1a4 100644 --- a/storage/xtradb/Makefile.am +++ b/storage/xtradb/Makefile.am @@ -229,9 +229,8 @@ noinst_HEADERS= \ handler/innodb_patch_info.h \ mem/mem0dbg.c -EXTRA_LIBRARIES= libxtradb.a -noinst_LIBRARIES= @plugin_xtradb_static_target@ -libxtradb_a_SOURCES= \ +noinst_LTLIBRARIES= @plugin_xtradb_static_target@ +libxtradb_la_SOURCES= \ btr/btr0btr.c \ btr/btr0cur.c \ btr/btr0pcur.c \ @@ -326,16 +325,16 @@ libxtradb_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libxtradb_a_CXXFLAGS= $(AM_CXXFLAGS) -libxtradb_a_CFLAGS= $(AM_CFLAGS) +libxtradb_la_CXXFLAGS= $(AM_CXXFLAGS) +libxtradb_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_xtradb.la +EXTRA_LTLIBRARIES= libxtradb.la ha_xtradb.la pkgplugin_LTLIBRARIES= @plugin_xtradb_shared_target@ ha_xtradb_la_LDFLAGS= -module -rpath $(pkgplugindir) ha_xtradb_la_CXXFLAGS= -shared $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_xtradb_la_CFLAGS= -shared $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) -ha_xtradb_la_SOURCES= $(libxtradb_a_SOURCES) +ha_xtradb_la_SOURCES= $(libxtradb_la_SOURCES) EXTRA_DIST= CMakeLists.txt plug.in \ pars/make_bison.sh pars/make_flex.sh \ diff --git a/storage/xtradb/plug.in b/storage/xtradb/plug.in index 37c895fb520..67f25755762 100644 --- a/storage/xtradb/plug.in +++ b/storage/xtradb/plug.in @@ -17,7 +17,7 @@ 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.a]) +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 diff --git a/strings/Makefile.am b/strings/Makefile.am index 9b0c1a33250..6a09abe7479 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -17,6 +17,7 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include pkglib_LIBRARIES = libmystrings.a +noinst_LTLIBRARIES = libmystrings.la # Exact one of ASSEMBLER_X if ASSEMBLER_x86 @@ -37,7 +38,7 @@ CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend. endif endif -libmystrings_a_SOURCES = $(ASRCS) $(CSRCS) +libmystrings_la_SOURCES = $(ASRCS) $(CSRCS) noinst_PROGRAMS = conf_to_src CLEANFILES = str_test uctypedump test_decimal # Default charset definitions @@ -56,9 +57,9 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc t_ctype.h my_strchr.c CMakeLists.txt \ CHARSET_INFO.txt strmov_overlapp.c -libmystrings_a_LIBADD= -conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c -conf_to_src_LDADD= +libmystrings_la_LIBADD= +conf_to_src_SOURCES = conf_to_src.c +conf_to_src_LDADD = libmystrings.a #force static linking of conf_to_src - essential when linking against #custom installation of libc conf_to_src_LDFLAGS= @NOINST_LDFLAGS@ @@ -66,6 +67,9 @@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@ # This is because the dependency tracking misses @FOO@ vars in sources. #strtoull.o: @CHARSET_OBJS@ +libmystrings_a_SOURCES= +libmystrings.a: libmystrings.la + $(CP) .libs/libmystrings.a $@ FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ diff --git a/unittest/unit.pl b/unittest/unit.pl index a1aab376fdf..be6424ec798 100644 --- a/unittest/unit.pl +++ b/unittest/unit.pl @@ -65,7 +65,7 @@ sub _find_test_files (@) { my @dirs = @_; my @files; find sub { - $File::Find::prune = 1 if /^SCCS$/; + $File::Find::prune = 1 if /^(SCCS|\.libs)$/; push(@files, $File::Find::name) if -x _ && (/-t\z/ || /-t\.exe\z/); }, @dirs; return @files; diff --git a/vio/Makefile.am b/vio/Makefile.am index c70af1008cd..588cd3ea0c4 100644 --- a/vio/Makefile.am +++ b/vio/Makefile.am @@ -17,9 +17,15 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ $(openssl_includes) LDADD = @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) $(yassl_libs) pkglib_LIBRARIES = libvio.a +noinst_LTLIBRARIES = libvio.la noinst_HEADERS = vio_priv.h -libvio_a_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c +libvio_la_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c EXTRA_DIST= CMakeLists.txt + +libvio_a_SOURCES= +libvio.a: libvio.la + $(CP) .libs/libvio.a $@ + |