forked from collectd/collectd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
7850 lines (6910 loc) · 217 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 Process this file with autoconf to produce a configure script.
AC_PREREQ([2.60])
AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)])
AC_CONFIG_SRCDIR(src/target_set.c)
AC_CONFIG_HEADERS(src/config.h)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
dnl we don't really need the 'u' even in older toolchains. Then there is
dnl older libtool, which spelled it AR_FLAGS
m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
LT_INIT([dlopen disable-static])
AM_INIT_AUTOMAKE([subdir-objects tar-pax dist-bzip2 no-dist-gzip foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_LANG(C)
AC_PREFIX_DEFAULT("/opt/collectd")
AC_SYS_LARGEFILE
#
# Checks for programs.
#
AC_PROG_CC_C99([],
[AC_MSG_ERROR([No compiler found that supports C99])]
)
AX_COMPILER_VENDOR
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_EGREP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_CC_C_O
AC_PROG_LEX
AC_PROG_YACC
AC_PATH_PROG([VALGRIND], [valgrind])
# Warn when pkg.m4 is missing
m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
PKG_PROG_PKG_CONFIG
AC_CACHE_CHECK([if Bison is the parser generator],
[collectd_cv_prog_bison],
[
AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '],
[collectd_cv_prog_bison=yes],
[collectd_cv_prog_bison=no]
)
]
)
if test "x$collectd_cv_prog_bison" = "xno" && test ! -f "${srcdir}/src/liboconfig/parser.c"; then
AC_MSG_ERROR([bison is missing and you do not have ${srcdir}/src/liboconfig/parser.c. Please install bison])
fi
if test "x$lt_cv_dlopen" = "xno"; then
AC_MSG_ERROR([Your system does not support dlopen])
fi
AC_SUBST([DLOPEN_LIBS], [$lt_cv_dlopen_libs])
AC_MSG_CHECKING([for kernel type ($host_os)])
case $host_os in
*aix*)
AC_DEFINE([KERNEL_AIX], [1], [True if program is to be compiled for a AIX kernel])
ac_system="AIX"
;;
*darwin*)
AC_DEFINE([KERNEL_DARWIN], [1], [True if program is to be compiled for a Darwin kernel])
ac_system="Darwin"
;;
*freebsd*)
AC_DEFINE([KERNEL_FREEBSD], [1], [True if program is to be compiled for a FreeBSD kernel])
ac_system="FreeBSD"
;;
*linux*)
AC_DEFINE([KERNEL_LINUX], [1], [True if program is to be compiled for a Linux kernel])
ac_system="Linux"
;;
*netbsd*)
AC_DEFINE([KERNEL_NETBSD], [1], [True if program is to be compiled for a NetBSD kernel])
ac_system="NetBSD"
;;
*openbsd*)
AC_DEFINE([KERNEL_OPENBSD], [1], [True if program is to be compiled for an OpenBSD kernel])
ac_system="OpenBSD"
;;
*solaris*)
AC_DEFINE([KERNEL_SOLARIS], [1], [True if program is to be compiled for a Solaris kernel])
ac_system="Solaris"
;;
*mingw32*)
AC_DEFINE([KERNEL_WIN32], [1], [True if program is to be compiled for a Windows kernel])
ac_system="Windows"
;;
*)
ac_system="unknown"
;;
esac
AC_MSG_RESULT([$ac_system])
AM_CONDITIONAL([BUILD_AIX], [test "x$ac_system" = "xAIX"])
AM_CONDITIONAL([BUILD_DARWIN], [test "x$ac_system" = "xDarwin"])
AM_CONDITIONAL([BUILD_FREEBSD], [test "x$ac_system" = "xFreeBSD"])
AM_CONDITIONAL([BUILD_LINUX], [test "x$ac_system" = "xLinux"])
AM_CONDITIONAL([BUILD_OPENBSD], [test "x$ac_system" = "xOpenBSD"])
AM_CONDITIONAL([BUILD_NETBSD], [test "x$ac_system" = "xNetBSD"])
AM_CONDITIONAL([BUILD_SOLARIS], [test "x$ac_system" = "xSolaris"])
AM_CONDITIONAL([BUILD_WIN32], [test "x$ac_system" = "xWindows"])
if test "x$ac_system" = "xSolaris"; then
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS], [1], [Define to enforce POSIX thread semantics under Solaris.])
AC_DEFINE([_REENTRANT], [1], [Define to enable reentrancy interfaces.])
AC_MSG_CHECKING([whether compiler builds 64bit binaries])
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
[
#ifndef _LP64
# error "Compiler not in 64bit mode."
#endif
]
)
],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no])
AC_MSG_NOTICE([Solaris detected. Please consider building a 64-bit binary.])
]
)
fi
if test "x$ac_system" = "xAIX"; then
AC_DEFINE([_THREAD_SAFE_ERRNO], [1], [Define to use the thread-safe version of errno under AIX.])
fi
if test "x${prefix}" != xNONE; then
AC_DEFINE_UNQUOTED([PREFIX], ["${prefix}"], [Define the install prefix.])
fi
# Where to install .pc files.
pkgconfigdir="${libdir}/pkgconfig"
AC_SUBST([pkgconfigdir])
#
# Checks for header files.
#
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_CHECK_HEADERS_ONCE([ \
arpa/inet.h \
endian.h \
fcntl.h \
fnmatch.h \
fs_info.h \
fshelp.h \
grp.h \
kstat.h \
kvm.h \
libgen.h \
locale.h \
mntent.h \
mnttab.h \
netdb.h \
paths.h \
poll.h \
pthread_np.h \
pwd.h \
regex.h \
sys/endian.h \
sys/fs_types.h \
sys/fstyp.h \
sys/ioctl.h \
sys/isa_defs.h \
sys/mntent.h \
sys/mnttab.h \
sys/param.h \
sys/resource.h \
sys/select.h \
sys/socket.h \
sys/statfs.h \
sys/statvfs.h \
sys/types.h \
sys/un.h \
sys/vfs.h \
sys/vfstab.h \
sys/vmmeter.h \
syslog.h \
wordexp.h
])
if test "x$ac_system" = "xNetBSD"; then
# For entropy plugin on newer NetBSD
AC_CHECK_HEADERS([sys/rndio.h], [], [],
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
]]
)
fi
# For ping library
AC_CHECK_HEADERS([netinet/in_systm.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/in.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/ip.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/ip_icmp.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#if HAVE_NETINET_IP_H
# include <netinet/ip.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/ip_var.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#if HAVE_NETINET_IP_H
# include <netinet/ip.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/ip6.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/icmp6.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#if HAVE_NETINET_IP6_H
# include <netinet/ip6.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/tcp.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#if HAVE_NETINET_IP_H
# include <netinet/ip.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/udp.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#if HAVE_NETINET_IP_H
# include <netinet/ip.h>
#endif
]]
)
# For cpu modules
AC_CHECK_HEADERS([sys/dkstat.h])
if test "x$ac_system" = "xDarwin"; then
AC_CHECK_HEADERS(
[ \
mach/mach_init.h \
mach/host_priv.h \
mach/mach_error.h \
mach/mach_host.h \
mach/mach_port.h \
mach/mach_types.h \
mach/message.h \
mach/processor_set.h \
mach/processor.h \
mach/processor_info.h \
mach/task.h \
mach/thread_act.h \
mach/vm_region.h \
mach/vm_map.h \
mach/vm_prot.h \
mach/vm_statistics.h \
mach/kern_return.h \
CoreFoundation/CoreFoundation.h \
IOKit/IOKitLib.h \
IOKit/IOTypes.h \
IOKit/ps/IOPSKeys.h \
IOKit/IOBSD.h \
IOKit/storage/IOBlockStorageDriver.h
]
)
# For the battery plugin
AC_CHECK_HEADERS([IOKit/ps/IOPowerSources.h], [], [],
[[
#if HAVE_IOKIT_IOKITLIB_H
# include <IOKit/IOKitLib.h>
#endif
#if HAVE_IOKIT_IOTYPES_H
# include <IOKit/IOTypes.h>
#endif
]]
)
fi
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
]]
)
# For interface plugin
AC_CHECK_HEADERS([ifaddrs.h])
AC_CHECK_HEADERS([net/if.h], [], [],
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]]
)
if test "x$ac_system" = "xLinux"; then
# For hddtemp module
AC_CHECK_HEADERS([linux/major.h])
# For md module (Linux only)
AC_CHECK_HEADERS([linux/raid/md_u.h],
[have_linux_raid_md_u_h="yes"],
[have_linux_raid_md_u_h="no"],
[[
#include <sys/ioctl.h>
#include <linux/major.h>
#include <linux/types.h>
]]
)
AC_CHECK_HEADERS([sys/sysmacros.h])
AC_CHECK_HEADERS([linux/wireless.h],
[have_linux_wireless_h="yes"],
[have_linux_wireless_h="no"],
[[
#include <dirent.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
]]
)
AC_CHECK_HEADERS([linux/if.h], [], [],
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]]
)
AC_CHECK_HEADERS([linux/inet_diag.h], [], [],
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]]
)
AC_CHECK_HEADERS([linux/netdevice.h], [], [],
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#if HAVE_LINUX_IF_H
# include <linux/if.h>
#endif
]]
)
# For ethstat module
AC_CHECK_HEADERS([linux/sockios.h],
[have_linux_sockios_h="yes"],
[have_linux_sockios_h="no"],
[[
#if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#if HAVE_NET_IF_H
# include <net/if.h>
#endif
]]
)
AC_CHECK_HEADERS([linux/ethtool.h],
[have_linux_ethtool_h="yes"],
[have_linux_ethtool_h="no"],
[[
#if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#if HAVE_NET_IF_H
# include <net/if.h>
#endif
#if HAVE_LINUX_SOCKIOS_H
# include <linux/sockios.h>
#endif
]]
)
# For ipvs module
AC_CHECK_HEADERS_ONCE([linux/ip_vs.h])
# For the email plugin
AC_CHECK_HEADERS([linux/un.h], [], [],
[[
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]]
)
# For the turbostat plugin
AC_CHECK_HEADERS([cpuid.h],
[have_cpuid_h="yes"],
[have_cpuid_h="no (cpuid.h not found)"]
)
AC_CHECK_HEADERS([sys/capability.h],
[have_capability="yes"],
[have_capability="no (<sys/capability.h> not found)"]
)
if test "x$have_capability" = "xyes"; then
AC_CHECK_LIB([cap], [cap_get_proc],
[have_capability="yes"],
[have_capability="no (cap_get_proc() not found)"]
)
fi
if test "x$have_capability" = "xyes"; then
AC_CHECK_DECL([CAP_IS_SUPPORTED],
[have_capability="yes"],
[have_capability="no (CAP_IS_SUPPORTED not found)"],
[[#include <sys/capability.h>]]
)
fi
if test "x$have_capability" = "xyes"; then
AC_DEFINE([HAVE_CAPABILITY], [1], [Define to 1 if you have cap_get_proc() (-lcap).])
fi
# For pcie_errors plugin
AC_CHECK_HEADERS([linux/pci_regs.h],
[have_pci_regs_h="yes"],
[have_pci_regs_h="no (linux/pci_regs.h not found)"]
)
else
have_linux_raid_md_u_h="no"
have_linux_wireless_h="no"
fi
AM_CONDITIONAL([BUILD_WITH_CAPABILITY], [test "x$have_capability" = "xyes"])
# For the swap module
have_sys_swap_h="yes"
AC_CHECK_HEADERS([sys/swap.h vm/anon.h],
[],
[have_sys_swap_h="no"],
[[
#undef _FILE_OFFSET_BITS
#undef _LARGEFILE64_SOURCE
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
]]
)
# For load module
# For the processes plugin
# For users module
AC_CHECK_HEADERS([sys/loadavg.h linux/config.h utmp.h utmpx.h])
# For quota module
AC_CHECK_HEADERS([sys/ucred.h], [], [],
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
]]
)
# For mount interface
AC_CHECK_HEADERS([sys/mount.h], [], [],
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
]]
)
# --enable-xfs {{{
AC_ARG_ENABLE([xfs],
[AS_HELP_STRING([--enable-xfs], [xfs support in df plugin @<:@default=yes@:>@])],
[],
[enable_xfs="auto"]
)
if test "x$enable_xfs" != "xno"; then
AC_CHECK_HEADERS([xfs/xqm.h],
[],
[
if test "x$enable_xfs" = "xyes"; then
AC_MSG_ERROR([xfs/xqm.h not found])
fi
],
[[#define _GNU_SOURCE]]
)
fi
# }}}
AC_CHECK_HEADERS([net/if_arp.h], [], [],
[[
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]]
)
AC_CHECK_HEADERS([net/ppp_defs.h])
AC_CHECK_HEADERS([net/if_ppp.h], [], [],
[[
#if HAVE_NET_PPP_DEFS_H
# include <net/ppp_defs.h>
#endif
]]
)
AC_CHECK_HEADERS([netinet/if_ether.h], [], [],
[[
#include <stdint.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#if HAVE_NET_IF_H
# include <net/if.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]]
)
AC_CHECK_HEADERS([net/pfvar.h],
[have_net_pfvar_h="yes"],
[have_net_pfvar_h="no"],
[[
#if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#if HAVE_NET_IF_H
# include <net/if.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]]
)
# For the multimeter plugin
AC_CHECK_HEADERS([termios.h],
[have_termios_h="yes"],
[have_termios_h="no"]
)
# For cpusleep plugin
AC_CACHE_CHECK([whether clock_boottime and clock_monotonic are supported],
[c_cv_have_clock_boottime_monotonic],
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <time.h>]],
[[
struct timespec b, m;
clock_gettime(CLOCK_BOOTTIME, &b );
clock_gettime(CLOCK_MONOTONIC, &m );
]]
)
],
[c_cv_have_clock_boottime_monotonic="yes"],
[c_cv_have_clock_boottime_monotonic="no"]
)
]
)
#
# Checks for typedefs, structures, and compiler characteristics.
#
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_HEADER_TIME
test_cxx_flags() {
AC_LANG_PUSH([C++])
AC_LANG_CONFTEST(
[AC_LANG_SOURCE([[int main(void){}]]) ]
)
$CXX -c conftest.cpp $CXXFLAGS $@ > /dev/null 2> /dev/null
ret=$?
rm -f conftest.o
AC_LANG_POP([C++])
return $ret
}
#
# Checks for library functions.
#
AC_CHECK_FUNCS_ONCE([ \
asprintf \
execvpe \
getpwnam \
getpwnam_r \
if_indextoname \
setgroups \
setlocale
]
)
AC_FUNC_STRERROR_R
if test "x$GCC" = "xyes"; then
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
fi
SAVE_LDFLAGS="$LDFLAGS"
LDFLAGS=""
if test "x$ac_system" = "xWindows"; then
# This is exported from build.sh
LDFLAGS="$LDFLAGS -L${GNULIB_DIR}"
fi
AC_CACHE_CHECK([for strtok_r],
[c_cv_have_strtok_r_default],
[
AC_LINK_IFELSE(
[
AC_LANG_PROGRAM(
[[
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
]],
[[
char buffer[] = "foo,bar,baz";
char *token;
char *dummy;
char *saveptr;
dummy = buffer;
saveptr = NULL;
while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
{
dummy = NULL;
printf ("token = %s;\n", token);
}
]]
)
],
[c_cv_have_strtok_r_default="yes"],
[c_cv_have_strtok_r_default="no"]
)
]
)
if test "x$c_cv_have_strtok_r_default" = "xno"; then
CFLAGS="$CFLAGS -D_REENTRANT=1"
AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
[c_cv_have_strtok_r_reentrant],
[
AC_LINK_IFELSE(
[
AC_LANG_PROGRAM(
[[
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
]],
[[
char buffer[] = "foo,bar,baz";
char *token;
char *dummy;
char *saveptr;
dummy = buffer;
saveptr = NULL;
while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
{
dummy = NULL;
printf ("token = %s;\n", token);
}
]]
)
],
[c_cv_have_strtok_r_reentrant="yes"],
[AC_MSG_FAILURE([strtok_r is not available. Please file a bugreport!])]
)
]
)
fi
CFLAGS="$SAVE_CFLAGS"
LDFLAGS="$SAVE_LDFLAGS"
if test "x$c_cv_have_strtok_r_reentrant" = "xyes"; then
CFLAGS="$CFLAGS -D_REENTRANT=1"
fi
AC_CHECK_FUNCS([socket],
[],
[
AC_CHECK_LIB([socket], [socket],
[socket_needs_socket="yes"],
[
AC_CHECK_LIB([gnu], [rpl_socket],
[socket_needs_gnulib="yes"],
[AC_MSG_ERROR([cannot find socket() in libsocket])]
)
]
)
]
)
AM_CONDITIONAL([BUILD_WITH_LIBSOCKET], [test "x$socket_needs_socket" = "xyes"])
AM_CONDITIONAL([BUILD_WITH_GNULIB], [test "x$socket_needs_gnulib" = "xyes"])
AC_CHECK_FUNCS([inet_ntop],
[],
[
AC_CHECK_LIB([nsl], [inet_ntop],
[inet_ntop_needs_nsl="yes"],
[AC_MSG_ERROR([cannot find inet_ntop() in libnsl])]
)
]
)
AM_CONDITIONAL([BUILD_WITH_LIBNSL], [test "x$inet_ntop_needs_nsl" = "xyes"])
clock_gettime_needs_posix4="no"
AC_CHECK_FUNCS([clock_gettime],
[have_clock_gettime="yes"],
[have_clock_gettime="no"]
)
if test "x$have_clock_gettime" = "xno"; then
AC_CHECK_LIB([rt], [clock_gettime],
[
clock_gettime_needs_rt="yes"
have_clock_gettime="yes"
]
)
fi
if test "x$have_clock_gettime" = "xno"; then
AC_CHECK_LIB([posix4], [clock_gettime],
[
clock_gettime_needs_posix4="yes"
have_clock_gettime="yes"
]
)
fi
if test "x$have_clock_gettime" = "xyes"; then
AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if the clock_gettime(2) function is available.])
fi
AC_CHECK_FUNCS([nanosleep], [],
AC_CHECK_LIB([rt], [nanosleep],
[nanosleep_needs_rt="yes"],
[
AC_CHECK_LIB([posix4], [nanosleep],
[nanosleep_needs_posix4="yes"],
[AC_MSG_ERROR([cannot find nanosleep])]
)
]
)
)
AM_CONDITIONAL([BUILD_WITH_LIBRT], [test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes"])
AM_CONDITIONAL([BUILD_WITH_LIBPOSIX4], [test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes"])
AC_CHECK_FUNCS([getifaddrs], [have_getifaddrs="yes"], [have_getifaddrs="no"])
AC_CHECK_FUNCS([getloadavg], [have_getloadavg="yes"], [have_getloadavg="no"])
AC_CHECK_FUNCS([getutent], [have_getutent="yes"], [have_getutent="no"])
AC_CHECK_FUNCS([getutxent], [have_getutxent="yes"], [have_getutxent="no"])
AC_CHECK_FUNCS([host_statistics], [have_host_statistics="yes"], [have_host_statistics="no"])
AC_CHECK_FUNCS([processor_info], [have_processor_info="yes"], [have_processor_info="no"])
AC_CHECK_FUNCS([statfs], [have_statfs="yes"], [have_statfs="no"])
AC_CHECK_FUNCS([statvfs], [have_statvfs="yes"], [have_statvfs="no"])
AC_CHECK_FUNCS([sysctl], [have_sysctl="yes"], [have_sysctl="no"])
AC_CHECK_FUNCS([sysctlbyname], [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
AC_CHECK_FUNCS([syslog], [have_syslog="yes"], [have_syslog="no"])
AC_CHECK_FUNCS([thread_info], [have_thread_info="yes"], [have_thread_info="no"])
# Check for strptime {{{
if test "x$GCC" = "xyes"; then
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wextra -Werror"
fi
AC_CHECK_FUNCS([strptime], [have_strptime="yes"], [have_strptime="no"])
if test "x$have_strptime" = "xyes"; then
AC_CACHE_CHECK([whether strptime is exported by default],
[c_cv_have_strptime_default],
[
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
[[#include <time.h>]],
[[
struct tm stm;
(void)strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
]]
)
],
[c_cv_have_strptime_default="yes"],
[c_cv_have_strptime_default="no"])
]
)
fi
if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"; then
AC_CACHE_CHECK([whether strptime needs standards mode],
[c_cv_have_strptime_standards],
[
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
[[
#ifndef _ISOC99_SOURCE
# define _ISOC99_SOURCE 1
#endif
#ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200112L
#endif
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 500
#endif
#include <time.h>
]],
[[
struct tm stm;
(void)strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
]]
)
],
[c_cv_have_strptime_standards="yes"],
[c_cv_have_strptime_standards="no"]
)
]
)
if test "x$c_cv_have_strptime_standards" = "xyes"; then
AC_DEFINE([STRPTIME_NEEDS_STANDARDS], [1],
[Set to true if strptime is only exported in X/Open mode (GNU libc).]
)
else
have_strptime="no"
fi
fi
if test "x$GCC" = "xyes"; then