• Joerg Bruehe's avatar
    Fix bug#46980 · db890516
    Joerg Bruehe authored
        Option "--without-server" still not working in 5.1
    
    The general approach is to make sure that source files
    which require thread support are only compiled if the build
    really needs thread support,
    which means when the server is built or a thread-safe client
    library.
    
    This required several changes:
    - Make sure the subdirectories "storage/" and "plugin/" are
      only processed if the server is built, not ifclient-only.
    - Make the compilation of some modules which inherently
      require threading depend on thread supportin the build.
    - Separate the handling of threading in "configure.in" from
      that of server issues, threading is also needed in a
      non-server build of a thread-safe client library.
    
    Also, "libdbug" must get built even in a client-only build,
    so "dbug/" must be in the list of client directories.
    
    In addition, calls to thread functions in source files which
    can be built without thread support must use the wrapper
    functions which handle the non-threaded build.
    So the modules "client/mysqlimport.c" and "client/mysqlslap.c"
    must call "my_thread_end()" only via "mysql_thread_end()".
    
    
    Makefile.am:
      The directories "storage/" and "plugin/" contain files
      which are needed for the server only, so their contents
      is to be built only if a server is built.
      
      They must not be named unconditionally, because building
      their contents will fail unless threads are enabled.
      
      These directories are now listed in the "configure"
      variable "sql_server_dirs" which becomes part of
      "sql_union_dirs" if the server is to be built.
    client/mysqlimport.c:
      Use the wrapper function "mysql_thread_end()" which
      correctly handles the case of a non-threaded build.
    client/mysqlslap.c:
      Use the wrapper function "mysql_thread_end()" which
      correctly handles the case of a non-threaded build.
    configure.in:
      Various changes to support builds "--without-server":
      
      1) For the unit tests, we need "libdbug".
      
      2) Separate the treatment of the server from that of the
         thread-safe client library.
      
      3) Introduce an "automake conditional" "NEED_THREAD"
         which can be checked in some "Makefile.am".
      
      4) Include "storage/" and "plugin/" in the list of
         "sql_server_dirs" so that they are handled in the
         top "Makefile.am" only if the server is to be built
         (see the change in that file).
    mysys/Makefile.am:
      The code of "mf_keycache.c" in 5.1 is no longer safe
      to be built without thread support.
      (In 5.0, this was possible.)
      
      Rather than fix these issues, which is tedious and risky,
      avoid the need to ever build it without thread support:
      It is needed in the server only, which needs thread support.
      
      The only case where we build a "libmysys" without thread
      support is for a non-threaded client, where "mf_keycache"
      is not neded.
      So its inclusion in the list of source files can depend
      on the new conditional "NEED_THREAD".
    unittest/mysys/Makefile.am:
      Test program "my_atomic-t" is to verify the correct handling
      of threads only, it cannot be built without thread support
      and is not needed in such cases either.
      
      Let its build depend on the new conditional "NEED_THREAD".
    db890516
Makefile.am 1.29 KB