WiP cmake-ify
authorMichael Wallner <mike@php.net>
Fri, 17 Jan 2020 07:54:27 +0000 (08:54 +0100)
committerMichael Wallner <mike@php.net>
Thu, 30 Jan 2020 13:49:38 +0000 (14:49 +0100)
18 files changed:
.gitignore
CMakeLists.txt [new file with mode: 0644]
Config.cmake [new file with mode: 0644]
Include.cmake [new file with mode: 0644]
clients/CMakeLists.txt [new file with mode: 0644]
clients/ms_conn.c
libhashkit-1.0/CMakeLists.txt [new file with mode: 0644]
libhashkit/CMakeLists.txt [new file with mode: 0644]
libmemcached-1.0/CMakeLists.txt [new file with mode: 0644]
libmemcached-1.0/configure.h.in
libmemcached/CMakeLists.txt [new file with mode: 0644]
libmemcached/csl/CMakeLists.txt [new file with mode: 0644]
libmemcached/csl/context.cc
libmemcached/csl/context.h
libmemcached/csl/parser.yy
libmemcached/csl/scanner.l
libmemcachedinternal/CMakeLists.txt [new file with mode: 0644]
libmemcachedutil/CMakeLists.txt [new file with mode: 0644]

index 25348f7a12760ed9f1632420f9fded85802663c3..aa09fc4ded430668eb6b5645cebd33c361921f77 100644 (file)
@@ -52,6 +52,7 @@ clients/memrm
 clients/memslap
 clients/memstat
 clients/memtouch
