File: configure.in

package info (click to toggle)
wide-dhcpv6 20080615-22
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,616 kB
  • sloc: ansic: 14,877; yacc: 1,114; sh: 615; lex: 469; makefile: 119
file content (246 lines) | stat: -rw-r--r-- 6,577 bytes parent folder | download | duplicates (2)
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
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
AC_PROG_YACC
AC_PROG_LEX

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)"

dnl On Sun systems, we need to use the standards-compliant 3XNET functions
if test -x /usr/bin/sun && /usr/bin/sun; then
	CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
	LDFLAGS="-lxnet -ldevinfo -lnsl -lsocket -lrt"
fi

AC_MSG_CHECKING(for sys/queue.h)
AC_TRY_COMPILE([#include <sys/queue.h>],
	[TAILQ_HEAD(test, none);],
	[AC_MSG_RESULT(yes)],
	[AC_MSG_RESULT(no)
	CFLAGS="$CFLAGS -I\$(srcdir)/missing"])

AC_EGREP_CPP(yes,
[#include <netinet/in.h>
#if defined (__KAME__) || defined (__FreeBSD_kernel__)
 yes
#endif], [result=kame], [result=regular])
AC_MSG_CHECKING(for getaddrinfo/getnameinfo library)
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_REPLACE_FUNCS(getifaddrs)
AC_CHECK_FUNCS(if_nametoindex)
AC_REPLACE_FUNCS(strlcpy strlcat)
AC_REPLACE_FUNCS(daemon)
AC_REPLACE_FUNCS(warnx)

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
AC_CHECK_TYPES([sig_atomic_t], , [AC_DEFINE(sig_atomic_t, u_long)], [#include <sys/types.h>
	#include <signal.h>])


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 not officially defined
dnl (no such option now)

dnl Checks the existence of TAILQ_FOREACH_REVERSE
AC_MSG_CHECKING(checking the existence TAILQ_FOREACH_REVERSE)
AC_EGREP_CPP(yes,
[#include <sys/queue.h>
 #ifdef TAILQ_FOREACH_REVERSE
  yes
#endif], [result=yes], [result=no])
AC_MSG_RESULT($result)
case $result in
yes)	tailq_foreach=yes
 	;;
*)	tailq_foreach=no
	;;
esac

dnl Checks the argument order of TAILQ_FOREACH_REVERSE if it exists
if test $tailq_foreach = yes ; then
	AC_MSG_CHECKING(argument order of TAILQ_FOREACH_REVERSE)
	AC_TRY_COMPILE([],
	[
	#include <stdio.h>
	#include <sys/queue.h>

	TAILQ_HEAD(tailhead, entry) head = TAILQ_HEAD_INITIALIZER(head);
	struct entry {
		TAILQ_ENTRY(entry) entries;
	} *p;

	int i;
	struct tailhead *headp;

	TAILQ_FOREACH_REVERSE(p, headp, tailhead, entries) {
	}
	],
	[AC_MSG_RESULT(new)
	 AC_DEFINE(HAVE_TAILQ_FOREACH_REVERSE)],
	[AC_MSG_RESULT(old)
	 AC_DEFINE(HAVE_TAILQ_FOREACH_REVERSE_OLD)]);
fi

dnl Checks for other features
AC_MSG_CHECKING(if you have a length field in struct sockaddr*)
AC_CACHE_VAL(ts_cv_sa_len, [dnl
 AC_TRY_COMPILE([
 #include <sys/types.h>
 #include <sys/socket.h>
 ], [ 
 struct sockaddr a;
 a.sa_len = 1;
 ], [ts_cv_sa_len="yes"], [ts_cv_sa_len="no"])])
AC_MSG_RESULT($ts_cv_sa_len);
if test "$ts_cv_sa_len" = yes; then
	AC_DEFINE([HAVE_SA_LEN], 1, [Define to 1 if you have a length field in struct sockaddr])
fi

dnl configure the ownership of the programs
AC_MSG_CHECKING(the owner of the programs)
AC_ARG_WITH(user,
[  --with-user=USER	set the owner of the programs],
    user="$withval", user="bin")
AC_MSG_RESULT($user)
AC_SUBST(user)

dnl configure the group ownership of the programs
AC_MSG_CHECKING(the group owner of the programs)
AC_ARG_WITH(group,
[  --with-group=GROUP	set the group owner of the programs],
    group="$withval", group="bin")
AC_MSG_RESULT($group)
AC_SUBST(group)

AC_CHECK_HEADERS(stdarg.h)

AC_MSG_CHECKING(whether libc defines struct in6_pktinfo)
AC_TRY_COMPILE([#include <netinet/in.h>],
 [struct in6_pktinfo p6;],
 [AC_MSG_RESULT(yes)
  CFLAGS="$CFLAGS -DHAVE_IN6_PKTINFO"],
 [AC_MSG_RESULT(no)])

AC_OUTPUT(Makefile)