From a0434e8354abd8f0f5d6050ab6c43aca90941920 Mon Sep 17 00:00:00 2001 From: Clarence Date: Mon, 22 Feb 2021 18:07:14 +0800 Subject: [PATCH] [cmake-build] initial commit --- .gitignore | 4 + CMakeLists.txt | 95 +++ cmake/awk.cmake | 10 + cmake/glib.cmake | 16 + cmake/inline.cmake | 34 + cmake/openssl.cmake | 36 ++ cmake/pthread.cmake | 30 + cmake/size_compat.cmake | 23 + cmake/sofia.cmake | 206 ++++++ cmake/utils.cmake | 137 ++++ config.h.cmake | 604 ++++++++++++++++++ libsofia-sip-ua-glib/CMakeLists.txt | 19 + libsofia-sip-ua-glib/su-glib/CMakeLists.txt | 16 + libsofia-sip-ua/CMakeLists.txt | 30 + libsofia-sip-ua/bnf/CMakeLists.txt | 9 + libsofia-sip-ua/features/CMakeLists.txt | 6 + libsofia-sip-ua/http/CMakeLists.txt | 63 ++ libsofia-sip-ua/ipt/CMakeLists.txt | 11 + libsofia-sip-ua/iptsec/CMakeLists.txt | 22 + libsofia-sip-ua/msg/CMakeLists.txt | 84 +++ libsofia-sip-ua/nea/CMakeLists.txt | 10 + libsofia-sip-ua/nta/CMakeLists.txt | 31 + libsofia-sip-ua/nth/CMakeLists.txt | 22 + libsofia-sip-ua/nua/CMakeLists.txt | 35 + libsofia-sip-ua/sdp/CMakeLists.txt | 23 + libsofia-sip-ua/sip/CMakeLists.txt | 143 +++++ libsofia-sip-ua/soa/CMakeLists.txt | 18 + libsofia-sip-ua/sresolv/CMakeLists.txt | 24 + libsofia-sip-ua/stun/CMakeLists.txt | 18 + libsofia-sip-ua/su/CMakeLists.txt | 93 +++ .../su/sofia-sip/su_configure.h.cmake | 140 ++++ libsofia-sip-ua/tport/CMakeLists.txt | 33 + libsofia-sip-ua/url/CMakeLists.txt | 16 + s2check/CMakeLists.txt | 18 + tests/CMakeLists.txt | 38 ++ utils/CMakeLists.txt | 10 + 36 files changed, 2127 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/awk.cmake create mode 100644 cmake/glib.cmake create mode 100644 cmake/inline.cmake create mode 100644 cmake/openssl.cmake create mode 100644 cmake/pthread.cmake create mode 100644 cmake/size_compat.cmake create mode 100644 cmake/sofia.cmake create mode 100644 cmake/utils.cmake create mode 100644 config.h.cmake create mode 100644 libsofia-sip-ua-glib/CMakeLists.txt create mode 100644 libsofia-sip-ua-glib/su-glib/CMakeLists.txt create mode 100644 libsofia-sip-ua/CMakeLists.txt create mode 100644 libsofia-sip-ua/bnf/CMakeLists.txt create mode 100644 libsofia-sip-ua/features/CMakeLists.txt create mode 100644 libsofia-sip-ua/http/CMakeLists.txt create mode 100644 libsofia-sip-ua/ipt/CMakeLists.txt create mode 100644 libsofia-sip-ua/iptsec/CMakeLists.txt create mode 100644 libsofia-sip-ua/msg/CMakeLists.txt create mode 100644 libsofia-sip-ua/nea/CMakeLists.txt create mode 100644 libsofia-sip-ua/nta/CMakeLists.txt create mode 100644 libsofia-sip-ua/nth/CMakeLists.txt create mode 100644 libsofia-sip-ua/nua/CMakeLists.txt create mode 100644 libsofia-sip-ua/sdp/CMakeLists.txt create mode 100644 libsofia-sip-ua/sip/CMakeLists.txt create mode 100644 libsofia-sip-ua/soa/CMakeLists.txt create mode 100644 libsofia-sip-ua/sresolv/CMakeLists.txt create mode 100644 libsofia-sip-ua/stun/CMakeLists.txt create mode 100644 libsofia-sip-ua/su/CMakeLists.txt create mode 100644 libsofia-sip-ua/su/sofia-sip/su_configure.h.cmake create mode 100644 libsofia-sip-ua/tport/CMakeLists.txt create mode 100644 libsofia-sip-ua/url/CMakeLists.txt create mode 100644 s2check/CMakeLists.txt create mode 100644 tests/CMakeLists.txt create mode 100644 utils/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 0c134e29..708b332b 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,7 @@ test-driver utils/sip-date utils/sip-dig utils/sip-options + +#cmake +.idea +*build* diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..76e767c4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,95 @@ +cmake_minimum_required(VERSION 3.15) +project(sofia-sip C) + +# parse project version +file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.spec SPEC_VERSION_LINE REGEX "^Version: +") +string(REGEX REPLACE ".+ +(.+)" "\\1" PROJECT_VERSION ${SPEC_VERSION_LINE}) +set(PACKAGE_NAME "${PROJECT_NAME}") +set(PACKAGE_VERSION "${PROJECT_VERSION}") +set(VERSION "${PROJECT_VERSION}") +message(STATUS "${PROJECT_NAME}: ${PROJECT_VERSION}") + +# project default make options +option(ENABLE_NTH "HTTP-related modules nth and http (enabled)" ON) +option(ENABLE_STUN "enable stun module (enabled)" ON) +option(ENABLE_NTLM "enable NTLM support (disabled)" OFF) +option(ENABLE_MEMLEAK_LOG "enable logging of possible memory leaks (disabled)" OFF) +option(ENABLE_TAG_CAST "cast tag values with inlined functions (enabled)" ON) +option(ENABLE_TESTS "enable ctest framework" OFF) + +SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +include(glib) +include(inline) +include(openssl) +include(pthread) +include(size_compat) +include(sofia) +include(FindUnixCommands) + +# find pkg-config command +find_package(PkgConfig REQUIRED) + +# Whether hava check library +pkg_check_modules(CHECK check>=0.9.4) +if (CHECK_FOUND) + set(HAVE_CHECK 1) +endif (CHECK_FOUND) + +# Check whether enable NTLM +if (ENABLE_NTLM) + set(HAVE_NTLM 1) + set(HAVE_SOFIA_NTLM 1) +endif (ENABLE_NTLM) + +# Check whether enable memory leak log +if (ENABLE_MEMLEAK_LOG) + set(HAVE_MEMLEAK_LOG 1) +endif (ENABLE_MEMLEAK_LOG) + +# Check whether enable stun +if (ENABLE_STUN) + set(HAVE_STUN 1) + set(HAVE_SOFIA_STUN 1) + if (NOT HAVE_OPENSSL) + message(WARNING "** TLS support for STUN disabled as OpenSSL headers and/or libraries were not found **") + endif (NOT HAVE_OPENSSL) +endif (ENABLE_STUN) + +# Check whether enable nth +if (ENABLE_NTH) + set(HAVE_NTH 1) +endif (ENABLE_NTH) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/config.h +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/s2check + ${CMAKE_CURRENT_SOURCE_DIR}/tests + ${CMAKE_CURRENT_BINARY_DIR} +) + +# whether enable tests +if (ENABLE_TESTS) + include(CTest) +endif (ENABLE_TESTS) +if (NOT ENABLE_TESTS AND ENABLE_MODULE_TEST) + string(TOUPPER "enable_${ENABLE_MODULE_TEST}_TESTS" _var) + set(${_var} 1) + if (ENABLE_TPORT_TESTS) + set(ENABLE_MSG_TESTS 1) + endif () + include(CTest) +endif (NOT ENABLE_TESTS AND ENABLE_MODULE_TEST) + +add_compile_options(-fPIC) +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/dummy.c) +add_library(empty OBJECT ${CMAKE_CURRENT_BINARY_DIR}/dummy.c) + +add_subdirectory(libsofia-sip-ua) +add_subdirectory(libsofia-sip-ua-glib) +add_subdirectory(s2check) +add_subdirectory(tests) +add_subdirectory(utils) diff --git a/cmake/awk.cmake b/cmake/awk.cmake new file mode 100644 index 00000000..d91b68dd --- /dev/null +++ b/cmake/awk.cmake @@ -0,0 +1,10 @@ +if (__AWK_INCLUDED) + return() +endif (__AWK_INCLUDED) +set(__AWK_INCLUDED TRUE) + +# find awk program +find_program(AWK awk mawk gawk) +if (AWK MATCHES ".+-NOTFOUND") + message(FATAL_ERROR "FATAL: awk (and mawk and gawk) could not be found (${AWK}).") +endif () diff --git a/cmake/glib.cmake b/cmake/glib.cmake new file mode 100644 index 00000000..a8de4fb7 --- /dev/null +++ b/cmake/glib.cmake @@ -0,0 +1,16 @@ +if (__GLIB_INCLUDED) + return() +endif (__GLIB_INCLUDED) +set(__GLIB_INCLUDED TRUE) + +set(WITH_GLIB_VERSION "2.0" CACHE STRING "use GLib (default=2.0)") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(GLIB glib-${WITH_GLIB_VERSION}) + +if (NOT GLIB_FOUND) + return() +endif (NOT GLIB_FOUND) + +set(HAVE_GLIB 1) +include_directories(${GLIB_INCLUDE_DIRS}) diff --git a/cmake/inline.cmake b/cmake/inline.cmake new file mode 100644 index 00000000..4ab977a0 --- /dev/null +++ b/cmake/inline.cmake @@ -0,0 +1,34 @@ +if (__INLINE_INCLUDED) + return() +endif (__INLINE_INCLUDED) +set(__INLINE_INCLUDED TRUE) + +include(CheckCSourceCompiles) + +foreach (KEYWORD "inline" "__inline__" "__inline") + set(_INLINE_SOURCE " + typedef int foo_t; + static ${KEYWORD} foo_t static_foo (void) {return 0; } + ${KEYWORD} foo_t foo (void) {return 0; } + int main() { return 0; } + ") + check_c_source_compiles("${_INLINE_SOURCE}" _${KEYWORD}_COMPLIED) + if (_${KEYWORD}_COMPLIED) + set(C_INLINE ${KEYWORD}) + break() + endif (_${KEYWORD}_COMPLIED) +ENDFOREACH (KEYWORD) + +# Whether inline +if (DEFINED C_INLINE) + set(SU_HAVE_INLINE 1) + set(SU_INLINE ${C_INLINE}) + set(su_inline "static ${C_INLINE}") + if (ENABLE_TAG_CAST) + set(SU_INLINE_TAG_CAST 1) + endif (ENABLE_TAG_CAST) +else () + set(SU_HAVE_INLINE 0) + set(SU_INLINE /*inline*/) + set(su_inline static) +endif () diff --git a/cmake/openssl.cmake b/cmake/openssl.cmake new file mode 100644 index 00000000..b2471fbb --- /dev/null +++ b/cmake/openssl.cmake @@ -0,0 +1,36 @@ +if (__OPENSSL_INCLUDED) + return() +endif (__OPENSSL_INCLUDED) +set(__OPENSSL_INCLUDED TRUE) + +option(ENABLE_TLS "use OpenSSL (enabled)" ON) +if (NOT ENABLE_TLS) + return() +endif (NOT ENABLE_TLS) + +include(utils) +sofia_include_file(openssl/tls1.h) + +# Check Whether enable tls +find_package(PkgConfig REQUIRED) +pkg_check_modules(OPENSSL openssl) +if (OPENSSL_FOUND) + set(HAVE_LIBCRYPTO 1) + set(HAVE_OPENSSL 1) + set(HAVE_LIBSSL 1) + set(HAVE_TLS 1) + link_libraries(${OPENSSL_LIBRARIES}) +else (OPENSSL_FOUND) + if (HAVE_OPENSSL_TLS1_H) + sofia_library_exists(crypto BIO_new HAVE_OPENSSL) + if (NOT HAVE_OPENSSL) + message(WARNING "OpenSSL crypto library was not found") + endif (NOT HAVE_OPENSSL) + sofia_library_exists(ssl TLSv1_method HAVE_TLS) + if (NOT HAVE_TLS) + message(WARNING "OpenSSL protocol library was not found") + endif (NOT HAVE_TLS) + else (HAVE_OPENSSL_TLS1_H) + message(WARNING "OpenSSL include files were not found") + endif (HAVE_OPENSSL_TLS1_H) +endif (OPENSSL_FOUND) diff --git a/cmake/pthread.cmake b/cmake/pthread.cmake new file mode 100644 index 00000000..f8676b20 --- /dev/null +++ b/cmake/pthread.cmake @@ -0,0 +1,30 @@ +if (__PTHREAD_INCLUDED) + return() +endif (__PTHREAD_INCLUDED) +set(__PTHREAD_INCLUDED TRUE) + +include(utils) + +sofia_include_file(pthread.h) +if (NOT HAVE_PTHREAD_H) + return() +endif (NOT HAVE_PTHREAD_H) + +link_libraries(pthread) +sofia_library_exists(pthread pthread_create) + +# Define if you have pthread_setschedparam() +sofia_library_exists(pthread pthread_setschedparam HAVE_PTHREAD_SETSCHEDPARAM) + +set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} pthread) +sofia_source_runs(" + pthread_rwlock_t rw; + int main() { + pthread_rwlock_init(&rw, NULL); + pthread_rwlock_rdlock(&rw); + pthread_rwlock_rdlock(&rw); + pthread_rwlock_unlock(&rw); + /* pthread_rwlock_trywrlock() should fail (not return 0) */ + return pthread_rwlock_trywrlock(&rw) != 0 ? 0 : 1; + } + " HAVE_PTHREAD_RWLOCK) diff --git a/cmake/size_compat.cmake b/cmake/size_compat.cmake new file mode 100644 index 00000000..4a1b8baa --- /dev/null +++ b/cmake/size_compat.cmake @@ -0,0 +1,23 @@ +if (__SIZE_COMPAT_INCLUDED) + return() +endif (__SIZE_COMPAT_INCLUDED) +set(__SIZE_COMPAT_INCLUDED TRUE) + +option(ENABLE_SIZE_COMPAT "use compatibility size_t types" OFF) + +# define sofia_size_t +if (ENABLE_SIZE_COMPAT) + set(SOFIA_ISIZE_T size_t) + set(ISIZE_MAX SIZE_MAX) + set(SOFIA_ISSIZE_T ssize_t) + set(ISSIZE_MAX SSIZE_MAX) + set(SOFIA_USIZE_T size_t) + set(USIZE_MAX SIZE_MAX) +else () + set(SOFIA_ISIZE_T int) + set(ISIZE_MAX INT_MAX) + set(SOFIA_ISSIZE_T int) + set(ISSIZE_MAX INT_MAX) + set(SOFIA_USIZE_T unsigned) + set(USIZE_MAX UINT_MAX) +endif (ENABLE_SIZE_COMPAT) diff --git a/cmake/sofia.cmake b/cmake/sofia.cmake new file mode 100644 index 00000000..05bf54ec --- /dev/null +++ b/cmake/sofia.cmake @@ -0,0 +1,206 @@ +if (__SOFIA_INCLUDED) + return() +endif (__SOFIA_INCLUDED) +set(__SOFIA_INCLUDED TRUE) + +include(utils) + +option(ENABLE_IP6 "enable IPv6 functionality (enabled)" ON) + +# static definitions +set(HAVE_SOFIA_SIP 1) +set(HAVE_SOFIA_SRESOLV 1) +set(HAVE_SOFIA_SMIME 0) + +# Check whether include headers exists +sofia_include_file(stdio.h) +sofia_include_file(stdlib.h) +sofia_include_file(stddef.h) +sofia_include_file(string.h) +sofia_include_file(strings.h) +sofia_include_file(signal.h) +sofia_include_file(stdint.h) +sofia_include_file(inttypes.h) +sofia_include_file(unistd.h) +sofia_include_file(sys/time.h) +sofia_include_file(fcntl.h) +sofia_include_file(dlfcn.h) +sofia_include_file(dirent.h) +sofia_include_file(sys/socket.h) +sofia_include_file(sys/types.h) +sofia_include_file(sys/ioctl.h) +sofia_include_file(sys/filio.h) +sofia_include_file(sys/sockio.h) +sofia_include_file(sys/select.h) +sofia_include_file(sys/epoll.h) +sofia_include_file(sys/devpoll.h) +sofia_include_file(sys/stat.h) +sofia_include_file(netdb.h) +sofia_include_file(netinet/in.h) +sofia_include_file(netinet/sctp.h) +sofia_include_file(netinet/tcp.h) +sofia_include_file(arpa/inet.h) +sofia_include_file(net/if.h) +sofia_include_file(net/if_types.h) +sofia_include_file(ifaddr.h) +sofia_include_file(netpacket/packet.h) +sofia_include_file(winsock2.h) +sofia_include_file(windef.h) +sofia_include_file(ws2tcpip.h) +sofia_include_file(iphlpapi.h) +sofia_include_file(alloca.h) +sofia_include_file(fnmatch.h) + +# Check whether symbol or function exists +sofia_symbol_exists(memmem) +sofia_symbol_exists(memspn) +sofia_symbol_exists(memcspn) +sofia_symbol_exists(memccpy) +sofia_symbol_exists(getopt) +sofia_symbol_exists(clock_getcpuclockid) +sofia_symbol_exists(clock_gettime) +sofia_symbol_exists(epoll_create) +sofia_symbol_exists(poll) +sofia_symbol_exists(socket) +sofia_symbol_exists(flock) +sofia_symbol_exists(freeaddrinfo) +sofia_symbol_exists(alloca) +sofia_symbol_exists(alarm) +sofia_symbol_exists(__func__ HAVE_FUNC) +sofia_symbol_exists(__FUNCTION__ HAVE_FUNCTION) +sofia_symbol_exists(gai_strerror) +sofia_symbol_exists(getaddrinfo) +sofia_symbol_exists(getdelim) +sofia_symbol_exists(gethostbyname) +sofia_symbol_exists(gethostname) +sofia_symbol_exists(getifaddrs) +sofia_symbol_exists(getipnodebyname) +sofia_symbol_exists(getline) +sofia_symbol_exists(getnameinfo) +sofia_symbol_exists(getpass) +sofia_symbol_exists(gettimeofday) +sofia_symbol_exists(if_nameindex) +sofia_symbol_exists(inet_ntop) +sofia_symbol_exists(inet_pton) +sofia_symbol_exists(initstate) +sofia_symbol_exists(kqueue) +sofia_symbol_exists(random) +sofia_symbol_exists(select) +sofia_symbol_exists(signal) +sofia_symbol_exists(socketpair) +sofia_symbol_exists(strerror) +sofia_symbol_exists(strnlen) +sofia_symbol_exists(strtoull) +sofia_symbol_exists(tcsetattr) +sofia_symbol_exists(MSG_TRUNC HAVE_MSG_TRUNC) + +# Check whether type exists +sofia_type_exists("const int" HAVE_CONST) +sofia_type_exists("struct addrinfo" HAVE_ADDRINFO) +sofia_type_exists("long long" HAVE_LONG_LONG) +sofia_type_exists("struct sockaddr_storage" HAVE_SOCKADDR_STORAGE) +sofia_type_exists("struct addrinfo" HAVE_ADDRINFO) +sofia_library_exists(z compress HAVE_ZLIB) +sofia_library_exists(dl dlopen HAVE_LIBDL) +sofia_struct_has_member("struct sockaddr" "sa_len" HAVE_SA_LEN) + +# Check whether have in6 in +if (ENABLE_IP6) + sofia_type_exists("struct sockaddr_in6" HAVE_SIN6) + if (HAVE_SIN6) + set(SU_HAVE_IN6 1) + endif (HAVE_SIN6) +endif (ENABLE_IP6) + +# Check whether epoll interface +if (HAVE_EPOLL_CREATE AND HAVE_SYS_EPOLL_H) + set(HAVE_EPOLL 1) +endif () +if (HAVE_POLL) + set(HAVE_POLL_PORT 1) +endif (HAVE_POLL) + +# Check Whether have zlib +if (HAVE_ZLIB) + link_libraries(z) + set(HAVE_ZLIB_COMPRESS 1) +endif (HAVE_ZLIB) + +# Define to empty if `const' does not conform to ANSI C. +if (NOT HAVE_CONST) + set(const " ") +endif (NOT HAVE_CONST) + +# Define size_t to `unsigned int' if does not define. +if (NOT HAVE_SYS_TYPES_H) + set(size_t "unsigned int") +endif (NOT HAVE_SYS_TYPES_H) + +# Check whether long long type +if (HAVE_LONG_LONG) + set(longlong "long long") +endif (HAVE_LONG_LONG) + +# Check whether /dev/urandom device +execute_process(COMMAND test -r /dev/urandom ERROR_VARIABLE TEST_URANDOM_ERROR) +if (NOT TEST_URANDOM_ERROR) + set(DEV_URANDOM 1) + set(HAVE_DEV_URANDOM 1) +endif () + +# Check whether c99 'size specifiers' supported +sofia_source_runs(" + int main() { + char buf[64]; + if (sprintf(buf, \"%lld%hhd%jd%zd%td\", (long long int)1, (char)2, (intmax_t)3, (size_t)4, (ptrdiff_t)5) != 5) { + return 1; + } + return strcmp(buf, \"12345\"); + } +" HAVE_C99_FORMAT) +if (HAVE_C99_FORMAT) + set(LLU %llu) + set(LLI %lli) + set(LLX %llx) + set(MOD_ZD %zd) + set(MOD_ZU %zu) +else (HAVE_C99_FORMAT) + sofia_source_runs(" + int main() { + char buf[64]; + if (sprintf(buf, \"%lld\", (long long int)1) != 1) return 1; + return strcmp(buf, \"1\"); + } + " HAVE_LL_FORMAT) + sofia_source_runs(" + int main() { + char buf[64]; + if (sprintf(buf, \"%zd\", (size_t)1) != 1) return 1; + return strcmp(buf, \"1\"); + } + " HAVE_Z_FORMAT) + if (NOT HAVE_LL_FORMAT) + message(FATAL_ERROR "printf cannot handle 64-bit integers") + endif (NOT HAVE_LL_FORMAT) + if (NOT HAVE_Z_FORMAT) + message(WARNING "printf cannot handle size_t, using long instead") + endif (NOT HAVE_Z_FORMAT) + + set(LLU %llu) + set(LLI %lli) + set(LLX %llx) + set(MOD_ZD %ld) + set(MOD_ZU %lu) +endif (HAVE_C99_FORMAT) + +# Check RETSIGTYPE +sofia_source_runs(" + int main() { + return *(signal (0, 0)) (0) == 1; + } +" HAVE_TYPE_SIGNAL_INT) +if (HAVE_TYPE_SIGNAL_INT) + set(RETSIGTYPE int) +else (HAVE_TYPE_SIGNAL_INT) + set(RETSIGTYPE void) +endif (HAVE_TYPE_SIGNAL_INT) diff --git a/cmake/utils.cmake b/cmake/utils.cmake new file mode 100644 index 00000000..7dbec9fb --- /dev/null +++ b/cmake/utils.cmake @@ -0,0 +1,137 @@ +if (__UTILS_INCLUDED) + return() +endif (__UTILS_INCLUDED) +set(__UTILS_INCLUDED TRUE) + +include(awk) +include(CMakeParseArguments) +include(CheckCSourceCompiles) +include(CheckCSourceRuns) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckLibraryExists) +include(CheckStructHasMember) +include(CheckSymbolExists) + +macro(sofia_include_file header) + string(REGEX REPLACE "[^a-zA-Z0-9]" "_" _file ${header}) + string(TOUPPER "have_${_file}" _var) + check_include_file(${header} ${_var}) + if (${_var}) + set(SU_${_var} 1) + if (NOT "${header}" IN_LIST CMAKE_EXTRA_INCLUDE_FILES) + list(APPEND CMAKE_EXTRA_INCLUDE_FILES ${header}) + endif () + endif (${_var}) +endmacro(sofia_include_file) + +macro(sofia_symbol_exists symbol) + set(_var "${ARGN}") + if ("${_var}" STREQUAL "") + string(REGEX REPLACE "[^a-zA-Z0-9]" "_" _symbol ${symbol}) + string(TOUPPER "have_${_symbol}" _var) + endif () + + check_symbol_exists(${symbol} "${CMAKE_EXTRA_INCLUDE_FILES}" _symbol_${_var}) + if (${_symbol_${_var}}) + set(${_var} ${_symbol_${_var}}) + else () + check_function_exists(${symbol} ${_var}) + endif () + if (${_var}) + set(SU_${_var} 1) + endif (${_var}) +endmacro(sofia_symbol_exists) + +macro(sofia_struct_has_member struct member var) + check_struct_has_member(${struct} ${member} "${CMAKE_EXTRA_INCLUDE_FILES}" ${var}) + if (${var}) + set(SU_${var} 1) + endif (${var}) +endmacro(sofia_struct_has_member) + +macro(sofia_type_exists type var) + set(_sofia_c_source) + foreach (_c_header ${CMAKE_EXTRA_INCLUDE_FILES}) + SET(_sofia_c_source "${_sofia_c_source} + #include <${_c_header}>") + endforeach (_c_header) + set(_sofia_c_source "${_sofia_c_source} + int main() { + ${type} var_exists; + (void)var_exists; + return 0; + } + ") + check_c_source_compiles("${_sofia_c_source}" ${var}) + if (${var}) + set(SU_${var} 1) + endif (${var}) +endmacro(sofia_type_exists) + +macro(sofia_source_runs source var) + set(_sofia_c_source) + foreach (_c_header ${CMAKE_EXTRA_INCLUDE_FILES}) + SET(_sofia_c_source "${_sofia_c_source} + #include <${_c_header}>") + endforeach (_c_header) + set(_sofia_c_source "${_sofia_c_source} + ${source} + ") + check_c_source_runs("${_sofia_c_source}" "${var}") + if (${var}) + set(SU_${var} 1) + endif (${var}) +endmacro(sofia_source_runs) + +macro(sofia_library_exists library function) + set(_var "${ARGN}") + if ("${_var}" STREQUAL "") + string(TOUPPER "have_${library}" _var) + endif () + find_library(_${library}_location NAMES ${library}) + check_library_exists("${library}" "${function}" "${_${library}_location}" "${_var}") + if (${_var}) + set(SU_${_var} 1) + endif (${_var}) +endmacro(sofia_library_exists) + +## Generating xxx_tag_ref.c +function (sofia_generate_tag_ref) + # parse arguments + cmake_parse_arguments(TAG "DLLREF;LIST" "PREFIX" "" ${ARGN}) + + # parse file prefix + if (TAG_PREFIX) + set(_prefix ${TAG_PREFIX}) + else (TAG_PREFIX) + string(REGEX REPLACE ".+/(.+)" "\\1" _prefix ${CMAKE_CURRENT_SOURCE_DIR}) + endif (TAG_PREFIX) + + # parse dll flags + set(_dll_flags NODLL=1) + if (${TAG_DLLREF}) + set(_dll_flags "${_dll_flags} DLLREF=1") + endif (${TAG_DLLREF}) + if (${TAG_LIST}) + set(_dll_flags "${_dll_flags} LIST=${_prefix}_tag_list") + endif (${TAG_LIST}) + + # source file and target file + set(_depends) + set(_source ${CMAKE_CURRENT_SOURCE_DIR}/${_prefix}_tag.c) + set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_prefix}_tag_ref.c) + set(_awk_file ${CMAKE_SOURCE_DIR}/libsofia-sip-ua/su/tag_dll.awk) + if (NOT EXISTS ${_source}) + set(_source ${CMAKE_CURRENT_BINARY_DIR}/${_prefix}_tag.c) + set(_depends ${_source}) + endif () + + # add xxx_tag_ref.c target + add_custom_command( + OUTPUT ${_target} + COMMAND ${AWK} -f ${_awk_file} NODLL=1 ${dll_flags} REF=${_target} ${_source} + DEPENDS ${_depends} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endfunction (sofia_generate_tag_ref) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 00000000..07bef8ad --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,604 @@ +/* Define if building universal (internal helper macro) */ +#cmakedefine AC_APPLE_UNIVERSAL_BUILD @AC_APPLE_UNIVERSAL_BUILD@ + +/* Define to 1 if using 'alloca.c'. */ +#cmakedefine C_ALLOCA @C_ALLOCA@ + +/* Define to the random number source name. */ +#cmakedefine DEV_URANDOM @DEV_URANDOM@ + +/* Define to 1 if you have addrinfo structure. */ +#cmakedefine HAVE_ADDRINFO @HAVE_ADDRINFO@ + +/* Define to 1 if you have the `alarm' function. */ +#cmakedefine HAVE_ALARM @HAVE_ALARM@ + +/* Define to 1 if you have 'alloca', as a function or macro. */ +#cmakedefine HAVE_ALLOCA @HAVE_ALLOCA@ + +/* Define to 1 if works. */ +#cmakedefine HAVE_ALLOCA_H @HAVE_ALLOCA_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_INET_H @HAVE_ARPA_INET_H@ + +/* Define to 1 if printf supports C99 size specifiers */ +#cmakedefine HAVE_C99_FORMAT @HAVE_C99_FORMAT@ + +/* Define to 1 if check library is available */ +#cmakedefine HAVE_CHECK @HAVE_CHECK@ + +/* Define to 1 if you have the `clock_getcpuclockid' function. */ +#cmakedefine HAVE_CLOCK_GETCPUCLOCKID @HAVE_CLOCK_GETCPUCLOCKID@ + +/* Define to 1 if you have the `clock_gettime' function. */ +#cmakedefine HAVE_CLOCK_GETTIME @HAVE_CLOCK_GETTIME@ + +/* Define to 1 if you have CLOCK_MONOTONIC */ +#cmakedefine HAVE_CLOCK_MONOTONIC @HAVE_CLOCK_MONOTONIC@ + +/* Defined when gcov is enabled to force by changing config.h */ +#cmakedefine HAVE_COVERAGE @HAVE_COVERAGE@ + +/* Define to 1 if you have /dev/urandom. */ +#cmakedefine HAVE_DEV_URANDOM @HAVE_DEV_URANDOM@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@ + +/* Define to 1 if you have epoll interface. */ +#cmakedefine HAVE_EPOLL @HAVE_EPOLL@ + +/* Define to 1 if you have the `epoll_create' function. */ +#cmakedefine HAVE_EPOLL_CREATE @HAVE_EPOLL_CREATE@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H @HAVE_FCNTL_H@ + +/* Define to 1 if you have WIN32 FILETIME type and GetSystemTimeAsFileTime(). +*/ +#cmakedefine HAVE_FILETIME @HAVE_FILETIME@ + +/* Define to 1 if you have the `flock' function. */ +#cmakedefine HAVE_FLOCK @HAVE_FLOCK@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FNMATCH_H @HAVE_FNMATCH_H@ + +/* Define to 1 if you have the `freeaddrinfo' function. */ +#cmakedefine HAVE_FREEADDRINFO @HAVE_FREEADDRINFO@ + +/* Define this as 1 if your c library does not crash with free(0) */ +#cmakedefine HAVE_FREE_NULL @HAVE_FREE_NULL@ + +/* Define to 1 if the C compiler supports __func__ */ +#cmakedefine HAVE_FUNC @HAVE_FUNC@ + +/* Define to 1 if the C compiler supports __FUNCTION__ */ +#cmakedefine HAVE_FUNCTION @HAVE_FUNCTION@ + +/* Define to 1 if you have the `gai_strerror' function. */ +#cmakedefine HAVE_GAI_STRERROR @HAVE_GAI_STRERROR@ + +/* Define to 1 if you have the `getaddrinfo' function. */ +#cmakedefine HAVE_GETADDRINFO @HAVE_GETADDRINFO@ + +/* Define to 1 if you have the `getdelim' function. */ +#cmakedefine HAVE_GETDELIM @HAVE_GETDELIM@ + +/* Define to 1 if you have the `gethostbyname' function. */ +#cmakedefine HAVE_GETHOSTBYNAME @HAVE_GETHOSTBYNAME@ + +/* Define to 1 if you have the `gethostname' function. */ +#cmakedefine HAVE_GETHOSTNAME @HAVE_GETHOSTNAME@ + +/* Define to 1 if you have the `getifaddrs' function. */ +#cmakedefine HAVE_GETIFADDRS @HAVE_GETIFADDRS@ + +/* Define to 1 if you have the `getipnodebyname' function. */ +#cmakedefine HAVE_GETIPNODEBYNAME @HAVE_GETIPNODEBYNAME@ + +/* Define to 1 if you have the `getline' function. */ +#cmakedefine HAVE_GETLINE @HAVE_GETLINE@ + +/* Define to 1 if you have the `getnameinfo' function. */ +#cmakedefine HAVE_GETNAMEINFO @HAVE_GETNAMEINFO@ + +/* Define to 1 if you have the `getpass' function. */ +#cmakedefine HAVE_GETPASS @HAVE_GETPASS@ + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY @HAVE_GETTIMEOFDAY@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IFADDR_H @HAVE_IFADDR_H@ + +/* Define to 1 if you have SIOCGIFCONF */ +#cmakedefine HAVE_IFCONF @HAVE_IFCONF@ + +/* Define to 1 if you have SIOCGIFNUM ioctl */ +#cmakedefine HAVE_IFNUM @HAVE_IFNUM@ + +/* Define to 1 if you have ifr_ifindex in */ +#cmakedefine HAVE_IFR_IFINDEX @HAVE_IFR_IFINDEX@ + +/* Define to 1 if you have ifr_index in */ +#cmakedefine HAVE_IFR_INDEX @HAVE_IFR_INDEX@ + +/* Define to 1 if you have the `if_nameindex' function. */ +#cmakedefine HAVE_IF_NAMEINDEX @HAVE_IF_NAMEINDEX@ + +/* Define to 1 if you have the `inet_ntop' function. */ +#cmakedefine HAVE_INET_NTOP @HAVE_INET_NTOP@ + +/* Define to 1 if you have the `inet_pton' function. */ +#cmakedefine HAVE_INET_PTON @HAVE_INET_PTON@ + +/* Define to 1 if you have the `initstate' function. */ +#cmakedefine HAVE_INITSTATE @HAVE_INITSTATE@ + +/* Define to 1 if you have inlining compiler */ +#cmakedefine HAVE_INLINE @HAVE_INLINE@ + +/* Define to 1 if you have WIN32 INTERFACE_INFO_EX type. */ +#cmakedefine HAVE_INTERFACE_INFO_EX @HAVE_INTERFACE_INFO_EX@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IPHLPAPI_H @HAVE_IPHLPAPI_H@ + +/* Define to 1 if you have IPV6_RECVERR in */ +#cmakedefine HAVE_IPV6_RECVERR @HAVE_IPV6_RECVERR@ + +/* Define to 1 if you have IP_ADD_MEMBERSHIP */ +#cmakedefine HAVE_IP_ADD_MEMBERSHIP @HAVE_IP_ADD_MEMBERSHIP@ + +/* Define to 1 if you have IP_MTU_DISCOVER */ +#cmakedefine HAVE_IP_MTU_DISCOVER @HAVE_IP_MTU_DISCOVER@ + +/* Define to 1 if you have IP_MULTICAST_LOOP */ +#cmakedefine HAVE_IP_MULTICAST_LOOP @HAVE_IP_MULTICAST_LOOP@ + +/* Define to 1 if you have IP_RECVERR in */ +#cmakedefine HAVE_IP_RECVERR @HAVE_IP_RECVERR@ + +/* Define to 1 if you have the `kqueue' function. */ +#cmakedefine HAVE_KQUEUE @HAVE_KQUEUE@ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#cmakedefine HAVE_LIBCRYPTO @HAVE_LIBCRYPTO@ + +/* Define to 1 if dl library is available */ +#cmakedefine HAVE_LIBDL @HAVE_LIBDL@ + +/* Define to 1 if you have the `gcov' library (-lgcov). */ +#cmakedefine HAVE_LIBGCOV @HAVE_LIBGCOV@ + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#cmakedefine HAVE_LIBPTHREAD @HAVE_LIBPTHREAD@ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#cmakedefine HAVE_LIBSOCKET @HAVE_LIBSOCKET@ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#cmakedefine HAVE_LIBSSL @HAVE_LIBSSL@ + +/* Define to 1 if you have the `memccpy' function. */ +#cmakedefine HAVE_MEMCCPY @HAVE_MEMCCPY@ + +/* Define to 1 if you have the `memcspn' function. */ +#cmakedefine HAVE_MEMCSPN @HAVE_MEMCSPN@ + +/* Define to 1 for memory-leak-related logging */ +#cmakedefine HAVE_MEMLEAK_LOG @HAVE_MEMLEAK_LOG@ + +/* Define to 1 if you have the `memmem' function. */ +#cmakedefine HAVE_MEMMEM @HAVE_MEMMEM@ + +/* Define to 1 if you have the `memspn' function. */ +#cmakedefine HAVE_MEMSPN @HAVE_MEMSPN@ + +/* Define to 1 if you are compiling in MinGW environment */ +#cmakedefine HAVE_MINGW @HAVE_MINGW@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MINIX_CONFIG_H @HAVE_MINIX_CONFIG_H@ + +/* Define to 1 if you have MSG_TRUNC flag */ +#cmakedefine HAVE_MSG_TRUNC @HAVE_MSG_TRUNC@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETDB_H @HAVE_NETDB_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_IN_H @HAVE_NETINET_IN_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_SCTP_H @HAVE_NETINET_SCTP_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_TCP_H @HAVE_NETINET_TCP_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETPACKET_PACKET_H @HAVE_NETPACKET_PACKET_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NET_IF_H @HAVE_NET_IF_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NET_IF_TYPES_H @HAVE_NET_IF_TYPES_H@ + +/* Define to 1 if you have OpenSSL */ +#cmakedefine HAVE_OPENSSL @HAVE_OPENSSL@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_TLS1_H @HAVE_OPENSSL_TLS1_H@ + +/* Define to 1 if you have the `poll' function. */ +#cmakedefine HAVE_POLL @HAVE_POLL@ + +/* Define to 1 if you use poll in su_port. */ +#cmakedefine HAVE_POLL_PORT @HAVE_POLL_PORT@ + +/* Define to 1 if you have /proc/net/if_inet6 control file */ +#cmakedefine HAVE_PROC_NET_IF_INET6 @HAVE_PROC_NET_IF_INET6@ + +/* + * Define to 1 if you have working pthread_rwlock_t implementation. A thread + * may hold multiple concurrent read locks on rwlock - that is, successfully + * call the pthread_rwlock_rdlock() function n times. If so, the application + * shall ensure that the thread performs matching unlocks - that is, it calls + * the pthread_rwlock_unlock() function n times. + **/ +#cmakedefine HAVE_PTHREAD_RWLOCK @HAVE_PTHREAD_RWLOCK@ + +/* Define if you have pthread_setschedparam() */ +#cmakedefine HAVE_PTHREAD_SETSCHEDPARAM @HAVE_PTHREAD_SETSCHEDPARAM@ + +/* Define to 1 if you have the `random' function. */ +#cmakedefine HAVE_RANDOM @HAVE_RANDOM@ + +/* Define to 1 if you have sa_len in struct sockaddr */ +#cmakedefine HAVE_SA_LEN @HAVE_SA_LEN@ + +/* Define to 1 if you have SCTP */ +#cmakedefine HAVE_SCTP @HAVE_SCTP@ + +/* Define to 1 if you have the `select' function. */ +#cmakedefine HAVE_SELECT @HAVE_SELECT@ + +/* Define to 1 if you have Sofia sigcomp >= 2.5 */ +#cmakedefine HAVE_SIGCOMP @HAVE_SIGCOMP@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SIGCOMP_H @HAVE_SIGCOMP_H@ + +/* Define to 1 if you have the `signal' function. */ +#cmakedefine HAVE_SIGNAL @HAVE_SIGNAL@ + +/* Define to 1 if you have SIGPIPE */ +#cmakedefine HAVE_SIGPIPE @HAVE_SIGPIPE@ + +/* Define to 1 if you have IPv6 structures and constants */ +#cmakedefine HAVE_SIN6 @HAVE_SIN6@ + +/* Define to 1 if you have WIN32 WSAIoctl SIO_ADDRESS_LIST_QUERY. */ +#cmakedefine HAVE_SIO_ADDRESS_LIST_QUERY @HAVE_SIO_ADDRESS_LIST_QUERY@ + +/* Define to 1 if you have the `socketpair' function. */ +#cmakedefine HAVE_SOCKETPAIR @HAVE_SOCKETPAIR@ + +/* Define to 1 if we use HTTP parser library */ +#cmakedefine HAVE_SOFIA_HTTP @HAVE_SOFIA_HTTP@ + +/* Define to 1 if we use NTH library */ +#cmakedefine HAVE_SOFIA_NTH @HAVE_SOFIA_NTH@ + +/* Define to 1 if we use NTLM library */ +#cmakedefine HAVE_SOFIA_NTLM @HAVE_SOFIA_NTLM@ + +/* Define to 1 if you have Sofia sigcomp >= 2.5 */ +#cmakedefine HAVE_SOFIA_SIGCOMP @HAVE_SOFIA_SIGCOMP@ + +/* Define to 1 always */ +#cmakedefine HAVE_SOFIA_SIP @HAVE_SOFIA_SIP@ + +/* Define to 1 if we use S/MIME library */ +#cmakedefine HAVE_SOFIA_SMIME @HAVE_SOFIA_SMIME@ + +/* Define to 1 if we use DNS library */ +#cmakedefine HAVE_SOFIA_SRESOLV @HAVE_SOFIA_SRESOLV@ + +/* Define to 1 if we use STUN library */ +#cmakedefine HAVE_SOFIA_STUN @HAVE_SOFIA_STUN@ + +/* Define to 1 if you have socket option SO_RCVBUFFORCE */ +#cmakedefine HAVE_SO_RCVBUFFORCE @HAVE_SO_RCVBUFFORCE@ + +/* Define to 1 if you have socket option SO_SNDBUFFORCE */ +#cmakedefine HAVE_SO_SNDBUFFORCE @HAVE_SO_SNDBUFFORCE@ + +/* Define to 1 if we use SRTP */ +#cmakedefine HAVE_SRTP @HAVE_SRTP@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDIO_H @HAVE_STDIO_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@ + +/* Define to 1 if you have the `strerror' function. */ +#cmakedefine HAVE_STRERROR @HAVE_STRERROR@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H @HAVE_STRING_H@ + +/* Define to 1 if you have the `strnlen' function. */ +#cmakedefine HAVE_STRNLEN @HAVE_STRNLEN@ + +/* Define to 1 if you have the `strtoull' function. */ +#cmakedefine HAVE_STRTOULL @HAVE_STRTOULL@ + +/* Define to 1 if your CC supports C99 struct initialization */ +#cmakedefine HAVE_STRUCT_KEYWORDS @HAVE_STRUCT_KEYWORDS@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_DEVPOLL_H @HAVE_SYS_DEVPOLL_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_EPOLL_H @HAVE_SYS_EPOLL_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_FILIO_H @HAVE_SYS_FILIO_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_IOCTL_H @HAVE_SYS_IOCTL_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SELECT_H @HAVE_SYS_SELECT_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKET_H @HAVE_SYS_SOCKET_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKIO_H @HAVE_SYS_SOCKIO_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ + +/* Define to 1 if you have the `tcsetattr' function. */ +#cmakedefine HAVE_TCSETATTR @HAVE_TCSETATTR@ + +/* Define to 1 if you have TLS */ +#cmakedefine HAVE_TLS @HAVE_TLS@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@ + +/* Define to 1 if we use UPnP */ +#cmakedefine HAVE_UPNP @HAVE_UPNP@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WCHAR_H @HAVE_WCHAR_H@ + +/* Define to 1 you have WIN32 */ +#cmakedefine HAVE_WIN32 @HAVE_WIN32@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINDEF_H @HAVE_WINDEF_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINSOCK2_H @HAVE_WINSOCK2_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WS2TCPIP_H @HAVE_WS2TCPIP_H@ + +/* Define if you have zlib compress */ +#cmakedefine HAVE_ZLIB_COMPRESS @HAVE_ZLIB_COMPRESS@ + +/* Format (%lli) for long long */ +#cmakedefine LLI "@LLI@" + +/* Format (%llu) for unsigned long long */ +#cmakedefine LLU "@LLU@" + +/* Format (%llx) for long long hex */ +#cmakedefine LLX "@LLX@" + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#cmakedefine LT_OBJDIR "@LT_OBJDIR@" + +/* Define printf() modifier for ssize_t */ +#cmakedefine MOD_ZD "@MOD_ZD@" + +/* Define printf() modifier for size_t */ +#cmakedefine MOD_ZU "@MOD_ZU@" + +/* Name of package */ +#cmakedefine PACKAGE "@PACKAGE@" + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" + +/* Define to the full name of this package. */ +#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" + +/* Define to the full name and version of this package. */ +#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" + +/* Define to the one symbol short name of this package. */ +#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@" + +/* Define to the home page for this package. */ +#cmakedefine PACKAGE_URL "@PACKAGE_URL@" + +/* Define to the version of this package. */ +#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#cmakedefine RETSIGTYPE @RETSIGTYPE@ + +/** + * If using the C implementation of alloca, define if you know the + * direction of stack growth for your system; otherwise it will be + * automatically deduced at runtime. + * STACK_DIRECTION > 0 => grows toward higher addresses + * STACK_DIRECTION < 0 => grows toward lower addresses + * STACK_DIRECTION = 0 => direction of growth unknown + **/ +#cmakedefine STACK_DIRECTION @STACK_DIRECTION@ + +/** + * Define to 1 if all of the C90 standard headers exist (not just the ones + * required in a freestanding environment). This macro is provided for + * backward compatibility; new code need not use it. + **/ +#cmakedefine STDC_HEADERS @STDC_HEADERS@ + +/* Little Endian */ +#cmakedefine SWITCH_BYTE_ORDER @SWITCH_BYTE_ORDER@ + +/** + * Define to 1 if you can safely include both and . + * This macro is obsolete. + **/ +#cmakedefine TIME_WITH_SYS_TIME @TIME_WITH_SYS_TIME@ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +#cmakedefine _ALL_SOURCE @_ALL_SOURCE@ +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +#cmakedefine _DARWIN_C_SOURCE @_DARWIN_C_SOURCE@ +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +#cmakedefine __EXTENSIONS__ @__EXTENSIONS__@ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +#cmakedefine _GNU_SOURCE @_GNU_SOURCE@ +#endif +/* Enable X/Open compliant socket functions that do not require linking +with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +#cmakedefine _HPUX_ALT_XOPEN_SOCKET_API @_HPUX_ALT_XOPEN_SOCKET_API@ +#endif +/** + * Identify the host operating system as Minix. + * This macro does not affect the system headers' behavior. + * A future release of Autoconf may stop defining this macro. + **/ +#ifndef _MINIX +#cmakedefine _MINIX @_MINIX@ +#endif +/** + * Enable general extensions on NetBSD. + * Enable NetBSD compatibility extensions on Minix. + **/ +#ifndef _NETBSD_SOURCE +#cmakedefine _NETBSD_SOURCE @_NETBSD_SOURCE@ +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. +Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +#cmakedefine _OPENBSD_SOURCE @_OPENBSD_SOURCE@ +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +#cmakedefine _POSIX_SOURCE @_POSIX_SOURCE@ +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +#cmakedefine _POSIX_1_SOURCE @_POSIX_1_SOURCE@ +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +#cmakedefine _POSIX_PTHREAD_SEMANTICS @_POSIX_PTHREAD_SEMANTICS@ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#cmakedefine __STDC_WANT_IEC_60559_ATTRIBS_EXT__ @__STDC_WANT_IEC_60559_ATTRIBS_EXT__@ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +#cmakedefine __STDC_WANT_IEC_60559_BFP_EXT__ @__STDC_WANT_IEC_60559_BFP_EXT__@ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +#cmakedefine __STDC_WANT_IEC_60559_DFP_EXT__ @__STDC_WANT_IEC_60559_DFP_EXT__@ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#cmakedefine __STDC_WANT_IEC_60559_FUNCS_EXT__ @__STDC_WANT_IEC_60559_FUNCS_EXT__@ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +#cmakedefine __STDC_WANT_IEC_60559_TYPES_EXT__ @__STDC_WANT_IEC_60559_TYPES_EXT__@ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +#cmakedefine __STDC_WANT_LIB_EXT2__ @__STDC_WANT_LIB_EXT2__@ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +#cmakedefine __STDC_WANT_MATH_SPEC_FUNCS__ @__STDC_WANT_MATH_SPEC_FUNCS__@ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +#cmakedefine _TANDEM_SOURCE @_TANDEM_SOURCE@ +#endif +/* Enable X/Open extensions. Define to 500 only if necessary +to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +#cmakedefine _XOPEN_SOURCE @_XOPEN_SOURCE@ +#endif + + +/* Version number of package */ +#cmakedefine VERSION "@VERSION@" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most +significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +#if defined __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#endif +#else +#ifndef WORDS_BIGENDIAN +#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ +#endif +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +#cmakedefine const @const@ + +/* Define to `__inline__' or `__inline' if that's what the C compiler +calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#cmakedefine inline @inline@ +#endif + +/* Define to a at least 64-bit int type */ +#cmakedefine longlong @longlong@ + +/* Define to `unsigned int' if does not define. */ +#cmakedefine size_t @size_t@ diff --git a/libsofia-sip-ua-glib/CMakeLists.txt b/libsofia-sip-ua-glib/CMakeLists.txt new file mode 100644 index 00000000..64d6694a --- /dev/null +++ b/libsofia-sip-ua-glib/CMakeLists.txt @@ -0,0 +1,19 @@ +if (NOT HAVE_GLIB) + return() +endif (NOT HAVE_GLIB) + +set(sofia_glib_modules su-glib) + +foreach (_dir ${sofia_glib_modules}) + set(${_dir}_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} ${CMAKE_CURRENT_BINARY_DIR}/${_dir}) + list(APPEND INTERNAL_INCLUDE_DIRS ${${_dir}_include_dirs}) + include_directories(${${_dir}_include_dirs}) +endforeach (_dir) +set(INTERNAL_INCLUDE_DIRS ${INTERNAL_INCLUDE_DIRS} PARENT_SCOPE) +foreach (_dir ${sofia_glib_modules}) + add_subdirectory(${_dir}) +endforeach (_dir) + +add_library(sofia-sip-ua-glib SHARED) +target_link_libraries(sofia-sip-ua-glib empty) +target_link_libraries(sofia-sip-ua-glib -Wl,--whole-archive ${sofia_glib_modules} -Wl,--no-whole-archive) diff --git a/libsofia-sip-ua-glib/su-glib/CMakeLists.txt b/libsofia-sip-ua-glib/su-glib/CMakeLists.txt new file mode 100644 index 00000000..fb922b73 --- /dev/null +++ b/libsofia-sip-ua-glib/su-glib/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories(${INTERNAL_INCLUDE_DIRS}) + +add_library(su-glib STATIC su_source.c) +target_link_libraries(su-glib ${GLIB_LIBRARIES}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_GLIB_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_GLIB_TESTS) + +add_executable(su_source_test su_source_test.c) +target_link_libraries(su_source_test su-glib sofia-sip-ua) +add_test(su_source_test su_source_test) + +add_executable(torture_su_glib_timer torture_su_glib_timer.c) +target_link_libraries(torture_su_glib_timer su-glib sofia-sip-ua) +add_test(torture_su_glib_timer torture_su_glib_timer) diff --git a/libsofia-sip-ua/CMakeLists.txt b/libsofia-sip-ua/CMakeLists.txt new file mode 100644 index 00000000..91abe84b --- /dev/null +++ b/libsofia-sip-ua/CMakeLists.txt @@ -0,0 +1,30 @@ +set(sofia_modules bnf features ipt iptsec msg nea nta nua sdp sip soa sresolv su tport url) + +if (HAVE_STUN) + set(stun_module stun) + list(APPEND sofia_modules stun) +else (HAVE_STUN) + unset(stun_module) +endif (HAVE_STUN) +if (HAVE_NTH) + set(nth_module nth) + set(http_module http) + list(APPEND sofia_modules nth http) +else (HAVE_NTH) + unset(nth_module) + unset(http_module) +endif (HAVE_NTH) + +foreach (_dir ${sofia_modules}) + set(${_dir}_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} ${CMAKE_CURRENT_BINARY_DIR}/${_dir}) + list(APPEND INTERNAL_INCLUDE_DIRS ${${_dir}_include_dirs}) + include_directories(${${_dir}_include_dirs}) +endforeach (_dir) +set(INTERNAL_INCLUDE_DIRS ${INTERNAL_INCLUDE_DIRS} PARENT_SCOPE) +foreach (_dir ${sofia_modules}) + add_subdirectory(${_dir}) +endforeach (_dir) + +add_library(sofia-sip-ua SHARED) +target_link_libraries(sofia-sip-ua empty) +target_link_libraries(sofia-sip-ua -Wl,--whole-archive ${sofia_modules} -Wl,--no-whole-archive) diff --git a/libsofia-sip-ua/bnf/CMakeLists.txt b/libsofia-sip-ua/bnf/CMakeLists.txt new file mode 100644 index 00000000..e0f95ddb --- /dev/null +++ b/libsofia-sip-ua/bnf/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(bnf STATIC bnf.c) + +if (NOT ENABLE_TESTS AND NOT ENABLE_BNF_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_BNF_TESTS) + +add_executable(torture_bnf torture_bnf.c) +target_link_libraries(torture_bnf bnf su) +add_test(torture_bnf torture_bnf) diff --git a/libsofia-sip-ua/features/CMakeLists.txt b/libsofia-sip-ua/features/CMakeLists.txt new file mode 100644 index 00000000..b4e892a5 --- /dev/null +++ b/libsofia-sip-ua/features/CMakeLists.txt @@ -0,0 +1,6 @@ +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sofia_features.h.in + ${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/sofia_features.h +) + +add_library(features STATIC features.c) diff --git a/libsofia-sip-ua/http/CMakeLists.txt b/libsofia-sip-ua/http/CMakeLists.txt new file mode 100644 index 00000000..890b2ba9 --- /dev/null +++ b/libsofia-sip-ua/http/CMakeLists.txt @@ -0,0 +1,63 @@ +set(MSG_PARSER_AWK ${CMAKE_CURRENT_SOURCE_DIR}/../msg/msg_parser.awk) +set(SS_HTTP_H ${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/http.h) + +include(awk) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sofia-sip) + +## Generating sofia-sip/http_protos.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=http + PR=${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/http_protos.h + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/http_protos.h.in + ${SS_HTTP_H} +) + +## Generating sofia-sip/http_tag.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=http + PR=${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/http_tag.h + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/http_tag.h.in + ${SS_HTTP_H} +) + +## Generating http_tag.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/http_tag.c + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=http + PR=${CMAKE_CURRENT_BINARY_DIR}/http_tag.c + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/http_tag.c.in + ${SS_HTTP_H} +) + +## Generating http_parser_table.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/http_parser_table.c + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=http + MC_HASH_SIZE=127 + PT=${CMAKE_CURRENT_BINARY_DIR}/http_parser_table.c + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/http_parser_table.c.in + ${SS_HTTP_H} +) + +## Generating sip_tag_ref.c +sofia_generate_tag_ref(DLLREF) + +set(http_sources + http_parser.c http_header.c + http_basic.c http_extra.c http_inlined.c + http_status.c http_tag_class.c + ${CMAKE_CURRENT_BINARY_DIR}/http_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/http_tag_ref.c + ${CMAKE_CURRENT_BINARY_DIR}/http_parser_table.c +) + +add_library(http STATIC ${http_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_HTTP_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_HTTP_TESTS) + +add_executable(test_http test_http.c) +target_link_libraries(test_http http bnf msg url su) +add_test(test_http test_http) diff --git a/libsofia-sip-ua/ipt/CMakeLists.txt b/libsofia-sip-ua/ipt/CMakeLists.txt new file mode 100644 index 00000000..31eeddcd --- /dev/null +++ b/libsofia-sip-ua/ipt/CMakeLists.txt @@ -0,0 +1,11 @@ +set(ipt_sources base64.c token64.c) + +add_library(ipt STATIC ${ipt_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_IPT_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_IPT_TESTS) + +add_executable(torture_base64 torture_base64.c) +target_link_libraries(torture_base64 ipt) +add_test(torture_base64 torture_base64) diff --git a/libsofia-sip-ua/iptsec/CMakeLists.txt b/libsofia-sip-ua/iptsec/CMakeLists.txt new file mode 100644 index 00000000..6f92cc45 --- /dev/null +++ b/libsofia-sip-ua/iptsec/CMakeLists.txt @@ -0,0 +1,22 @@ +sofia_generate_tag_ref(PREFIX auth) + +set(iptsec_sources + auth_client.c auth_common.c auth_digest.c + auth_module.c auth_tag.c + auth_plugin.c auth_plugin_delayed.c + auth_module_sip.c + iptsec_debug.c + ${CMAKE_CURRENT_BINARY_DIR}/auth_tag_ref.c +) + +add_library(iptsec STATIC ${iptsec_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_AUTH_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_AUTH_TESTS) + +file(COPY testpasswd DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_executable(test_auth_digest test_auth_digest.c) +target_link_libraries(test_auth_digest iptsec sip msg url bnf ipt su) +add_test(test_auth_digest test_auth_digest) diff --git a/libsofia-sip-ua/msg/CMakeLists.txt b/libsofia-sip-ua/msg/CMakeLists.txt new file mode 100644 index 00000000..d4bd01c0 --- /dev/null +++ b/libsofia-sip-ua/msg/CMakeLists.txt @@ -0,0 +1,84 @@ +set(MSG_PARSER_AWK ${CMAKE_CURRENT_SOURCE_DIR}/msg_parser.awk) +set(SS_MIME_H ${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/msg_mime.h) + +include(awk) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sofia-sip) + +## Generating sofia-sip/msg_protos.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} + module=msg NO_FIRST=1 NO_MIDDLE=1 + PR=${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/msg_protos.h + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/msg_protos.h.in + ${SS_MIME_H} +) + +## Generating sofia-sip/msg_mime_protos.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} + module=msg NO_FIRST=1 NO_LAST=1 + PR=${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/msg_mime_protos.h + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/msg_mime_protos.h.in + ${SS_MIME_H} +) + +## Generating msg_mime_table.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/msg_mime_table.c + COMMAND ${AWK} -f ${MSG_PARSER_AWK} + module=msg_multipart tprefix=msg prefix=mp MC_HASH_SIZE=127 MC_SHORT_SIZE=26 + PT=${CMAKE_CURRENT_BINARY_DIR}/msg_mime_table.c + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/msg_mime_table.c.in + ${SS_MIME_H} +) + +set(msg_sources + msg.c msg_tag.c msg_inlined.c msg_mime.c + msg_header_copy.c msg_header_make.c + msg_parser.c msg_mclass.c msg_parser_util.c + msg_basic.c msg_generic.c msg_date.c msg_auth.c + ${CMAKE_CURRENT_BINARY_DIR}/msg_mime_table.c +) + +add_library(msg STATIC ${msg_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_MSG_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_MSG_TESTS) + +set(TEST_CLASS_H ${CMAKE_CURRENT_SOURCE_DIR}/test_class.h) + +## Generating test_protos.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} + module=msg_test NO_MIDDLE=1 NO_LAST=1 + PR=${CMAKE_CURRENT_BINARY_DIR}/test_protos.h + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/test_protos.h.in + ${TEST_CLASS_H} +) + +## Generating test_table.c +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} + module=msg_test prefix=msg + MC_HASH_SIZE=127 multipart=msg_multipart + PT=${CMAKE_CURRENT_BINARY_DIR}/test_table.c + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/test_table.c.in + ${TEST_CLASS_H} +) + +set(test_msg_sources + test_class.c test_inlined.c + ${CMAKE_CURRENT_BINARY_DIR}/test_table.c +) + +add_library(test_msg STATIC ${test_msg_sources}) +target_link_libraries(test_msg msg bnf url ipt su) + +add_executable(test_msg_exec test_msg.c) +target_link_libraries(test_msg_exec test_msg) +add_test(test_msg_exec test_msg_exec) + +add_executable(msg_name_hash msg_name_hash.c) +target_link_libraries(msg_name_hash test_msg) diff --git a/libsofia-sip-ua/nea/CMakeLists.txt b/libsofia-sip-ua/nea/CMakeLists.txt new file mode 100644 index 00000000..4535e70b --- /dev/null +++ b/libsofia-sip-ua/nea/CMakeLists.txt @@ -0,0 +1,10 @@ +sofia_generate_tag_ref() + +set(nea_sources + nea.c nea_event.c + nea_server.c nea_debug.h nea_debug.c + nea_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/nea_tag_ref.c +) + +add_library(nea STATIC ${nea_sources}) diff --git a/libsofia-sip-ua/nta/CMakeLists.txt b/libsofia-sip-ua/nta/CMakeLists.txt new file mode 100644 index 00000000..c1e002b5 --- /dev/null +++ b/libsofia-sip-ua/nta/CMakeLists.txt @@ -0,0 +1,31 @@ +sofia_generate_tag_ref(LIST) + +set(nta_sources + nta.c nta_check.c nta_tag.c + sl_utils_print.c sl_utils_log.c + sl_read_payload.c + ${CMAKE_CURRENT_BINARY_DIR}/nta_tag_ref.c +) + +add_library(nta STATIC ${nta_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_NTA_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_NTA_TESTS) + +add_executable(portbind portbind.c) +target_link_libraries(portbind su) + +add_executable(test_nta_api test_nta_api.c) +target_link_libraries(test_nta_api nta sip msg tport ${stun_module} ${http_module} sresolv url bnf su) +add_test(test_nta_api test_nta_api) + +if (HAVE_CHECK) + add_executable(test_nta test_nta.c) + target_link_libraries(test_nta nta sip msg tport ${stun_module} ${http_module} sresolv url bnf su s2) + add_test(test_nta test_nta) + + add_executable(check_nta check_nta.c check_nta_api.c check_nta_client.c) + target_link_libraries(check_nta nta sip msg tport ${stun_module} ${http_module} sresolv url bnf su s2) + add_test(check_nta check_nta) +endif (HAVE_CHECK) diff --git a/libsofia-sip-ua/nth/CMakeLists.txt b/libsofia-sip-ua/nth/CMakeLists.txt new file mode 100644 index 00000000..95ea0915 --- /dev/null +++ b/libsofia-sip-ua/nth/CMakeLists.txt @@ -0,0 +1,22 @@ +sofia_generate_tag_ref() + +set(nth_sources + nth_client.c nth_server.c nth_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/nth_tag_ref.c +) + +add_library(nth STATIC ${nth_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_NTH_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_NTH_TESTS) + +add_executable(http-client http-client.c) +target_link_libraries(http-client nth tport ${stun_module} ${http_module} msg sresolv url bnf sip iptsec ipt su) + +add_executable(http-server http-server.c) +target_link_libraries(http-server nth tport ${stun_module} ${http_module} msg sresolv url bnf sip iptsec ipt su) + +add_executable(test_nth test_nth.c) +target_link_libraries(test_nth nth tport ${stun_module} ${http_module} msg sresolv url bnf sip iptsec ipt su) +add_test(test_nth test_nth) diff --git a/libsofia-sip-ua/nua/CMakeLists.txt b/libsofia-sip-ua/nua/CMakeLists.txt new file mode 100644 index 00000000..8953eabf --- /dev/null +++ b/libsofia-sip-ua/nua/CMakeLists.txt @@ -0,0 +1,35 @@ +sofia_generate_tag_ref(LIST) + +set(nua_sources + nua.c nua_stack.h nua_common.c nua_stack.c + nua_server.h nua_server.c + nua_client.h nua_client.c + nua_extension.c nua_types.h + nua_dialog.c nua_dialog.h + outbound.c outbound.h + nua_params.c nua_params.h + nua_register.c nua_registrar.c + nua_session.c nua_options.c + nua_message.c nua_publish.c nua_subnotref.c + nua_notifier.c + nua_event_server.c + nua_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/nua_tag_ref.c +) + +add_library(nua STATIC ${nua_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_NUA_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_NUA_TESTS) + +if (HAVE_CHECK) + set(check_nua_sources + check_nua.c check_nua.h + check_session.c check_register.c + check_etsi.c check_simple.c + ) + add_executable(check_nua ${check_nua_sources}) + target_link_libraries(check_nua nua sip msg nta nea soa sdp tport sresolv ${stun_module} ${http_module} url bnf iptsec ipt s2 su) + add_test(check_nua. check_nua) +endif (HAVE_CHECK) diff --git a/libsofia-sip-ua/sdp/CMakeLists.txt b/libsofia-sip-ua/sdp/CMakeLists.txt new file mode 100644 index 00000000..1ecf48c3 --- /dev/null +++ b/libsofia-sip-ua/sdp/CMakeLists.txt @@ -0,0 +1,23 @@ +sofia_generate_tag_ref() + +set(sdp_sources + sdp.c sdp_parse.c sdp_print.c sdp_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/sdp_tag_ref.c +) + +add_library(sdp STATIC ${sdp_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_SDP_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_SDP_TESTS) + +add_executable(torture_sdp torture_sdp.c) +target_link_libraries(torture_sdp sdp su) +add_test(torture_sdp torture_sdp) + +add_executable(test_sdp test_sdp.c) +target_link_libraries(test_sdp sdp su) +foreach (loop_var RANGE 1 10) + add_test(run_test_sdp_${loop_var} test_sdp ${CMAKE_CURRENT_SOURCE_DIR}/tests/message-${loop_var}.sdp) +endforeach (loop_var) +set_tests_properties(run_test_sdp_1 run_test_sdp_6 PROPERTIES WILL_FAIL TRUE) diff --git a/libsofia-sip-ua/sip/CMakeLists.txt b/libsofia-sip-ua/sip/CMakeLists.txt new file mode 100644 index 00000000..b557c30c --- /dev/null +++ b/libsofia-sip-ua/sip/CMakeLists.txt @@ -0,0 +1,143 @@ +set(MSG_PARSER_AWK ${CMAKE_CURRENT_SOURCE_DIR}/../msg/msg_parser.awk) +set(SS_SIP_H ${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sip.h) +set(SS_SIP_H_EXTRA ${CMAKE_CURRENT_SOURCE_DIR}/sip_extra_headers.txt) + +include(awk) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sofia-sip) + +## Generating sofia-sip/sip_hclasses.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=sip + PR=${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/sip_hclasses.h + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sip_hclasses.h.in + ${SS_SIP_H} +) + +## Generating sofia-sip/sip_protos.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=sip + PR=${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/sip_protos.h + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sip_protos.h.in + ${SS_SIP_H} +) + +## Generating sofia-sip/sip_tag.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=sip + PR=${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/sip_tag.h + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sip_tag.h.in + ${SS_SIP_H} +) + +## Generating sofia-sip/sip_extra.h +execute_process( + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=sip + NO_FIRST=1 NO_LAST=1 + PACKAGE_NAME="${PACKAGE_NAME}" + PACKAGE_VERSION="${PACKAGE_VERSION}" + PR=${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/sip_extra.h + TEMPLATE1=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sip_hclasses.h.in + TEMPLATE2=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sip_protos.h.in + TEMPLATE3=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sip_tag.h.in + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/sip_extra.h.in + ${SS_SIP_H_EXTRA} +) + +## Generating sip_tag.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sip_tag.c + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=sip + PR=${CMAKE_CURRENT_BINARY_DIR}/sip_tag.c + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sip_tag.c.in + ${SS_SIP_H} ${SS_SIP_H_EXTRA} +) + +## Generating sip_parser_table.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sip_parser_table.c + COMMAND ${AWK} -f ${MSG_PARSER_AWK} module=sip + MC_HASH_SIZE=127 MC_SHORT_SIZE=26 + FLAGFILE=${CMAKE_CURRENT_SOURCE_DIR}/sip_bad_mask + PT=${CMAKE_CURRENT_BINARY_DIR}/sip_parser_table.c + TEMPLATE=${CMAKE_CURRENT_SOURCE_DIR}/sip_parser_table.c.in + ${SS_SIP_H} ${SS_SIP_H_EXTRA} +) + +## Generating sip_tag_ref.c +sofia_generate_tag_ref() + +set(sip_sources + sip_parser.c sip_header.c sip_util.c sip_pref_util.c + sip_basic.c sip_extra.c sip_feature.c sip_mime.c + sip_security.c sip_event.c sip_prack.c + sip_refer.c sip_session.c + sip_caller_prefs.c sip_reason.c + sip_status.c sip_time.c + sip_tag_class.c sip_inlined.c + ${CMAKE_CURRENT_BINARY_DIR}/sip_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/sip_tag_ref.c + ${CMAKE_CURRENT_BINARY_DIR}/sip_parser_table.c +) + +add_library(sip STATIC ${sip_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_SIP_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_SIP_TESTS) + +add_executable(torture_sip torture_sip.c) +target_link_libraries(torture_sip sip msg bnf url ipt su) +add_test(torture_sip torture_sip) + +add_executable(test_date test_date.c) +target_link_libraries(test_date sip msg bnf url ipt su) +add_test(test_date test_date "Sun, 18 Mar 2001 23:01:00 GMT") + +add_executable(test_sip_msg test_sip_msg.c) +target_link_libraries(test_sip_msg sip msg bnf url ipt su) + +add_executable(validator validator.c) +target_link_libraries(validator sip msg bnf url ipt su) + +set(test_flag "-t") + +# These are messages that the parser should pass +set(good_messages + -t test1.txt test2.txt test3.txt test4.txt + -u test5.txt -t test6.txt test7.txt -u test8.txt -t test9.txt + test14.txt test20.txt test23.txt test24.txt test31.txt + own1.txt own2.txt own3.txt own4.txt own5.txt own6.txt +) +# These are ugly messages that parser should pass +set(ugly_messages + -t test25.txt -u test27.txt test28.txt -t test30.txt + -u test32.txt test34.txt -t test36.txt -u test37.txt + test38.txt test39.txt test41.txt test42.txt +) +# These are messages that the parser should fail +set(bad_messages + test10.txt test11.txt test12.txt test13.txt test15.txt + test16.txt test17.txt test18.txt test19.txt + test21.txt test22.txt + test26.txt test29.txt test33.txt + test35.txt + test40.txt +) +foreach (_txt ${good_messages} ${ugly_messages}) + if (_txt MATCHES "^\\-") + set(test_flag ${_txt}) + continue() + endif () + add_test( + NAME test_sip_msg_${_txt} + COMMAND ${BASH} -c "$ ${test_flag} < ${CMAKE_CURRENT_SOURCE_DIR}/tests/${_txt}" + ) +endforeach (_txt) +foreach (_txt ${bad_messages}) + add_test( + NAME test_sip_msg_${_txt} + COMMAND ${BASH} -c "$ ${test_flag} < ${CMAKE_CURRENT_SOURCE_DIR}/tests/${_txt}" + ) + set_tests_properties(test_sip_msg_${_txt} PROPERTIES WILL_FAIL TRUE) +endforeach (_txt) diff --git a/libsofia-sip-ua/soa/CMakeLists.txt b/libsofia-sip-ua/soa/CMakeLists.txt new file mode 100644 index 00000000..866f4f93 --- /dev/null +++ b/libsofia-sip-ua/soa/CMakeLists.txt @@ -0,0 +1,18 @@ +sofia_generate_tag_ref(LIST) + +set(soa_sources + soa.c soa_static.c soa_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/soa_tag_ref.c +) + +add_library(soa STATIC ${soa_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_SOA_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_SOA_TESTS) + +if (HAVE_CHECK) + add_executable(test_soa test_soa.c) + target_link_libraries(test_soa soa ${stun_module} ${http_module} sdp bnf sip msg url tport sresolv s2 su) + add_test(test_soa test_soa) +endif (HAVE_CHECK) diff --git a/libsofia-sip-ua/sresolv/CMakeLists.txt b/libsofia-sip-ua/sresolv/CMakeLists.txt new file mode 100644 index 00000000..24b5fd9d --- /dev/null +++ b/libsofia-sip-ua/sresolv/CMakeLists.txt @@ -0,0 +1,24 @@ +set(sresolv_sources + sres.c sres_cache.c sres_blocking.c + sresolv.c sres_sip.c +) + +add_library(sresolv STATIC ${sresolv_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_SRES_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_SRES_TESTS) + +if (HAVE_CHECK) + add_executable(check_sres_sip check_sres_sip.c) + target_link_libraries(check_sres_sip sresolv sip msg tport ${stun_module} ${http_module} url bnf s2 su) + add_test(check_sres_sip check_sres_sip) +endif (HAVE_CHECK) + +add_executable(torture_sresolv torture_sresolv.c) +target_link_libraries(torture_sresolv sresolv url bnf su) +add_test(torture_sresolv torture_sresolv) + +add_executable(test_sresolv test_sresolv.c) +target_link_libraries(test_sresolv sresolv url bnf su) +# TODO add run_test_sresolv into ctest diff --git a/libsofia-sip-ua/stun/CMakeLists.txt b/libsofia-sip-ua/stun/CMakeLists.txt new file mode 100644 index 00000000..a7595f40 --- /dev/null +++ b/libsofia-sip-ua/stun/CMakeLists.txt @@ -0,0 +1,18 @@ +sofia_generate_tag_ref(LIST) + +set(stun_sources + stun.c stun_common.c stun_dns.c stun_mini.c stun_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/stun_tag_ref.c +) + +add_library(stun STATIC ${stun_sources}) + +add_executable(stunc stunc.c) +target_link_libraries(stunc stun sresolv url bnf su) + +if (NOT ENABLE_TESTS AND NOT ENABLE_STUN_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_STUN_TESTS) + +add_executable(lookup_stun_server lookup_stun_server.c) +target_link_libraries(lookup_stun_server stun sresolv url bnf su) diff --git a/libsofia-sip-ua/su/CMakeLists.txt b/libsofia-sip-ua/su/CMakeLists.txt new file mode 100644 index 00000000..4f2fae4c --- /dev/null +++ b/libsofia-sip-ua/su/CMakeLists.txt @@ -0,0 +1,93 @@ +########## generator su_configure.h ########## +if (HAVE_STDINT_H) + set(SU_HAVE_STDINT 1) +endif (HAVE_STDINT_H) +if (HAVE_INTTYPES_H) + set(SU_HAVE_INTTYPES 1) +endif (HAVE_INTTYPES_H) +if (HAVE_SYS_TYPES_H) + set(SU_HAVE_SYS_TYPES 1) +endif (HAVE_SYS_TYPES_H) +if (HAVE_PTHREAD_H) + set(SU_HAVE_PTHREADS 1) +endif (HAVE_PTHREAD_H) +if (HAVE_SOCKET) + set(SU_HAVE_BSDSOCK 1) +endif (HAVE_SOCKET) +if (HAVE_SA_LEN) + set(HAVE_SOCKADDR_SA_LEN 1) +endif (HAVE_SA_LEN) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/sofia-sip/su_configure.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/sofia-sip/su_configure.h +) + +set(su_sources + su.c su_errno.c su_addrinfo.c + su_alloc.c su_alloc_lock.c su_strdup.c su_sprintf.c + su_strlst.c su_vector.c + su_time.c su_time0.c + su_wait.c su_root.c su_timer.c + su_port.c su_port.h + su_base_port.c su_pthread_port.c su_socket_port.c + su_poll_port.c su_epoll_port.c su_select_port.c su_kqueue_port.c + su_devpoll_port.c su_localinfo.c su_os_nw.c + su_taglist.c su_tag.c su_tag_io.c + su_log.c su_global_log.c su_default_log.c su_module_debug.h + su_md5.c su_uniqueid.c su_bm.c smoothsort.c su_string.c string0.c +) +set(su_extra_sources + memmem.c strtoull.c + memspn.c memcspn.c memccpy.c + inet_ntop.c inet_pton.c poll.c getopt.c +) +foreach (_su_extra_src ${su_extra_sources}) + string(REGEX REPLACE ".c$" "" _src_filename ${_su_extra_src}) + string(TOUPPER "have_${_src_filename}" _var) + if (NOT ${_var}) + set(su_sources ${su_sources} ${_su_extra_src}) + endif (NOT ${_var}) +endforeach (_su_extra_src) + +add_library(su STATIC ${su_sources}) + +add_executable(addrinfo addrinfo.c) +target_link_libraries(addrinfo su) + +add_executable(localinfo localinfo.c) +target_link_libraries(localinfo su) + +if (NOT ENABLE_TESTS AND NOT ENABLE_SU_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_SU_TESTS) + +set(su_testable_binaries + torture_su torture_su_port + torture_su_alloc torture_su_time torture_su_tag + test_htable test_htable2 torture_rbtree torture_heap + test_memmem torture_su_bm torture_su_root torture_su_timer +) +set(su_test_binaries + ${su_testable_binaries} + test_su su_proxy test_poll +) + +foreach (bin ${su_test_binaries}) + add_executable(${bin} ${bin}.c) + target_link_libraries(${bin} su) +endforeach (bin) +foreach (bin ${su_testable_binaries}) + add_test(${bin} ${bin}) +endforeach (bin) +add_test(run_addrinfo addrinfo -n echo 127.0.0.1) +add_test(run_localinfo localinfo -n) +foreach (SU_PORT select kqueue devpoll epoll poll) + string(TOUPPER "have_${SU_PORT}" _var) + if (NOT ${_var}) + continue() + endif (NOT ${_var}) + add_test(test_su_${SU_PORT} test_su) + add_test(test_su_${SU_PORT}_s test_su -s) + set_tests_properties(test_su_${SU_PORT} test_su_${SU_PORT}_s PROPERTIES ENVIRONMENT "SU_PORT=${SU_PORT}") +endforeach (SU_PORT) diff --git a/libsofia-sip-ua/su/sofia-sip/su_configure.h.cmake b/libsofia-sip-ua/su/sofia-sip/su_configure.h.cmake new file mode 100644 index 00000000..bc7d5bf6 --- /dev/null +++ b/libsofia-sip-ua/su/sofia-sip/su_configure.h.cmake @@ -0,0 +1,140 @@ +/* + * This file is part of the Sofia-SIP package + * + * Copyright (C) 2005,2006,2007 Nokia Corporation. + * + * Contact: Pekka Pessi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef SU_CONFIGURE_H +/** Defined when has been included. */ +#define SU_CONFIGURE_H + +/**@file sofia-sip/su_configure.h + * + * Autoconf configuration for SU library. + * + * The file is automatically generated by autoconf. + * + * The file contains configuration information for + * programs using @b su library. The configuration for su library itself is + * in "config.h". + * + * @author Pekka Pessi + * + * @date Created: Mon Aug 21 20:32:25 2000 ppessi + */ + +/** Define as 1 if you have */ +#cmakedefine SU_HAVE_STDINT @SU_HAVE_STDINT@ +/** Define as 1 if you have */ +#cmakedefine SU_HAVE_INTTYPES @SU_HAVE_INTTYPES@ +/** Define as 1 if you have */ +#cmakedefine SU_HAVE_SYS_TYPES @SU_HAVE_SYS_TYPES@ + +/** Define as 1 if you have BSD socket interface */ +#cmakedefine SU_HAVE_BSDSOCK @SU_HAVE_BSDSOCK@ +/** Define as 1 if you have pthreads library */ +#cmakedefine SU_HAVE_PTHREADS @SU_HAVE_PTHREADS@ +/** Define as 1 if you have poll() */ +#cmakedefine SU_HAVE_POLL @SU_HAVE_POLL@ +/** Define as 1 if you have IPv6 structures, macros and constants */ +#cmakedefine SU_HAVE_IN6 @SU_HAVE_IN6@ + +/** Define as 1 if you have sa_len field in struct sockaddr */ +#cmakedefine SU_HAVE_SOCKADDR_SA_LEN @SU_HAVE_SOCKADDR_SA_LEN@ + +/** Define as 1 if you have struct sockaddr_storage */ +#cmakedefine SU_HAVE_SOCKADDR_STORAGE @SU_HAVE_SOCKADDR_STORAGE@ + +/** Define as 1 if you have struct addrinfo. */ +#cmakedefine SU_HAVE_ADDRINFO @SU_HAVE_ADDRINFO@ + +/** Define as 1 if you have Winsock interface */ +#cmakedefine SU_HAVE_WINSOCK @SU_HAVE_WINSOCK@ + +/** Define as 1 if you have Winsock2 interface */ +#cmakedefine SU_HAVE_WINSOCK2 @SU_HAVE_WINSOCK2@ + +/** Define as 1 if you have OSX CoreFoundation interface */ +#cmakedefine SU_HAVE_OSX_CF_API @SU_HAVE_OSX_CF_API@ + +/** Define as 1 if you want to enable experimental features. + * + * Use --enable-experimental with ./configure + */ +#cmakedefine SU_HAVE_EXPERIMENTAL @SU_HAVE_EXPERIMENTAL@ + +/** Define as 1 if you have inline functions */ +#cmakedefine SU_HAVE_INLINE @SU_HAVE_INLINE@ +/** Define as suitable declarator inline functions */ +#cmakedefine SU_INLINE @SU_INLINE@ +/** Define as suitable declarator static inline functions */ +#cmakedefine su_inline @su_inline@ + +/** Define as 1 the tag value casts use inlined functions */ +#cmakedefine SU_INLINE_TAG_CAST @SU_INLINE_TAG_CAST@ + +/** Define this as 1 if we can use tags directly from stack. */ +#cmakedefine SU_HAVE_TAGSTACK @SU_HAVE_TAGSTACK@ + +/* These are valid only for GCC */ + +#define SU_S64_C(i) (SU_S64_T)(i ## LL) +#define SU_U64_C(i) (SU_U64_T)(i ## ULL) +#define SU_S32_C(i) (SU_S32_T)(i ## L) +#define SU_U32_C(i) (SU_U32_T)(i ## UL) +#define SU_S16_C(i) (SU_S16_T)(i) +#define SU_U16_C(i) (SU_U16_T)(i ## U) +#define SU_S8_C(i) (SU_S8_T)(i) +#define SU_U8_C(i) (SU_U8_T)(i ## U) + +/** Define this as ssize_t. */ +#cmakedefine SOFIA_SSIZE_T @SOFIA_SSIZE_T@ + +/** Define this as size_t + (int when compatible with sofia-sip-ua 1.12.0 binaries). */ +#cmakedefine SOFIA_ISIZE_T @SOFIA_ISIZE_T@ + +/** Maximum value of isize_t */ +#cmakedefine ISIZE_MAX @ISIZE_MAX@ + +/** Define this as ssize_t + (int when compatible with sofia-sip-ua 1.12.0 binaries). */ +#cmakedefine SOFIA_ISSIZE_T @SOFIA_ISSIZE_T@ + +/** Maximum value of issize_t */ +#cmakedefine ISSIZE_MAX @ISSIZE_MAX@ + +/** Define this as size_t + (unsigned int when compatible with sofia-sip-ua 1.12.0 binaries). */ +#cmakedefine SOFIA_USIZE_T @SOFIA_USIZE_T@ + +/** Maximum value of usize_t */ +#cmakedefine USIZE_MAX @USIZE_MAX@ + +/**On Solaris define this in order to get POSIX extensions. */ +#cmakedefine __EXTENSIONS__ @__EXTENSIONS__@ + +/** Define this in order to get GNU extensions. */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#endif /* SU_CONFIGURE_H */ diff --git a/libsofia-sip-ua/tport/CMakeLists.txt b/libsofia-sip-ua/tport/CMakeLists.txt new file mode 100644 index 00000000..1dfb05f1 --- /dev/null +++ b/libsofia-sip-ua/tport/CMakeLists.txt @@ -0,0 +1,33 @@ +sofia_generate_tag_ref() + +set(tport_tls_sources tport_type_tls.c tport_tls.c) +set(tport_stun_sources tport_stub_stun.c tport_type_stun.c) +set(tport_http_sources tport_type_connect.c tport_type_ws.c ws.c) +set(tport_sources + tport.c tport_logging.c + tport_stub_sigcomp.c + tport_type_udp.c tport_type_tcp.c tport_type_sctp.c + tport_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/tport_tag_ref.c +) +if (HAVE_TLS) + set(tport_sources ${tport_sources} ${tport_tls_sources}) +endif (HAVE_TLS) +if (HAVE_STUN) + set(tport_sources ${tport_sources} ${tport_stun_sources}) +endif (HAVE_STUN) +if (HAVE_NTH) + set(tport_sources ${tport_sources} ${tport_http_sources}) +endif (HAVE_NTH) + +add_library(tport STATIC ${tport_sources}) +target_include_directories(tport PRIVATE include) + +if (NOT ENABLE_TESTS AND NOT ENABLE_TPORT_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_TPORT_TESTS) + +add_executable(test_tport test_tport.c) +file(COPY agent.pem cafile.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(test_tport tport ${stun_module} ${http_module} sresolv test_msg) +add_test(test_tport test_tport) diff --git a/libsofia-sip-ua/url/CMakeLists.txt b/libsofia-sip-ua/url/CMakeLists.txt new file mode 100644 index 00000000..0772371d --- /dev/null +++ b/libsofia-sip-ua/url/CMakeLists.txt @@ -0,0 +1,16 @@ +sofia_generate_tag_ref(DLLREF) + +set(url_sources + url.c url_tag.c + ${CMAKE_CURRENT_BINARY_DIR}/url_tag_ref.c +) + +add_library(url STATIC ${url_sources}) + +if (NOT ENABLE_TESTS AND NOT ENABLE_URL_TESTS) + return() +endif (NOT ENABLE_TESTS AND NOT ENABLE_URL_TESTS) + +add_executable(torture_url torture_url.c) +target_link_libraries(torture_url url bnf ipt su) +add_test(torture_url torture_url) diff --git a/s2check/CMakeLists.txt b/s2check/CMakeLists.txt new file mode 100644 index 00000000..f26510b2 --- /dev/null +++ b/s2check/CMakeLists.txt @@ -0,0 +1,18 @@ +if (NOT HAVE_CHECK) + return() +endif (NOT HAVE_CHECK) + +include_directories(${INTERNAL_INCLUDE_DIRS}) + +set(s2_sources + s2check.h s2tcase.c + s2base.h s2base.c + s2sip.c s2sip.h + s2_localinfo.h s2_localinfo.c + s2dns.h s2dns.c + s2util.h s2time.c +) + +add_library(s2 STATIC ${s2_sources}) +target_link_libraries(s2 ${CHECK_LIBRARIES}) +target_include_directories(s2 PRIVATE ${CHECK_INCLUDEDIR}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..7837be57 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,38 @@ +if (NOT ENABLE_TESTS) + return() +endif (NOT ENABLE_TESTS) + +include_directories(${INTERNAL_INCLUDE_DIRS}) + +set(nua_sources + test_nua.h test_ops.c + test_init.c + test_nua_api.c test_nua_params.c + test_register.c test_basic_call.c + test_offer_answer.c + test_call_reject.c test_cancel_bye.c + test_call_hold.c test_session_timer.c + test_refer.c test_100rel.c + test_simple.c test_sip_events.c + test_extension.c +) +set(proxy_sources test_proxy.c) +set(nat_sources test_nat.c test_nat_tags.c) + +add_library(test_nua STATIC ${nua_sources} ${proxy_sources} ${nat_sources}) + +add_executable(test_nua_exec test_nua.c) +target_link_libraries(test_nua_exec sofia-sip-ua test_nua) +add_test(test_nua_exec test_nua_exec) + +if (NOT HAVE_CHECK) + return() +endif (NOT HAVE_CHECK) + +add_executable(check_dlopen_sofia check_dlopen_sofia.c) +target_link_libraries(check_dlopen_sofia dl s2 sofia-sip-ua) +add_test(check_dlopen_sofia check_dlopen_sofia) + +add_executable(check_sofia check_sofia.c suite_for_nua.c) +target_link_libraries(check_sofia sofia-sip-ua test_nua s2) +add_test(check_sofia check_sofia) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt new file mode 100644 index 00000000..427fb45f --- /dev/null +++ b/utils/CMakeLists.txt @@ -0,0 +1,10 @@ +include_directories(${INTERNAL_INCLUDE_DIRS}) + +add_executable(sip-date sip-date.c) +target_link_libraries(sip-date sofia-sip-ua) + +add_executable(sip-dig sip-dig.c) +target_link_libraries(sip-dig sofia-sip-ua) + +add_executable(sip-options sip-options.c) +target_link_libraries(sip-options sofia-sip-ua)