4 AH_TEMPLATE([HAVE_GETHOSTBYADDR_R_5], [Set to 1 if gethostbyaddr_r takes 5 arguments])
5 AH_TEMPLATE([HAVE_GETHOSTBYADDR_R_7], [Set to 1 if gethostbyaddr_r takes 7 arguments])
6 AH_TEMPLATE([HAVE_GETHOSTBYADDR_R_8], [Set to 1 if gethostbyaddr_r takes 8 arguments])
7 AH_TEMPLATE([HAVE_PCAP_FREECODE_2], [Set to 1 if pcap_freecode takes 2 arguments])
8 AH_TEMPLATE([HAVE_PCAP_FREECODE_1], [Set to 1 if pcap_freecode takes 1 argument])
9 AH_TEMPLATE([HAVE_IP6_S6_ADDR32], [Set to 1 if struct in6_addr contains s6_addr32 member])
10 AH_TEMPLATE([HAVE_IP6__S6_UN__S6_U32], [Set to 1 if struct in6_addr contains _S6_un._S6_u32 member])
11 AH_TEMPLATE([HAVE_IP6___U6_ADDR___U6_ADDR32], [Set to 1 if struct in6_addr contains __u6_addr.__u6_addr32 member])
12 AH_TEMPLATE([NEED_REENTRANT], [Set to 1 if gethostbyaddr_r requires _REENTRANT symbol to be defined])
14 AC_DEFUN(AC_NETTOP_GCC_FLAGS,
16 if test "$GCC" = "yes"; then
17 CFLAGS="$CFLAGS -Wall"
23 # AC_NETTOP_GETHOSTBY_LIB_CHECK
25 # Checks whether we need "-lnsl" to get "gethostby*()", which we use
28 # Copied from EtherReal package ;
29 # Done by Jakub Skopal <j@kubs.cz> on 2002-08-22.
31 # Adapted from stuff in the AC_PATH_XTRA macro in "acspecific.m4" in
32 # GNU Autoconf 2.13; the comment came from there.
33 # Done by Guy Harris <guy@alum.mit.edu> on 2000-01-14.
35 AC_DEFUN(AC_NETTOP_GETHOSTBY_LIB_CHECK,
37 # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
38 # to get the SysV transport functions.
39 # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4)
41 # The nsl library prevents programs from opening the X display
42 # on Irix 5.2, according to dickey@clark.net.
43 AC_CHECK_FUNC(gethostbyname, ,
44 AC_CHECK_LIB(nsl, gethostbyname, NSL_LIBS="-lnsl"))
50 # AC_NETTOP_SOCKET_LIB_CHECK
52 # Checks whether we need "-lsocket" to get "socket()", which is used
53 # by libpcap on some platforms - and, in effect, "gethostby*()" on
54 # most if not all platforms (so that it can use NIS or DNS or...
55 # to look up host names).
57 # Copied from EtherReal package ;
58 # Done by Jakub Skopal <j@kubs.cz> on 2002-08-22.
60 # Adapted from stuff in the AC_PATH_XTRA macro in "acspecific.m4" in
61 # GNU Autoconf 2.13; the comment came from there.
62 # Done by Guy Harris <guy@alum.mit.edu> on 2000-01-14.
64 # We use "connect" because that's what AC_PATH_XTRA did.
66 AC_DEFUN(AC_NETTOP_SOCKET_LIB_CHECK,
68 # lieder@skyler.mavd.honeywell.com says without -lsocket,
69 # socket/setsockopt and other routines are undefined under SCO ODT
70 # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
71 # on later versions), says simon@lia.di.epfl.ch: it contains
72 # gethostby* variants that don't use the nameserver (or something).
73 # -lsocket must be given before -lnsl if both are needed.
74 # We assume that if connect needs -lnsl, so does gethostbyname.
75 AC_CHECK_FUNC(connect, ,
76 AC_CHECK_LIB(socket, connect, SOCKET_LIBS="-lsocket",
77 AC_MSG_ERROR(Function 'socket' not found.), $NSL_LIBS))
82 # AC_NETTOP_PCAP_CHECK
84 AC_DEFUN(AC_NETTOP_PCAP_CHECK,
86 if test -z "$pcap_dir"
89 # The user didn't specify a directory in which libpcap resides;
90 # we assume that the current library search path will work,
91 # but we may have to look for the header in a "pcap"
92 # subdirectory of "/usr/include" or "/usr/local/include",
93 # as some systems apparently put "pcap.h" in a "pcap"
94 # subdirectory, and we also check "$prefix/include".
96 # XXX - should we just add "$prefix/include" to the include
97 # search path and "$prefix/lib" to the library search path?
99 AC_MSG_CHECKING(for extraneous pcap header directories)
101 for pcap_dir in /usr/include/pcap /usr/local/include/pcap $prefix/include
103 if test -d $pcap_dir ; then
104 if test x$pcap_dir != x/usr/include; then
105 CFLAGS="$CFLAGS -I$pcap_dir"
106 CPPFLAGS="$CPPFLAGS -I$pcap_dir"
108 found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
112 if test "$found_pcap_dir" != "" ; then
113 AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
115 AC_MSG_RESULT(not found)
119 # The user specified a directory in which libpcap resides,
120 # so add the "include" subdirectory of that directory to
121 # the include file search path and the "lib" subdirectory
122 # of that directory to the library search path.
124 # XXX - if there's also a libpcap in a directory that's
125 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
126 # make us find the version in the specified directory,
127 # as the compiler and/or linker will search that other
128 # directory before it searches the specified directory.
130 CFLAGS="$CFLAGS -I$pcap_dir/include"
131 CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
132 LDFLAGS="$LDFLAGS -L$pcap_dir/lib"
136 AC_CHECK_HEADER(pcap.h,, AC_MSG_ERROR(Header file pcap.h not found.))
138 AC_CHECK_LIB(pcap, pcap_open_live,, AC_MSG_ERROR(Library libpcap not found.),
139 $SOCKET_LIBS $NSL_LIBS)
142 dnl ************************************************************
143 dnl check for "localhost", if it doesn't exist, we can't do the
144 dnl gethostbyname_r tests!
146 dnl Copied from cURL package ;
147 dnl Done by Jakub Skopal <j@kubs.cz> on 2002-08-28.
150 AC_DEFUN(AC_NETTOP_CHECK_WORKING_RESOLVER,[
151 AC_MSG_CHECKING([if "localhost" resolves])
154 #include <sys/types.h>
160 h = gethostbyname("localhost");
161 exit (h == NULL ? 1 : 0); }],[
162 AC_MSG_RESULT(yes)],[
164 AC_MSG_ERROR([can't figure out gethostbyname_r() since localhost doesn't resolve])
171 dnl Try to discover struct in6_addr members
173 AC_DEFUN(AC_NETTOP_CHECK_IN6_ADDR,
175 AC_MSG_CHECKING([if struct in6_addr contains s6_addr32 member])
177 #include <sys/types.h>
178 #include <netinet/in.h>],[
183 AC_DEFINE(HAVE_IP6_S6_ADDR32)],[
185 AC_MSG_CHECKING([if struct in6_addr contains _S6_un._S6_u32 member])
187 #include <sys/types.h>
188 #include <netinet/in.h>],[
190 adr._S6_un._S6_u32[0]=0;
193 AC_DEFINE(HAVE_IP6__S6_UN__S6_U32)],[
195 AC_MSG_CHECKING([if struct in6_addr contains __u6_addr.__u6_addr32 member])
197 #include <sys/types.h>
198 #include <netinet/in.h>],[
200 adr.__u6_addr.__u6_addr32[0]=0;
203 AC_DEFINE(HAVE_IP6___U6_ADDR___U6_ADDR32)],[
205 AC_MSG_ERROR([can't figure out members of struct in6_addr])
215 dnl Find number of arguments of pcap_freecode
217 AC_DEFUN(AC_NETTOP_CHECK_PCAP_FREECODE,
219 dnl check for number of arguments to pcap_freecode. it might take
221 AC_MSG_CHECKING(if pcap_freecode takes 2 arguments)
224 struct bpf_program *program;
226 pcap_freecode(pcap, program);],[
228 AC_DEFINE(HAVE_PCAP_FREECODE_2)
229 ac_cv_pcap_freecode_args=2],[
231 AC_MSG_CHECKING(if pcap_freecode takes 1 argument)
234 struct bpf_program *program;
235 pcap_freecode(program);],[
237 AC_DEFINE(HAVE_PCAP_FREECODE_1)
238 ac_cv_pcap_freecode_args=1],[
240 AC_MSG_ERROR([cannot discover number of arguments of pcap_freecode])
248 dnl Copied from cURL package ;
249 dnl Done by Jakub Skopal <j@kubs.cz> on 2002-08-28.
251 AC_DEFUN(AC_NETTOP_CHECK_GETHOSTBYADDR_R,
253 AC_ARG_ENABLE(multithreaded-resolver, AC_HELP_STRING([--disable-multithreaded-resolver],[do not try to use multithreaded resolver !!FreeBSD!!]), disable_multithreaded_resolver=yes)
255 if test "x$disable_multithreaded_resolver" != "xyes"; then
257 if uname -a | grep "FreeBSD" > /dev/null 2>&1; then
258 echo "**********************************************************************"
259 echo "** configure script detected, that you're using FreeBSD. **"
260 echo "** 5.1-RELEASE and maybe others have been found to contain **"
261 echo "** bogus implementation of gethostbyaddr_r function. **"
263 echo "** IN CASE YOU ENCOUNTER ANY Bus Error OR SegFault PROBLEMS WITH **"
264 echo "** jnettop, PLEASE SPECIFY --disable-multithreaded-resolver **"
265 echo "** OPTION TO CONFIGURE SCRIPT!! **"
266 echo "**********************************************************************"
269 dnl check for number of arguments to gethostbyaddr_r. it might take
270 dnl either 5, 7, or 8 arguments.
271 AC_CHECK_FUNCS(gethostbyaddr_r,[
272 AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
274 #include <sys/types.h>
275 #include <netdb.h>],[
280 struct hostent_data hdata;
282 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
284 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
285 ac_cv_gethostbyaddr_args=5],[
287 AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
290 #include <sys/types.h>
291 #include <netdb.h>],[
296 struct hostent_data hdata;
298 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
300 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
301 AC_DEFINE(NEED_REENTRANT)
302 ac_cv_gethostbyaddr_args=5],[
304 AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
306 #include <sys/types.h>
307 #include <netdb.h>],[
317 rc = gethostbyaddr_r(address, length, type, &h,
318 buffer, 8192, &hp, &h_errnop);],[
320 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
321 ac_cv_gethostbyaddr_args=8],[
323 have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])