mirror of https://github.com/getdnsapi/getdns.git
Initial version of CMake build.
This is just a basic build of the library. No options are support, and the only builds tested are Xenial and MacOS (the latter using the Brew openssl package, and so requiring -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2l option on the cmake command line). Using the library is untested.
This commit is contained in:
parent
2ff1bf6152
commit
1ecc7b3c26
|
@ -0,0 +1,245 @@
|
|||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE_ON)
|
||||
|
||||
# The following must be set BEFORE doing project() or enable_language().
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "No build type defined; defaulting to 'Debug'")
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
||||
"The type of build. Possible values are: Debug, Release, RelWithDebInfo and MinSizeRel.")
|
||||
endif()
|
||||
|
||||
set(PACKAGE "getdns")
|
||||
set(PACKAGE_NAME "getdns")
|
||||
set(PACKAGE_VERSION "1.3.0")
|
||||
set(PACKAGE_BUGREPORT "team@getdnsapi.net")
|
||||
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_TARNAME "${PACKAGE}-${PACKAGE_VERSION}")
|
||||
|
||||
# Dont forget to put a dash in front of the release candidate!!!
|
||||
# That is how it is done with semantic versioning!
|
||||
set(RELEASE_CANDIDATE "")
|
||||
|
||||
set(GETDNS_VERSION "${PACKAGE_VERSION}${RELEASE_CANDIDATE}")
|
||||
set(GETDNS_NUMERIC_VERSION 0x01030000)
|
||||
set(API_VERSION "December 2015")
|
||||
set(API_NUMERIC_VERSION 0x07df0c00)
|
||||
set(GETDNS_COMPILATION_COMMENT "${PACKAGE_NAME} ${GETDNS_VERSION} configured on <date> for the ${API_VERSION} of the API")
|
||||
|
||||
set(GETDNS_LIBVERSION "9:0:3")
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(CheckLibraryExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckTypeSize)
|
||||
|
||||
project(getdns VERSION ${PACKAGE_VERSION})
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
# Directories
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if (DEFINED CMAKE_INSTALL_FULL_RUNSTATEDIR)
|
||||
set(RUNSTATEDIR "${CMAKE_INSTALL_FULL_RUNSTATEDIR}")
|
||||
else ()
|
||||
set(RUNSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run")
|
||||
endif ()
|
||||
install(
|
||||
DIRECTORY
|
||||
DESTINATION ${RUNSTATEDIR}
|
||||
DIRECTORY_PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
|
||||
# Always have build dir as an include directory.
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# File locations
|
||||
set(TRUST_ANCHOR_FILE "${CMAKE_INSTALL_FULL_SYSCONF_DIR}/unbound/getdns-root.key")
|
||||
|
||||
# Options.
|
||||
set(DNSSEC_ROADBLOCK_AVOIDANCE 1) # Nail on, as build fails if off.
|
||||
set(MAXIMUM_UPSTREAM_OPTION_SPACE 3000)
|
||||
set(EDNS_PADDING_OPCODE 12)
|
||||
set(MAX_CNAME_REFERRALS 100)
|
||||
set(DRAFT_RRTYPES 1)
|
||||
set(EDNS_COOKIE_OPCODE 10)
|
||||
set(EDNS_COOKIE_ROLLOVER_TIME "(24*60*60)")
|
||||
|
||||
# Platform
|
||||
if (WIN32 OR MINGW OR MSYS OR CYGWIN)
|
||||
set(HOSTOS "windows")
|
||||
elseif (APPLE)
|
||||
set(HOSTOS "macos")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DARWIN_C_SOURCE")
|
||||
elseif (UNIX)
|
||||
set(HOSTOS "unix")
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(LINUX 1)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -D_DEFAULT_SOURCE")
|
||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Solaris")
|
||||
set(SOLARIS 1)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__EXTENSIONS_")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Does the compiler accept the "format" attribute?
|
||||
try_compile(HAVE_ATTR_FORMAT
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/cmake/tests/test_format_attr.c
|
||||
)
|
||||
# Does the compiler accept the "unused" attribute?
|
||||
try_compile(HAVE_ATTR_UNUSED
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/cmake/tests/test_unused_attr.c
|
||||
)
|
||||
|
||||
# Compiler flags
|
||||
|
||||
# Check for include files
|
||||
check_include_file(assert.h HAVE_ASSERT_H)
|
||||
check_include_file(inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_file(limits.h HAVE_LIMITS_H)
|
||||
check_include_file(sys/limits.h HAVE_SYS_LIMITS_H)
|
||||
check_include_file(stdarg.h HAVE_STDARG_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(stdio.h HAVE_STDIO_H)
|
||||
check_include_file(stdlib.h HAVE_STDLIB_H)
|
||||
check_include_file(string.h HAVE_STRING_H)
|
||||
check_include_file(time.h HAVE_TIME_H)
|
||||
|
||||
check_include_file(signal.h HAVE_SIGNAL_H)
|
||||
check_include_file(sys/poll.h HAVE_SYS_POLL_H)
|
||||
check_include_file(poll.h HAVE_POLL_H)
|
||||
check_include_file(resource.h HAVE_RESOURCE_H)
|
||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
|
||||
|
||||
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
|
||||
check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
|
||||
check_include_file(netdb.h HAVE_NETDB_H)
|
||||
check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
|
||||
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
||||
check_include_file(sys/select.h HAVE_SYS_SELECT_H)
|
||||
check_include_file(endian.h HAVE_ENDIAN_H)
|
||||
check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
|
||||
|
||||
check_include_file(windows.h HAVE_WINDOWS_H)
|
||||
check_include_file(winsock.h HAVE_WINSOCK_H)
|
||||
check_include_file(winsock2.h HAVE_WINSOCK2_H)
|
||||
check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)
|
||||
|
||||
# Check for include declarations
|
||||
check_symbol_exists(inet_pton arpa/inet.h HAVE_DECL_INET_PTON)
|
||||
check_symbol_exists(inet_ntop arpa/inet.h HAVE_DECL_INET_NTOP)
|
||||
check_symbol_exists(strlcpy string.h HAVE_DECL_STRLCPY)
|
||||
check_symbol_exists(sigemptyset signal.h HAVE_DECL_SIGEMPTYSET)
|
||||
check_symbol_exists(sigfillset signal.h HAVE_DECL_SIGFILLSET)
|
||||
check_symbol_exists(sigaddset signal.h HAVE_DECL_SIGADDSET)
|
||||
|
||||
# Check for functions
|
||||
check_function_exists(inet_pton HAVE_INET_PTON)
|
||||
check_function_exists(inet_ntop HAVE_INET_NTOP)
|
||||
check_function_exists(strlcpy HAVE_STRLCPY)
|
||||
check_function_exists(sigemptyset HAVE_SIGEMPTYSET)
|
||||
check_function_exists(sigfillset HAVE_SIGFILLSET)
|
||||
check_function_exists(sigaddset HAVE_SIGADDSET)
|
||||
|
||||
# Check for types
|
||||
check_type_size(sigset_t SIGSET_T)
|
||||
check_type_size(_sigset_t _SIGSET_T)
|
||||
|
||||
# SSL library
|
||||
find_package(OpenSSL "0.9.7" REQUIRED)
|
||||
|
||||
set(HAVE_SSL 1)
|
||||
|
||||
check_include_file(openssl/ssl.h HAVE_OPENSSL_SSL_H)
|
||||
check_include_file(openssl/evp.h HAVE_OPENSSL_EVP_H)
|
||||
check_include_file(openssl/err.h HAVE_OPENSSL_ERR_H)
|
||||
check_include_file(openssl/rand.h HAVE_OPENSSL_RAND_H)
|
||||
check_include_file(openssl/conf.h HAVE_OPENSSL_CONF_H)
|
||||
check_include_file(openssl/engine.h HAVE_OPENSSL_ENGINE_H)
|
||||
|
||||
# Threading library
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
set(HAVE_PTHREAD 1)
|
||||
elseif (CMAKE_USE_WIN32_THREADS_INIT)
|
||||
set(HAVE_WINDOWS_THREADS 1)
|
||||
else()
|
||||
message(WARNING "Neither pthreads nor Windows threading available.")
|
||||
endif()
|
||||
|
||||
# Main library
|
||||
|
||||
add_library(getdns
|
||||
src/const-info.c
|
||||
src/convert.c
|
||||
src/dict.c
|
||||
src/dnssec.c
|
||||
src/general.c
|
||||
src/list.c
|
||||
src/request-internal.c
|
||||
src/mdns.c
|
||||
src/platform.c
|
||||
src/pubkey-pinning.c
|
||||
src/rr-dict.c
|
||||
src/rr-iter.c
|
||||
src/server.c
|
||||
src/stub.c
|
||||
src/sync.c
|
||||
src/ub_loop.c
|
||||
src/util-internal.c
|
||||
|
||||
src/gldns/keyraw.c
|
||||
src/gldns/gbuffer.c
|
||||
src/gldns/wire2str.c
|
||||
src/gldns/parse.c
|
||||
src/gldns/parseutil.c
|
||||
src/gldns/rrdef.c
|
||||
src/gldns/str2wire.c
|
||||
|
||||
src/util/rbtree.c
|
||||
src/util/val_secalgo.c
|
||||
src/util/lruhash.c
|
||||
src/util/lookup3.c
|
||||
src/util/locks.c
|
||||
|
||||
src/jsmn/jsmn.c
|
||||
|
||||
src/yxml/yxml.c
|
||||
)
|
||||
|
||||
target_include_directories(getdns
|
||||
PRIVATE src
|
||||
PRIVATE src/util/auxiliary
|
||||
PRIVATE src/yxml
|
||||
PRIVATE stubby/src # Wrong, wrong, wrong.
|
||||
|
||||
PRIVATE ${OPENSSL_INCLUDE_DIR}
|
||||
PRIVATE Threads::Threads
|
||||
)
|
||||
|
||||
target_link_libraries(getdns
|
||||
PRIVATE ${OPENSSL_LIBRARIES}
|
||||
PUBLIC Threads::Threads
|
||||
)
|
||||
|
||||
set_property(TARGET getdns PROPERTY C_STANDARD 11)
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/include/cmakeconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/src/getdns/getdns.h.in ${CMAKE_CURRENT_BINARY_DIR}/getdns/getdns.h)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/src/getdns/getdns_extra.h.in ${CMAKE_CURRENT_BINARY_DIR}/getdns/getdns_extra.h)
|
|
@ -0,0 +1,375 @@
|
|||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#cmakedefine PACKAGE "@PACKAGE@"
|
||||
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
|
||||
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||
#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
|
||||
|
||||
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
||||
#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@"
|
||||
|
||||
#cmakedefine HAVE_ASSERT_H 1
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
#cmakedefine HAVE_LIMITS_H 1
|
||||
#cmakedefine HAVE_SYS_LIMITS_H 1
|
||||
#cmakedefine HAVE_STDARG_H 1
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
#cmakedefine HAVE_STDIO_H 1
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
#cmakedefine HAVE_STRING_H 1
|
||||
#cmakedefine HAVE_TIME_H 1
|
||||
|
||||
#cmakedefine HAVE_SIGNAL_H 1
|
||||
#cmakedefine HAVE_SYS_POLL_H 1
|
||||
#cmakedefine HAVE_POLL_H 1
|
||||
#cmakedefine HAVE_RESOURCE_H 1
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
|
||||
#cmakedefine HAVE_NETINET_IN_H 1
|
||||
#cmakedefine HAVE_ARPA_INET_H 1
|
||||
#cmakedefine HAVE_NETDB_H 1
|
||||
#cmakedefine HAVE_SYS_SOCKET_H 1
|
||||
#cmakedefine HAVE_SYS_TIME_H 1
|
||||
#cmakedefine HAVE_SYS_SELECT_H 1
|
||||
#cmakedefine HAVE_ENDIAN_H 1
|
||||
#cmakedefine HAVE_SYS_WAIT_H 1
|
||||
|
||||
#cmakedefine HAVE_WINDOWS_H 1
|
||||
#cmakedefine HAVE_WINSOCK_H 1
|
||||
#cmakedefine HAVE_WINSOCK2_H 1
|
||||
#cmakedefine HAVE_WS2TCPIP_H 1
|
||||
|
||||
#cmakedefine HAVE_SSL 1
|
||||
|
||||
#cmakedefine HAVE_OPENSSL_SSL_H 1
|
||||
#cmakedefine HAVE_OPENSSL_EVP_H 1
|
||||
#cmakedefine HAVE_OPENSSL_ERR_H 1
|
||||
#cmakedefine HAVE_OPENSSL_RAND_H 1
|
||||
#cmakedefine HAVE_OPENSSL_CONF_H 1
|
||||
#cmakedefine HAVE_OPENSSL_ENGINE_H 1
|
||||
|
||||
#cmakedefine HAVE_PTHREAD 1
|
||||
#cmakedefine HAVE_WINDOWS_THREADS 1
|
||||
|
||||
#cmakedefine RUNSTATEDIR "@RUNSTATEDIR@"
|
||||
#cmakedefine TRUST_ANCHOR_FILE "@TRUST_ANCHOR_FILE@"
|
||||
|
||||
#cmakedefine DNSSEC_ROADBLOCK_AVOIDANCE 1
|
||||
#cmakedefine MAXIMUM_UPSTREAM_OPTION_SPACE @MAXIMUM_UPSTREAM_OPTION_SPACE@
|
||||
#cmakedefine EDNS_PADDING_OPCODE @EDNS_PADDING_OPCODE@
|
||||
#cmakedefine MAX_CNAME_REFERRALS @MAX_CNAME_REFERRALS@
|
||||
#cmakedefine DRAFT_RRTYPES @DRAFT_RRTYPES@
|
||||
#cmakedefine EDNS_COOKIE_OPCODE @EDNS_COOKIE_OPCODE@
|
||||
#cmakedefine EDNS_COOKIE_ROLLOVER_TIME @EDNS_COOKIE_ROLLOVER_TIME@
|
||||
|
||||
#cmakedefine HAVE_DECL_INET_PTON 1
|
||||
#cmakedefine HAVE_DECL_INET_NTOP 1
|
||||
#cmakedefine HAVE_DECL_STRLCPY 1
|
||||
#cmakedefine HAVE_DECL_SIGEMPTYSET 1
|
||||
#cmakedefine HAVE_DECL_SIGFILLSET 1
|
||||
#cmakedefine HAVE_DECL_SIGADDSET 1
|
||||
|
||||
#cmakedefine HAVE_INET_PTON 1
|
||||
#cmakedefine HAVE_INET_NTOP 1
|
||||
#cmakedefine HAVE_STRLCPY 1
|
||||
#cmakedefine HAVE_SIGEMPTYSET 1
|
||||
#cmakedefine HAVE_SIGFILLSET 1
|
||||
#cmakedefine HAVE_SIGADDSET 1
|
||||
|
||||
#cmakedefine HAVE_SIGSET_T 1
|
||||
#cmakedefine HAVE__SIGSET_T 1
|
||||
|
||||
#ifdef HAVE___FUNC__
|
||||
#define __FUNC__ __func__
|
||||
#else
|
||||
#define __FUNC__ __FUNCTION__
|
||||
#endif
|
||||
|
||||
#ifdef GETDNS_ON_WINDOWS
|
||||
/* On windows it is allowed to increase the FD_SETSIZE
|
||||
* (and nescessary to make our custom eventloop work)
|
||||
* See: https://support.microsoft.com/en-us/kb/111855
|
||||
*/
|
||||
# ifndef FD_SETSIZE
|
||||
# define FD_SETSIZE 1024
|
||||
# endif
|
||||
|
||||
/* the version of the windows API enabled */
|
||||
# ifndef WINVER
|
||||
# define WINVER 0x0600 // 0x0502
|
||||
# endif
|
||||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0600 // 0x0502
|
||||
# endif
|
||||
# ifdef HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
# endif
|
||||
|
||||
# ifdef _MSC_VER
|
||||
# if _MSC_VER >= 1800
|
||||
# define PRIsz "zu"
|
||||
# else
|
||||
# define PRIsz "Iu"
|
||||
# endif
|
||||
# else
|
||||
# define PRIsz "Iu"
|
||||
# endif
|
||||
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# endif
|
||||
|
||||
/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# define FD_SET_T (u_int)
|
||||
# else
|
||||
# define FD_SET_T
|
||||
# endif
|
||||
|
||||
/* Windows wants us to use _strdup instead of strdup */
|
||||
# ifndef strdup
|
||||
# define strdup _strdup
|
||||
# endif
|
||||
#else
|
||||
# define PRIsz "zu"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY || !defined(strlcpy)
|
||||
size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||
#else
|
||||
#ifndef __BSD_VISIBLE
|
||||
#define __BSD_VISIBLE 1
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(HAVE_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM
|
||||
uint32_t arc4random(void);
|
||||
#endif
|
||||
#if !defined(HAVE_ARC4RANDOM_UNIFORM) || !HAVE_DECL_ARC4RANDOM_UNIFORM
|
||||
uint32_t arc4random_uniform(uint32_t upper_bound);
|
||||
#endif
|
||||
#ifndef HAVE_ARC4RANDOM
|
||||
void explicit_bzero(void* buf, size_t len);
|
||||
int getentropy(void* buf, size_t len);
|
||||
void arc4random_buf(void* buf, size_t n);
|
||||
void _ARC4_LOCK(void);
|
||||
void _ARC4_UNLOCK(void);
|
||||
#endif
|
||||
#ifdef COMPAT_SHA512
|
||||
#ifndef SHA512_DIGEST_LENGTH
|
||||
#define SHA512_BLOCK_LENGTH 128
|
||||
#define SHA512_DIGEST_LENGTH 64
|
||||
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
|
||||
typedef struct _SHA512_CTX {
|
||||
uint64_t state[8];
|
||||
uint64_t bitcount[2];
|
||||
uint8_t buffer[SHA512_BLOCK_LENGTH];
|
||||
} SHA512_CTX;
|
||||
#endif /* SHA512_DIGEST_LENGTH */
|
||||
void SHA512_Init(SHA512_CTX*);
|
||||
void SHA512_Update(SHA512_CTX*, void*, size_t);
|
||||
void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
|
||||
unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest);
|
||||
#endif /* COMPAT_SHA512 */
|
||||
|
||||
#ifndef HAVE_DECL_INET_PTON
|
||||
int inet_pton(int af, const char* src, void* dst);
|
||||
#endif /* HAVE_INET_PTON */
|
||||
|
||||
#ifndef HAVE_DECL_INET_NTOP
|
||||
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
# ifndef _CUSTOM_VSNPRINTF
|
||||
# define _CUSTOM_VSNPRINTF
|
||||
static inline int _gldns_custom_vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
{ int r = vsnprintf(str, size, format, ap); return r == -1 ? _vscprintf(format, ap) : r; }
|
||||
# define vsnprintf _gldns_custom_vsnprintf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Use on-board gldns */
|
||||
#define USE_GLDNS 1
|
||||
#ifdef HAVE_SSL
|
||||
# define GLDNS_BUILD_CONFIG_HAVE_SSL 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_LIMITS_H
|
||||
#include <sys/limits.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_SSL_H
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_EVP_H
|
||||
#include <openssl/evp.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_RAND_H
|
||||
#include <openssl/rand.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_CONF_H
|
||||
#include <openssl/conf.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ENGINE_H
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
|
||||
#ifdef PATH_MAX
|
||||
#define _GETDNS_PATH_MAX PATH_MAX
|
||||
#else
|
||||
#define _GETDNS_PATH_MAX 2048
|
||||
#endif
|
||||
|
||||
#ifndef PRIu64
|
||||
#define PRIu64 "llu"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATTR_FORMAT
|
||||
# define ATTR_FORMAT(archetype, string_index, first_to_check) \
|
||||
__attribute__ ((format (archetype, string_index, first_to_check)))
|
||||
#else /* !HAVE_ATTR_FORMAT */
|
||||
# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
|
||||
#endif /* !HAVE_ATTR_FORMAT */
|
||||
|
||||
#if defined(DOXYGEN)
|
||||
# define ATTR_UNUSED(x) x
|
||||
#elif defined(__cplusplus)
|
||||
# define ATTR_UNUSED(x)
|
||||
#elif defined(HAVE_ATTR_UNUSED)
|
||||
# define ATTR_UNUSED(x) x __attribute__((unused))
|
||||
#else /* !HAVE_ATTR_UNUSED */
|
||||
# define ATTR_UNUSED(x) x
|
||||
#endif /* !HAVE_ATTR_UNUSED */
|
||||
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
|
||||
#define strptime unbound_strptime
|
||||
struct tm;
|
||||
char *strptime(const char *s, const char *format, struct tm *tm);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SIGSET_T) && defined(HAVE__SIGSET_T)
|
||||
typedef _sigset_t sigset_t;
|
||||
#endif
|
||||
#if !defined(HAVE_SIGEMPTYSET)
|
||||
# define sigemptyset(pset) (*(pset) = 0)
|
||||
#endif
|
||||
#if !defined(HAVE_SIGFILLSET)
|
||||
# define sigfillset(pset) (*(pset) = (sigset_t)-1)
|
||||
#endif
|
||||
#if !defined(HAVE_SIGADDSET)
|
||||
# define sigaddset(pset, num) (*(pset) |= (1L<<(num)))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBUNBOUND
|
||||
# include <unbound.h>
|
||||
# ifdef HAVE_UNBOUND_EVENT_H
|
||||
# include <unbound-event.h>
|
||||
# else
|
||||
# ifdef HAVE_UNBOUND_EVENT_API
|
||||
# ifndef _UB_EVENT_PRIMITIVES
|
||||
# define _UB_EVENT_PRIMITIVES
|
||||
struct ub_event_base;
|
||||
struct ub_ctx* ub_ctx_create_ub_event(struct ub_event_base* base);
|
||||
typedef void (*ub_event_callback_t)(void*, int, void*, int, int, char*);
|
||||
int ub_resolve_event(struct ub_ctx* ctx, const char* name, int rrtype,
|
||||
int rrclass, void* mydata, ub_event_callback_t callback, int* async_id);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_H */
|
|
@ -0,0 +1,13 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void f(char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
void f(char *format, ...)
|
||||
{
|
||||
}
|
||||
|
||||
int main (int ac, char *av[])
|
||||
{
|
||||
f("%s", "str");
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void f (char *u __attribute__((unused)));
|
||||
|
||||
void f(char *u)
|
||||
{
|
||||
}
|
||||
|
||||
int main (int ac, char *av[])
|
||||
{
|
||||
f("str");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue