diff options
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | config.h.in | 1 | ||||
-rw-r--r-- | src/resolve.c | 5 |
3 files changed, 16 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c9c76d5..0fa9d72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,17 +26,27 @@ else() endif() +include(CheckCSourceCompiles) include(CheckPrototypeDefinition) include(CheckTypeSize) set(CMAKE_EXTRA_INCLUDE_FILES "netinet/if_ether.h") set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") +check_c_source_compiles(" +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> + +int main() { + return AI_ADDRCONFIG; +} +" HAVE_AI_ADDRCONFIG) + check_prototype_definition("get_current_dir_name" "char *get_current_dir_name(void)" "NULL" "unistd.h" HAVE_GET_CURRENT_DIR_NAME) check_type_size("struct ethhdr" SIZEOF_ETHHDR) string(COMPARE NOTEQUAL "${SIZEOF_ETHHDR}" "" HAVE_ETHHDR) - set(USE_BINDTODEVICE ${LINUX}) set(USE_PMTU ${LINUX}) set(USE_PKTINFO ${LINUX}) diff --git a/config.h.in b/config.h.in index cd71d3d..5f41bde 100644 --- a/config.h.in +++ b/config.h.in @@ -27,6 +27,7 @@ #ifndef _FASTD_CONFIG_H_ #define _FASTD_CONFIG_H_ +#cmakedefine HAVE_AI_ADDRCONFIG #cmakedefine HAVE_ETHHDR #cmakedefine HAVE_GET_CURRENT_DIR_NAME diff --git a/src/resolve.c b/src/resolve.c index fea0cff..541006d 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -53,7 +53,10 @@ static void* resolve_peer(void *varg) { .ai_family = arg->constraints.sa.sa_family, .ai_socktype = SOCK_DGRAM, .ai_protocol = IPPROTO_UDP, - .ai_flags = AI_NUMERICSERV | AI_ADDRCONFIG, + .ai_flags = AI_NUMERICSERV +#ifdef HAVE_AI_ADDRCONFIG + | AI_ADDRCONFIG +#endif }; gai_ret = getaddrinfo(arg->hostname, portstr, &hints, &res); |