dnl dnl ZABBIX dnl Copyright (C) 2000-2005 SIA Zabbix dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. dnl dnl Process this file with autoconf to produce a configure script. AC_INIT(src/zabbix_server/server.c) AM_INIT_AUTOMAKE([zabbix],[1.5.3]) AC_MSG_NOTICE([Configuring $PACKAGE_NAME $PACKAGE_VERSION]) AC_PROG_MAKE_SET AM_CONFIG_HEADER(include/config.h) AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC dnl AC_PROG_RANLIB dnl AM_PROG_LIBTOOL dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(stdio.h stdlib.h string.h unistd.h netdb.h signal.h \ syslog.h time.h errno.h sys/types.h sys/stat.h netinet/in.h \ math.h sys/socket.h dirent.h ctype.h \ mtent.h fcntl.h sys/param.h sys/mount.h arpa/inet.h \ sys/vfs.h sys/pstat.h sys/sysinfo.h sys/statvfs.h \ sys/socket.h sys/loadavg.h arpa/inet.h \ sys/swap.h sys/vmmeter.h strings.h sys/sysctl.h vm/vm_param.h \ sys/time.h kstat.h sys/syscall.h sys/sysmacros.h sys/procfs.h \ stdint.h mach/host_info.h mach/mach_host.h knlist.h pwd.h sys/proc.h \ sys/var.h resolv.h arpa/nameser.h assert.h sys/dkstat.h sys/disk.h \ nlist.h net/if.h kvm.h linux/kernel.h getopt.h procinfo.h sys/dk.h \ sys/resource.h pthread.h windows.h process.h conio.h sys/wait.h regex.h \ stdarg.h winsock2.h pdh.h psapi.h sys/sem.h sys/ipc.h sys/shm.h Winldap.h \ sys/timeb.h Winber.h lber.h ws2tcpip.h inttypes.h sys/file.h grp.h \ net/if_mib.h sys/user.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T dnl Checks for libraries. dnl Check for crypto moved under SNMP dnl Why I had -lsnmp before ??? dnl AC_CHECK_LIB(snmp, main, LIBS="-lsnmp $LIBS") dnl Required for AIX when -lsnmp is used dnl AC_CHECK_LIB(isode, main) AC_SEARCH_LIBS(socket, socket) #Solaris SNMP requires this AC_SEARCH_LIBS(kstat_open, kstat) AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(__res_query, resolv bind socket) #Solaris 8 requires this. It does not have symbol __res_query. AC_SEARCH_LIBS(res_query, resolv bind socket) AC_CHECK_LIB(m, main) AC_CHECK_LIB(kvm, main) dnl AC_CHECK_LIB(pthread, main) dnl Check for function res_query AC_MSG_CHECKING(for function res_query) AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #ifdef HAVE_ARPA_NAMESER_H #include #endif /* HAVE_ARPA_NAMESER_H */ #ifdef HAVE_RESOLV_H #include #endif /* HAVE_RESOLV_H */ #if !defined(C_IN) # define C_IN ns_c_in #endif /* C_IN */ #if !defined(T_ANY) # define T_SOA ns_t_any #endif /* T_ANY */ ], [ char zone[1024]; unsigned char respbuf[1024]; if (!(_res.options & RES_INIT)) res_init(); res_query(zone, C_IN, T_SOA, respbuf, sizeof(respbuf)); ], AC_DEFINE(HAVE_RES_QUERY, 1 ,[Define to 1 if function 'res_query' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for union semun AC_MSG_CHECKING(for union semun) AC_TRY_COMPILE( [ #include #include #include ], [union semun foo;], AC_DEFINE(HAVE_SEMUN, 1 ,[Define to 1 if union 'semun' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for %ql format (FreeBSD 4.x) dnl FreeBSD 4.x, it does not support %llu AC_MSG_CHECKING(for long long format) AC_RUN_IFELSE( [ #include int main() { uint64_t i; sscanf("200000000010020" ,"%qu" ,&i); if(i == 200000000010020) return 0; else return -1; } ], AC_DEFINE(HAVE_LONG_LONG_QU, 1 ,[Define to 1 if format '%qu' exists.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for socklen_t AC_MSG_CHECKING(for socklen_t) AC_TRY_COMPILE([ #include #include #include ],[socklen_t s;], AC_MSG_RESULT(yes), [AC_DEFINE(socklen_t, int, [Define socklen_t type]) AC_MSG_RESULT(no)]) dnl Check for /proc filesystem AC_MSG_CHECKING(for /proc filesystem) if test -d /proc; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PROC,1,[Define to 1 if '/proc' file system should be used.]) else AC_MSG_RESULT(no) fi dnl Check for /proc filesystem AC_MSG_CHECKING(for file /proc/stat) if test -r /proc/stat; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PROC_STAT,1,[Define to 1 if file '/proc/stat' should be used.]) else AC_MSG_RESULT(no) fi dnl Check for /proc/cpuinfo filesystem AC_MSG_CHECKING(for file /proc/cpuinfo) if test -r /proc/cpuinfo; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PROC_CPUINFO,1,[Define to 1 if file '/proc/cpuinfo' should be used.]) else AC_MSG_RESULT(no) fi dnl Check for file /proc/1/status AC_MSG_CHECKING(for file /proc/1/status) if test -r /proc/1/status; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PROC_1_STATUS,1,[Define to 1 if file '/proc/1/status' should be used.]) else AC_MSG_RESULT(no) fi dnl Check for file /proc/0/psinfo (Solaris) AC_MSG_CHECKING(for file /proc/0/psinfo) if test -r /proc/0/psinfo; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PROC_0_PSINFO,1,[Define to 1 if file '/proc/0/psinfo' should be used.]) else AC_MSG_RESULT(no) fi dnl Check for file /proc/loadavg AC_MSG_CHECKING(for file /proc/loadavg) if test -r /proc/loadavg; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PROC_LOADAVG,1,[Define to 1 if file '/proc/loadavg' should be used.]) else AC_MSG_RESULT(no) fi dnl Check for file /proc/net/dev AC_MSG_CHECKING(for file /proc/net/dev) if test -r /proc/net/dev; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PROC_NET_DEV,1,[Define to 1 if file /proc/net/dev' should be used.]) else AC_MSG_RESULT(no) fi dnl Check for mem_unit in struct sysinfo AC_MSG_CHECKING(for mem_unit in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.mem_unit=0; ], AC_DEFINE(HAVE_SYSINFO_MEM_UNIT,1,[Define to 1 if 'sysinfo.mem_unit' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for freeswap in struct sysinfo AC_MSG_CHECKING(for freeswap in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.freeswap=0; ], AC_DEFINE(HAVE_SYSINFO_FREESWAP,1,[Define to 1 if 'sysinfo.freeswap' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function setpriority in sys/resource.h AC_MSG_CHECKING(for function setpriority() in sys/resource.h) AC_TRY_COMPILE( [ #include #include ], [ int i; i=setpriority(PRIO_PROCESS,0,5); ], AC_DEFINE(HAVE_SYS_RESOURCE_SETPRIORITY,1,[Define to 1 if function 'setpriority' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function sysconf in unistd.h AC_MSG_CHECKING(for function sysconf() in unistd.h) AC_TRY_COMPILE( [ #include ], [ int i; i=sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PHYS_PAGES); i=sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PHYS_PAGES); ], AC_DEFINE(HAVE_UNISTD_SYSCONF,1,[Define to 1 if function 'sysconf' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for macro __va_copy in stdarg.h AC_MSG_CHECKING(for macro __va_copy() in stdarg.h) AC_TRY_COMPILE( [ #include ], [ va_list src,dst; __va_copy(dst,src); ], AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if function '__va_copy' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for vmtotal in sys/vmmeter.h AC_MSG_CHECKING(for vmtotal in struct sys/vmmeter.h) AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include #ifdef HAVE_VM_VM_PARAM_H #include #endif /* HAVE_VM_VM_PARAM_H */ #ifdef HAVE_SYS_VMMETER_H #include #endif /* HAVE_SYS_VMMETER_H */ #ifndef NULL #define NULL (void *)0 #endif ], [ int mib[] = {CTL_VM, VM_METER}; size_t len; struct vmtotal v; len = sizeof(struct vmtotal); sysctl(mib, 2, &v, &len, NULL, 0); ], AC_DEFINE(HAVE_SYS_VMMETER_VMTOTAL,1,[Define to 1 if struct 'vmtotal' exist .]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for uvmexp_sysctl in uvm/uvm_extern.h AC_MSG_CHECKING(for uvmexp_sysctl in struct uvm/uvm_extern.h) AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include #ifdef HAVE_VM_VM_PARAM_H #include #endif /* HAVE_VM_VM_PARAM_H */ #ifdef HAVE_SYS_VMMETER_H #include #endif /* HAVE_SYS_VMMETER_H */ #ifndef NULL #define NULL (void *)0 #endif ], [ int mib[] = {CTL_VM, VM_UVMEXP2}; size_t len; struct uvmexp_sysctl v; len = sizeof(struct uvmexp_sysctl); sysctl(mib, 2, &v, &len, NULL, 0); ], AC_DEFINE(HAVE_UVM_UVMEXP2,1,[Define to 1 if struct 'uvmexp_sysctl' exist .]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for uvmexp in uvm/uvm_extern.h AC_MSG_CHECKING(for uvmexp in struct uvm/uvm_extern.h) AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include #ifdef HAVE_VM_VM_PARAM_H #include #endif /* HAVE_VM_VM_PARAM_H */ #ifdef HAVE_SYS_VMMETER_H #include #endif /* HAVE_SYS_VMMETER_H */ #ifndef NULL #define NULL (void *)0 #endif ], [ int mib[] = {CTL_VM, VM_UVMEXP}; size_t len; struct uvmexp v; len = sizeof(struct uvmexp); sysctl(mib, 2, &v, &len, NULL, 0); ], AC_DEFINE(HAVE_UVM_UVMEXP,1,[Define to 1 if struct 'uvmexp' exist .]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for struct swaptable in sys/swap.h AC_MSG_CHECKING(for struct swaptable in sys/swap.h) AC_TRY_COMPILE( [ #include #include #include #include #ifndef NULL #define NULL (void *)0 #endif ], [ register int cnt, i; register int t, f; struct swaptable *swt; struct swapent *ste; static char path[256]; /* get total number of swap entries */ cnt = swapctl(SC_GETNSWP, 0); /* allocate enough space to hold count + n swapents */ swt = (struct swaptable *)malloc(sizeof(int) + cnt * sizeof(struct swapent)); if (swt == NULL) { return; } swt->swt_n = cnt; /* fill in ste_path pointers: we don't care about the paths, so we point them all to the same buffer */ ste = &(swt->swt_ent[0]); i = cnt; while (--i >= 0) { ste++->ste_path = path; } /* grab all swap info */ swapctl(SC_LIST, swt); /* walk thru the structs and sum up the fields */ t = f = 0; ste = &(swt->swt_ent[0]); i = cnt; while (--i >= 0) { /* dont count slots being deleted */ if (!(ste->ste_flags & ST_INDEL) && !(ste->ste_flags & ST_DOINGDEL)) { t += ste->ste_pages; f += ste->ste_free; } ste++; } /* fill in the results */ free(swt); ], AC_DEFINE(HAVE_SYS_SWAP_SWAPTABLE,1,[Define to 1 if struct 'swaptable' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for totalswap in struct sysinfo AC_MSG_CHECKING(for totalswap in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.totalswap=0; ], AC_DEFINE(HAVE_SYSINFO_TOTALSWAP,1,[Define to 1 if 'sysinfo.totalswap' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function sysctl (KERN_BOOTTIME) AC_MSG_CHECKING(for function sysctl (KERN_BOOTTIME)) AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include #include #include #include ], [ size_t len; struct timeval uptime; int mib[2]; mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; len = sizeof(uptime); sysctl(mib, 2, &uptime, &len, 0, 0); ], AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME,1,[Define to 1 if 'KERN_BOOTTIME' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function sysctl (HW_NCPU) AC_MSG_CHECKING(for function sysctl (HW_NCPU)) AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include ], [ size_t len; int mib[2], ncpu; mib[0] = CTL_HW; mib[1] = HW_NCPU; len = sizeof(ncpu); sysctl(mib, 2, &ncpu, &len, 0, 0); ], AC_DEFINE(HAVE_FUNCTION_SYSCTL_HW_NCPU,1,[Define to 1 if 'HW_NCPU' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function sysctlbyname() AC_MSG_CHECKING(for function sysctlbyname()) AC_TRY_LINK( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #include ], [ sysctlbyname("", 0, 0, 0, 0); ], AC_DEFINE(HAVE_FUNCTION_SYSCTLBYNAME,1,[Define to 1 if 'sysctlbyname' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function sysctl (KERN_MAXFILES) AC_MSG_CHECKING(for function sysctl (KERN_MAXFILES)) AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include ], [ size_t len; int mib[2], maxfiles; mib[0] = CTL_KERN; mib[1] = KERN_MAXFILES; len = sizeof(maxfiles); sysctl(mib, 2, &maxfiles, &len, 0, 0); ], AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_MAXFILES,1,[Define to 1 if 'KERN_MAXFILES' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function sysctl (KENR_MAXPROC) AC_MSG_CHECKING(for function sysctl (KERN_MAXPROC)) AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include ], [ size_t len; int mib[2], maxproc; mib[0] = CTL_KERN; mib[1] = KERN_MAXPROC; len = sizeof(maxproc); sysctl(mib, 2, &maxproc, &len, 0, 0); ], AC_DEFINE(HAVE_FUNCTION_SYSCTL_KERN_MAXPROC,1,[Define to 1 if 'KERN_MAXPROC' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function initgroups() AC_MSG_CHECKING(for function initgroups()) AC_TRY_LINK( [ #include #include ], [ char *user = "zabbix"; initgroups(user, 0); ], AC_DEFINE(HAVE_FUNCTION_INITGROUPS,1,[Define to 1 if function 'initgroups' exists.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function seteuid() AC_MSG_CHECKING(for function seteuid()) AC_TRY_LINK( [ #include #include ], [ seteuid(0); setegid(0); ], AC_DEFINE(HAVE_FUNCTION_SETEUID,1,[Define to 1 if function 'seteuid' and 'setegid' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for function setproctitle() AC_MSG_CHECKING(for function setproctitle()) AC_TRY_LINK( [ #include #include ], [ setproctitle("Test %d", 1); ], AC_DEFINE(HAVE_FUNCTION_SETPROCTITLE,1,[Define to 1 if function 'setproctitle' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for totalram in struct sysinfo AC_MSG_CHECKING(for totalram in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.totalram=0; ], AC_DEFINE(HAVE_SYSINFO_TOTALRAM,1,[Define to 1 if 'sysinfo.totalram' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for __VA_ARGS__ AC_MSG_CHECKING(for __VA_ARGS__) AC_TRY_COMPILE( [ #define ZBX_CONST_STRING(str) str int test(const char *fmt, ...) { return 0; } ], [ #define TEST(fmt, ...) test(ZBX_CONST_STRING(fmt), ##__VA_ARGS__) TEST("%s","test"); TEST("test"); ], AC_DEFINE(HAVE___VA_ARGS__, 1 ,[Define to 1 if __VA_ARGS__ available.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for sharedram in struct sysinfo AC_MSG_CHECKING(for sharedram in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.sharedram=0; ], AC_DEFINE(HAVE_SYSINFO_SHAREDRAM,1,[Define to 1 if 'sysinfo.sharedram' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for bufferram in struct sysinfo AC_MSG_CHECKING(for bufferram in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.bufferram=0; ], AC_DEFINE(HAVE_SYSINFO_BUFFERRAM,1,[Define to 1 if 'sysinfo.bufferram' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for freeram in struct sysinfo AC_MSG_CHECKING(for freeram in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.freeram=0; ], AC_DEFINE(HAVE_SYSINFO_FREERAM,1,[Define to 1 if 'sysinfo.freeram' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for uptime in struct sysinfo AC_MSG_CHECKING(for uptime in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.uptime=0; ], AC_DEFINE(HAVE_SYSINFO_UPTIME,1,[Define to 1 if 'sysinfo.uptime' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for procs in struct sysinfo AC_MSG_CHECKING(for procs in struct sysinfo) AC_TRY_COMPILE([#include ], [struct sysinfo sysinfo; sysinfo.procs=0; ], AC_DEFINE(HAVE_SYSINFO_PROCS,1,[Define to 1 if 'sysinfo.procs' exist.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Checks for library functions. AC_TYPE_SIGNAL #AC_FUNC_GETLOADAVG AC_REPLACE_FUNCS(getloadavg) AC_CHECK_FUNCS(socket strtod) AC_CHECK_FUNCS(snprintf) AC_CHECK_FUNCS(vasprintf) AC_CHECK_FUNCS(asprintf) AC_CHECK_FUNCS(vsnprintf) AC_CHECK_FUNCS(hstrerror) AC_CHECK_FUNCS(atoll) AC_CHECK_FUNCS(getopt_long) dnl Check if we want to compile everything with static AC_ARG_ENABLE(static,[ --enable-static Build statically linked binaries], [ LDFLAGS="${LDFLAGS} -static"; enable_static=yes]) AC_ARG_ENABLE(server,[ --enable-server Turn on build of server], [case "${enableval}" in yes) server=yes ;; no) server=no ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-server]) ;; esac], [server=no]) AM_CONDITIONAL(SERVER, test x$server = xyes) AC_ARG_ENABLE(proxy,[ --enable-proxy Turn on build of proxy server], [case "${enableval}" in yes) proxy=yes ;; no) proxy=no ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-proxy]) ;; esac], [proxy=no]) AM_CONDITIONAL(PROXY, test x$proxy = xyes) AC_ARG_ENABLE(agent,[ --enable-agent Turn on build of agent], [case "${enableval}" in yes) agent=yes ;; no) agent=no ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-agent]) ;; esac], [agent=no]) AM_CONDITIONAL(AGENT, test x$agent = xyes) AC_ARG_ENABLE(ipv6,[ --enable-ipv6 Turn on support of IPv6], [case "${enableval}" in yes) ipv6=yes ;; no) ipv6=no ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;; esac], [ipv6=no]) have_db="no" have_odbc="no" have_web_monitoring="no" have_jabber="no" have_snmp="no" have_ipv6="no" if test "$ipv6" = "yes"; then AC_DEFINE(HAVE_IPV6,1,[Define to 1 if IPv6 should be enabled.]) have_ipv6="yes" fi if test "$server" = "yes" || test "$proxy" = "yes"; then dnl Checking for Oracle support LIBSQLORA8_CHECK_CONFIG() if test "x$want_sqlora8" = "xyes"; then if test "x$have_db" != "xno"; then AC_MSG_ERROR([You can configure for only one database.]) fi if test "x$found_sqlora8" = "xyes"; then have_db="Oracle" ORACLE_CPPFLAGS="$SQLORA8_CPPFLAGS" ORACLE_LDFLAGS="$SQLORA8_LDFLAGS" AC_SUBST(ORACLE_CPPFLAGS) AC_SUBST(ORACLE_LDFLAGS) AC_DEFINE(HAVE_ORACLE,1,[Define to 1 if Oracle should be enabled.]) else AC_MSG_ERROR([Not found Sqlora8 library]) fi fi dnl Checking for SQLite3 support AX_LIB_SQLITE3() if test "x$WANT_SQLITE3" = "xyes"; then if test "x$have_db" != "xno"; then AC_MSG_ERROR([You can configure for only one database.]) fi if test "x$found_sqlite3" = "xyes"; then have_db="SQLite v3.x" else AC_MSG_ERROR([Not found SQLite3 library]) fi fi dnl Checking for MySQL support AX_LIB_MYSQL() if test "x$want_mysql" = "xyes"; then if test "x$have_db" != "xno"; then AC_MSG_ERROR([You can configure for only one database.]) fi if test "x$found_mysql" = "xyes"; then have_db="MySQL" else AC_MSG_ERROR([Not found MySQL library]) fi fi dnl Checking for PostgreSQL support AX_LIB_POSTGRESQL() if test "x$want_postgresql" = "xyes"; then if test "x$have_db" != "xno"; then AC_MSG_ERROR([You can configure for only one database.]) fi if test "x$found_postgresql" = "xyes"; then have_db="PostgreSQL" dnl To avoid linking of crypt with the agent dnl It seems PostgreSQL does not require this dnl AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, POSTGRESQL_LDFLAGS="-lcrypt $POSTGRESQL_LDFLAGS")) else AC_MSG_ERROR([Not found PostgreSQL library]) fi fi AC_MSG_CHECKING(for ZABBIX server database selection) if test "x$have_db" = "xno"; then AC_MSG_RESULT(error) AC_MSG_ERROR([No database selected for ZABBIX server. Use --with-mysql or --with-oracle or --with-pgsql or --with-sqlite3.]) else AC_MSG_RESULT(ok) fi DB_CPPFLAGS="$ORACLE_CPPFLAGS $SQLITE3_CPPFLAGS $MYSQL_CFLAGS $POSTGRESQL_CPPFLAGS" DB_LDFLAGS="$ORACLE_LDFLAGS $SQLITE3_LDFLAGS $MYSQL_LDFLAGS $POSTGRESQL_LDFLAGS" DB_LIBS="$ORACLE_LIBS $SQLITE3_LIBS $MYSQL_LIBS $POSTGRESQL_LIBS" AC_SUBST(DB_CPPFLAGS) AC_SUBST(DB_LDFLAGS) AC_SUBST(DB_LIBS) CFLAGS="${CFLAGS} ${DB_CPPFLAGS}" SERVER_LDFLAGS="${SERVER_LDFLAGS} ${DB_LDFLAGS}" SERVER_LIBS="${SERVER_LIBS} ${DB_LIBS}" PROXY_LDFLAGS="${PROXY_LDFLAGS} ${DB_LDFLAGS}" PROXY_LIBS="${PROXY_LIBS} ${DB_LIBS}" dnl Checking for Jabber libraries JABBER_CHECK_CONFIG() if test "x$want_jabber" = "xyes"; then if test "x$found_jabber" != "xyes"; then AC_MSG_ERROR([Not found Jabber library]) else have_jabber="yes" fi fi CFLAGS="${CFLAGS} ${JABBER_CPPFLAGS}" SERVER_LDFLAGS="${SERVER_LDFLAGS} ${JABBER_LDFLAGS}" SERVER_LIBS="${SERVER_LIBS} ${JABBER_LIBS}" PROXY_LDFLAGS="${PROXY_LDFLAGS}" PROXY_LIBS="${PROXY_LIBS}" dnl Check for libCurl [default - yes] LIBCURL_CHECK_CONFIG(, [7.13.1], [],[]) if test "x$want_curl" = "xyes"; then if test "x$found_curl" != "xyes"; then AC_MSG_ERROR([Not found Curl library]) fi fi if test "x$found_curl" = "xyes"; then have_web_monitoring="cURL" fi CFLAGS="${CFLAGS} ${LIBCURL_CPPFLAGS}" SERVER_LDFLAGS="${SERVER_LDFLAGS} ${LIBCURL_LDFLAGS}" SERVER_LIBS="${SERVER_LIBS} ${LIBCURL_LIBS}" PROXY_LDFLAGS="${PROXY_LDFLAGS} ${LIBCURL_LDFLAGS}" PROXY_LIBS="${PROXY_LIBS} ${LIBCURL_LIBS}" have_odbc="no" dnl Checking for iODBC support LIBIODBC_CHECK_CONFIG([no]) if test "x$want_iodbc" = "xyes"; then if test "x$found_iodbc" = "xyes"; then have_odbc="iODBC" else AC_MSG_ERROR([Not found iODBC library]) fi fi dnl Checking for unixODBC support LIBUNIXODBC_CHECK_CONFIG([no]) if test "x$want_unixodbc" = "xyes"; then if test "x$have_odbc" != "xno"; then AC_MSG_ERROR([You can configure for only one ODBC griver.]) fi if test "x$found_unixodbc" = "xyes"; then have_odbc="unixODBC" else AC_MSG_ERROR([Not found unixODBC library]) fi fi if test x$have_odbc != xno; then ODBC_CFLAGS="${IODBC_CFLAGS} ${UNIXODBC_CFLAGS}" ODBC_LDFLAGS="${IODBC_LDFLAGS} ${UNIXODBC_LDFLAGS}" ODBC_LIBS="${IODBC_LIBS} ${UNIXODBC_LIBS}" AC_SUBST(ODBC_CFLAGS) AC_SUBST(ODBC_LDFLAGS) AC_SUBST(ODBC_LIBS) AC_DEFINE(HAVE_ODBC,1,[Define to 1 if ODBC Driver Manager should be used.]) CFLAGS="${CFLAGS} ${ODBC_CFLAGS}" SERVER_LDFLAGS="${SERVER_LDFLAGS} ${ODBC_LDFLAGS}" SERVER_LIBS="${SERVER_LIBS} ${ODBC_LIBS}" PROXY_LDFLAGS="${PROXY_LDFLAGS} ${ODBC_LDFLAGS}" PROXY_LIBS="${PROXY_LIBS} ${ODBC_LIBS}" fi dnl Check for NET-SNMP [by default - skip] LIBNETSNMP_CHECK_CONFIG([no]) if test "x$want_netsnmp" = "xyes"; then if test "x$found_netsnmp" != "xyes"; then AC_MSG_ERROR([Invalid NET-SNMP directory - unable to find net-snmp-config]) else have_snmp="net-snmp" fi fi CFLAGS="${CFLAGS} ${SNMP_CFLAGS}" SERVER_LDFLAGS="${SERVER_LDFLAGS} ${SNMP_LDFLAGS}" SERVER_LIBS="${SERVER_LIBS} ${SNMP_LIBS}" PROXY_LDFLAGS="${PROXY_LDFLAGS} ${SNMP_LDFLAGS}" PROXY_LIBS="${PROXY_LIBS} ${SNMP_LIBS}" dnl Check for UCD-SNMP [by default - skip] LIBSNMP_CHECK_CONFIG([no]) if test "x$want_snmp" = "xyes"; then if test "x$found_snmp" != "xyes"; then AC_MSG_ERROR([Invalid UCD-SNMP directory - unable to find ucd-snmp-config.h]) else have_snmp="ucd-snmp" fi if test "x$found_netsnmp" = "xyes"; then AC_MSG_ERROR([You can configure for only one SNMP library.]) fi fi CFLAGS="${CFLAGS} ${SNMP_CPPFLAGS}" SERVER_LDFLAGS="${SERVER_LDFLAGS} ${SNMP_LDFLAGS}" PROXY_LDFLAGS="${PROXY_LDFLAGS} ${SNMP_LDFLAGS}" AC_SUBST(SERVER_LDFLAGS) AC_SUBST(SERVER_LIBS) AC_SUBST(PROXY_LDFLAGS) AC_SUBST(PROXY_LIBS) fi AM_CONDITIONAL(JABBER, test "x$found_jabber" = "xyes") AM_CONDITIONAL(WITH_ODBC, test "x$have_odbc" != "xno") found_ldap="no" dnl Check for libLDAP [by default - skip] LIBLDAP_CHECK_CONFIG([no]) if test "x$want_ldap" = "xyes"; then if test "x$found_ldap" != "xyes"; then AC_MSG_ERROR([Invalid LDAP directory - unable to find ldap.h "${found_ldap}"]) fi fi CFLAGS="${CFLAGS} ${LDAP_CPPFLAGS}" LDFLAGS="${LDFLAGS} ${LDAP_LDFLAGS}" RANLIB="ranlib" AC_SUBST(RANLIB) dnl AC_CONFIG_HEADER(include/config.h) AC_MSG_CHECKING(for architecture) # Cheks for host_os case "$host_os" in linux*) ARCH="linux" AC_MSG_RESULT([ok (${host_os})]) # Ok, this is linux. Check the kernel version AC_MSG_CHECKING([for the kernel version]) kernel=`uname -r` case "${kernel}" in 2.6.*) AC_MSG_RESULT([2.6 family (${kernel})]) AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x]) ;; 2.4.*) AC_MSG_RESULT([2.4 family (${kernel})]) AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) ;; esac ;; aix*) ARCH="aix" AC_MSG_RESULT([ok (${host_os})]) ;; darwin*|rhapsody*) ARCH="osx" AC_MSG_RESULT([ok (${host_os})]) ;; *solaris*) ARCH="solaris" AC_MSG_RESULT([ok (${host_os})]) ;; hpux*) ARCH="hpux" AC_MSG_RESULT([ok (${host_os})]) ;; freebsd*) ARCH="freebsd" AC_MSG_RESULT([ok (${host_os})]) ;; netbsd*) ARCH="netbsd" AC_MSG_RESULT([ok (${host_os})]) ;; osf*) ARCH="osf" AC_MSG_RESULT([ok (${host_os})]) ;; openbsd*) ARCH="openbsd" AC_MSG_RESULT([ok (${host_os})]) ;; *) ARCH="unknown" AC_MSG_RESULT([ok (${host_os})]) dnl AC_MSG_ERROR(${host_os} not supported) ;; esac AC_DEFINE_UNQUOTED([ARCH], "${ARCH}", [Define to os name for code managing]) AC_SUBST(ARCH) AC_OUTPUT([ Makefile create/Makefile misc/Makefile src/Makefile src/libs/Makefile src/libs/zbxlog/Makefile src/libs/zbxcrypto/Makefile src/libs/zbxconf/Makefile src/libs/zbxdbcache/Makefile src/libs/zbxdbhigh/Makefile src/libs/zbxemail/Makefile src/libs/zbxsysinfo/Makefile src/libs/zbxsms/Makefile src/libs/zbxjabber/Makefile src/libs/zbxcommon/Makefile src/libs/zbxsysinfo/common/Makefile src/libs/zbxsysinfo/simple/Makefile src/libs/zbxsysinfo/linux/Makefile src/libs/zbxsysinfo/aix/Makefile src/libs/zbxsysinfo/freebsd/Makefile src/libs/zbxsysinfo/hpux/Makefile src/libs/zbxsysinfo/openbsd/Makefile src/libs/zbxsysinfo/osx/Makefile src/libs/zbxsysinfo/solaris/Makefile src/libs/zbxsysinfo/osf/Makefile src/libs/zbxsysinfo/netbsd/Makefile src/libs/zbxsysinfo/unknown/Makefile src/libs/zbxnix/Makefile src/libs/zbxplugin/Makefile src/libs/zbxsys/Makefile src/libs/zbxcomms/Makefile src/libs/zbxdb/Makefile src/libs/zbxjson/Makefile src/libs/zbxserver/Makefile src/libs/zbxicmpping/Makefile src/zabbix_agent/Makefile src/zabbix_get/Makefile src/zabbix_sender/Makefile src/zabbix_server/Makefile src/zabbix_server/alerter/Makefile src/zabbix_server/dbsyncer/Makefile src/zabbix_server/discoverer/Makefile src/zabbix_server/housekeeper/Makefile src/zabbix_server/httppoller/Makefile src/zabbix_server/nodewatcher/Makefile src/zabbix_server/pinger/Makefile src/zabbix_server/poller/Makefile src/zabbix_server/timer/Makefile src/zabbix_server/trapper/Makefile src/zabbix_server/utils/Makefile src/zabbix_server/watchdog/Makefile src/zabbix_server/escalator/Makefile src/zabbix_proxy/Makefile src/zabbix_proxy/heart/Makefile src/zabbix_proxy/housekeeper/Makefile src/zabbix_proxy/proxyconfig/Makefile src/zabbix_proxy/datasender/Makefile upgrades/Makefile ]) echo " Configuration: Detected OS: ${host_os} Install path: ${prefix} Compilation arch: ${ARCH} Compiler: ${CC} Compiler flags: ${CFLAGS} Enable server: ${server}" if test "x$server" != "xno"; then echo " With database: ${have_db} WEB Monitoring via: ${have_web_monitoring} Native Jabber: ${have_jabber} SNMP: ${have_snmp} Linker flags: ${LDFLAGS} ${SERVER_LDFLAGS} Libraries: ${LIBS} ${SERVER_LIBS}" fi echo " Enable proxy: ${proxy}" if test "x$proxy" != "xno"; then echo " With database: ${have_db} WEB Monitoring via: ${have_web_monitoring} SNMP: ${have_snmp} Linker flags: ${LDFLAGS} ${PROXY_LDFLAGS} Libraries: ${LIBS} ${PROXY_LIBS}" fi echo " Enable agent: ${agent}" if test "x$agent" != "xno"; then echo " Linker flags: ${LDFLAGS} Libraries: ${LIBS}" fi echo " LDAP support: ${found_ldap} IPv6 support: ${have_ipv6}" echo echo "***********************************************************" echo "* Now run '${am_make} install' *" echo "* *" echo "* Thank you for using ZABBIX! *" echo "* *" echo "***********************************************************" echo