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],[3.0.32]) 23AC_CONFIG_SRCDIR(src/zabbix_server/server.c) 24AM_INIT_AUTOMAKE 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 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 regex.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/protosw.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]) 101AC_CHECK_HEADERS(sys/mount.h sys/proc.h sys/sysctl.h sys/user.h, [], [], [ 102#ifdef HAVE_SYS_TYPES_H 103# include <sys/types.h> 104#endif 105#ifdef HAVE_SYS_PARAM_H 106# include <sys/param.h> 107#endif 108]) 109AC_CHECK_HEADERS(sys/swap.h, [], [], [ 110#ifdef HAVE_SYS_PARAM_H 111# include <sys/param.h> 112#endif 113]) 114AC_CHECK_HEADERS(sys/ucontext.h, [], [], [ 115#ifdef HAVE_SIGNAL_H 116# include <signal.h> 117#endif 118]) 119AC_CHECK_HEADERS(devstat.h, [], [], [ 120#ifdef HAVE_SYS_DKSTAT_H 121# include <sys/dkstat.h> 122#endif 123]) 124AC_CHECK_HEADERS(linux/netlink.h, [ 125 AC_CHECK_HEADERS(linux/inet_diag.h, [ 126 AC_DEFINE([HAVE_INET_DIAG], 1, [Define to 1 if you have NETLINK INET_DIAG support.]) 127 ]) 128], [], [ 129#ifdef HAVE_SYS_SOCKET_H 130# include <sys/socket.h> 131#endif 132]) 133AC_CHECK_HEADERS(libperfstat.h, [], [], [ 134#ifdef HAVE_SYS_PROTOSW_H 135# include <sys/protosw.h> 136#endif 137]) 138 139dnl ***************************************************************** 140dnl * * 141dnl * Checks for libraries * 142dnl * * 143dnl ***************************************************************** 144 145AC_SEARCH_LIBS(socket, socket) 146AC_SEARCH_LIBS(kstat_open, kstat) 147AC_SEARCH_LIBS(gethostbyname, nsl) 148AC_SEARCH_LIBS(clock_gettime, rt) 149AC_SEARCH_LIBS(dlopen, dl) 150 151dnl AIX 152AC_SEARCH_LIBS(perfstat_memory_total, perfstat, [AC_DEFINE([HAVE_LIBPERFSTAT], 1, [Define to 1 if you have the 'libperfstat' library (-lperfstat)])]) 153AC_SEARCH_LIBS(devstat_getdevs, devstat, [AC_DEFINE([HAVE_LIBDEVSTAT], 1, [Define to 1 if you have the 'libdevstat' library (-ldevstat)])]) 154AC_SEARCH_LIBS(getdevs, devstat, [AC_DEFINE([HAVE_LIBDEVSTAT], 1, [Define to 1 if you have the 'libdevstat' library (-ldevstat)])]) 155 156dnl on FreeBSD we have to link with -lexecinfo to get backtraces 157AC_SEARCH_LIBS(backtrace_symbols, execinfo, [AC_DEFINE([HAVE_LIBEXECINFO], 1, [Define to 1 if you have the 'libexecinfo' library (-lexecinfo)])]) 158 159AC_CHECK_LIB(m, main) 160AC_CHECK_LIB(kvm, main) 161 162dnl check for DNS lookup functions 163found_resolv="no" 164LIBRESOLV_CHECK_CONFIG([no]) 165if test "x$found_resolv" != "xyes"; then 166 AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)]) 167fi 168LIBS="${LIBS} ${RESOLV_LIBS}" 169 170dnl ***************************************************************** 171dnl * * 172dnl * Checks for type definitions and structures * 173dnl * * 174dnl ***************************************************************** 175 176dnl large file support 177largefile=yes 178 179dnl disable large file support on 32-bit Solaris as it's incompatible with procfs and swapctl 180case "${host_os}" in 181 solaris*) 182 largefile=no 183 ;; 184esac 185 186if test "x$largefile" = "xyes"; then 187 AC_SYS_LARGEFILE 188fi 189 190AC_C_CONST 191AC_TYPE_PID_T 192 193AC_MSG_CHECKING(for socklen_t) 194AC_TRY_COMPILE([ 195#include <sys/types.h> 196#include <unistd.h> 197#include <sys/socket.h> 198],[socklen_t s;], 199AC_MSG_RESULT(yes), 200[AC_DEFINE(socklen_t, int, [Define socklen_t type.]) 201AC_MSG_RESULT(no)]) 202 203AC_MSG_CHECKING(for actual socklen_t parameter type in socket functions) 204zbx_socklen_t= 205for arg2 in "struct sockaddr" void; do 206 for arg3 in socklen_t size_t int; do 207 AC_TRY_COMPILE([ 208#ifdef HAVE_SYS_TYPES_H 209# include <sys/types.h> 210#endif 211#ifdef HAVE_SYS_SOCKET_H 212# include <sys/socket.h> 213#endif 214 extern int getpeername(int sockfd, $arg2 *addr, $arg3 *addrlen); 215 ],[ 216 $arg3 addrlen; 217 getpeername(0, 0, &addrlen); 218 ],[ 219 zbx_socklen_t="$arg3" 220 break 2 221 ]) 222 done 223done 224if test "x$zbx_socklen_t" != "x"; then 225 AC_MSG_RESULT($zbx_socklen_t) 226 AC_DEFINE_UNQUOTED(ZBX_SOCKLEN_T, $zbx_socklen_t, [Define actual socklen_t parameter type in socket functions.]) 227else 228 AC_MSG_RESULT(leaving undefined) 229fi 230 231AC_MSG_CHECKING(for integer field name in union sigval of struct siginfo_t) 232zbx_sival_int= 233for field in sival_int sigval_int; do 234 AC_TRY_COMPILE([ 235#ifdef HAVE_SIGNAL_H 236# include <signal.h> 237#endif 238 ],[ 239 siginfo_t siginfo; 240 siginfo.si_value.$field = 0; 241 ],[ 242 zbx_sival_int="$field" 243 break 244 ]) 245done 246if test "x$zbx_sival_int" != "x"; then 247 AC_MSG_RESULT($zbx_sival_int) 248 AC_DEFINE_UNQUOTED(ZBX_SIVAL_INT, $zbx_sival_int, [Define integer field name in union 'sigval' of struct 'siginfo_t']) 249else 250 AC_MSG_ERROR(Unable to find integer field name in union sigval of struct siginfo_t) 251fi 252 253AC_MSG_CHECKING(for res_ninit) 254AC_TRY_LINK( 255[ 256#ifdef HAVE_SYS_TYPES_H 257# include <sys/types.h> 258#endif 259#ifdef HAVE_NETINET_IN_H 260# include <netinet/in.h> 261#endif 262#ifdef HAVE_ARPA_NAMESER_H 263# include <arpa/nameser.h> 264#endif 265#ifdef HAVE_RESOLV_H 266# include <resolv.h> 267#endif 268#ifndef C_IN 269# define C_IN ns_c_in 270#endif /* C_IN */ 271#ifndef T_SOA 272# define T_SOA ns_t_soa 273#endif /* T_SOA */ 274], 275[ 276 struct __res_state res_state_local; 277 278 res_ninit(&res_state_local); 279], 280AC_DEFINE(HAVE_RES_NINIT,1,[Define to 1 if 'res_ninit' exists.]) 281AC_MSG_RESULT(yes), 282AC_MSG_RESULT(no)) 283 284AC_MSG_CHECKING(for res_ndestroy) 285AC_TRY_LINK( 286[ 287#ifdef HAVE_SYS_TYPES_H 288# include <sys/types.h> 289#endif 290#ifdef HAVE_NETINET_IN_H 291# include <netinet/in.h> 292#endif 293#ifdef HAVE_ARPA_NAMESER_H 294# include <arpa/nameser.h> 295#endif 296#ifdef HAVE_RESOLV_H 297# include <resolv.h> 298#endif 299#ifndef C_IN 300# define C_IN ns_c_in 301#endif /* C_IN */ 302#ifndef T_SOA 303# define T_SOA ns_t_soa 304#endif /* T_SOA */ 305], 306[ 307 struct __res_state res_state_local; 308 309 res_ninit(&res_state_local); 310 res_ndestroy(&res_state_local); 311], 312AC_DEFINE(HAVE_RES_NDESTROY,1,[Define to 1 if 'res_ndestroy' exists.]) 313AC_MSG_RESULT(yes), 314AC_MSG_RESULT(no)) 315 316AC_MSG_CHECKING(for union semun) 317AC_TRY_COMPILE( 318[ 319#include <sys/types.h> 320#include <sys/ipc.h> 321#include <sys/sem.h> 322], 323[union semun foo;], 324AC_DEFINE(HAVE_SEMUN, 1, [Define to 1 if union 'semun' exists.]) 325AC_MSG_RESULT(yes), 326AC_MSG_RESULT(no)) 327 328AC_MSG_CHECKING(for struct swaptable in sys/swap.h) 329AC_TRY_COMPILE( 330[ 331#include <stdlib.h> 332#include <sys/types.h> 333#include <sys/syscall.h> 334#include <sys/swap.h> 335 336#ifndef NULL 337#define NULL (void *)0 338#endif 339], 340[ 341 register int cnt, i; 342 register int t, f; 343 struct swaptable *swt; 344 struct swapent *ste; 345 static char path[256]; 346 347 /* get total number of swap entries */ 348 cnt = swapctl(SC_GETNSWP, 0); 349 350 /* allocate enough space to hold count + n swapents */ 351 swt = (struct swaptable *)malloc(sizeof(int) + 352 cnt * sizeof(struct swapent)); 353 if (swt == NULL) 354 { 355 return; 356 } 357 swt->swt_n = cnt; 358 359 /* fill in ste_path pointers: we do not care about the paths, so we 360point 361 them all to the same buffer */ 362 ste = &(swt->swt_ent[0]); 363 i = cnt; 364 while (--i >= 0) 365 { 366 ste++->ste_path = path; 367 } 368 369 /* grab all swap info */ 370 swapctl(SC_LIST, swt); 371 372 /* walk through the structs and sum up the fields */ 373 t = f = 0; 374 ste = &(swt->swt_ent[0]); 375 i = cnt; 376 while (--i >= 0) 377 { 378 /* do not count slots being deleted */ 379 if (!(ste->ste_flags & ST_INDEL) && 380 !(ste->ste_flags & ST_DOINGDEL)) 381 { 382 t += ste->ste_pages; 383 f += ste->ste_free; 384 } ste++; 385 } 386 387 /* fill in the results */ 388 free(swt); 389 390], 391AC_DEFINE(HAVE_SYS_SWAP_SWAPTABLE,1,[Define to 1 if struct 'swaptable' exists.]) 392AC_MSG_RESULT(yes), 393AC_MSG_RESULT(no)) 394 395AC_MSG_CHECKING(for struct sensordev in sys/sensors.h) 396AC_TRY_COMPILE([ 397#include <stdlib.h> 398#include <sys/queue.h> 399#include <sys/sensors.h>], 400[struct sensordev sensordev; 401sensordev.xname[0]='\0'; 402sensordev.maxnumt[0]=0; 403], 404AC_DEFINE(HAVE_SENSORDEV,1,[Define to 1 if struct 'sensordev' exists.]) 405AC_MSG_RESULT(yes), 406AC_MSG_RESULT(no)) 407 408AC_MSG_CHECKING(for struct statvfs64 in sys/statvfs.h) 409AC_TRY_COMPILE( 410[ 411#ifdef HAVE_SYS_TYPES_H 412# include <sys/types.h> 413#endif 414#ifdef HAVE_SYS_STATVFS_H 415# include <sys/statvfs.h> 416#endif 417], 418[ 419 struct statvfs64 s; 420 s.f_frsize = s.f_blocks = s.f_bfree = s.f_bavail = 0; 421 statvfs64("/", &s); 422], 423AC_DEFINE(HAVE_SYS_STATVFS64, 1, [Define to 1 if struct 'statvfs64' exists.]) 424AC_MSG_RESULT(yes), 425AC_MSG_RESULT(no)) 426 427AC_MSG_CHECKING(for struct statfs64 in sys/statfs.h) 428AC_TRY_COMPILE( 429[ 430#ifdef HAVE_SYS_TYPES_H 431# include <sys/types.h> 432#endif 433#ifdef HAVE_SYS_STATFS_H 434# include <sys/statfs.h> 435#endif 436], 437[ 438 struct statfs64 s; 439 s.f_bsize = s.f_blocks = s.f_bfree = s.f_bavail = 0; 440 statfs64("/", &s); 441], 442AC_DEFINE(HAVE_SYS_STATFS64, 1, [Define to 1 if struct 'statfs64' exists.]) 443AC_MSG_RESULT(yes), 444AC_MSG_RESULT(no)) 445 446AC_MSG_CHECKING(for field ss_family in struct sockaddr_storage) 447AC_TRY_COMPILE([#include <sys/socket.h>], 448[struct sockaddr_storage ss; 449ss.ss_family = 0; 450], 451AC_DEFINE(HAVE_SOCKADDR_STORAGE_SS_FAMILY, 1, [Define to 1 if 'sockaddr_storage.ss_family' exists.]) 452AC_MSG_RESULT(yes), 453AC_MSG_RESULT(no)) 454 455AC_MSG_CHECKING(for field mem_unit in struct sysinfo) 456AC_TRY_COMPILE([#include <sys/sysinfo.h>], 457[struct sysinfo sysinfo; 458sysinfo.mem_unit=0; 459], 460AC_DEFINE(HAVE_SYSINFO_MEM_UNIT,1,[Define to 1 if 'sysinfo.mem_unit' exists.]) 461AC_MSG_RESULT(yes), 462AC_MSG_RESULT(no)) 463 464AC_MSG_CHECKING(for field freeswap in struct sysinfo) 465AC_TRY_COMPILE([#include <sys/sysinfo.h>], 466[struct sysinfo sysinfo; 467sysinfo.freeswap=0; 468], 469AC_DEFINE(HAVE_SYSINFO_FREESWAP,1,[Define to 1 if 'sysinfo.freeswap' exists.]) 470AC_MSG_RESULT(yes), 471AC_MSG_RESULT(no)) 472 473AC_MSG_CHECKING(for field totalswap in struct sysinfo) 474AC_TRY_COMPILE([#include <sys/sysinfo.h>], 475[struct sysinfo sysinfo; 476sysinfo.totalswap=0; 477], 478AC_DEFINE(HAVE_SYSINFO_TOTALSWAP,1,[Define to 1 if 'sysinfo.totalswap' exists.]) 479AC_MSG_RESULT(yes), 480AC_MSG_RESULT(no)) 481 482AC_MSG_CHECKING(for field totalram in struct sysinfo) 483AC_TRY_COMPILE([#include <sys/sysinfo.h>], 484[struct sysinfo sysinfo; 485sysinfo.totalram=0; 486], 487AC_DEFINE(HAVE_SYSINFO_TOTALRAM,1,[Define to 1 if 'sysinfo.totalram' exists.]) 488AC_MSG_RESULT(yes), 489AC_MSG_RESULT(no)) 490 491AC_MSG_CHECKING(for field sharedram in struct sysinfo) 492AC_TRY_COMPILE([#include <sys/sysinfo.h>], 493[struct sysinfo sysinfo; 494sysinfo.sharedram=0; 495], 496AC_DEFINE(HAVE_SYSINFO_SHAREDRAM,1,[Define to 1 if 'sysinfo.sharedram' exists.]) 497AC_MSG_RESULT(yes), 498AC_MSG_RESULT(no)) 499 500AC_MSG_CHECKING(for field bufferram in struct sysinfo) 501AC_TRY_COMPILE([#include <sys/sysinfo.h>], 502[struct sysinfo sysinfo; 503sysinfo.bufferram=0; 504], 505AC_DEFINE(HAVE_SYSINFO_BUFFERRAM,1,[Define to 1 if 'sysinfo.bufferram' exists.]) 506AC_MSG_RESULT(yes), 507AC_MSG_RESULT(no)) 508 509AC_MSG_CHECKING(for field freeram in struct sysinfo) 510AC_TRY_COMPILE([#include <sys/sysinfo.h>], 511[struct sysinfo sysinfo; 512sysinfo.freeram=0; 513], 514AC_DEFINE(HAVE_SYSINFO_FREERAM,1,[Define to 1 if 'sysinfo.freeram' exists.]) 515AC_MSG_RESULT(yes), 516AC_MSG_RESULT(no)) 517 518AC_MSG_CHECKING(for field procs in struct sysinfo) 519AC_TRY_COMPILE([#include <sys/sysinfo.h>], 520[struct sysinfo sysinfo; 521sysinfo.procs=0; 522], 523AC_DEFINE(HAVE_SYSINFO_PROCS,1,[Define to 1 if 'sysinfo.procs' exists.]) 524AC_MSG_RESULT(yes), 525AC_MSG_RESULT(no)) 526 527AC_MSG_CHECKING(for field tm_gmtoff in struct tm) 528AC_TRY_COMPILE([ 529#ifdef HAVE_SYS_TIME_H 530#include <sys/time.h> 531#endif /* HAVE_SYS_TIME_H */ 532 533#ifdef HAVE_TIME_H 534#include <time.h> 535#endif /* HAVE_TIME_H */ 536], 537[ 538 struct tm tm; 539 tm.tm_gmtoff; 540], 541AC_DEFINE(HAVE_TM_TM_GMTOFF,1,[Define to 1 if 'tm.tm_gmtoff' exists.]) 542AC_MSG_RESULT(yes), 543AC_MSG_RESULT(no)) 544 545dnl ***************************************************************** 546dnl * * 547dnl * Checks for functions * 548dnl * * 549dnl ***************************************************************** 550 551AC_MSG_CHECKING(for function sysconf() in unistd.h) 552AC_TRY_COMPILE( 553[ 554#include <unistd.h> 555], 556[ int i; 557 558 i=sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PHYS_PAGES); 559 i=sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PHYS_PAGES); 560], 561AC_DEFINE(HAVE_UNISTD_SYSCONF,1,[Define to 1 if function 'sysconf' exists.]) 562AC_MSG_RESULT(yes), 563AC_MSG_RESULT(no)) 564 565AC_MSG_CHECKING(for function initgroups()) 566AC_TRY_LINK( 567[ 568#include <sys/types.h> 569#include <grp.h> 570], 571[ 572 char *user = "zabbix"; 573 initgroups(user, 0); 574], 575AC_DEFINE(HAVE_FUNCTION_INITGROUPS,1,[Define to 1 if function 'initgroups' exists.]) 576AC_MSG_RESULT(yes), 577AC_MSG_RESULT(no)) 578 579AC_MSG_CHECKING(for functions seteuid() and setegid()) 580AC_TRY_LINK( 581[ 582#include <sys/types.h> 583#include <unistd.h> 584], 585[ 586 seteuid(0); 587 setegid(0); 588], 589AC_DEFINE(HAVE_FUNCTION_SETEUID,1,[Define to 1 if functions 'seteuid' and 'setegid' exist.]) 590AC_MSG_RESULT(yes), 591AC_MSG_RESULT(no)) 592 593AC_MSG_CHECKING(for function setproctitle()) 594AC_TRY_LINK( 595[ 596#include <sys/types.h> 597#include <unistd.h> 598], 599[ 600 setproctitle("Test %d", 1); 601], 602AC_DEFINE(HAVE_FUNCTION_SETPROCTITLE,1,[Define to 1 if function 'setproctitle' exists.]) 603AC_MSG_RESULT(yes), 604AC_MSG_RESULT(no)) 605 606AC_MSG_CHECKING(for function sysctlbyname()) 607AC_TRY_LINK( 608[ 609#ifdef HAVE_SYS_TYPES_H 610#include <sys/types.h> 611#endif /* HAVE_SYS_TYPES_H */ 612 613#ifdef HAVE_SYS_PARAM_H 614#include <sys/param.h> 615#endif /* HAVE_SYS_PARAM_H */ 616 617#include <sys/sysctl.h> 618], 619[ 620 sysctlbyname("", 0, 0, 0, 0); 621], 622AC_DEFINE(HAVE_FUNCTION_SYSCTLBYNAME,1,[Define to 1 if 'sysctlbyname' exists.]) 623AC_MSG_RESULT(yes), 624AC_MSG_RESULT(no)) 625 626AC_MSG_CHECKING(for function sysctl (KERN_BOOTTIME)) 627AC_TRY_COMPILE( 628[ 629#ifdef HAVE_SYS_TYPES_H 630#include <sys/types.h> 631#endif /* HAVE_SYS_TYPES_H */ 632 633#ifdef HAVE_SYS_PARAM_H 634#include <sys/param.h> 635#endif /* HAVE_SYS_PARAM_H */ 636 637#include <sys/sysctl.h> 638#include <unistd.h> 639#include <time.h> 640#include <sys/time.h> 641], 642[ 643 size_t len; 644 struct timeval uptime; 645 int mib[2]; 646 647 mib[0] = CTL_KERN; 648 mib[1] = KERN_BOOTTIME; 649 650 len = sizeof(uptime); 651 sysctl(mib, 2, &uptime, &len, 0, 0); 652], 653AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME,1,[Define to 1 if 'KERN_BOOTTIME' exists.]) 654AC_MSG_RESULT(yes), 655AC_MSG_RESULT(no)) 656 657AC_MSG_CHECKING(for function sysctl (HW_NCPU)) 658AC_TRY_COMPILE( 659[ 660#ifdef HAVE_SYS_TYPES_H 661#include <sys/types.h> 662#endif /* HAVE_SYS_TYPES_H */ 663 664#ifdef HAVE_SYS_PARAM_H 665#include <sys/param.h> 666#endif /* HAVE_SYS_PARAM_H */ 667 668#include <sys/sysctl.h> 669], 670[ 671 size_t len; 672 int mib[2], ncpu; 673 674 mib[0] = CTL_HW; 675 mib[1] = HW_NCPU; 676 677 len = sizeof(ncpu); 678 sysctl(mib, 2, &ncpu, &len, 0, 0); 679], 680AC_DEFINE(HAVE_FUNCTION_SYSCTL_HW_NCPU,1,[Define to 1 if 'HW_NCPU' exists.]) 681AC_MSG_RESULT(yes), 682AC_MSG_RESULT(no)) 683 684AC_MSG_CHECKING(for function sysctl (KERN_MAXFILES)) 685AC_TRY_COMPILE( 686[ 687#ifdef HAVE_SYS_TYPES_H 688#include <sys/types.h> 689#endif /* HAVE_SYS_TYPES_H */ 690 691#ifdef HAVE_SYS_PARAM_H 692#include <sys/param.h> 693#endif /* HAVE_SYS_PARAM_H */ 694 695#include <sys/sysctl.h> 696], 697[ 698 size_t len; 699 int mib[2], maxfiles; 700 701 mib[0] = CTL_KERN; 702 mib[1] = KERN_MAXFILES; 703 704 len = sizeof(maxfiles); 705 sysctl(mib, 2, &maxfiles, &len, 0, 0); 706], 707AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_MAXFILES,1,[Define to 1 if 'KERN_MAXFILES' exists.]) 708AC_MSG_RESULT(yes), 709AC_MSG_RESULT(no)) 710 711AC_MSG_CHECKING(for function sysctl (KERN_MAXPROC)) 712AC_TRY_COMPILE( 713[ 714#ifdef HAVE_SYS_TYPES_H 715#include <sys/types.h> 716#endif /* HAVE_SYS_TYPES_H */ 717 718#ifdef HAVE_SYS_PARAM_H 719#include <sys/param.h> 720#endif /* HAVE_SYS_PARAM_H */ 721 722#include <sys/sysctl.h> 723], 724[ 725 size_t len; 726 int mib[2], maxproc; 727 728 mib[0] = CTL_KERN; 729 mib[1] = KERN_MAXPROC; 730 731 len = sizeof(maxproc); 732 sysctl(mib, 2, &maxproc, &len, 0, 0); 733], 734AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_MAXPROC,1,[Define to 1 if 'KERN_MAXPROC' exists.]) 735AC_MSG_RESULT(yes), 736AC_MSG_RESULT(no)) 737 738AC_MSG_CHECKING(for function sysctl (KERN_CPTIME,KERN_CPTIME2)) 739AC_TRY_COMPILE( 740[ 741#include <sys/param.h> 742#include <sys/sysctl.h> 743#if defined(HAVE_SYS_DKSTAT_H) 744# include <sys/dkstat.h> 745#elif defined(HAVE_SYS_SCHED_H) 746# include <sys/sched.h> 747#endif 748], 749[ 750size_t sz; 751int i[] = {CP_USER, CP_NICE, CP_SYS, CP_INTR, CP_IDLE}; 752 753{ 754 long states[CPUSTATES]; 755 int mib[2] = {CTL_KERN, KERN_CPTIME}; 756 757 sz = sizeof(states); 758 sysctl(mib, 2, &states, &sz, NULL, 0); 759} 760 761{ 762 u_int64_t states[CPUSTATES]; 763 int mib[3] = {CTL_KERN, KERN_CPTIME2, 0}; 764 765 sz = sizeof(states); 766 sysctl(mib, 3, &states, &sz, NULL, 0); 767} 768], 769AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_CPTIME,1,[Define to 1 if 'KERN_CPTIME,KERN_CPTIME2' exists.]) 770AC_MSG_RESULT(yes), 771AC_MSG_RESULT(no)) 772 773AC_MSG_CHECKING(for function clock_gettime in time.h) 774AC_TRY_LINK([ 775#ifdef HAVE_TIME_H 776# include <time.h> 777#elif HAVE_SYS_TIME_H 778# include <sys/time.h> 779#endif /* HAVE_SYS_TIME_H */ 780], 781[struct timespec tp; 782clock_gettime(CLOCK_REALTIME, &tp); 783], 784AC_DEFINE(HAVE_TIME_CLOCK_GETTIME,1,[Define to 1 if function 'clock_gettime' exists.]) 785AC_MSG_RESULT(yes), 786AC_MSG_RESULT(no)) 787 788dnl ***************************************************************** 789dnl * * 790dnl * Checks for macros * 791dnl * * 792dnl ***************************************************************** 793 794AC_MSG_CHECKING(for macro __va_copy() in stdarg.h) 795AC_TRY_COMPILE( 796[ 797#include <stdarg.h> 798], 799[ 800 va_list src,dst; 801 802 __va_copy(dst,src); 803], 804AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if macro '__va_copy' exists.]) 805AC_MSG_RESULT(yes), 806AC_MSG_RESULT(no)) 807 808AC_MSG_CHECKING(for macro __VA_ARGS__) 809AC_TRY_COMPILE( 810[ 811#define ZBX_CONST_STRING(str) str 812int test(const char *fmt, ...) { return 0; } 813], 814[ 815#define TEST(fmt, ...) test(ZBX_CONST_STRING(fmt), ##__VA_ARGS__) 816TEST("%s","test"); 817TEST("test"); 818], 819AC_DEFINE(HAVE___VA_ARGS__,1,[Define to 1 if macro '__VA_ARGS__' exists.]) 820AC_MSG_RESULT(yes), 821AC_MSG_RESULT(no)) 822 823dnl ***************************************************************** 824dnl * * 825dnl * Checks for library functions * 826dnl * * 827dnl ***************************************************************** 828 829AC_TYPE_SIGNAL 830AC_REPLACE_FUNCS(getloadavg) 831AC_CHECK_FUNCS(hstrerror) 832AC_CHECK_FUNCS(getenv) 833AC_CHECK_FUNCS(putenv) 834AC_CHECK_FUNCS(sigqueue) 835AC_CHECK_FUNCS(round) 836 837dnl ***************************************************************** 838dnl * * 839dnl * Checks for file system characteristics * 840dnl * * 841dnl ***************************************************************** 842 843AC_MSG_CHECKING(for /proc filesystem) 844if test -d /proc; then 845 AC_MSG_RESULT(yes) 846 AC_DEFINE(HAVE_PROC,1,[Define to 1 if '/proc' file system should be used.]) 847else 848 AC_MSG_RESULT(no) 849fi 850 851AC_MSG_CHECKING(for file /proc/stat) 852if test -r /proc/stat; then 853 AC_MSG_RESULT(yes) 854 AC_DEFINE(HAVE_PROC_STAT,1,[Define to 1 if file '/proc/stat' should be used.]) 855else 856 AC_MSG_RESULT(no) 857fi 858 859AC_MSG_CHECKING(for file /proc/cpuinfo) 860if test -r /proc/cpuinfo; then 861 AC_MSG_RESULT(yes) 862 AC_DEFINE(HAVE_PROC_CPUINFO,1,[Define to 1 if file '/proc/cpuinfo' should be used.]) 863else 864 AC_MSG_RESULT(no) 865fi 866 867dnl Solaris 868AC_MSG_CHECKING(for file /proc/0/psinfo) 869if test -r /proc/0/psinfo; then 870 AC_MSG_RESULT(yes) 871 AC_DEFINE(HAVE_PROC_0_PSINFO,1,[Define to 1 if file '/proc/0/psinfo' should be used.]) 872else 873 AC_MSG_RESULT(no) 874fi 875 876AC_MSG_CHECKING(for file /proc/loadavg) 877if test -r /proc/loadavg; then 878 AC_MSG_RESULT(yes) 879 AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define to 1 if file '/proc/loadavg' should be used.]) 880else 881 AC_MSG_RESULT(no) 882fi 883 884AC_MSG_CHECKING(for file /proc/net/dev) 885if test -r /proc/net/dev; then 886 AC_MSG_RESULT(yes) 887 AC_DEFINE(HAVE_PROC_NET_DEV,1,[Define to 1 if file '/proc/net/dev' should be used.]) 888else 889 AC_MSG_RESULT(no) 890fi 891 892dnl ***************************************************************** 893dnl * * 894dnl * Checks for compiler characteristics * 895dnl * * 896dnl ***************************************************************** 897 898dnl Check for %qu format (FreeBSD 4.x) 899dnl FreeBSD 4.x does not support %llu 900AC_MSG_CHECKING(for long long format) 901AC_TRY_RUN( 902[ 903#include <sys/types.h> 904int main() 905{ 906 uint64_t i; 907 908 sscanf("200000000010020", "%qu", &i); 909 910 if (i == 200000000010020) return 0; 911 else return -1; 912} 913], 914AC_DEFINE(HAVE_LONG_LONG_QU, 1 ,[Define to 1 if format '%qu' exists.]) 915AC_MSG_RESULT(yes), 916AC_MSG_RESULT(no), 917AC_MSG_RESULT(no)) 918 919dnl option -rdynamic is needed for readable backtraces 920AC_MSG_CHECKING(for -rdynamic linking option) 921saved_LDFLAGS="$LDFLAGS" 922LDFLAGS="-rdynamic $LDFLAGS" 923AC_TRY_LINK([#include <execinfo.h>], 924[void *bcktrc[6]; 925(void)backtrace(bcktrc, 6); 926], 927LDFLAGS="-rdynamic $saved_LDFLAGS" 928AC_MSG_RESULT(yes), 929LDFLAGS="$saved_LDFLAGS" 930AC_MSG_RESULT(no)) 931 932dnl ***************************************************************** 933dnl * * 934dnl * Checks for operating systems * 935dnl * * 936dnl ***************************************************************** 937 938AC_MSG_CHECKING(for libperfstat 5.2.0.40 fileset) 939AC_TRY_COMPILE([#include <sys/protosw.h> 940#include <libperfstat.h>], 941[perfstat_memory_total_t memstats; 942memstats.virt_active = 0; 943], 944AC_DEFINE(HAVE_AIXOSLEVEL_520004,1,[Define to 1 if libperfstat 5.2.0.40 fileset exists.]) 945AC_MSG_RESULT(yes), 946AC_MSG_RESULT(no)) 947 948AC_MSG_CHECKING(for libperfstat 5.3.0.60 fileset) 949AC_TRY_COMPILE([#include <sys/protosw.h> 950#include <libperfstat.h>], 951[perfstat_partition_total_t lparstats; 952lparstats.type.b.donate_enabled = 0; 953lparstats.idle_donated_purr = 0; 954lparstats.busy_donated_purr = 0; 955lparstats.idle_stolen_purr = 0; 956lparstats.busy_stolen_purr = 0; 957], 958AC_DEFINE(HAVE_AIXOSLEVEL_530006,1,[Define to 1 if libperfstat 5.3.0.60 fileset exists.]) 959AC_MSG_RESULT(yes), 960AC_MSG_RESULT(no)) 961 962case "$host_os" in 963linux*) 964 ARCH="linux" 965 ;; 966aix*) 967 ARCH="aix" 968 ;; 969darwin*|rhapsody*) 970 ARCH="osx" 971 AC_DEFINE([MAC_OS_X], 1, [Define to 1 if you are using Mac OS X.]) 972 ;; 973*solaris*) 974 ARCH="solaris" 975 ;; 976hpux*) 977 ARCH="hpux" 978 ;; 979freebsd*) 980 ARCH="freebsd" 981 ;; 982dragonfly*) 983 ARCH="dragonfly" 984 ;; 985netbsd*) 986 ARCH="netbsd" 987 ;; 988osf*) 989 ARCH="osf" 990 ;; 991openbsd*) 992 ARCH="openbsd" 993 ;; 994*) 995 ARCH="unknown" 996 ;; 997esac 998 999AC_MSG_CHECKING(for architecture) 1000AC_MSG_RESULT([$ARCH ($host_os)]) 1001 1002if test "x$ARCH" = "xlinux"; then 1003 AC_MSG_CHECKING([for the linux kernel version]) 1004 1005 kernel=`uname -r` 1006 1007 case "${kernel}" in 1008 2.6.*) 1009 AC_MSG_RESULT([2.6 family (${kernel})]) 1010 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you are using Linux 2.6.x]) 1011 ;; 1012 2.4.*) 1013 AC_MSG_RESULT([2.4 family (${kernel})]) 1014 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you are using Linux 2.4.x]) 1015 ;; 1016 *) 1017 AC_MSG_RESULT([unknown family (${kernel})]) 1018 ;; 1019 esac 1020fi 1021 1022if test "x$ARCH" = "xsolaris"; then 1023 dnl Forcing a 64-bit application for a 64-bit Solaris 1024 dnl A 32-bit program that uses /proc is able to look at 32-bit processes, 1025 dnl but is not able to understand all attributes of a 64-bit process. 1026 AC_MSG_CHECKING(for -m64 compilation flag) 1027 saved_CFLAGS="$CFLAGS" 1028 CFLAGS="-m64" 1029 AC_TRY_RUN( 1030 [int main(void) {return 0;}], 1031 CFLAGS="-m64 $saved_CFLAGS" 1032 AC_MSG_RESULT(yes), 1033 CFLAGS="$saved_CFLAGS" 1034 AC_MSG_RESULT(no)) 1035fi 1036 1037if test "x$ARCH" = "xhpux"; then 1038 dnl Low Level Discovery needs a way to get the list of network 1039 dnl interfaces available on the monitored system. On HP-UX systems 1040 dnl that way depends on the OS version. 1041 hpux_version=${host_os#hpux} 1042 hpux_major=${hpux_version%.*} 1043 hpux_minor=${hpux_version#*.} 1044 1045 AC_DEFINE_UNQUOTED([HPUX_VERSION], $hpux_major$hpux_minor, [Define to HP-UX version]) 1046 1047 dnl This API level is needed so that "utsname.nodename" is not truncated. 1048 AC_MSG_CHECKING(for -D_HPUX_API_LEVEL=20040821 compilation flag) 1049 saved_CFLAGS="$CFLAGS" 1050 CFLAGS="-D_HPUX_API_LEVEL=20040821" 1051 AC_TRY_RUN( 1052[ 1053#ifdef HAVE_DLFCN_H 1054# include <dlfcn.h> 1055#endif 1056#ifdef HAVE_SYS_UTSNAME_H 1057# include <sys/utsname.h> 1058#endif 1059 1060int main(void) 1061{ 1062 void *p1, *p2; 1063 struct utsname name; 1064 1065 /* check that the compiler (e.g., GCC 4.3.0 and above) supports function-level versioning */ 1066 1067 p1 = uname; 1068 p2 = dlsym(RTLD_DEFAULT, "uname{20040821}"); 1069 1070 if (p1 != p2) 1071 return 1; 1072 1073 /* uname() fails with EFAULT on HP-UX systems that were only partially upgraded to this API level */ 1074 1075 return -1 == uname(&name) ? 1 : 0; 1076} 1077], 1078 CFLAGS="-D_HPUX_API_LEVEL=20040821 $saved_CFLAGS" 1079 AC_MSG_RESULT(yes), 1080 CFLAGS="$saved_CFLAGS" 1081 AC_MSG_RESULT(no)) 1082fi 1083 1084AC_DEFINE_UNQUOTED([ARCH], "${ARCH}", [Define to OS name for code managing]) 1085AC_SUBST(ARCH) 1086 1087AC_CHECK_SIZEOF([void *]) 1088 1089dnl ***************************************************************** 1090dnl * * 1091dnl * Checks for options given on the command line * 1092dnl * * 1093dnl ***************************************************************** 1094 1095AC_ARG_ENABLE(static,[ --enable-static Build statically linked binaries], 1096[case "${enableval}" in 1097 yes) 1098 LDFLAGS="${LDFLAGS} -static" 1099 AC_MSG_CHECKING(if static linking is possible) 1100 AC_LINK_IFELSE([AC_LANG_PROGRAM(,)], 1101 [AC_MSG_RESULT([yes]) 1102 static_linking=yes], 1103 [AC_MSG_RESULT([no]) 1104 static_linking=no]) 1105 if test "x$static_linking" = "xno"; then 1106 AC_MSG_ERROR([static linking is not possible on this system]) 1107 fi 1108 ;; 1109 no) ;; 1110 *) AC_MSG_ERROR([bad value ${enableval} for --enable-static]) ;; 1111esac]) 1112 1113AC_ARG_ENABLE(server,[ --enable-server Turn on build of Zabbix server], 1114[case "${enableval}" in 1115 yes) server=yes ;; 1116 no) server=no ;; 1117 *) AC_MSG_ERROR([bad value ${enableval} for --enable-server]) ;; 1118esac], 1119[server=no]) 1120AM_CONDITIONAL(SERVER, test "x$server" = "xyes") 1121 1122AC_ARG_ENABLE(proxy,[ --enable-proxy Turn on build of Zabbix proxy], 1123[case "${enableval}" in 1124 yes) proxy=yes ;; 1125 no) proxy=no ;; 1126 *) AC_MSG_ERROR([bad value ${enableval} for --enable-proxy]) ;; 1127esac], 1128[proxy=no]) 1129AM_CONDITIONAL(PROXY, test "x$proxy" = "xyes") 1130 1131AC_ARG_ENABLE(agent,[ --enable-agent Turn on build of Zabbix agent and client utilities], 1132[case "${enableval}" in 1133 yes) agent=yes ;; 1134 no) agent=no ;; 1135 *) AC_MSG_ERROR([bad value ${enableval} for --enable-agent]) ;; 1136esac], 1137[agent=no]) 1138AM_CONDITIONAL(AGENT, test "x$agent" = "xyes") 1139 1140AC_ARG_ENABLE(java,[ --enable-java Turn on build of Zabbix Java gateway], 1141[case "${enableval}" in 1142 yes) java=yes ;; 1143 no) java=no ;; 1144 *) AC_MSG_ERROR([bad value ${enableval} for --enable-java]) ;; 1145esac], 1146[java=no]) 1147AM_CONDITIONAL(JAVA, test "x$java" = "xyes") 1148 1149AC_ARG_ENABLE(ipv6,[ --enable-ipv6 Turn on support of IPv6], 1150[case "${enableval}" in 1151 yes) ipv6=yes ;; 1152 no) ipv6=no ;; 1153 *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;; 1154esac], 1155[ipv6=no]) 1156 1157have_db="no" 1158have_unixodbc="no" 1159have_web_monitoring="no" 1160have_jabber="no" 1161have_snmp="no" 1162have_ipmi="no" 1163have_ipv6="no" 1164have_ssh2="no" 1165have_tls="no" 1166 1167if test "x$ipv6" = "xyes"; then 1168 AC_DEFINE(HAVE_IPV6,1,[Define to 1 if IPv6 should be enabled.]) 1169 have_ipv6="yes" 1170fi 1171 1172if test "x$server" = "xyes" || test "x$proxy" = "xyes"; then 1173 1174 have_multirow_insert="no" 1175 1176 dnl Checking for IBM DB2 support 1177 AX_LIB_IBM_DB2() 1178 if test "x$want_ibm_db2" = "xyes"; then 1179 if test "x$have_db" != "xno"; then 1180 AC_MSG_ERROR([You can configure for only one database.]) 1181 fi 1182 1183 if test "x$found_ibm_db2" = "xyes"; then 1184 have_db="IBM DB2" 1185 have_multirow_insert="yes" 1186 else 1187 AC_MSG_ERROR([IBM DB2 library not found]) 1188 fi 1189 fi 1190 1191 dnl Checking for MySQL support 1192 AX_LIB_MYSQL() 1193 if test "x$want_mysql" = "xyes"; then 1194 if test "x$have_db" != "xno"; then 1195 AC_MSG_ERROR([You can configure for only one database.]) 1196 fi 1197 1198 if test "x$found_mysql" = "xyes"; then 1199 have_db="MySQL" 1200 have_multirow_insert="yes" 1201 else 1202 AC_MSG_ERROR([MySQL library not found]) 1203 fi 1204 fi 1205 1206 dnl Checking for Oracle support 1207 AX_LIB_ORACLE_OCI([10.0]) 1208 if test "x$want_oracle_oci" = "xyes"; then 1209 if test "x$have_db" != "xno"; then 1210 AC_MSG_ERROR([You can configure for only one database.]) 1211 fi 1212 1213 if test "x$HAVE_ORACLE_OCI" = "xyes"; then 1214 have_db="Oracle" 1215 1216 ORACLE_CPPFLAGS="$ORACLE_OCI_CFLAGS" 1217 ORACLE_LDFLAGS="$ORACLE_OCI_LDFLAGS" 1218 ORACLE_LIBS="$ORACLE_OCI_LIBS" 1219 1220 AC_DEFINE(HAVE_ORACLE,1,[Define to 1 if Oracle should be enabled.]) 1221 else 1222 AC_MSG_ERROR([Oracle OCI library not found]) 1223 fi 1224 fi 1225 1226 dnl Checking for PostgreSQL support 1227 AX_LIB_POSTGRESQL("8.1") 1228 if test "x$want_postgresql" = "xyes"; then 1229 if test "x$have_db" != "xno"; then 1230 AC_MSG_ERROR([You can configure for only one database.]) 1231 fi 1232 1233 if test "x$found_postgresql" = "xyes"; then 1234 if test "$postgresql_version_check" != "1"; then 1235 AC_MSG_ERROR([PostgreSQL version mismatch]) 1236 fi 1237 1238 have_db="PostgreSQL" 1239 1240 if test "$postgresql_version_number" -ge 8002000; then 1241 have_multirow_insert="yes" 1242 fi 1243 1244 else 1245 AC_MSG_ERROR([PostgreSQL library not found]) 1246 fi 1247 fi 1248 1249 dnl Checking for SQLite3 support 1250 AX_LIB_SQLITE3() 1251 if test "x$want_sqlite3" = "xyes"; then 1252 if test "x$have_db" != "xno"; then 1253 AC_MSG_ERROR([You can configure for only one database.]) 1254 fi 1255 1256 if test "x$found_sqlite3" = "xyes"; then 1257 have_db="SQLite v3.x" 1258 1259 saved_CPPFLAGS="$CPPFLAGS" 1260 saved_LDFLAGS="$LDFLAGS" 1261 1262 CPPFLAGS="$CPPFLAGS $SQLITE3_CPPFLAGS" 1263 LDFLAGS="$LDFLAGS $SQLITE3_LDFLAGS $SQLITE3_LIBS" 1264 1265 AC_MSG_CHECKING([for function sqlite3_open_v2() in sqlite3.h]) 1266 AC_TRY_LINK([#include <sqlite3.h>], 1267 [sqlite3 *conn = 0; 1268 sqlite3_open_v2("dbname", &conn, SQLITE_OPEN_READWRITE, 0); 1269 ], 1270 AC_DEFINE(HAVE_FUNCTION_SQLITE3_OPEN_V2,1,[Define to 1 if function 'sqlite3_open_v2' exists.]) 1271 AC_MSG_RESULT(yes), 1272 AC_MSG_RESULT(no)) 1273 1274 CPPFLAGS="$saved_CPPFLAGS" 1275 LDFLAGS="$saved_LDFLAGS" 1276 else 1277 AC_MSG_ERROR([SQLite3 library not found]) 1278 fi 1279 fi 1280 1281 AC_MSG_CHECKING(for Zabbix server/proxy database selection) 1282 if test "x$have_db" = "xno"; then 1283 AC_MSG_RESULT(error) 1284 AC_MSG_ERROR([No database selected for Zabbix server/proxy. Use --with-ibm-db2 or --with-mysql or --with-oracle or --with-postgresql or --with-sqlite3.]) 1285 else 1286 AC_MSG_RESULT(ok) 1287 fi 1288 1289 AC_MSG_CHECKING(for multirow insert statements) 1290 if test "x$have_multirow_insert" = "xyes"; then 1291 AC_DEFINE(HAVE_MULTIROW_INSERT,1,[Define to 1 if database supports multirow insert statements.]) 1292 AC_MSG_RESULT(yes) 1293 else 1294 AC_MSG_RESULT(no) 1295 fi 1296 1297 DB_CFLAGS="$IBM_DB2_CPPFLAGS $MYSQL_CFLAGS $ORACLE_CPPFLAGS $POSTGRESQL_CFLAGS $SQLITE3_CPPFLAGS" 1298 DB_LDFLAGS="$IBM_DB2_LDFLAGS $MYSQL_LDFLAGS $ORACLE_LDFLAGS $POSTGRESQL_LDFLAGS $SQLITE3_LDFLAGS" 1299 DB_LIBS="$IBM_DB2_LIBS $MYSQL_LIBS $ORACLE_LIBS $POSTGRESQL_LIBS $SQLITE3_LIBS" 1300 1301 AC_SUBST(DB_CFLAGS) 1302 AC_SUBST(DB_LDFLAGS) 1303 AC_SUBST(DB_LIBS) 1304 1305 SERVER_LDFLAGS="${SERVER_LDFLAGS} ${DB_LDFLAGS}" 1306 SERVER_LIBS="${SERVER_LIBS} ${DB_LIBS}" 1307 1308 PROXY_LDFLAGS="${PROXY_LDFLAGS} ${DB_LDFLAGS}" 1309 PROXY_LIBS="${PROXY_LIBS} ${DB_LIBS}" 1310 1311 dnl Checking for Jabber libraries 1312 JABBER_CHECK_CONFIG() 1313 if test "x$want_jabber" = "xyes"; then 1314 if test "x$found_jabber" != "xyes"; then 1315 AC_MSG_ERROR([Jabber library not found]) 1316 else 1317 have_jabber="yes" 1318 fi 1319 fi 1320 SERVER_LDFLAGS="$SERVER_LDFLAGS $JABBER_LDFLAGS" 1321 SERVER_LIBS="$SERVER_LIBS $JABBER_LIBS" 1322 1323 AC_SUBST(JABBER_CPPFLAGS) 1324 1325 dnl Check for LIBXML2 [by default - skip] 1326 LIBXML2_CHECK_CONFIG([no]) 1327 if test "x$want_libxml2" = "xyes"; then 1328 if test "x$found_libxml2" != "xyes"; then 1329 AC_MSG_ERROR([LIBXML2 library not found]) 1330 else 1331 have_libxml2="yes" 1332 fi 1333 fi 1334 SERVER_LDFLAGS="$SERVER_LDFLAGS $LIBXML2_LDFLAGS" 1335 SERVER_LIBS="$SERVER_LIBS $LIBXML2_LIBS" 1336 1337 PROXY_LDFLAGS="$PROXY_LDFLAGS $LIBXML2_LDFLAGS" 1338 PROXY_LIBS="$PROXY_LIBS $LIBXML2_LIBS" 1339 1340 AC_SUBST(LIBXML2_CFLAGS) 1341 1342 dnl Checking for unixODBC support 1343 LIBUNIXODBC_CHECK_CONFIG([no]) 1344 if test "x$want_unixodbc" = "xyes"; then 1345 if test "x$unixodbc_error" != "x"; then 1346 AC_MSG_ERROR($unixodbc_error) 1347 fi 1348 have_unixodbc="yes" 1349 fi 1350 SERVER_LDFLAGS="$SERVER_LDFLAGS $UNIXODBC_LDFLAGS" 1351 SERVER_LIBS="$SERVER_LIBS $UNIXODBC_LIBS" 1352 1353 PROXY_LDFLAGS="$PROXY_LDFLAGS $UNIXODBC_LDFLAGS" 1354 PROXY_LIBS="$PROXY_LIBS $UNIXODBC_LIBS" 1355 1356 AC_SUBST(UNIXODBC_CFLAGS) 1357 1358 dnl Check for Net-SNMP [by default - skip] 1359 LIBNETSNMP_CHECK_CONFIG([no]) 1360 if test "x$want_netsnmp" = "xyes"; then 1361 if test "x$found_netsnmp" != "xyes"; then 1362 AC_MSG_ERROR([Invalid Net-SNMP directory - unable to find net-snmp-config]) 1363 else 1364 have_snmp="yes" 1365 fi 1366 fi 1367 SERVER_LDFLAGS="$SERVER_LDFLAGS $SNMP_LDFLAGS" 1368 SERVER_LIBS="$SERVER_LIBS $SNMP_LIBS" 1369 1370 PROXY_LDFLAGS="$PROXY_LDFLAGS $SNMP_LDFLAGS" 1371 PROXY_LIBS="$PROXY_LIBS $SNMP_LIBS" 1372 1373 AC_SUBST(SNMP_CFLAGS) 1374 1375 dnl Check for LIBSSH2 [by default - skip] at least of version 1.0.0. 1376 LIBSSH2_CHECK_CONFIG([no]) 1377 if test "x$want_ssh2" = "xyes"; then 1378 if test "x$found_ssh2" != "xyes"; then 1379 AC_MSG_ERROR([SSH2 library not found]) 1380 elif test "x$accept_ssh2_version" != "xyes"; then 1381 AC_MSG_ERROR([SSH2 library version requirement not met (>= 1.0.0)]) 1382 else 1383 have_ssh2="yes" 1384 fi 1385 fi 1386 SERVER_LDFLAGS="$SERVER_LDFLAGS $SSH2_LDFLAGS" 1387 SERVER_LIBS="$SERVER_LIBS $SSH2_LIBS" 1388 1389 PROXY_LDFLAGS="$PROXY_LDFLAGS $SSH2_LDFLAGS" 1390 PROXY_LIBS="$PROXY_LIBS $SSH2_LIBS" 1391 1392 AC_SUBST(SSH2_CFLAGS) 1393 1394 found_openipmi="no" 1395 dnl Check for libOpenIPMI [by default - skip] 1396 LIBOPENIPMI_CHECK_CONFIG([no]) 1397 if test "x$want_openipmi" = "xyes"; then 1398 if test "x$found_openipmi" != "xyes"; then 1399 AC_MSG_ERROR([Invalid OPENIPMI directory - unable to find ipmiif.h]) 1400 else 1401 have_ipmi="yes" 1402 fi 1403 fi 1404 SERVER_LDFLAGS="$SERVER_LDFLAGS $OPENIPMI_LDFLAGS" 1405 SERVER_LIBS="$SERVER_LIBS $OPENIPMI_LIBS" 1406 1407 PROXY_LDFLAGS="$PROXY_LDFLAGS $OPENIPMI_LDFLAGS" 1408 PROXY_LIBS="$PROXY_LIBS $OPENIPMI_LIBS" 1409 1410 AC_SUBST(OPENIPMI_CFLAGS) 1411fi 1412 1413dnl Check for mbed TLS (PolarSSL) libpolarssl [by default - skip] 1414LIBMBEDTLS_CHECK_CONFIG([no]) 1415if test "x$want_mbedtls" = "xyes"; then 1416 if test "x$have_tls" != "xno"; then 1417 AC_MSG_ERROR([You can configure for only one TLS library (--with-mbedtls, --with-gnutls or --with-openssl).]) 1418 fi 1419 1420 if test "x$found_mbedtls" != "xyes"; then 1421 AC_MSG_ERROR([mbed TLS (PolarSSL) library libpolarssl not found]) 1422 elif test "x$accept_mbedtls_version" != "xyes"; then 1423 AC_MSG_ERROR([mbed TLS (PolarSSL) library version requirement not met (>= 1.3.9)]) 1424 else 1425 have_tls="mbed TLS" 1426 fi 1427 TLS_CFLAGS="$MBEDTLS_CFLAGS" 1428 TLS_LDFLAGS="$MBEDTLS_LDFLAGS" 1429 TLS_LIBS="$MBEDTLS_LIBS" 1430fi 1431 1432dnl Check for GnuTLS libgnutls [by default - skip] 1433LIBGNUTLS_CHECK_CONFIG([no]) 1434if test "x$want_gnutls" = "xyes"; then 1435 if test "x$have_tls" != "xno"; then 1436 AC_MSG_ERROR([You can configure for only one TLS library (--with-mbedtls, --with-gnutls or --with-openssl).]) 1437 fi 1438 1439 if test "x$found_gnutls" != "xyes"; then 1440 AC_MSG_ERROR([GnuTLS library libgnutls not found]) 1441 elif test "x$accept_gnutls_version" != "xyes"; then 1442 AC_MSG_ERROR([GnuTLS library version requirement not met (>= 3.1.18)]) 1443 else 1444 have_tls="GnuTLS" 1445 fi 1446 TLS_CFLAGS="$GNUTLS_CFLAGS" 1447 TLS_LDFLAGS="$GNUTLS_LDFLAGS" 1448 TLS_LIBS="$GNUTLS_LIBS" 1449fi 1450 1451dnl Check for OpenSSL libssl and libcrypto [by default - skip] 1452LIBOPENSSL_CHECK_CONFIG([no]) 1453if test "x$want_openssl" = "xyes"; then 1454 if test "x$have_tls" != "xno"; then 1455 AC_MSG_ERROR([You can configure for only one TLS library (--with-mbedtls, --with-gnutls or --with-openssl).]) 1456 fi 1457 1458 if test "x$found_openssl" != "xOpenSSL" -a "x$found_openssl" != "xOpenSSL (PSK not supported)"; then 1459 AC_MSG_ERROR([OpenSSL library libssl or libcrypto not found]) 1460 elif test "x$accept_openssl_version" != "xyes"; then 1461 AC_MSG_ERROR([OpenSSL library version requirement not met (>= 1.0.1)]) 1462 else 1463 have_tls=$found_openssl 1464 fi 1465 TLS_CFLAGS="$OPENSSL_CFLAGS" 1466 TLS_LDFLAGS="$OPENSSL_LDFLAGS" 1467 TLS_LIBS="$OPENSSL_LIBS" 1468fi 1469AC_SUBST(TLS_CFLAGS) 1470 1471SERVER_LDFLAGS="$SERVER_LDFLAGS $TLS_LDFLAGS" 1472SERVER_LIBS="$SERVER_LIBS $TLS_LIBS" 1473 1474PROXY_LDFLAGS="$PROXY_LDFLAGS $TLS_LDFLAGS" 1475PROXY_LIBS="$PROXY_LIBS $TLS_LIBS" 1476 1477AGENT_LDFLAGS="$AGENT_LDFLAGS $TLS_LDFLAGS" 1478AGENT_LIBS="$AGENT_LIBS $TLS_LIBS" 1479 1480ZBXGET_LDFLAGS="$ZBXGET_LDFLAGS $TLS_LDFLAGS" 1481ZBXGET_LIBS="$ZBXGET_LIBS $TLS_LIBS" 1482 1483SENDER_LDFLAGS="$SENDER_LDFLAGS $TLS_LDFLAGS" 1484SENDER_LIBS="$SENDER_LIBS $TLS_LIBS" 1485 1486if test "x$java" = "xyes"; then 1487 AC_CHECK_PROGS([JAVAC], [javac], [no]) 1488 if test "x$JAVAC" = "xno"; then 1489 AC_MSG_ERROR([Unable to find "javac" executable in path]) 1490 fi 1491 AC_CHECK_PROGS([JAR], [jar], [no]) 1492 if test "x$JAR" = "xno"; then 1493 AC_MSG_ERROR([Unable to find "jar" executable in path]) 1494 fi 1495fi 1496 1497found_ldap="no" 1498dnl Check for libLDAP [by default - skip] 1499LIBLDAP_CHECK_CONFIG([no]) 1500if test "x$want_ldap" = "xyes"; then 1501 if test "x$found_ldap" != "xyes"; then 1502 AC_MSG_ERROR([Invalid LDAP directory - unable to find ldap.h]) 1503 fi 1504fi 1505SERVER_LDFLAGS="$SERVER_LDFLAGS $LDAP_LDFLAGS" 1506SERVER_LIBS="$SERVER_LIBS $LDAP_LIBS" 1507 1508PROXY_LDFLAGS="$PROXY_LDFLAGS $LDAP_LDFLAGS" 1509PROXY_LIBS="$PROXY_LIBS $LDAP_LIBS" 1510 1511AGENT_LDFLAGS="$AGENT_LDFLAGS $LDAP_LDFLAGS" 1512AGENT_LIBS="$AGENT_LIBS $LDAP_LIBS" 1513 1514AC_SUBST(LDAP_CPPFLAGS) 1515 1516found_curl="no" 1517dnl Checking for libCurl [by default - skip] 1518LIBCURL_CHECK_CONFIG(, [7.13.1], [],[]) 1519if test "x$want_curl" = "xyes"; then 1520 if test "x$found_curl" != "xyes"; then 1521 AC_MSG_ERROR([Curl library not found]) 1522 fi 1523fi 1524if test "x$found_curl" = "xyes"; then 1525 have_web_monitoring="cURL" 1526fi 1527CFLAGS="$LIBCURL_CFLAGS $CFLAGS" 1528 1529SERVER_LDFLAGS="$SERVER_LDFLAGS $LIBCURL_LDFLAGS" 1530SERVER_LIBS="$SERVER_LIBS $LIBCURL_LIBS" 1531 1532PROXY_LDFLAGS="$PROXY_LDFLAGS $LIBCURL_LDFLAGS" 1533PROXY_LIBS="$PROXY_LIBS $LIBCURL_LIBS" 1534 1535dnl Starting from 2.0 agent can do web monitoring 1536AGENT_LDFLAGS="$AGENT_LDFLAGS $LIBCURL_LDFLAGS" 1537AGENT_LIBS="$AGENT_LIBS $LIBCURL_LIBS" 1538 1539found_iconv="no" 1540dnl Check for libiconv [by default - skip] 1541LIBICONV_CHECK_CONFIG([no]) 1542if test "x$found_iconv" != "xyes"; then 1543 AC_MSG_ERROR([Unable to use iconv (libiconv check failed)]) 1544fi 1545LDFLAGS="$LDFLAGS $ICONV_LDFLAGS" 1546LIBS="$LIBS $ICONV_LIBS" 1547 1548AC_SUBST(ICONV_CFLAGS) 1549 1550RANLIB="ranlib" 1551AC_SUBST(RANLIB) 1552 1553AC_SUBST(SERVER_LDFLAGS) 1554AC_SUBST(SERVER_LIBS) 1555 1556AC_SUBST(PROXY_LDFLAGS) 1557AC_SUBST(PROXY_LIBS) 1558 1559AC_SUBST(AGENT_LDFLAGS) 1560AC_SUBST(AGENT_LIBS) 1561 1562AC_SUBST(ZBXGET_LDFLAGS) 1563AC_SUBST(ZBXGET_LIBS) 1564 1565AC_SUBST(SENDER_LDFLAGS) 1566AC_SUBST(SENDER_LIBS) 1567 1568dnl ***************************************************************** 1569dnl * * 1570dnl * Other checks * 1571dnl * * 1572dnl ***************************************************************** 1573 1574dnl Automake 1.8 to 1.9.6 sets mkdir_p macro (lower-cased). 1575AC_MSG_CHECKING(for mkdir -p candidate) 1576if test "x${MKDIR_P}" = "x"; then 1577 if test "x${mkdir_p}" = "x"; then 1578 AC_MSG_ERROR([No suitable "mkdir -p" candidate found.]) 1579 fi 1580 AC_SUBST([MKDIR_P], ${mkdir_p}) 1581fi 1582AC_MSG_RESULT([ok (${MKDIR_P})]) 1583 1584dnl Check if process statistics collector should be enabled 1585case "x$ARCH" in 1586 xlinux|xsolaris) 1587 AC_DEFINE(ZBX_PROCSTAT_COLLECTOR, 1 , [Define to 1 on linux and solaris platforms]) 1588 ;; 1589esac 1590 1591 1592dnl ***************************************************************** 1593dnl * * 1594dnl * Output configuration results * 1595dnl * * 1596dnl ***************************************************************** 1597 1598AC_OUTPUT([ 1599 Makefile 1600 database/Makefile 1601 misc/Makefile 1602 src/Makefile 1603 src/libs/Makefile 1604 src/libs/zbxlog/Makefile 1605 src/libs/zbxalgo/Makefile 1606 src/libs/zbxmemory/Makefile 1607 src/libs/zbxcrypto/Makefile 1608 src/libs/zbxconf/Makefile 1609 src/libs/zbxdbcache/Makefile 1610 src/libs/zbxdbhigh/Makefile 1611 src/libs/zbxmedia/Makefile 1612 src/libs/zbxsysinfo/Makefile 1613 src/libs/zbxcommon/Makefile 1614 src/libs/zbxsysinfo/agent/Makefile 1615 src/libs/zbxsysinfo/common/Makefile 1616 src/libs/zbxsysinfo/simple/Makefile 1617 src/libs/zbxsysinfo/linux/Makefile 1618 src/libs/zbxsysinfo/aix/Makefile 1619 src/libs/zbxsysinfo/freebsd/Makefile 1620 src/libs/zbxsysinfo/dragonfly/Makefile 1621 src/libs/zbxsysinfo/hpux/Makefile 1622 src/libs/zbxsysinfo/openbsd/Makefile 1623 src/libs/zbxsysinfo/osx/Makefile 1624 src/libs/zbxsysinfo/solaris/Makefile 1625 src/libs/zbxsysinfo/osf/Makefile 1626 src/libs/zbxsysinfo/netbsd/Makefile 1627 src/libs/zbxsysinfo/unknown/Makefile 1628 src/libs/zbxnix/Makefile 1629 src/libs/zbxsys/Makefile 1630 src/libs/zbxcomms/Makefile 1631 src/libs/zbxcommshigh/Makefile 1632 src/libs/zbxdb/Makefile 1633 src/libs/zbxdbupgrade/Makefile 1634 src/libs/zbxjson/Makefile 1635 src/libs/zbxserver/Makefile 1636 src/libs/zbxicmpping/Makefile 1637 src/libs/zbxexec/Makefile 1638 src/libs/zbxself/Makefile 1639 src/libs/zbxmodules/Makefile 1640 src/libs/zbxregexp/Makefile 1641 src/zabbix_agent/Makefile 1642 src/zabbix_get/Makefile 1643 src/zabbix_sender/Makefile 1644 src/zabbix_server/Makefile 1645 src/zabbix_server/alerter/Makefile 1646 src/zabbix_server/dbsyncer/Makefile 1647 src/zabbix_server/dbconfig/Makefile 1648 src/zabbix_server/discoverer/Makefile 1649 src/zabbix_server/housekeeper/Makefile 1650 src/zabbix_server/httppoller/Makefile 1651 src/zabbix_server/pinger/Makefile 1652 src/zabbix_server/poller/Makefile 1653 src/zabbix_server/snmptrapper/Makefile 1654 src/zabbix_server/timer/Makefile 1655 src/zabbix_server/trapper/Makefile 1656 src/zabbix_server/watchdog/Makefile 1657 src/zabbix_server/escalator/Makefile 1658 src/zabbix_server/proxypoller/Makefile 1659 src/zabbix_server/selfmon/Makefile 1660 src/zabbix_server/vmware/Makefile 1661 src/zabbix_proxy/Makefile 1662 src/zabbix_proxy/heart/Makefile 1663 src/zabbix_proxy/housekeeper/Makefile 1664 src/zabbix_proxy/proxyconfig/Makefile 1665 src/zabbix_proxy/datasender/Makefile 1666 src/zabbix_java/Makefile 1667 upgrades/Makefile 1668 man/Makefile 1669 ]) 1670 1671echo " 1672 1673Configuration: 1674 1675 Detected OS: ${host_os} 1676 Install path: ${prefix} 1677 Compilation arch: ${ARCH} 1678 1679 Compiler: ${CC} 1680 Compiler flags: ${CFLAGS} 1681 1682 Library-specific flags:" 1683 1684if test "x$DB_CFLAGS" != "x"; then 1685 echo " database: ${DB_CFLAGS}" 1686fi 1687 1688if test "x$JABBER_CPPFLAGS" != "x"; then 1689 echo " Jabber: ${JABBER_CPPFLAGS}" 1690fi 1691 1692if test "x$LIBXML2_CFLAGS" != "x"; then 1693 echo " libXML2: ${LIBXML2_CFLAGS}" 1694fi 1695 1696if test "x$UNIXODBC_CFLAGS" != "x"; then 1697 echo " unixODBC: ${UNIXODBC_CFLAGS}" 1698fi 1699 1700if test "x$SNMP_CFLAGS" != "x"; then 1701 echo " Net-SNMP: ${SNMP_CFLAGS}" 1702fi 1703 1704if test "x$OPENIPMI_CFLAGS" != "x"; then 1705 echo " OpenIPMI: ${OPENIPMI_CFLAGS}" 1706fi 1707 1708if test "x$SSH2_CFLAGS" != "x"; then 1709 echo " libssh2: ${SSH2_CFLAGS}" 1710fi 1711 1712if test "x$TLS_CFLAGS" != "x"; then 1713 echo " TLS: ${TLS_CFLAGS}" 1714fi 1715 1716if test "x$LDAP_CPPFLAGS" != "x"; then 1717 echo " LDAP: ${LDAP_CPPFLAGS}" 1718fi 1719 1720if test "x$ICONV_CFLAGS" != "x"; then 1721 echo " iconv: ${ICONV_CFLAGS}" 1722fi 1723 1724echo " 1725 Enable server: ${server}" 1726 1727if test "x$server" != "xno"; then 1728 1729echo " Server details: 1730 With database: ${have_db} 1731 WEB Monitoring: ${have_web_monitoring} 1732 Native Jabber: ${have_jabber} 1733 SNMP: ${have_snmp} 1734 IPMI: ${have_ipmi} 1735 SSH: ${have_ssh2} 1736 TLS: ${have_tls} 1737 ODBC: ${have_unixodbc} 1738 Linker flags: ${SERVER_LDFLAGS} ${LDFLAGS} 1739 Libraries: ${SERVER_LIBS} ${LIBS}" 1740 1741fi 1742 1743echo " 1744 Enable proxy: ${proxy}" 1745 1746if test "x$proxy" != "xno"; then 1747 1748echo " Proxy details: 1749 With database: ${have_db} 1750 WEB Monitoring: ${have_web_monitoring} 1751 SNMP: ${have_snmp} 1752 IPMI: ${have_ipmi} 1753 SSH: ${have_ssh2} 1754 TLS: ${have_tls} 1755 ODBC: ${have_unixodbc} 1756 Linker flags: ${PROXY_LDFLAGS} ${LDFLAGS} 1757 Libraries: ${PROXY_LIBS} ${LIBS}" 1758 1759fi 1760 1761echo " 1762 Enable agent: ${agent}" 1763 1764if test "x$agent" != "xno"; then 1765 1766echo " Agent details: 1767 TLS: ${have_tls} 1768 Linker flags: ${AGENT_LDFLAGS} ${LDFLAGS} 1769 Libraries: ${AGENT_LIBS} ${LIBS}" 1770 1771fi 1772 1773echo " 1774 Enable Java gateway: ${java}" 1775 1776if test "x$java" != "xno"; then 1777 1778echo " Java gateway details: 1779 Java compiler: ${JAVAC} 1780 Java archiver: ${JAR}" 1781 1782fi 1783 1784echo " 1785 LDAP support: ${found_ldap} 1786 IPv6 support: ${have_ipv6}" 1787 1788echo 1789echo "***********************************************************" 1790echo "* Now run '${am_make} install' *" 1791echo "* *" 1792echo "* Thank you for using Zabbix! *" 1793echo "* <http://www.zabbix.com> *" 1794echo "***********************************************************" 1795echo 1796