configure.ac revision 1.3
1dnl 2dnl Some global settings 3dnl 4 5sinclude(acx_nlnetlabs.m4) 6sinclude(dnstap/dnstap.m4) 7 8AC_INIT(NSD,4.2.4,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_CHECK_TYPE([struct mmsghdr], AC_DEFINE(HAVE_MMSGHDR, 1, [If sys/socket.h has a struct mmsghdr.]), [], [ 639AC_INCLUDES_DEFAULT 640#include <sys/socket.h> 641]) 642 643AC_ARG_ENABLE(recvmmsg, AC_HELP_STRING([--enable-recvmmsg], [Enable recvmmsg and sendmmsg compilation, faster but some kernel versions may have implementation problems for IPv6])) 644case "$enable_recvmmsg" in 645 yes) 646 AC_CHECK_FUNC([recvmmsg], [ 647AC_RUN_IFELSE([AC_LANG_SOURCE([[ 648#include <sys/socket.h> 649#include <errno.h> 650int main(void) 651{ 652 int s = socket(AF_INET, SOCK_DGRAM, 0); 653 int r = recvmmsg(s, 0, 0, 0, 0) == -1 && errno == ENOSYS; 654 close(s); 655 return r; 656} 657]])], [ 658AC_DEFINE([HAVE_RECVMMSG], [1], [Define if recvmmsg is implemented])], [ 659], [ 660AC_DEFINE([HAVE_RECVMMSG], [1], [Define if recvmmsg exists])] 661)]) 662 AC_CHECK_FUNC([sendmmsg], [ 663AC_RUN_IFELSE([AC_LANG_SOURCE([[ 664#include <sys/socket.h> 665#include <errno.h> 666int main(void) 667{ 668 int s = socket(AF_INET, SOCK_DGRAM, 0); 669 int r = sendmmsg(s, 0, 0, 0) == -1 && errno == ENOSYS; 670 close(s); 671 return r; 672} 673]])], [ 674AC_DEFINE([HAVE_SENDMMSG], [1], [Define if sendmmsg is implemented])], [ 675], [ 676AC_DEFINE([HAVE_SENDMMSG], [1], [Define if sendmmsg exists])] 677)]) 678 679 ;; 680 no|*) 681 ;; 682esac 683 684# check if setreuid en setregid fail, on MacOSX10.4(darwin8). 685if echo $target_os | grep darwin8 > /dev/null; then 686 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work]) 687fi 688 689# 690# Checking for missing functions we can replace 691# 692AC_REPLACE_FUNCS(basename) 693AC_REPLACE_FUNCS(inet_aton) 694AC_REPLACE_FUNCS(inet_pton) 695AC_REPLACE_FUNCS(inet_ntop) 696AC_REPLACE_FUNCS(snprintf) 697AC_REPLACE_FUNCS(strlcat) 698AC_REPLACE_FUNCS(strlcpy) 699AC_REPLACE_FUNCS(strptime) 700AC_REPLACE_FUNCS(b64_pton) 701AC_REPLACE_FUNCS(b64_ntop) 702AC_REPLACE_FUNCS(pselect) 703AC_REPLACE_FUNCS(memmove) 704AC_MSG_CHECKING([for reallocarray]) 705AC_LINK_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT 706[[ 707#ifndef _OPENBSD_SOURCE 708#define _OPENBSD_SOURCE 1 709#endif 710#include <stdlib.h> 711int main(void) { 712 void* p = reallocarray(NULL, 10, 100); 713 free(p); 714 return 0; 715} 716]])], [AC_MSG_RESULT(yes) 717 AC_DEFINE(HAVE_REALLOCARRAY, 1, [If we have reallocarray(3)]) 718], [ 719 AC_MSG_RESULT(no) 720 AC_LIBOBJ(reallocarray) 721]) 722 723AC_MSG_CHECKING(for pselect prototype in sys/select.h) 724AC_EGREP_HEADER([[^a-zA-Z_]*pselect[^a-zA-Z_]], sys/select.h, AC_DEFINE(HAVE_PSELECT_PROTO, 1, 725 [if sys/select.h provides pselect prototype]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) 726 727AC_MSG_CHECKING(for ctime_r prototype in time.h) 728AC_EGREP_HEADER([[^a-zA-Z_]*ctime_r[^a-zA-Z_]], time.h, AC_DEFINE(HAVE_CTIME_R_PROTO, 1, 729 [if time.h provides ctime_r prototype]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) 730 731AC_CHECK_TYPE([struct timespec], AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [If time.h has a struct timespec (for pselect).]), [], [ 732AC_INCLUDES_DEFAULT 733#ifdef HAVE_SIGNAL_H 734#include <signal.h> 735#endif 736#ifdef HAVE_TIME_H 737#include <time.h> 738#endif 739]) 740 741dnl 742dnl Some random defines's 743dnl 744AC_DEFINE_UNQUOTED([IDENTITY], ["unidentified server"], [Define to the default nsd identity.]) 745AC_DEFINE_UNQUOTED([VERSION], [PACKAGE_STRING], [Define to the NSD version to answer version.server query.]) 746AC_DEFINE_UNQUOTED([TCP_BACKLOG], [256], [Define to the backlog to be used with listen.]) 747AC_DEFINE_UNQUOTED([TCP_PORT], ["53"], [Define to the default tcp port.]) 748AC_DEFINE_UNQUOTED([TCP_MAX_MESSAGE_LEN], [65535], [Define to the default maximum message length.]) 749AC_DEFINE_UNQUOTED([UDP_PORT], ["53"], [Define to the default udp port.]) 750AC_DEFINE_UNQUOTED([UDP_MAX_MESSAGE_LEN], [512], [Define to the default maximum udp message length.]) 751AC_DEFINE_UNQUOTED([EDNS_MAX_MESSAGE_LEN], [4096], [Define to the default maximum message length with EDNS.]) 752AC_DEFINE_UNQUOTED([TLS_PORT], ["853"], [Define to the default DNS over TLS port.]) 753AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [512], [Define to the maximum message length to pass to syslog.]) 754AC_DEFINE_UNQUOTED([NSD_CONTROL_PORT], [8952], [Define to the default nsd-control port.]) 755AC_DEFINE_UNQUOTED([NSD_CONTROL_VERSION], [1], [Define to nsd-control proto version.]) 756 757dnl 758dnl Determine the syslog facility to use 759dnl 760facility=LOG_DAEMON 761AC_ARG_WITH([facility], 762 AC_HELP_STRING([--with-facility=name], [Syslog default facility (LOG_DAEMON)]), 763 [facility=$withval]) 764AC_DEFINE_UNQUOTED([FACILITY], $facility, [Define to the default facility for syslog.]) 765 766dnl 767dnl Determine the default tcp timeout 768dnl 769tcp_timeout=120 770AC_ARG_WITH([tcp_timeout], 771 AC_HELP_STRING([--with-tcp-timeout=number], [Limit the default tcp timeout]), 772 [tcp_timeout=$withval]) 773AC_DEFINE_UNQUOTED([TCP_TIMEOUT], $tcp_timeout, [Define to the default tcp timeout.]) 774 775dnl 776dnl Features 777dnl 778AC_ARG_ENABLE(root-server, AC_HELP_STRING([--enable-root-server], [Configure NSD as a root server])) 779case "$enable_root_server" in 780 yes) 781 AC_DEFINE_UNQUOTED([ROOT_SERVER], [], [Define this to configure as a root server.]) 782 ;; 783 no|*) 784 ;; 785esac 786 787AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [Disables IPv6 support])) 788case "$enable_ipv6" in 789 no) 790 ;; 791 yes|*) 792 AC_DEFINE_UNQUOTED([INET6], [], [Define this to enable IPv6 support.]) 793 ;; 794esac 795 796AC_ARG_ENABLE(bind8-stats, AC_HELP_STRING([--enable-bind8-stats], [Enables BIND8 like NSTATS & XSTATS and statistics in nsd-control])) 797 798case "$enable_bind8_stats" in 799 yes|'') 800 AC_DEFINE_UNQUOTED([BIND8_STATS], [], [Define this to enable BIND8 like NSTATS & XSTATS.]) 801 ;; 802 no|*) 803 ;; 804esac 805 806AC_ARG_ENABLE(zone-stats, AC_HELP_STRING([--enable-zone-stats], [Enable per-zone statistics gathering (needs --enable-bind8-stats)])) 807case "$enable_zone_stats" in 808 yes) 809 AC_DEFINE_UNQUOTED([USE_ZONE_STATS], [], [Define this to enable per-zone statistics gathering.]) 810 AC_DEFINE_UNQUOTED([BIND8_STATS], [], [Define this to enable BIND8 like NSTATS & XSTATS.]) 811 ;; 812 no|''|*) 813 ;; 814esac 815 816AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable internal runtime checks])) 817case "$enable_checking" in 818 yes) 819 CHECK_COMPILER_FLAG(W, [ CFLAGS="$CFLAGS -W" ]) 820 CHECK_COMPILER_FLAG(Wall, [ CFLAGS="$CFLAGS -Wall" ]) 821 CHECK_COMPILER_FLAG(Wextra, [ CFLAGS="$CFLAGS -Wextra" ]) 822 CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [ CFLAGS="$CFLAGS -Wdeclaration-after-statement" ]) 823 ;; 824 no|*) 825 AC_DEFINE([NDEBUG], [], [Undefine this to enable internal runtime checks.]) 826 ;; 827esac 828 829AC_ARG_ENABLE(memclean, AC_HELP_STRING([--enable-memclean], [Cleanup memory (at exit) for eg. valgrind, memcheck])) 830if test "$enable_memclean" = "yes"; then AC_DEFINE_UNQUOTED([MEMCLEAN], [1], [Define this to cleanup memory at exit (eg. for valgrind, etc.)]) 831fi 832 833AC_ARG_ENABLE(ratelimit, AC_HELP_STRING([--enable-ratelimit], [Enable rate limiting])) 834case "$enable_ratelimit" in 835 yes) 836 AC_DEFINE_UNQUOTED([RATELIMIT], [], [Define this to enable rate limiting.]) 837 dnl causes awk to not match the exclusion start marker. 838 ratelimit="xx" 839 ;; 840 no|*) 841 ratelimit="" 842 ;; 843esac 844AC_SUBST(ratelimit) 845 846AC_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])) 847case "$enable_ratelimit_default_is_off" in 848 yes) 849 AC_DEFINE_UNQUOTED([RATELIMIT_DEFAULT_OFF], [], [Define this to set ratelimit to off by default.]) 850 ratelimit_default="off" 851 ;; 852 no|*) 853 ratelimit_default="on" 854 ;; 855esac 856AC_SUBST(ratelimit_default) 857 858# we need SSL for TSIG (and maybe also for NSEC3). 859CHECK_SSL 860if test x$HAVE_SSL = x"yes"; then 861 ACX_LIB_SSL 862 863 # Check for -pthread 864 BAKLIBS="$LIBS" 865 LIBS="-lcrypto $LIBS" 866 AC_TRY_LINK([], [ 867 int HMAC_Update(void); 868 (void)HMAC_Update(); 869 ], [],[ 870 dnl so link fails for HMAC_Update, try with -pthread. 871 BAKCFLAGS="$CFLAGS" 872 CFLAGS="$CFLAGS -pthread" 873 AC_MSG_CHECKING([if libcrypto needs -pthread]) 874 AC_TRY_LINK_FUNC([HMAC_Update], [ 875 AC_MSG_RESULT([yes]) 876 ] , [ 877 AC_MSG_RESULT([no]) 878 dnl restore the nonpthread value 879 CFLAGS="$BAKCFLAGS" 880 ]) 881 ]) 882 LIBS="$BAKLIBS" 883 884 if test -n "$ssldir"; then 885 AC_CHECK_LIB(crypto, HMAC_Update,, [ 886 AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) 887 ]) 888 fi 889 SSL_LIBS="-lssl" 890 AC_SUBST(SSL_LIBS) 891 AC_CHECK_HEADERS([openssl/ssl.h openssl/err.h openssl/rand.h openssl/ocsp.h],,, [AC_INCLUDES_DEFAULT]) 892 AC_CHECK_FUNCS([HMAC_CTX_reset HMAC_CTX_new EVP_cleanup ERR_load_crypto_strings OPENSSL_init_crypto SSL_CTX_set_security_level CRYPTO_memcmp EC_KEY_new_by_curve_name]) 893 AC_CHECK_DECLS([SSL_CTX_set_ecdh_auto,SSL_CTX_set_tmp_ecdh], [], [], [ 894AC_INCLUDES_DEFAULT 895#ifdef HAVE_OPENSSL_ERR_H 896#include <openssl/err.h> 897#endif 898 899#ifdef HAVE_OPENSSL_RAND_H 900#include <openssl/rand.h> 901#endif 902 903#ifdef HAVE_OPENSSL_CONF_H 904#include <openssl/conf.h> 905#endif 906 907#ifdef HAVE_OPENSSL_ENGINE_H 908#include <openssl/engine.h> 909#endif 910#include <openssl/ssl.h> 911#include <openssl/evp.h> 912]) 913 914 915 BAKLIBS="$LIBS" 916 LIBS="-lssl $LIBS" 917 AC_CHECK_FUNCS([OPENSSL_init_ssl]) 918 LIBS="$BAKLIBS" 919 920else 921 AC_MSG_WARN([No SSL, therefore remote-control is disabled]) 922 AC_MSG_WARN([No SSL, therefore TLS is disabled]) 923fi 924 925AC_ARG_ENABLE(nsec3, AC_HELP_STRING([--disable-nsec3], [Disable NSEC3 support])) 926case "$enable_nsec3" in 927 no) 928 ;; 929 yes) 930 AC_DEFINE_UNQUOTED([NSEC3], [], [Define this to enable NSEC3 support.]) 931 ;; 932 *) 933 if test x$HAVE_SSL = x"yes"; then 934 AC_DEFINE_UNQUOTED([NSEC3], [], [Define this to enable NSEC3 support.]) 935 else 936 AC_MSG_WARN([No SSL, therefore NSEC3 is disabled]) 937 fi 938 ;; 939esac 940 941AC_ARG_ENABLE(minimal-responses, AC_HELP_STRING([--disable-minimal-responses], [Disable response minimization. More truncation.])) 942case "$enable_minimal_responses" in 943 no) 944 ;; 945 yes|*) 946 AC_DEFINE_UNQUOTED([MINIMAL_RESPONSES], [], [Define this to enable response minimalization to reduce truncation.]) 947 ;; 948esac 949 950AC_ARG_ENABLE(mmap, AC_HELP_STRING([--enable-mmap], [Use mmap instead of malloc. Experimental.])) 951case "$enable_mmap" in 952 yes) 953 AC_CHECK_HEADERS([sys/mman.h]) 954 AC_LIBGTOP_CHECK_TYPE(uintptr_t, void*) 955 AC_CHECK_FUNCS([mmap munmap]) 956 AC_DEFINE_UNQUOTED([USE_MMAP_ALLOC], [], [Define this to enable mmap instead of malloc. Experimental.]) 957 ;; 958 no|*) 959 ;; 960esac 961 962AC_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.])) 963case "$enable_radix_tree" in 964 no) 965 ;; 966 yes|*) 967 AC_DEFINE_UNQUOTED([USE_RADIX_TREE], [], [Define this to configure to use the radix tree.]) 968 ;; 969esac 970 971AC_ARG_ENABLE(packed, AC_HELP_STRING([--enable-packed], [Enable packed structure alignment, uses less memory, but unaligned reads.])) 972case "$enable_packed" in 973 yes) 974 AC_DEFINE_UNQUOTED([PACKED_STRUCTS], [], [Define this to use packed structure alignment.]) 975 ACX_CHECK_COMPILER_FLAG(Wno-address-of-packed-member, [CFLAGS="$CFLAGS -Wno-address-of-packed-member"]) 976 ;; 977 no|*) 978 ;; 979esac 980 981# check for dnstap if requested 982dt_DNSTAP([${localstatedir}/run/nsd-dnstap.sock], 983 [ 984 AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support]) 985 AC_SUBST([ENABLE_DNSTAP], [1]) 986 987 AC_SUBST([opt_dnstap_socket_path]) 988 ACX_ESCAPE_BACKSLASH($opt_dnstap_socket_path, hdr_dnstap_socket_path) 989 AC_DEFINE_UNQUOTED(DNSTAP_SOCKET_PATH, 990 ["$hdr_dnstap_socket_path"], [default dnstap socket path]) 991 992 AC_SUBST([DNSTAP_SRC], ["dnstap/dnstap.c dnstap/dnstap.pb-c.c dnstap/dnstap_collector.c"]) 993 AC_SUBST([DNSTAP_OBJ], ["dnstap.o dnstap_collector.o dnstap.pb-c.o"]) 994 dnstap_config="dnstap/dnstap_config.h" 995 ], 996 [ 997 AC_SUBST([ENABLE_DNSTAP], [0]) 998 ] 999) 1000 1001# Include systemd.m4 - begin 1002sinclude(systemd.m4) 1003# Include systemd.m4 - end 1004 1005AC_ARG_ENABLE(tcp-fastopen, AC_HELP_STRING([--enable-tcp-fastopen], [Enable TCP Fast Open])) 1006case "$enable_tcp_fastopen" in 1007 yes) 1008 AC_CHECK_DECL([TCP_FASTOPEN], [], [AC_MSG_ERROR([TCP Fast Open is not available: please rerun without --enable-tcp-fastopen])], [AC_INCLUDES_DEFAULT 1009#include <netinet/tcp.h> 1010 ]) 1011 AC_DEFINE_UNQUOTED([USE_TCP_FASTOPEN], [1], [Define this to enable TCP fast open.]) 1012 ;; 1013 no|*) 1014 ;; 1015esac 1016 1017AH_BOTTOM([ 1018/* define before includes as it specifies what standard to use. */ 1019#if (defined(HAVE_PSELECT) && !defined (HAVE_PSELECT_PROTO)) \ 1020 || !defined (HAVE_CTIME_R_PROTO) \ 1021 || defined (STRPTIME_NEEDS_DEFINES) 1022# ifndef _XOPEN_SOURCE 1023# define _XOPEN_SOURCE 600 1024# endif 1025# ifndef _POSIX_C_SOURCE 1026# define _POSIX_C_SOURCE 200112 1027# endif 1028# ifndef _BSD_SOURCE 1029# define _BSD_SOURCE 1 1030# endif 1031# ifndef _OPENBSD_SOURCE 1032# define _OPENBSD_SOURCE 1 1033# endif 1034# ifndef _DEFAULT_SOURCE 1035# define _DEFAULT_SOURCE 1 1036# endif 1037# ifndef __EXTENSIONS__ 1038# define __EXTENSIONS__ 1 1039# endif 1040# ifndef _STDC_C99 1041# define _STDC_C99 1 1042# endif 1043# ifndef _ALL_SOURCE 1044# define _ALL_SOURCE 1 1045# endif 1046#endif 1047]) 1048 1049AH_BOTTOM([ 1050#ifdef HAVE_VA_LIST_DOUBLE_DEF 1051/* workaround double va_list definition on some platforms */ 1052# ifndef _VA_LIST_DEFINED 1053# define _VA_LIST_DEFINED 1054# endif 1055#endif 1056]) 1057 1058AH_BOTTOM([ 1059#include <sys/types.h> 1060#if STDC_HEADERS 1061#include <stdlib.h> 1062#include <stddef.h> 1063#endif 1064 1065#ifdef HAVE_TIME_H 1066#include <time.h> 1067#endif 1068 1069#ifdef HAVE_STDINT_H 1070#include <stdint.h> 1071#endif 1072 1073#ifdef HAVE_SYS_SOCKET_H 1074#include <sys/socket.h> 1075#endif 1076 1077#ifdef HAVE_NETINET_IN_H 1078#include <netinet/in.h> 1079#endif 1080 1081#ifdef HAVE_NETINET_TCP_H 1082#include <netinet/tcp.h> 1083#endif 1084 1085#ifdef HAVE_ARPA_INET_H 1086#include <arpa/inet.h> 1087#endif 1088 1089/* For Tru64 */ 1090#ifdef HAVE_SYS_BITYPES_H 1091#include <sys/bitypes.h> 1092#endif 1093]) 1094 1095AH_BOTTOM([ 1096#ifdef HAVE_ATTR_FORMAT 1097#define ATTR_FORMAT(archetype, string_index, first_to_check) \ 1098 __attribute__ ((format (archetype, string_index, first_to_check))) 1099#else /* !HAVE_ATTR_FORMAT */ 1100#define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ 1101#endif /* !HAVE_ATTR_FORMAT */ 1102#if defined(__cplusplus) 1103#define ATTR_UNUSED(x) 1104#elif defined(HAVE_ATTR_UNUSED) 1105#define ATTR_UNUSED(x) x __attribute__((unused)) 1106#else /* !HAVE_ATTR_UNUSED */ 1107#define ATTR_UNUSED(x) x 1108#endif /* !HAVE_ATTR_UNUSED */ 1109]) 1110 1111AH_BOTTOM([ 1112#ifndef IPV6_MIN_MTU 1113#define IPV6_MIN_MTU 1280 1114#endif /* IPV6_MIN_MTU */ 1115 1116#ifndef AF_INET6 1117#define AF_INET6 28 1118#endif /* AF_INET6 */ 1119]) 1120 1121if test $ac_cv_func_getaddrinfo = no; then 1122AC_LIBOBJ([fake-rfc2553]) 1123fi 1124 1125AH_BOTTOM([ 1126/* maximum nesting of included files */ 1127#define MAXINCLUDES 10 1128]) 1129 1130AH_BOTTOM([ 1131#ifndef HAVE_B64_NTOP 1132int b64_ntop(uint8_t const *src, size_t srclength, 1133 char *target, size_t targsize); 1134#endif /* !HAVE_B64_NTOP */ 1135#ifndef HAVE_B64_PTON 1136int b64_pton(char const *src, uint8_t *target, size_t targsize); 1137#endif /* !HAVE_B64_PTON */ 1138#ifndef HAVE_FSEEKO 1139#define fseeko fseek 1140#define ftello ftell 1141#endif /* HAVE_FSEEKO */ 1142#ifndef HAVE_SNPRINTF 1143#include <stdarg.h> 1144int snprintf (char *str, size_t count, const char *fmt, ...); 1145int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); 1146#endif /* HAVE_SNPRINTF */ 1147#ifndef HAVE_INET_PTON 1148int inet_pton(int af, const char* src, void* dst); 1149#endif /* HAVE_INET_PTON */ 1150#ifndef HAVE_INET_NTOP 1151const char *inet_ntop(int af, const void *src, char *dst, size_t size); 1152#endif 1153#ifndef HAVE_INET_ATON 1154int inet_aton(const char *cp, struct in_addr *addr); 1155#endif 1156#ifndef HAVE_MEMMOVE 1157void *memmove(void *dest, const void *src, size_t n); 1158#endif 1159#ifndef HAVE_STRLCAT 1160size_t strlcat(char *dst, const char *src, size_t siz); 1161#endif 1162#ifndef HAVE_STRLCPY 1163size_t strlcpy(char *dst, const char *src, size_t siz); 1164#endif 1165#ifndef HAVE_REALLOCARRAY 1166void* reallocarray(void *ptr, size_t nmemb, size_t size); 1167#endif 1168#ifndef HAVE_GETADDRINFO 1169#include "compat/fake-rfc2553.h" 1170#endif 1171#ifndef HAVE_STRPTIME 1172#define HAVE_STRPTIME 1 1173char *strptime(const char *s, const char *format, struct tm *tm); 1174#endif 1175#ifndef STRPTIME_WORKS 1176#define STRPTIME_WORKS 1 1177char *nsd_strptime(const char *s, const char *format, struct tm *tm); 1178#define strptime(a,b,c) nsd_strptime((a),(b),(c)) 1179#endif 1180]) 1181AH_BOTTOM( 1182AHX_MEMCMP_BROKEN(nsd) 1183AHX_CONFIG_MAXHOSTNAMELEN 1184) 1185AH_BOTTOM([ 1186 1187/* provide timespec def if not available */ 1188#ifndef CONFIG_DEFINES 1189#define CONFIG_DEFINES 1190#ifndef HAVE_STRUCT_TIMESPEC 1191#ifndef __timespec_defined 1192#define __timespec_defined 1 1193 struct timespec { 1194 long tv_sec; /* seconds */ 1195 long tv_nsec; /* nanoseconds */ 1196 }; 1197#endif /* !__timespec_defined */ 1198#endif /* !HAVE_STRUCT_TIMESPEC */ 1199#endif /* !CONFIG_DEFINES */ 1200 1201#ifdef PACKED_STRUCTS 1202#define ATTR_PACKED __attribute__((packed)) 1203#else 1204#define ATTR_PACKED 1205#endif 1206]) 1207 1208# big fat warning 1209if test "$enable_checking" = "yes"; then 1210 echo "************************************************" 1211 echo "* You have activated \"--enable-checking\" *" 1212 echo "* *" 1213 echo "* This will instruct NSD to be stricter *" 1214 echo "* when validating its input. This could lead *" 1215 echo "* to a reduced service level. *" 1216 echo "* *" 1217 echo "************************************************" 1218fi 1219 1220AC_CONFIG_FILES([Makefile $dnstap_config]) 1221AC_OUTPUT 1222