-
Notifications
You must be signed in to change notification settings - Fork 16
/
configure.in
1532 lines (1323 loc) · 40.8 KB
/
configure.in
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
dnl Zabbix
dnl Copyright (C) 2000-2011 Zabbix SIA
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/zabbix_server/server.c)
AM_INIT_AUTOMAKE([zabbix],[2.0.5rc1])
AC_MSG_NOTICE([Configuring $PACKAGE_NAME $PACKAGE_VERSION])
AC_PROG_MAKE_SET
AM_CONFIG_HEADER(include/config.h)
AC_CANONICAL_HOST
dnl *****************************************************************
dnl * *
dnl * Checks for programs *
dnl * *
dnl *****************************************************************
AC_PROG_CC
AM_PROG_CC_C_O
dnl *****************************************************************
dnl * *
dnl * Checks for header files *
dnl * *
dnl *****************************************************************
AC_HEADER_STDC
AC_CHECK_HEADERS(stdio.h stdlib.h string.h unistd.h netdb.h signal.h \
syslog.h time.h errno.h sys/types.h sys/stat.h netinet/in.h \
math.h sys/socket.h dirent.h ctype.h \
mtent.h fcntl.h sys/param.h arpa/inet.h \
sys/vfs.h sys/pstat.h sys/sysinfo.h sys/statvfs.h \
sys/socket.h sys/loadavg.h arpa/inet.h \
sys/vmmeter.h strings.h vm/vm_param.h \
sys/time.h kstat.h sys/syscall.h sys/sysmacros.h sys/procfs.h \
stdint.h mach/host_info.h mach/mach_host.h knlist.h pwd.h \
sys/var.h arpa/nameser.h assert.h sys/dkstat.h sys/disk.h \
nlist.h kvm.h linux/kernel.h procinfo.h sys/dk.h \
sys/resource.h pthread.h windows.h process.h conio.h sys/wait.h regex.h \
stdarg.h winsock2.h pdh.h psapi.h sys/sem.h sys/ipc.h sys/shm.h Winldap.h \
sys/timeb.h Winber.h lber.h ws2tcpip.h inttypes.h sys/file.h grp.h \
execinfo.h libperfstat.h sys/systemcfg.h sys/mnttab.h mntent.h sys/times.h)
AC_CHECK_HEADERS(resolv.h, [], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
])
AC_CHECK_HEADERS(net/if.h net/if_mib.h, [], [], [
#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
/* for net/if_mib.h */
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
])
AC_CHECK_HEADERS(sys/mount.h sys/proc.h sys/sysctl.h sys/user.h, [], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
])
AC_CHECK_HEADERS(sys/swap.h, [], [], [
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
])
AC_CHECK_HEADERS(sys/ucontext.h, [], [], [
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
])
AC_CHECK_HEADERS(devstat.h, [], [], [
#ifdef HAVE_SYS_DKSTAT_H
# include <sys/dkstat.h>
#endif
])
dnl *****************************************************************
dnl * *
dnl * Checks for libraries *
dnl * *
dnl *****************************************************************
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(kstat_open, kstat)
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(clock_gettime, rt)
dnl AIX
AC_SEARCH_LIBS(perfstat_memory_total, perfstat, [AC_DEFINE([HAVE_LIBPERFSTAT], 1, [Define to 1 if you have the 'libperfstat' library (-lperfstat)])])
AC_SEARCH_LIBS(devstat_getdevs, devstat, [AC_DEFINE([HAVE_LIBDEVSTAT], 1, [Define to 1 if you have the 'libdevstat' library (-ldevstat)])])
AC_SEARCH_LIBS(getdevs, devstat, [AC_DEFINE([HAVE_LIBDEVSTAT], 1, [Define to 1 if you have the 'libdevstat' library (-ldevstat)])])
dnl on FreeBSD we have to link with -lexecinfo to get backtraces
AC_SEARCH_LIBS(backtrace_symbols, execinfo, [AC_DEFINE([HAVE_LIBEXECINFO], 1, [Define to 1 if you have the 'libexecinfo' library (-lexecinfo)])])
AC_CHECK_LIB(m, main)
AC_CHECK_LIB(kvm, main)
dnl check for DNS lookup functions
found_resolv="no"
LIBRESOLV_CHECK_CONFIG([no])
if test "x$found_resolv" != "xyes"; then
AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)])
fi
LIBS="${LIBS} ${RESOLV_LIBS}"
dnl *****************************************************************
dnl * *
dnl * Checks for type definitions and structures *
dnl * *
dnl *****************************************************************
dnl large file support
largefile=yes
dnl disable large file support on 32-bit Solaris as it's incompatible with procfs and swapctl
case "${host_os}" in
solaris*)
largefile=no
;;
esac
if test "x$largefile" = "xyes"; then
AC_SYS_LARGEFILE
fi
AC_C_CONST
AC_TYPE_PID_T
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
],[socklen_t s;],
AC_MSG_RESULT(yes),
[AC_DEFINE(socklen_t, int, [Define socklen_t type.])
AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for actual socklen_t parameter type in socket functions)
zbx_socklen_t=
for arg2 in "struct sockaddr" void; do
for arg3 in socklen_t size_t int; do
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
extern int getpeername(int sockfd, $arg2 *addr, $arg3 *addrlen);
],[
$arg3 addrlen;
getpeername(0, 0, &addrlen);
],[
zbx_socklen_t="$arg3"
break 2
])
done
done
if test "x$zbx_socklen_t" != "x"; then
AC_MSG_RESULT($zbx_socklen_t)
AC_DEFINE_UNQUOTED(ZBX_SOCKLEN_T, $zbx_socklen_t, [Define actual socklen_t parameter type in socket functions.])
else
AC_MSG_RESULT(leaving undefined)
fi
AC_MSG_CHECKING(for integer field name in union sigval of struct siginfo_t)
zbx_sival_int=
for field in sival_int sigval_int; do
AC_TRY_COMPILE([
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
],[
siginfo_t siginfo;
siginfo.si_value.$field = 0;
],[
zbx_sival_int="$field"
break
])
done
if test "x$zbx_sival_int" != "x"; then
AC_MSG_RESULT($zbx_sival_int)
AC_DEFINE_UNQUOTED(ZBX_SIVAL_INT, $zbx_sival_int, [Define integer field name in union 'sigval' of struct 'siginfo_t'])
else
AC_MSG_ERROR(Unable to find integer field name in union sigval of struct siginfo_t)
fi
AC_MSG_CHECKING(for union semun)
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
],
[union semun foo;],
AC_DEFINE(HAVE_SEMUN, 1, [Define to 1 if union 'semun' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for struct swaptable in sys/swap.h)
AC_TRY_COMPILE(
[
#include <stdlib.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/swap.h>
#ifndef NULL
#define NULL (void *)0
#endif
],
[
register int cnt, i;
register int t, f;
struct swaptable *swt;
struct swapent *ste;
static char path[256];
/* get total number of swap entries */
cnt = swapctl(SC_GETNSWP, 0);
/* allocate enough space to hold count + n swapents */
swt = (struct swaptable *)malloc(sizeof(int) +
cnt * sizeof(struct swapent));
if (swt == NULL)
{
return;
}
swt->swt_n = cnt;
/* fill in ste_path pointers: we do not care about the paths, so we
point
them all to the same buffer */
ste = &(swt->swt_ent[0]);
i = cnt;
while (--i >= 0)
{
ste++->ste_path = path;
}
/* grab all swap info */
swapctl(SC_LIST, swt);
/* walk through the structs and sum up the fields */
t = f = 0;
ste = &(swt->swt_ent[0]);
i = cnt;
while (--i >= 0)
{
/* do not count slots being deleted */
if (!(ste->ste_flags & ST_INDEL) &&
!(ste->ste_flags & ST_DOINGDEL))
{
t += ste->ste_pages;
f += ste->ste_free;
} ste++;
}
/* fill in the results */
free(swt);
],
AC_DEFINE(HAVE_SYS_SWAP_SWAPTABLE,1,[Define to 1 if struct 'swaptable' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for struct sensordev in sys/sensors.h)
AC_TRY_COMPILE([
#include <stdlib.h>
#include <sys/queue.h>
#include <sys/sensors.h>],
[struct sensordev sensordev;
sensordev.xname[0]='\0';
sensordev.maxnumt[0]=0;
],
AC_DEFINE(HAVE_SENSORDEV,1,[Define to 1 if struct 'sensordev' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for struct statvfs64 in sys/statvfs.h)
AC_TRY_COMPILE(
[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif
],
[
struct statvfs64 s;
s.f_frsize = s.f_blocks = s.f_bfree = s.f_bavail = 0;
statvfs64("/", &s);
],
AC_DEFINE(HAVE_SYS_STATVFS64, 1, [Define to 1 if struct 'statvfs64' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field ss_family in struct sockaddr_storage)
AC_TRY_COMPILE([#include <sys/socket.h>],
[struct sockaddr_storage ss;
ss.ss_family = 0;
],
AC_DEFINE(HAVE_SOCKADDR_STORAGE_SS_FAMILY, 1, [Define to 1 if 'sockaddr_storage.ss_family' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field mem_unit in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.mem_unit=0;
],
AC_DEFINE(HAVE_SYSINFO_MEM_UNIT,1,[Define to 1 if 'sysinfo.mem_unit' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field freeswap in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.freeswap=0;
],
AC_DEFINE(HAVE_SYSINFO_FREESWAP,1,[Define to 1 if 'sysinfo.freeswap' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field totalswap in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.totalswap=0;
],
AC_DEFINE(HAVE_SYSINFO_TOTALSWAP,1,[Define to 1 if 'sysinfo.totalswap' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field totalram in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.totalram=0;
],
AC_DEFINE(HAVE_SYSINFO_TOTALRAM,1,[Define to 1 if 'sysinfo.totalram' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field sharedram in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.sharedram=0;
],
AC_DEFINE(HAVE_SYSINFO_SHAREDRAM,1,[Define to 1 if 'sysinfo.sharedram' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field bufferram in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.bufferram=0;
],
AC_DEFINE(HAVE_SYSINFO_BUFFERRAM,1,[Define to 1 if 'sysinfo.bufferram' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field freeram in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.freeram=0;
],
AC_DEFINE(HAVE_SYSINFO_FREERAM,1,[Define to 1 if 'sysinfo.freeram' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field uptime in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.uptime=0;
],
AC_DEFINE(HAVE_SYSINFO_UPTIME,1,[Define to 1 if 'sysinfo.uptime' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field procs in struct sysinfo)
AC_TRY_COMPILE([#include <sys/sysinfo.h>],
[struct sysinfo sysinfo;
sysinfo.procs=0;
],
AC_DEFINE(HAVE_SYSINFO_PROCS,1,[Define to 1 if 'sysinfo.procs' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for field tm_gmtoff in struct tm)
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#ifdef HAVE_TIME_H
#include <time.h>
#endif /* HAVE_TIME_H */
],
[
struct tm tm;
tm.tm_gmtoff;
],
AC_DEFINE(HAVE_TM_TM_GMTOFF,1,[Define to 1 if 'tm.tm_gmtoff' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl *****************************************************************
dnl * *
dnl * Checks for functions *
dnl * *
dnl *****************************************************************
AC_MSG_CHECKING(for function sysconf() in unistd.h)
AC_TRY_COMPILE(
[
#include <unistd.h>
],
[ int i;
i=sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PHYS_PAGES);
i=sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PHYS_PAGES);
],
AC_DEFINE(HAVE_UNISTD_SYSCONF,1,[Define to 1 if function 'sysconf' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function initgroups())
AC_TRY_LINK(
[
#include <sys/types.h>
#include <grp.h>
],
[
char *user = "zabbix";
initgroups(user, 0);
],
AC_DEFINE(HAVE_FUNCTION_INITGROUPS,1,[Define to 1 if function 'initgroups' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for functions seteuid() and setegid())
AC_TRY_LINK(
[
#include <sys/types.h>
#include <unistd.h>
],
[
seteuid(0);
setegid(0);
],
AC_DEFINE(HAVE_FUNCTION_SETEUID,1,[Define to 1 if functions 'seteuid' and 'setegid' exist.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function setproctitle())
AC_TRY_LINK(
[
#include <sys/types.h>
#include <unistd.h>
],
[
setproctitle("Test %d", 1);
],
AC_DEFINE(HAVE_FUNCTION_SETPROCTITLE,1,[Define to 1 if function 'setproctitle' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function sysctlbyname())
AC_TRY_LINK(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
#include <sys/sysctl.h>
],
[
sysctlbyname("", 0, 0, 0, 0);
],
AC_DEFINE(HAVE_FUNCTION_SYSCTLBYNAME,1,[Define to 1 if 'sysctlbyname' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function sysctl (KERN_BOOTTIME))
AC_TRY_COMPILE(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
#include <sys/sysctl.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
],
[
size_t len;
struct timeval uptime;
int mib[2];
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
len = sizeof(uptime);
sysctl(mib, 2, &uptime, &len, 0, 0);
],
AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME,1,[Define to 1 if 'KERN_BOOTTIME' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function sysctl (HW_NCPU))
AC_TRY_COMPILE(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
#include <sys/sysctl.h>
],
[
size_t len;
int mib[2], ncpu;
mib[0] = CTL_HW;
mib[1] = HW_NCPU;
len = sizeof(ncpu);
sysctl(mib, 2, &ncpu, &len, 0, 0);
],
AC_DEFINE(HAVE_FUNCTION_SYSCTL_HW_NCPU,1,[Define to 1 if 'HW_NCPU' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function sysctl (KERN_MAXFILES))
AC_TRY_COMPILE(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
#include <sys/sysctl.h>
],
[
size_t len;
int mib[2], maxfiles;
mib[0] = CTL_KERN;
mib[1] = KERN_MAXFILES;
len = sizeof(maxfiles);
sysctl(mib, 2, &maxfiles, &len, 0, 0);
],
AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_MAXFILES,1,[Define to 1 if 'KERN_MAXFILES' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function sysctl (KERN_MAXPROC))
AC_TRY_COMPILE(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
#include <sys/sysctl.h>
],
[
size_t len;
int mib[2], maxproc;
mib[0] = CTL_KERN;
mib[1] = KERN_MAXPROC;
len = sizeof(maxproc);
sysctl(mib, 2, &maxproc, &len, 0, 0);
],
AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_MAXPROC,1,[Define to 1 if 'KERN_MAXPROC' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function sysctl (KERN_CPTIME,KERN_CPTIME2))
AC_TRY_COMPILE(
[
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/dkstat.h>
],
[
size_t sz;
int i[] = {CP_USER, CP_NICE, CP_SYS, CP_INTR, CP_IDLE};
{
long states[CPUSTATES];
int mib[2] = {CTL_KERN, KERN_CPTIME};
sz = sizeof(states);
sysctl(mib, 2, &states, &sz, NULL, 0);
}
{
u_int64_t states[CPUSTATES];
int mib[3] = {CTL_KERN, KERN_CPTIME2, 0};
sz = sizeof(states);
sysctl(mib, 3, &states, &sz, NULL, 0);
}
],
AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_CPTIME,1,[Define to 1 if 'KERN_CPTIME,KERN_CPTIME2' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for function clock_gettime in time.h)
AC_TRY_LINK([
#ifdef HAVE_TIME_H
# include <time.h>
#elif HAVE_SYS_TIME_H
# include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
],
[struct timespec tp;
clock_gettime(CLOCK_REALTIME, &tp);
],
AC_DEFINE(HAVE_TIME_CLOCK_GETTIME,1,[Define to 1 if function 'clock_gettime' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl *****************************************************************
dnl * *
dnl * Checks for macros *
dnl * *
dnl *****************************************************************
AC_MSG_CHECKING(for macro __va_copy() in stdarg.h)
AC_TRY_COMPILE(
[
#include <stdarg.h>
],
[
va_list src,dst;
__va_copy(dst,src);
],
AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if macro '__va_copy' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for macro __VA_ARGS__)
AC_TRY_COMPILE(
[
#define ZBX_CONST_STRING(str) str
int test(const char *fmt, ...) { return 0; }
],
[
#define TEST(fmt, ...) test(ZBX_CONST_STRING(fmt), ##__VA_ARGS__)
TEST("%s","test");
TEST("test");
],
AC_DEFINE(HAVE___VA_ARGS__,1,[Define to 1 if macro '__VA_ARGS__' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl *****************************************************************
dnl * *
dnl * Checks for library functions *
dnl * *
dnl *****************************************************************
AC_TYPE_SIGNAL
AC_REPLACE_FUNCS(getloadavg)
AC_CHECK_FUNCS(hstrerror)
AC_CHECK_FUNCS(getenv)
AC_CHECK_FUNCS(putenv)
AC_CHECK_FUNCS(sigqueue)
dnl *****************************************************************
dnl * *
dnl * Checks for file system characteristics *
dnl * *
dnl *****************************************************************
AC_MSG_CHECKING(for /proc filesystem)
if test -d /proc; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PROC,1,[Define to 1 if '/proc' file system should be used.])
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for file /proc/stat)
if test -r /proc/stat; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PROC_STAT,1,[Define to 1 if file '/proc/stat' should be used.])
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for file /proc/cpuinfo)
if test -r /proc/cpuinfo; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PROC_CPUINFO,1,[Define to 1 if file '/proc/cpuinfo' should be used.])
else
AC_MSG_RESULT(no)
fi
dnl Solaris
AC_MSG_CHECKING(for file /proc/0/psinfo)
if test -r /proc/0/psinfo; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PROC_0_PSINFO,1,[Define to 1 if file '/proc/0/psinfo' should be used.])
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for file /proc/loadavg)
if test -r /proc/loadavg; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define to 1 if file '/proc/loadavg' should be used.])
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for file /proc/net/dev)
if test -r /proc/net/dev; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PROC_NET_DEV,1,[Define to 1 if file '/proc/net/dev' should be used.])
else
AC_MSG_RESULT(no)
fi
dnl *****************************************************************
dnl * *
dnl * Checks for compiler characteristics *
dnl * *
dnl *****************************************************************
dnl Check for %qu format (FreeBSD 4.x)
dnl FreeBSD 4.x does not support %llu
AC_MSG_CHECKING(for long long format)
AC_TRY_RUN(
[
#include <sys/types.h>
int main()
{
uint64_t i;
sscanf("200000000010020", "%qu", &i);
if (i == 200000000010020) return 0;
else return -1;
}
],
AC_DEFINE(HAVE_LONG_LONG_QU, 1 ,[Define to 1 if format '%qu' exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl option -rdynamic is needed for readable backtraces
AC_MSG_CHECKING(for -rdynamic linking option)
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="-rdynamic $LDFLAGS"
AC_TRY_LINK([#include <execinfo.h>],
[void *bcktrc[6];
(void)backtrace(bcktrc, 6);
],
LDFLAGS="-rdynamic $saved_LDFLAGS"
AC_MSG_RESULT(yes),
LDFLAGS="$saved_LDFLAGS"
AC_MSG_RESULT(no))
dnl *****************************************************************
dnl * *
dnl * Checks for operating systems *
dnl * *
dnl *****************************************************************
AC_MSG_CHECKING(for libperfstat 5.2.0.40 fileset)
AC_TRY_COMPILE([#include <libperfstat.h>],
[perfstat_memory_total_t memstats;
memstats.virt_active = 0;
],
AC_DEFINE(HAVE_AIXOSLEVEL_520004,1,[Define to 1 if libperfstat 5.2.0.40 fileset exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for libperfstat 5.3.0.60 fileset)
AC_TRY_COMPILE([#include <libperfstat.h>],
[perfstat_partition_total_t lparstats;
lparstats.type.b.donate_enabled = 0;
lparstats.idle_donated_purr = 0;
lparstats.busy_donated_purr = 0;
lparstats.idle_stolen_purr = 0;
lparstats.busy_stolen_purr = 0;
],
AC_DEFINE(HAVE_AIXOSLEVEL_530006,1,[Define to 1 if libperfstat 5.3.0.60 fileset exists.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for architecture)
case "$host_os" in
linux*)
ARCH="linux"
;;
aix*)
ARCH="aix"
;;
darwin*|rhapsody*)
ARCH="osx"
AC_DEFINE([MAC_OS_X], 1, [Define to 1 if you are using Mac OS X])
;;
*solaris*)
ARCH="solaris"
;;
hpux*)
ARCH="hpux"
;;
freebsd*)
ARCH="freebsd"
;;
netbsd*)
ARCH="netbsd"
;;
osf*)
ARCH="osf"
;;
openbsd*)
ARCH="openbsd"
;;
*)
ARCH="unknown"
;;
esac
AC_MSG_RESULT([$ARCH ($host_os)])
if test "x$ARCH" = "xlinux"; then
AC_MSG_CHECKING([for the linux kernel version])
kernel=`uname -r`
case "${kernel}" in
2.6.*)
AC_MSG_RESULT([2.6 family (${kernel})])
AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you are using Linux 2.6.x])
;;
2.4.*)
AC_MSG_RESULT([2.4 family (${kernel})])
AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you are using Linux 2.4.x])
;;
*)
AC_MSG_RESULT([unknown family (${kernel})])
;;
esac
fi
dnl Low Level Discovery needs a way to get the list of network
dnl interfaces available on the monitored system. On HP-UX systems
dnl that way depends on the OS version.
if test "x$ARCH" = "xhpux"; then
hpux_version=${host_os#hpux}
hpux_major=${hpux_version%.*}
hpux_minor=${hpux_version#*.}
AC_DEFINE_UNQUOTED([HPUX_VERSION], $hpux_major$hpux_minor, [Define to HP-UX version])
fi
AC_DEFINE_UNQUOTED([ARCH], "${ARCH}", [Define to OS name for code managing])
AC_SUBST(ARCH)
dnl *****************************************************************
dnl * *
dnl * Checks for options given on the command line *
dnl * *
dnl *****************************************************************
AC_ARG_ENABLE(static,[ --enable-static Build statically linked binaries],
[case "${enableval}" in
yes)
LDFLAGS="${LDFLAGS} -static"
AC_MSG_CHECKING(if static linking is possible)
AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
[AC_MSG_RESULT([yes])
static_linking=yes],
[AC_MSG_RESULT([no])
static_linking=no])
if test "x$static_linking" = "xno"; then
AC_MSG_ERROR([static linking is not possible on this system])
fi
;;
no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-static]) ;;
esac])
AC_ARG_ENABLE(server,[ --enable-server Turn on build of Zabbix server],
[case "${enableval}" in
yes) server=yes ;;
no) server=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-server]) ;;
esac],
[server=no])
AM_CONDITIONAL(SERVER, test "x$server" = "xyes")
AC_ARG_ENABLE(proxy,[ --enable-proxy Turn on build of Zabbix proxy],
[case "${enableval}" in
yes) proxy=yes ;;
no) proxy=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-proxy]) ;;
esac],
[proxy=no])
AM_CONDITIONAL(PROXY, test "x$proxy" = "xyes")
AC_ARG_ENABLE(agent,[ --enable-agent Turn on build of Zabbix agent and client utilities],
[case "${enableval}" in
yes) agent=yes ;;
no) agent=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-agent]) ;;
esac],
[agent=no])
AM_CONDITIONAL(AGENT, test "x$agent" = "xyes")
AC_ARG_ENABLE(java,[ --enable-java Turn on build of Zabbix Java gateway],
[case "${enableval}" in
yes) java=yes ;;
no) java=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-java]) ;;
esac],
[java=no])
AM_CONDITIONAL(JAVA, test "x$java" = "xyes")
AC_ARG_ENABLE(ipv6,[ --enable-ipv6 Turn on support of IPv6],
[case "${enableval}" in
yes) ipv6=yes ;;
no) ipv6=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;