1dnl 2dnl Some global settings 3dnl 4 5sinclude(acx_nlnetlabs.m4) 6sinclude(dnstap/dnstap.m4) 7 8AC_INIT(NSD,4.1.27,nsd-bugs@nlnetlabs.nl) 9AC_CONFIG_HEADER([config.h]) 10 11CFLAGS="$CFLAGS" 12AC_AIX 13if test "$ac_cv_header_minix_config_h" = "yes"; then 14 AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix]) 15fi 16 17dnl 18dnl By default set $sysconfdir to /etc and $localstatedir to /var 19dnl 20case "$prefix" in 21 NONE) 22 case "$sysconfdir" in 23 '${prefix}/etc') 24 sysconfdir=/etc 25 ;; 26 esac 27 case "$localstatedir" in 28 '${prefix}/var') 29 localstatedir=/var 30 ;; 31 esac 32 ;; 33esac 34 35# 36# Determine configuration directory 37# 38configdir=$sysconfdir/nsd 39AC_ARG_WITH([configdir], 40 AC_HELP_STRING([--with-configdir=dir], [NSD configuration directory]), 41 [configdir=$withval]) 42AC_DEFINE_UNQUOTED(CONFIGDIR, ["`eval echo $configdir`"], [NSD config dir]) 43AC_SUBST(configdir) 44 45# 46# Determine configuration file 47nsd_conf_file=${configdir}/nsd.conf 48AC_ARG_WITH([nsd_conf_file], 49 AC_HELP_STRING([--with-nsd_conf_file=path], [Pathname to the NSD configuration file]), 50 [nsd_conf_file=$withval]) 51AC_SUBST(nsd_conf_file) 52# the eval is to evaluate shell expansion twice, once 53# for $nsd_conf_file and once for the ${prefix} within it. 54AC_DEFINE_UNQUOTED(CONFIGFILE, ["`eval echo $nsd_conf_file`"], [Pathname to the NSD configuration file]) 55 56# 57# Default logfile 58# 59logfile=${localstatedir}/log/nsd.log 60AC_ARG_WITH([logfile], 61 AC_HELP_STRING([--with-logfile=path], [Pathname to the default log file]), 62 [logfile=$withval]) 63AC_SUBST(logfile) 64 65# 66# Database directory 67# 68dbdir=${localstatedir}/db/nsd 69 70# 71# Determine the pidfile location. Check if /var/run exists, if so set pidfile 72# to /var/run/nsd.pid by default 73# 74if test -d ${localstatedir}/run; then 75 pidfile=${localstatedir}/run/nsd.pid 76else 77 pidfile=${dbdir}/nsd.pid 78fi 79AC_ARG_WITH([pidfile], 80 AC_HELP_STRING([--with-pidfile=path], [Pathname to the NSD pidfile]), 81 [pidfile=$withval]) 82AC_SUBST(pidfile) 83AC_DEFINE_UNQUOTED(PIDFILE, ["`eval echo $pidfile`"], [Pathname to the NSD pidfile]) 84 85# 86# Determine location of nsd.db 87# 88dbfile=${dbdir}/nsd.db 89AC_ARG_WITH([dbfile], 90 AC_HELP_STRING([--with-dbfile=path], [Pathname to the NSD database]), 91 [dbfile=$withval]) 92AC_SUBST(dbfile) 93AC_DEFINE_UNQUOTED(DBFILE, ["`eval echo $dbfile`"], [Pathname to the NSD database]) 94 95if test -n "$dbfile"; then 96 dbdir=`dirname $dbfile` 97fi 98AC_SUBST(dbdir) 99 100piddir=`dirname $pidfile` 101AC_SUBST(piddir) 102 103# 104# Determine the default directory for the zone files 105# 106zonesdir=$configdir 107AC_ARG_WITH([zonesdir], 108 AC_HELP_STRING([--with-zonesdir=dir], [NSD default location for zone files]), 109 [zonesdir=$withval]) 110AC_SUBST(zonesdir) 111AC_DEFINE_UNQUOTED(ZONESDIR, ["`eval echo $zonesdir`"], [NSD default location for zone files. Empty string or NULL to disable.]) 112 113# default xfrd file location. 114xfrdfile=${dbdir}/xfrd.state 115AC_ARG_WITH([xfrdfile], AC_HELP_STRING([--with-xfrdfile=path], 116 [Pathname to the NSD xfrd zone timer state file]), [xfrdfile=$withval]) 117AC_DEFINE_UNQUOTED(XFRDFILE, ["`eval echo $xfrdfile`"], [Pathname to the NSD xfrd zone timer state file.]) 118AC_SUBST(xfrdfile) 119 120# default zonelist file location. 121zonelistfile=${dbdir}/zone.list 122AC_ARG_WITH([zonelistfile], AC_HELP_STRING([--with-zonelistfile=path], 123 [Pathname to the NSD zone list file]), [zonelistfile=$withval]) 124AC_DEFINE_UNQUOTED(ZONELISTFILE, ["`eval echo $zonelistfile`"], [Pathname to the NSD zone list file.]) 125AC_SUBST(zonelistfile) 126 127# default xfr dir location. 128xfrdir="/tmp" 129AC_ARG_WITH([xfrdir], AC_HELP_STRING([--with-xfrdir=path], 130 [Pathname to where the NSD transfer dir is created]), [xfrdir=$withval]) 131AC_DEFINE_UNQUOTED(XFRDIR, ["`eval echo $xfrdir`"], [Pathname to where the NSD transfer dir is created.]) 132AC_SUBST(xfrdir) 133 134# nsd sbin location. tmpinstantiate execprefix with defaults if not yet done. 135if test "x${exec_prefix}" = "xNONE"; then 136 if test "x${prefix}" = "xNONE"; then exec_prefix="$ac_default_prefix" 137 else exec_prefix="${prefix}"; fi 138 nsd_start_path="`eval echo $sbindir`/nsd" 139 exec_prefix="NONE" 140else 141 nsd_start_path="`eval echo $sbindir`/nsd" 142fi 143AC_DEFINE_UNQUOTED(NSD_START_PATH, ["$nsd_start_path"], [Pathname to start nsd from nsd-control]) 144 145# 146# Determine default chroot directory 147# 148AC_ARG_WITH([chroot], 149 AC_HELP_STRING([--with-chroot=dir], [NSD default chroot directory]), 150 [ 151 chrootdir=$withval 152 AC_DEFINE_UNQUOTED(CHROOTDIR, ["`eval echo $chrootdir`"], [NSD default chroot directory]) 153 ]) 154AC_SUBST(chrootdir) 155 156# 157# Determine the user name to drop privileges to 158# 159user=nsd 160AC_ARG_WITH([user], 161 AC_HELP_STRING([--with-user=username], [User name or ID to answer the queries with]), 162 [user=$withval]) 163AC_SUBST(user) 164AC_DEFINE_UNQUOTED(USER, ["$user"], [the user name to drop privileges to]) 165 166# Checks for programs. 167AC_PROG_AWK 168AC_PROG_CC 169AC_PROG_LN_S 170AC_PROG_INSTALL 171AC_PROG_LEX 172AC_PROG_YACC 173 174if test "$LEX" != ":" -a "$LEX" != ""; then 175 # Check if lex defines yy_current_buffer, because 2.4.6 and older use it, 176 # but later could define it as a macro and then we should not redefine it. 177 AC_MSG_CHECKING(if lex defines yy_current_buffer) 178 cat <<EOF >conftest.lex 179%% 180EOF 181 $LEX -i -t conftest.lex >> conftest.c 182 if grep "^#define yy_current_buffer" conftest.c >/dev/null; then 183 AC_DEFINE_UNQUOTED(LEX_DEFINES_YY_CURRENT_BUFFER, 1, [If flex defines yy_current_buffer as a macro]) 184 AC_MSG_RESULT(yes) 185 else 186 AC_MSG_RESULT(no) 187 fi 188 rm -f conftest.lex conftest.c 189fi 190 191AC_DEFUN([AC_CHECK_FORMAT_ATTRIBUTE], 192[AC_REQUIRE([AC_PROG_CC]) 193AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute) 194AC_CACHE_VAL(ac_cv_c_format_attribute, 195[ac_cv_c_format_attribute=no 196AC_TRY_COMPILE( 197[#include <stdio.h> 198void f (char *format, ...) __attribute__ ((format (printf, 1, 2))); 199void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2))); 200], [ 201 f ("%s", "str"); 202], 203[ac_cv_c_format_attribute="yes"], 204[ac_cv_c_format_attribute="no"]) 205]) 206 207AC_MSG_RESULT($ac_cv_c_format_attribute) 208if test $ac_cv_c_format_attribute = yes; then 209 AC_DEFINE(HAVE_ATTR_FORMAT, 1, [Whether the C compiler accepts the "format" attribute]) 210fi 211])dnl 212 213AC_DEFUN([AC_CHECK_UNUSED_ATTRIBUTE], 214[AC_REQUIRE([AC_PROG_CC]) 215AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute) 216AC_CACHE_VAL(ac_cv_c_unused_attribute, 217[ac_cv_c_unused_attribute=no 218AC_TRY_COMPILE( 219[#include <stdio.h> 220void f (char *u __attribute__((unused))); 221], [ 222 f ("x"); 223], 224[ac_cv_c_unused_attribute="yes"], 225[ac_cv_c_unused_attribute="no"]) 226]) 227 228AC_MSG_RESULT($ac_cv_c_unused_attribute) 229if test $ac_cv_c_unused_attribute = yes; then 230 AC_DEFINE(HAVE_ATTR_UNUSED, 1, [Whether the C compiler accepts the "unused" attribute]) 231fi 232])dnl 233 234AC_DEFUN([CHECK_NORETURN_ATTRIBUTE], 235[AC_REQUIRE([AC_PROG_CC]) 236AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "noreturn" attribute) 237AC_CACHE_VAL(ac_cv_c_noreturn_attribute, 238[ac_cv_c_noreturn_attribute=no 239AC_TRY_COMPILE( 240[ #include <stdio.h> 241__attribute__((noreturn)) void f(int x) { printf("%d", x); } 242], [ 243 f(1); 244], 245[ac_cv_c_noreturn_attribute="yes"], 246[ac_cv_c_noreturn_attribute="no"]) 247]) 248 249AC_MSG_RESULT($ac_cv_c_noreturn_attribute) 250if test $ac_cv_c_noreturn_attribute = yes; then 251 AC_DEFINE(HAVE_ATTR_NORETURN, 1, [Whether the C compiler accepts the "noreturn" attribute]) 252 AC_DEFINE(ATTR_NORETURN, [__attribute__((__noreturn__))], [apply the noreturn attribute to a function that exits the program]) 253fi 254])dnl End of CHECK_NORETURN_ATTRIBUTE 255 256AC_DEFUN([CHECK_COMPILER_FLAG], 257[ 258AC_REQUIRE([AC_PROG_CC]) 259AC_MSG_CHECKING(whether $CC supports -$1) 260cache=`echo $1 | sed 'y%.=/+-%___p_%'` 261AC_CACHE_VAL(cv_prog_cc_flag_$cache, 262[ 263echo 'void f(){}' >conftest.c 264if test -z "`$CC -$1 -c conftest.c 2>&1`"; then 265eval "cv_prog_cc_flag_$cache=yes" 266else 267eval "cv_prog_cc_flag_$cache=no" 268fi 269rm -f conftest* 270]) 271if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then 272AC_MSG_RESULT(yes) 273: 274$2 275else 276AC_MSG_RESULT(no) 277: 278$3 279fi 280]) 281 282AC_DEFUN([AC_CHECK_CTIME_R], 283[AC_REQUIRE([AC_PROG_CC]) 284AC_MSG_CHECKING(whether ctime_r works with two arguments) 285AC_CACHE_VAL(ac_cv_c_ctime_c, 286[ac_cv_c_ctime_c=no 287AC_TRY_COMPILE( 288[#include <time.h> 289void testing (void) { time_t clock; char current_time[40]; ctime_r(&clock, current_time); }], 290[ 291 testing(); 292], 293[ac_cv_c_ctime_c="yes"], 294[ac_cv_c_ctime_c="no"]) 295]) 296 297AC_MSG_RESULT($ac_cv_c_ctime_c) 298if test $ac_cv_c_ctime_c = no; then 299 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" 300fi 301])dnl 302 303# Checks for typedefs, structures, and compiler characteristics. 304# allow user to override the -g -O2 flags. 305if test "x$CFLAGS" = "x" ; then 306 ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"]) 307 # we do not use O3 because it causes miscompilations. 308 ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) 309 ACX_CHECK_FLTO 310 ACX_CHECK_PIE 311 ACX_CHECK_RELRO_NOW 312fi 313AC_C_CONST 314AC_C_INLINE 315AC_TYPE_UID_T 316AC_TYPE_PID_T 317AC_TYPE_SIZE_T 318AC_TYPE_OFF_T 319 320AC_CHECK_FORMAT_ATTRIBUTE 321AC_CHECK_UNUSED_ATTRIBUTE 322CHECK_NORETURN_ATTRIBUTE 323ACX_CHECK_MEMCMP_SIGNED 324AC_CHECK_CTIME_R 325 326# Checks for libraries. 327 328# Check for SSL, original taken from 329# http://www.gnu.org/software/ac-archive/htmldoc/check_ssl.html and 330# modified for NSD. 331AC_DEFUN([CHECK_SSL], [ 332 AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], 333 [enable SSL (will check /usr/local/ssl 334 /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr)]),[ 335 ],[ 336 withval="yes" 337 ]) 338 if test x_$withval != x_no; then 339 AC_MSG_CHECKING(for SSL) 340 if test x_$withval = x_ -o x_$withval = x_yes; then 341 withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr" 342 fi 343 for dir in $withval; do 344 ssldir="$dir" 345 if test -f "$dir/include/openssl/ssl.h"; then 346 found_ssl="yes"; 347 AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.]) 348 if test x_$ssldir != x_/usr; then 349 CPPFLAGS="$CPPFLAGS -I$ssldir/include"; 350 fi 351 break; 352 fi 353 done 354 if test x_$found_ssl != x_yes; then 355 AC_MSG_ERROR(Cannot find the SSL libraries in $withval) 356 else 357 AC_MSG_RESULT(found in $ssldir) 358 HAVE_SSL=yes 359 if test x_$ssldir != x_/usr; then 360 LDFLAGS="$LDFLAGS -L$ssldir/lib"; 361 fi 362 if test x_$ssldir = x_/usr/sfw; then 363 LDFLAGS="$LDFLAGS -R$ssldir/lib"; 364 fi 365 fi 366 AC_SUBST(HAVE_SSL) 367 fi 368])dnl 369 370# check for libevent 371AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname], 372 [use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path), useful when the zone count is high.]), 373 [ ],[ withval="yes" ]) 374if test x_$withval = x_yes -o x_$withval != x_no; then 375 AC_MSG_CHECKING(for libevent) 376 if test x_$withval = x_ -o x_$withval = x_yes; then 377 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" 378 fi 379 for dir in $withval; do 380 thedir="$dir" 381 if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then 382 found_libevent="yes" 383 dnl assume /usr is in default path. 384 if test "$thedir" != "/usr"; then 385 CPPFLAGS="$CPPFLAGS -I$thedir/include" 386 fi 387 break; 388 fi 389 done 390 if test x_$found_libevent != x_yes; then 391 if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then 392 # libevent source directory 393 AC_MSG_RESULT(found in $thedir) 394 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include" 395 # remove evdns from linking 396 ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o` 397 cp $ev_files_o . 398 LDFLAGS="$ev_files_o $LDFLAGS -lm" 399 else 400 AC_MSG_ERROR([Cannot find the libevent library. 401You can restart ./configure --with-libevent=no to use a builtin alternative.]) 402 fi 403 else 404 AC_MSG_RESULT(found in $thedir) 405 dnl if event2 exists and no event lib in dir itself, use subdir 406 if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then 407 LDFLAGS="$LDFLAGS -L$thedir/lib/event2" 408 ACX_RUNTIME_PATH_ADD([$thedir/lib/event2]) 409 else 410 dnl assume /usr is in default path, do not add "". 411 if test "$thedir" != "/usr" -a "$thedir" != ""; then 412 LDFLAGS="$LDFLAGS -L$thedir/lib" 413 ACX_RUNTIME_PATH_ADD([$thedir/lib]) 414 fi 415 fi 416 fi 417 # check for library used by libevent after 1.3c 418 AC_SEARCH_LIBS([clock_gettime], [rt]) 419 420 # is the event.h header libev or libevent? 421 AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT]) 422 AC_CHECK_DECL(EV_VERSION_MAJOR, [ 423 AC_SEARCH_LIBS(event_set, [ev]) 424 ],[ 425 AC_SEARCH_LIBS(event_set, [event]) 426 ],[AC_INCLUDES_DEFAULT 427#include <event.h> 428 ]) 429 AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later 430 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later 431 AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later 432 AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later 433 AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51) 434 AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00) 435else 436 AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events]) 437fi 438 439# Checks for header files. 440AC_HEADER_STDC 441AC_HEADER_SYS_WAIT 442AC_CHECK_HEADERS([time.h arpa/inet.h signal.h string.h strings.h fcntl.h limits.h netinet/in.h netinet/tcp.h stddef.h sys/param.h sys/socket.h sys/un.h syslog.h unistd.h sys/select.h stdarg.h stdint.h netdb.h sys/bitypes.h tcpd.h glob.h grp.h endian.h]) 443 444AC_DEFUN([CHECK_VALIST_DEF], 445[ 446AC_REQUIRE([AC_PROG_CC]) 447AC_MSG_CHECKING(for double definition of struct va_list) 448AC_CACHE_VAL(ac_cv_c_va_list_def, 449[ 450cat >conftest.c <<EOF 451#include <stdio.h> 452#include <stdarg.h> 453int foo(void); 454EOF 455if test -z "`$CC -Werror -D_XOPEN_SOURCE=600 -c conftest.c 2>&1`"; then 456eval "ac_cv_c_va_list_def=no" 457else 458eval "ac_cv_c_va_list_def=yes" 459fi 460rm -f conftest* 461]) 462if test $ac_cv_c_va_list_def = yes; then 463AC_MSG_RESULT(yes) 464: 465AC_DEFINE_UNQUOTED([HAVE_VA_LIST_DOUBLE_DEF], [], [Define this if you have double va_list definitions.]) 466else 467AC_MSG_RESULT(no) 468: 469 470fi 471]) 472 473CHECK_VALIST_DEF 474 475AC_DEFUN([AC_CHECK_STRPTIME], 476[AC_REQUIRE([AC_PROG_CC]) 477AC_MSG_CHECKING(whether strptime needs defines) 478AC_CACHE_VAL(ac_cv_c_strptime_needs_defs, 479[ 480cat >conftest.c <<EOF 481#include <time.h> 482int testing (void) { struct tm t; const char *timestr="201201"; return strptime(timestr, "%Y%m", &t) != 0; } 483EOF 484if test -z "`$CC -Wall -Werror -c conftest.c 2>&1`"; then 485eval "ac_cv_c_strptime_needs_defs=no" 486else 487eval "ac_cv_c_strptime_needs_defs=yes" 488fi 489rm -f conftest* 490]) 491 492AC_MSG_RESULT($ac_cv_c_strptime_needs_defs) 493if test $ac_cv_c_strptime_needs_defs = yes; then 494AC_DEFINE_UNQUOTED([STRPTIME_NEEDS_DEFINES], 1, [strptime is available from time.h with some defines.]) 495fi 496])dnl 497 498AC_CHECK_STRPTIME 499 500# check wether strptime also works 501AC_DEFUN([AC_CHECK_STRPTIME_WORKS], 502[AC_REQUIRE([AC_PROG_CC]) 503AC_MSG_CHECKING(whether strptime works) 504if test c${cross_compiling} = cno; then 505AC_RUN_IFELSE([AC_LANG_SOURCE([[ 506#define _XOPEN_SOURCE 600 507#include <time.h> 508int main(void) { struct tm tm; char *res; 509res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); 510if (!res) return 1; return 0; } 511]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"]) 512else 513eval "ac_cv_c_strptime_works=maybe" 514fi 515AC_MSG_RESULT($ac_cv_c_strptime_works) 516if test $ac_cv_c_strptime_works = no; then 517AC_LIBOBJ(strptime) 518else 519AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.]) 520fi 521])dnl 522 523AC_SEARCH_LIBS(inet_pton, [nsl]) 524AC_SEARCH_LIBS(socket, [socket]) 525 526AC_CHECK_STRPTIME_WORKS 527ACX_CHECK_NONBLOCKING_BROKEN 528ACX_MKDIR_ONE_ARG 529 530# set -I. and -Isrcdir 531if test -n "$CPPFLAGS"; then 532 CPPFLAGS="$CPPFLAGS -I." 533else 534 CPPFLAGS="-I." 535fi 536if test "$srcdir" != "."; then 537 CPPFLAGS="$CPPFLAGS -I$srcdir" 538 if test -f $srcdir/config.h; then 539 AC_ERROR([$srcdir/config.h is in the way, please remove it]) 540 fi 541fi 542 543dnl LIBGTOP_CHECK_TYPE 544dnl Stolen from Gnome's anjuta 545dnl Improved version of AC_CHECK_TYPE which takes into account 546dnl that we need to #include some other header files on some 547dnl systems to get some types. 548 549dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT) 550AC_DEFUN([AC_LIBGTOP_CHECK_TYPE], 551[AC_REQUIRE([AC_HEADER_STDC])dnl 552AC_MSG_CHECKING(for $1) 553AC_CACHE_VAL(ac_cv_type_$1, 554[AC_EGREP_CPP(dnl 555changequote(<<,>>)dnl 556<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl 557changequote([,]), [ 558#include <sys/types.h> 559#if STDC_HEADERS 560#include <stdlib.h> 561#include <stddef.h> 562#endif 563 564#ifdef HAVE_STDINT_H 565#include <stdint.h> 566#endif 567 568#ifdef HAVE_SYS_SOCKET_H 569#include <sys/socket.h> 570#endif 571 572#ifdef HAVE_ARPA_INET_H 573#include <arpa/inet.h> 574#endif 575 576#ifdef HAVE_SIGNAL_H 577#include <signal.h> 578#endif 579 580/* For Tru64 */ 581#ifdef HAVE_SYS_BITYPES_H 582#include <sys/bitypes.h> 583#endif 584], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl 585AC_MSG_RESULT($ac_cv_type_$1) 586if test $ac_cv_type_$1 = no; then 587 AC_DEFINE($1, $2, Define "$1" to "$2" if "$1" is missing) 588fi 589]) 590 591AC_LIBGTOP_CHECK_TYPE(int8_t, char) 592AC_LIBGTOP_CHECK_TYPE(int16_t, short) 593AC_LIBGTOP_CHECK_TYPE(int32_t, int) 594AC_LIBGTOP_CHECK_TYPE(int64_t, long long) 595AC_LIBGTOP_CHECK_TYPE(uint8_t, unsigned char) 596AC_LIBGTOP_CHECK_TYPE(uint16_t, unsigned short) 597AC_LIBGTOP_CHECK_TYPE(uint32_t, unsigned int) 598AC_LIBGTOP_CHECK_TYPE(uint64_t, unsigned long long) 599AC_LIBGTOP_CHECK_TYPE(socklen_t, int) 600AC_LIBGTOP_CHECK_TYPE(sig_atomic_t, int) 601AC_LIBGTOP_CHECK_TYPE(ssize_t, int) 602AC_LIBGTOP_CHECK_TYPE(suseconds_t, time_t) 603 604AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ 605#if HAVE_SYS_TYPES_H 606# include <sys/types.h> 607#endif 608#if HAVE_NETINET_IN_H 609# include <netinet/in.h> 610#endif]) 611ACX_CHECK_SS_FAMILY 612AC_CHECK_MEMBERS([struct stat.st_mtimensec, struct stat.st_mtim.tv_nsec]) 613AC_CHECK_MEMBERS([struct sockaddr_un.sun_len],,,[ 614AC_INCLUDES_DEFAULT 615#ifdef HAVE_SYS_UN_H 616#include <sys/un.h> 617#endif 618]) 619 620# Checks for library functions. 621AC_FUNC_CHOWN 622AC_FUNC_FORK 623AC_FUNC_MALLOC 624AC_TYPE_SIGNAL 625AC_FUNC_FSEEKO 626AC_SYS_LARGEFILE 627AC_CHECK_SIZEOF(void*) 628AC_CHECK_SIZEOF(off_t) 629AC_CHECK_FUNCS([arc4random arc4random_uniform]) 630AC_SEARCH_LIBS([setusercontext],[util],[AC_CHECK_HEADERS([login_cap.h])]) 631AC_CHECK_FUNCS([tzset alarm chroot dup2 endpwent gethostname memset memcpy pwrite socket strcasecmp strchr strdup strerror strncasecmp strtol writev getaddrinfo getnameinfo freeaddrinfo gai_strerror sigaction sigprocmask strptime strftime localtime_r setusercontext glob initgroups setresuid setreuid setresgid setregid getpwnam mmap ppoll clock_gettime accept4]) 632 633AC_ARG_ENABLE(recvmmsg, AC_HELP_STRING([--enable-recvmmsg], [Enable recvmmsg and sendmmsg compilation, faster but some kernel versions may have implementation problems for IPv6])) 634case "$enable_recvmmsg" in 635 yes) 636 AC_CHECK_FUNC([recvmmsg], [ 637AC_RUN_IFELSE([AC_LANG_SOURCE([[ 638#include <sys/socket.h> 639#include <errno.h> 640int main(void) 641{ 642 int s = socket(AF_INET, SOCK_DGRAM, 0); 643 int r = recvmmsg(s, 0, 0, 0, 0) == -1 && errno == ENOSYS; 644 close(s); 645 return r; 646} 647]])], [ 648AC_DEFINE([HAVE_RECVMMSG], [1], [Define if recvmmsg is implemented])], [ 649], [ 650AC_DEFINE([HAVE_RECVMMSG], [1], [Define if recvmmsg exists])] 651)]) 652 AC_CHECK_FUNC([sendmmsg], [ 653AC_RUN_IFELSE([AC_LANG_SOURCE([[ 654#include <sys/socket.h> 655#include <errno.h> 656int main(void) 657{ 658 int s = socket(AF_INET, SOCK_DGRAM, 0); 659 int r = sendmmsg(s, 0, 0, 0) == -1 && errno == ENOSYS; 660 close(s); 661 return r; 662} 663]])], [ 664AC_DEFINE([HAVE_SENDMMSG], [1], [Define if sendmmsg is implemented])], [ 665], [ 666AC_DEFINE([HAVE_SENDMMSG], [1], [Define if sendmmsg exists])] 667)]) 668 669 ;; 670 no|*) 671 ;; 672esac 673 674# check if setreuid en setregid fail, on MacOSX10.4(darwin8). 675if echo $target_os | grep darwin8 > /dev/null; then 676 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work]) 677fi 678 679# 680# Checking for missing functions we can replace 681# 682AC_REPLACE_FUNCS(basename) 683AC_REPLACE_FUNCS(inet_aton) 684AC_REPLACE_FUNCS(inet_pton) 685AC_REPLACE_FUNCS(inet_ntop) 686AC_REPLACE_FUNCS(snprintf) 687AC_REPLACE_FUNCS(strlcat) 688AC_REPLACE_FUNCS(strlcpy) 689AC_REPLACE_FUNCS(strptime) 690AC_REPLACE_FUNCS(b64_pton) 691AC_REPLACE_FUNCS(b64_ntop) 692AC_REPLACE_FUNCS(pselect) 693AC_REPLACE_FUNCS(memmove) 694AC_REPLACE_FUNCS(reallocarray) 695 696AC_MSG_CHECKING(for pselect prototype in sys/select.h) 697AC_EGREP_HEADER([[^a-zA-Z_]*pselect[^a-zA-Z_]], sys/select.h, AC_DEFINE(HAVE_PSELECT_PROTO, 1, 698 [if sys/select.h provides pselect prototype]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) 699 700AC_MSG_CHECKING(for ctime_r prototype in time.h) 701AC_EGREP_HEADER([[^a-zA-Z_]*ctime_r[^a-zA-Z_]], time.h, AC_DEFINE(HAVE_CTIME_R_PROTO, 1, 702 [if time.h provides ctime_r prototype]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) 703 704AC_CHECK_TYPE([struct timespec], AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [If time.h has a struct timespec (for pselect).]), [], [ 705AC_INCLUDES_DEFAULT 706#ifdef HAVE_SIGNAL_H 707#include <signal.h> 708#endif 709#ifdef HAVE_TIME_H 710#include <time.h> 711#endif 712]) 713 714dnl 715dnl Some random defines's 716dnl 717AC_DEFINE_UNQUOTED([IDENTITY], ["unidentified server"], [Define to the default nsd identity.]) 718AC_DEFINE_UNQUOTED([VERSION], [PACKAGE_STRING], [Define to the NSD version to answer version.server query.]) 719AC_DEFINE_UNQUOTED([TCP_BACKLOG], [256], [Define to the backlog to be used with listen.]) 720AC_DEFINE_UNQUOTED([TCP_PORT], ["53"], [Define to the default tcp port.]) 721AC_DEFINE_UNQUOTED([TCP_MAX_MESSAGE_LEN], [65535], [Define to the default maximum message length.]) 722AC_DEFINE_UNQUOTED([UDP_PORT], ["53"], [Define to the default udp port.]) 723AC_DEFINE_UNQUOTED([UDP_MAX_MESSAGE_LEN], [512], [Define to the default maximum udp message length.]) 724AC_DEFINE_UNQUOTED([EDNS_MAX_MESSAGE_LEN], [4096], [Define to the default maximum message length with EDNS.]) 725AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [512], [Define to the maximum message length to pass to syslog.]) 726AC_DEFINE_UNQUOTED([NSD_CONTROL_PORT], [8952], [Define to the default nsd-control port.]) 727AC_DEFINE_UNQUOTED([NSD_CONTROL_VERSION], [1], [Define to nsd-control proto version.]) 728 729dnl 730dnl Determine the syslog facility to use 731dnl 732facility=LOG_DAEMON 733AC_ARG_WITH([facility], 734 AC_HELP_STRING([--with-facility=name], [Syslog default facility (LOG_DAEMON)]), 735 [facility=$withval]) 736AC_DEFINE_UNQUOTED([FACILITY], $facility, [Define to the default facility for syslog.]) 737 738dnl 739dnl Determine the default tcp timeout 740dnl 741tcp_timeout=120 742AC_ARG_WITH([tcp_timeout], 743 AC_HELP_STRING([--with-tcp-timeout=number], [Limit the default tcp timeout]), 744 [tcp_timeout=$withval]) 745AC_DEFINE_UNQUOTED([TCP_TIMEOUT], $tcp_timeout, [Define to the default tcp timeout.]) 746 747dnl 748dnl Features 749dnl 750AC_ARG_ENABLE(root-server, AC_HELP_STRING([--enable-root-server], [Configure NSD as a root server])) 751case "$enable_root_server" in 752 yes) 753 AC_DEFINE_UNQUOTED([ROOT_SERVER], [], [Define this to configure as a root server.]) 754 ;; 755 no|*) 756 ;; 757esac 758 759AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [Disables IPv6 support])) 760case "$enable_ipv6" in 761 no) 762 ;; 763 yes|*) 764 AC_DEFINE_UNQUOTED([INET6], [], [Define this to enable IPv6 support.]) 765 ;; 766esac 767 768AC_ARG_ENABLE(bind8-stats, AC_HELP_STRING([--enable-bind8-stats], [Enables BIND8 like NSTATS & XSTATS and statistics in nsd-control])) 769 770case "$enable_bind8_stats" in 771 yes|'') 772 AC_DEFINE_UNQUOTED([BIND8_STATS], [], [Define this to enable BIND8 like NSTATS & XSTATS.]) 773 ;; 774 no|*) 775 ;; 776esac 777 778AC_ARG_ENABLE(zone-stats, AC_HELP_STRING([--enable-zone-stats], [Enable per-zone statistics gathering (needs --enable-bind8-stats)])) 779case "$enable_zone_stats" in 780 yes) 781 AC_DEFINE_UNQUOTED([USE_ZONE_STATS], [], [Define this to enable per-zone statistics gathering.]) 782 AC_DEFINE_UNQUOTED([BIND8_STATS], [], [Define this to enable BIND8 like NSTATS & XSTATS.]) 783 ;; 784 no|''|*) 785 ;; 786esac 787 788AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable internal runtime checks])) 789case "$enable_checking" in 790 yes) 791 CHECK_COMPILER_FLAG(W, [ CFLAGS="$CFLAGS -W" ]) 792 CHECK_COMPILER_FLAG(Wall, [ CFLAGS="$CFLAGS -Wall" ]) 793 CHECK_COMPILER_FLAG(Wextra, [ CFLAGS="$CFLAGS -Wextra" ]) 794 CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [ CFLAGS="$CFLAGS -Wdeclaration-after-statement" ]) 795 ;; 796 no|*) 797 AC_DEFINE([NDEBUG], [], [Undefine this to enable internal runtime checks.]) 798 ;; 799esac 800 801AC_ARG_ENABLE(memclean, AC_HELP_STRING([--enable-memclean], [Cleanup memory (at exit) for eg. valgrind, memcheck])) 802if test "$enable_memclean" = "yes"; then AC_DEFINE_UNQUOTED([MEMCLEAN], [1], [Define this to cleanup memory at exit (eg. for valgrind, etc.)]) 803fi 804 805AC_ARG_ENABLE(ratelimit, AC_HELP_STRING([--enable-ratelimit], [Enable rate limiting])) 806case "$enable_ratelimit" in 807 yes) 808 AC_DEFINE_UNQUOTED([RATELIMIT], [], [Define this to enable rate limiting.]) 809 dnl causes awk to not match the exclusion start marker. 810 ratelimit="xx" 811 ;; 812 no|*) 813 ratelimit="" 814 ;; 815esac 816AC_SUBST(ratelimit) 817 818AC_ARG_ENABLE(ratelimit-default-is-off, AC_HELP_STRING([--enable-ratelimit-default-is-off], [Enable this to set default of ratelimit to off (enable in nsd.conf), otherwise ratelimit is enabled by default if --enable-ratelimit is enabled])) 819case "$enable_ratelimit_default_is_off" in 820 yes) 821 AC_DEFINE_UNQUOTED([RATELIMIT_DEFAULT_OFF], [], [Define this to set ratelimit to off by default.]) 822 ratelimit_default="off" 823 ;; 824 no|*) 825 ratelimit_default="on" 826 ;; 827esac 828AC_SUBST(ratelimit_default) 829 830# we need SSL for TSIG (and maybe also for NSEC3). 831CHECK_SSL 832if test x$HAVE_SSL = x"yes"; then 833 ACX_LIB_SSL 834 835 # Check for -pthread 836 BAKLIBS="$LIBS" 837 LIBS="-lcrypto $LIBS" 838 AC_TRY_LINK([], [ 839 int HMAC_Update(void); 840 (void)HMAC_Update(); 841 ], [],[ 842 dnl so link fails for HMAC_Update, try with -pthread. 843 BAKCFLAGS="$CFLAGS" 844 CFLAGS="$CFLAGS -pthread" 845 AC_MSG_CHECKING([if libcrypto needs -pthread]) 846 AC_TRY_LINK_FUNC([HMAC_Update], [ 847 AC_MSG_RESULT([yes]) 848 ] , [ 849 AC_MSG_RESULT([no]) 850 dnl restore the nonpthread value 851 CFLAGS="$BAKCFLAGS" 852 ]) 853 ]) 854 LIBS="$BAKLIBS" 855 856 if test -n "$ssldir"; then 857 AC_CHECK_LIB(crypto, HMAC_Update,, [ 858 AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) 859 ]) 860 fi 861 SSL_LIBS="-lssl" 862 AC_SUBST(SSL_LIBS) 863 AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) 864 AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) 865 AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) 866 AC_CHECK_FUNCS([HMAC_CTX_reset HMAC_CTX_new EVP_cleanup ERR_load_crypto_strings OPENSSL_init_crypto]) 867 868 BAKLIBS="$LIBS" 869 LIBS="-lssl $LIBS" 870 AC_CHECK_FUNCS([OPENSSL_init_ssl]) 871 LIBS="$BAKLIBS" 872 873else 874 AC_MSG_WARN([No SSL, therefore remote-control is disabled]) 875fi 876 877AC_ARG_ENABLE(nsec3, AC_HELP_STRING([--disable-nsec3], [Disable NSEC3 support])) 878case "$enable_nsec3" in 879 no) 880 ;; 881 yes) 882 AC_DEFINE_UNQUOTED([NSEC3], [], [Define this to enable NSEC3 support.]) 883 ;; 884 *) 885 if test x$HAVE_SSL = x"yes"; then 886 AC_DEFINE_UNQUOTED([NSEC3], [], [Define this to enable NSEC3 support.]) 887 else 888 AC_MSG_WARN([No SSL, therefore NSEC3 is disabled]) 889 fi 890 ;; 891esac 892 893AC_ARG_ENABLE(minimal-responses, AC_HELP_STRING([--disable-minimal-responses], [Disable response minimization. More truncation.])) 894case "$enable_minimal_responses" in 895 no) 896 ;; 897 yes|*) 898 AC_DEFINE_UNQUOTED([MINIMAL_RESPONSES], [], [Define this to enable response minimalization to reduce truncation.]) 899 ;; 900esac 901 902AC_ARG_ENABLE(mmap, AC_HELP_STRING([--enable-mmap], [Use mmap instead of malloc. Experimental.])) 903case "$enable_mmap" in 904 yes) 905 AC_CHECK_HEADERS([sys/mman.h]) 906 AC_LIBGTOP_CHECK_TYPE(uintptr_t, void*) 907 AC_CHECK_FUNCS([mmap munmap]) 908 AC_DEFINE_UNQUOTED([USE_MMAP_ALLOC], [], [Define this to enable mmap instead of malloc. Experimental.]) 909 ;; 910 no|*) 911 ;; 912esac 913 914AC_ARG_ENABLE(radix-tree, AC_HELP_STRING([--disable-radix-tree], [You can disable the radix tree and use the red-black tree for the main lookups, the red-black tree uses less memory, but uses some more CPU.])) 915case "$enable_radix_tree" in 916 no) 917 ;; 918 yes|*) 919 AC_DEFINE_UNQUOTED([USE_RADIX_TREE], [], [Define this to configure to use the radix tree.]) 920 ;; 921esac 922 923AC_ARG_ENABLE(packed, AC_HELP_STRING([--enable-packed], [Enable packed structure alignment, uses less memory, but unaligned reads.])) 924case "$enable_packed" in 925 yes) 926 AC_DEFINE_UNQUOTED([PACKED_STRUCTS], [], [Define this to use packed structure alignment.]) 927 ACX_CHECK_COMPILER_FLAG(Wno-address-of-packed-member, [CFLAGS="$CFLAGS -Wno-address-of-packed-member"]) 928 ;; 929 no|*) 930 ;; 931esac 932 933# check for dnstap if requested 934dt_DNSTAP([${localstatedir}/run/nsd-dnstap.sock], 935 [ 936 AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support]) 937 AC_SUBST([ENABLE_DNSTAP], [1]) 938 939 AC_SUBST([opt_dnstap_socket_path]) 940 ACX_ESCAPE_BACKSLASH($opt_dnstap_socket_path, hdr_dnstap_socket_path) 941 AC_DEFINE_UNQUOTED(DNSTAP_SOCKET_PATH, 942 ["$hdr_dnstap_socket_path"], [default dnstap socket path]) 943 944 AC_SUBST([DNSTAP_SRC], ["dnstap/dnstap.c dnstap/dnstap.pb-c.c dnstap/dnstap_collector.c"]) 945 AC_SUBST([DNSTAP_OBJ], ["dnstap.o dnstap_collector.o dnstap.pb-c.o"]) 946 dnstap_config="dnstap/dnstap_config.h" 947 ], 948 [ 949 AC_SUBST([ENABLE_DNSTAP], [0]) 950 ] 951) 952 953# Include systemd.m4 - begin 954sinclude(systemd.m4) 955# Include systemd.m4 - end 956 957AH_BOTTOM([ 958/* define before includes as it specifies what standard to use. */ 959#if (defined(HAVE_PSELECT) && !defined (HAVE_PSELECT_PROTO)) \ 960 || !defined (HAVE_CTIME_R_PROTO) \ 961 || defined (STRPTIME_NEEDS_DEFINES) 962# ifndef _XOPEN_SOURCE 963# define _XOPEN_SOURCE 600 964# endif 965# ifndef _POSIX_C_SOURCE 966# define _POSIX_C_SOURCE 200112 967# endif 968# ifndef _BSD_SOURCE 969# define _BSD_SOURCE 1 970# endif 971# ifndef _DEFAULT_SOURCE 972# define _DEFAULT_SOURCE 1 973# endif 974# ifndef __EXTENSIONS__ 975# define __EXTENSIONS__ 1 976# endif 977# ifndef _STDC_C99 978# define _STDC_C99 1 979# endif 980# ifndef _ALL_SOURCE 981# define _ALL_SOURCE 1 982# endif 983#endif 984]) 985 986AH_BOTTOM([ 987#ifdef HAVE_VA_LIST_DOUBLE_DEF 988/* workaround double va_list definition on some platforms */ 989# ifndef _VA_LIST_DEFINED 990# define _VA_LIST_DEFINED 991# endif 992#endif 993]) 994 995AH_BOTTOM([ 996#include <sys/types.h> 997#if STDC_HEADERS 998#include <stdlib.h> 999#include <stddef.h> 1000#endif 1001 1002#ifdef HAVE_TIME_H 1003#include <time.h> 1004#endif 1005 1006#ifdef HAVE_STDINT_H 1007#include <stdint.h> 1008#endif 1009 1010#ifdef HAVE_SYS_SOCKET_H 1011#include <sys/socket.h> 1012#endif 1013 1014#ifdef HAVE_NETINET_IN_H 1015#include <netinet/in.h> 1016#endif 1017 1018#ifdef HAVE_NETINET_TCP_H 1019#include <netinet/tcp.h> 1020#endif 1021 1022#ifdef HAVE_ARPA_INET_H 1023#include <arpa/inet.h> 1024#endif 1025 1026/* For Tru64 */ 1027#ifdef HAVE_SYS_BITYPES_H 1028#include <sys/bitypes.h> 1029#endif 1030]) 1031 1032AH_BOTTOM([ 1033#ifdef HAVE_ATTR_FORMAT 1034#define ATTR_FORMAT(archetype, string_index, first_to_check) \ 1035 __attribute__ ((format (archetype, string_index, first_to_check))) 1036#else /* !HAVE_ATTR_FORMAT */ 1037#define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ 1038#endif /* !HAVE_ATTR_FORMAT */ 1039#if defined(__cplusplus) 1040#define ATTR_UNUSED(x) 1041#elif defined(HAVE_ATTR_UNUSED) 1042#define ATTR_UNUSED(x) x __attribute__((unused)) 1043#else /* !HAVE_ATTR_UNUSED */ 1044#define ATTR_UNUSED(x) x 1045#endif /* !HAVE_ATTR_UNUSED */ 1046]) 1047 1048AH_BOTTOM([ 1049#ifndef IPV6_MIN_MTU 1050#define IPV6_MIN_MTU 1280 1051#endif /* IPV6_MIN_MTU */ 1052 1053#ifndef AF_INET6 1054#define AF_INET6 28 1055#endif /* AF_INET6 */ 1056]) 1057 1058if test $ac_cv_func_getaddrinfo = no; then 1059AC_LIBOBJ([fake-rfc2553]) 1060fi 1061 1062AH_BOTTOM([ 1063/* maximum nesting of included files */ 1064#define MAXINCLUDES 10 1065]) 1066 1067AH_BOTTOM([ 1068#ifndef HAVE_B64_NTOP 1069int b64_ntop(uint8_t const *src, size_t srclength, 1070 char *target, size_t targsize); 1071#endif /* !HAVE_B64_NTOP */ 1072#ifndef HAVE_B64_PTON 1073int b64_pton(char const *src, uint8_t *target, size_t targsize); 1074#endif /* !HAVE_B64_PTON */ 1075#ifndef HAVE_FSEEKO 1076#define fseeko fseek 1077#define ftello ftell 1078#endif /* HAVE_FSEEKO */ 1079#ifndef HAVE_SNPRINTF 1080#include <stdarg.h> 1081int snprintf (char *str, size_t count, const char *fmt, ...); 1082int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); 1083#endif /* HAVE_SNPRINTF */ 1084#ifndef HAVE_INET_PTON 1085int inet_pton(int af, const char* src, void* dst); 1086#endif /* HAVE_INET_PTON */ 1087#ifndef HAVE_INET_NTOP 1088const char *inet_ntop(int af, const void *src, char *dst, size_t size); 1089#endif 1090#ifndef HAVE_INET_ATON 1091int inet_aton(const char *cp, struct in_addr *addr); 1092#endif 1093#ifndef HAVE_MEMMOVE 1094void *memmove(void *dest, const void *src, size_t n); 1095#endif 1096#ifndef HAVE_STRLCAT 1097size_t strlcat(char *dst, const char *src, size_t siz); 1098#endif 1099#ifndef HAVE_STRLCPY 1100size_t strlcpy(char *dst, const char *src, size_t siz); 1101#endif 1102#ifndef HAVE_REALLOCARRAY 1103void* reallocarray(void *ptr, size_t nmemb, size_t size); 1104#endif 1105#ifndef HAVE_GETADDRINFO 1106#include "compat/fake-rfc2553.h" 1107#endif 1108#ifndef HAVE_STRPTIME 1109#define HAVE_STRPTIME 1 1110char *strptime(const char *s, const char *format, struct tm *tm); 1111#endif 1112#ifndef STRPTIME_WORKS 1113#define STRPTIME_WORKS 1 1114char *nsd_strptime(const char *s, const char *format, struct tm *tm); 1115#define strptime(a,b,c) nsd_strptime((a),(b),(c)) 1116#endif 1117]) 1118AH_BOTTOM( 1119AHX_MEMCMP_BROKEN(nsd) 1120AHX_CONFIG_MAXHOSTNAMELEN 1121) 1122AH_BOTTOM([ 1123 1124/* provide timespec def if not available */ 1125#ifndef CONFIG_DEFINES 1126#define CONFIG_DEFINES 1127#ifndef HAVE_STRUCT_TIMESPEC 1128#ifndef __timespec_defined 1129#define __timespec_defined 1 1130 struct timespec { 1131 long tv_sec; /* seconds */ 1132 long tv_nsec; /* nanoseconds */ 1133 }; 1134#endif /* !__timespec_defined */ 1135#endif /* !HAVE_STRUCT_TIMESPEC */ 1136#endif /* !CONFIG_DEFINES */ 1137 1138#ifdef PACKED_STRUCTS 1139#define ATTR_PACKED __attribute__((packed)) 1140#else 1141#define ATTR_PACKED 1142#endif 1143]) 1144 1145# big fat warning 1146if test "$enable_checking" = "yes"; then 1147 echo "************************************************" 1148 echo "* You have activated \"--enable-checking\" *" 1149 echo "* *" 1150 echo "* This will instruct NSD to be stricter *" 1151 echo "* when validating its input. This could lead *" 1152 echo "* to a reduced service level. *" 1153 echo "* *" 1154 echo "************************************************" 1155fi 1156 1157AC_CONFIG_FILES([Makefile $dnstap_config]) 1158AC_OUTPUT 1159