aboutsummaryrefslogtreecommitdiff
path: root/configure.in
blob: b32a0f93ddf5b0f8fa98015b7ba647946032b702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
dnl Process this file with autoconf to produce a configure script.
AC_INIT(dhcp6c.c)

dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP

dnl Checks for libraries.
dnl AC_CHECK_LIB(c, kvm_open, [], [AC_CHECK_LIB(kvm, kvm_open)])
dnl AC_CHECK_LIB(mld, nlist)

dnl pcap library
dnl CFLAGS="-I. $CFLAGS"
dnl AC_MSG_CHECKING(for pcap library/header)
dnl for dir in /usr/local/libpcap /usr/local/v6 /usr/local \
dnl 		../libpcap* ../../libpcap*; do
dnl 	ac_cv_pcap_lib=no
dnl 	ac_cv_pcap_include=no
dnl 	if test -d $dir -a -f $dir/libpcap.a; then
dnl 		ac_cv_pcap_lib="$dir"
dnl 	elif test -d $dir/lib -a -f $dir/lib/libpcap.a; then
dnl 		ac_cv_pcap_lib="$dir/lib"
dnl 	fi
dnl 	if test -d $dir -a -f $dir/pcap.h; then
dnl 		ac_cv_pcap_include="$dir"
dnl 	elif test -d $dir/include -a -f $dir/include/pcap.h; then
dnl 		ac_cv_pcap_include="$dir/include"
dnl 	fi
dnl 	if test "$ac_cv_pcap_lib" != "no" -a "$ac_cv_pcap_include" != "no"; then
dnl 		LIBS="-L$ac_cv_pcap_lib $LIBS"
dnl 		CFLAGS="-I$ac_cv_pcap_include $CFLAGS"
dnl 		break
dnl 	fi
dnl done
dnl if test "$ac_cv_pcap_lib" = "no" -a "$ac_cv_pcap_include" = "no"; then
dnl 	AC_MSG_RESULT(no)
dnl else
dnl 	AC_MSG_RESULT($ac_cv_pcap_lib and $ac_cv_pcap_include)
dnl fi
dnl AC_CHECK_LIB(pcap, pcap_lookupdev, [],
dnl 	[echo "Fatal: libpcap.a not found"
dnl 	exit 1])
dnl AC_TRY_COMPILE([#include <pcap.h>], [], [], [dnl
dnl 	echo "Fatal: pcap.h not found"
dnl 	exit 1])

CFLAGS="$CFLAGS -I\$(srcdir)"

AC_MSG_CHECKING(for getaddrinfo/getnameinfo library)
AC_EGREP_CPP(yes,
[#include <netinet/in.h>
#ifdef __KAME__
 yes
#endif], [result=kame])
AC_MSG_RESULT($result)
case $result in
kame)	AC_DEFINE(INET6)
	o_LIBS="$LIBS"
	LIBS="$LIBS -L/usr/local/v6/lib"
	AC_CHECK_LIB(inet6, getaddrinfo, [], [LIBS="$o_LIBS"])
	;;
*)	;;
esac

AC_REPLACE_FUNCS(getaddrinfo)
AC_REPLACE_FUNCS(getnameinfo)
AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS), [dnl
	echo FATAL: getifaddrs is required
	exit 1])
AC_CHECK_FUNCS(if_nametoindex)
AC_REPLACE_FUNCS(strlcpy strlcat)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h syslog.h unistd.h ifaddrs.h)
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
	[socklen_t x;  x = 1; return x;],
	[AC_MSG_RESULT(yes)],
	[AC_MSG_RESULT(no)
	AC_CHECK_TYPE(socklen_t, int)])

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE

dnl Checks for library functions.
AC_FUNC_GETPGRP
AC_PROG_GCC_TRADITIONAL
AC_FUNC_SETPGRP
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(mktime select socket)
AC_CHECK_FUNCS(clock_gettime)

dnl configure local DB directory
AC_MSG_CHECKING(for local DB directory)
AC_ARG_WITH(localdbdir,
[  --with-localdbdir=VALUE where to put local DB files],
    localdbdir="$withval", localdbdir="/var/db")
AC_MSG_RESULT($localdbdir)
AC_SUBST(localdbdir)

dnl Checks for arc4random
AC_REPLACE_FUNCS(arc4random)

AC_MSG_CHECKING(if --enable-pedant option is specified)
AC_ARG_ENABLE(pedant, [  --enable-pedant         pedantic compilation],
	[if test "$enableval" = "yes"; then
		CFLAGS="-Wall -Werror $CFLAGS"
	fi], [enableval=no])
AC_MSG_RESULT($enableval);

