1 dnl Process this file with autoconf to produce a configure script.
4 dnl Checks for programs.
12 dnl Checks for libraries.
13 dnl AC_CHECK_LIB(c, kvm_open, [], [AC_CHECK_LIB(kvm, kvm_open)])
14 dnl AC_CHECK_LIB(mld, nlist)
17 dnl CFLAGS="-I. $CFLAGS"
18 dnl AC_MSG_CHECKING(for pcap library/header)
19 dnl for dir in /usr/local/libpcap /usr/local/v6 /usr/local \
20 dnl ../libpcap* ../../libpcap*; do
22 dnl ac_cv_pcap_include=no
23 dnl if test -d $dir -a -f $dir/libpcap.a; then
24 dnl ac_cv_pcap_lib="$dir"
25 dnl elif test -d $dir/lib -a -f $dir/lib/libpcap.a; then
26 dnl ac_cv_pcap_lib="$dir/lib"
28 dnl if test -d $dir -a -f $dir/pcap.h; then
29 dnl ac_cv_pcap_include="$dir"
30 dnl elif test -d $dir/include -a -f $dir/include/pcap.h; then
31 dnl ac_cv_pcap_include="$dir/include"
33 dnl if test "$ac_cv_pcap_lib" != "no" -a "$ac_cv_pcap_include" != "no"; then
34 dnl LIBS="-L$ac_cv_pcap_lib $LIBS"
35 dnl CFLAGS="-I$ac_cv_pcap_include $CFLAGS"
39 dnl if test "$ac_cv_pcap_lib" = "no" -a "$ac_cv_pcap_include" = "no"; then
42 dnl AC_MSG_RESULT($ac_cv_pcap_lib and $ac_cv_pcap_include)
44 dnl AC_CHECK_LIB(pcap, pcap_lookupdev, [],
45 dnl [echo "Fatal: libpcap.a not found"
47 dnl AC_TRY_COMPILE([#include <pcap.h>], [], [], [dnl
48 dnl echo "Fatal: pcap.h not found"
51 CFLAGS="$CFLAGS -I\$(srcdir)"
53 dnl On Sun systems, we need to use the standards-compliant 3XNET functions
54 if test -x /usr/bin/sun && /usr/bin/sun; then
55 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
56 LDFLAGS="-lxnet -ldevinfo -lnsl -lsocket -lrt"
59 AC_MSG_CHECKING(for sys/queue.h)
60 AC_TRY_COMPILE([#include <sys/queue.h>],
61 [TAILQ_HEAD(test, none);],
64 CFLAGS="$CFLAGS -I\$(srcdir)/missing"])
67 [#include <netinet/in.h>
70 #endif], [result=kame], [result=regular])
71 AC_MSG_CHECKING(for getaddrinfo/getnameinfo library)
72 AC_MSG_RESULT($result)
74 kame) AC_DEFINE(INET6)
76 LIBS="$LIBS -L/usr/local/v6/lib"
77 AC_CHECK_LIB(inet6, getaddrinfo, [], [LIBS="$o_LIBS"])
82 AC_REPLACE_FUNCS(getaddrinfo)
83 AC_REPLACE_FUNCS(getnameinfo)
84 AC_REPLACE_FUNCS(getifaddrs)
85 AC_CHECK_FUNCS(if_nametoindex)
86 AC_REPLACE_FUNCS(strlcpy strlcat)
87 AC_REPLACE_FUNCS(daemon)
88 AC_REPLACE_FUNCS(warnx)
90 dnl Checks for header files.
92 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h syslog.h unistd.h ifaddrs.h)
93 AC_MSG_CHECKING(for socklen_t)
94 AC_TRY_COMPILE([#include <sys/types.h>
95 #include <sys/socket.h>],
96 [socklen_t x; x = 1; return x;],
99 AC_CHECK_TYPE(socklen_t, int)])
101 dnl Checks for typedefs, structures, and compiler characteristics.
107 AC_CHECK_TYPES([sig_atomic_t], , [AC_DEFINE(sig_atomic_t, u_long)], [#include <sys/types.h>
108 #include <signal.h>])
111 dnl Checks for library functions.
113 AC_PROG_GCC_TRADITIONAL
116 AC_CHECK_FUNCS(mktime select socket)
117 AC_CHECK_FUNCS(clock_gettime)
119 dnl configure local DB directory
120 AC_MSG_CHECKING(for local DB directory)
121 AC_ARG_WITH(localdbdir,
122 [ --with-localdbdir=VALUE where to put local DB files],
123 localdbdir="$withval", localdbdir="/var/db")
124 AC_MSG_RESULT($localdbdir)
127 dnl Checks for arc4random
128 AC_REPLACE_FUNCS(arc4random)
130 AC_MSG_CHECKING(if --enable-pedant option is specified)
131 AC_ARG_ENABLE(pedant, [ --enable-pedant pedantic compilation],
132 [if test "$enableval" = "yes"; then
133 CFLAGS="-Wall -Werror $CFLAGS"
135 AC_MSG_RESULT($enableval);
137 dnl Checks predeclared identifers of function names
138 AC_MSG_CHECKING(ANSI predeclared __func__)
140 [void func(void) {printf("%s\n", __func__);}],
145 if test $pred_func_id = no; then
146 AC_MSG_CHECKING(gcc predelcared __FUNCTION__)
148 [void func(void) {printf("%s\n", __FUNCTION__);}],
154 case $pred_func_id in
156 AC_DEFINE(HAVE_ANSI_FUNC)
159 AC_DEFINE(HAVE_GCC_FUNCTION)
163 dnl DHCP option type values not officially defined
164 dnl (no such option now)
166 dnl Checks the existence of TAILQ_FOREACH_REVERSE
167 AC_MSG_CHECKING(checking the existence TAILQ_FOREACH_REVERSE)
169 [#include <sys/queue.h>
170 #ifdef TAILQ_FOREACH_REVERSE
172 #endif], [result=yes], [result=no])
173 AC_MSG_RESULT($result)
175 yes) tailq_foreach=yes
181 dnl Checks the argument order of TAILQ_FOREACH_REVERSE if it exists
182 if test $tailq_foreach = yes ; then
183 AC_MSG_CHECKING(argument order of TAILQ_FOREACH_REVERSE)
187 #include <sys/queue.h>
189 TAILQ_HEAD(tailhead, entry) head = TAILQ_HEAD_INITIALIZER(head);
191 TAILQ_ENTRY(entry) entries;
195 struct tailhead *headp;
197 TAILQ_FOREACH_REVERSE(p, headp, tailhead, entries) {
201 AC_DEFINE(HAVE_TAILQ_FOREACH_REVERSE)],
203 AC_DEFINE(HAVE_TAILQ_FOREACH_REVERSE_OLD)]);
206 dnl Checks for other features
207 AC_MSG_CHECKING(if you have a length field in struct sockaddr*)
208 AC_CACHE_VAL(ts_cv_sa_len, [dnl
210 #include <sys/types.h>
211 #include <sys/socket.h>
215 ], [ts_cv_sa_len="yes"], [ts_cv_sa_len="no"])])
216 AC_MSG_RESULT($ts_cv_sa_len);
217 if test "$ts_cv_sa_len" = yes; then
218 AC_DEFINE([HAVE_SA_LEN], 1, [Define to 1 if you have a length field in struct sockaddr])
221 dnl configure the ownership of the programs
222 AC_MSG_CHECKING(the owner of the programs)
224 [ --with-user=USER set the owner of the programs],
225 user="$withval", user="bin")
229 dnl configure the group ownership of the programs
230 AC_MSG_CHECKING(the group owner of the programs)
232 [ --with-group=GROUP set the group owner of the programs],
233 group="$withval", group="bin")
234 AC_MSG_RESULT($group)
237 AC_CHECK_HEADERS(stdarg.h)