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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
|
dnl ######################################################################
dnl Common IPv6 detection for NTP configure.ac files
AC_DEFUN([NTP_IPV6], [
AC_CACHE_CHECK(
[for struct sockaddr_storage],
[ntp_cv_sockaddr_storage],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]],
[[
struct sockaddr_storage n;
]]
)],
[ntp_cv_sockaddr_storage=yes],
[ntp_cv_sockaddr_storage=no]
)]
)
case "$ntp_cv_sockaddr_storage" in
yes)
AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
[Does a system header define struct sockaddr_storage?])
AC_CACHE_CHECK(
[for sockaddr_storage.__ss_family],
[ntp_cv_have___ss_family],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]],
[[
struct sockaddr_storage s;
s.__ss_family = 1;
]]
)],
[ntp_cv_have___ss_family=yes],
[ntp_cv_have___ss_family=no]
)]
)
case "$ntp_cv_have___ss_family" in
yes)
AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
[Does struct sockaddr_storage have __ss_family?])
esac
AH_VERBATIM(
[HAVE___SS_FAMILY_IN_SS_VERBATIM],
[
/* Handle sockaddr_storage.__ss_family */
#ifdef HAVE___SS_FAMILY_IN_SS
# define ss_family __ss_family
#endif /* HAVE___SS_FAMILY_IN_SS */
]
)
esac
#
# Look for in_port_t.
#
AC_CACHE_CHECK(
[for in_port_t],
[isc_cv_have_in_port_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <netinet/in.h>
]],
[[
in_port_t port = 25;
return (0);
]]
)],
[isc_cv_have_in_port_t=yes],
[isc_cv_have_in_port_t=no]
)]
)
case "$isc_cv_have_in_port_t" in
no)
AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
[Declare in_port_t?])
esac
AC_CACHE_CHECK(
[type of socklen arg for getsockname()],
[ntp_cv_getsockname_socklen_type],
[
getsockname_socklen_type_found=no
for getsockname_arg2 in 'struct sockaddr *' 'void *'; do
for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]], [[
extern
getsockname(int, $getsockname_arg2,
$ntp_cv_getsockname_socklen_type *);
]]
)],
[getsockname_socklen_type_found=yes ; break 2],
[]
)
done
done
case "$getsockname_socklen_type_found" in
no)
ntp_cv_getsockname_socklen_type='socklen_t'
esac
AS_UNSET([getsockname_arg2])
AS_UNSET([getsockname_socklen_type_found])
]
)
AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
[$ntp_cv_getsockname_socklen_type],
[What is getsockname()'s socklen type?])
AC_CACHE_CHECK(
[struct sockaddr for sa_len],
[isc_cv_platform_havesalen],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/socket.h>
]],
[[
extern struct sockaddr *ps;
return ps->sa_len;
]]
)],
[isc_cv_platform_havesalen=yes],
[isc_cv_platform_havesalen=no]
)]
)
case "$isc_cv_platform_havesalen" in
yes)
AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
[struct sockaddr has sa_len?])
esac
AC_ARG_ENABLE(
[ipv6],
[AS_HELP_STRING(
[--enable-ipv6],
[s use IPv6?]
)]
)
case "$enable_ipv6" in
yes|''|autodetect)
case "$host" in
powerpc-ibm-aix4*)
;;
*)
AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
;;
esac
;;
no)
;;
esac
dnl [Bug 1984] ntp/libisc fails to compile on OS X 10.7 (Lion)
case "$host" in
*-*-darwin*)
AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Are we _special_?])
esac
AC_CACHE_CHECK(
[for IPv6 structures],
[isc_cv_found_ipv6],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
]],
[[
struct sockaddr_in6 sin6;
]]
)],
[isc_cv_found_ipv6=yes],
[isc_cv_found_ipv6=no]
)]
)
#
# See whether IPv6 support is provided via a Kame add-on.
# This is done before other IPv6 linking tests so LIBS is properly set.
#
AC_MSG_CHECKING([for Kame IPv6 support])
AC_ARG_WITH(
[kame],
[AS_HELP_STRING(
[--with-kame],
[- =/usr/local/v6]
)],
[use_kame="$withval"],
[use_kame="no"]
)
case "$use_kame" in
no)
;;
yes)
kame_path=/usr/local/v6
;;
*)
kame_path="$use_kame"
;;
esac
case "$use_kame" in
no)
AC_MSG_RESULT([no])
;;
*)
if test -f $kame_path/lib/libinet6.a; then
AC_MSG_RESULT([$kame_path/lib/libinet6.a])
LIBS="-L$kame_path/lib -linet6 $LIBS"
else
AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
Please choose the proper path with the following command:
configure --with-kame=PATH
])
fi
;;
esac
#
# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
# Including it on Kame-using platforms is very bad, though, because
# Kame uses #error against direct inclusion. So include it on only
# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
# This is done before the in6_pktinfo check because that's what
# netinet6/in6.h is needed for.
#
case "$host" in
*-bsdi4.[[01]]*)
AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
[Do we need netinet6/in6.h?])
isc_netinet6in6_hack="#include <netinet6/in6.h>"
;;
*)
isc_netinet6in6_hack=""
;;
esac
#
# This is similar to the netinet6/in6.h issue.
#
case "$host" in
*-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
[Do we need to fix in6isaddr?])
isc_netinetin6_hack="#include <netinet/in6.h>"
;;
*)
isc_netinetin6_hack=""
;;
esac
case "$isc_cv_found_ipv6" in
yes)
AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
AC_CACHE_CHECK(
[for in6_pktinfo],
[isc_cv_have_in6_pktinfo],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
$isc_netinetin6_hack
$isc_netinet6in6_hack
]],
[[
struct in6_pktinfo xyzzy;
]]
)],
[isc_cv_have_in6_pktinfo=yes],
[isc_cv_have_in6_pktinfo=no]
)]
)
case "$isc_cv_have_in6_pktinfo" in
yes)
AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
[have struct in6_pktinfo?])
esac
# HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
AC_CACHE_CHECK(
[for sockaddr_in6.sin6_scope_id],
[isc_cv_have_sin6_scope_id],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
$isc_netinetin6_hack
$isc_netinet6in6_hack
]],
[[
struct sockaddr_in6 xyzzy;
xyzzy.sin6_scope_id = 0;
]]
)],
[isc_cv_have_sin6_scope_id=yes],
[isc_cv_have_sin6_scope_id=no]
)]
)
case "$isc_cv_have_sin6_scope_id" in
yes)
AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
esac
esac
# We need this check run even without isc_cv_found_ipv6=yes
AC_CACHE_CHECK(
[for in6addr_any],
[isc_cv_in6addr_any_links],
[
SAVED_LIBS="$LIBS"
LIBS="$LDADD_LIBNTP $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
AC_INCLUDES_DEFAULT [[
#include <sys/socket.h>
#include <netinet/in.h>
$isc_netinetin6_hack
$isc_netinet6in6_hack
]],
[[
printf("%x", in6addr_any.s6_addr[15]);
]]
)],
[isc_cv_in6addr_any_links=yes],
[isc_cv_in6addr_any_links=no]
)
LIBS="$SAVED_LIBS"
AS_UNSET([SAVED_LIBS])
]
)
case "$isc_cv_in6addr_any_links" in
no)
AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
esac
AC_CACHE_CHECK(
[for struct if_laddrconf],
[isc_cv_struct_if_laddrconf],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <net/if6.h>
]],
[[
struct if_laddrconf a;
]]
)],
[isc_cv_struct_if_laddrconf=yes],
[isc_cv_struct_if_laddrconf=no]
)]
)
case "$isc_cv_struct_if_laddrconf" in
yes)
AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
[have struct if_laddrconf?])
esac
AC_CACHE_CHECK(
[for struct if_laddrreq],
isc_cv_struct_if_laddrreq,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <net/if6.h>
]],
[[
struct if_laddrreq a;
]]
)],
[isc_cv_struct_if_laddrreq=yes],
[isc_cv_struct_if_laddrreq=no]
)]
)
case "$isc_cv_struct_if_laddrreq" in
yes)
AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
[have struct if_laddrreq?])
esac
AC_CACHE_CHECK(
[for multicast IP support],
[ntp_cv_multicast],
[
ntp_cv_multicast=no
case "$host" in
i386-sequent-sysv4)
;;
*)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]],
[[
struct ip_mreq ipmr;
ipmr.imr_interface.s_addr = 0;
]]
)],
[ntp_cv_multicast=yes],
[]
)
;;
esac
]
)
case "$ntp_cv_multicast" in
yes)
AC_DEFINE([MCAST], [1], [Does the target support multicast IP?])
AC_CACHE_CHECK(
[arg type needed for setsockopt() IP*_MULTICAST_LOOP],
[ntp_cv_typeof_ip_multicast_loop],
[
case "$host" in
*-*-netbsd*|*-*-*linux*)
ntp_cv_typeof_ip_multicast_loop=u_int
;;
*)
ntp_cv_typeof_ip_multicast_loop=u_char
;;
esac
]
)
AC_DEFINE_UNQUOTED([TYPEOF_IP_MULTICAST_LOOP],
[$ntp_cv_typeof_ip_multicast_loop],
[What type to use for setsockopt])
esac
AC_ARG_ENABLE(
[getifaddrs],
[AS_HELP_STRING(
[--enable-getifaddrs],
[+ Enable the use of getifaddrs() [[yes|no]].]
)],
[want_getifaddrs="$enableval"],
[want_getifaddrs="yes"]
)
case $want_getifaddrs in
glibc)
AC_MSG_WARN([--enable-getifaddrs=glibc is no longer required])
esac
case $want_getifaddrs in
no)
;;
*)
SAVED_LIBS="$LIBS"
LIBS="$LDADD_LIBNTP $LIBS"
AC_CHECK_FUNCS([getifaddrs])
LIBS="$SAVED_LIBS"
AS_UNSET([SAVED_LIBS])
;;
esac
#
# Check for if_nametoindex() for IPv6 scoped addresses support
#
case "$host" in
*-hp-hpux*)
AC_SEARCH_LIBS([if_nametoindex], [ipv6])
esac
SAVED_LIBS="$LIBS"
LIBS="$LDADD_LIBNTP $LIBS"
AC_CHECK_FUNCS([if_nametoindex])
LIBS="$SAVED_LIBS"
AS_UNSET([SAVED_LIBS])
case "$ac_cv_func_if_nametoindex" in
yes)
AC_DEFINE([ISC_PLATFORM_HAVEIFNAMETOINDEX], [1],
[ISC: do we have if_nametoindex()?])
esac
])dnl
dnl ======================================================================
|