+cmake-build-debug/
 config.cache
 config.log
 config.status
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d35aabd
--- /dev/null
@@ -0,0 +1,367 @@
+cmake_minimum_required(VERSION 3.9..3.16)
+
+if(${CMAKE_VERSION} VERSION_LESS 3.12)
+    cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
+endif()
+
+project(libmemcached
+        VERSION 1.99
+        DESCRIPTION "libmemcached https://github.com/m6w6/libmemcached"
+        )
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+include(Config.cmake)
+include(Include.cmake)
+
+find_package(Threads REQUIRED)
+find_library(HAVE_LIBSASL NAMES sasl sasl2)
+check_header(sasl/sasl.h)
+
+check_header(arpa/inet.h)
+check_header(dlfcn.h)
+check_header(errno.h)
+check_header(execinfo.h)
+check_header(fcntl.h)
+check_header(io.h)
+check_header(limits.h)
+check_header(netdb.h)
+check_header(poll.h)
+check_header(stddef.h)
+check_header(stdlib.h)
+check_header(strings.h)
+check_header(sys/socket.h)
+check_header(sys/time.h)
+check_header(sys/types.h)
+check_header(sys/un.h)
+check_header(time.h)
+check_header(umem.h)
+check_header(unistd.h)
+check_header(winsock2.h)
+check_header(ws2tcpip.h)
+
+check_decl(fcntl fcntl.h)
+check_decl(htonll arpa/inet.h)
+check_decl(MSG_DONTWAIT sys/socket.h)
+check_decl(MSG_MORE sys/socket.h)
+check_decl(MSG_NOSIGNAL sys/socket.h)
+check_decl(rcvtimeo sys/socket.h)
+check_decl(sndtimeo sys/socket.h)
+check_decl(strerror_r string.h)
+check_decl(strerror string.h)
+check_decl(abi::__cxa_demangle cxxabi.h)
+set(HAVE_GCC_ABI_DEMANGLE ${HAVE_ABI____CXA_DEMANGLE})
+
+check_type(in_port_t netinet/in.h)
+
+check_header(cstdint)
+check_header(cinttypes)
+
+check_debug()
+
+configure_file(mem_config.h.in ${CMAKE_BINARY_DIR}/mem_config.h @ONLY)
+
+include_directories(${CMAKE_BINARY_DIR})
+
+add_subdirectory(clients)
+add_subdirectory(libhashkit)
+add_subdirectory(libhashkit-1.0)
+add_subdirectory(libmemcached)
+add_subdirectory(libmemcached-1.0)
+add_subdirectory(libmemcachedinternal)
+add_subdirectory(libmemcachedutil)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+include_directories(${CMAKE_BINARY_DIR})
+include_directories(.)
+include_directories(clients)
+include_directories(example)
+include_directories(libhashkit)
+include_directories(libhashkit-1.0)
+include_directories(libmemcached)
+include_directories(libmemcached/csl)
+include_directories(libmemcached/memcached)
+include_directories(libmemcached-1.0)
+include_directories(libmemcached-1.0/struct)
+include_directories(libmemcached-1.0/types)
+include_directories(libmemcachedprotocol)
+include_directories(libmemcachedprotocol-0.0)
+include_directories(libmemcachedutil)
+include_directories(libmemcachedutil-1.0)
+include_directories(libtest)
+include_directories(libtest/exception)
+include_directories(libtest/result)
+include_directories(tests)
+include_directories(tests/libmemcached-1.0)
+include_directories(util)
+include_directories(win32)
+
+
+if (FALSE)
+    add_executable(nope
+        example/byteorder.cc
+        example/byteorder.h
+        example/interface_v0.cc
+        example/interface_v1.cc
+        example/memcached_light.cc
+        example/memcached_light.h
+        example/storage.cc
+        example/storage.h
+
+
+        libmemcached-1.0/t/c_sasl_test.c
+        libmemcached-1.0/t/c_test.c
+        libmemcached-1.0/t/cc_test.cc
+
+        libmemcachedprotocol/ascii_handler.c
+        libmemcachedprotocol/ascii_handler.h
+        libmemcachedprotocol/binary_handler.c
+        libmemcachedprotocol/binary_handler.h
+        libmemcachedprotocol/cache.c
+        libmemcachedprotocol/cache.h
+        libmemcachedprotocol/common.h
+        libmemcachedprotocol/handler.c
+        libmemcachedprotocol/pedantic.c
+        libmemcachedprotocol-0.0/binary.h
+        libmemcachedprotocol-0.0/callback.h
+        libmemcachedprotocol-0.0/handler.h
+        libmemcachedprotocol-0.0/vbucket.h
+
+        libmemcachedutil/common.h
+
+        libmemcachedutil-1.0/flush.h
+        libmemcachedutil-1.0/ostream.hpp
+        libmemcachedutil-1.0/pid.h
+        libmemcachedutil-1.0/ping.h
+        libmemcachedutil-1.0/pool.h
+        libmemcachedutil-1.0/util.h
+        libmemcachedutil-1.0/version.h
+
+        libtest/exception/disconnected.hpp
+        libtest/exception/fatal.cc
+        libtest/exception/fatal.hpp
+        libtest/result/base.hpp
+        libtest/result/fail.hpp
+        libtest/result/skip.hpp
+        libtest/result/success.hpp
+        libtest/abort.cc
+        libtest/alarm.cc
+        libtest/alarm.h
+        libtest/backtrace_test.cc
+        libtest/binaries.cc
+        libtest/binaries.h
+        libtest/blobslap_worker.cc
+        libtest/blobslap_worker.h
+        libtest/callbacks.h
+        libtest/client.cc
+        libtest/client.hpp
+        libtest/cmdline.cc
+        libtest/cmdline.h
+        libtest/collection.cc
+        libtest/collection.h
+        libtest/common.h
+        libtest/comparison.cc
+        libtest/comparison.hpp
+        libtest/core.cc
+        libtest/core.h
+        libtest/core_count.cc
+        libtest/cpu.cc
+        libtest/cpu.hpp
+        libtest/dns.cc
+        libtest/dns.hpp
+        libtest/dream.cc
+        libtest/dream.h
+        libtest/drizzled.cc
+        libtest/drizzled.h
+        libtest/error.h
+        libtest/exception.cc
+        libtest/exception.hpp
+        libtest/failed.cc
+        libtest/formatter.cc
+        libtest/formatter.hpp
+        libtest/framework.cc
+        libtest/framework.h
+        libtest/gearmand.cc
+        libtest/gearmand.h
+        libtest/get.h
+        libtest/has.cc
+        libtest/has.hpp
+        libtest/http.cc
+        libtest/http.hpp
+        libtest/is_local.cc
+        libtest/is_local.hpp
+        libtest/is_pid.hpp
+        libtest/killpid.cc
+        libtest/killpid.h
+        libtest/libtool.cc
+        libtest/libtool.hpp
+        libtest/lite.h
+        libtest/main.cc
+        libtest/memcached.cc
+        libtest/memcached.h
+        libtest/memcached.hpp
+        libtest/poll_error.hpp
+        libtest/port.cc
+        libtest/port.h
+        libtest/result.cc
+        libtest/result.hpp
+        libtest/runner.cc
+        libtest/runner.h
+        libtest/server.cc
+        libtest/server.h
+        libtest/server_container.cc
+        libtest/server_container.h
+        libtest/signal.cc
+        libtest/signal.h
+        libtest/skiptest.cc
+        libtest/socket.cc
+        libtest/socket.hpp
+        libtest/stream.h
+        libtest/strerror.cc
+        libtest/strerror.h
+        libtest/string.hpp
+        libtest/test.h
+        libtest/test.hpp
+        libtest/thread.hpp
+        libtest/timer.cc
+        libtest/timer.hpp
+        libtest/tmpfile.cc
+        libtest/tmpfile.hpp
+        libtest/unittest.cc
+        libtest/valgrind.h
+        libtest/vchar.cc
+        libtest/vchar.hpp
+        libtest/version.h
+        libtest/visibility.h
+        libtest/wait.cc
+        libtest/wait.h
+        libtest/yatl.h
+        libtest/yatlcon.h
+
+        tests/libmemcached-1.0/all_tests.cc
+        tests/libmemcached-1.0/all_tests.h
+        tests/libmemcached-1.0/all_tests_socket.cc
+        tests/libmemcached-1.0/atomsmasher.cc
+        tests/libmemcached-1.0/basic.cc
+        tests/libmemcached-1.0/callback_counter.cc
+        tests/libmemcached-1.0/callback_counter.h
+        tests/libmemcached-1.0/callbacks.cc
+        tests/libmemcached-1.0/debug.cc
+        tests/libmemcached-1.0/deprecated.cc
+        tests/libmemcached-1.0/dump.cc
+        tests/libmemcached-1.0/dump.h
+        tests/libmemcached-1.0/encoding_key.cc
+        tests/libmemcached-1.0/encoding_key.h
+        tests/libmemcached-1.0/error_conditions.cc
+        tests/libmemcached-1.0/exist.cc
+        tests/libmemcached-1.0/fetch_all_results.cc
+        tests/libmemcached-1.0/fetch_all_results.h
+        tests/libmemcached-1.0/generate.cc
+        tests/libmemcached-1.0/generate.h
+        tests/libmemcached-1.0/haldenbrand.cc
+        tests/libmemcached-1.0/haldenbrand.h
+        tests/libmemcached-1.0/internals.cc
+        tests/libmemcached-1.0/ketama.cc
+        tests/libmemcached-1.0/mem_functions.cc
+        tests/libmemcached-1.0/mem_functions.h
+        tests/libmemcached-1.0/memcached_fetch_execute.cc
+        tests/libmemcached-1.0/memcached_fetch_execute.h
+        tests/libmemcached-1.0/memcached_get.cc
+        tests/libmemcached-1.0/memcached_get.h
+        tests/libmemcached-1.0/namespace.cc
+        tests/libmemcached-1.0/parser.cc
+        tests/libmemcached-1.0/parser.h
+        tests/libmemcached-1.0/plus.cpp
+        tests/libmemcached-1.0/pool.cc
+        tests/libmemcached-1.0/print.cc
+        tests/libmemcached-1.0/replication.cc
+        tests/libmemcached-1.0/sasl.cc
+        tests/libmemcached-1.0/server_add.cc
+        tests/libmemcached-1.0/setup_and_teardowns.cc
+        tests/libmemcached-1.0/setup_and_teardowns.h
+        tests/libmemcached-1.0/stat.cc
+        tests/libmemcached-1.0/stat.h
+        tests/libmemcached-1.0/string.cc
+        tests/libmemcached-1.0/touch.cc
+        tests/libmemcached-1.0/virtual_buckets.cc
+        tests/basic.h
+        tests/callbacks.h
+        tests/cpp_example.cc
+        tests/cycle.cc
+        tests/debug.h
+        tests/deprecated.h
+        tests/error_conditions.h
+        tests/exist.h
+        tests/failure.cc
+        tests/hash_plus.cc
+        tests/hash_results.h
+        tests/hashkit_functions.cc
+        tests/ketama.h
+        tests/ketama_test_cases.h
+        tests/ketama_test_cases_spy.h
+        tests/keys.hpp
+        tests/libmemcached_test_container.h
+        tests/libmemcached_world.h
+        tests/libmemcached_world_socket.h
+        tests/mem_udp.cc
+        tests/memc.hpp
+        tests/memcapable.cc
+        tests/memcat.cc
+        tests/memcp.cc
+        tests/memdump.cc
+        tests/memerror.cc
+        tests/memexist.cc
+        tests/memflush.cc
+        tests/memping.cc
+        tests/memrm.cc
+        tests/memslap.cc
+        tests/memstat.cc
+        tests/memtouch.cc
+        tests/namespace.h
+        tests/parser.cc
+        tests/pool.h
+        tests/print.h
+        tests/replication.h
+        tests/runner.h
+        tests/server_add.h
+        tests/string.h
+        tests/touch.h
+        tests/virtual_buckets.h
+
+        util/daemon.cc
+        util/daemon.hpp
+        util/instance.cc
+        util/instance.hpp
+        util/log.hpp
+        util/logfile.cc
+        util/logfile.hpp
+        util/operation.cc
+        util/operation.hpp
+        util/pidfile.cc
+        util/pidfile.hpp
+        util/signal.cc
+        util/signal.hpp
+        util/string.hpp
+
+        win32/wrappers.h
+
+            )
+endif()
diff --git a/Config.cmake b/Config.cmake
new file mode 100644 (file)
index 0000000..93aead4
--- /dev/null
@@ -0,0 +1,10 @@
+set(LIBMEMCACHED_WITH_SASL_SUPPORT 0)
+
+set(HAVE_FNV64_HASH 1)
+set(HAVE_MURMUR_HASH 1)
+set(HAVE_HSIEH_HASH 0)
+
+set(HAVE_DTRACE 0)
+set(HAVE_VISIBILITY 1)
+set(HAVE_GCC_BUILTIN_ATOMIC 1)
+set(HAVE_SHARED_ENABLED 1)
diff --git a/Include.cmake b/Include.cmake
new file mode 100644 (file)
index 0000000..522f61a
--- /dev/null
@@ -0,0 +1,40 @@
+
+include(CheckTypeSize)
+include(CheckIncludeFileCXX)
+include(CheckCXXSymbolExists)
+include(CheckCXXCompilerFlag)
+
+function(safe_string STRING OUTPUT)
+    string(REGEX REPLACE "[^0-9a-zA-Z_]" "_" HEADER_SAFE ${STRING})
+    string(TOUPPER "${HEADER_SAFE}" HEADER_DEFN)
+    set(${OUTPUT} ${HEADER_DEFN} PARENT_SCOPE)
+endfunction(safe_string)
+
+function(define_cpp DEF)
+    safe_string(${DEF} CNST)
+    add_compile_definitions(HAVE_${CNST}=1)
+endfunction(define_cpp)
+
+function(check_header HEADER_PATH)
+    safe_string(${HEADER_PATH} HEADER_CONST)
+    check_include_file_cxx(${HEADER_PATH} HAVE_${HEADER_CONST})
+endfunction(check_header)
+
+function(check_decl DECL HEADER)
+    safe_string(${DECL} DECL_CONST)
+    check_cxx_symbol_exists(${DECL} ${HEADER} HAVE_${DECL_CONST})
+endfunction(check_decl)
+
+function(check_type TYPE HEADER)
+    safe_string(${TYPE} TYPE_CONST)
+    SET(CMAKE_EXTRA_INCLUDE_FILES ${HEADER})
+    check_type_size(${TYPE} ${TYPE_CONST})
+    SET(CMAKE_EXTRA_INCLUDE_FILES)
+endfunction(check_type)
+
+function(check_debug)
+    if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
+        add_compile_definitions(DEBUG=1)
+        add_compile_options(-Wall -Wextra)
+    endif()
+endfunction(check_debug)
diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt
new file mode 100644 (file)
index 0000000..59fa4aa
--- /dev/null
@@ -0,0 +1,30 @@
+include_directories(..)
+
+add_library(utilities STATIC utilities.cc)
+link_libraries(utilities memcachedinternal)
+
+add_executable(memcapable   memcapable.cc ../libmemcached/byteorder.cc)
+add_executable(memcat       memcat.cc)
+add_executable(memcp        memcp.cc)
+add_executable(memdump      memdump.cc)
+add_executable(memerror     memerror.cc)
+add_executable(memexist     memexist.cc)
+add_executable(memflush     memflush.cc)
+add_executable(memparse     memparse.cc)
+add_executable(memping      memping.cc)
+add_executable(memrm        memrm.cc)
+add_executable(memslap      memslap.cc generator.cc execute.cc)
+add_executable(memstat      memstat.cc)
+add_executable(memtouch     memtouch.cc)
+
+target_link_libraries(memcapable ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(memping memcachedutil)
+target_link_libraries(memslap ${CMAKE_THREAD_LIBS_INIT})
+
+find_library(LIBEVENT event)
+
+if(LIBEVENT)
+    add_executable(memaslap
+            memaslap.c generator.cc execute.cc ms_conn.c ms_setting.c ms_sigsegv.c ms_stats.c ms_task.c ms_thread.c)
+    target_link_libraries(memaslap event)
+endif()
index 85e84739835b0c3af8b8709a189f5eefa438c79d..9c4b7f534af6cc28934708d5f7e06e1aa63b51f2 100644 (file)
 #include <fcntl.h>
 #include <netinet/tcp.h>
 #include <netinet/in.h>
-#include <arpa/inet.h>
+
+#if defined(HAVE_ARPA_INET_H)
+# include <arpa/inet.h>
+#endif
 
 #if defined(HAVE_SYS_TIME_H)
 # include <sys/time.h>
diff --git a/libhashkit-1.0/CMakeLists.txt b/libhashkit-1.0/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8fa3e9a
--- /dev/null
@@ -0,0 +1,2 @@
+
+configure_file(configure.h.in configure.h @ONLY)
diff --git a/libhashkit/CMakeLists.txt b/libhashkit/CMakeLists.txt
new file mode 100644 (file)
index 0000000..36bb15b
--- /dev/null
@@ -0,0 +1,38 @@
+if(HSIEH)
+    set(HSIEH_CC hsieh.cc)
+else()
+    set(HSIEH_CC nohsieh.cc)
+endif()
+
+set(AUTOHEADER_FILE mem_config.h)
+configure_file(hashkitcon.h.in hashkitcon.h @ONLY)
+
+include_directories(..)
+
+add_library(hashkit
+        aes.cc
+        algorithm.cc
+        behavior.cc
+        crc32.cc
+        digest.cc
+        encrypt.cc
+        fnv_32.cc
+        fnv_64.cc
+        function.cc
+        has.cc
+        hashkit.cc
+        ${HSIEH_CC}
+        jenkins.cc
+        ketama.cc
+        md5.cc
+        murmur.cc
+        murmur3.cc
+        murmur3_api.cc
+        nohsieh.cc
+        one_at_a_time.cc
+        rijndael.cc
+        str_algorithm.cc
+        strerror.cc
+        string.cc
+        )
+target_compile_options(hashkit PRIVATE -DBUILDING_HASHKIT)
diff --git a/libmemcached-1.0/CMakeLists.txt b/libmemcached-1.0/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8fa3e9a
--- /dev/null
@@ -0,0 +1,2 @@
+
+configure_file(configure.h.in configure.h @ONLY)
index 3f0465a0ee8f8b71f0ebd1847a7203b4f8acc043..70b5e1ddbe520d91dca54321f3ab26428b86e4a9 100644 (file)
@@ -41,8 +41,8 @@
 extern "C" {
 #endif
 
-@DEPRECATED@
-@LIBMEMCACHED_WITH_SASL_SUPPORT@
+#cmakedefine DEPRECATED
+#cmakedefine LIBMEMCACHED_WITH_SASL_SUPPORT
 
 #define LIBMEMCACHED_VERSION_STRING "@LIBMEMCACHED_VERSION_STRING@"
 #define LIBMEMCACHED_VERSION_HEX @LIBMEMCACHED_VERSION_HEX@
diff --git a/libmemcached/CMakeLists.txt b/libmemcached/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a28aeb8
--- /dev/null
@@ -0,0 +1,58 @@
+
+add_subdirectory(csl)
+
+include_directories(..)
+
+add_library(memcached
+        allocators.cc
+        analyze.cc
+        array.c
+        auto.cc
+        backtrace.cc
+        behavior.cc
+        byteorder.cc
+        callback.cc
+        connect.cc
+        delete.cc
+        do.cc
+        dump.cc
+        encoding_key.cc
+        error.cc
+        exist.cc
+        fetch.cc
+        flag.cc
+        flush.cc
+        flush_buffers.cc
+        get.cc
+        hash.cc
+        hosts.cc
+        initialize_query.cc
+        instance.cc
+        io.cc
+        key.cc
+        memcached.cc
+        namespace.cc
+        options.cc
+        parse.cc
+        poll.cc
+        purge.cc
+        quit.cc
+        response.cc
+        result.cc
+        sasl.cc
+        server.cc
+        server_list.cc
+        stats.cc
+        storage.cc
+        strerror.cc
+        string.cc
+        touch.cc
+        udp.cc
+        verbosity.cc
+        version.cc
+        virtual_bucket.c
+        )
+
+target_link_libraries(memcached csl hashkit ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
+
+target_compile_definitions(memcached PRIVATE -DBUILDING_LIBMEMCACHED)
diff --git a/libmemcached/csl/CMakeLists.txt b/libmemcached/csl/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0200add
--- /dev/null
@@ -0,0 +1,18 @@
+
+find_package(FLEX)
+find_package(BISON)
+
+flex_target(CSL_SCANNER scanner.l ${CMAKE_SOURCE_DIR}/scanner.cc
+        DEFINES_FILE ${CMAKE_SOURCE_DIR}/scanner.h
+        )
+bison_target(CSL_PARSER parser.yy ${CMAKE_SOURCE_DIR}/parser.cc
+        DEFINES_FILE ${CMAKE_SOURCE_DIR}/parser.h
+        )
+add_flex_bison_dependency(CSL_SCANNER CSL_PARSER)
+
+include_directories(../..)
+add_library(csl STATIC
+        context.cc
+        ${BISON_CSL_PARSER_OUTPUTS}
+        ${FLEX_CSL_SCANNER_OUTPUTS}
+        )
index 44fb4358548177d1913d5d097e0baa7c502c840d..fa2500be61837d13df5ab223f63a6b4c76a356af 100644 (file)
@@ -38,7 +38,7 @@
 #include <libmemcached/csl/common.h>
 #include <libmemcached/csl/context.h>
 
-void Context::abort(const char *error_arg, yytokentype last_token, const char *last_token_str)
+void Context::abort(const char *error_arg, config_tokentype last_token, const char *last_token_str)
 {
   rc= MEMCACHED_PARSE_ERROR;
   (void)last_token;
@@ -58,7 +58,7 @@ void Context::abort(const char *error_arg, yytokentype last_token, const char *l
   memcached_set_parser_error(*memc, MEMCACHED_AT, "unknown parsing error");
 }
 
-void Context::error(const char *error_arg, yytokentype last_token, const char *last_token_str)
+void Context::error(const char *error_arg, config_tokentype last_token, const char *last_token_str)
 {
   rc= MEMCACHED_PARSE_ERROR;
   if (not error_arg)
index 8517fdfd38225818b111bc77d3f8ed2a1471ea64..64d1f2f35028b02052eba95493145c8cc06cf720 100644 (file)
@@ -106,8 +106,8 @@ public:
     return _hostname;
   }
 
-  void abort(const char *, yytokentype, const char *);
-  void error(const char *, yytokentype, const char* );
+  void abort(const char *, config_tokentype, const char *);
+  void error(const char *, config_tokentype, const char* );
 
   ~Context()
   {
@@ -116,7 +116,7 @@ public:
     memc->state.is_parsing= false;
   }
 
-  yytokentype previous_token;
+  config_tokentype previous_token;
   void *scanner;
   const char *buf;
   const char *begin;
index dd9c720b9631009f2ac0277eb51c2f2fdc7ae2ff..dba76a53072807b37c197f1142d62b32c9091abc 100644 (file)
@@ -42,17 +42,15 @@ class Context;
 
 %}
 
-%error-verbose
+%define parse.error verbose
+%define api.prefix {config_}
+%define api.pure
 %debug
 %defines
 %expect 0
-%output "libmemcached/csl/parser.cc"
-%defines "libmemcached/csl/parser.h"
 %lex-param { yyscan_t *scanner }
-%name-prefix="config_"
 %parse-param { class Context *context }
 %parse-param { yyscan_t *scanner }
-%pure-parser
 %require "2.5"
 %start begin
 %verbose
@@ -82,18 +80,18 @@ int conf_lex(YYSTYPE* lvalp, void* scanner);
 
 #define stryytname(__yytokentype) ((__yytokentype) <  YYNTOKENS ) ? yytname[(__yytokentype)] : ""
 
-#define parser_abort(__context, __error_message) do { (__context)->abort((__error_message), yytokentype(select_yychar(__context)), stryytname(YYTRANSLATE(select_yychar(__context)))); YYABORT; } while (0) 
+#define parser_abort(__context, __error_message) do { (__context)->abort((__error_message), config_tokentype(select_yychar(__context)), stryytname(YYTRANSLATE(select_yychar(__context)))); YYABORT; } while (0)
 
 // This is bison calling error.
 inline void __config_error(Context *context, yyscan_t *scanner, const char *error, int last_token, const char *last_token_str)
 {
   if (not context->end())
   {
-    context->error(error, yytokentype(last_token), last_token_str);
+    context->error(error, config_tokentype(last_token), last_token_str);
   }
   else
   {
-    context->error(error, yytokentype(last_token), last_token_str);
+    context->error(error, config_tokentype(last_token), last_token_str);
   }
 }
 
index bb233d6f2f0f4b4816589a80bad13b6228a143d8..6db562eca4d005783d54d0b80e7142f5dd3460e6 100644 (file)
 %option noinput
 %option nounput
 %option noyywrap
-%option outfile="libmemcached/csl/scanner.cc" header-file="libmemcached/csl/scanner.h"
 %option perf-report
 %option prefix="config_"
 %option reentrant
diff --git a/libmemcachedinternal/CMakeLists.txt b/libmemcachedinternal/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4a2fae1
--- /dev/null
@@ -0,0 +1,55 @@
+include_directories(..)
+
+add_library(memcachedinternal
+        ../libmemcached/allocators.cc
+        ../libmemcached/analyze.cc
+        ../libmemcached/array.c
+        ../libmemcached/auto.cc
+        ../libmemcached/backtrace.cc
+        ../libmemcached/behavior.cc
+        ../libmemcached/byteorder.cc
+        ../libmemcached/callback.cc
+        ../libmemcached/connect.cc
+        ../libmemcached/delete.cc
+        ../libmemcached/do.cc
+        ../libmemcached/dump.cc
+        ../libmemcached/encoding_key.cc
+        ../libmemcached/error.cc
+        ../libmemcached/exist.cc
+        ../libmemcached/fetch.cc
+        ../libmemcached/flag.cc
+        ../libmemcached/flush.cc
+        ../libmemcached/flush_buffers.cc
+        ../libmemcached/get.cc
+        ../libmemcached/hash.cc
+        ../libmemcached/hosts.cc
+        ../libmemcached/initialize_query.cc
+        ../libmemcached/instance.cc
+        ../libmemcached/io.cc
+        ../libmemcached/key.cc
+        ../libmemcached/memcached.cc
+        ../libmemcached/namespace.cc
+        ../libmemcached/options.cc
+        ../libmemcached/parse.cc
+        ../libmemcached/poll.cc
+        ../libmemcached/purge.cc
+        ../libmemcached/quit.cc
+        ../libmemcached/response.cc
+        ../libmemcached/result.cc
+        ../libmemcached/sasl.cc
+        ../libmemcached/server.cc
+        ../libmemcached/server_list.cc
+        ../libmemcached/stats.cc
+        ../libmemcached/storage.cc
+        ../libmemcached/strerror.cc
+        ../libmemcached/string.cc
+        ../libmemcached/touch.cc
+        ../libmemcached/udp.cc
+        ../libmemcached/verbosity.cc
+        ../libmemcached/version.cc
+        ../libmemcached/virtual_bucket.c
+        )
+
+target_link_libraries(memcachedinternal csl hashkit ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
+
+target_compile_definitions(memcachedinternal PRIVATE -DBUILDING_LIBMEMCACHEDINTERNAL)
diff --git a/libmemcachedutil/CMakeLists.txt b/libmemcachedutil/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ff17e2e
--- /dev/null
@@ -0,0 +1,15 @@
+
+find_package(Threads)
+
+add_library(memcachedutil
+        ../libmemcached/backtrace.cc
+        flush.cc
+        pid.cc
+        ping.cc
+        pool.cc
+        version.cc
+        )
+
+target_compile_definitions(memcachedutil PRIVATE -DBUILDING_LIBMEMCACHED)
+
+target_link_libraries(memcachedutil memcached ${CMAKE_THREAD_LIBS_INIT})