dnl Checks predeclared identifers of function names
AC_MSG_CHECKING(ANSI predeclared __func__)
AC_TRY_COMPILE([],
[void func(void) {printf("%s\n", __func__);}],
	[AC_MSG_RESULT(yes)
	 pred_func_id=ansi],
	[AC_MSG_RESULT(no)
	 pred_func_id=no])
if test $pred_func_id = no; then
AC_MSG_CHECKING(gcc predelcared __FUNCTION__)
	AC_TRY_COMPILE([],
	[void func(void) {printf("%s\n", __FUNCTION__);}],
		[AC_MSG_RESULT(yes)
		 pred_func_id=gcc],
		[AC_MSG_RESULT(no)
		 pred_func_id=no])
fi
case $pred_func_id in
	ansi)
		AC_DEFINE(HAVE_ANSI_FUNC)
		;;
	gcc)
		AC_DEFINE(HAVE_GCC_FUNCTION)
		;;
esac

dnl DHCP option type values that have been assigned very recently:
dnl These values may need be configurable for interoperability with
dnl prior experimental implementations.
AC_MSG_CHECKING(for DHCP DNS option)
AC_ARG_WITH(opt-dns,
[  --with-opt-dns=VALUE    specify DHCP option value for DNS],
    dhcpopt_dns="$withval", dhcpopt_dns=0)
if test $dhcpopt_dns != 0 ; then
	AC_MSG_RESULT(using $dhcpopt_dns)
	DHCPOPT_DNS="-DDH6OPT_DNS=$dhcpopt_dns"
	AC_SUBST(DHCPOPT_DNS)
else
	AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for DHCP DNS_NAME option)
AC_ARG_WITH(opt-dnsname,
[  --with-opt-dnsname=VALUE    specify DHCP option value for DNS_NAME],
    dhcpopt_dnsname="$withval", dhcpopt_dnsname=0)
if test $dhcpopt_dnsname != 0 ; then
	AC_MSG_RESULT(using $dhcpopt_dnsname)
	DH6OPT_DNSNAME="-DDH6OPT_DNSNAME=$dhcpopt_dnsname"
	AC_SUBST(DH6OPT_DNSNAME)
else
	AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for DHCP IA_PD option)
AC_ARG_WITH(opt-ia-pd,
[  --with-opt-ia-pd=VALUE  specify DHCP option value for IA_PD],
    dhcpopt_ia_pd="$withval", dhcpopt_ia_pd=0)
if test $dhcpopt_ia_pd != 0 ; then
	AC_MSG_RESULT(using $dhcpopt_ia_pd)
	DH6OPT_IA_PD="-DDH6OPT_IA_PD=$dhcpopt_ia_pd"
	AC_SUBST(DH6OPT_IA_PD)
else
	AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for DHCP IA_PD_PREFIX option)
AC_ARG_WITH(opt-ia-pd-prefix,
[  --with-opt-ia-pd-prefix=VALUE   specify DHCP option value for IA_PD prefix],
    dhcpopt_ia_pd_prefix="$withval", dhcpopt_ia_pd_prefix=0)
if test $dhcpopt_ia_pd_prefix != 0 ; then
	AC_MSG_RESULT(using $dhcpopt_ia_pd_prefix)
	DH6OPT_IA_PD_PREFIX="-DDH6OPT_IA_PD_PREFIX=$dhcpopt_ia_pd_prefix"
	AC_SUBST(DH6OPT_IA_PD_PREFIX)
else
	AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for DHCP information refresh time option)
AC_ARG_WITH(opt-refreshtime,
[  --with-opt-refreshtime=VALUE    specify DHCP option value for refresh time],
    dhcpopt_refreshtime="$withval", dhcpopt_refreshtime=0)
if test $dhcpopt_refreshtime != 0 ; then
	AC_MSG_RESULT(using $dhcpopt_refresh)
	DH6OPT_REFRESHTIME="-DDH6OPT_REFRESHTIME=$dhcpopt_refreshtime"
	AC_SUBST(DH6OPT_REFRESHTIME)
else
	AC_MSG_RESULT(no)
fi

dnl DHCP option type values not officially defined
AC_MSG_CHECKING(for DHCP NTP option)
AC_ARG_WITH(opt-ntp,
[  --with-opt-ntp=VALUE    specify DHCP option value for NTP],
    dhcpopt_ntp="$withval", dhcpopt_ntp=0)
if test $dhcpopt_ntp = 0 ; then
	dhcpopt_ntp=-1
	AC_MSG_RESULT(unspecified)
else
	AC_MSG_RESULT(using $dhcpopt_ntp)
fi
AC_SUBST(dhcpopt_ntp)

AC_CHECK_HEADERS(stdarg.h)

AC_OUTPUT(Makefile)