1dnl
2dnl Zabbix
3dnl Copyright (C) 2001-2021 Zabbix SIA
4dnl
5dnl This program is free software; you can redistribute it and/or modify
6dnl it under the terms of the GNU General Public License as published by
7dnl the Free Software Foundation; either version 2 of the License, or
8dnl (at your option) any later version.
9dnl
10dnl This program is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13dnl GNU General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU General Public License
16dnl along with this program; if not, write to the Free Software
17dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18dnl
19
20dnl Process this file with autoconf to produce a configure script.
21
22AC_INIT([Zabbix],[5.4.9])
23AC_CONFIG_SRCDIR(src/zabbix_server/server.c)
24AM_INIT_AUTOMAKE([subdir-objects filename-length-max=99])
25
26AC_MSG_NOTICE([Configuring $PACKAGE_NAME $PACKAGE_VERSION])
27
28AC_PROG_MAKE_SET
29
30AM_CONFIG_HEADER(include/config.h)
31
32AC_CANONICAL_HOST
33
34dnl *****************************************************************
35dnl *                                                               *
36dnl *                     Checks for programs                       *
37dnl *                                                               *
38dnl *****************************************************************
39
40AC_PROG_CC([cc c99 gcc clang])
41AM_PROG_CC_C_O
42
43dnl *****************************************************************
44dnl *                                                               *
45dnl *                   Checks for header files                     *
46dnl *                                                               *
47dnl *****************************************************************
48
49AC_HEADER_STDC
50AC_CHECK_HEADERS(stdio.h stdlib.h string.h unistd.h netdb.h signal.h \
51  syslog.h time.h errno.h sys/types.h sys/stat.h netinet/in.h \
52  math.h sys/socket.h dirent.h ctype.h \
53  mtent.h fcntl.h sys/param.h arpa/inet.h \
54  sys/vfs.h sys/pstat.h sys/sysinfo.h sys/statvfs.h sys/statfs.h \
55  sys/socket.h sys/loadavg.h arpa/inet.h \
56  sys/vmmeter.h strings.h vm/vm_param.h \
57  sys/time.h kstat.h sys/syscall.h sys/sysmacros.h \
58  stdint.h mach/host_info.h mach/mach_host.h knlist.h pwd.h \
59  sys/var.h arpa/nameser.h assert.h sys/dkstat.h sys/disk.h sys/sched.h \
60  zone.h nlist.h kvm.h linux/kernel.h procinfo.h sys/dk.h \
61  sys/resource.h pthread.h windows.h process.h conio.h sys/wait.h \
62  stdarg.h winsock2.h pdh.h psapi.h sys/sem.h sys/ipc.h sys/shm.h Winldap.h \
63  Winber.h lber.h ws2tcpip.h inttypes.h sys/file.h grp.h \
64  execinfo.h sys/systemcfg.h sys/mnttab.h mntent.h sys/times.h \
65  dlfcn.h sys/utsname.h sys/un.h sys/protosw.h stddef.h limits.h float.h)
66AC_CHECK_HEADERS(resolv.h, [], [], [
67#ifdef HAVE_SYS_TYPES_H
68#  include <sys/types.h>
69#endif
70#ifdef HAVE_NETINET_IN_H
71#  include <netinet/in.h>
72#endif
73#ifdef HAVE_ARPA_NAMESER_H
74#  include <arpa/nameser.h>
75#endif
76#ifdef HAVE_NETDB_H
77#  include <netdb.h>
78#endif
79])
80AC_CHECK_HEADERS(net/if.h net/if_mib.h, [], [], [
81#include <stdio.h>
82#ifdef STDC_HEADERS
83#  include <stdlib.h>
84#  include <stddef.h>
85#else
86#  ifdef HAVE_STDLIB_H
87#    include <stdlib.h>
88#  endif
89#endif
90#ifdef HAVE_SYS_TYPES_H
91#  include <sys/types.h>
92#endif
93#ifdef HAVE_SYS_SOCKET_H
94#  include <sys/socket.h>
95#endif
96/* for net/if_mib.h */
97#ifdef HAVE_NET_IF_H
98#  include <net/if.h>
99#endif
100])
101
102AC_MSG_CHECKING(whether compiler supports -Werror=cpp)
103checked_werror_cpp_CFLAGS=""
104saved_CFLAGS="$CFLAGS"
105CFLAGS="$CFLAGS -Werror=cpp"
106AC_TRY_COMPILE(,[
107  void f() {};
108],checked_werror_cpp_CFLAGS="-Werror=cpp"
109  AC_MSG_RESULT(yes),
110  AC_MSG_RESULT(no)
111)
112CFLAGS="$saved_CFLAGS"
113
114saved_CFLAGS="$CFLAGS"
115CFLAGS="$checked_werror_cpp_CFLAGS $CFLAGS"
116AC_CHECK_HEADERS(sys/mount.h sys/proc.h sys/sysctl.h sys/user.h, [], [], [
117#ifdef HAVE_SYS_TYPES_H
118#  include <sys/types.h>
119#endif
120#ifdef HAVE_SYS_PARAM_H
121#  include <sys/param.h>
122#endif
123])
124CFLAGS="$saved_CFLAGS"
125
126AC_CHECK_HEADERS(sys/swap.h, [], [], [
127#ifdef HAVE_SYS_PARAM_H
128#  include <sys/param.h>
129#endif
130])
131AC_CHECK_HEADERS(sys/ucontext.h, [], [], [
132#ifdef HAVE_SIGNAL_H
133#  include <signal.h>
134#endif
135])
136AC_CHECK_HEADERS(devstat.h, [], [], [
137#ifdef HAVE_SYS_DKSTAT_H
138#  include <sys/dkstat.h>
139#endif
140])
141AC_CHECK_HEADERS(linux/netlink.h, [
142	AC_CHECK_HEADERS(linux/inet_diag.h, [
143		AC_DEFINE([HAVE_INET_DIAG], 1, [Define to 1 if you have NETLINK INET_DIAG support.])
144	])
145], [], [
146#ifdef HAVE_SYS_SOCKET_H
147#  include <sys/socket.h>
148#endif
149])
150AC_CHECK_HEADERS(libperfstat.h, [], [], [
151#ifdef HAVE_SYS_PROTOSW_H
152#  include <sys/protosw.h>
153#endif
154])
155
156dnl *****************************************************************
157dnl *                                                               *
158dnl *                     Checks for libraries                      *
159dnl *                                                               *
160dnl *****************************************************************
161
162AC_SEARCH_LIBS(socket, socket)
163AC_SEARCH_LIBS(kstat_open, kstat)
164AC_SEARCH_LIBS(gethostbyname, nsl)
165AC_SEARCH_LIBS(clock_gettime, rt)
166AC_SEARCH_LIBS(dlopen, dl)
167
168dnl AIX
169AC_SEARCH_LIBS(perfstat_memory_total, perfstat, [AC_DEFINE([HAVE_LIBPERFSTAT], 1, [Define to 1 if you have the 'libperfstat' library (-lperfstat)])])
170AC_SEARCH_LIBS(devstat_getdevs, devstat, [AC_DEFINE([HAVE_LIBDEVSTAT], 1, [Define to 1 if you have the 'libdevstat' library (-ldevstat)])])
171AC_SEARCH_LIBS(getdevs, devstat, [AC_DEFINE([HAVE_LIBDEVSTAT], 1, [Define to 1 if you have the 'libdevstat' library (-ldevstat)])])
172
173dnl on FreeBSD we have to link with -lexecinfo to get backtraces
174AC_SEARCH_LIBS(backtrace_symbols, execinfo, [AC_DEFINE([HAVE_LIBEXECINFO], 1, [Define to 1 if you have the 'libexecinfo' library (-lexecinfo)])])
175
176AC_CHECK_LIB(m, main)
177AC_CHECK_LIB(kvm, main)
178
179dnl check for DNS lookup functions
180found_resolv="no"
181LIBRESOLV_CHECK_CONFIG([no])
182if test "x$found_resolv" != "xyes"; then
183	AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)])
184fi
185LIBS="${LIBS} ${RESOLV_LIBS}"
186
187dnl *****************************************************************
188dnl *                                                               *
189dnl *          Checks for type definitions and structures           *
190dnl *                                                               *
191dnl *****************************************************************
192
193dnl large file support
194largefile=yes
195
196dnl disable large file support on 32-bit Solaris as it's incompatible with procfs and swapctl
197case "${host_os}" in
198	solaris*)
199		largefile=no
200		;;
201esac
202
203if test "x$largefile" = "xyes"; then
204	AC_SYS_LARGEFILE
205fi
206
207AC_C_CONST
208AC_TYPE_PID_T
209
210AC_MSG_CHECKING(for socklen_t)
211AC_TRY_COMPILE([
212#include <sys/types.h>
213#include <unistd.h>
214#include <sys/socket.h>
215],[socklen_t s;],
216AC_MSG_RESULT(yes),
217[AC_DEFINE(socklen_t, int, [Define socklen_t type.])
218AC_MSG_RESULT(no)])
219
220AC_MSG_CHECKING(for actual socklen_t parameter type in socket functions)
221zbx_socklen_t=
222for arg2 in "struct sockaddr" void; do
223  for arg3 in socklen_t size_t int; do
224    AC_TRY_COMPILE([
225#ifdef HAVE_SYS_TYPES_H
226#  include <sys/types.h>
227#endif
228#ifdef HAVE_SYS_SOCKET_H
229#  include <sys/socket.h>
230#endif
231      extern int getpeername(int sockfd, $arg2 *addr, $arg3 *addrlen);
232    ],[
233      $arg3 addrlen;
234      getpeername(0, 0, &addrlen);
235    ],[
236      zbx_socklen_t="$arg3"
237      break 2
238    ])
239  done
240done
241if test "x$zbx_socklen_t" != "x"; then
242  AC_MSG_RESULT($zbx_socklen_t)
243  AC_DEFINE_UNQUOTED(ZBX_SOCKLEN_T, $zbx_socklen_t, [Define actual socklen_t parameter type in socket functions.])
244else
245  AC_MSG_RESULT(leaving undefined)
246fi
247
248AC_MSG_CHECKING(for integer field name in union sigval of struct siginfo_t)
249zbx_sival_int=
250for field in sival_int sigval_int; do
251  AC_TRY_COMPILE([
252#ifdef HAVE_SIGNAL_H
253#  include <signal.h>
254#endif
255  ],[
256    siginfo_t siginfo;
257    siginfo.si_value.$field = 0;
258  ],[
259    zbx_sival_int="$field"
260    break
261  ])
262done
263if test "x$zbx_sival_int" != "x"; then
264  AC_MSG_RESULT($zbx_sival_int)
265  AC_DEFINE_UNQUOTED(ZBX_SIVAL_INT, $zbx_sival_int, [Define integer field name in union 'sigval' of struct 'siginfo_t'])
266else
267  AC_MSG_ERROR(Unable to find integer field name in union sigval of struct siginfo_t)
268fi
269
270AC_MSG_CHECKING(for res_ninit)
271AC_TRY_LINK(
272[
273#ifdef HAVE_SYS_TYPES_H
274#	include <sys/types.h>
275#endif
276#ifdef HAVE_NETINET_IN_H
277#	include <netinet/in.h>
278#endif
279#ifdef HAVE_ARPA_NAMESER_H
280#	include <arpa/nameser.h>
281#endif
282#ifdef HAVE_RESOLV_H
283#	include <resolv.h>
284#endif
285#ifndef C_IN
286#	define C_IN	ns_c_in
287#endif	/* C_IN */
288#ifndef T_SOA
289#	define T_SOA	ns_t_soa
290#endif	/* T_SOA */
291],
292[
293	struct __res_state	res_state_local;
294
295	res_ninit(&res_state_local);
296],
297AC_DEFINE(HAVE_RES_NINIT,1,[Define to 1 if 'res_ninit' exists.])
298AC_MSG_RESULT(yes),
299AC_MSG_RESULT(no))
300
301AC_MSG_CHECKING(for res_ndestroy)
302AC_TRY_LINK(
303[
304#ifdef HAVE_SYS_TYPES_H
305#	include <sys/types.h>
306#endif
307#ifdef HAVE_NETINET_IN_H
308#	include <netinet/in.h>
309#endif
310#ifdef HAVE_ARPA_NAMESER_H
311#	include <arpa/nameser.h>
312#endif
313#ifdef HAVE_RESOLV_H
314#	include <resolv.h>
315#endif
316#ifndef C_IN
317#	define C_IN	ns_c_in
318#endif	/* C_IN */
319#ifndef T_SOA
320#	define T_SOA	ns_t_soa
321#endif	/* T_SOA */
322],
323[
324	struct __res_state	res_state_local;
325
326	res_ninit(&res_state_local);
327	res_ndestroy(&res_state_local);
328],
329AC_DEFINE(HAVE_RES_NDESTROY,1,[Define to 1 if 'res_ndestroy' exists.])
330AC_MSG_RESULT(yes),
331AC_MSG_RESULT(no))
332
333AC_MSG_CHECKING(for _res._u._ext.nsaddrs[])
334AC_TRY_LINK(
335[
336#ifdef HAVE_SYS_TYPES_H
337#	include <sys/types.h>
338#endif
339#ifdef HAVE_NETINET_IN_H
340#	include <netinet/in.h>
341#endif
342#ifdef HAVE_ARPA_NAMESER_H
343#	include <arpa/nameser.h>
344#endif
345#ifdef HAVE_RESOLV_H
346#	include <resolv.h>
347#endif
348#ifndef C_IN
349#	define C_IN	ns_c_in
350#endif	/* C_IN */
351#ifndef T_SOA
352#	define T_SOA	ns_t_soa
353#endif	/* T_SOA */
354],
355[
356	struct sockaddr_in6	*sockaddrin6;
357
358	sockaddrin6 = _res._u._ext.nsaddrs[0];
359],
360AC_DEFINE(HAVE_RES_U_EXT,1,[Define to 1 if '_res._u._ext.nsaddrs[]' exists. /Linux/])
361AC_MSG_RESULT(yes),
362AC_MSG_RESULT(no))
363
364AC_MSG_CHECKING(for _res._u._ext.ext)
365AC_TRY_LINK(
366[
367#ifdef HAVE_SYS_TYPES_H
368#	include <sys/types.h>
369#endif
370#ifdef HAVE_NETINET_IN_H
371#	include <netinet/in.h>
372#endif
373#ifdef HAVE_ARPA_NAMESER_H
374#	include <arpa/nameser.h>
375#endif
376#ifdef HAVE_RESOLV_H
377#	include <resolv.h>
378#endif
379#ifndef C_IN
380#	define C_IN	ns_c_in
381#endif	/* C_IN */
382#ifndef T_SOA
383#	define T_SOA	ns_t_soa
384#endif	/* T_SOA */
385],
386[
387	struct __res_state_ext	*ext;
388
389	ext = _res._u._ext.ext;
390],
391AC_DEFINE(HAVE_RES_U_EXT_EXT,1,[Define to 1 if '_res._u._ext.ext' exists. /BSD/])
392AC_MSG_RESULT(yes),
393AC_MSG_RESULT(no))
394
395AC_MSG_CHECKING(for _res._ext.ext.nsaddrs[])
396AC_TRY_LINK(
397[
398#ifdef HAVE_SYS_TYPES_H
399#	include <sys/types.h>
400#endif
401#ifdef HAVE_NETINET_IN_H
402#	include <netinet/in.h>
403#endif
404#ifdef HAVE_ARPA_NAMESER_H
405#	include <arpa/nameser.h>
406#endif
407#ifdef HAVE_RESOLV_H
408#	include <resolv.h>
409#endif
410#ifndef C_IN
411#	define C_IN	ns_c_in
412#endif	/* C_IN */
413#ifndef T_SOA
414#	define T_SOA	ns_t_soa
415#endif	/* T_SOA */
416],
417[
418	union res_sockaddr_union	*na;
419
420	na = &_res._ext.ext.nsaddrs[0];
421],
422AC_DEFINE(HAVE_RES_EXT_EXT,1,[Define to 1 if '_res._ext.ext.nsaddrs[]' exists. /AIX/])
423AC_MSG_RESULT(yes),
424AC_MSG_RESULT(no))
425
426AC_MSG_CHECKING(for struct sockaddr_in6.sin6_len)
427AC_TRY_LINK(
428[
429#ifdef HAVE_SYS_TYPES_H
430#	include <sys/types.h>
431#endif
432#ifdef HAVE_NETINET_IN_H
433#	include <netinet/in.h>
434#endif
435#ifdef HAVE_ARPA_NAMESER_H
436#	include <arpa/nameser.h>
437#endif
438#ifdef HAVE_RESOLV_H
439#	include <resolv.h>
440#endif
441#ifndef C_IN
442#	define C_IN	ns_c_in
443#endif	/* C_IN */
444#ifndef T_SOA
445#	define T_SOA	ns_t_soa
446#endif	/* T_SOA */
447],
448[
449	struct sockaddr_in6	sin6;
450	unsigned int		len;
451
452	len = sin6.sin6_len;
453],
454AC_DEFINE(HAVE_RES_SIN6_LEN,1,[Define to 1 if 'sockaddr_in6.sin6_len' exists. /BSD/])
455AC_MSG_RESULT(yes),
456AC_MSG_RESULT(no))
457
458AC_MSG_CHECKING(for union semun)
459AC_TRY_COMPILE(
460[
461#include <sys/types.h>
462#include <sys/ipc.h>
463#include <sys/sem.h>
464],
465[union semun foo;],
466AC_DEFINE(HAVE_SEMUN, 1, [Define to 1 if union 'semun' exists.])
467AC_MSG_RESULT(yes),
468AC_MSG_RESULT(no))
469
470AC_MSG_CHECKING(for struct swaptable in sys/swap.h)
471AC_TRY_COMPILE(
472[
473#include <stdlib.h>
474#include <sys/types.h>
475#include <sys/syscall.h>
476#include <sys/swap.h>
477
478#ifndef NULL
479#define NULL (void *)0
480#endif
481],
482[
483    register int cnt, i;
484    register int t, f;
485    struct swaptable *swt;
486    struct swapent *ste;
487    static char path[256];
488
489    /* get total number of swap entries */
490    cnt = swapctl(SC_GETNSWP, 0);
491
492    /* allocate enough space to hold count + n swapents */
493    swt = (struct swaptable *)malloc(sizeof(int) +
494             cnt * sizeof(struct swapent));
495    if (swt == NULL)
496    {
497  return;
498    }
499    swt->swt_n = cnt;
500
501    /* fill in ste_path pointers: we do not care about the paths, so we
502point
503       them all to the same buffer */
504    ste = &(swt->swt_ent[0]);
505    i = cnt;
506    while (--i >= 0)
507    {
508  ste++->ste_path = path;
509    }
510
511    /* grab all swap info */
512    swapctl(SC_LIST, swt);
513
514    /* walk through the structs and sum up the fields */
515    t = f = 0;
516    ste = &(swt->swt_ent[0]);
517    i = cnt;
518    while (--i >= 0)
519    {
520  /* do not count slots being deleted */
521  if (!(ste->ste_flags & ST_INDEL) &&
522      !(ste->ste_flags & ST_DOINGDEL))
523  {
524      t += ste->ste_pages;
525      f += ste->ste_free;
526  } ste++;
527    }
528
529    /* fill in the results */
530    free(swt);
531
532],
533AC_DEFINE(HAVE_SYS_SWAP_SWAPTABLE,1,[Define to 1 if struct 'swaptable' exists.])
534AC_MSG_RESULT(yes),
535AC_MSG_RESULT(no))
536
537AC_MSG_CHECKING(for struct sensordev in sys/sensors.h)
538AC_TRY_COMPILE([
539#include <stdlib.h>
540#include <sys/queue.h>
541#include <sys/sensors.h>],
542[struct sensordev sensordev;
543sensordev.xname[0]='\0';
544sensordev.maxnumt[0]=0;
545],
546AC_DEFINE(HAVE_SENSORDEV,1,[Define to 1 if struct 'sensordev' exists.])
547AC_MSG_RESULT(yes),
548AC_MSG_RESULT(no))
549
550AC_MSG_CHECKING(for struct statvfs64 in sys/statvfs.h)
551AC_TRY_COMPILE(
552[
553#ifdef HAVE_SYS_TYPES_H
554#	include <sys/types.h>
555#endif
556#ifdef HAVE_SYS_STATVFS_H
557#	include <sys/statvfs.h>
558#endif
559],
560[
561	struct statvfs64	s;
562	s.f_frsize = s.f_blocks = s.f_bfree = s.f_bavail = 0;
563	statvfs64("/", &s);
564],
565AC_DEFINE(HAVE_SYS_STATVFS64, 1, [Define to 1 if struct 'statvfs64' exists.])
566AC_MSG_RESULT(yes),
567AC_MSG_RESULT(no))
568
569AC_MSG_CHECKING(for struct statfs64 in sys/statfs.h)
570AC_TRY_COMPILE(
571[
572#ifdef HAVE_SYS_TYPES_H
573#	include <sys/types.h>
574#endif
575#ifdef HAVE_SYS_STATFS_H
576#	include <sys/statfs.h>
577#endif
578],
579[
580	struct statfs64	s;
581	s.f_bsize = s.f_blocks = s.f_bfree = s.f_bavail = 0;
582	statfs64("/", &s);
583],
584AC_DEFINE(HAVE_SYS_STATFS64, 1, [Define to 1 if struct 'statfs64' exists.])
585AC_MSG_RESULT(yes),
586AC_MSG_RESULT(no))
587
588AC_MSG_CHECKING(for field ss_family in struct sockaddr_storage)
589AC_TRY_COMPILE([#include <sys/socket.h>],
590[struct sockaddr_storage ss;
591ss.ss_family = 0;
592],
593AC_DEFINE(HAVE_SOCKADDR_STORAGE_SS_FAMILY, 1, [Define to 1 if 'sockaddr_storage.ss_family' exists.])
594AC_MSG_RESULT(yes),
595AC_MSG_RESULT(no))
596
597AC_MSG_CHECKING(for field mem_unit in struct sysinfo)
598AC_TRY_COMPILE([#include <sys/sysinfo.h>],
599[struct sysinfo sysinfo;
600sysinfo.mem_unit=0;
601],
602AC_DEFINE(HAVE_SYSINFO_MEM_UNIT,1,[Define to 1 if 'sysinfo.mem_unit' exists.])
603AC_MSG_RESULT(yes),
604AC_MSG_RESULT(no))
605
606AC_MSG_CHECKING(for field freeswap in struct sysinfo)
607AC_TRY_COMPILE([#include <sys/sysinfo.h>],
608[struct sysinfo sysinfo;
609sysinfo.freeswap=0;
610],
611AC_DEFINE(HAVE_SYSINFO_FREESWAP,1,[Define to 1 if 'sysinfo.freeswap' exists.])
612AC_MSG_RESULT(yes),
613AC_MSG_RESULT(no))
614
615AC_MSG_CHECKING(for field totalswap in struct sysinfo)
616AC_TRY_COMPILE([#include <sys/sysinfo.h>],
617[struct sysinfo sysinfo;
618sysinfo.totalswap=0;
619],
620AC_DEFINE(HAVE_SYSINFO_TOTALSWAP,1,[Define to 1 if 'sysinfo.totalswap' exists.])
621AC_MSG_RESULT(yes),
622AC_MSG_RESULT(no))
623
624AC_MSG_CHECKING(for field totalram in struct sysinfo)
625AC_TRY_COMPILE([#include <sys/sysinfo.h>],
626[struct sysinfo sysinfo;
627sysinfo.totalram=0;
628],
629AC_DEFINE(HAVE_SYSINFO_TOTALRAM,1,[Define to 1 if 'sysinfo.totalram' exists.])
630AC_MSG_RESULT(yes),
631AC_MSG_RESULT(no))
632
633AC_MSG_CHECKING(for field sharedram in struct sysinfo)
634AC_TRY_COMPILE([#include <sys/sysinfo.h>],
635[struct sysinfo sysinfo;
636sysinfo.sharedram=0;
637],
638AC_DEFINE(HAVE_SYSINFO_SHAREDRAM,1,[Define to 1 if 'sysinfo.sharedram' exists.])
639AC_MSG_RESULT(yes),
640AC_MSG_RESULT(no))
641
642AC_MSG_CHECKING(for field bufferram in struct sysinfo)
643AC_TRY_COMPILE([#include <sys/sysinfo.h>],
644[struct sysinfo sysinfo;
645sysinfo.bufferram=0;
646],
647AC_DEFINE(HAVE_SYSINFO_BUFFERRAM,1,[Define to 1 if 'sysinfo.bufferram' exists.])
648AC_MSG_RESULT(yes),
649AC_MSG_RESULT(no))
650
651AC_MSG_CHECKING(for field freeram in struct sysinfo)
652AC_TRY_COMPILE([#include <sys/sysinfo.h>],
653[struct sysinfo sysinfo;
654sysinfo.freeram=0;
655],
656AC_DEFINE(HAVE_SYSINFO_FREERAM,1,[Define to 1 if 'sysinfo.freeram' exists.])
657AC_MSG_RESULT(yes),
658AC_MSG_RESULT(no))
659
660AC_MSG_CHECKING(for field uptime in struct sysinfo)
661AC_TRY_COMPILE([#include <sys/sysinfo.h>],
662[struct sysinfo sysinfo;
663sysinfo.uptime=0;
664],
665AC_DEFINE(HAVE_SYSINFO_UPTIME,1,[Define to 1 if 'sysinfo.uptime' exists.])
666AC_MSG_RESULT(yes),
667AC_MSG_RESULT(no))
668
669AC_MSG_CHECKING(for field procs in struct sysinfo)
670AC_TRY_COMPILE([#include <sys/sysinfo.h>],
671[struct sysinfo sysinfo;
672sysinfo.procs=0;
673],
674AC_DEFINE(HAVE_SYSINFO_PROCS,1,[Define to 1 if 'sysinfo.procs' exists.])
675AC_MSG_RESULT(yes),
676AC_MSG_RESULT(no))
677
678AC_MSG_CHECKING(for field tm_gmtoff in struct tm)
679AC_TRY_COMPILE([
680#ifdef HAVE_SYS_TIME_H
681#include <sys/time.h>
682#endif	/* HAVE_SYS_TIME_H */
683
684#ifdef HAVE_TIME_H
685#include <time.h>
686#endif	/* HAVE_TIME_H */
687],
688[
689	struct tm tm;
690	tm.tm_gmtoff;
691],
692AC_DEFINE(HAVE_TM_TM_GMTOFF,1,[Define to 1 if 'tm.tm_gmtoff' exists.])
693AC_MSG_RESULT(yes),
694AC_MSG_RESULT(no))
695
696AC_MSG_CHECKING(for linker options --start-group/--end-group)
697saved_LDFLAGS="$LDFLAGS"
698LDFLAGS="-Wl,--start-group -Wl,--end-group"
699AC_TRY_LINK([], [],
700HAVE_START_GROUP="yes"
701AC_MSG_RESULT(yes),
702AC_MSG_RESULT(no)
703)
704LDFLAGS="$saved_LDFLAGS"
705
706AC_MSG_CHECKING(for '__thread' compiler support)
707AC_TRY_COMPILE([#include <stdio.h>],[static __thread int a = 0;],
708AC_DEFINE(HAVE_THREAD_LOCAL,1,[Define to 1 if compiler keyword '__thread' supported.])
709AC_MSG_RESULT(yes),
710AC_MSG_RESULT(no)
711HAVE_THREAD_LOCAL="no")
712
713AC_MSG_CHECKING(for field updates in struct vminfo_t)
714AC_TRY_COMPILE([
715#include <sys/sysinfo.h>
716],
717[
718	vminfo_t vminfo;
719	vminfo.updates;
720],
721AC_DEFINE(HAVE_VMINFO_T_UPDATES,1,[Define to 1 if 'vminfo.updates' exists.])
722AC_MSG_RESULT(yes),
723AC_MSG_RESULT(no))
724
725dnl *****************************************************************
726dnl *                                                               *
727dnl *                     Checks for functions                      *
728dnl *                                                               *
729dnl *****************************************************************
730
731AC_MSG_CHECKING(for function sysconf() in unistd.h)
732AC_TRY_COMPILE(
733[
734#include <unistd.h>
735],
736[	int i;
737
738	i=sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PHYS_PAGES);
739	i=sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PHYS_PAGES);
740],
741AC_DEFINE(HAVE_UNISTD_SYSCONF,1,[Define to 1 if function 'sysconf' exists.])
742AC_MSG_RESULT(yes),
743AC_MSG_RESULT(no))
744
745AC_MSG_CHECKING(for function initgroups())
746AC_TRY_LINK(
747[
748#include <sys/types.h>
749#include <grp.h>
750],
751[
752	char	*user = "zabbix";
753	initgroups(user, 0);
754],
755AC_DEFINE(HAVE_FUNCTION_INITGROUPS,1,[Define to 1 if function 'initgroups' exists.])
756AC_MSG_RESULT(yes),
757AC_MSG_RESULT(no))
758
759AC_MSG_CHECKING(for functions seteuid() and setegid())
760AC_TRY_LINK(
761[
762#include <sys/types.h>
763#include <unistd.h>
764],
765[
766	seteuid(0);
767	setegid(0);
768],
769AC_DEFINE(HAVE_FUNCTION_SETEUID,1,[Define to 1 if functions 'seteuid' and 'setegid' exist.])
770AC_MSG_RESULT(yes),
771AC_MSG_RESULT(no))
772
773AC_MSG_CHECKING(for function setproctitle())
774AC_TRY_LINK(
775[
776#include <sys/types.h>
777#include <unistd.h>
778],
779[
780	setproctitle("Test %d", 1);
781],
782AC_DEFINE(HAVE_FUNCTION_SETPROCTITLE,1,[Define to 1 if function 'setproctitle' exists.])
783AC_MSG_RESULT(yes),
784AC_MSG_RESULT(no))
785
786AC_MSG_CHECKING(for function sysctlbyname())
787AC_TRY_LINK(
788[
789#ifdef HAVE_SYS_TYPES_H
790#include <sys/types.h>
791#endif /* HAVE_SYS_TYPES_H */
792
793#ifdef HAVE_SYS_PARAM_H
794#include <sys/param.h>
795#endif /* HAVE_SYS_PARAM_H */
796
797#include <sys/sysctl.h>
798],
799[
800	sysctlbyname("", 0, 0, 0, 0);
801],
802AC_DEFINE(HAVE_FUNCTION_SYSCTLBYNAME,1,[Define to 1 if 'sysctlbyname' exists.])
803AC_MSG_RESULT(yes),
804AC_MSG_RESULT(no))
805
806AC_MSG_CHECKING(for function sysctl (KERN_BOOTTIME))
807AC_TRY_COMPILE(
808[
809#ifdef HAVE_SYS_TYPES_H
810#include <sys/types.h>
811#endif /* HAVE_SYS_TYPES_H */
812
813#ifdef HAVE_SYS_PARAM_H
814#include <sys/param.h>
815#endif /* HAVE_SYS_PARAM_H */
816
817#include <sys/sysctl.h>
818#include <unistd.h>
819#include <time.h>
820#include <sys/time.h>
821],
822[
823	size_t		len;
824	struct timeval	uptime;
825        int		mib[2];
826
827        mib[0] = CTL_KERN;
828        mib[1] = KERN_BOOTTIME;
829
830        len = sizeof(uptime);
831        sysctl(mib, 2, &uptime, &len, 0, 0);
832],
833AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME,1,[Define to 1 if 'KERN_BOOTTIME' exists.])
834AC_MSG_RESULT(yes),
835AC_MSG_RESULT(no))
836
837AC_MSG_CHECKING(for function sysctl (HW_NCPU))
838AC_TRY_COMPILE(
839[
840#ifdef HAVE_SYS_TYPES_H
841#include <sys/types.h>
842#endif /* HAVE_SYS_TYPES_H */
843
844#ifdef HAVE_SYS_PARAM_H
845#include <sys/param.h>
846#endif /* HAVE_SYS_PARAM_H */
847
848#include <sys/sysctl.h>
849],
850[
851	size_t	len;
852	int	mib[2], ncpu;
853
854	mib[0] = CTL_HW;
855	mib[1] = HW_NCPU;
856
857	len = sizeof(ncpu);
858	sysctl(mib, 2, &ncpu, &len, 0, 0);
859],
860AC_DEFINE(HAVE_FUNCTION_SYSCTL_HW_NCPU,1,[Define to 1 if 'HW_NCPU' exists.])
861AC_MSG_RESULT(yes),
862AC_MSG_RESULT(no))
863
864AC_MSG_CHECKING(for function sysctl (KERN_MAXFILES))
865AC_TRY_COMPILE(
866[
867#ifdef HAVE_SYS_TYPES_H
868#include <sys/types.h>
869#endif /* HAVE_SYS_TYPES_H */
870
871#ifdef HAVE_SYS_PARAM_H
872#include <sys/param.h>
873#endif /* HAVE_SYS_PARAM_H */
874
875#include <sys/sysctl.h>
876],
877[
878	size_t	len;
879        int	mib[2], maxfiles;
880
881        mib[0] = CTL_KERN;
882        mib[1] = KERN_MAXFILES;
883
884        len = sizeof(maxfiles);
885        sysctl(mib, 2, &maxfiles, &len, 0, 0);
886],
887AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_MAXFILES,1,[Define to 1 if 'KERN_MAXFILES' exists.])
888AC_MSG_RESULT(yes),
889AC_MSG_RESULT(no))
890
891AC_MSG_CHECKING(for function sysctl (KERN_MAXPROC))
892AC_TRY_COMPILE(
893[
894#ifdef HAVE_SYS_TYPES_H
895#include <sys/types.h>
896#endif /* HAVE_SYS_TYPES_H */
897
898#ifdef HAVE_SYS_PARAM_H
899#include <sys/param.h>
900#endif /* HAVE_SYS_PARAM_H */
901
902#include <sys/sysctl.h>
903],
904[
905	size_t	len;
906	int	mib[2], maxproc;
907
908        mib[0] = CTL_KERN;
909        mib[1] = KERN_MAXPROC;
910
911        len = sizeof(maxproc);
912        sysctl(mib, 2, &maxproc, &len, 0, 0);
913],
914AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_MAXPROC,1,[Define to 1 if 'KERN_MAXPROC' exists.])
915AC_MSG_RESULT(yes),
916AC_MSG_RESULT(no))
917
918AC_MSG_CHECKING(for function sysctl (KERN_CPTIME,KERN_CPTIME2))
919AC_TRY_COMPILE(
920[
921#include <sys/param.h>
922#include <sys/sysctl.h>
923#if defined(HAVE_SYS_DKSTAT_H)
924#	include <sys/dkstat.h>
925#elif defined(HAVE_SYS_SCHED_H)
926#	include <sys/sched.h>
927#endif
928],
929[
930size_t	sz;
931int	i[] = {CP_USER, CP_NICE, CP_SYS, CP_INTR, CP_IDLE};
932
933{
934	long	states[CPUSTATES];
935	int	mib[2] = {CTL_KERN, KERN_CPTIME};
936
937	sz = sizeof(states);
938	sysctl(mib, 2, &states, &sz, NULL, 0);
939}
940
941{
942	u_int64_t	states[CPUSTATES];
943	int		mib[3] = {CTL_KERN, KERN_CPTIME2, 0};
944
945	sz = sizeof(states);
946	sysctl(mib, 3, &states, &sz, NULL, 0);
947}
948],
949AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_CPTIME,1,[Define to 1 if 'KERN_CPTIME,KERN_CPTIME2' exists.])
950AC_MSG_RESULT(yes),
951AC_MSG_RESULT(no))
952
953AC_MSG_CHECKING(for function clock_gettime in time.h)
954AC_TRY_LINK([
955#ifdef HAVE_TIME_H
956#	include <time.h>
957#elif HAVE_SYS_TIME_H
958#	include <sys/time.h>
959#endif	/* HAVE_SYS_TIME_H */
960],
961[struct timespec tp;
962clock_gettime(CLOCK_REALTIME, &tp);
963],
964AC_DEFINE(HAVE_TIME_CLOCK_GETTIME,1,[Define to 1 if function 'clock_gettime' exists.])
965AC_MSG_RESULT(yes),
966AC_MSG_RESULT(no))
967
968dnl *****************************************************************
969dnl *                                                               *
970dnl *                      Checks for macros                        *
971dnl *                                                               *
972dnl *****************************************************************
973
974AC_MSG_CHECKING(for macro __va_copy() in stdarg.h)
975AC_TRY_COMPILE(
976[
977#include <stdarg.h>
978],
979[
980	va_list	src,dst;
981
982	__va_copy(dst,src);
983],
984AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if macro '__va_copy' exists.])
985AC_MSG_RESULT(yes),
986AC_MSG_RESULT(no))
987
988AC_MSG_CHECKING(for macro __VA_ARGS__)
989AC_TRY_COMPILE(
990[
991#define ZBX_CONST_STRING(str)   str
992int test(const char *fmt, ...) { return 0; }
993],
994[
995#define TEST(fmt, ...) test(ZBX_CONST_STRING(fmt), ##__VA_ARGS__)
996TEST("%s","test");
997TEST("test");
998],
999AC_DEFINE(HAVE___VA_ARGS__,1,[Define to 1 if macro '__VA_ARGS__' exists.])
1000AC_MSG_RESULT(yes),
1001AC_MSG_RESULT(no))
1002
1003dnl *****************************************************************
1004dnl *                                                               *
1005dnl *                 Checks for library functions                  *
1006dnl *                                                               *
1007dnl *****************************************************************
1008
1009AC_TYPE_SIGNAL
1010AC_REPLACE_FUNCS(getloadavg)
1011AC_CHECK_FUNCS(hstrerror)
1012AC_CHECK_FUNCS(getenv)
1013AC_CHECK_FUNCS(putenv)
1014AC_CHECK_FUNCS(setenv)
1015AC_CHECK_FUNCS(tzset)
1016AC_CHECK_FUNCS(unsetenv)
1017AC_CHECK_FUNCS(sigqueue)
1018AC_CHECK_FUNCS(round)
1019
1020dnl *****************************************************************
1021dnl *                                                               *
1022dnl *            Checks for file system characteristics             *
1023dnl *                                                               *
1024dnl *****************************************************************
1025
1026AC_MSG_CHECKING(for /proc filesystem)
1027if test -d /proc; then
1028	AC_MSG_RESULT(yes)
1029	AC_DEFINE(HAVE_PROC,1,[Define to 1 if '/proc' file system should be used.])
1030else
1031	AC_MSG_RESULT(no)
1032fi
1033
1034AC_MSG_CHECKING(for file /proc/stat)
1035if test -r /proc/stat; then
1036	AC_MSG_RESULT(yes)
1037	AC_DEFINE(HAVE_PROC_STAT,1,[Define to 1 if file '/proc/stat' should be used.])
1038else
1039	AC_MSG_RESULT(no)
1040fi
1041
1042AC_MSG_CHECKING(for file /proc/cpuinfo)
1043if test -r /proc/cpuinfo; then
1044	AC_MSG_RESULT(yes)
1045	AC_DEFINE(HAVE_PROC_CPUINFO,1,[Define to 1 if file '/proc/cpuinfo' should be used.])
1046else
1047	AC_MSG_RESULT(no)
1048fi
1049
1050dnl Solaris
1051AC_MSG_CHECKING(for file /proc/0/psinfo)
1052if test -r /proc/0/psinfo; then
1053	AC_MSG_RESULT(yes)
1054	AC_DEFINE(HAVE_PROC_0_PSINFO,1,[Define to 1 if file '/proc/0/psinfo' should be used.])
1055else
1056	AC_MSG_RESULT(no)
1057fi
1058
1059AC_MSG_CHECKING(for file /proc/loadavg)
1060if test -r /proc/loadavg; then
1061	AC_MSG_RESULT(yes)
1062	AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define to 1 if file '/proc/loadavg' should be used.])
1063else
1064	AC_MSG_RESULT(no)
1065fi
1066
1067AC_MSG_CHECKING(for file /proc/net/dev)
1068if test -r /proc/net/dev; then
1069	AC_MSG_RESULT(yes)
1070	AC_DEFINE(HAVE_PROC_NET_DEV,1,[Define to 1 if file '/proc/net/dev' should be used.])
1071else
1072	AC_MSG_RESULT(no)
1073fi
1074
1075dnl *****************************************************************
1076dnl *                                                               *
1077dnl *              Checks for compiler characteristics              *
1078dnl *                                                               *
1079dnl *****************************************************************
1080
1081dnl Check for %qu format (FreeBSD 4.x)
1082dnl FreeBSD 4.x does not support %llu
1083AC_MSG_CHECKING(for long long format)
1084AC_TRY_RUN(
1085[
1086#include <sys/types.h>
1087int main()
1088{
1089        uint64_t i;
1090
1091        sscanf("200000000010020", "%qu", &i);
1092
1093        if (i == 200000000010020) return 0;
1094        else return -1;
1095}
1096],
1097AC_DEFINE(HAVE_LONG_LONG_QU, 1 ,[Define to 1 if format '%qu' exists.])
1098AC_MSG_RESULT(yes),
1099AC_MSG_RESULT(no),
1100AC_MSG_RESULT(no))
1101
1102dnl option -rdynamic is needed for readable backtraces
1103AC_MSG_CHECKING(for -rdynamic linking option)
1104saved_LDFLAGS="$LDFLAGS"
1105LDFLAGS="-rdynamic $LDFLAGS"
1106AC_TRY_LINK([#include <execinfo.h>],
1107[void *bcktrc[6];
1108(void)backtrace(bcktrc, 6);
1109],
1110LDFLAGS="-rdynamic $saved_LDFLAGS"
1111AC_MSG_RESULT(yes),
1112LDFLAGS="$saved_LDFLAGS"
1113AC_MSG_RESULT(no))
1114
1115dnl *****************************************************************
1116dnl *                                                               *
1117dnl *                 Checks for operating systems                  *
1118dnl *                                                               *
1119dnl *****************************************************************
1120
1121AC_MSG_CHECKING(for libperfstat 5.2.0.40 fileset)
1122AC_TRY_COMPILE([#include <sys/protosw.h>
1123#include <libperfstat.h>],
1124[perfstat_memory_total_t	memstats;
1125memstats.virt_active = 0;
1126],
1127AC_DEFINE(HAVE_AIXOSLEVEL_520004,1,[Define to 1 if libperfstat 5.2.0.40 fileset exists.])
1128AC_MSG_RESULT(yes),
1129AC_MSG_RESULT(no))
1130
1131AC_MSG_CHECKING(for libperfstat 5.3.0.60 fileset)
1132AC_TRY_COMPILE([#include <sys/protosw.h>
1133#include <libperfstat.h>],
1134[perfstat_partition_total_t	lparstats;
1135lparstats.type.b.donate_enabled = 0;
1136lparstats.idle_donated_purr = 0;
1137lparstats.busy_donated_purr = 0;
1138lparstats.idle_stolen_purr = 0;
1139lparstats.busy_stolen_purr = 0;
1140],
1141AC_DEFINE(HAVE_AIXOSLEVEL_530006,1,[Define to 1 if libperfstat 5.3.0.60 fileset exists.])
1142AC_MSG_RESULT(yes),
1143AC_MSG_RESULT(no))
1144
1145case "$host_os" in
1146linux*)
1147	ARCH="linux"
1148	;;
1149aix*)
1150	ARCH="aix"
1151	;;
1152darwin*|rhapsody*)
1153	ARCH="osx"
1154	AC_DEFINE([MAC_OS_X], 1, [Define to 1 if you are using Mac OS X.])
1155	;;
1156*solaris*)
1157	ARCH="solaris"
1158	;;
1159hpux*)
1160	ARCH="hpux"
1161	;;
1162freebsd*)
1163	ARCH="freebsd"
1164	;;
1165netbsd*)
1166	ARCH="netbsd"
1167	;;
1168osf*)
1169	ARCH="osf"
1170	;;
1171openbsd*)
1172	ARCH="openbsd"
1173	;;
1174*)
1175	ARCH="unknown"
1176	;;
1177esac
1178
1179AC_MSG_CHECKING(for architecture)
1180AC_MSG_RESULT([$ARCH ($host_os)])
1181
1182if test "x$ARCH" = "xlinux"; then
1183	AC_MSG_CHECKING([for the linux kernel version])
1184
1185	kernel=`uname -r`
1186
1187	case "${kernel}" in
1188		2.6.*)
1189			AC_MSG_RESULT([2.6 family (${kernel})])
1190			AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you are using Linux 2.6.x])
1191			;;
1192		2.4.*)
1193			AC_MSG_RESULT([2.4 family (${kernel})])
1194			AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you are using Linux 2.4.x])
1195			;;
1196		*)
1197			AC_MSG_RESULT([unknown family (${kernel})])
1198			;;
1199	esac
1200fi
1201
1202if test "x$ARCH" = "xsolaris"; then
1203	dnl Forcing a 64-bit application for a 64-bit Solaris
1204	dnl A 32-bit program that uses /proc is able to look at 32-bit processes,
1205	dnl but is not able to understand all attributes of a 64-bit process.
1206	AC_MSG_CHECKING(for -m64 compilation flag)
1207	saved_CFLAGS="$CFLAGS"
1208	CFLAGS="-m64"
1209	AC_TRY_RUN(
1210	[int main(void) {return 0;}],
1211	CFLAGS="-m64 $saved_CFLAGS"
1212	AC_MSG_RESULT(yes),
1213	CFLAGS="$saved_CFLAGS"
1214	AC_MSG_RESULT(no))
1215	CFLAGS="${CFLAGS} -DZBX_OLD_SOLARIS"
1216fi
1217
1218if test "x$ARCH" = "xhpux"; then
1219	dnl Low Level Discovery needs a way to get the list of network
1220	dnl interfaces available on the monitored system. On HP-UX systems
1221	dnl that way depends on the OS version.
1222	hpux_version=${host_os#hpux}
1223	hpux_major=${hpux_version%.*}
1224	hpux_minor=${hpux_version#*.}
1225
1226	AC_DEFINE_UNQUOTED([HPUX_VERSION], $hpux_major$hpux_minor, [Define to HP-UX version])
1227
1228	dnl This API level is needed so that "utsname.nodename" is not truncated.
1229	AC_MSG_CHECKING(for -D_HPUX_API_LEVEL=20040821 compilation flag)
1230	saved_CFLAGS="$CFLAGS"
1231	CFLAGS="-D_HPUX_API_LEVEL=20040821"
1232	AC_TRY_RUN(
1233[
1234#ifdef HAVE_DLFCN_H
1235#	include <dlfcn.h>
1236#endif
1237#ifdef HAVE_SYS_UTSNAME_H
1238#	include <sys/utsname.h>
1239#endif
1240
1241int main(void)
1242{
1243	void		*p1, *p2;
1244	struct utsname	name;
1245
1246	/* check that the compiler (e.g., GCC 4.3.0 and above) supports function-level versioning */
1247
1248	p1 = uname;
1249	p2 = dlsym(RTLD_DEFAULT, "uname{20040821}");
1250
1251	if (p1 != p2)
1252		return 1;
1253
1254	/* uname() fails with EFAULT on HP-UX systems that were only partially upgraded to this API level */
1255
1256	return -1 == uname(&name) ? 1 : 0;
1257}
1258],
1259	CFLAGS="-D_HPUX_API_LEVEL=20040821 $saved_CFLAGS"
1260	AC_MSG_RESULT(yes),
1261	CFLAGS="$saved_CFLAGS"
1262	AC_MSG_RESULT(no))
1263fi
1264
1265AC_DEFINE_UNQUOTED([ARCH], "${ARCH}", [Define to OS name for code managing])
1266AC_SUBST(ARCH)
1267
1268AC_CHECK_SIZEOF([void *])
1269
1270dnl *****************************************************************
1271dnl *                                                               *
1272dnl *         Checks for options given on the command line          *
1273dnl *                                                               *
1274dnl *****************************************************************
1275
1276AC_ARG_ENABLE(static,[  --enable-static         Build statically linked binaries],
1277[case "${enableval}" in
1278  yes)
1279    LDFLAGS="${LDFLAGS} -static"
1280    AC_MSG_CHECKING(if static linking is possible)
1281    AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
1282      [AC_MSG_RESULT([yes])
1283        static_linking=yes],
1284      [AC_MSG_RESULT([no])
1285        static_linking=no])
1286      if test "x$static_linking" = "xno"; then
1287        AC_MSG_ERROR([static linking is not possible on this system])
1288      fi
1289    ;;
1290  no) ;;
1291  *) AC_MSG_ERROR([bad value ${enableval} for --enable-static]) ;;
1292esac])
1293
1294AC_ARG_ENABLE(static-libs,[  --enable-static-libs    Build statically linked binaries with selected libs from default folders],
1295[case "${enableval}" in
1296  yes)
1297    static_linking_libs=yes
1298    saved_LIBS="$LIBS"
1299    LIBS="${saved_LIBS} -Wl,-bstatic -Wl,-bdynamic"
1300    AC_MSG_CHECKING([if libs static linking with "-Wl,-b" is possible])
1301    AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
1302      [AC_MSG_RESULT([yes])
1303        static_linking_support="-Wl,-b"],
1304      [AC_MSG_RESULT([no])
1305        static_linking_support=no])
1306        LIBS="$saved_LIBS"
1307
1308    if test "x$static_linking_support" = "xno"; then
1309      LIBS="${saved_LIBS} -Wl,-Bstatic -Wl,-Bdynamic"
1310      AC_MSG_CHECKING([if libs static linking with "-Wl,-B" is possible])
1311      AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
1312        [AC_MSG_RESULT([yes])
1313          static_linking_support="-Wl,-B"],
1314        [AC_MSG_RESULT([no])
1315          static_linking_support=no])
1316          LIBS="$saved_LIBS"
1317    fi
1318    ;;
1319  no) ;;
1320  *) AC_MSG_ERROR([bad value ${enableval} for --enable-static-libs]) ;;
1321esac])
1322
1323AC_ARG_ENABLE(server,[  --enable-server         Turn on build of Zabbix server],
1324[case "${enableval}" in
1325  yes) server=yes ;;
1326  no)  server=no ;;
1327  *) AC_MSG_ERROR([bad value ${enableval} for --enable-server]) ;;
1328esac],
1329[server=no])
1330AM_CONDITIONAL(SERVER, test "x$server" = "xyes")
1331
1332AC_ARG_ENABLE(proxy,[  --enable-proxy          Turn on build of Zabbix proxy],
1333[case "${enableval}" in
1334  yes) proxy=yes ;;
1335  no)  proxy=no ;;
1336  *) AC_MSG_ERROR([bad value ${enableval} for --enable-proxy]) ;;
1337esac],
1338[proxy=no])
1339AM_CONDITIONAL(PROXY, test "x$proxy" = "xyes")
1340
1341AC_ARG_ENABLE(agent,[  --enable-agent          Turn on build of Zabbix agent and client utilities],
1342[case "${enableval}" in
1343  yes) agent=yes ;;
1344  no)  agent=no ;;
1345  *) AC_MSG_ERROR([bad value ${enableval} for --enable-agent]) ;;
1346esac],
1347[agent=no])
1348AM_CONDITIONAL(AGENT, test "x$agent" = "xyes")
1349
1350AC_ARG_ENABLE(agent2,[  --enable-agent2         Turn on build of Zabbix agent 2],
1351[case "${enableval}" in
1352  yes) agent2=yes ;;
1353  no)  agent2=no ;;
1354  *) AC_MSG_ERROR([bad value ${enableval} for --enable-agent2]) ;;
1355esac
1356test "x$agent2" = "xyes" -a "x$HAVE_THREAD_LOCAL" = "xno" && AC_MSG_ERROR([C compiler is not compatible with agent2 assembly])
1357],
1358[agent2=no])
1359AM_CONDITIONAL(AGENT2, test "x$agent2" = "xyes")
1360
1361AC_ARG_ENABLE(webservice,[  --enable-webservice         Turn on build of Zabbix web service],
1362[case "${enableval}" in
1363  yes) webservice=yes ;;
1364  no)  webservice=no ;;
1365  *) AC_MSG_ERROR([bad value ${enableval} for --enable-webservice]) ;;
1366esac
1367test "x$webservice" = "xyes" -a "x$HAVE_THREAD_LOCAL" = "xno" && AC_MSG_ERROR([C compiler is not compatible with webservice assembly])
1368],
1369[webservice=no])
1370AM_CONDITIONAL(WEBSERVICE, test "x$webservice" = "xyes")
1371
1372AC_ARG_ENABLE(java,[  --enable-java           Turn on build of Zabbix Java gateway],
1373[case "${enableval}" in
1374  yes) java=yes ;;
1375  no)  java=no ;;
1376  *) AC_MSG_ERROR([bad value ${enableval} for --enable-java]) ;;
1377esac],
1378[java=no])
1379AM_CONDITIONAL(JAVA, test "x$java" = "xyes")
1380
1381AC_ARG_ENABLE(ipv6,[  --enable-ipv6           Turn on support of IPv6],
1382[case "${enableval}" in
1383  yes) ipv6=yes ;;
1384  no)  ipv6=no ;;
1385  *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
1386esac],
1387[ipv6=no])
1388AM_CONDITIONAL(IPV6, test "x$ipv6" = "xyes")
1389
1390AM_CONDITIONAL([DBSCHEMA], [test -d create])
1391
1392AM_CONDITIONAL([ZBXCMOCKA], [(test -f m4/conf_tests.m4) && (test "x$server" = "xyes" || test "x$proxy" = "xyes" || test "x$agent" = "xyes")])
1393
1394have_db="no"
1395have_unixodbc="no"
1396have_web_monitoring="no"
1397have_snmp="no"
1398have_ipmi="no"
1399have_ipv6="no"
1400have_ssh="no"
1401have_tls="no"
1402have_libmodbus="no"
1403
1404
1405if test "x$ipv6" = "xyes"; then
1406	AC_DEFINE(HAVE_IPV6,1,[Define to 1 if IPv6 should be enabled.])
1407	have_ipv6="yes"
1408fi
1409
1410if test "x$server" = "xyes" || test "x$proxy" = "xyes"; then
1411
1412
1413	dnl Checking for MySQL support
1414	AX_LIB_MYSQL()
1415	if test "x$want_mysql" = "xyes"; then
1416		if test "x$have_db" != "xno"; then
1417			AC_MSG_ERROR([You can configure for only one database.])
1418		fi
1419
1420		if test "x$found_mysql" = "xyes"; then
1421			have_db="MySQL"
1422			have_multirow_insert="yes"
1423		else
1424			AC_MSG_ERROR([MySQL library not found])
1425		fi
1426	fi
1427
1428	dnl Checking for Oracle support
1429	AX_LIB_ORACLE_OCI([10.0])
1430	if test "x$want_oracle_oci" = "xyes"; then
1431		if test "x$have_db" != "xno"; then
1432			AC_MSG_ERROR([You can configure for only one database.])
1433		fi
1434
1435		if test "x$HAVE_ORACLE_OCI" = "xyes"; then
1436			have_db="Oracle"
1437
1438			ORACLE_CPPFLAGS="$ORACLE_OCI_CFLAGS"
1439			ORACLE_LDFLAGS="$ORACLE_OCI_LDFLAGS"
1440			ORACLE_LIBS="$ORACLE_OCI_LIBS"
1441
1442			AC_DEFINE(HAVE_ORACLE,1,[Define to 1 if Oracle should be enabled.])
1443		else
1444			AC_MSG_ERROR([Oracle OCI library not found])
1445		fi
1446	fi
1447
1448	dnl Checking for PostgreSQL support
1449	AX_LIB_POSTGRESQL("9.2")
1450	if test "x$want_postgresql" = "xyes"; then
1451		if test "x$have_db" != "xno"; then
1452			AC_MSG_ERROR([You can configure for only one database.])
1453		fi
1454
1455		if test "x$found_postgresql" = "xyes"; then
1456			if test "$postgresql_version_check" != "1"; then
1457				AC_MSG_ERROR([PostgreSQL version mismatch])
1458			fi
1459
1460			have_db="PostgreSQL"
1461
1462			if test "$postgresql_version_number" -ge 8002000; then
1463				have_multirow_insert="yes"
1464			fi
1465
1466		else
1467			AC_MSG_ERROR([PostgreSQL library not found])
1468		fi
1469	fi
1470
1471	dnl Checking for SQLite3 support
1472	AX_LIB_SQLITE3()
1473	if test "x$want_sqlite3" = "xyes"; then
1474		if test "x$server" = "xyes"; then
1475			AC_MSG_ERROR([SQLite is not supported as a main Zabbix database backend.])
1476		fi
1477
1478		if test "x$have_db" != "xno"; then
1479			AC_MSG_ERROR([You can configure for only one database.])
1480		fi
1481
1482		if test "x$found_sqlite3" = "xyes"; then
1483			have_db="SQLite v3.x"
1484
1485			saved_CPPFLAGS="$CPPFLAGS"
1486			saved_LDFLAGS="$LDFLAGS"
1487
1488			CPPFLAGS="$CPPFLAGS $SQLITE3_CPPFLAGS"
1489			LDFLAGS="$LDFLAGS $SQLITE3_LDFLAGS $SQLITE3_LIBS"
1490
1491			AC_MSG_CHECKING([for function sqlite3_open_v2() in sqlite3.h])
1492			AC_TRY_LINK([#include <sqlite3.h>],
1493				[sqlite3 *conn = 0;
1494				sqlite3_open_v2("dbname", &conn, SQLITE_OPEN_READWRITE, 0);
1495				],
1496				AC_DEFINE(HAVE_FUNCTION_SQLITE3_OPEN_V2,1,[Define to 1 if function 'sqlite3_open_v2' exists.])
1497				AC_MSG_RESULT(yes),
1498				AC_MSG_RESULT(no))
1499
1500			CPPFLAGS="$saved_CPPFLAGS"
1501			LDFLAGS="$saved_LDFLAGS"
1502		else
1503			AC_MSG_ERROR([SQLite3 library not found])
1504		fi
1505	fi
1506
1507	AC_MSG_CHECKING(for Zabbix server/proxy database selection)
1508	if test "x$have_db" = "xno"; then
1509		AC_MSG_RESULT(error)
1510		AC_MSG_ERROR([No database selected for Zabbix server/proxy. Use --with-mysql or --with-oracle or --with-postgresql or --with-sqlite3.])
1511	else
1512		AC_MSG_RESULT(ok)
1513	fi
1514
1515	AC_MSG_CHECKING(for multirow insert statements)
1516	if test "x$have_multirow_insert" = "xyes"; then
1517		AC_DEFINE(HAVE_MULTIROW_INSERT,1,[Define to 1 if database supports multirow insert statements.])
1518		AC_MSG_RESULT(yes)
1519	else
1520		AC_MSG_RESULT(no)
1521	fi
1522
1523	DB_CFLAGS="$MYSQL_CFLAGS $ORACLE_CPPFLAGS $POSTGRESQL_CFLAGS $SQLITE3_CPPFLAGS"
1524	DB_LDFLAGS="$MYSQL_LDFLAGS $ORACLE_LDFLAGS $POSTGRESQL_LDFLAGS $SQLITE3_LDFLAGS"
1525	DB_LIBS="$MYSQL_LIBS $ORACLE_LIBS $POSTGRESQL_LIBS $SQLITE3_LIBS"
1526
1527	AC_SUBST(DB_CFLAGS)
1528	AC_SUBST(DB_LDFLAGS)
1529	AC_SUBST(DB_LIBS)
1530
1531	SERVER_LDFLAGS="${SERVER_LDFLAGS} ${DB_LDFLAGS}"
1532	SERVER_LIBS="${SERVER_LIBS} ${DB_LIBS}"
1533
1534	PROXY_LDFLAGS="${PROXY_LDFLAGS} ${DB_LDFLAGS}"
1535	PROXY_LIBS="${PROXY_LIBS} ${DB_LIBS}"
1536
1537	dnl Check for LIBXML2 [by default - skip]
1538	LIBXML2_CHECK_CONFIG([no])
1539	if test "x$want_libxml2" = "xyes"; then
1540		if test "x$found_libxml2" != "xyes"; then
1541			AC_MSG_ERROR([LIBXML2 library not found])
1542		else
1543			have_libxml2="yes"
1544		fi
1545	fi
1546
1547	LDFLAGS="$LDFLAGS $LIBXML2_LDFLAGS"
1548	LIBS="$LIBS $LIBXML2_LIBS"
1549
1550	AC_SUBST(LIBXML2_CFLAGS)
1551
1552	dnl Checking for unixODBC support
1553	LIBUNIXODBC_CHECK_CONFIG([no])
1554	if test "x$want_unixodbc" = "xyes"; then
1555		if test "x$unixodbc_error" != "x"; then
1556			AC_MSG_ERROR($unixodbc_error)
1557		fi
1558		have_unixodbc="yes"
1559	fi
1560	SERVER_LDFLAGS="$SERVER_LDFLAGS $UNIXODBC_LDFLAGS"
1561	SERVER_LIBS="$SERVER_LIBS $UNIXODBC_LIBS"
1562
1563	PROXY_LDFLAGS="$PROXY_LDFLAGS $UNIXODBC_LDFLAGS"
1564	PROXY_LIBS="$PROXY_LIBS $UNIXODBC_LIBS"
1565
1566	AC_SUBST(UNIXODBC_CFLAGS)
1567
1568	dnl Check for Net-SNMP [by default - skip]
1569	LIBNETSNMP_CHECK_CONFIG([no], "5.3.0")
1570
1571	if test "x$want_netsnmp" = "xyes"; then
1572		if test "x$found_netsnmp" != "xyes"; then
1573			AC_MSG_ERROR([Invalid Net-SNMP directory - unable to find net-snmp-config])
1574		else
1575			have_snmp="yes"
1576		fi
1577	fi
1578	SERVER_LDFLAGS="$SNMP_LDFLAGS $SERVER_LDFLAGS"
1579	SERVER_LIBS="$SERVER_LIBS $SNMP_LIBS"
1580
1581	PROXY_LDFLAGS="$SNMP_LDFLAGS $PROXY_LDFLAGS"
1582	PROXY_LIBS="$PROXY_LIBS $SNMP_LIBS"
1583
1584
1585	AC_SUBST(SNMP_CFLAGS)
1586
1587	dnl Check for LIBSSH2 [by default - skip] at least of version 1.0.0.
1588	LIBSSH2_CHECK_CONFIG([no])
1589	LIBSSH_CHECK_CONFIG([no])
1590	if test "x$want_ssh2" = "xyes"; then
1591		if test "x$want_ssh" != "xno"; then
1592			AC_MSG_ERROR([You can configure for only one SSH library (--with-ssh or --with-ssh2).])
1593		fi
1594
1595		if test "x$found_ssh2" != "xyes"; then
1596			AC_MSG_ERROR([SSH2 library not found])
1597		elif test "x$accept_ssh2_version" != "xyes"; then
1598			AC_MSG_ERROR([SSH2 library version requirement not met (>= 1.0.0)])
1599		else
1600			have_ssh="yes (libssh2)"
1601		fi
1602	fi
1603	SERVER_LDFLAGS="$SERVER_LDFLAGS $SSH2_LDFLAGS"
1604	SERVER_LIBS="$SERVER_LIBS $SSH2_LIBS"
1605
1606	PROXY_LDFLAGS="$PROXY_LDFLAGS $SSH2_LDFLAGS"
1607	PROXY_LIBS="$PROXY_LIBS $SSH2_LIBS"
1608
1609	AC_SUBST(SSH2_CFLAGS)
1610
1611	dnl Check for LIBSSH [by default - skip] at least of version 0.7.0.
1612	if test "x$want_ssh" = "xyes"; then
1613		if test "x$found_ssh" != "xyes"; then
1614			AC_MSG_ERROR([SSH library not found])
1615		elif test "x$accept_ssh_version" != "xyes"; then
1616			AC_MSG_ERROR([SSH library version requirement not met (>= 0.6.0)])
1617		else
1618			have_ssh="yes (libssh)"
1619		fi
1620	fi
1621	SERVER_LDFLAGS="$SERVER_LDFLAGS $SSH_LDFLAGS"
1622	SERVER_LIBS="$SERVER_LIBS $SSH_LIBS"
1623
1624	PROXY_LDFLAGS="$PROXY_LDFLAGS $SSH_LDFLAGS"
1625	PROXY_LIBS="$PROXY_LIBS $SSH_LIBS"
1626
1627	AC_SUBST(SSH_CFLAGS)
1628
1629	found_openipmi="no"
1630	dnl Check for libOpenIPMI [by default - skip]
1631	LIBOPENIPMI_CHECK_CONFIG([no])
1632	if test "x$want_openipmi" = "xyes"; then
1633		if test "x$found_openipmi" != "xyes"; then
1634			AC_MSG_ERROR([Invalid OPENIPMI directory - unable to find ipmiif.h])
1635		else
1636			have_ipmi="yes"
1637		fi
1638	fi
1639
1640	SERVER_LDFLAGS="$SERVER_LDFLAGS $OPENIPMI_LDFLAGS"
1641	SERVER_LIBS="$SERVER_LIBS $OPENIPMI_LIBS"
1642
1643	PROXY_LDFLAGS="$PROXY_LDFLAGS $OPENIPMI_LDFLAGS"
1644	PROXY_LIBS="$PROXY_LIBS $OPENIPMI_LIBS"
1645
1646	AC_SUBST(OPENIPMI_CFLAGS)
1647
1648	dnl Check for zlib, used by Zabbix server-proxy communications
1649	ZLIB_CHECK_CONFIG([no])
1650	if test "x$found_zlib" != "xyes"; then
1651		AC_MSG_ERROR([Unable to use zlib (zlib check failed)])
1652	fi
1653
1654	AC_SUBST(ZLIB_CFLAGS)
1655
1656	dnl Check for 'libpthread' library that supports PTHREAD_PROCESS_SHARED flag
1657	LIBPTHREAD_CHECK_CONFIG([no])
1658	if test "x$found_libpthread" != "xyes"; then
1659		AC_MSG_ERROR([Unable to use libpthread (libpthread check failed)])
1660	fi
1661fi
1662
1663SERVER_LDFLAGS="$SERVER_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1664SERVER_LIBS="$SERVER_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1665
1666PROXY_LDFLAGS="$PROXY_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1667PROXY_LIBS="$PROXY_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1668
1669AGENT_LDFLAGS="$AGENT_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1670AGENT_LIBS="$AGENT_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1671
1672AGENT2_LDFLAGS="$AGENT2_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1673AGENT2_LIBS="$AGENT2_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1674
1675ZBXGET_LDFLAGS="$ZBXGET_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1676ZBXGET_LIBS="$ZBXGET_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1677
1678SENDER_LDFLAGS="$SENDER_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1679SENDER_LIBS="$SENDER_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1680
1681ZBXJS_LDFLAGS="$ZBXJS_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1682ZBXJS_LIBS="$ZBXJS_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1683
1684AM_CONDITIONAL(HAVE_IPMI, [test "x$have_ipmi" = "xyes"])
1685AM_CONDITIONAL(HAVE_LIBXML2, test "x$have_libxml2" = "xyes")
1686
1687dnl Check if Zabbix internal IPC services are used
1688have_ipcservice="no"
1689if test "x$have_ipmi" = "xyes"; then
1690	have_ipcservice="yes"
1691fi
1692
1693if test "x$server" = "xyes"; then
1694	have_ipcservice="yes"
1695fi
1696
1697if test "x$proxy" = "xyes"; then
1698	have_ipcservice="yes"
1699fi
1700
1701AM_CONDITIONAL(PROXY_IPCSERVICE, [test "x$have_ipmi" = "xyes"])
1702
1703dnl Check for libevent, used by Zabbix IPC services
1704if test "x$have_ipcservice" = "xyes"; then
1705	AC_DEFINE([HAVE_IPCSERVICE], 1, [Define to 1 if Zabbix IPC services are used])
1706
1707	LIBEVENT_CHECK_CONFIG([no])
1708	if test "x$found_libevent" != "xyes"; then
1709		AC_MSG_ERROR([Unable to use libevent (libevent check failed)])
1710	fi
1711
1712	SERVER_LDFLAGS="$SERVER_LDFLAGS $LIBEVENT_LDFLAGS"
1713	SERVER_LIBS="$SERVER_LIBS $LIBEVENT_LIBS"
1714
1715	PROXY_LDFLAGS="$PROXY_LDFLAGS $LIBEVENT_LDFLAGS"
1716	PROXY_LIBS="$PROXY_LIBS $LIBEVENT_LIBS"
1717fi
1718
1719dnl Check for GnuTLS libgnutls [by default - skip]
1720LIBGNUTLS_CHECK_CONFIG([no])
1721if test "x$want_gnutls" = "xyes"; then
1722	if test "x$have_tls" != "xno"; then
1723		AC_MSG_ERROR([You can configure for only one TLS library (--with-gnutls or --with-openssl).])
1724	fi
1725
1726	if test "x$found_gnutls" != "xyes"; then
1727		AC_MSG_ERROR([GnuTLS library libgnutls not found])
1728	elif test "x$accept_gnutls_version" != "xyes"; then
1729		AC_MSG_ERROR([GnuTLS library version requirement not met (>= 3.1.18)])
1730	else
1731		have_tls="GnuTLS"
1732	fi
1733	TLS_CFLAGS="$GNUTLS_CFLAGS"
1734	TLS_LDFLAGS="$GNUTLS_LDFLAGS"
1735	TLS_LIBS="$GNUTLS_LIBS"
1736fi
1737
1738dnl Check for OpenSSL libssl and libcrypto [by default - skip]
1739LIBOPENSSL_CHECK_CONFIG([no])
1740if test "x$want_openssl" = "xyes"; then
1741	if test "x$have_tls" != "xno"; then
1742		AC_MSG_ERROR([You can configure for only one TLS library (--with-gnutls or --with-openssl).])
1743	fi
1744
1745	if test "x$found_openssl" != "xOpenSSL" -a "x$found_openssl" != "xOpenSSL (PSK not supported)"; then
1746		AC_MSG_ERROR([OpenSSL library libssl or libcrypto not found])
1747	elif test "x$accept_openssl_version" != "xyes"; then
1748		AC_MSG_ERROR([OpenSSL library version requirement not met (>= 1.0.1)])
1749	else
1750		have_tls=$found_openssl
1751	fi
1752	TLS_CFLAGS="$OPENSSL_CFLAGS"
1753	TLS_LDFLAGS="$OPENSSL_LDFLAGS"
1754	TLS_LIBS="$OPENSSL_LIBS"
1755fi
1756AC_SUBST(TLS_CFLAGS)
1757
1758SERVER_LDFLAGS="$SERVER_LDFLAGS $TLS_LDFLAGS"
1759SERVER_LIBS="$SERVER_LIBS $TLS_LIBS"
1760
1761PROXY_LDFLAGS="$PROXY_LDFLAGS $TLS_LDFLAGS"
1762PROXY_LIBS="$PROXY_LIBS $TLS_LIBS"
1763
1764AGENT_LDFLAGS="$AGENT_LDFLAGS $TLS_LDFLAGS"
1765AGENT_LIBS="$AGENT_LIBS $TLS_LIBS"
1766
1767AGENT2_LDFLAGS="$AGENT2_LDFLAGS $TLS_LDFLAGS"
1768AGENT2_LIBS="$AGENT2_LIBS $TLS_LIBS"
1769
1770ZBXGET_LDFLAGS="$ZBXGET_LDFLAGS $TLS_LDFLAGS"
1771ZBXGET_LIBS="$ZBXGET_LIBS $TLS_LIBS"
1772
1773SENDER_LDFLAGS="$SENDER_LDFLAGS $TLS_LDFLAGS"
1774SENDER_LIBS="$SENDER_LIBS $TLS_LIBS"
1775
1776ZBXJS_LDFLAGS="$ZLIB_LDFLAGS $TLS_LDFLAGS"
1777ZBXJS_LIBS="$ZBXJS_LIBS $TLS_LIBS"
1778
1779dnl Check for libmodbus [by default - skip]
1780if test "x$agent" = "xyes"; then
1781	LIBMODBUS_CHECK_CONFIG([3.0.0])
1782	if test "x$want_libmodbus" = "xyes"; then
1783		if test "x$found_libmodbus" = "xyes"; then
1784			have_libmodbus="yes"
1785		fi
1786	fi
1787	LDFLAGS="$LDFLAGS $LIBMODBUS_LDFLAGS"
1788	CFLAGS="$CFLAGS $LIBMODBUS_CFLAGS"
1789	LIBS="$LIBS $LIBMODBUS_LIBS"
1790fi
1791AM_CONDITIONAL(HAVE_LIBMODBUS, [test "x$have_libmodbus" = "xyes"])
1792
1793if test "x$agent2" = "xyes"; then
1794	AC_CHECK_PROGS([GO], [go], [no])
1795	if test "x$GO" = "xno"; then
1796		AC_MSG_ERROR([Unable to find "go" executable in path])
1797	fi
1798	AC_DEFINE(ZBX_BUILD_AGENT2,1,[Define to 1 if Agent2 is being built.])
1799fi
1800
1801if test "x$webservice" = "xyes"; then
1802	AC_CHECK_PROGS([GO], [go], [no])
1803	if test "x$GO" = "xno"; then
1804		AC_MSG_ERROR([Unable to find "go" executable in path])
1805	fi
1806	AC_DEFINE(ZBX_BUILD_WEBSERVICE,1,[Define to 1 if Web Service is being built.])
1807fi
1808
1809if test "x$java" = "xyes"; then
1810	AC_CHECK_PROGS([JAVAC], [javac], [no])
1811	if test "x$JAVAC" = "xno"; then
1812		AC_MSG_ERROR([Unable to find "javac" executable in path])
1813	fi
1814	AC_CHECK_PROGS([JAR], [jar], [no])
1815	if test "x$JAR" = "xno"; then
1816		AC_MSG_ERROR([Unable to find "jar" executable in path])
1817	fi
1818fi
1819
1820found_ldap="no"
1821dnl Check for libLDAP [by default - skip]
1822LIBLDAP_CHECK_CONFIG([no])
1823if test "x$want_ldap" = "xyes"; then
1824	if test "x$found_ldap" != "xyes"; then
1825		AC_MSG_ERROR([Invalid LDAP directory - unable to find ldap.h])
1826	fi
1827fi
1828SERVER_LDFLAGS="$SERVER_LDFLAGS $LDAP_LDFLAGS"
1829SERVER_LIBS="$SERVER_LIBS $LDAP_LIBS"
1830
1831PROXY_LDFLAGS="$PROXY_LDFLAGS $LDAP_LDFLAGS"
1832PROXY_LIBS="$PROXY_LIBS $LDAP_LIBS"
1833
1834AGENT_LDFLAGS="$AGENT_LDFLAGS $LDAP_LDFLAGS"
1835AGENT_LIBS="$AGENT_LIBS $LDAP_LIBS"
1836
1837AC_SUBST(LDAP_CPPFLAGS)
1838
1839found_curl="no"
1840dnl Checking for libCurl [by default - skip]
1841LIBCURL_CHECK_CONFIG(, [7.13.1], [],[])
1842if test "x$want_curl" = "xyes"; then
1843	if test "x$found_curl" != "xyes"; then
1844		AC_MSG_ERROR([Curl library not found])
1845	fi
1846fi
1847if test "x$found_curl" = "xyes"; then
1848	have_web_monitoring="cURL"
1849fi
1850CFLAGS="$LIBCURL_CFLAGS $CFLAGS"
1851
1852SERVER_LDFLAGS="$SERVER_LDFLAGS $LIBCURL_LDFLAGS"
1853SERVER_LIBS="$SERVER_LIBS $LIBCURL_LIBS"
1854
1855PROXY_LDFLAGS="$PROXY_LDFLAGS $LIBCURL_LDFLAGS"
1856PROXY_LIBS="$PROXY_LIBS $LIBCURL_LIBS"
1857
1858AM_CONDITIONAL(HAVE_LIBCURL, test "x$found_curl" = "xyes")
1859
1860dnl Starting from 2.0 agent can do web monitoring
1861AGENT_LDFLAGS="$AGENT_LDFLAGS $LIBCURL_LDFLAGS"
1862AGENT_LIBS="$AGENT_LIBS $LIBCURL_LIBS"
1863
1864ZBXGET_LDFLAGS="$ZBXGET_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1865ZBXGET_LIBS="$ZBXGET_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1866
1867SENDER_LDFLAGS="$SENDER_LDFLAGS $ZLIB_LDFLAGS $LIBPTHREAD_LDFLAGS"
1868SENDER_LIBS="$SENDER_LIBS $ZLIB_LIBS $LIBPTHREAD_LIBS"
1869
1870ZBXJS_LDFLAGS="$ZBXJS_LDFLAGS $LIBCURL_LDFLAGS"
1871ZBXJS_LIBS="$ZBXJS_LIBS $LIBCURL_LIBS"
1872
1873dnl Check for libpcre, used by Zabbix for regular expressions
1874if test "x$server" = "xyes" || test "x$proxy" = "xyes" || test "x$agent" = "xyes" || test "x$agent2" = "xyes"; then
1875	LIBPCRE_CHECK_CONFIG([no])
1876	if test "x$found_libpcre" != "xyes"; then
1877		AC_MSG_ERROR([Unable to use libpcre (libpcre check failed)])
1878	fi
1879fi
1880
1881CFLAGS="$CFLAGS $LIBPCRE_CFLAGS"
1882LDFLAGS="$LDFLAGS $LIBPCRE_LDFLAGS"
1883if test "x$ARCH" = "xosx"; then
1884	LIBS="$LIBPCRE_LIBS $LIBS"
1885else
1886	LIBS="$LIBS $LIBPCRE_LIBS"
1887fi
1888
1889found_iconv="no"
1890dnl Check for libiconv [by default - skip]
1891LIBICONV_CHECK_CONFIG([no])
1892if test "x$found_iconv" != "xyes"; then
1893	AC_MSG_ERROR([Unable to use iconv (libiconv check failed)])
1894fi
1895LDFLAGS="$LDFLAGS $ICONV_LDFLAGS"
1896LIBS="$LIBS $ICONV_LIBS"
1897
1898RANLIB="ranlib"
1899AC_SUBST(RANLIB)
1900
1901SERVER_CONFIG_FILE="${sysconfdir}/zabbix_server.conf"
1902PROXY_CONFIG_FILE="${sysconfdir}/zabbix_proxy.conf"
1903AGENT_CONFIG_FILE="${sysconfdir}/zabbix_agentd.conf"
1904AGENT2_CONFIG_FILE="${sysconfdir}/zabbix_agent2.conf"
1905WEBSERVICE_CONFIG_FILE="${sysconfdir}/zabbix_web_service.conf"
1906
1907EXTERNAL_SCRIPTS_PATH="${datadir}/zabbix/externalscripts"
1908ALERT_SCRIPTS_PATH="${datadir}/zabbix/alertscripts"
1909
1910CURL_SSL_CERT_LOCATION="${datadir}/zabbix/ssl/certs"
1911CURL_SSL_KEY_LOCATION="${datadir}/zabbix/ssl/keys"
1912
1913LOAD_MODULE_PATH="${libdir}/modules"
1914
1915AC_SUBST(SERVER_LDFLAGS)
1916AC_SUBST(SERVER_LIBS)
1917
1918AC_SUBST(PROXY_LDFLAGS)
1919AC_SUBST(PROXY_LIBS)
1920
1921AC_SUBST(AGENT_LDFLAGS)
1922AC_SUBST(AGENT_LIBS)
1923
1924AC_SUBST(AGENT2_LDFLAGS)
1925AC_SUBST(AGENT2_LIBS)
1926
1927if test "x$HAVE_START_GROUP" = "xyes"; then
1928	LD_START_GROUP=-Wl,--start-group
1929	LD_END_GROUP=-Wl,--end-group
1930fi
1931
1932if test "x$agent2" = "xyes"; then
1933	CGO_CFLAGS=$TLS_CFLAGS
1934	CGO_LDFLAGS="$AGENT2_LDFLAGS $LD_START_GROUP \
1935		\${abs_top_builddir}/src/zabbix_agent/logfiles/libzbxlogfiles.a \
1936		\${abs_top_builddir}/src/libs/zbxcomms/libzbxcomms.a \
1937		\${abs_top_builddir}/src/libs/zbxcommon/libzbxcommon.a \
1938		\${abs_top_builddir}/src/libs/zbxcrypto/libzbxcrypto.a \
1939		\${abs_top_builddir}/src/libs/zbxsys/libzbxsys.a \
1940		\${abs_top_builddir}/src/libs/zbxnix/libzbxnix.a \
1941		\${abs_top_builddir}/src/libs/zbxconf/libzbxconf.a \
1942		\${abs_top_builddir}/src/libs/zbxhttp/libzbxhttp.a \
1943		\${abs_top_builddir}/src/libs/zbxcompress/libzbxcompress.a \
1944		\${abs_top_builddir}/src/libs/zbxregexp/libzbxregexp.a \
1945		\${abs_top_builddir}/src/libs/zbxsysinfo/libzbxagent2sysinfo.a \
1946		\${abs_top_builddir}/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
1947		\${abs_top_builddir}/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
1948		\${abs_top_builddir}/src/libs/zbxsysinfo/"$ARCH"/libspechostnamesysinfo.a \
1949		\${abs_top_builddir}/src/libs/zbxsysinfo/"$ARCH"/libspecsysinfo.a \
1950		\${abs_top_builddir}/src/libs/zbxexec/libzbxexec.a \
1951		\${abs_top_builddir}/src/libs/zbxalgo/libzbxalgo.a \
1952		\${abs_top_builddir}/src/libs/zbxjson/libzbxjson.a \
1953		$LIBS $AGENT2_LIBS $LD_END_GROUP"
1954
1955	AC_SUBST(CGO_CFLAGS)
1956	AC_SUBST(CGO_LDFLAGS)
1957fi
1958
1959AC_SUBST(ZBXGET_LDFLAGS)
1960AC_SUBST(ZBXGET_LIBS)
1961
1962AC_SUBST(SENDER_LDFLAGS)
1963AC_SUBST(SENDER_LIBS)
1964
1965AC_SUBST(ZBXJS_LDFLAGS)
1966AC_SUBST(ZBXJS_LIBS)
1967
1968AC_SUBST(SERVER_CONFIG_FILE)
1969AC_SUBST(PROXY_CONFIG_FILE)
1970AC_SUBST(AGENT_CONFIG_FILE)
1971AC_SUBST(AGENT2_CONFIG_FILE)
1972AC_SUBST(WEBSERVICE_CONFIG_FILE)
1973
1974AC_SUBST(EXTERNAL_SCRIPTS_PATH)
1975AC_SUBST(ALERT_SCRIPTS_PATH)
1976
1977AC_SUBST(CURL_SSL_CERT_LOCATION)
1978AC_SUBST(CURL_SSL_KEY_LOCATION)
1979
1980AC_SUBST(LOAD_MODULE_PATH)
1981
1982GOBIN=${sbindir}
1983GOCMD=go
1984GOWORKDIR=$ac_abs_confdir/go/src/zabbix
1985
1986export GOBIN=${GOBIN}
1987AC_SUBST(GOBIN)
1988AC_SUBST(GOCMD)
1989AC_SUBST(GOWORKDIR)
1990
1991dnl *****************************************************************
1992dnl *                                                               *
1993dnl *                         Other checks                          *
1994dnl *                                                               *
1995dnl *****************************************************************
1996
1997dnl Automake 1.8 to 1.9.6 sets mkdir_p macro (lower-cased).
1998AC_MSG_CHECKING(for mkdir -p candidate)
1999if test "x${MKDIR_P}" = "x"; then
2000        if test "x${mkdir_p}" = "x"; then
2001                AC_MSG_ERROR([No suitable "mkdir -p" candidate found.])
2002        fi
2003        AC_SUBST([MKDIR_P], ${mkdir_p})
2004fi
2005AC_MSG_RESULT([ok (${MKDIR_P})])
2006
2007dnl Check if process statistics collector should be enabled
2008case "x$ARCH" in
2009	xlinux|xsolaris)
2010		AC_DEFINE(ZBX_PROCSTAT_COLLECTOR, 1 , [Define to 1 on linux and solaris platforms])
2011		;;
2012esac
2013
2014dnl *****************************************************************
2015dnl *                                                               *
2016dnl *                 Output configuration results                  *
2017dnl *                                                               *
2018dnl *****************************************************************
2019
2020m4_ifdef([CONF_TESTS],[CONF_TESTS(ZBXCMOCKA)])
2021
2022AC_OUTPUT([
2023	Makefile
2024	database/Makefile
2025	database/mysql/Makefile
2026	database/oracle/Makefile
2027	database/postgresql/Makefile
2028	database/sqlite3/Makefile
2029	misc/Makefile
2030	src/Makefile
2031	src/go/Makefile
2032	src/libs/Makefile
2033	src/libs/zbxlog/Makefile
2034	src/libs/zbxalgo/Makefile
2035	src/libs/zbxmemory/Makefile
2036	src/libs/zbxcrypto/Makefile
2037	src/libs/zbxconf/Makefile
2038	src/libs/zbxdbcache/Makefile
2039	src/libs/zbxdbhigh/Makefile
2040	src/libs/zbxmedia/Makefile
2041	src/libs/zbxsysinfo/Makefile
2042	src/libs/zbxcommon/Makefile
2043	src/libs/zbxsysinfo/agent/Makefile
2044	src/libs/zbxsysinfo/common/Makefile
2045	src/libs/zbxsysinfo/simple/Makefile
2046	src/libs/zbxsysinfo/linux/Makefile
2047	src/libs/zbxsysinfo/aix/Makefile
2048	src/libs/zbxsysinfo/freebsd/Makefile
2049	src/libs/zbxsysinfo/hpux/Makefile
2050	src/libs/zbxsysinfo/openbsd/Makefile
2051	src/libs/zbxsysinfo/osx/Makefile
2052	src/libs/zbxsysinfo/solaris/Makefile
2053	src/libs/zbxsysinfo/osf/Makefile
2054	src/libs/zbxsysinfo/netbsd/Makefile
2055	src/libs/zbxsysinfo/unknown/Makefile
2056	src/libs/zbxnix/Makefile
2057	src/libs/zbxsys/Makefile
2058	src/libs/zbxcomms/Makefile
2059	src/libs/zbxcommshigh/Makefile
2060	src/libs/zbxdb/Makefile
2061	src/libs/zbxdbupgrade/Makefile
2062	src/libs/zbxjson/Makefile
2063	src/libs/zbxhttp/Makefile
2064	src/libs/zbxserver/Makefile
2065	src/libs/zbxicmpping/Makefile
2066	src/libs/zbxeval/Makefile
2067	src/libs/zbxexec/Makefile
2068	src/libs/zbxself/Makefile
2069	src/libs/zbxmodules/Makefile
2070	src/libs/zbxregexp/Makefile
2071	src/libs/zbxtasks/Makefile
2072	src/libs/zbxipcservice/Makefile
2073	src/libs/zbxhistory/Makefile
2074	src/libs/zbxcompress/Makefile
2075	src/libs/zbxembed/Makefile
2076	src/libs/zbxprometheus/Makefile
2077	src/libs/zbxvault/Makefile
2078	src/libs/zbxdiag/Makefile
2079	src/libs/zbxtrends/Makefile
2080	src/libs/zbxavailability/Makefile
2081	src/libs/zbxxml/Makefile
2082	src/zabbix_agent/Makefile
2083	src/zabbix_agent/logfiles/Makefile
2084	src/zabbix_get/Makefile
2085	src/zabbix_js/Makefile
2086	src/zabbix_sender/Makefile
2087	src/zabbix_server/Makefile
2088	src/zabbix_server/alerter/Makefile
2089	src/zabbix_server/dbsyncer/Makefile
2090	src/zabbix_server/dbconfig/Makefile
2091	src/zabbix_server/discoverer/Makefile
2092	src/zabbix_server/housekeeper/Makefile
2093	src/zabbix_server/httppoller/Makefile
2094	src/zabbix_server/pinger/Makefile
2095	src/zabbix_server/poller/Makefile
2096	src/zabbix_server/snmptrapper/Makefile
2097	src/zabbix_server/timer/Makefile
2098	src/zabbix_server/trapper/Makefile
2099	src/zabbix_server/escalator/Makefile
2100	src/zabbix_server/proxypoller/Makefile
2101	src/zabbix_server/selfmon/Makefile
2102	src/zabbix_server/vmware/Makefile
2103	src/zabbix_server/taskmanager/Makefile
2104	src/zabbix_server/ipmi/Makefile
2105	src/zabbix_server/odbc/Makefile
2106	src/zabbix_server/scripts/Makefile
2107	src/zabbix_server/preprocessor/Makefile
2108	src/zabbix_server/availability/Makefile
2109	src/zabbix_server/lld/Makefile
2110	src/zabbix_server/reporter/Makefile
2111	src/zabbix_proxy/Makefile
2112	src/zabbix_proxy/heart/Makefile
2113	src/zabbix_proxy/housekeeper/Makefile
2114	src/zabbix_proxy/proxyconfig/Makefile
2115	src/zabbix_proxy/datasender/Makefile
2116	src/zabbix_proxy/taskmanager/Makefile
2117	src/zabbix_java/Makefile
2118	man/Makefile
2119	])
2120
2121dnl The following variables use autoconf variables such as
2122dnl ${sysconfdir} and ${datadir} . Which in turn contain
2123dnl variables such as ${prefix}. In order to completely
2124dnl substitute all variables and output end-value in
2125dnl Configuration output below it is required to perform 2
2126dnl substitutions.
2127
2128SERVER_CONFIG_FILE=`eval echo "${SERVER_CONFIG_FILE}"`
2129SERVER_CONFIG_FILE=`eval echo "${SERVER_CONFIG_FILE}"`
2130
2131PROXY_CONFIG_FILE=`eval echo "${PROXY_CONFIG_FILE}"`
2132PROXY_CONFIG_FILE=`eval echo "${PROXY_CONFIG_FILE}"`
2133
2134AGENT_CONFIG_FILE=`eval echo "${AGENT_CONFIG_FILE}"`
2135AGENT_CONFIG_FILE=`eval echo "${AGENT_CONFIG_FILE}"`
2136
2137AGENT2_CONFIG_FILE=`eval echo "${AGENT2_CONFIG_FILE}"`
2138AGENT2_CONFIG_FILE=`eval echo "${AGENT2_CONFIG_FILE}"`
2139
2140WEBSERVICE_CONFIG_FILE=`eval echo "${WEBSERVICE_CONFIG_FILE}"`
2141WEBSERVICE_CONFIG_FILE=`eval echo "${WEBSERVICE_CONFIG_FILE}"`
2142
2143EXTERNAL_SCRIPTS_PATH=`eval echo "${EXTERNAL_SCRIPTS_PATH}"`
2144EXTERNAL_SCRIPTS_PATH=`eval echo "${EXTERNAL_SCRIPTS_PATH}"`
2145
2146ALERT_SCRIPTS_PATH=`eval echo "${ALERT_SCRIPTS_PATH}"`
2147ALERT_SCRIPTS_PATH=`eval echo "${ALERT_SCRIPTS_PATH}"`
2148
2149CURL_SSL_CERT_LOCATION=`eval echo "${CURL_SSL_CERT_LOCATION}"`
2150CURL_SSL_CERT_LOCATION=`eval echo "${CURL_SSL_CERT_LOCATION}"`
2151
2152CURL_SSL_KEY_LOCATION=`eval echo "${CURL_SSL_KEY_LOCATION}"`
2153CURL_SSL_KEY_LOCATION=`eval echo "${CURL_SSL_KEY_LOCATION}"`
2154
2155LOAD_MODULE_PATH=`eval echo "${LOAD_MODULE_PATH}"`
2156LOAD_MODULE_PATH=`eval echo "${LOAD_MODULE_PATH}"`
2157
2158echo "
2159
2160Configuration:
2161
2162  Detected OS:           ${host_os}
2163  Install path:          ${prefix}
2164  Compilation arch:      ${ARCH}
2165
2166  Compiler:              ${CC}
2167  Compiler flags:        ${CFLAGS}
2168
2169  Library-specific flags:"
2170
2171if test "x$DB_CFLAGS" != "x"; then
2172	echo "    database:              ${DB_CFLAGS}"
2173fi
2174
2175if test "x$LIBXML2_CFLAGS" != "x"; then
2176	echo "    libXML2:               ${LIBXML2_CFLAGS}"
2177fi
2178
2179if test "x$UNIXODBC_CFLAGS" != "x"; then
2180	echo "    unixODBC:              ${UNIXODBC_CFLAGS}"
2181fi
2182
2183if test "x$SNMP_CFLAGS" != "x"; then
2184	echo "    Net-SNMP:              ${SNMP_CFLAGS}"
2185fi
2186
2187if test "x$OPENIPMI_CFLAGS" != "x"; then
2188	echo "    OpenIPMI:              ${OPENIPMI_CFLAGS}"
2189fi
2190
2191if test "x$SSH2_CFLAGS" != "x"; then
2192	echo "    libssh2:               ${SSH2_CFLAGS}"
2193fi
2194
2195if test "x$SSH_CFLAGS" != "x"; then
2196	echo "    libssh:                ${SSH_CFLAGS}"
2197fi
2198
2199if test "x$LIBMODBUS_CFLAGS" != "x"; then
2200	echo "    libmodbus:                ${LIBMODBUS_CFLAGS}"
2201fi
2202
2203if test "x$TLS_CFLAGS" != "x"; then
2204	echo "    TLS:                   ${TLS_CFLAGS}"
2205fi
2206
2207if test "x$LDAP_CPPFLAGS" != "x"; then
2208	echo "    LDAP:                  ${LDAP_CPPFLAGS}"
2209fi
2210
2211if test "x$ICONV_CFLAGS" != "x"; then
2212	echo "    iconv:                 ${ICONV_CFLAGS}"
2213fi
2214
2215if test "x$LIBEVENT_CFLAGS" != "x"; then
2216	echo "    libevent:              ${LIBEVENT_CFLAGS}"
2217fi
2218
2219echo "
2220  Enable server:         ${server}"
2221
2222if test "x$server" != "xno"; then
2223
2224echo "  Server details:
2225    With database:         ${have_db}
2226    WEB Monitoring:        ${have_web_monitoring}"
2227
2228if test "x$have_web_monitoring" = "xcURL"; then
2229echo "      SSL certificates:      ${CURL_SSL_CERT_LOCATION}
2230      SSL keys:              ${CURL_SSL_KEY_LOCATION}"
2231fi
2232
2233echo "    SNMP:                  ${have_snmp}
2234    IPMI:                  ${have_ipmi}
2235    SSH:                   ${have_ssh}
2236    TLS:                   ${have_tls}
2237    ODBC:                  ${have_unixodbc}
2238    Linker flags:          ${SERVER_LDFLAGS} ${LDFLAGS}
2239    Libraries:             ${SERVER_LIBS} ${LIBS}
2240    Configuration file:    ${SERVER_CONFIG_FILE}
2241    External scripts:      ${EXTERNAL_SCRIPTS_PATH}
2242    Alert scripts:         ${ALERT_SCRIPTS_PATH}
2243    Modules:               ${LOAD_MODULE_PATH}"
2244
2245fi
2246
2247echo "
2248  Enable proxy:          ${proxy}"
2249
2250if test "x$proxy" != "xno"; then
2251
2252echo "  Proxy details:
2253    With database:         ${have_db}
2254    WEB Monitoring:        ${have_web_monitoring}"
2255
2256if test "x$have_web_monitoring" = "xcURL"; then
2257echo "      SSL certificates:      ${CURL_SSL_CERT_LOCATION}
2258      SSL keys:              ${CURL_SSL_KEY_LOCATION}"
2259fi
2260
2261echo "    SNMP:                  ${have_snmp}
2262    IPMI:                  ${have_ipmi}
2263    SSH:                   ${have_ssh}
2264    TLS:                   ${have_tls}
2265    ODBC:                  ${have_unixodbc}
2266    Linker flags:          ${PROXY_LDFLAGS} ${LDFLAGS}
2267    Libraries:             ${PROXY_LIBS} ${LIBS}
2268    Configuration file:    ${PROXY_CONFIG_FILE}
2269    External scripts:      ${EXTERNAL_SCRIPTS_PATH}
2270    Modules:               ${LOAD_MODULE_PATH}"
2271
2272fi
2273
2274echo "
2275  Enable agent:          ${agent}"
2276
2277if test "x$agent" != "xno"; then
2278
2279echo "  Agent details:
2280    TLS:                   ${have_tls}
2281    Modbus:                ${have_libmodbus}
2282    Linker flags:          ${AGENT_LDFLAGS} ${LDFLAGS}
2283    Libraries:             ${AGENT_LIBS} ${LIBS}
2284    Configuration file:    ${AGENT_CONFIG_FILE}
2285    Modules:               ${LOAD_MODULE_PATH}"
2286
2287fi
2288
2289echo "
2290  Enable agent 2:        ${agent2}"
2291
2292echo "
2293  Enable web service:    ${webservice}"
2294
2295echo "
2296  Enable Java gateway:   ${java}"
2297
2298if test "x$java" != "xno"; then
2299
2300echo "  Java gateway details:
2301    Java compiler:         ${JAVAC}
2302    Java archiver:         ${JAR}"
2303
2304fi
2305
2306echo "
2307  LDAP support:          ${found_ldap}
2308  IPv6 support:          ${have_ipv6}"
2309
2310echo
2311echo "***********************************************************"
2312echo "*            Now run '${am_make} install'                       *"
2313echo "*                                                         *"
2314echo "*            Thank you for using Zabbix!                  *"
2315echo "*              <http://www.zabbix.com>                    *"
2316echo "***********************************************************"
2317echo
2318