common.h.in revision 246854
1/** 2 * \file common.h 3 * 4 * Common definitions for LDNS 5 */ 6 7/** 8 * a Net::DNS like library for C 9 * 10 * (c) NLnet Labs, 2004-2006 11 * 12 * See the file LICENSE for the license 13 */ 14 15#ifndef LDNS_COMMON_H 16#define LDNS_COMMON_H 17 18/* 19 * The build configuration that is used in the distributed headers, 20 * as detected and determined by the auto configure script. 21 */ 22#define LDNS_BUILD_CONFIG_HAVE_SSL @ldns_build_config_have_ssl@ 23#define LDNS_BUILD_CONFIG_HAVE_INTTYPES_H @ldns_build_config_have_inttypes_h@ 24#define LDNS_BUILD_CONFIG_HAVE_ATTR_FORMAT @ldns_build_config_have_attr_format@ 25#define LDNS_BUILD_CONFIG_HAVE_ATTR_UNUSED @ldns_build_config_have_attr_unused@ 26#define LDNS_BUILD_CONFIG_HAVE_SOCKLEN_T @ldns_build_config_have_socklen_t@ 27 28/* 29 * HAVE_STDBOOL_H is not available when distributed as a library, but no build 30 * configuration variables may be used (like those above) because the header 31 * is sometimes only available when using special compiler flags to enable the 32 * c99 environment. Because we cannot force the usage of this flag, we have to 33 * provide a default type. Below what is suggested by the autoconf manual. 34 */ 35/*@ignore@*/ 36/* splint barfs on this construct */ 37#ifdef HAVE_STDBOOL_H 38# include <stdbool.h> 39#else 40# ifndef HAVE__BOOL 41# ifdef __cplusplus 42typedef bool _Bool; 43# else 44# define _Bool signed char 45# endif 46# endif 47# define bool _Bool 48# define false 0 49# define true 1 50# define __bool_true_false_are_defined 1 51#endif 52/*@end@*/ 53 54#if LDNS_BUILD_CONFIG_HAVE_ATTR_FORMAT 55#define ATTR_FORMAT(archetype, string_index, first_to_check) \ 56 __attribute__ ((format (archetype, string_index, first_to_check))) 57#else /* !LDNS_BUILD_CONFIG_HAVE_ATTR_FORMAT */ 58#define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ 59#endif /* !LDNS_BUILD_CONFIG_HAVE_ATTR_FORMAT */ 60 61#if defined(__cplusplus) 62#define ATTR_UNUSED(x) 63#elif LDNS_BUILD_CONFIG_HAVE_ATTR_UNUSED 64#define ATTR_UNUSED(x) x __attribute__((unused)) 65#else /* !LDNS_BUILD_CONFIG_HAVE_ATTR_UNUSED */ 66#define ATTR_UNUSED(x) x 67#endif /* !LDNS_BUILD_CONFIG_HAVE_ATTR_UNUSED */ 68 69#if !LDNS_BUILD_CONFIG_HAVE_SOCKLEN_T 70typedef int socklen_t; 71#endif 72 73#endif /* LDNS_COMMON_H */ 74