diff --git a/CMakeLists.txt b/CMakeLists.txt index 11d1a143..14d030d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,5 @@ # CMakeLists.txt for libcoap # -# [CMakeLists.txt is re-built from CMakeLists.txt.in by the libcoap -# ./configure command, so make any permanent changes to libcoap's -# CMakeLists.txt.in for a libcoap Pull Request] -# # Copyright (C) 2020 Carlos Gomes Martinho # Copyright (C) 2020-2024 Jon Shallow # diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in deleted file mode 100644 index fbffe52c..00000000 --- a/CMakeLists.txt.in +++ /dev/null @@ -1,1005 +0,0 @@ -# CMakeLists.txt for libcoap -# -# [CMakeLists.txt is re-built from CMakeLists.txt.in by the libcoap -# ./configure command, so make any permanent changes to libcoap's -# CMakeLists.txt.in for a libcoap Pull Request] -# -# Copyright (C) 2020 Carlos Gomes Martinho -# Copyright (C) 2020-2024 Jon Shallow -# -# SPDX-License-Identifier: BSD-2-Clause -# -# This file is part of the CoAP library libcoap. Please see README for terms -# of use. - -cmake_minimum_required(VERSION 3.10) - -project( - libcoap - VERSION @LIBCOAP_PACKAGE_BASE@ - LANGUAGES CXX C) - -set(LIBCOAP_API_VERSION @LIBCOAP_API_VERSION@) -set(LIBCOAP_ABI_VERSION @LIBCOAP_ABI_VERSION@) - -set(COAP_LIBRARY_NAME "coap-${LIBCOAP_API_VERSION}") - -if(NOT ZEPHYR_BASE) -option( - BUILD_SHARED_LIBS - "Build shared libs" - OFF) -else() - # provided by the zephyr build system -endif() - -# -# global compiler options -# (need to do it before add_library()) -# - -add_compile_options( - $<$,$,$>:-pedantic> - $<$,$,$>:-Wall> - $<$,$,$>:-Wcast-qual> - $<$,$,$>:-Wextra> - $<$,$,$>:-Wformat-security> - $<$,$,$>:-Winline> - $<$,$,$>:-Wmissing-declarations> - $<$,$,$>:-Wmissing-prototypes> - $<$,$,$>:-Wnested-externs> - $<$,$,$>:-Wpointer-arith> - $<$,$,$>:-Wshadow> - $<$,$,$>:-Wstrict-prototypes> - $<$,$,$>:-Wswitch-default> - $<$,$,$>:-Wswitch-enum> - $<$,$,$>:-Wunused> - $<$,$,$>:-Wwrite-strings>) - -if(MINGW) -add_compile_options( - $<$,$>:-Wno-format> - $<$,$>:-Wno-format-security>) -endif() - -if(${WARNING_TO_ERROR}) -add_compile_options( - $<$,$,$>:-Werror>) -endif() - -if(CMAKE_GENERATOR MATCHES "Visual Studio") - option(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "Export all symbols when compiling to a .dll" ON) - # add_compile_options(/Wall /wd4100 /wd4820 /wd4668 /wd4061) - if(${WARNING_TO_ERROR}) - add_compile_options(/WX) - endif() -endif() - -# -# The libcoap library -# - -add_library(${COAP_LIBRARY_NAME}) -set_property(TARGET ${COAP_LIBRARY_NAME} PROPERTY C_STANDARD 99) -if(${CMAKE_VERSION} VERSION_GREATER "3.20.0") - cmake_policy(SET CMP0115 OLD) # Supresses libcoap configuration warning -endif() - -set_target_properties(${COAP_LIBRARY_NAME} PROPERTIES SOVERSION ${LIBCOAP_API_VERSION}) -set_target_properties(${COAP_LIBRARY_NAME} PROPERTIES VERSION ${LIBCOAP_ABI_VERSION}) - -# -# options to tweak the library -# - -if(NOT ZEPHYR_BASE) -option( - ENABLE_DTLS - "enable building with DTLS support" - ON) -set(DTLS_BACKEND - "default" - CACHE - STRING - "\ -Name of the dtls backend, only relevant if `ENABLE_DTLS` is ON which is default. \ -Possible values: default, gnutls, openssl, wolfssl, tinydtls and mbedtls. \ -If specified then this library will be searched and if found also used. \ -If not found then the cmake configuration will stop with an error. \ -If not specified, then cmake will try to use the first one found in the following order: \ -gnutls, openssl, wolfssl, tinydtls, mbedtls \ - ") -set_property( - CACHE DTLS_BACKEND - PROPERTY STRINGS - default - openssl - wolfssl - gnutls - tinydtls - mbedtls) -option( - USE_VENDORED_TINYDTLS - "compile with the tinydtls project in the submodule if on, otherwise try to find the compiled lib with find_package" - ON) -option( - ENABLE_CLIENT_MODE - "compile with support for client mode code" - ON) -option( - ENABLE_SERVER_MODE - "compile with support for server mode code" - ON) -option( - ENABLE_OSCORE - "compile with support for OSCORE" - ON) -option( - WITH_OBSERVE_PERSIST - "compile with observe persist support for server restarts" - ON) -option( - WITH_EPOLL - "compile with epoll support" - ON) -option( - ENABLE_THREAD_SAFE - "enable building with thread safe support" - ON) -option( - ENABLE_THREAD_RECURSIVE_LOCK_CHECK - "enable building with thread recursive lock detection" - OFF) -option( - ENABLE_SMALL_STACK - "enable if the system has small stack size" - OFF) -option( - ENABLE_TCP - "enable building with TCP support" - ON) -option( - ENABLE_IPV4 - "enable building with IPv4 support" - ON) -option( - ENABLE_IPV6 - "enable building with IPv6 support" - ON) -option( - ENABLE_AF_UNIX - "enable building with Unix socket support" - ON) -option( - ENABLE_WS - "enable building with WebSockets support" - ON) -option( - ENABLE_ASYNC - "enable building with async separate response support" - ON) -option( - ENABLE_Q_BLOCK - "enable building with Q-Block (RFC9177) support" - ON) -option( - ENABLE_TESTS - "build also tests" - OFF) -option( - ENABLE_EXAMPLES - "build also examples" - ON) -option( - ENABLE_DOCS - "build also doxygen documentation" - ON) -option( - WARNING_TO_ERROR - "force all compiler warnings to be errors" - OFF) -set(MAX_LOGGING_LEVEL - "8" - CACHE - STRING - "\ -Only build logging code up to and including the specified logging level (0 - 8)[default=8]] - ") -set_property( - CACHE MAX_LOGGING_LEVEL - PROPERTY STRINGS - "0" - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8") - -else() # ! ZEPHYR_BASE - # provided by zephyr/CMakeLists.txt and zephyr/Kconfig -endif() # ! ZEPHYR_BASE - -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 11) -endif() - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug) -endif() - -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) -endif() - -if(APPLE) - add_definitions(-D__APPLE_USE_RFC_3542=1) -endif() - -list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR}) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -include(CheckCSourceCompiles) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckSymbolExists) -include(CheckTypeSize) -include(TestBigEndian) - -# check for headers -check_include_file(assert.h HAVE_ASSERT_H) -check_include_file(string.h HAVE_STRING_H) -check_include_file(strings.h HAVE_STRINGS_H) -check_include_file(byteswap.h HAVE_BYTESWAP_H) -check_include_file(inttypes.h HAVE_INTTYPES_H) -check_include_file(errno.h HAVE_ERRNO_H) -check_include_file(limits.h HAVE_LIMITS_H) -check_include_file(memory.h HAVE_MEMORY_H) -check_include_file(strings.h HAVE_STRINGS_H) -check_include_file(string.h HAVE_STRING_H) -check_include_file(sys/sysctl.h HAVE_SYS_SYSCTL_H) -check_include_file(net/if.h HAVE_NET_IF_H) -check_include_file(ifaddrs.h HAVE_IFADDRS_H) -check_include_file(netinet/in.h HAVE_NETINET_IN_H) -check_include_file(sys/epoll.h HAVE_EPOLL_H) -check_include_file(sys/timerfd.h HAVE_TIMERFD_H) -check_include_file(arpa/inet.h HAVE_ARPA_INET_H) -check_include_file(stdbool.h HAVE_STDBOOL_H) -check_include_file(netdb.h HAVE_NETDB_H) -check_include_file(pthread.h HAVE_PTHREAD_H) -check_include_file(stdlib.h HAVE_STDINT_H) -check_include_file(stdint.h HAVE_STDLIB_H) -check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) -check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) -check_include_file(sys/stat.h HAVE_SYS_STAT_H) -check_include_file(sys/time.h HAVE_SYS_TIME_H) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(sys/unistd.h HAVE_SYS_UNISTD_H) -check_include_file(time.h HAVE_TIME_H) -check_include_file(unistd.h HAVE_UNISTD_H) -check_include_file(float.h HAVE_FLOAT_H) -check_include_file(stddef.h HAVE_STDDEF_H) -check_include_file(winsock2.h HAVE_WINSOCK2_H) -check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H) - -# check for functions -check_function_exists(malloc HAVE_MALLOC) -check_function_exists(memset HAVE_MEMSET) -check_function_exists(select HAVE_SELECT) -check_function_exists(socket HAVE_SOCKET) -check_function_exists(strcasecmp HAVE_STRCASECMP) -check_function_exists(pthread_mutex_lock HAVE_PTHREAD_MUTEX_LOCK) -check_function_exists(getaddrinfo HAVE_GETADDRINFO) -check_function_exists(strnlen HAVE_STRNLEN) -check_function_exists(strrchr HAVE_STRRCHR) -check_function_exists(getrandom HAVE_GETRANDOM) -check_function_exists(random HAVE_RANDOM) -check_function_exists(if_nametoindex HAVE_IF_NAMETOINDEX) - -# check for symbols -if(WIN32) - set(HAVE_STRUCT_CMSGHDR 1) - message(STATUS "setting HAVE_STRUCT_CMSGHDR") -elseif(${CMAKE_SYSTEM_NAME} STREQUAL QNX) - set(HAVE_STRUCT_CMSGHDR 0) -else() - check_symbol_exists( - CMSG_FIRSTHDR - sys/socket.h - HAVE_STRUCT_CMSGHDR) -endif() - -if(${ENABLE_CLIENT_MODE}) - set(COAP_CLIENT_SUPPORT "1") - message(STATUS "compiling with client support") -else() - message(STATUS "compiling without client support") -endif() - -if(${ENABLE_SERVER_MODE}) - set(COAP_SERVER_SUPPORT "1") - message(STATUS "compiling with server support") -else() - message(STATUS "compiling without server support") -endif() - -if(${ENABLE_OSCORE}) - set(COAP_OSCORE_SUPPORT "1") - message(STATUS "compiling with OSCORE support") -else() - message(STATUS "compiling without OSCORE support") -endif() - -if(${ENABLE_WS} AND ${ENABLE_TCP}) - set(COAP_WS_SUPPORT "1") - message(STATUS "compiling with WebSockets support") -else() - if(${ENABLE_WS}) - set(ENABLE_WS OFF) - message(STATUS "WebSockets disabled as TCP not enabled") - endif() - message(STATUS "compiling without WebSockets support") -endif() - -if(${ENABLE_ASYNC}) - set(COAP_ASYNC_SUPPORT "1") - message(STATUS "compiling with async separate response support") -else() - message(STATUS "compiling without async separate response support") -endif() - -if(${ENABLE_IPV4}) - set(COAP_IPV4_SUPPORT "1") - message(STATUS "compiling with IPv4 support") -else() - message(STATUS "compiling without IPv4 support") -endif() - -if(${ENABLE_IPV6}) - set(COAP_IPV6_SUPPORT "1") - message(STATUS "compiling with IPv6 support") -else() - message(STATUS "compiling without IPv6 support") -endif() - -if(${ENABLE_AF_UNIX}) - set(COAP_AF_UNIX_SUPPORT "1") - message(STATUS "compiling with Unix socket support") -else() - message(STATUS "compiling without Unix socket support") -endif() - -if(${ENABLE_Q_BLOCK}) - set(COAP_Q_BLOCK_SUPPORT "1") - message(STATUS "compiling with Q-Block (RFC9177) support") -else() - message(STATUS "compiling without Q-Block (RFC9177) support") -endif() - - -if(${WITH_OBSERVE_PERSIST}) - set(COAP_WITH_OBSERVE_PERSIST "1") - message(STATUS "compiling with observe persistence support") -else() - message(STATUS "compiling without observe persistence support") -endif() - -if(${WITH_EPOLL} - AND HAVE_EPOLL_H - AND HAVE_TIMERFD_H) - set(COAP_EPOLL_SUPPORT "1") - message(STATUS "compiling with epoll support") -else() - if(${WITH_EPOLL}) - set(WITH_EPOLL OFF) - message(STATUS "epoll disabled as kernel support not available") - endif() - message(STATUS "compiling without epoll support") -endif() - -if(ENABLE_THREAD_SAFE) - set(COAP_THREAD_SAFE "${ENABLE_THREAD_SAFE}") - message(STATUS "compiling with thread safe support") -endif() - -if(ENABLE_THREAD_RECURSIVE_LOCK_CHECK) - set(COAP_THREAD_RECURSIVE_CHECK "${ENABLE_THREAD_RECURSIVE_LOCK_CHECK}") - message(STATUS "compiling with thread recursive lock detection support") -endif() - -if(ENABLE_SMALL_STACK) - set(COAP_CONSTRAINED_STACK "${ENABLE_SMALL_STACK}") - message(STATUS "compiling with small stack support") -endif() - -if(${MAX_LOGGING_LEVEL} MATCHES "[0-8]") - set(COAP_MAX_LOGGING_LEVEL ${MAX_LOGGING_LEVEL}) - message(STATUS "compiling with max logging level set to ${MAX_LOGGING_LEVEL}") -else() - message(STATUS "compiling with max logging level set to none") -endif() - -set(WITH_GNUTLS OFF) -set(WITH_OPENSSL OFF) -set(WITH_TINYDTLS OFF) -set(WITH_MBEDTLS OFF) -set(WITH_WOLFSSL OFF) - -function(compile_tinydtls) - set(TINYDTLS_SOURCES_DIR ${CMAKE_CURRENT_LIST_DIR}/ext/tinydtls) - set(TINYDTLS_SOURCES_GENERATED ${TINYDTLS_SOURCES_DIR}/dtls_config.h) - - message(STATUS "compiling the tinydtls lib") - - include(ExternalProject) - - externalproject_add( - external_tinydtls - SOURCE_DIR "${TINYDTLS_SOURCES_DIR}" - BUILD_IN_SOURCE 1 - DOWNLOAD_COMMAND "" - UPDATE_COMMAND "" - CONFIGURE_COMMAND - ${TINYDTLS_SOURCES_DIR}/configure - --disable-manpages - --prefix=${CMAKE_BINARY_DIR} - BUILD_COMMAND make install - INSTALL_COMMAND "" - LOG_DOWNLOAD 1 - LOG_CONFIGURE 1) - - externalproject_add_step( - external_tinydtls autoreconf - COMMAND ./autogen.sh - ALWAYS 1 - WORKING_DIRECTORY "${TINYDTLS_SOURCES_DIR}" - DEPENDERS configure - DEPENDEES download) - - # Let cmake know that it needs to execute the external_tinydtls target to generate those files. - add_custom_command( - OUTPUT ${TINYDTLS_SOURCES_GENERATED} - WORKING_DIRECTORY "${TINYDTLS_SOURCES_DIR}" - COMMAND "make install" - DEPENDS external_tinydtls) - - add_dependencies(${COAP_LIBRARY_NAME} external_tinydtls) - - if(BUILD_SHARED_LIBS) - set(LIBTINYDTLS_PATH "${CMAKE_CURRENT_BINARY_DIR}/lib/libtinydtls.so") - else() - set(LIBTINYDTLS_PATH "${CMAKE_CURRENT_BINARY_DIR}/lib/libtinydtls.a") - endif() - - add_library( - tinydtls - UNKNOWN - IMPORTED) - set_target_properties( - tinydtls - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_BINARY_DIR}/include" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${LIBTINYDTLS_PATH}") - -endfunction() - -if(ENABLE_DTLS) - message(STATUS "compiling with DTLS support") - message(STATUS "DTLS_BACKEND: ${DTLS_BACKEND}") - - if(DTLS_BACKEND - STREQUAL - "default") - # try to find a crypto lib and use it, use the first one found - - # libgnutls (e.g. debian libgnutls28-dev) - find_package(GnuTLS) - if(GnuTLS_FOUND) - set(WITH_GNUTLS ON) - message(STATUS "compiling with gnutls support") - set(COAP_WITH_LIBGNUTLS 1) - else() - # gnutls not found - find_package(OpenSSL) - if(OpenSSL_FOUND) - set(WITH_OPENSSL ON) - message(STATUS "compiling with openssl support") - set(COAP_WITH_LIBOPENSSL 1) - else() - # openssl not found - # wolfSSL - find_package(wolfSSL) - if(wolfSSL_FOUND) - set(WITH_WOLFSSL ON) - message(STATUS "compiling with wolfssl support") - set(COAP_WITH_LIBWOLFSSL 1) - else() - # wolfssl not found - # libmbedtls (e.g. debian libmbedtls-dev) - find_package(MbedTLS) - if(MbedTLS_FOUND) - set(WITH_MBEDTLS ON) - message(STATUS "compiling with mbedtls support") - set(COAP_WITH_LIBMBEDTLS 1) - else() - # mbedtls not found - if(USE_VENDORED_TINYDTLS) - compile_tinydtls() - else() - find_package(TinyDTLS) - if(TINYDTLS_FOUND) - - else() - # no cryto lib found - message( - FATAL_ERROR - "cannot find any cryto lib, either install one or compile without DTLS support" - ) - endif() - - endif() - - set(WITH_TINYDTLS ON) - message(STATUS "compiling with tinydtls support") - set(COAP_WITH_LIBTINYDTLS 1) - - endif() - - endif() - - endif() - - endif() - - else() - # DTLS_BACKEND variable is not empty, so set all to false and set the only right to true - set(WITH_GNUTLS OFF) - set(WITH_TINYDTLS OFF) - set(WITH_MBEDTLS OFF) - set(WITH_OPENSSL OFF) - set(WITH_WOLFSSL OFF) - - if(DTLS_BACKEND - STREQUAL - "gnutls") - # libgnutls (e.g. debian libgnutls28-dev) - find_package(GnuTLS REQUIRED) - set(WITH_GNUTLS ON) - message(STATUS "compiling with gnutls support") - set(COAP_WITH_LIBGNUTLS 1) - endif() - - if(DTLS_BACKEND - STREQUAL - "openssl") - # libssl (e.g. debian libssl1.0-dev) - find_package(OpenSSL REQUIRED) - set(WITH_OPENSSL ON) - message(STATUS "compiling with openssl support") - set(COAP_WITH_LIBOPENSSL 1) - endif() - - if(DTLS_BACKEND - STREQUAL - "wolfssl") - find_package(wolfSSL REQUIRED) - set(WITH_WOLFSSL ON) - message(STATUS "compiling with wolfssl support") - set(COAP_WITH_LIBWOLFSSL 1) - endif() - - if(DTLS_BACKEND - STREQUAL - "mbedtls") - # libmbedtls (e.g. debian libmbedtls-dev) - find_package(MbedTLS REQUIRED) - set(WITH_MBEDTLS ON) - message(STATUS "compiling with mbedtls support") - set(COAP_WITH_LIBMBEDTLS 1) - endif() - - if(DTLS_BACKEND - STREQUAL - "tinydtls") - - if(USE_VENDORED_TINYDTLS) - compile_tinydtls() - else(USE_VENDORED_TINYDTLS) - find_package(TinyDTLS REQUIRED) - endif(USE_VENDORED_TINYDTLS) - - message(STATUS "compiling with tinydtls support") - set(WITH_TINYDTLS ON) - set(COAP_WITH_LIBTINYDTLS 1) - - endif() - - endif() - -endif() - -if(WITH_WOLFSSL) - find_library(WOLFSSL_LIBRARY wolfssl HINTS /usr/local/lib) - find_path(WOLFSSL_INCLUDE_DIR wolfssl/wolfcrypt/settings.h HINTS /usr/local/include) - if(WOLFSSL_LIBRARY AND WOLFSSL_INCLUDE_DIR) - message(STATUS "compiling with wolfssl support") - else() - message(FATAL_ERROR "WolfSSL not found") - endif() -endif() - -execute_process(COMMAND git describe --tags --dirty --always - RESULT_VARIABLE USING_GIT - OUTPUT_VARIABLE LIBCOAP_PACKAGE_BUILD - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET) -if(NOT ${USING_GIT} EQUAL 0) - set(LIBCOAP_PACKAGE_BUILD ${PROJECT_VERSION}) -else() - set(LIBCOAP_PACKAGE_BUILD "${LIBCOAP_PACKAGE_BUILD}") -endif() - -set(PACKAGE_URL "https://libcoap.net/") -set(PACKAGE_NAME "${PROJECT_NAME}") -set(PACKAGE_TARNAME "${PROJECT_NAME}") -set(PACKAGE_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") -set(PACKAGE_VERSION "${PROJECT_VERSION}") -set(PACKAGE_BUGREPORT "libcoap-developers@lists.sourceforge.net") -set(LIBCOAP_PACKAGE_VERSION "${PACKAGE_VERSION}") -set(LIBCOAP_PACKAGE_URL "${PACKAGE_URL}") -set(LIBCOAP_PACKAGE_NAME "${PACKAGE_NAME}") -set(LIBCOAP_PACKAGE_STRING "${PACKAGE_STRING}") -set(LIBCOAP_PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}") - -message(STATUS "") -message(STATUS "libcoap Configuration Summary:") -message(STATUS "") -message(STATUS "PACKAGE VERSION..................${PACKAGE_VERSION}") -message(STATUS "PACKAGE SOURCE...................${LIBCOAP_PACKAGE_BUILD}") -message(STATUS "LIBRARY API VERSION..............${LIBCOAP_API_VERSION}") -message(STATUS "LIBRARY ABI VERSION..............${LIBCOAP_ABI_VERSION}") -message(STATUS "ENABLE_DTLS:.....................${ENABLE_DTLS}") -message(STATUS "ENABLE_TCP:......................${ENABLE_TCP}") -message(STATUS "ENABLE_IPV4:.....................${ENABLE_IPV4}") -message(STATUS "ENABLE_IPV6:.....................${ENABLE_IPV6}") -message(STATUS "ENABLE_AF_UNIX:..................${ENABLE_AF_UNIX}") -message(STATUS "ENABLE_WEBSOCKETS:...............${ENABLE_WS}") -message(STATUS "ENABLE_Q_BLOCK:..................${ENABLE_Q_BLOCK}") -message(STATUS "ENABLE_CLIENT_MODE:..............${ENABLE_CLIENT_MODE}") -message(STATUS "ENABLE_SERVER_MODE:..............${ENABLE_SERVER_MODE}") -message(STATUS "ENABLE_OSCORE:...................${ENABLE_OSCORE}") -message(STATUS "ENABLE_ASYNC:....................${ENABLE_ASYNC}") -message(STATUS "ENABLE_THREAD_SAFE:..............${ENABLE_THREAD_SAFE}") -message(STATUS "ENABLE_THREAD_RECURSIVE_CHECK....${ENABLE_THREAD_RECURSIVE_LOCK_CHECK}") -message(STATUS "ENABLE_DOCS:.....................${ENABLE_DOCS}") -message(STATUS "ENABLE_EXAMPLES:.................${ENABLE_EXAMPLES}") -message(STATUS "DTLS_BACKEND:....................${DTLS_BACKEND}") -message(STATUS "WITH_GNUTLS:.....................${WITH_GNUTLS}") -message(STATUS "WITH_TINYDTLS:...................${WITH_TINYDTLS}") -message(STATUS "WITH_OPENSSL:....................${WITH_OPENSSL}") -message(STATUS "WITH_WOLFSSL:....................${WITH_WOLFSSL}") -message(STATUS "WITH_MBEDTLS:....................${WITH_MBEDTLS}") -message(STATUS "HAVE_LIBTINYDTLS:................${COAP_WITH_LIBTINYDTLS}") -message(STATUS "HAVE_LIBGNUTLS:..................${COAP_WITH_LIBGNUTLS}") -message(STATUS "HAVE_LIBOPENSSL:.................${COAP_WITH_LIBOPENSSL}") -message(STATUS "HAVE_LIBWOLFSSL:.................${COAP_WITH_LIBWOLFSSL}") -message(STATUS "HAVE_LIBMBEDTLS:.................${COAP_WITH_LIBMBEDTLS}") -message(STATUS "WITH_EPOLL:......................${WITH_EPOLL}") -message(STATUS "WITH_OBSERVE_PERSIST:............${WITH_OBSERVE_PERSIST}") -message(STATUS "BUILD_SHARED_LIBS:...............${BUILD_SHARED_LIBS}") -message(STATUS "MAX_LOGGING_LEVEL:...............${MAX_LOGGING_LEVEL}") -message(STATUS "WARNING_TO_ERROR:................${WARNING_TO_ERROR}") -message(STATUS "CMAKE_C_COMPILER:................${CMAKE_C_COMPILER}") -message(STATUS "CMAKE_CXX_COMPILER_ID:...........${CMAKE_CXX_COMPILER_ID}") -message(STATUS "CMAKE_BUILD_TYPE:................${CMAKE_BUILD_TYPE}") -message(STATUS "CMAKE_SYSTEM_PROCESSOR:..........${CMAKE_SYSTEM_PROCESSOR}") -message(STATUS "CMAKE_HOST_SYSTEM_NAME:..........${CMAKE_HOST_SYSTEM_NAME}") -message(STATUS "CMAKE_GENERATOR:.................${CMAKE_GENERATOR}") -message(STATUS "") - -set(top_srcdir "${CMAKE_CURRENT_LIST_DIR}") -set(top_builddir "${CMAKE_CURRENT_BINARY_DIR}") -if(ENABLE_TCP) - set(COAP_DISABLE_TCP 0) -else(ENABLE_TCP) - set(COAP_DISABLE_TCP 1) -endif(ENABLE_TCP) - -# creates config header file in build directory -configure_file(${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h.in - ${CMAKE_CURRENT_BINARY_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h) - -configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake_coap_config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/coap_config.h) - -configure_file(${CMAKE_CURRENT_LIST_DIR}/tests/test_common.h.in - ${CMAKE_CURRENT_LIST_DIR}/tests/test_common.h) - -# -# sources -# - -target_sources( - ${COAP_LIBRARY_NAME} - PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src/coap_address.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_asn1.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_async.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_block.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_cache.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_debug.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_dtls.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_encode.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_event.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_hashkey.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_io.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_layers.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_mem.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_net.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_netif.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_notls.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_option.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_oscore.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_pdu.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_prng.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_resource.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_session.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_sha1.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_str.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_subscribe.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_tcp.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_threadsafe.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_time.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_uri.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_ws.c - # no need to parse those files if we do not need them - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_openssl.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_wolfssl.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_tinydtls.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_gnutls.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_mbedtls.c> - # needed for OSCORE if enabled - $<$:${CMAKE_CURRENT_LIST_DIR}/src/oscore/oscore.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/oscore/oscore_cbor.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/oscore/oscore_context.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/oscore/oscore_cose.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/oscore/oscore_crypto.c> - # headers - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/libcoap.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_address.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_async.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_block.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_cache.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_debug.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_dtls.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_encode.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_event.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_io.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_mem.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_net.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_option.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_pdu.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_prng.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_resource.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_session.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_str.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_subscribe.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_time.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_uri.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_ws.h) -target_include_directories( - ${COAP_LIBRARY_NAME} - PUBLIC # config headers are generated during configuration time - $ - $ - $ - $ - $<$,$>:${CMAKE_BINARY_DIR}/include/tinydtls> - $<$:${GNUTLS_INCLUDE_DIR}> - $<$:${MBEDTLS_INCLUDE_DIRS}> - $<$:${WOLFSSL_INCLUDE_DIR}>) -target_link_libraries( - ${COAP_LIBRARY_NAME} - PUBLIC $<$:OpenSSL::SSL> - $<$:OpenSSL::Crypto> - $<$:${GNUTLS_LIBRARIES}> - $<$:tinydtls> - $<$:${MBEDTLS_LIBRARY}> - $<$:${MBEDX509_LIBRARY}> - $<$:${MBEDCRYPTO_LIBRARY}> - $<$:${WOLFSSL_LIBRARY}> - $<$:ws2_32>) - -target_compile_options( - ${COAP_LIBRARY_NAME} - PUBLIC -DLIBCOAP_PACKAGE_BUILD="${LIBCOAP_PACKAGE_BUILD}") - -if(ZEPHYR_BASE) -target_compile_options( - ${COAP_LIBRARY_NAME} - PUBLIC -DMBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}" -I${ZEPHYR_MBEDTLS_CMAKE_DIR}/configs) -endif() - -add_library( - ${PROJECT_NAME}::${COAP_LIBRARY_NAME} - ALIAS - ${COAP_LIBRARY_NAME}) - -# -# tests -# - -if(ENABLE_TESTS) - add_executable( - testdriver - ${CMAKE_CURRENT_LIST_DIR}/tests/testdriver.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_common.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_encode.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_encode.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_error_response.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_error_response.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_options.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_options.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_oscore.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_oscore.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_pdu.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_pdu.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_sendqueue.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_sendqueue.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_session.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_session.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_tls.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_tls.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_uri.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_uri.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_wellknown.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_wellknown.h) - # tests require libcunit (e.g. debian libcunit1-dev) - target_link_libraries(testdriver PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME} - -lcunit) -endif() - -# -# examples -# - -if(ENABLE_EXAMPLES) - add_executable(coap-client ${CMAKE_CURRENT_LIST_DIR}/examples/coap-client.c) - target_link_libraries(coap-client - PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - add_executable(coap-rd ${CMAKE_CURRENT_LIST_DIR}/examples/coap-rd.c) - target_include_directories(coap-rd - PRIVATE - $) - target_link_libraries(coap-rd PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - add_executable(coap-server ${CMAKE_CURRENT_LIST_DIR}/examples/coap-server.c) - target_link_libraries(coap-server - PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - if(NOT WIN32 AND NOT MINGW) - add_executable(etsi_iot_01 ${CMAKE_CURRENT_LIST_DIR}/examples/etsi_iot_01.c) - target_link_libraries(etsi_iot_01 - PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - add_executable(tiny ${CMAKE_CURRENT_LIST_DIR}/examples/tiny.c) - target_link_libraries(tiny PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - add_executable(oscore-interop-server - ${CMAKE_CURRENT_LIST_DIR}/examples/oscore-interop-server.c) - target_link_libraries(oscore-interop-server - PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - endif() -endif() - -# -# docs -# - -if(ENABLE_DOCS) - find_package(Doxygen) - - if(Doxygen_FOUND) - # set input and output files - set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in) - set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) - - # Make necessary temporary directories - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/man_tmp) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/man_html) - - # request to configure the file - configure_file( - ${DOXYGEN_IN} - ${DOXYGEN_OUT} - @ONLY) - - # note the option ALL which allows to build the docs together with the - # application - add_custom_target( - doc_doxygen ALL - COMMAND ${DOXYGEN_EXECUTABLE} -u > /dev/null 2>&1 - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" - VERBATIM) - - message(STATUS "Setup up the Doxygen documention build") - - else(Doxygen_FOUND) - message( - WARNING - "Doxygen need to be installed to generate the doxygen documentation") - endif(Doxygen_FOUND) - -endif() - -# -# install -# - -include(GNUInstallDirs) -include(CMakePackageConfigHelpers) - -set(LIBCOAP_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) -install( - TARGETS ${COAP_LIBRARY_NAME} - EXPORT ${PROJECT_NAME}Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib) - -if(NOT ZEPHYR_BASE) -install( - EXPORT ${PROJECT_NAME}Targets - DESTINATION ${LIBCOAP_CONFIG_INSTALL_DIR} - NAMESPACE ${PROJECT_NAME}:: - COMPONENT dev) -endif() - -configure_package_config_file( - cmake/Config.cmake.in - ${PROJECT_NAME}Config.cmake - INSTALL_DESTINATION - ${LIBCOAP_CONFIG_INSTALL_DIR}) -write_basic_package_version_file( - ${PROJECT_NAME}ConfigVersion.cmake - COMPATIBILITY SameMajorVersion) -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION ${LIBCOAP_CONFIG_INSTALL_DIR} - COMPONENT dev) - -install( - DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT dev - FILES_MATCHING - PATTERN "*.h" - PATTERN "coap.h" EXCLUDE - PATTERN "coap_riot.h" EXCLUDE - PATTERN "*_internal.h" EXCLUDE - PATTERN "oscore*" EXCLUDE) -install( - DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT dev - FILES_MATCHING - PATTERN "*.h") -if(ENABLE_EXAMPLES) - install( - TARGETS coap-server coap-client coap-rd - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT dev) - if(NOT WIN32 AND NOT MINGW) - install( - TARGETS etsi_iot_01 tiny oscore-interop-server - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT dev) - endif() -endif() diff --git a/Makefile.am b/Makefile.am index 2e2c2452..4f403b1b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,7 +60,6 @@ EXTRA_DIST = \ examples/lwip/server-coap.c \ examples/lwip/server-coap.h \ examples/lwip/config/coap_config.h \ - examples/lwip/config/coap_config.h.in \ examples/lwip/config/lwipopts.h \ examples/lwip/config/lwippools.h \ examples/riot/examples_libcoap_client/client-coap.c \ @@ -125,9 +124,7 @@ EXTRA_DIST = \ include/coap$(LIBCOAP_API_VERSION)/coap_ws_internal.h \ include/coap$(LIBCOAP_API_VERSION)/coap.h.in \ include/coap$(LIBCOAP_API_VERSION)/coap.h.riot \ - include/coap$(LIBCOAP_API_VERSION)/coap.h.riot.in \ include/coap$(LIBCOAP_API_VERSION)/coap.h.windows \ - include/coap$(LIBCOAP_API_VERSION)/coap.h.windows.in \ include/oscore/oscore_cbor.h \ include/oscore/oscore_context.h \ include/oscore/oscore_cose.h \ @@ -365,15 +362,7 @@ clean-local: distclean-local: @rm -f src/*.o src/*.lo - rm -f libcoap-$(LIBCOAP_API_VERSION).map - rm -f libcoap-$(LIBCOAP_API_VERSION).sym rm -f libcoap-$(LIBCOAP_NAME_SUFFIX).pc - @echo - @echo " ---> Please note the following important advice! <---" - @echo " The files libcoap-$(LIBCOAP_API_VERSION).{map,sym} are removed by the distclean target!" - @echo " To regenerate this two files you need to call 'make update-map-file' first before any" - @echo " other Make target. Otherwise the build of libcoap will fail!" - @echo ## Ensure we have actual *.{map,sym} files if we create a release tarball. dist-local: update-map-file diff --git a/coap_config.h.contiki b/coap_config.h.contiki index ca11c5be..472e8af1 100644 --- a/coap_config.h.contiki +++ b/coap_config.h.contiki @@ -1,10 +1,6 @@ /* * coap_config.h.contiki -- Contiki configuration for libcoap * - * [coap_config.h.contiki is re-built from coap_config.h.contiki.in by the - * libcoap ./configure command, so make any permanent changes to libcoap's - * coap_config.h.contiki.in for a libcoap Pull Request] - * * Copyright (C) 2021-2024 Olaf Bergmann and others * * SPDX-License-Identifier: BSD-2-Clause diff --git a/coap_config.h.contiki.in b/coap_config.h.contiki.in deleted file mode 100644 index aa0f0a33..00000000 --- a/coap_config.h.contiki.in +++ /dev/null @@ -1,138 +0,0 @@ -/* - * coap_config.h.contiki -- Contiki configuration for libcoap - * - * [coap_config.h.contiki is re-built from coap_config.h.contiki.in by the - * libcoap ./configure command, so make any permanent changes to libcoap's - * coap_config.h.contiki.in for a libcoap Pull Request] - * - * Copyright (C) 2021-2024 Olaf Bergmann and others - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -/* Define to 1 if libcoap supports client mode code. */ -#define COAP_CLIENT_SUPPORT 1 - -/* Define to 1 if libcoap supports server mode code. */ -#define COAP_SERVER_SUPPORT 1 - -/* Define to 1 if the system has small stack size. */ -#define COAP_CONSTRAINED_STACK 1 - -/* Define to 1 to build without TCP support. */ -#define COAP_DISABLE_TCP 1 - -/* Define to 1 to build support for IPv4 packets. */ -/* #undef COAP_IPV4_SUPPORT 1 */ - -/* Define to 1 to build support for IPv6 packets. */ -#define COAP_IPV6_SUPPORT 1 - -/* Define to 1 to build support for Unix socket packets. */ -/* #undef COAP_AF_UNIX_SUPPORT 1 */ - -/* Define to 1 to build with support for async separate responses. */ -#define COAP_ASYNC_SUPPORT 1 - -/* Define to 1 to build support for persisting observes. */ -/* #undef COAP_WITH_OBSERVE_PERSIST 1 */ - -/* Define to 1 to build with WebSockets support. */ -/* #undef COAP_WS_SUPPORT 1 */ - -/* Define to 1 to build with Q-Block (RFC9177) support. */ -/* #undef COAP_Q_BLOCK_SUPPORT 1 */ - -/* Define to 1 to build with thread recursive lock detection support. */ -/* #undef COAP_THREAD_RECURSIVE_CHECK 1 */ - -/* Define to 1 if libcoap has thread safe support. */ -/* #undef COAP_THREAD_SAFE 1 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strnlen' function. */ -#define HAVE_STRNLEN 1 - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -#ifndef PACKAGE_BUGREPORT -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" -#endif /* PACKAGE_BUGREPORT */ - -#ifndef PACKAGE_NAME -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" -#endif /* PACKAGE_NAME */ - -#ifndef PACKAGE_STRING -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@PACKAGE_STRING@" -#endif /* PACKAGE_STRING */ - -#ifndef PACKAGE_TARNAME -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PACKAGE_TARNAME@" -#endif /* PACKAGE_TARNAME */ - -#ifndef PACKAGE_URL -/* Define to the home page for this package. */ -#define PACKAGE_URL "@PACKAGE_URL@" -#endif /* PACKAGE_URL */ - -#ifndef PACKAGE_VERSION -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" -#endif /* PACKAGE_VERSION */ - -#define WITH_CONTIKI 1 - -#define HASH_NONFATAL_OOM 1 - -#ifndef HEAPMEM_CONF_ARENA_SIZE -#define HEAPMEM_CONF_ARENA_SIZE 6144 -#endif - -#endif /* COAP_CONFIG_H_ */ diff --git a/coap_config.h.riot b/coap_config.h.riot index 707762fb..30c0557d 100644 --- a/coap_config.h.riot +++ b/coap_config.h.riot @@ -1,10 +1,6 @@ /* * coap_config.h.riot -- RIOT configuration for libcoap * - * [coap_config.h.riot is re-built from coap_config.h.riot.in by the - * libcoap ./configure command, so make any permanent changes to libcoap's - * coap_config.h.riot.in for a libcoap Pull Request] - * * Copyright (C) 2021-2024 Olaf Bergmann and others * * SPDX-License-Identifier: BSD-2-Clause diff --git a/coap_config.h.riot.in b/coap_config.h.riot.in deleted file mode 100644 index de67742d..00000000 --- a/coap_config.h.riot.in +++ /dev/null @@ -1,407 +0,0 @@ -/* - * coap_config.h.riot -- RIOT configuration for libcoap - * - * [coap_config.h.riot is re-built from coap_config.h.riot.in by the - * libcoap ./configure command, so make any permanent changes to libcoap's - * coap_config.h.riot.in for a libcoap Pull Request] - * - * Copyright (C) 2021-2024 Olaf Bergmann and others - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#define WITH_POSIX 1 - -#ifndef COAP_CONSTRAINED_STACK -#define COAP_CONSTRAINED_STACK 1 -#endif - -/* - * For systems that define int as being 2 bytes, need to make sure the - * minimum configuration is set up (overridden if explicitely defined). - */ -#include - -#if (UINT_MAX <= 65535) -#define COAP_DISABLE_TCP 1 -#define COAP_AF_UNIX_SUPPORT 0 -#define COAP_OSCORE_SUPPORT 0 -#define COAP_WITH_OBSERVE_PERSIST 0 -#define COAP_WS_SUPPORT 0 -#define COAP_Q_BLOCK_SUPPORT 0 -#define COAP_MAX_LOGGING_LEVEL 0 -#endif /* UINT_MAX < 65536 */ - -#ifdef CONFIG_LIBCOAP_MAX_LOGGING_LEVEL -#ifndef COAP_MAX_LOGGING_LEVEL -/* Define 0-8 for max logging levels. */ -#define COAP_MAX_LOGGING_LEVEL CONFIG_LIBCOAP_MAX_LOGGING_LEVEL -#endif /* COAP_MAX_LOGGING_LEVEL */ -#else /* ! CONFIG_LIBCOAP_MAX_LOGGING_LEVEL */ -#ifndef COAP_MAX_LOGGING_LEVEL -/* Define 0-8 for max logging levels. */ -#define COAP_MAX_LOGGING_LEVEL 4 -#endif /* COAP_MAX_LOGGING_LEVEL */ -#endif /* ! CONFIG_LIBCOAP_MAX_LOGGING_LEVEL */ - -#ifdef CONFIG_LIBCOAP_IPV4_SUPPORT -#ifndef COAP_IPV4_SUPPORT -/* Define to 1 to build with IPv4 support. */ -#define COAP_IPV4_SUPPORT 1 -#endif /* COAP_IPV4_SUPPORT */ -#endif /* CONFIG_LIBCOAP_IPV4_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_IPV6_SUPPORT -#ifndef COAP_IPV6_SUPPORT -/* Define to 1 to build with IPv6 support. */ -#define COAP_IPV6_SUPPORT 1 -#endif /* COAP_IPV6_SUPPORT */ -#endif /* CONFIG_LIBCOAP_IPV6_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_AF_UNIX_SUPPORT -#ifndef COAP_AF_UNIX_SUPPORT -/* Define to 1 to build with Unix socket support. */ -#define COAP_AF_UNIX_SUPPORT 1 -#endif /* COAP_AF_UNIX_SUPPORT */ -#endif /* CONFIG_LIBCOAP_AF_UNIX_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_TCP_SUPPORT -#ifndef COAP_DISABLE_TCP -/* Define to 1 to build without TCP support. */ -#define COAP_DISABLE_TCP 0 -#endif /* COAP_DISABLE_TCP */ -#else /* ! CONFIG_LIBCOAP_TCP_SUPPORT */ -#ifndef COAP_DISABLE_TCP -/* Define to 1 to build without TCP support. */ -#define COAP_DISABLE_TCP 1 -#endif /* ! COAP_DISABLE_TCP */ -#endif /* ! CONFIG_LIBCOAP_TCP_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_OSCORE_SUPPORT -#ifndef COAP_OSCORE_SUPPORT -/* Define to 1 if the library has OSCORE support. */ -#define COAP_OSCORE_SUPPORT 1 -#endif /* COAP_OSCORE_SUPPORT */ -#endif /* CONFIG_LIBCOAP_OSCORE_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_WITH_OBSERVE_PERSIST -#ifndef COAP_WITH_OBSERVE_PERSIST -/* Define to 1 if the library has Observe persist support. */ -#define COAP_WITH_OBSERVE_PERSIST 0 -#endif /* COAP_WITH_OBSERVE_PERSIST */ -#endif /* CONFIG_LIBCOAP_WITH_OBSERVE_PERSIST */ - -#ifdef CONFIG_LIBCOAP_WS_SUPPORT -#ifndef COAP_WS_SUPPORT -/* Define to 1 if the library has WebSockets support. */ -#define COAP_WS_SUPPORT 0 -#endif /* COAP_WS_SUPPORT */ -#endif /* CONFIG_LIBCOAP_WS_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_Q_BLOCK_SUPPORT -#ifndef COAP_Q_BLOCK_SUPPORT -/* Define to 1 to build with Q-Block (RFC9177) support. */ -#define COAP_Q_BLOCK_SUPPORT 0 -#endif /* COAP_Q_BLOCK_SUPPORT */ -#endif /* CONFIG_LIBCOAP_Q_BLOCK_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_CLIENT_SUPPORT -#ifndef COAP_CLIENT_SUPPORT -/* Define to 1 if the library has client support. */ -#define COAP_CLIENT_SUPPORT 1 -#endif /* COAP_CLIENT_SUPPORT */ -#endif /* CONFIG_LIBCOAP_CLIENT_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_SERVER_SUPPORT -#ifndef COAP_SERVER_SUPPORT -/* Define to 1 if the library has server support. */ -#define COAP_SERVER_SUPPORT 1 -#endif /* COAP_SERVER_SUPPORT */ -#endif /* CONFIG_LIBCOAP_SERVER_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_ASYNC_SUPPORT -#ifndef COAP_ASYNC_SUPPORT -/* Define to 1 to build with support for async separate responses. */ -#define COAP_ASYNC_SUPPORT 1 -#endif /* COAP_ASYNC_SUPPORT */ -#endif /* CONFIG_LIBCOAP_ASYNC_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_THREAD_SAFE -#ifndef COAP_THREAD_SAFE -/* Define to 1 if libcoap has thread safe support. */ -#define COAP_THREAD_SAFE 1 -#endif /* COAP_THREAD_SAFE */ -#endif /* CONFIG_LIBCOAP_THREAD_SAFE */ - -#ifdef CONFIG_LIBCOAP_THREAD_RECURSIVE_CHECK -#ifndef COAP_THREAD_RECURSIVE_CHECK -/* Define to 1 to build with thread recursive lock detection support. */ -#define COAP_THREAD_RECURSIVE_CHECK 1 -#endif /* COAP_THREAD_RECURSIVE_CHECK */ -#endif /* CONFIG_LIBCOAP_THREAD_RECURSIVE_CHECK */ - -#ifdef CONFIG_LIBCOAP_MAX_STRING_SIZE -#ifndef COAP_MAX_STRING_SIZE -#define COAP_MAX_STRING_SIZE CONFIG_LIBCOAP_MAX_STRING_SIZE -#endif /* COAP_MAX_STRING_SIZE */ -#endif /* CONFIG_LIBCOAP_OSCORE_SUPPORT */ - -#ifdef CONFIG_LIBCOAP_MAX_ENDPOINTS -#ifndef COAP_MAX_ENDPOINTS -#define COAP_MAX_ENDPOINTS CONFIG_LIBCOAP_MAX_ENDPOINTS -#endif /* COAP_MAX_ENDPOINTS */ -#endif /* CONFIG_LIBCOAP_MAX_ENDPOINTS */ - -#ifdef CONFIG_LIBCOAP_MAX_RESOURCES -#ifndef COAP_MAX_RESOURCES -#define COAP_MAX_RESOURCES CONFIG_LIBCOAP_MAX_RESOURCES -#endif /* COAP_MAX_RESOURCES */ -#endif /* CONFIG_LIBCOAP_MAX_RESOURCES */ - -#ifdef CONFIG_LIBCOAP_MAX_ATTRIBUTE_SIZE -#ifndef COAP_MAX_ATTRIBUTE_SIZE -#define COAP_MAX_ATTRIBUTE_SIZE CONFIG_LIBCOAP_MAX_ATTRIBUTE_SIZE -#endif /* COAP_MAX_ATTRIBUTE_SIZE */ -#endif /* CONFIG_LIBCOAP_MAX_ATTRIBUTE_SIZE */ - -#ifdef CONFIG_LIBCOAP_MAX_ATTRIBUTES -#ifndef COAP_MAX_ATTRIBUTES -#define COAP_MAX_ATTRIBUTES CONFIG_LIBCOAP_MAX_ATTRIBUTES -#endif /* COAP_MAX_ATTRIBUTES */ -#endif /* CONFIG_LIBCOAP_MAX_ATTRIBUTES */ - -#ifdef CONFIG_LIBCOAP_MAX_PACKETS -#ifndef COAP_MAX_PACKETS -#define COAP_MAX_PACKETS CONFIG_LIBCOAP_MAX_PACKETS -#endif /* COAP_MAX_PACKETS */ -#endif /* CONFIG_LIBCOAP_MAX_PACKETS */ - -#ifdef CONFIG_LIBCOAP_MAX_NODES -#ifndef COAP_MAX_NODES -#define COAP_MAX_NODES CONFIG_LIBCOAP_MAX_NODES -#endif /* COAP_MAX_NODES */ -#endif /* CONFIG_LIBCOAP_MAX_NODES */ - -#ifdef CONFIG_LIBCOAP_MAX_CONTEXTS -#ifndef COAP_MAX_CONTEXTS -#define COAP_MAX_CONTEXTS CONFIG_LIBCOAP_MAX_CONTEXTS -#endif /* COAP_MAX_CONTEXTS */ -#endif /* CONFIG_LIBCOAP_MAX_CONTEXTS */ - -#ifdef CONFIG_LIBCOAP_MAX_PDUS -#ifndef COAP_MAX_PDUS -#define COAP_MAX_PDUS CONFIG_LIBCOAP_MAX_PDUS -#endif /* COAP_MAX_PDUS */ -#endif /* CONFIG_LIBCOAP_MAX_PDUS */ - -#ifdef CONFIG_LIBCOAP_MAX_DTLS_SESSIONS -#ifndef COAP_MAX_DTLS_SESSIONS -#define COAP_MAX_DTLS_SESSIONS CONFIG_LIBCOAP_MAX_DTLS_SESSIONS -#endif /* COAP_MAX_DTLS_SESSIONS */ -#endif /* CONFIG_LIBCOAP_MAX_DTLS_SESSIONS */ - -#ifdef CONFIG_LIBCOAP_MAX_SESSIONS -#ifndef COAP_MAX_SESSIONS -#define COAP_MAX_SESSIONS CONFIG_LIBCOAP_MAX_SESSIONS -#endif /* COAP_MAX_SESSIONS */ -#endif /* CONFIG_LIBCOAP_MAX_SESSIONS */ - -#ifdef CONFIG_LIBCOAP_MAX_OPTION_SIZE -#ifndef COAP_MAX_OPTION_SIZE -#define COAP_MAX_OPTION_SIZE CONFIG_LIBCOAP_MAX_OPTION_SIZE -#endif /* COAP_MAX_OPTION_SIZE */ -#endif /* CONFIG_LIBCOAP_MAX_OPTION_SIZE */ - -#ifdef CONFIG_LIBCOAP_MAX_OPTIONS -#ifndef COAP_MAX_OPTIONS -#define COAP_MAX_OPTIONS CONFIG_LIBCOAP_MAX_OPTIONS -#endif /* COAP_MAX_OPTIONS */ -#endif /* CONFIG_LIBCOAP_MAX_OPTIONS */ - -#ifdef CONFIG_LIBCOAP_MAX_CACHE_KEYS -#ifndef COAP_MAX_CACHE_KEYS -#define COAP_MAX_CACHE_KEYS CONFIG_LIBCOAP_MAX_CACHE_KEYS -#endif /* COAP_MAX_CACHE_KEYS */ -#endif /* CONFIG_LIBCOAP_MAX_CACHE_KEYS */ - -#ifdef CONFIG_LIBCOAP_MAX_CACHE_ENTRIES -#ifndef COAP_MAX_CACHE_ENTRIES -#define COAP_MAX_CACHE_ENTRIES CONFIG_LIBCOAP_MAX_CACHE_ENTRIES -#endif /* COAP_MAX_CACHE_ENTRIES */ -#endif /* CONFIG_LIBCOAP_MAX_CACHE_ENTRIES */ - -#ifdef CONFIG_LIBCOAP_MAX_LG_CRCVS -#ifndef COAP_MAX_LG_CRCVS -#define COAP_MAX_LG_CRCVS CONFIG_LIBCOAP_MAX_LG_CRCVS -#endif /* COAP_MAX_LG_CRCVS */ -#endif /* CONFIG_LIBCOAP_MAX_LG_CRCVS */ - -#ifdef CONFIG_LIBCOAP_MAX_LG_SRCVS -#ifndef COAP_MAX_LG_SRCVS -#define COAP_MAX_LG_SRCVS CONFIG_LIBCOAP_MAX_LG_SRCVS -#endif /* COAP_MAX_LG_SRCVS */ -#endif /* CONFIG_LIBCOAP_MAX_LG_SRCVS */ - -#ifdef CONFIG_LIBCOAP_MAX_LG_XMITS -#ifndef COAP_MAX_LG_XMITS -#define COAP_MAX_LG_XMITS CONFIG_LIBCOAP_MAX_LG_XMITS -#endif /* COAP_MAX_LG_XMITS */ -#endif /* CONFIG_LIBCOAP_MAX_LG_XMITS */ - -#ifndef COAP_DISABLE_TCP -#if MODULE_SOCK_TCP -#define COAP_DISABLE_TCP 0 -#else /* ! MODULE_SOCK_TCP */ -#define COAP_DISABLE_TCP 1 -#endif /* ! MODULE_SOCK_TCP */ -#endif /* COAP_DISABLE_TCP */ - -#ifdef MODULE_TINYDTLS -#ifndef COAP_WITH_LIBTINYDTLS -#define COAP_WITH_LIBTINYDTLS 1 -#endif /* ! COAP_WITH_LIBTINYDTLS */ -#endif /* MODULE_TINYDTLS */ - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ARPA_INET_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if you have the `getaddrinfo' function. */ -/* #undef HAVE_GETADDRINFO */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIMITS_H */ - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETDB_H */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_NETINET_IN_H */ - -/* Define to 1 if you have the `select' function. */ -/* #undef HAVE_SELECT */ - -/* Define to 1 if you have the `socket' function. */ -/* #undef HAVE_SOCKET */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strnlen' function. */ -#define HAVE_STRNLEN 1 - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SOCKET_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_STAT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -#ifndef PACKAGE_BUGREPORT -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" -#endif /* PACKAGE_BUGREPORT */ - -#ifndef PACKAGE_NAME -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" -#endif /* PACKAGE_NAME */ - -#ifndef PACKAGE_STRING -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@PACKAGE_STRING@" -#endif /* PACKAGE_STRING */ - -#ifndef PACKAGE_TARNAME -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PACKAGE_TARNAME@" -#endif /* PACKAGE_TARNAME */ - -#ifndef PACKAGE_URL -/* Define to the home page for this package. */ -#define PACKAGE_URL "@PACKAGE_URL@" -#endif /* PACKAGE_URL */ - -#ifndef PACKAGE_VERSION -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" -#endif /* PACKAGE_VERSION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* 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 -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ - -#endif /* COAP_CONFIG_H_ */ diff --git a/coap_config.h.windows b/coap_config.h.windows index 71f3d1d2..bc0529c4 100644 --- a/coap_config.h.windows +++ b/coap_config.h.windows @@ -1,10 +1,6 @@ /* * coap_config.h.windows -- Windows configuration for libcoap * - * [coap_config.h.windows is re-built from coap_config.h.windows.in by the - * libcoap ./configure command, so make any permanent changes to libcoap's - * coap_config.h.windows.in for a libcoap Pull Request] - * * Copyright (C) 2017-2024 Olaf Bergmann and others * * SPDX-License-Identifier: BSD-2-Clause diff --git a/coap_config.h.windows.in b/coap_config.h.windows.in deleted file mode 100644 index dba97ea7..00000000 --- a/coap_config.h.windows.in +++ /dev/null @@ -1,211 +0,0 @@ -/* - * coap_config.h.windows -- Windows configuration for libcoap - * - * [coap_config.h.windows is re-built from coap_config.h.windows.in by the - * libcoap ./configure command, so make any permanent changes to libcoap's - * coap_config.h.windows.in for a libcoap Pull Request] - * - * Copyright (C) 2017-2024 Olaf Bergmann and others - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#if defined(_WIN32) - -/* Define to 1 if you have header file. */ -#define HAVE_WS2TCPIP_H 1 - -/* Define to 1 if you have header file. */ -#define HAVE_WINSOCK2_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if you have the `getaddrinfo' function. */ -#define HAVE_GETADDRINFO 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the `malloc' function. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the `select' function. */ -#define HAVE_SELECT 1 - -/* Define to 1 if you have the `socket' function. */ -#define HAVE_SOCKET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strnlen' function. */ -#define HAVE_STRNLEN 1 - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if the system has the type `struct cmsghdr'. */ -#define HAVE_STRUCT_CMSGHDR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -#if defined(_MSC_VER) && (_MSC_VER < 1900) && !defined(snprintf) -#define snprintf _snprintf -#endif - -#ifndef COAP_DISABLE_TCP -/* Define to 1 to build without TCP support. */ -#define COAP_DISABLE_TCP 0 -#endif - -#ifndef COAP_IPV4_SUPPORT -/* Define to 1 to build with IPv4 support. */ -#define COAP_IPV4_SUPPORT 1 -#endif - -#ifndef COAP_IPV6_SUPPORT -/* Define to 1 to build with IPv6 support. */ -#define COAP_IPV6_SUPPORT 1 -#endif - -#ifndef COAP_AF_UNIX_SUPPORT -/* Define to 1 to build with Unix socket support. */ -#define COAP_AF_UNIX_SUPPORT 0 -#endif - -#ifndef COAP_CLIENT_SUPPORT -/* Define if libcoap supports client mode code. */ -#define COAP_CLIENT_SUPPORT 1 -#endif - -#ifndef COAP_SERVER_SUPPORT -/* Define if libcoap supports server mode code. */ -#define COAP_SERVER_SUPPORT 1 -#endif - -#ifndef COAP_WITH_OBSERVE_PERSIST -/* Define to build support for persisting observes. */ -#define COAP_WITH_OBSERVE_PERSIST 0 -#endif - -#ifndef COAP_WS_SUPPORT -/* Define to 1 to build with WebSockets support. */ -#define COAP_WS_SUPPORT 0 -#endif - -#ifndef COAP_Q_BLOCK_SUPPORT -/* Define to 1 to build with Q-Block (RFC9177) support. */ -#define COAP_Q_BLOCK_SUPPORT 0 -#endif - -#ifndef COAP_MAX_LOGGING_LEVEL -/* Define to 0-8 for maximum logging level. */ -#define COAP_MAX_LOGGING_LEVEL 8 -#endif - -#ifndef COAP_OSCORE_SUPPORT -/* Define to 1 to build with OSCORE support. */ -#define COAP_OSCORE_SUPPORT 1 -#endif - -#ifndef COAP_ASYNC_SUPPORT -/* Define to 1 to build with support for async separate responses. */ -#define COAP_ASYNC_SUPPORT 1 -#endif - -#ifndef COAP_THREAD_SAFE -/* Define to 1 if libcoap has thread safe support. */ -#define COAP_THREAD_SAFE 0 -#endif - -#ifndef COAP_THREAD_RECURSIVE_CHECK -/* Define to 1 to build with thread recursive lock detection support. */ -#define COAP_THREAD_RECURSIVE_CHECK 0 -#endif - -#ifndef PACKAGE_BUGREPORT -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" -#endif /* PACKAGE_BUGREPORT */ - -#ifndef PACKAGE_NAME -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" -#endif /* PACKAGE_NAME */ - -#ifndef PACKAGE_STRING -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@PACKAGE_STRING@" -#endif /* PACKAGE_STRING */ - -#ifndef PACKAGE_TARNAME -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PACKAGE_TARNAME@" -#endif /* PACKAGE_TARNAME */ - -#ifndef PACKAGE_URL -/* Define to the home page for this package. */ -#define PACKAGE_URL "@PACKAGE_URL@" -#endif /* PACKAGE_URL */ - -#ifndef PACKAGE_VERSION -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" -#endif /* PACKAGE_VERSION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* 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 -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define this to 1 for ancillary data on MacOS */ -/* #undef __APPLE_USE_RFC_3542 */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ - -#endif - -#endif /* COAP_CONFIG_H_ */ diff --git a/configure.ac b/configure.ac index 21da465d..297f5b1a 100644 --- a/configure.ac +++ b/configure.ac @@ -144,6 +144,13 @@ LT_INIT([shared static]) # To add to the confusion, if LIBCOAP_SO_VERSION is set to 3:0:1 (c:r:a), then the # .so version naming ends up as 2.1.0 (c-a:a:r) (as decided by libtool). +# +# CAUTION +# +# You will need to manually update various configuration files by running the +# ./configure built script file scripts/fix_version.sh . +# + LT_LIBCOAP_CURRENT=4 LT_LIBCOAP_REVISION=2 LT_LIBCOAP_AGE=1 @@ -1304,16 +1311,9 @@ CFLAGS="$CFLAGS $ADDITIONAL_CFLAGS" # AC_CONFIG_FILES([ Makefile -CMakeLists.txt -coap_config.h.contiki -coap_config.h.riot -coap_config.h.windows doc/Makefile examples/Makefile -examples/lwip/config/coap_config.h include/coap$LIBCOAP_API_VERSION/coap.h -include/coap$LIBCOAP_API_VERSION/coap.h.riot -include/coap$LIBCOAP_API_VERSION/coap.h.windows man/coap.txt man/coap_address.txt man/coap_async.txt @@ -1350,6 +1350,7 @@ man/coap-server.txt man/coap-rd.txt man/coap-tls-engine-conf.txt man/Makefile +scripts/fix_version.sh tests/test_common.h tests/Makefile tests/oss-fuzz/Makefile.ci diff --git a/examples/lwip/config/coap_config.h b/examples/lwip/config/coap_config.h index e836ab03..3e15e4e2 100644 --- a/examples/lwip/config/coap_config.h +++ b/examples/lwip/config/coap_config.h @@ -1,10 +1,6 @@ /* * coap_config.h -- LwIP configuration for libcoap * - * [coap_config.h is re-built from coap_config.h.in by the - * libcoap ./configure command, so make any permanent changes to libcoap's - * examples/lwip/config/coap_config.h.in for a libcoap Pull Request] - * * Copyright (C) 2021-2024 Olaf Bergmann and others * * SPDX-License-Identifier: BSD-2-Clause diff --git a/examples/lwip/config/coap_config.h.in b/examples/lwip/config/coap_config.h.in deleted file mode 100644 index 21e02a38..00000000 --- a/examples/lwip/config/coap_config.h.in +++ /dev/null @@ -1,124 +0,0 @@ -/* - * coap_config.h -- LwIP configuration for libcoap - * - * [coap_config.h is re-built from coap_config.h.in by the - * libcoap ./configure command, so make any permanent changes to libcoap's - * examples/lwip/config/coap_config.h.in for a libcoap Pull Request] - * - * Copyright (C) 2021-2024 Olaf Bergmann and others - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#include -#include -#include /* provide ntohs, htons */ - -#define WITH_LWIP 1 - -#if LWIP_IPV4 -#define COAP_IPV4_SUPPORT 1 -#endif /* LWIP_IPV4 */ - -#if LWIP_IPV6 -#define COAP_IPV6_SUPPORT 1 -#endif /* LWIP_IPV6 */ - -#ifndef COAP_CONSTRAINED_STACK -/* Define to 1 to minimize stack usage. */ -#define COAP_CONSTRAINED_STACK 1 -#endif - -#ifndef COAP_DISABLE_TCP -/* Define to 1 to build without TCP support. */ -#if LWIP_TCP -#define COAP_DISABLE_TCP 0 -#else /* ! LWIP_TCP */ -#define COAP_DISABLE_TCP 1 -#endif /* ! LWIP_TCP */ -#endif - -#ifndef COAP_ASYNC_SUPPORT -/* Define to 1 to build with support for async separate responses. */ -#define COAP_ASYNC_SUPPORT 1 -#endif - -#ifndef COAP_WITH_OBSERVE_PERSIST -/* Define to 1 to build support for persisting observes. */ -#define COAP_WITH_OBSERVE_PERSIST 0 -#endif - -#ifndef COAP_WS_SUPPORT -/* Define to 1 to build with WebSockets support. */ -#define COAP_WS_SUPPORT 0 -#endif - -#ifndef COAP_Q_BLOCK_SUPPORT -/* Define to 1 to build with Q-Block (RFC9177) support. */ -#define COAP_Q_BLOCK_SUPPORT 0 -#endif - -#ifndef COAP_THREAD_SAFE -/* Define to 1 if libcoap has thread safe support. */ -#define COAP_THREAD_SAFE 0 -#endif - -#ifndef COAP_THREAD_RECURSIVE_CHECK -/* Define to 1 to build with thread recursive lock detection support. */ -#define COAP_THREAD_RECURSIVE_CHECK 0 -#endif - -#ifndef PACKAGE_BUGREPORT -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" -#endif /* PACKAGE_BUGREPORT */ - -#ifndef PACKAGE_NAME -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" -#endif /* PACKAGE_NAME */ - -#ifndef PACKAGE_STRING -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@PACKAGE_STRING@" -#endif /* PACKAGE_STRING */ - -#ifndef PACKAGE_TARNAME -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PACKAGE_TARNAME@" -#endif /* PACKAGE_TARNAME */ - -#ifndef PACKAGE_URL -/* Define to the home page for this package. */ -#define PACKAGE_URL "@PACKAGE_URL@" -#endif /* PACKAGE_URL */ - -#ifndef PACKAGE_VERSION -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" -#endif /* PACKAGE_VERSION */ - -#ifndef assert -#define assert(x) LWIP_ASSERT("CoAP assert failed", x) -#endif /* assert */ - -/* it's just provided by libc. i hope we don't get too many of those, as - * actually we'd need autotools again to find out what environment we're - * building in */ -#define HAVE_STRNLEN 1 - -#define HAVE_LIMITS_H - -#define HAVE_NETDB_H - -#define HAVE_SNPRINTF - -#define HAVE_ERRNO_H - -#endif /* COAP_CONFIG_H_ */ diff --git a/include/coap3/coap.h.riot.in b/include/coap3/coap.h.riot.in deleted file mode 100644 index ebdde9e8..00000000 --- a/include/coap3/coap.h.riot.in +++ /dev/null @@ -1,72 +0,0 @@ -/* - * coap.h -- main header file for CoAP stack of libcoap (RIOT) - * - * Copyright (C) 2010-2012,2015-2024 Olaf Bergmann - * 2015 Carsten Schoenert - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -/** - * @file coap.h - * @brief Primary include file - */ - -#ifndef COAP_H_ -#define COAP_H_ - -/* Define the address where bug reports for libcoap should be sent. */ -#define LIBCOAP_PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" - -/* Define the full name of libcoap. */ -#define LIBCOAP_PACKAGE_NAME "@PACKAGE_NAME@" - -/* Define the full name and version of libcoap. */ -#define LIBCOAP_PACKAGE_STRING "@PACKAGE_STRING@" - -/* Define the home page for libcoap. */ -#define LIBCOAP_PACKAGE_URL "@PACKAGE_URL@" - -/* Define the version of libcoap this file belongs to. */ -#define LIBCOAP_PACKAGE_VERSION "@PACKAGE_VERSION@" - -/* Define the numeric version identifier for libcoap */ -#define LIBCOAP_VERSION (@LIBCOAP_VERSION@U) - -#ifdef __cplusplus -extern "C" { -#endif - -#include "libcoap.h" - -#include "coap_forward_decls.h" -#include "coap_address.h" -#include "coap_async.h" -#include "coap_block.h" -#include "coap_cache.h" -#include "coap_debug.h" -#include "coap_dtls.h" -#include "coap_encode.h" -#include "coap_event.h" -#include "coap_io.h" -#include "coap_mem.h" -#include "coap_net.h" -#include "coap_option.h" -#include "coap_oscore.h" -#include "coap_pdu.h" -#include "coap_prng.h" -#include "coap_resource.h" -#include "coap_str.h" -#include "coap_subscribe.h" -#include "coap_time.h" -#include "coap_uri.h" -#include "coap_ws.h" - -#ifdef __cplusplus -} -#endif - -#endif /* COAP_H_ */ diff --git a/include/coap3/coap.h.windows.in b/include/coap3/coap.h.windows.in deleted file mode 100644 index 415b7923..00000000 --- a/include/coap3/coap.h.windows.in +++ /dev/null @@ -1,72 +0,0 @@ -/* - * coap.h -- main header file for CoAP stack of libcoap (Windows) - * - * Copyright (C) 2010-2012,2015-2024 Olaf Bergmann - * 2015 Carsten Schoenert - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -/** - * @file coap.h - * @brief Primary include file - */ - -#ifndef COAP_H_ -#define COAP_H_ - -/* Define the address where bug reports for libcoap should be sent. */ -#define LIBCOAP_PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" - -/* Define the full name of libcoap. */ -#define LIBCOAP_PACKAGE_NAME "@PACKAGE_NAME@" - -/* Define the full name and version of libcoap. */ -#define LIBCOAP_PACKAGE_STRING "@PACKAGE_STRING@" - -/* Define the home page for libcoap. */ -#define LIBCOAP_PACKAGE_URL "@PACKAGE_URL@" - -/* Define the version of libcoap this file belongs to. */ -#define LIBCOAP_PACKAGE_VERSION "@PACKAGE_VERSION@" - -/* Define the numeric version identifier for libcoap */ -#define LIBCOAP_VERSION (@LIBCOAP_VERSION@U) - -#ifdef __cplusplus -extern "C" { -#endif - -#include "coap@LIBCOAP_API_VERSION@/libcoap.h" - -#include "coap@LIBCOAP_API_VERSION@/coap_forward_decls.h" -#include "coap@LIBCOAP_API_VERSION@/coap_address.h" -#include "coap@LIBCOAP_API_VERSION@/coap_async.h" -#include "coap@LIBCOAP_API_VERSION@/coap_block.h" -#include "coap@LIBCOAP_API_VERSION@/coap_cache.h" -#include "coap@LIBCOAP_API_VERSION@/coap_debug.h" -#include "coap@LIBCOAP_API_VERSION@/coap_dtls.h" -#include "coap@LIBCOAP_API_VERSION@/coap_encode.h" -#include "coap@LIBCOAP_API_VERSION@/coap_event.h" -#include "coap@LIBCOAP_API_VERSION@/coap_io.h" -#include "coap@LIBCOAP_API_VERSION@/coap_mem.h" -#include "coap@LIBCOAP_API_VERSION@/coap_net.h" -#include "coap@LIBCOAP_API_VERSION@/coap_option.h" -#include "coap@LIBCOAP_API_VERSION@/coap_oscore.h" -#include "coap@LIBCOAP_API_VERSION@/coap_pdu.h" -#include "coap@LIBCOAP_API_VERSION@/coap_prng.h" -#include "coap@LIBCOAP_API_VERSION@/coap_resource.h" -#include "coap@LIBCOAP_API_VERSION@/coap_str.h" -#include "coap@LIBCOAP_API_VERSION@/coap_subscribe.h" -#include "coap@LIBCOAP_API_VERSION@/coap_time.h" -#include "coap@LIBCOAP_API_VERSION@/coap_uri.h" -#include "coap@LIBCOAP_API_VERSION@/coap_ws.h" - -#ifdef __cplusplus -} -#endif - -#endif /* COAP_H_ */ diff --git a/scripts/check-missing-updates.sh b/scripts/check-missing-updates.sh index 8dd8b2eb..24a28ccc 100755 --- a/scripts/check-missing-updates.sh +++ b/scripts/check-missing-updates.sh @@ -6,15 +6,20 @@ make update-map-file > /dev/null +# +# Check for any version revision changes +# +. scripts/fix_version.sh + git diff > diff_check WC=`cat diff_check | wc -l` if [ $WC != 0 ] ; then echo - echo "Please update the master file (usually .in) for the following files" - echo "that had the changes reverted by the running of './configure'." - echo "There is no need to update the original files, just commit the" - echo "changed .in files." + echo "Please correct any header files for the appropriate revision" + echo "changes. It is possible to do this by running" + echo " . scripts/fix_version.sh" + echo "and then commit the changes to the header files." echo echo "Or run 'make update-map-file' and commit the changes to" echo "libcoap-3.map and libcoap-3.sym." diff --git a/scripts/fix_version.sh.in b/scripts/fix_version.sh.in new file mode 100755 index 00000000..62a81807 --- /dev/null +++ b/scripts/fix_version.sh.in @@ -0,0 +1,24 @@ +#/bin/sh + +FILES="coap_config.h.contiki \ + coap_config.h.riot \ + coap_config.h.windows \ + include/coap@LIBCOAP_API_VERSION@/coap.h.riot \ + include/coap@LIBCOAP_API_VERSION@/coap.h.windows \ + examples/lwip/config/coap_config.h" + +for file in $FILES ; do + sed -i $file -e 's/#define PACKAGE_NAME ".*"/#define PACKAGE_NAME "@PACKAGE_NAME@"/g' + sed -i $file -e 's/#define PACKAGE_STRING ".*"/#define PACKAGE_STRING "@PACKAGE_STRING@"/g' + sed -i $file -e 's/#define PACKAGE_VERSION ".*"/#define PACKAGE_VERSION "@PACKAGE_VERSION@"/g' + sed -i $file -e 's/#define PACKAGE_TARNAME ".*"/#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"/g' + sed -i $file -e 's/#define LIBCOAP_VERSION (.*)/#define LIBCOAP_VERSION (@LIBCOAP_VERSION@U)/g' + sed -i $file -e 's/#define LIBCOAP_PACKAGE_STRING ".*"/#define LIBCOAP_PACKAGE_STRING "@PACKAGE_STRING@"/g' + sed -i $file -e 's/#define LIBCOAP_PACKAGE_VERSION ".*"/#define LIBCOAP_PACKAGE_VERSION "@PACKAGE_VERSION@"/g' +done + +for file in CMakeLists.txt ; do + sed -i $file -e 's/^ VERSION .*$/ VERSION @LIBCOAP_PACKAGE_BASE@/g' + sed -i $file -e 's/set(LIBCOAP_API_VERSION .*)$/set(LIBCOAP_API_VERSION @LIBCOAP_API_VERSION@)/g' + sed -i $file -e 's/set(LIBCOAP_ABI_VERSION .*)$/set(LIBCOAP_ABI_VERSION @LIBCOAP_ABI_VERSION@)/g' +done