configure.ac revision 1.2
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 303AC_CANONICAL_HOST 304 305case "${host_os}" in 306 *netbsd*) 307 # NetBSD needs -D_OPENBSD_SOURCE for reallocarray 308 CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE";; 309esac 310 311# Checks for typedefs, structures, and compiler characteristics. 312# allow user to override the -g -O2 flags. 313if test "x$CFLAGS" = "x" ; then 314 ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"]) 315 # we do not use O3 because it causes miscompilations. 316 ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) 317 ACX_CHECK_FLTO 318 ACX_CHECK_PIE 319 ACX_CHECK_RELRO_NOW 320fi 321AC_C_CONST 322AC_C_INLINE 323AC_TYPE_UID_T 324AC_TYPE_PID_T 325AC_TYPE_SIZE_T 326AC_TYPE_OFF_T 327 328AC_CHECK_FORMAT_ATTRIBUTE 329AC_CHECK_UNUSED_ATTRIBUTE 330CHECK_NORETURN_ATTRIBUTE 331ACX_CHECK_MEMCMP_SIGNED 332AC_CHECK_CTIME_R 333 334# Checks for libraries. 335 336# Check for SSL, original taken from 337# http://www.gnu.org/software/ac-archive/htmldoc/check_ssl.html and 338# modified for NSD. 339AC_DEFUN([CHECK_SSL], [ 340 AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], 341 [enable SSL (will check /usr/local/ssl 342 /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr)]),[ 343 ],[ 344 withval="yes" 345 ]) 346 if test x_$withval != x_no; then 347 AC_MSG_CHECKING(for SSL) 348 if test x_$withval = x_ -o x_$withval = x_yes; then 349 withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr" 350 fi 351 for dir in $withval; do 352 ssldir="$dir" 353 if test -f "$dir/include/openssl/ssl.h"; then 354 found_ssl="yes"; 355 AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.]) 356 if test x_$ssldir != x_/usr; then 357 CPPFLAGS="$CPPFLAGS -I$ssldir/include"; 358 fi 359 break; 360 fi 361 done 362 if test x_$found_ssl != x_yes; then 363 AC_MSG_ERROR(Cannot find the SSL libraries in $withval) 364 else 365 AC_MSG_RESULT(found in $ssldir) 366 HAVE_SSL=yes 367 if test x_$ssldir != x_/usr; then 368 LDFLAGS="$LDFLAGS -Wl,-R$ssldir/lib -L$ssldir/lib"; 369 fi 370 fi 371 AC_SUBST(HAVE_SSL) 372 fi 373])dnl 374 375# check for libevent 376AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname], 377 [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.]), 378 [ ],[ withval="yes" ]) 379if test x_$withval = x_yes -o x_$withval != x_no; then 380 AC_MSG_CHECKING(for libevent) 381 if test x_$withval = x_ -o x_$withval = x_yes; then 382 withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" 383 fi 384 for dir in $withval; do 385 thedir="$dir" 386 if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then 387 found_libevent="yes" 388 dnl assume /usr is in default path. 389 if test "$thedir" != "/usr"; then 390 CPPFLAGS="$CPPFLAGS -I$thedir/include" 391 fi 392 break; 393 fi 394 done 395 if test x_$found_libevent != x_yes; then 396 if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then 397 # libevent source directory 398 AC_MSG_RESULT(found in $thedir) 399 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include" 400 # remove evdns from linking 401 ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o` 402 cp $ev_files_o . 403 LDFLAGS="$ev_files_o $LDFLAGS -lm" 404 else 405 AC_MSG_ERROR([Cannot find the libevent library. 406You can restart ./configure --with-libevent=no to use a builtin alternative.]) 407 fi 408 else 409 AC_MSG_RESULT(found in $thedir) 410 dnl if event2 exists and no event lib in dir itself, use subdir 411 if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then 412 LDFLAGS="$LDFLAGS -Wl,-R$thedir/lib -L$thedir/lib/event2" 413 ACX_RUNTIME_PATH_ADD([$thedir/lib/event2]) 414 else 415 dnl assume /usr is in default path, do not add "". 416 if test "$thedir" != "/usr" -a "$thedir" != ""; then 417 LDFLAGS="$LDFLAGS -Wl,-R$thedir/lib -L$thedir/lib" 418 ACX_RUNTIME_PATH_ADD([$thedir/lib]) 419 fi 420 fi 421 fi 422 # check for library used by libevent after 1.3c 423 AC_SEARCH_LIBS([clock_gettime], [rt]) 424 425 # is the event.h header libev or libevent? 426 AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT]) 427 AC_CHECK_DECL(EV_VERSION_MAJOR, [ 428 AC_SEARCH_LIBS(event_set, [ev]) 429 ],[ 430 AC_SEARCH_LIBS(event_set, [event]) 431 ],[AC_INCLUDES_DEFAULT 432#include <event.h> 433 ]) 434 AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later 435 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later 436 AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later 437 AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later 438 AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51) 439 AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00) 440else 441 AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events]) 442fi 443 444# Checks for header files. 445AC_HEADER_STDC 446AC_HEADER_SYS_WAIT 447AC_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 login_cap.h]) 448 449AC_DEFUN([CHECK_VALIST_DEF], 450[ 451AC_REQUIRE([AC_PROG_CC]) 452AC_MSG_CHECKING(for double definition of struct va_list) 453AC_CACHE_VAL(ac_cv_c_va_list_def, 454[ 455cat >conftest.c <<EOF 456#include <stdio.h> 457#include <stdarg.h> 458int foo(void); 459EOF 460if test -z "`$CC -Werror -D_XOPEN_SOURCE=600 -c conftest.c 2>&1`"; then 461eval "ac_cv_c_va_list_def=no" 462else 463eval "ac_cv_c_va_list_def=yes" 464fi 465rm -f conftest* 466]) 467if test $ac_cv_c_va_list_def = yes; then 468AC_MSG_RESULT(yes) 469: 470AC_DEFINE_UNQUOTED([HAVE_VA_LIST_DOUBLE_DEF], [], [Define this if you have double va_list definitions.]) 471else 472AC_MSG_RESULT(no) 473: 474 475fi 476]) 477 478CHECK_VALIST_DEF 479 480AC_DEFUN([AC_CHECK_STRPTIME], 481[AC_REQUIRE([AC_PROG_CC]) 482AC_MSG_CHECKING(whether strptime needs defines) 483AC_CACHE_VAL(ac_cv_c_strptime_needs_defs, 484[ 485cat >conftest.c <<EOF 486#include <time.h> 487int testing (void) { struct tm t; const char *timestr="201201"; return strptime(timestr, "%Y%m", &t) != 0; } 488EOF 489if test -z "`$CC -Wall -Werror -c conftest.c 2>&1`"; then 490eval "ac_cv_c_strptime_needs_defs=no" 491else 492eval "ac_cv_c_strptime_needs_defs=yes" 493fi 494rm -f conftest* 495]) 496 497AC_MSG_RESULT($ac_cv_c_strptime_needs_defs) 498if test $ac_cv_c_strptime_needs_defs = yes; then 499AC_DEFINE_UNQUOTED([STRPTIME_NEEDS_DEFINES], 1, [strptime is available from time.h with some defines.]) 500fi 501])dnl 502 503AC_CHECK_STRPTIME 504 505# check wether strptime also works 506AC_DEFUN([AC_CHECK_STRPTIME_WORKS], 507[AC_REQUIRE([AC_PROG_CC]) 508AC_MSG_CHECKING(whether strptime works) 509if test c${cross_compiling} = cno; then 510AC_RUN_IFELSE([AC_LANG_SOURCE([[ 511#define _XOPEN_SOURCE 600 512#include <time.h> 513int main(void) { struct tm tm; char *res; 514res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); 515if (!res) return 1; return 0; } 516]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"]) 517else 518eval "ac_cv_c_strptime_works=maybe" 519fi 520AC_MSG_RESULT($ac_cv_c_strptime_works) 521if test $ac_cv_c_strptime_works = no; then 522AC_LIBOBJ(strptime) 523else 524AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.]) 525fi 526])dnl 527 528AC_SEARCH_LIBS(inet_pton, [nsl]) 529AC_SEARCH_LIBS(socket, [socket]) 530 531AC_CHECK_STRPTIME_WORKS 532ACX_CHECK_NONBLOCKING_BROKEN 533ACX_MKDIR_ONE_ARG 534 535# set -I. and -Isrcdir 536if test -n "$CPPFLAGS"; then 537 CPPFLAGS="$CPPFLAGS -I." 538else 539 CPPFLAGS="-I." 540fi 541if test "$srcdir" != "."; then 542 CPPFLAGS="$CPPFLAGS -I$srcdir" 543 if test -f $srcdir/config.h; then 544 AC_ERROR([$srcdir/config.h is in the way, please remove it]) 545 fi 546fi 547 548dnl LIBGTOP_CHECK_TYPE 549dnl Stolen from Gnome's anjuta 550dnl Improved version of AC_CHECK_TYPE which takes into account 551dnl that we need to #include some other header files on some 552dnl systems to get some types. 553 554dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT) 555AC_DEFUN([AC_LIBGTOP_CHECK_TYPE], 556[AC_REQUIRE([AC_HEADER_STDC])dnl 557AC_MSG_CHECKING(for $1) 558AC_CACHE_VAL(ac_cv_type_$1, 559[AC_EGREP_CPP(dnl 560changequote(<<,>>)dnl 561<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl 562changequote([,]), [ 563#include <sys/types.h> 564#if STDC_HEADERS 565#include <stdlib.h> 566#include <stddef.h> 567#endif 568 569#ifdef HAVE_STDINT_H 570#include <stdint.h> 571#endif 572 573#ifdef HAVE_SYS_SOCKET_H 574#include <sys/socket.h> 575#endif 576 577#ifdef HAVE_ARPA_INET_H 578#include <arpa/inet.h> 579#endif 580 581#ifdef HAVE_SIGNAL_H 582#include <signal.h> 583#endif 584 585/* For Tru64 */ 586#ifdef HAVE_SYS_BITYPES_H 587#include <sys/bitypes.h> 588#endif 589], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl 590AC_MSG_RESULT($ac_cv_type_$1) 591if test $ac_cv_type_$1 = no; then 592 AC_DEFINE($1, $2, Define "$1" to "$2" if "$1" is missing) 593fi 594]) 595 596AC_LIBGTOP_CHECK_TYPE(int8_t, char) 597AC_LIBGTOP_CHECK_TYPE(int16_t, short) 598AC_LIBGTOP_CHECK_TYPE(int32_t, int) 599AC_LIBGTOP_CHECK_TYPE(int64_t, long long) 600AC_LIBGTOP_CHECK_TYPE(uint8_t, unsigned char) 601AC_LIBGTOP_CHECK_TYPE(uint16_t, unsigned short) 602AC_LIBGTOP_CHECK_TYPE(uint32_t, unsigned int) 603AC_LIBGTOP_CHECK_TYPE(uint64_t, unsigned long long) 604AC_LIBGTOP_CHECK_TYPE(socklen_t, int) 605AC_LIBGTOP_CHECK_TYPE(sig_atomic_t, int) 606AC_LIBGTOP_CHECK_TYPE(ssize_t, int) 607AC_LIBGTOP_CHECK_TYPE(suseconds_t, time_t) 608 609AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ 610#if HAVE_SYS_TYPES_H 611# include <sys/types.h> 612#endif 613#if HAVE_NETINET_IN_H 614# include <netinet/in.h> 615#endif]) 616ACX_CHECK_SS_FAMILY 617AC_CHECK_MEMBERS([struct stat.st_mtimensec, struct stat.st_mtim.tv_nsec]) 618AC_CHECK_MEMBERS([struct sockaddr_un.sun_len],,,[ 619AC_INCLUDES_DEFAULT 620#ifdef HAVE_SYS_UN_H 621#include <sys/un.h> 622#endif 623]) 624 625# Checks for library functions. 626AC_FUNC_CHOWN 627AC_FUNC_FORK 628AC_FUNC_MALLOC 629AC_TYPE_SIGNAL 630AC_FUNC_FSEEKO 631AC_SYS_LARGEFILE 632AC_CHECK_SIZEOF(void*) 633AC_CHECK_SIZEOF(off_t) 634AC_CHECK_FUNCS([arc4random arc4random_uniform]) 635AC_SEARCH_LIBS([setusercontext],[util],[AC_CHECK_HEADERS([login_cap.h])]) 636AC_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]) 637 638AC_ARG_ENABLE(recvmmsg, AC_HELP_STRING([--enable-recvmmsg], [Enable recvmmsg and sendmmsg compilation, faster but some kernel versions may have implementation problems for IPv6])) 639case "$enable_recvmmsg" in 640 yes) 641 AC_CHECK_FUNC([recvmmsg], [ 642AC_RUN_IFELSE([AC_LANG_SOURCE([[ 643#include <sys/socket.h> 644#include <errno.h> 645int main(void) 646{ 647 int s = socket(AF_INET, SOCK_DGRAM, 0); 648 int r = recvmmsg(s, 0, 0, 0, 0) == -1 && errno == ENOSYS; 649 close(s); 650 return r; 651} 652]])], [ 653AC_DEFINE([HAVE_RECVMMSG], [1], [Define if recvmmsg is implemented])], [ 654], [ 655AC_DEFINE([HAVE_RECVMMSG], [1], [Define if recvmmsg exists])] 656)]) 657 AC_CHECK_FUNC([sendmmsg], [ 658AC_RUN_IFELSE([AC_LANG_SOURCE([[ 659#include <sys/socket.h> 660#include <errno.h> 661int main(void) 662{ 663 int s = socket(AF_INET, SOCK_DGRAM, 0); 664 int r = sendmmsg(s, 0, 0, 0) == -1 && errno == ENOSYS; 665 close(s); 666 return r; 667} 668]])], [ 669AC_DEFINE([HAVE_SENDMMSG], [1], [Define if sendmmsg is implemented])], [ 670], [ 671AC_DEFINE([HAVE_SENDMMSG], [1], [Define if sendmmsg exists])] 672)]) 673 674 ;; 675 no|*) 676 ;; 677esac 678 679# check if setreuid en setregid fail, on MacOSX10.4(darwin8). 680if echo $target_os | grep darwin8 > /dev/null; then 681 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work]) 682fi 683 684# 685# Checking for missing functions we can replace 686# 687AC_REPLACE_FUNCS(basename) 688AC_REPLACE_FUNCS(inet_aton) 689AC_REPLACE_FUNCS(inet_pton) 690AC_REPLACE_FUNCS(inet_ntop) 691AC_REPLACE_FUNCS(snprintf) 692AC_REPLACE_FUNCS(strlcat) 693AC_REPLACE_FUNCS(strlcpy) 694AC_REPLACE_FUNCS(strptime) 695AC_REPLACE_FUNCS(b64_pton) 696AC_REPLACE_FUNCS(b64_ntop) 697AC_REPLACE_FUNCS(pselect) 698AC_REPLACE_FUNCS(memmove) 699AC_REPLACE_FUNCS(reallocarray) 700 701AC_MSG_CHECKING(for pselect prototype in sys/select.h) 702AC_EGREP_HEADER([[^a-zA-Z_]*pselect[^a-zA-Z_]], sys/select.h, AC_DEFINE(HAVE_PSELECT_PROTO, 1, 703 [if sys/select.h provides pselect prototype]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) 704 705AC_MSG_CHECKING(for ctime_r prototype in time.h) 706AC_EGREP_HEADER([[^a-zA-Z_]*ctime_r[^a-zA-Z_]], time.h, AC_DEFINE(HAVE_CTIME_R_PROTO, 1, 707 [if time.h provides ctime_r prototype]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) 708 709AC_CHECK_TYPE([struct timespec], AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [If time.h has a struct timespec (for pselect).]), [], [ 710AC_INCLUDES_DEFAULT 711#ifdef HAVE_SIGNAL_H 712#include <signal.h> 713#endif 714#ifdef HAVE_TIME_H 715#include <time.h> 716#endif 717]) 718 719dnl 720dnl Some random defines's 721dnl 722AC_DEFINE_UNQUOTED([IDENTITY], ["unidentified server"], [Define to the default nsd identity.]) 723AC_DEFINE_UNQUOTED([VERSION], [PACKAGE_STRING], [Define to the NSD version to answer version.server query.]) 724AC_DEFINE_UNQUOTED([TCP_BACKLOG], [256], [Define to the backlog to be used with listen.]) 725AC_DEFINE_UNQUOTED([TCP_PORT], ["53"], [Define to the default tcp port.]) 726AC_DEFINE_UNQUOTED([TCP_MAX_MESSAGE_LEN], [65535], [Define to the default maximum message length.]) 727AC_DEFINE_UNQUOTED([UDP_PORT], ["53"], [Define to the default udp port.]) 728AC_DEFINE_UNQUOTED([UDP_MAX_MESSAGE_LEN], [512], [Define to the default maximum udp message length.]) 729AC_DEFINE_UNQUOTED([EDNS_MAX_MESSAGE_LEN], [4096], [Define to the default maximum message length with EDNS.]) 730AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [512], [Define to the maximum message length to pass to syslog.]) 731AC_DEFINE_UNQUOTED([NSD_CONTROL_PORT], [8952], [Define to the default nsd-control port.]) 732AC_DEFINE_UNQUOTED([NSD_CONTROL_VERSION], [1], [Define to nsd-control proto version.]) 733 734dnl 735dnl Determine the syslog facility to use 736dnl 737facility=LOG_DAEMON 738AC_ARG_WITH([facility], 739 AC_HELP_STRING([--with-facility=name], [Syslog default facility (LOG_DAEMON)]), 740 [facility=$withval]) 741AC_DEFINE_UNQUOTED([FACILITY], $facility, [Define to the default facility for syslog.]) 742 743dnl 744dnl Determine the default tcp timeout 745dnl 746tcp_timeout=120 747AC_ARG_WITH([tcp_timeout], 748 AC_HELP_STRING([--with-tcp-timeout=number], [Limit the default tcp timeout]), 749 [tcp_timeout=$withval]) 750AC_DEFINE_UNQUOTED([TCP_TIMEOUT], $tcp_timeout, [Define to the default tcp timeout.]) 751 752dnl 753dnl Features 754dnl 755AC_ARG_ENABLE(root-server, AC_HELP_STRING([--enable-root-server], [Configure NSD as a root server])) 756case "$enable_root_server" in 757 yes) 758 AC_DEFINE_UNQUOTED([ROOT_SERVER], [], [Define this to configure as a root server.]) 759 ;; 760 no|*) 761 ;; 762esac 763 764AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [Disables IPv6 support])) 765case "$enable_ipv6" in 766 no) 767 ;; 768 yes|*) 769 AC_DEFINE_UNQUOTED([INET6], [], [Define this to enable IPv6 support.]) 770 ;; 771esac 772 773AC_ARG_ENABLE(bind8-stats, AC_HELP_STRING([--enable-bind8-stats], [Enables BIND8 like NSTATS & XSTATS and statistics in nsd-control])) 774 775case "$enable_bind8_stats" in 776 yes|'') 777 AC_DEFINE_UNQUOTED([BIND8_STATS], [], [Define this to enable BIND8 like NSTATS & XSTATS.]) 778 ;; 779 no|*) 780 ;; 781esac 782 783AC_ARG_ENABLE(zone-stats, AC_HELP_STRING([--enable-zone-stats], [Enable per-zone statistics gathering (needs --enable-bind8-stats)])) 784case "$enable_zone_stats" in 785 yes) 786 AC_DEFINE_UNQUOTED([USE_ZONE_STATS], [], [Define this to enable per-zone statistics gathering.]) 787 AC_DEFINE_UNQUOTED([BIND8_STATS], [], [Define this to enable BIND8 like NSTATS & XSTATS.]) 788 ;; 789 no|''|*) 790 ;; 791esac 792 793AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable internal runtime checks])) 794case "$enable_checking" in 795 yes) 796 CHECK_COMPILER_FLAG(W, [ CFLAGS="$CFLAGS -W" ]) 797 CHECK_COMPILER_FLAG(Wall, [ CFLAGS="$CFLAGS -Wall" ]) 798 CHECK_COMPILER_FLAG(Wextra, [ CFLAGS="$CFLAGS -Wextra" ]) 799 CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [ CFLAGS="$CFLAGS -Wdeclaration-after-statement" ]) 800 ;; 801 no|*) 802 AC_DEFINE([NDEBUG], [], [Undefine this to enable internal runtime checks.]) 803 ;; 804esac 805 806AC_ARG_ENABLE(memclean, AC_HELP_STRING([--enable-memclean], [Cleanup memory (at exit) for eg. valgrind, memcheck])) 807if test "$enable_memclean" = "yes"; then AC_DEFINE_UNQUOTED([MEMCLEAN], [1], [Define this to cleanup memory at exit (eg. for valgrind, etc.)]) 808fi 809 810AC_ARG_ENABLE(ratelimit, AC_HELP_STRING([--enable-ratelimit], [Enable rate limiting])) 811case "$enable_ratelimit" in 812 yes) 813 AC_DEFINE_UNQUOTED([RATELIMIT], [], [Define this to enable rate limiting.]) 814 dnl causes awk to not match the exclusion start marker. 815 ratelimit="xx" 816 ;; 817 no|*) 818 ratelimit="" 819 ;; 820esac 821AC_SUBST(ratelimit) 822 823AC_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])) 824case "$enable_ratelimit_default_is_off" in 825 yes) 826 AC_DEFINE_UNQUOTED([RATELIMIT_DEFAULT_OFF], [], [Define this to set ratelimit to off by default.]) 827 ratelimit_default="off" 828 ;; 829 no|*) 830 ratelimit_default="on" 831 ;; 832esac 833AC_SUBST(ratelimit_default) 834 835# we need SSL for TSIG (and maybe also for NSEC3). 836CHECK_SSL 837if test x$HAVE_SSL = x"yes"; then 838 ACX_LIB_SSL 839 840 # Check for -pthread 841 BAKLIBS="$LIBS" 842 LIBS="-lcrypto $LIBS" 843 AC_TRY_LINK([], [ 844 int HMAC_Update(void); 845 (void)HMAC_Update(); 846 ], [],[ 847 dnl so link fails for HMAC_Update, try with -pthread. 848 BAKCFLAGS="$CFLAGS" 849 CFLAGS="$CFLAGS -pthread" 850 AC_MSG_CHECKING([if libcrypto needs -pthread]) 851 AC_TRY_LINK_FUNC([HMAC_Update], [ 852 AC_MSG_RESULT([yes]) 853 ] , [ 854 AC_MSG_RESULT([no]) 855 dnl restore the nonpthread value 856 CFLAGS="$BAKCFLAGS" 857 ]) 858 ]) 859 LIBS="$BAKLIBS" 860 861 if test -n "$ssldir"; then 862 AC_CHECK_LIB(crypto, HMAC_Update,, [ 863 AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) 864 ]) 865 fi 866 SSL_LIBS="-lssl" 867 AC_SUBST(SSL_LIBS) 868 AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) 869 AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) 870 AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) 871 AC_CHECK_FUNCS([HMAC_CTX_reset HMAC_CTX_new EVP_cleanup ERR_load_crypto_strings OPENSSL_init_crypto]) 872 873 BAKLIBS="$LIBS" 874 LIBS="-lssl $LIBS" 875 AC_CHECK_FUNCS([OPENSSL_init_ssl]) 876 LIBS="$BAKLIBS" 877 878else 879 AC_MSG_WARN([No SSL, therefore remote-control is disabled]) 880fi 881 882AC_ARG_ENABLE(nsec3, AC_HELP_STRING([--disable-nsec3], [Disable NSEC3 support])) 883case "$enable_nsec3" in 884 no) 885 ;; 886 yes) 887 AC_DEFINE_UNQUOTED([NSEC3], [], [Define this to enable NSEC3 support.]) 888 ;; 889 *) 890 if test x$HAVE_SSL = x"yes"; then 891 AC_DEFINE_UNQUOTED([NSEC3], [], [Define this to enable NSEC3 support.]) 892 else 893 AC_MSG_WARN([No SSL, therefore NSEC3 is disabled]) 894 fi 895 ;; 896esac 897 898AC_ARG_ENABLE(minimal-responses, AC_HELP_STRING([--disable-minimal-responses], [Disable response minimization. More truncation.])) 899case "$enable_minimal_responses" in 900 no) 901 ;; 902 yes|*) 903 AC_DEFINE_UNQUOTED([MINIMAL_RESPONSES], [], [Define this to enable response minimalization to reduce truncation.]) 904 ;; 905esac 906 907AC_ARG_ENABLE(mmap, AC_HELP_STRING([--enable-mmap], [Use mmap instead of malloc. Experimental.])) 908case "$enable_mmap" in 909 yes) 910 AC_CHECK_HEADERS([sys/mman.h]) 911 AC_LIBGTOP_CHECK_TYPE(uintptr_t, void*) 912 AC_CHECK_FUNCS([mmap munmap]) 913 AC_DEFINE_UNQUOTED([USE_MMAP_ALLOC], [], [Define this to enable mmap instead of malloc. Experimental.]) 914 ;; 915 no|*) 916 ;; 917esac 918 919AC_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.])) 920case "$enable_radix_tree" in 921 no) 922 ;; 923 yes|*) 924 AC_DEFINE_UNQUOTED([USE_RADIX_TREE], [], [Define this to configure to use the radix tree.]) 925 ;; 926esac 927 928AC_ARG_ENABLE(packed, AC_HELP_STRING([--enable-packed], [Enable packed structure alignment, uses less memory, but unaligned reads.])) 929case "$enable_packed" in 930 yes) 931 AC_DEFINE_UNQUOTED([PACKED_STRUCTS], [], [Define this to use packed structure alignment.]) 932 ACX_CHECK_COMPILER_FLAG(Wno-address-of-packed-member, [CFLAGS="$CFLAGS -Wno-address-of-packed-member"]) 933 ;; 934 no|*) 935 ;; 936esac 937 938# check for dnstap if requested 939dt_DNSTAP([${localstatedir}/run/nsd-dnstap.sock], 940 [ 941 AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support]) 942 AC_SUBST([ENABLE_DNSTAP], [1]) 943 944 AC_SUBST([opt_dnstap_socket_path]) 945 ACX_ESCAPE_BACKSLASH($opt_dnstap_socket_path, hdr_dnstap_socket_path) 946 AC_DEFINE_UNQUOTED(DNSTAP_SOCKET_PATH, 947 ["$hdr_dnstap_socket_path"], [default dnstap socket path]) 948 949 AC_SUBST([DNSTAP_SRC], ["dnstap/dnstap.c dnstap/dnstap.pb-c.c dnstap/dnstap_collector.c"]) 950 AC_SUBST([DNSTAP_OBJ], ["dnstap.o dnstap_collector.o dnstap.pb-c.o"]) 951 dnstap_config="dnstap/dnstap_config.h" 952 ], 953 [ 954 AC_SUBST([ENABLE_DNSTAP], [0]) 955 ] 956) 957 958# Include systemd.m4 - begin 959sinclude(systemd.m4) 960# Include systemd.m4 - end 961 962AH_BOTTOM([ 963/* define before includes as it specifies what standard to use. */ 964#if (defined(HAVE_PSELECT) && !defined (HAVE_PSELECT_PROTO)) \ 965 || !defined (HAVE_CTIME_R_PROTO) \ 966 || defined (STRPTIME_NEEDS_DEFINES) 967# ifndef _XOPEN_SOURCE 968# define _XOPEN_SOURCE 600 969# endif 970# ifndef _POSIX_C_SOURCE 971# define _POSIX_C_SOURCE 200112 972# endif 973# ifndef _BSD_SOURCE 974# define _BSD_SOURCE 1 975# endif 976# ifndef _DEFAULT_SOURCE 977# define _DEFAULT_SOURCE 1 978# endif 979# ifndef __EXTENSIONS__ 980# define __EXTENSIONS__ 1 981# endif 982# ifndef _STDC_C99 983# define _STDC_C99 1 984# endif 985# ifndef _ALL_SOURCE 986# define _ALL_SOURCE 1 987# endif 988#endif 989]) 990 991AH_BOTTOM([ 992#ifdef HAVE_VA_LIST_DOUBLE_DEF 993/* workaround double va_list definition on some platforms */ 994# ifndef _VA_LIST_DEFINED 995# define _VA_LIST_DEFINED 996# endif 997#endif 998]) 999 1000AH_BOTTOM([ 1001#include <sys/types.h> 1002#if STDC_HEADERS 1003#include <stdlib.h> 1004#include <stddef.h> 1005#endif 1006 1007#ifdef HAVE_TIME_H 1008#include <time.h> 1009#endif 1010 1011#ifdef HAVE_STDINT_H 1012#include <stdint.h> 1013#endif 1014 1015#ifdef HAVE_SYS_SOCKET_H 1016#include <sys/socket.h> 1017#endif 1018 1019#ifdef HAVE_NETINET_IN_H 1020#include <netinet/in.h> 1021#endif 1022 1023#ifdef HAVE_NETINET_TCP_H 1024#include <netinet/tcp.h> 1025#endif 1026 1027#ifdef HAVE_ARPA_INET_H 1028#include <arpa/inet.h> 1029#endif 1030 1031/* For Tru64 */ 1032#ifdef HAVE_SYS_BITYPES_H 1033#include <sys/bitypes.h> 1034#endif 1035]) 1036 1037AH_BOTTOM([ 1038#ifdef HAVE_ATTR_FORMAT 1039#define ATTR_FORMAT(archetype, string_index, first_to_check) \ 1040 __attribute__ ((format (archetype, string_index, first_to_check))) 1041#else /* !HAVE_ATTR_FORMAT */ 1042#define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ 1043#endif /* !HAVE_ATTR_FORMAT */ 1044#if defined(__cplusplus) 1045#define ATTR_UNUSED(x) 1046#elif defined(HAVE_ATTR_UNUSED) 1047#define ATTR_UNUSED(x) x __attribute__((unused)) 1048#else /* !HAVE_ATTR_UNUSED */ 1049#define ATTR_UNUSED(x) x 1050#endif /* !HAVE_ATTR_UNUSED */ 1051]) 1052 1053AH_BOTTOM([ 1054#ifndef IPV6_MIN_MTU 1055#define IPV6_MIN_MTU 1280 1056#endif /* IPV6_MIN_MTU */ 1057 1058#ifndef AF_INET6 1059#define AF_INET6 28 1060#endif /* AF_INET6 */ 1061]) 1062 1063if test $ac_cv_func_getaddrinfo = no; then 1064AC_LIBOBJ([fake-rfc2553]) 1065fi 1066 1067AH_BOTTOM([ 1068/* maximum nesting of included files */ 1069#define MAXINCLUDES 10 1070]) 1071 1072AH_BOTTOM([ 1073#ifndef HAVE_B64_NTOP 1074int b64_ntop(uint8_t const *src, size_t srclength, 1075 char *target, size_t targsize); 1076#endif /* !HAVE_B64_NTOP */ 1077#ifndef HAVE_B64_PTON 1078int b64_pton(char const *src, uint8_t *target, size_t targsize); 1079#endif /* !HAVE_B64_PTON */ 1080#ifndef HAVE_FSEEKO 1081#define fseeko fseek 1082#define ftello ftell 1083#endif /* HAVE_FSEEKO */ 1084#ifndef HAVE_SNPRINTF 1085#include <stdarg.h> 1086int snprintf (char *str, size_t count, const char *fmt, ...); 1087int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); 1088#endif /* HAVE_SNPRINTF */ 1089#ifndef HAVE_INET_PTON 1090int inet_pton(int af, const char* src, void* dst); 1091#endif /* HAVE_INET_PTON */ 1092#ifndef HAVE_INET_NTOP 1093const char *inet_ntop(int af, const void *src, char *dst, size_t size); 1094#endif 1095#ifndef HAVE_INET_ATON 1096int inet_aton(const char *cp, struct in_addr *addr); 1097#endif 1098#ifndef HAVE_MEMMOVE 1099void *memmove(void *dest, const void *src, size_t n); 1100#endif 1101#ifndef HAVE_STRLCAT 1102size_t strlcat(char *dst, const char *src, size_t siz); 1103#endif 1104#ifndef HAVE_STRLCPY 1105size_t strlcpy(char *dst, const char *src, size_t siz); 1106#endif 1107#ifndef HAVE_REALLOCARRAY 1108void* reallocarray(void *ptr, size_t nmemb, size_t size); 1109#endif 1110#ifndef HAVE_GETADDRINFO 1111#include "compat/fake-rfc2553.h" 1112#endif 1113#ifndef HAVE_STRPTIME 1114#define HAVE_STRPTIME 1 1115char *strptime(const char *s, const char *format, struct tm *tm); 1116#endif 1117#ifndef STRPTIME_WORKS 1118#define STRPTIME_WORKS 1 1119char *nsd_strptime(const char *s, const char *format, struct tm *tm); 1120#define strptime(a,b,c) nsd_strptime((a),(b),(c)) 1121#endif 1122]) 1123AH_BOTTOM( 1124AHX_MEMCMP_BROKEN(nsd) 1125AHX_CONFIG_MAXHOSTNAMELEN 1126) 1127AH_BOTTOM([ 1128 1129/* provide timespec def if not available */ 1130#ifndef CONFIG_DEFINES 1131#define CONFIG_DEFINES 1132#ifndef HAVE_STRUCT_TIMESPEC 1133#ifndef __timespec_defined 1134#define __timespec_defined 1 1135 struct timespec { 1136 long tv_sec; /* seconds */ 1137 long tv_nsec; /* nanoseconds */ 1138 }; 1139#endif /* !__timespec_defined */ 1140#endif /* !HAVE_STRUCT_TIMESPEC */ 1141#endif /* !CONFIG_DEFINES */ 1142 1143#ifdef PACKED_STRUCTS 1144#define ATTR_PACKED __attribute__((packed)) 1145#else 1146#define ATTR_PACKED 1147#endif 1148]) 1149 1150# big fat warning 1151if test "$enable_checking" = "yes"; then 1152 echo "************************************************" 1153 echo "* You have activated \"--enable-checking\" *" 1154 echo "* *" 1155 echo "* This will instruct NSD to be stricter *" 1156 echo "* when validating its input. This could lead *" 1157 echo "* to a reduced service level. *" 1158 echo "* *" 1159 echo "************************************************" 1160fi 1161 1162AC_CONFIG_FILES([Makefile $dnstap_config]) 1163AC_OUTPUT 1164