forked from collectd/collectd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
6715 lines (6162 loc) · 180 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([libltdl/config])
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}"])
m4_ifdef([LT_PACKAGE_VERSION],
# libtool >= 2.2
[
LT_CONFIG_LTDL_DIR([libltdl])
LT_INIT([dlopen])
LTDL_INIT([convenience])
AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
]
,
# libtool <= 1.5
[
AC_LIBLTDL_CONVENIENCE
AC_SUBST(LTDLINCL)
AC_SUBST(LIBLTDL)
AC_LIBTOOL_DLOPEN
AC_CONFIG_SUBDIRS(libltdl)
AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
]
)
AM_CONDITIONAL([BUILD_INCLUDED_LTDL], [test "x$LTDLDEPS" != "x"])
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])]
)
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
AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
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
AC_ARG_VAR([PROTOC], [path to the protoc binary])
AC_PATH_PROG([PROTOC], [protoc])
have_protoc3="no"
if test "x$PROTOC" != "x"; then
AC_MSG_CHECKING([for protoc 3.0.0+])
if $PROTOC --version | $EGREP libprotoc.3 >/dev/null; then
protoc3="yes (`$PROTOC --version`)"
have_protoc3="yes"
else
protoc3="no (`$PROTOC --version`)"
fi
AC_MSG_RESULT([$protoc3])
fi
AM_CONDITIONAL(HAVE_PROTOC3, test "x$have_protoc3" = "xyes")
AC_ARG_VAR([GRPC_CPP_PLUGIN], [path to the grpc_cpp_plugin binary])
AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin])
AM_CONDITIONAL(HAVE_GRPC_CPP, test "x$GRPC_CPP_PLUGIN" != "x")
AC_ARG_VAR([PROTOC_C], [path to the protoc-c binary])
AC_PATH_PROG([PROTOC_C], [protoc-c])
if test "x$PROTOC_C" = "x"
then
have_protoc_c="no (protoc-c compiler not found)"
else
have_protoc_c="yes"
fi
AC_MSG_CHECKING([for kernel type ($host_os)])
case $host_os in
*linux*)
AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
ac_system="Linux"
;;
*solaris*)
AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
ac_system="Solaris"
;;
*darwin*)
AC_DEFINE([KERNEL_DARWIN], 1, [True if program is to be compiled for a Darwin kernel])
ac_system="Darwin"
;;
*openbsd*)
AC_DEFINE([KERNEL_OPENBSD], 1, [True if program is to be compiled for an OpenBSD kernel])
ac_system="OpenBSD"
;;
*netbsd*)
AC_DEFINE([KERNEL_NETBSD], 1, [True if program is to be compiled for a NetBSD kernel])
ac_system="NetBSD"
;;
*aix*)
AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
ac_system="AIX"
;;
*freebsd*)
AC_DEFINE([KERNEL_FREEBSD], 1, [True if program is to be compiled for a FreeBSD kernel])
ac_system="FreeBSD"
;;
*)
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_SOLARIS], [test "x$ac_system" = "xSolaris"])
if test "x$ac_system" = "xLinux"
then
AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
if test -z "$KERNEL_DIR"
then
KERNEL_DIR="/lib/modules/`uname -r`/source"
fi
KERNEL_CFLAGS="-I$KERNEL_DIR/include"
AC_SUBST(KERNEL_CFLAGS)
fi
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
# Where to install .pc files.
pkgconfigdir="${libdir}/pkgconfig"
AC_SUBST(pkgconfigdir)
# Check for standards compliance mode
AC_ARG_ENABLE(standards,
AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
[enable_standards="$enableval"],
[enable_standards="no"])
if test "x$enable_standards" = "xyes"
then
AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
if test "x$GCC" = "xyes"
then
CFLAGS="$CFLAGS -std=c99"
fi
fi
AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
#
# Checks for header files.
#
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_HEADER_STDBOOL
AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h fnmatch.h libgen.h)
# 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
])
# For ping library
AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
])
AC_CHECK_HEADERS(netinet/in.h, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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
])
have_ip6_ext="no"
AC_CHECK_TYPES([struct ip6_ext], [have_ip6_ext="yes"], [have_ip6_ext="no"],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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
])
if test "x$have_ip6_ext" = "xno"; then
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -DSOLARIS2=8"
AC_CHECK_TYPES([struct ip6_ext],
[have_ip6_ext="yes, with -DSOLARIS2=8"],
[have_ip6_ext="no"],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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
])
if test "x$have_ip6_ext" = "xno"; then
CFLAGS="$SAVE_CFLAGS"
fi
fi
# 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)
AC_CHECK_HEADERS(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
])
AC_MSG_CHECKING([for sysctl kern.cp_times])
if test -x /sbin/sysctl
then
/sbin/sysctl kern.cp_times >/dev/null 2>&1
if test $? -eq 0
then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
[Define if sysctl supports kern.cp_times])
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([for sysctl kern.cp_time])
if test -x /sbin/sysctl
then
/sbin/sysctl kern.cp_time >/dev/null 2>&1
if test $? -eq 0
then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIME, 1,
[Define if sysctl supports kern.cp_time])
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([no])
fi
# For hddtemp module
AC_CHECK_HEADERS(linux/major.h)
# For md module (Linux only)
if test "x$ac_system" = "xLinux"
then
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])
else
have_linux_raid_md_u_h="no"
fi
# For the wireless module
have_linux_wireless_h="no"
if test "x$ac_system" = "xLinux"
then
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>
])
fi
# 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 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
])
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
#if HAVE_LINUX_INET_DIAG_H
# include <linux/inet_diag.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
have_linux_ip_vs_h="no"
have_net_ip_vs_h="no"
have_ip_vs_h="no"
ip_vs_h_needs_kernel_cflags="no"
if test "x$ac_system" = "xLinux"
then
AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
then
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $KERNEL_CFLAGS"
AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
then
ip_vs_h_needs_kernel_cflags="yes"
fi
CFLAGS="$SAVE_CFLAGS"
fi
fi
AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
# 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
])
# For the email plugin
AC_CHECK_HEADERS(linux/un.h, [], [],
[
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
AC_CHECK_HEADERS([ \
ctype.h \
fs_info.h \
fshelp.h \
grp.h \
kvm.h \
limits.h \
locale.h \
mntent.h \
mnttab.h \
paths.h \
pwd.h \
sys/fs_types.h \
sys/fstyp.h \
sys/mntent.h \
sys/mnttab.h \
sys/statfs.h \
sys/statvfs.h \
sys/un.h \
sys/vfs.h \
sys/vfstab.h \
sys/vmmeter.h \
wordexp.h \
])
# --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
# }}}
# For the dns plugin
AC_CHECK_HEADERS(arpa/nameser.h)
AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
[
#if HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
])
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, [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
#endif
#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
])
have_net_pfvar_h="no"
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
have_termios_h="no"
AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
# 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"]))
# For the turbostat plugin
have_asm_msrindex_h="no"
AC_CHECK_HEADERS(asm/msr-index.h, [have_asm_msrindex_h="yes"])
if test "x$have_asm_msrindex_h" = "xyes"
then
AC_CACHE_CHECK([whether asm/msr-index.h has MSR_PKG_C10_RESIDENCY],
[c_cv_have_usable_asm_msrindex_h],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[[
#include<asm/msr-index.h>
]]],
[[[
int y = MSR_PKG_C10_RESIDENCY;
return(y);
]]]
)],
[c_cv_have_usable_asm_msrindex_h="yes"],
[c_cv_have_usable_asm_msrindex_h="no"],
)
)
fi
have_cpuid_h="no"
AC_CHECK_HEADERS(cpuid.h, [have_cpuid_h="yes"])
AC_CHECK_HEADERS(sys/capability.h)
#
# 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
#
# Checks for library functions.
#
AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname setlocale asprintf)
AC_FUNC_STRERROR_R
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
}
SAVE_CFLAGS="$CFLAGS"
# Emulate behavior of src/Makefile.am
if test "x$GCC" = "xyes"
then
CFLAGS="$CFLAGS -Wall -Werror"
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 isn't available. Please file a bugreport!])]
)
)
fi
CFLAGS="$SAVE_CFLAGS"
if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
then
CFLAGS="$CFLAGS -D_REENTRANT=1"
fi
AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
socket_needs_socket="no"
AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
clock_gettime_needs_rt="no"
clock_gettime_needs_posix4="no"
have_clock_gettime="no"
AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
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
nanosleep_needs_rt="no"
nanosleep_needs_posix4="no"
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(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="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(thread_info, [have_thread_info="yes"], [have_thread_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(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="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