15
15
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
19
AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h netinet/ether.h)
18
AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h)
20
19
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
21
20
#include <sys/socket.h>])
21
if test "$ac_cv_header_netinet_if_ether_h" != yes; then
23
# The simple test didn't work.
24
# Do we need to include <net/if.h> first?
25
# Unset ac_cv_header_netinet_if_ether_h so we don't
26
# treat the previous failure as a cached value and
27
# suppress the next test.
29
AC_MSG_NOTICE([Rechecking with some additional includes])
30
unset ac_cv_header_netinet_if_ether_h
31
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
32
#include <sys/socket.h>
33
#include <netinet/in.h>
124
AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
125
AC_MSG_CHECKING([whether to drop root privileges by default])
126
if test ! -z "$with_user" ; then
127
AC_DEFINE_UNQUOTED(WITH_USER, "$withval")
128
AC_MSG_RESULT(to \"$withval\")
133
AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
134
AC_MSG_CHECKING([whether to chroot])
135
if test ! -z "$with_chroot" ; then
136
AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval")
137
AC_MSG_RESULT(to \"$withval\")
107
142
AC_MSG_CHECKING([whether to enable ipv6])
108
143
AC_ARG_ENABLE(ipv6,
109
144
[ --enable-ipv6 enable ipv6 (with ipv4) support
473
509
dnl Checks if res_state structure has nsort member.
474
510
AC_STRUCT_RES_STATE(ac_cv_res_state)
477
dnl set additional include path if necessary
478
if test "$missing_includes" = "yes"; then
479
CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
480
V_INCLS="$V_INCLS -I\$(srcdir)/missing"
484
513
AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
485
514
AC_CHECK_FUNCS(strftime)
486
AC_CHECK_FUNCS(ether_ntohost, [
487
AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
490
#include <sys/types.h>
491
#include <sys/param.h>
492
#include <sys/socket.h>
495
main(int argc, char **argv)
497
u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
498
char name[MAXHOSTNAMELEN];
500
ether_ntohost(name, (struct ether_addr *)ea);
503
], [ac_cv_buggy_ether_ntohost=no],
504
[ac_cv_buggy_ether_ntohost=yes],
505
[ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
506
if test "$ac_cv_buggy_ether_ntohost" = "no"; then
507
AC_DEFINE(USE_ETHER_NTOHOST)
510
AC_CHECK_FUNCS(setlinebuf)
515
AC_CHECK_FUNCS(setlinebuf alarm)
513
518
AC_CHECK_FUNCS(vsnprintf snprintf,,
514
519
[needsnprintf=yes])
515
520
if test $needsnprintf = yes; then
516
AC_LIBOBJ(snprintf.o)
519
524
AC_LBL_TYPE_SIGNAL
566
571
struct in_addr dst;
567
572
inet_aton(src, &dst);],
568
573
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
569
AC_LIBOBJ(inet_aton.o)])
574
AC_LIBOBJ(inet_aton)])
577
# Check for these after AC_LBL_LIBPCAP, for the same reason.
579
# You are in a twisty little maze of UN*Xes, all different.
580
# Some might not have ether_ntohost().
581
# Some might have it, but not declare it in any header file.
582
# Some might have it, but declare it in <netinet/if_ether.h>.
583
# Some might have it, but declare it in <netinet/ether.h>
584
# (And some might have it but document it as something declared in
585
# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
587
# Before you is a C compiler.
589
AC_CHECK_FUNCS(ether_ntohost, [
590
AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
593
#include <sys/types.h>
594
#include <sys/param.h>
595
#include <sys/socket.h>
598
main(int argc, char **argv)
600
u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
601
char name[MAXHOSTNAMELEN];
603
ether_ntohost(name, (struct ether_addr *)ea);
606
], [ac_cv_buggy_ether_ntohost=no],
607
[ac_cv_buggy_ether_ntohost=yes],
608
[ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
609
if test "$ac_cv_buggy_ether_ntohost" = "no"; then
610
AC_DEFINE(USE_ETHER_NTOHOST)
613
if test "$ac_cv_func_ether_ntohost" = yes -a \
614
"$ac_cv_buggy_ether_ntohost" = "no"; then
616
# OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
618
if test "$ac_cv_header_netinet_if_ether_h" = yes; then
620
# Yes. Does it declare ether_ntohost()?
622
AC_CHECK_DECL(ether_ntohost,
624
AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
625
[Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
628
#include <sys/types.h>
629
#include <sys/socket.h>
630
#include <netinet/in.h>
631
#include <arpa/inet.h>
635
#include <netinet/if_ether.h>
641
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
643
# No, how about <netinet/ether.h>, as on Linux?
645
AC_CHECK_HEADERS(netinet/ether.h)
646
if test "$ac_cv_header_netinet_ether_h" = yes; then
648
# We have it - does it declare ether_ntohost()?
649
# Unset ac_cv_have_decl_ether_ntohost so we don't
650
# treat the previous failure as a cached value and
651
# suppress the next test.
653
unset ac_cv_have_decl_ether_ntohost
654
AC_CHECK_DECL(ether_ntohost,
656
AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
657
[Define to 1 if netinet/ether.h declares `ether_ntohost'])
660
#include <netinet/ether.h>
665
# Is ether_ntohost() declared?
667
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
669
# No, we'll have to declare it ourselves.
670
# Do we have "struct ether_addr"?
672
AC_CHECK_TYPES(struct ether_addr,,,
674
#include <sys/types.h>
675
#include <sys/socket.h>
676
#include <netinet/in.h>
677
#include <arpa/inet.h>
681
#include <netinet/if_ether.h>
683
AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
684
[Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
687
AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
688
[Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
571
693
dnl portability macros for getaddrinfo/getnameinfo
579
701
AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)
580
702
if test $ac_cv_func_pcap_findalldevs = "yes" ; then
581
dnl Check for MacOS X, which may ship pcap.h from 0.6 but libpcap may
703
dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
582
704
dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
583
705
dnl have pcap_if_t.
706
savedcflags="$CFLAGS"
707
CFLAGS="$CFLAGS $V_INCLS"
584
708
AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
709
CFLAGS="$savedcflags"
586
712
if test $ac_cv_func_pcap_lib_version = "no" ; then
587
713
AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
591
return_pcap_version(void)
593
716
extern char pcap_version[];
718
return (int)pcap_version;
598
720
ac_lbl_cv_pcap_version_defined=yes,
599
721
ac_lbl_cv_pcap_version_defined=no)
678
AC_LBL_CHECK_TYPE(int8_t, signed char)
679
AC_LBL_CHECK_TYPE(u_int8_t, u_char)
680
AC_LBL_CHECK_TYPE(int16_t, short)
681
AC_LBL_CHECK_TYPE(u_int16_t, u_short)
682
AC_LBL_CHECK_TYPE(int32_t, int)
683
AC_LBL_CHECK_TYPE(u_int32_t, u_int)
792
AC_CHECK_HEADERS(sys/bitypes.h)
794
AC_CHECK_TYPE([int8_t], ,
795
[AC_DEFINE([int8_t], [signed char],
796
[Define to `signed char' if int8_t not defined.])])
797
AC_CHECK_TYPE([u_int8_t], ,
798
[AC_DEFINE([u_int8_t], [unsigned char],
799
[Define to `unsigned char' if u_int8_t not defined.])],
801
#ifdef HAVE_SYS_BITYPES_H
802
#include <sys/bitypes.h>
804
AC_CHECK_TYPE([int16_t], ,
805
[AC_DEFINE([int16_t], [short],
806
[Define to `short' if int16_t not defined.])])
807
AC_CHECK_TYPE([u_int16_t], ,
808
[AC_DEFINE([u_int16_t], [unsigned short],
809
[Define to `unsigned short' if u_int16_t not defined.])],
811
#ifdef HAVE_SYS_BITYPES_H
812
#include <sys/bitypes.h>
814
AC_CHECK_TYPE([int32_t], ,
815
[AC_DEFINE([int32_t], [int],
816
[Define to `int' if int32_t not defined.])])
817
AC_CHECK_TYPE([u_int32_t], ,
818
[AC_DEFINE([u_int32_t], [unsigned int],
819
[Define to `unsigned int' if u_int32_t not defined.])],
821
#ifdef HAVE_SYS_BITYPES_H
822
#include <sys/bitypes.h>
824
AC_CHECK_TYPE([int64_t], ,
825
[AC_DEFINE([int64_t], [long long],
826
[Define to `long long' if int64_t not defined.])])
827
AC_CHECK_TYPE([u_int64_t], ,
828
[AC_DEFINE([u_int64_t], [unsigned long long],
829
[Define to `unsigned long long' if u_int64_t not defined.])],
831
#ifdef HAVE_SYS_BITYPES_H
832
#include <sys/bitypes.h>
836
# We can't just check for <inttypes.h> - some systems have one that
837
# doesn't define all the PRI[doxu]64 macros.
839
AC_CHECK_HEADERS(inttypes.h,
842
# OK, we have inttypes.h, but does it define those macros?
844
AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
849
#include <inttypes.h>
851
#include <sys/types.h>
852
#ifdef HAVE_SYS_BITYPES_H
853
#include <sys/bitypes.h>
858
printf("%" PRId64 "\n", (u_int64_t)1);
859
printf("%" PRIo64 "\n", (u_int64_t)1);
860
printf("%" PRIx64 "\n", (u_int64_t)1);
861
printf("%" PRIu64 "\n", (u_int64_t)1);
867
ac_lbl_inttypes_h_defines_formats=yes
871
ac_lbl_inttypes_h_defines_formats=no
876
# We don't have inttypes.h, so it obviously can't define those
879
ac_lbl_inttypes_h_defines_formats=no
881
if test "$ac_lbl_inttypes_h_defines_formats" = no; then
882
AC_LBL_CHECK_64BIT_FORMAT(l,
884
AC_LBL_CHECK_64BIT_FORMAT(ll,
886
AC_LBL_CHECK_64BIT_FORMAT(L,
888
AC_LBL_CHECK_64BIT_FORMAT(q,
890
AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
685
897
AC_LBL_DEVEL(V_CCOPT)