-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
4443 lines (4139 loc) · 91.1 KB
/
configure.ac
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
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl NTP top-level configure.ac -*- Autoconf -*-
dnl
m4_include([sntp/m4/version.m4])
AC_PREREQ([2.61])
AC_INIT(
[ntp],
[VERSION_NUMBER],
[http://bugs.ntp.org./],
[],
[http://www.ntp.org./]dnl
)
AC_CONFIG_MACRO_DIR([sntp/m4])
AC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
AC_LANG([C])
AC_PRESERVE_HELP_ORDER
# Bump ntp_configure_cache_version for each change to configure.ac or
# .m4 files which invalidates cached values from previous configure
# runs.
#
# If the change affects cache variables used only by the main NTP
# configure.ac, then only its version number should be bumped, while
# the subdir configure.ac version numbers should be unchanged. The
# same is true for a test/variable that is used only by one subdir
# being changed incompatibly; only that subdir's cache version needs
# bumping.
#
# If a change affects variables shared by all NTP configure scripts,
# please bump the version numbers of each. If you are not sure, the
# safe choice is to bump all on any cache-invalidating change.
#
# In order to avoid the risk of version stamp collision between -stable
# and -dev branches, do not simply increment the version, instead use
# the date YYYYMMDD optionally with -HHMM if there is more than one
# bump in a day.
ntp_configure_cache_version=20120806
# When the cache version of config.cache and configure do not
# match, NTP_CACHEVERSION will flush the cache.
NTP_CACHEVERSION([main], [$ntp_configure_cache_version])
AM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
dnl AM_SILENT_RULES req. automake 1.11. [yes] defaults V=0
m4_ifdef(
[AM_SILENT_RULES],
[AM_SILENT_RULES([yes])]
)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl the 'build' machine is where we run configure and compile
dnl the 'host' machine is where the resulting stuff runs.
AC_DEFINE_UNQUOTED([STR_SYSTEM], ["$host"],
[canonical system (cpu-vendor-os) of where we should run])
AC_CONFIG_HEADERS([config.h])
dnl AC_ARG_PROGRAM
ntp_atom_ok=${ntp_atom_ok=no}
ntp_oncore_ok=${ntp_oncore_ok=no}
ntp_parse_ok=${ntp_parse_ok=no}
ntp_ripe_ncc_ok=${ntp_parse_ok=no}
ntp_jupiter_ok=${ntp_jupiter_ok=no}
NTP_PROG_CC
AC_PROG_CPP
# Do we need CXX for anything besides google test?
AC_PROG_CXX
AC_PROG_YACC
AC_PROG_CC_C_O
AX_C99_STRUCT_INIT
NTP_VPATH_HACK dnl used only by ntpd/Makefile.am
NTP_LOCINFO([sntp]) dnl takes over from NTP_BINDIR, in NTP_LIBNTP
dnl AM_PROG_AR req. automake 1.12
m4_ifdef(
[AM_PROG_AR],
[AM_PROG_AR]
)
# So far, the only shared library we might use is libopts.
# It's a small library - we might as well use a static version of it.
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])
# NTP has (so far) been relying on leading-edge autogen, which
# means we need the appropriate corresponding libopts as well.
# Therefore, by default:
# - use the version of libopts we ship with
# - do not install it
# - build a static copy (AC_DISABLE_SHARED - done earlier)
case "${enable_local_libopts+set}" in
set) ;;
*) enable_local_libopts=yes ;;
esac
case "${enable_libopts_install+set}" in
set) ;;
*) enable_libopts_install=no ;;
esac
enable_nls=no
LIBOPTS_CHECK_NOBUILD([sntp/libopts])
NTP_LIBEVENT_CHECK_NOBUILD([2], [sntp/libevent])
NTP_LIBNTP
AC_MSG_CHECKING([for deprecated --with-arlib])
AC_ARG_WITH([arlib],
AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
[ans=$withval], [ans=no])
AC_MSG_RESULT([$ans])
case "$ans" in
yes)
AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included. In the future, --with-arlib will not be recognized.])
;;
esac
dnl we need to check for cross compile tools for vxWorks here
AC_PROG_AWK
AS_UNSET([ac_cv_prog_AWK])
AC_SUBST([AWK]) dnl scripts/ntpver.in
AC_PROG_MAKE_SET
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])
AC_PROG_LN_S
AC_ISC_POSIX
AC_PATH_PROG([PATH_PERL], [perl])
dnl Saving cached hardcoded paths rather than searching $PATH during a
dnl cached configure run is an optimization not worth the the cost of
dnl preventing newly-installed tools from being found. Short-circuit
dnl the caching after the tests so preset overrides still work.
AS_UNSET([ac_cv_path_PATH_PERL])
AC_PATH_PROG([PATH_TEST], [test])
AS_UNSET([ac_cv_path_PATH_TEST])
test -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
AC_SUBST([CONFIG_SHELL]) dnl for scripts #!/path/to/sh
AC_ARG_WITH(
[net-snmp-config],
[AS_HELP_STRING(
[--with-net-snmp-config],
[+ =net-snmp-config]
)],
[ans=$withval],
[ans=yes]
)
case "$ans" in
no)
;;
yes)
ans=net-snmp-config
;;
/*)
;;
*/*)
AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
;;
*)
;;
esac
PROG_NET_SNMP_CONFIG=$ans
AC_MSG_CHECKING([for net-snmp-config path])
case "$PROG_NET_SNMP_CONFIG" in
no) ;;
/*)
PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
;;
*)
AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
;;
esac
AC_MSG_RESULT([$PATH_NET_SNMP_CONFIG])
case "$PATH_NET_SNMP_CONFIG" in
/*) AC_CACHE_CHECK(
[for net-snmp version],
[ntp_cv_net_snmp_version],
[ntp_cv_net_snmp_version=`$PATH_NET_SNMP_CONFIG --version`]
)
;;
esac
case "$host" in
*-*-vxworks*)
ac_link="$ac_link $VX_KERNEL"
;;
esac
# HMS: a check for -lnsl used to be here - now being done in NTP_LIBNTP
AC_SEARCH_LIBS([openlog], [gen syslog])
# XXX library list will be in ac_cv_search_openlog
# LIBSECCOMP is off by default -- needs testing with all the features
# Please send bug reports to [email protected]
AC_MSG_CHECKING([if we want to use libseccomp sandboxing (EXPERIMENTAL)])
AC_ARG_ENABLE(
[libseccomp],
[AS_HELP_STRING(
[--enable-libseccomp],
[EXPERIMENTAL: enable support for libseccomp sandboxing (default is no) ]
)],
[ntp_ok=$enableval],
[ntp_ok=no]
)
AC_MSG_RESULT([$ntp_ok])
case "$ntp_ok" in
yes)
AC_SEARCH_LIBS(
[seccomp_init],
[seccomp],
[AC_DEFINE([LIBSECCOMP], [1],
[Define to any value to include libseccomp sandboxing.])]
)
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/prctl.h>
#include <linux/seccomp.h>
int main(void)
{
int ret;
ret = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
if (ret < 0) {
switch (errno) {
case ENOSYS:
return 1;
case EINVAL:
return 1;
default:
return 1;
}
}
ret =
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
if (ret < 0) {
switch (errno) {
case EINVAL:
return 1;
case EFAULT:
return 0;
default:
return 1;
}
}
return 1;
}
]
, AC_DEFINE([KERN_SECCOMP], 1,
[Define to use libseccomp system call filtering.])
, []
)
;;
esac
NTP_FACILITYNAMES
dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
dnl so only use one of them. Linux (glibc-2.1.2 and -2.2.2, at least)
dnl does Strange Things with extra processes using the Posix-compatibility
dnl real-time library, so we don't want to use it.
dnl
dnl 081118 Harlan got tired of looking for a way to get the sched*()
dnl functions to link OK with either cc or gcc.
case "$host" in
*-*-*linux*) ;;
*-*-osf4*) ;;
*-*-osf5*) ;;
*)
# HMS: Make sure we check for -lrt for clock_* before this...
case "$ac_cv_search_clock_gettime" in
'') AC_MSG_ERROR([Internal Error: Haven't looked for clock_gettime() yet!]) ;;
esac
AC_SEARCH_LIBS([sched_setscheduler], [rt posix4])
;;
esac
AC_CHECK_HEADERS([bstring.h])
AC_CHECK_HEADER(
[dns_sd.h],
[AC_SEARCH_LIBS(
[DNSServiceRegister],
[dns_sd],
[AC_DEFINE([HAVE_DNSREGISTRATION], [1],
[Use Rendezvous/DNS-SD registration])]
)]
)
AC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
AC_CHECK_HEADERS([memory.h netdb.h poll.h])
AC_CHECK_HEADERS([sgtty.h stdatomic.h])
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([stdlib.h string.h termio.h])
AC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
case "$host" in
*-*-aix*)
AC_CHECK_HEADERS([utmpx.h])
case "$ac_cv_header_utmpx_h" in
yes)
;;
*)
AC_CHECK_HEADERS([utmp.h])
;;
esac
;;
*)
AC_CHECK_HEADERS([utmp.h utmpx.h])
;;
esac
#
# On Suns only (so far) getpass() truncates the typed password to 8
# characters, but getpassphrase() allows up to 257. Most systems'
# getpass() does not truncate, at least not so as to affect ntpq and
# ntpdc password prompts.
#
# So check for getpassphrase(), but only on Sun operating systems.
#
case "$host" in
*-*-sunos*|*-*-solaris*)
AC_CHECK_FUNCS([getpassphrase])
esac
AC_CHECK_HEADERS([net/if6.h])
AC_CHECK_HEADERS([net/route.h], [], [], [
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
])
AC_CHECK_HEADERS([netinfo/ni.h])
case "$ac_cv_header_netinfo_ni_h" in
yes)
AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
esac
AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
case "$host" in
*-*-sunos4*)
;;
*)
AC_CHECK_HEADERS([sys/ioctl.h])
;;
esac
AC_CHECK_HEADERS([sys/ipc.h sys/lock.h sys/mman.h])
# HMS: Check sys/proc.h and sys/resource.h after some others
AC_CHECK_HEADERS([sys/modem.h sys/ppsclock.h sys/ppstime.h sched.h])
case "$ac_cv_header_sched_h" in
yes)
;;
*)
AC_CHECK_HEADERS([sys/sched.h])
;;
esac
# HMS: Check sys/shm.h after some others
AC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
# HMS: Checked sys/socket.h earlier
case "$host" in
*-*-netbsd*)
;;
*)
AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h])
;;
esac
AC_CHECK_HEADERS([sys/stat.h sys/stream.h stropts.h sys/stropts.h sys/syssgi.h])
AC_CHECK_HEADERS([sys/systune.h sys/termios.h sys/tpro.h sys/wait.h])
case "$host" in
*-convex-*)
AC_CHECK_HEADERS([/sys/sync/queue.h /sys/sync/sema.h])
;;
*-*-bsdi*)
AC_CHECK_HEADERS([machine/inline.h sys/pcl720.h sys/i8253.h])
;;
esac
case "$ac_cv_header_stdatomic_h" in
yes)
AC_CHECK_FUNCS([atomic_thread_fence])
AC_CACHE_CHECK(
[for atomic_thread_fence()],
[ntp_cv_func_atomic_thread_fence],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <stdatomic.h>
]],
[[
atomic_thread_fence(memory_order_seq_cst);
]]
)]
[ntp_cv_func_atomic_thread_fence=yes],
[ntp_cv_func_atomic_thread_fence=no]
)]
)
;;
esac
case "$host" in
*-*-solaris2.6)
# Broken...
;;
*)
AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
;;
esac
case "$host" in
*-*-*linux*)
case "$ac_cv_func_ntp_gettime" in
yes)
;;
*)
AC_CHECK_FUNCS([__ntp_gettime])
case "$ac_cv_func___ntp_gettime" in
yes)
AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
esac
;;
esac
AC_CHECK_FUNCS([adjtimex])
case "$ac_cv_func_adjtimex" in
yes)
AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
have_adjtimex=1
;;
*)
AC_CHECK_FUNCS([__adjtimex])
case "$ac_cv_func___adjtimex" in
yes)
AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
AC_DEFINE([adjtimex], [__adjtimex], [deviant])
AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
have_adjtimex=1
esac
;;
esac
esac
case "$have_adjtimex" in
'')
# nlist stuff is only needed for tickadj.
saved_LIBS="$LIBS"
LIBS=
AC_SEARCH_LIBS([nlist], [elf ld mld])
# XXX ac_cv_search_nlist will be 'none required', 'no', or '-l...'
AC_SEARCH_LIBS([kvm_open], [kvm]) dnl We already know about -lelf here...
# XXX ac_cv_search_kvm_open will be 'none required', 'no', or '-l...'
AC_CHECK_HEADERS([nlist.h sys/var.h])
case "$ac_cv_header_nlist_h" in
yes)
AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
AC_CACHE_CHECK(
[for n_un in struct nlist],
[ntp_cv_struct_nlist_n_un],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <nlist.h>
]],
[[
struct nlist n;
n.n_un.n_name = 0;
]]
)]
[ntp_cv_struct_nlist_n_un=yes],
[ntp_cv_struct_nlist_n_un=no]
)]
)
case "$ntp_cv_struct_nlist_n_un" in
yes)
AC_DEFINE([NLIST_NAME_UNION], [1],
[does struct nlist use a name union?])
esac
esac
AC_SUBST([LDADD_NLIST])
LDADD_NLIST="$LIBS"
LIBS="$saved_LIBS"
AS_UNSET([saved_LIBS])
esac
AC_CHECK_HEADERS([sys/proc.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
])
AC_CHECK_HEADERS([sys/resource.h], [], [], [
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
])
AC_CHECK_HEADERS([sys/shm.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_IPC_H
# include <sys/ipc.h>
#endif
])
AC_CHECK_HEADERS([sys/timex.h], [], [], [
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
])
AC_TYPE_SIGNAL
AC_TYPE_OFF_T
AC_STRUCT_TM dnl defines TM_IN_SYS_TIME used by refclock_parse.c
AC_CACHE_CHECK(
[for a fallback value for HZ],
[ntp_cv_default_hz],
[
ntp_cv_default_hz=100
case "$host" in
alpha*-dec-osf4*|alpha*-dec-osf5*)
ntp_cv_default_hz=1024
;;
mips-dec-ultrix4*)
ntp_cv_default_hz=256
;;
esac
]
)
AC_DEFINE_UNQUOTED([DEFAULT_HZ], [$ntp_cv_default_hz],
[What is the fallback value for HZ?])
AC_CACHE_CHECK(
[if we need to override the system's value for HZ],
[ntp_cv_override_hz],
[
ntp_cv_override_hz=no
case "$host" in
alpha*-dec-osf4*|alpha*-dec-osf5*)
ntp_cv_override_hz=yes
;;
mips-dec-ultrix4*)
ntp_cv_override_hz=yes
;;
*-*-freebsd*)
ntp_cv_override_hz=yes
;;
*-*-sunos4*)
ntp_cv_override_hz=yes
;;
*-*-kfreebsd*)
ntp_cv_override_hz=yes
;;
esac
]
)
case "$ntp_cv_override_hz" in
yes)
AC_DEFINE([OVERRIDE_HZ], [1],
[Do we need to override the system's idea of HZ?])
esac
dnl AC_CACHE_CHECK(ut_host in struct utmp, ac_cv_func_ut_host_in_utmp,
dnl [AC_TRY_LINK([#include <sys/types.h>
dnl #include <utmp.h>], [struct utmp ut; ut.ut_host;],
dnl ac_cv_func_ut_host_in_utmp=yes, ac_cv_func_ut_host_in_utmp=no)])
dnl if test $su_cv_func_ut_host_in_utmp = yes; then
dnl AC_DEFINE(HAVE_UT_HOST)
dnl fi
dnl AC_MSG_CHECKING(if we can get the system boot time)
dnl AC_CACHE_VAL(su_cv_have_boot_time,
dnl [AC_EGREP_CPP(yes,
dnl [#ifdef HAVE_UTMPX_H
dnl #include <utmpx.h>
dnl #else
dnl #include <utmp.h>
dnl #endif
dnl #ifdef BOOT_TIME
dnl yes
dnl #endif
dnl ], su_cv_have_boot_time=yes, su_cv_have_boot_time=no)])
dnl AC_MSG_RESULT($su_cv_have_boot_time)
AC_CACHE_CHECK(
[for struct rt_msghdr],
[ntp_cv_struct_rt_msghdr],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/route.h>
]],
[[
struct rt_msghdr p;
]]
)],
[ntp_cv_struct_rt_msghdr=yes],
[ntp_cv_struct_rt_msghdr=no]
)]
)
AC_CACHE_CHECK(
[for struct rtattr],
[ntp_cv_rtattr],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <stddef.h>
#include <sys/socket.h>
#include <linux/rtnetlink.h>
]],
[[
struct rtattr p;
]]
)],
[ntp_cv_rtattr=yes],
[ntp_cv_rtattr=no]
)]
)
case "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
*yes*)
AC_DEFINE([HAS_ROUTING_SOCKET], [1],
[Do we have a routing socket (rt_msghdr or rtattr)?])
case "$ntp_cv_rtattr" in
yes)
AC_DEFINE([HAVE_RTNETLINK], [1],
[Do we have Linux routing socket?])
esac
esac
AC_CACHE_CHECK(
[struct sigaction for sa_sigaction],
[ntp_cv_struct_sigaction_has_sa_sigaction],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <signal.h>
]],
[[
struct sigaction act;
act.sa_sigaction = 0;
]]
)],
[ntp_cv_struct_sigaction_has_sa_sigaction=yes],
[ntp_cv_struct_sigaction_has_sa_sigaction=no]
)]
)
case "$ntp_cv_struct_sigaction_has_sa_sigaction" in
yes)
AC_DEFINE([HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION], [1], [Obvious])
esac
AC_CACHE_CHECK(
[for struct ppsclockev],
[ntp_cv_struct_ppsclockev],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_TERMIOS_H
# include <sys/termios.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_PPSCLOCK_H
# include <sys/ppsclock.h>
#endif
]],
[[
extern struct ppsclockev *pce;
return pce->serial;
]]
)],
[ntp_cv_struct_ppsclockev=yes],
[ntp_cv_struct_ppsclockev=no]
)]
)
case "$ntp_cv_struct_ppsclockev" in
yes)
AC_DEFINE([HAVE_STRUCT_PPSCLOCKEV], [1],
[Does a system header define struct ppsclockev?])
esac
case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
*yes*)
AC_CACHE_CHECK(
[for struct snd_size],
[ntp_cv_struct_snd_size],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#ifdef HAVE_MACHINE_SOUNDCARD_H
# include <machine/soundcard.h>
#endif
#ifdef HAVE_SYS_SOUNDCARD_H
# include <sys/soundcard.h>
#endif
]],
[[
extern struct snd_size *ss;
return ss->rec_size;
]]
)],
[ntp_cv_struct_snd_size=yes],
[ntp_cv_struct_snd_size=no]
)]
)
case "$ntp_cv_struct_snd_size" in
yes)
AC_DEFINE([HAVE_STRUCT_SND_SIZE], [1],
[Do we have struct snd_size?])
esac
esac
AC_CACHE_CHECK(
[struct clockinfo for hz],
[ntp_cv_struct_clockinfo_has_hz],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/time.h>
]],
[[
extern struct clockinfo *pc;
return pc->hz;
]]
)],
[ntp_cv_struct_clockinfo_has_hz=yes],
[ntp_cv_struct_clockinfo_has_hz=no]
)]
)
case "$ntp_cv_struct_clockinfo_has_hz" in
yes)
AC_DEFINE([HAVE_HZ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
esac
AC_CACHE_CHECK(
[struct clockinfo for tickadj],
[ntp_cv_struct_clockinfo_has_hz],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/time.h>
]],
[[
extern struct clockinfo *pc;
return pc->tickadj;
]]
)],
[ntp_cv_struct_clockinfo_has_hz=yes],
[ntp_cv_struct_clockinfo_has_hz=no]
)]
)
case "$ntp_cv_struct_clockinfo_has_hz" in
yes)
AC_DEFINE([HAVE_TICKADJ_IN_STRUCT_CLOCKINFO], [1], [Obvious])
esac
case "$ntp_cv_struct_ntptimeval" in
yes)
AC_CHECK_MEMBERS(
[struct ntptimeval.time.tv_nsec],
[],
[],
[
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#else
# ifdef HAVE_TIME_H
# include <time.h>
# endif
#endif
#ifdef HAVE_SYS_TIMEX_H
# include <sys/timex.h>
#else
# ifdef HAVE_TIMEX_H
# include <timex.h>
# endif
#endif
]
)
esac
####
AC_CHECK_FUNCS([arc4random_buf])
####
saved_LIBS="$LIBS"
LIBS="$LIBS $LDADD_LIBNTP"
AC_CHECK_FUNCS([daemon])
# XXX if we keep everything in LIBS and also keep separate lists, this simplifies.
LIBS="$saved_LIBS"
AS_UNSET([saved_LIBS])
AC_CHECK_FUNCS(
[finite],
[],
[AC_CHECK_FUNCS(
[isfinite],
[],
[
AC_MSG_CHECKING([for isfinite with <math.h>])
_libs=$LIBS
# XXX
LIBS="$LIBS -lm"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <math.h>
]],
[[
float f = 0.0;
isfinite(f);
]]
)],
[ans=yes],
[ans=no]
)
LIBS=$_libs
AC_MSG_RESULT([$ans])
case "$ans" in
yes)
AC_DEFINE([HAVE_ISFINITE], [1])
esac
]
)]
)
AC_CHECK_FUNCS([fnmatch getbootfile getuid getrusage nanosleep strsignal])
# kvm_open() is only used by tickadj. Also see above.
case "$ac_cv_header_kvm_h" in
yes)
AC_CHECK_FUNCS([kvm_open])
;;
esac
case "$host" in
*-*-sco3.2v5.0.*)
# Just stubs. Sigh.
;;
*) AC_CHECK_FUNCS([mkstemp])
;;
esac
AC_CHECK_FUNCS([mktime])
case "$host" in
*-*-aix[[4-9]]*)
# XXX only verified thru AIX6.
# Just a stub. Sigh.
;;
*-*-irix[[45]]*)
# Just a stub in "old" Irix. Sigh.
;;
# In the belief that the fix for bug 1223 fixes mlockall() under linux...
# *-*-*linux*)
# # there, but more trouble than it is worth for now (resolver problems)
# ;;
*-*-qnx*)
# Apparently there but not working in QNX. Sigh?
;;
*-*-sco3.2v5.0.*)
# Just a stub. Sigh.
;;
alpha*-dec-osf4*|alpha*-dec-osf5*)
# mlockall is there, as a #define calling memlk via <sys/mman.h>
# Not easy to test for - cheat.
AC_CHECK_FUNCS([memlk], [ac_cv_func_mlockall=yes])
AC_CHECK_FUNCS([mlockall])
;;
*) AC_CHECK_FUNCS([mlockall])
;;
esac
AC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
case "$host" in
*-*-aix[[4-9]]*)
# XXX only verified thru AIX6.
# Just a stub in AIX 4. Sigh.
;;
*-*-solaris2.5*)
# Just stubs in solaris2.5. Sigh.
;;
*) AC_CHECK_FUNCS([sched_setscheduler])
;;
esac
AC_CHECK_FUNCS([setlinebuf setpgid setpriority setsid setvbuf])
AC_CHECK_FUNCS([strdup strerror setrlimit strchr])
case "$host" in
*-*-aix[[4-9]]*)
# XXX only verified thru AIX6.
# Just stubs. Sigh.
;;
*-*-netbsd1*)
# Just stubs. Sigh.
;;
*-*-netbsdelf1*)
# Just stubs. Sigh.
;;
*-*-openbsd*)
# Just stubs. Sigh.
;;
*)
AC_CHECK_FUNCS([timer_create])
;;
esac
NTP_RLIMIT_ITEMS
# some OSes prefer _exit() in forked children to exit()
AC_CHECK_FUNCS([_exit])
ntp_worker_child_exit=exit
case "$ac_cv_func__exit::$host_os" in
yes::netbsd*)
ntp_worker_child_exit=_exit
;;
yes::openbsd*)
ntp_worker_child_exit=_exit
;;
esac
AC_DEFINE_UNQUOTED([WORKER_CHILD_EXIT], [$ntp_worker_child_exit],
[routine worker child proc uses to exit.])
AC_CHECK_FUNCS([umask uname updwtmp updwtmpx])
###
# http://bugs.ntp.org/737
case "$ac_cv_func_recvmsg" in
yes)
AC_CACHE_CHECK(
[if we need extra help to define struct iovec],
[ntp_cv_struct_iovec_help],
[
compiled=no
for ntp_cv_struct_iovec_help in '0' '1'; 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
#if $ntp_cv_struct_iovec_help
# include <sys/uio.h>
#endif
]],
[[
void foo(void) {
ssize_t x;
int s = 0;
struct iovec iov;
struct msghdr mh;
int flags = 0;
mh.msg_iov = &iov;
x = recvmsg(s, &mh, flags);
}
]]
)],
[compiled=yes ; break 1],
[]
)
done
case "$compiled" in
no)
ntp_cv_struct_iovec_help=0
esac
AS_UNSET([compiled])
]
)
case "$ntp_cv_struct_iovec_help" in
1)
AC_DEFINE([HAVE_SYS_UIO_H], [1],