Code

network plugin: Fix compiler warnings.
[collectd.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
8         # libtool >= 2.2
9         [
10          LT_CONFIG_LTDL_DIR([libltdl])
11          LT_INIT([dlopen])
12          LTDL_INIT([convenience])
13          AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
14         ]
15 ,
16         # libtool <= 1.5
17         [
18          AC_LIBLTDL_CONVENIENCE
19          AC_SUBST(LTDLINCL)
20          AC_SUBST(LIBLTDL)
21          AC_LIBTOOL_DLOPEN
22          AC_CONFIG_SUBDIRS(libltdl)
23          AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
24         ]
25 )
27 AM_INIT_AUTOMAKE(dist-bzip2)
28 AC_LANG(C)
30 AC_PREFIX_DEFAULT("/opt/collectd")
32 AC_SYS_LARGEFILE
34 #
35 # Checks for programs.
36 #
37 AC_PROG_CC
38 AC_PROG_CPP
39 AC_PROG_INSTALL
40 AC_PROG_LN_S
41 AC_PROG_MAKE_SET
42 AM_PROG_CC_C_O
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
45 AC_DISABLE_STATIC
46 AC_PROG_LIBTOOL
47 AC_PROG_LEX
48 AC_PROG_YACC
49 PKG_PROG_PKG_CONFIG
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
54 AC_MSG_CHECKING([for kernel type ($host_os)])
55 case $host_os in
56         *linux*)
57         AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
58         ac_system="Linux"
59         ;;
60         *solaris*)
61         AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
62         ac_system="Solaris"
63         ;;
64         *darwin*)
65         ac_system="Darwin"
66         ;;
67         *openbsd*)
68         ac_system="OpenBSD"
69         ;;
70         *aix*)
71         AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
72         ac_system="AIX"
73         ;;
74         *)
75         ac_system="unknown"
76 esac
77 AC_MSG_RESULT([$ac_system])
79 if test "x$ac_system" = "xLinux"
80 then
81         AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
82         if test -z "$KERNEL_DIR"
83         then
84                 KERNEL_DIR="/lib/modules/`uname -r`/source"
85         fi
87         KERNEL_CFLAGS="-I$KERNEL_DIR/include"
88         AC_SUBST(KERNEL_CFLAGS)
89 fi
91 if test "x$ac_system" = "xSolaris"
92 then
93         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 fi
95 if test "x$ac_system" = "xAIX"
96 then
97         AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
98 fi
100 # Where to install .pc files.
101 pkgconfigdir="${libdir}/pkgconfig"
102 AC_SUBST(pkgconfigdir)
104 # Check for standards compliance mode
105 AC_ARG_ENABLE(standards,
106               AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
107               [enable_standards="$enableval"],
108               [enable_standards="no"])
109 if test "x$enable_standards" = "xyes"
110 then
111         AC_DEFINE(_ISOC99_SOURCE,        1, [Define to enforce ISO C99 compliance.])
112         AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
113         AC_DEFINE(_XOPEN_SOURCE,       600, [Define to enforce X/Open 6 (XSI) compliance.])
114         AC_DEFINE(_REENTRANT,            1, [Define to enable reentrancy interfaces.])
115 fi
116 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
119 # Checks for header files.
121 AC_HEADER_STDC
122 AC_HEADER_SYS_WAIT
123 AC_HEADER_DIRENT
124 AC_HEADER_STDBOOL
126 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
128 # For ping library
129 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
130 [#if HAVE_STDINT_H
131 # include <stdint.h>
132 #endif
133 #if HAVE_SYS_TYPES_H
134 # include <sys/types.h>
135 #endif
136 ])
137 AC_CHECK_HEADERS(netinet/in.h, [], [],
138 [#if HAVE_STDINT_H
139 # include <stdint.h>
140 #endif
141 #if HAVE_SYS_TYPES_H
142 # include <sys/types.h>
143 #endif
144 #if HAVE_NETINET_IN_SYSTM_H
145 # include <netinet/in_systm.h>
146 #endif
147 ])
148 AC_CHECK_HEADERS(netinet/ip.h, [], [],
149 [#if HAVE_STDINT_H
150 # include <stdint.h>
151 #endif
152 #if HAVE_SYS_TYPES_H
153 # include <sys/types.h>
154 #endif
155 #if HAVE_NETINET_IN_SYSTM_H
156 # include <netinet/in_systm.h>
157 #endif
158 #if HAVE_NETINET_IN_H
159 # include <netinet/in.h>
160 #endif
161 ])
162 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
163 [#if HAVE_STDINT_H
164 # include <stdint.h>
165 #endif
166 #if HAVE_SYS_TYPES_H
167 # include <sys/types.h>
168 #endif
169 #if HAVE_NETINET_IN_SYSTM_H
170 # include <netinet/in_systm.h>
171 #endif
172 #if HAVE_NETINET_IN_H
173 # include <netinet/in.h>
174 #endif
175 #if HAVE_NETINET_IP_H
176 # include <netinet/ip.h>
177 #endif
178 ])
179 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
180 [#if HAVE_STDINT_H
181 # include <stdint.h>
182 #endif
183 #if HAVE_SYS_TYPES_H
184 # include <sys/types.h>
185 #endif
186 #if HAVE_NETINET_IN_SYSTM_H
187 # include <netinet/in_systm.h>
188 #endif
189 #if HAVE_NETINET_IN_H
190 # include <netinet/in.h>
191 #endif
192 #if HAVE_NETINET_IP_H
193 # include <netinet/ip.h>
194 #endif
195 ])
196 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
197 [#if HAVE_STDINT_H
198 # include <stdint.h>
199 #endif
200 #if HAVE_SYS_TYPES_H
201 # include <sys/types.h>
202 #endif
203 #if HAVE_NETINET_IN_SYSTM_H
204 # include <netinet/in_systm.h>
205 #endif
206 #if HAVE_NETINET_IN_H
207 # include <netinet/in.h>
208 #endif
209 ])
210 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
211 [#if HAVE_STDINT_H
212 # include <stdint.h>
213 #endif
214 #if HAVE_SYS_TYPES_H
215 # include <sys/types.h>
216 #endif
217 #if HAVE_NETINET_IN_SYSTM_H
218 # include <netinet/in_systm.h>
219 #endif
220 #if HAVE_NETINET_IN_H
221 # include <netinet/in.h>
222 #endif
223 #if HAVE_NETINET_IP6_H
224 # include <netinet/ip6.h>
225 #endif
226 ])
227 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
228 [#if HAVE_STDINT_H
229 # include <stdint.h>
230 #endif
231 #if HAVE_SYS_TYPES_H
232 # include <sys/types.h>
233 #endif
234 #if HAVE_NETINET_IN_SYSTM_H
235 # include <netinet/in_systm.h>
236 #endif
237 #if HAVE_NETINET_IN_H
238 # include <netinet/in.h>
239 #endif
240 #if HAVE_NETINET_IP_H
241 # include <netinet/ip.h>
242 #endif
243 ])
244 AC_CHECK_HEADERS(netinet/udp.h, [], [],
245 [#if HAVE_STDINT_H
246 # include <stdint.h>
247 #endif
248 #if HAVE_SYS_TYPES_H
249 # include <sys/types.h>
250 #endif
251 #if HAVE_NETINET_IN_SYSTM_H
252 # include <netinet/in_systm.h>
253 #endif
254 #if HAVE_NETINET_IN_H
255 # include <netinet/in.h>
256 #endif
257 #if HAVE_NETINET_IP_H
258 # include <netinet/ip.h>
259 #endif
260 ])
262 # For cpu modules
263 AC_CHECK_HEADERS(sys/dkstat.h)
264 if test "x$ac_system" = "xDarwin"
265 then
266         AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
267         AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
268 fi
269 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
271 #if HAVE_SYS_TYPES_H
272 #  include <sys/types.h>
273 #endif
274 #if HAVE_SYS_PARAM_H
275 # include <sys/param.h>
276 #endif
277 ])
279 AC_MSG_CHECKING([for sysctl kern.cp_times])
280 if test -x /sbin/sysctl
281 then
282         /sbin/sysctl kern.cp_times 2>/dev/null
283         if test $? -eq 0
284         then
285                 AC_MSG_RESULT([yes])
286                 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
287                 [Define if sysctl supports kern.cp_times])
288         else
289                 AC_MSG_RESULT([no])
290         fi
291 else
292         AC_MSG_RESULT([no])
293 fi
295 # For hddtemp module
296 AC_CHECK_HEADERS(linux/major.h libgen.h)
298 # For the battery plugin
299 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
301 #if HAVE_IOKIT_IOKITLIB_H
302 #  include <IOKit/IOKitLib.h>
303 #endif
304 #if HAVE_IOKIT_IOTYPES_H
305 #  include <IOKit/IOTypes.h>
306 #endif
307 ])
309 # For the swap module
310 have_linux_wireless_h="no"
311 if test "x$ac_system" = "xLinux"
312 then
313   AC_CHECK_HEADERS(linux/wireless.h,
314                    [have_linux_wireless_h="yes"],
315                    [have_linux_wireless_h="no"],
317 #include <dirent.h>
318 #include <sys/ioctl.h>
319 #include <sys/socket.h>
320 ])
321 fi
323 # For the swap module
324 have_sys_swap_h="yes"
325 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
327 #undef _FILE_OFFSET_BITS
328 #undef _LARGEFILE64_SOURCE
329 #if HAVE_SYS_TYPES_H
330 #  include <sys/types.h>
331 #endif
332 #if HAVE_SYS_PARAM_H
333 # include <sys/param.h>
334 #endif
335 ])
337 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
338 then
339         hint_64=""
340         if test "x$GCC" = "xyes"
341         then
342                 hint_64="CFLAGS='-m64'"
343         else
344                 hint_64="CFLAGS='-xarch=v9'"
345         fi
346         AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
347 fi
349 # For load module
350 # For the processes plugin
351 # For users module
352 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
354 # For interface plugin
355 AC_CHECK_HEADERS(ifaddrs.h)
356 AC_CHECK_HEADERS(net/if.h, [], [],
358 #if HAVE_SYS_TYPES_H
359 #  include <sys/types.h>
360 #endif
361 #if HAVE_SYS_SOCKET_H
362 #  include <sys/socket.h>
363 #endif
364 ])
365 AC_CHECK_HEADERS(linux/if.h, [], [],
367 #if HAVE_SYS_TYPES_H
368 #  include <sys/types.h>
369 #endif
370 #if HAVE_SYS_SOCKET_H
371 #  include <sys/socket.h>
372 #endif
373 ])
374 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
376 #if HAVE_SYS_TYPES_H
377 #  include <sys/types.h>
378 #endif
379 #if HAVE_SYS_SOCKET_H
380 #  include <sys/socket.h>
381 #endif
382 #if HAVE_LINUX_IF_H
383 # include <linux/if.h>
384 #endif
385 ])
387 # For ipvs module
388 have_linux_ip_vs_h="no"
389 have_net_ip_vs_h="no"
390 have_ip_vs_h="no"
391 ip_vs_h_needs_kernel_cflags="no"
392 if test "x$ac_system" = "xLinux"
393 then
394         AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
395         AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
396         AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
398         if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
399         then
400                 SAVE_CFLAGS="$CFLAGS"
401                 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
403                 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
405                 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
406                 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
407                 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
409                 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
410                 then
411                         ip_vs_h_needs_kernel_cflags="yes"
412                 fi
414                 CFLAGS="$SAVE_CFLAGS"
415         fi
416 fi
417 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
419 # For quota module
420 AC_CHECK_HEADERS(sys/ucred.h, [], [],
422 #if HAVE_SYS_TYPES_H
423 #  include <sys/types.h>
424 #endif
425 #if HAVE_SYS_PARAM_H
426 # include <sys/param.h>
427 #endif
428 ])
430 # For mount interface
431 AC_CHECK_HEADERS(sys/mount.h, [], [],
433 #if HAVE_SYS_TYPES_H
434 #  include <sys/types.h>
435 #endif
436 #if HAVE_SYS_PARAM_H
437 # include <sys/param.h>
438 #endif
439 ])
441 # For the email plugin
442 AC_CHECK_HEADERS(linux/un.h, [], [],
444 #if HAVE_SYS_SOCKET_H
445 #       include <sys/socket.h>
446 #endif
447 ])
449 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h)
451 # For the dns plugin
452 AC_CHECK_HEADERS(arpa/nameser.h)
453 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
455 #if HAVE_ARPA_NAMESER_H
456 # include <arpa/nameser.h>
457 #endif
458 ])
460 AC_CHECK_HEADERS(net/if_arp.h, [], [],
461 [#if HAVE_SYS_SOCKET_H
462 # include <sys/socket.h>
463 #endif
464 ])
465 AC_CHECK_HEADERS(net/ppp_defs.h)
466 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
467 [#if HAVE_NET_PPP_DEFS_H
468 # include <net/ppp_defs.h>
469 #endif
470 ])
471 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
472 [#if HAVE_STDINT_H
473 # include <stdint.h>
474 #endif
475 #if HAVE_SYS_TYPES_H
476 # include <sys/types.h>
477 #endif
478 #if HAVE_SYS_SOCKET_H
479 # include <sys/socket.h>
480 #endif
481 #if HAVE_NET_IF_H
482 # include <net/if.h>
483 #endif
484 #if HAVE_NETINET_IN_H
485 # include <netinet/in.h>
486 #endif
487 ])
489 # For the multimeter plugin
490 have_termios_h="no"
491 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
494 # Checks for typedefs, structures, and compiler characteristics.
496 AC_C_CONST
497 AC_TYPE_PID_T
498 AC_TYPE_SIZE_T
499 AC_TYPE_UID_T
500 AC_HEADER_TIME
503 # Checks for library functions.
505 AC_PROG_GCC_TRADITIONAL
506 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
508 AC_FUNC_STRERROR_R
510 SAVE_CFLAGS="$CFLAGS"
511 # Emulate behavior of src/Makefile.am
512 if test "x$GCC" = "xyes"
513 then
514         CFLAGS="$CFLAGS -Wall -Werror"
515 fi
517 AC_CACHE_CHECK([for strtok_r],
518   [c_cv_have_strtok_r_default],
519   AC_LINK_IFELSE(
520     AC_LANG_PROGRAM(
521     [[[[
522 #include <stdlib.h>
523 #include <stdio.h>
524 #include <string.h>
525     ]]]],
526     [[[[
527       char buffer[] = "foo,bar,baz";
528       char *token;
529       char *dummy;
530       char *saveptr;
532       dummy = buffer;
533       saveptr = NULL;
534       while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
535       {
536         dummy = NULL;
537         printf ("token = %s;\n", token);
538       }
539     ]]]]),
540     [c_cv_have_strtok_r_default="yes"],
541     [c_cv_have_strtok_r_default="no"]
542   )
545 if test "x$c_cv_have_strtok_r_default" = "xno"
546 then
547   CFLAGS="$CFLAGS -D_REENTRANT=1"
549   AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
550     [c_cv_have_strtok_r_reentrant],
551     AC_LINK_IFELSE(
552       AC_LANG_PROGRAM(
553       [[[[
554 #include <stdlib.h>
555 #include <stdio.h>
556 #include <string.h>
557       ]]]],
558       [[[[
559         char buffer[] = "foo,bar,baz";
560         char *token;
561         char *dummy;
562         char *saveptr;
564         dummy = buffer;
565         saveptr = NULL;
566         while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
567         {
568           dummy = NULL;
569           printf ("token = %s;\n", token);
570         }
571       ]]]]),
572       [c_cv_have_strtok_r_reentrant="yes"],
573       [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
574     )
575   )
576 fi
578 CFLAGS="$SAVE_CFLAGS"
579 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
580 then
581         CFLAGS="$CFLAGS -D_REENTRANT=1"
582 fi
584 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
586 socket_needs_socket="no"
587 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
588 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
590 nanosleep_needs_rt="no"
591 nanosleep_needs_posix4="no"
592 AC_CHECK_FUNCS(nanosleep,
593     [],
594     AC_CHECK_LIB(rt, nanosleep,
595         [nanosleep_needs_rt="yes"],
596         AC_CHECK_LIB(posix4, nanosleep,
597             [nanosleep_needs_posix4="yes"],
598             AC_MSG_ERROR(cannot find nanosleep))))
599 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
600 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
602 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
603 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
604 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
605 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
606 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
607 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
608 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
609 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
610 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
611 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
612 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
613 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
615 # For load module
616 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
618 # Check for NAN
619 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
621  if test "x$withval" = "xno"; then
622          nan_type="none"
623  else if test "x$withval" = "xyes"; then
624          nan_type="zero"
625  else
626          nan_type="$withval"
627  fi; fi
628 ],
629 [nan_type="none"])
630 if test "x$nan_type" = "xnone"; then
631   AC_CACHE_CHECK([whether NAN is defined by default],
632     [c_cv_have_nan_default],
633     AC_COMPILE_IFELSE(
634       AC_LANG_PROGRAM(
635       [[
636 #include <stdlib.h>
637 #include <math.h>
638 static float foo = NAN;
639       ]],
640       [[
641        if (isnan (foo))
642         return 0;
643        else
644         return 1;
645       ]]),
646       [c_cv_have_nan_default="yes"],
647       [c_cv_have_nan_default="no"]
648     )
649   )
650   if test "x$c_cv_have_nan_default" = "xyes"
651   then
652     nan_type="default"
653   fi
654 fi
655 if test "x$nan_type" = "xnone"; then
656   AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
657     [c_cv_have_nan_isoc],
658     AC_COMPILE_IFELSE(
659       AC_LANG_PROGRAM(
660       [[
661 #include <stdlib.h>
662 #define __USE_ISOC99 1
663 #include <math.h>
664 static float foo = NAN;
665       ]],
666       [[
667        if (isnan (foo))
668         return 0;
669        else
670         return 1;
671       ]]),
672       [c_cv_have_nan_isoc="yes"],
673       [c_cv_have_nan_isoc="no"]
674     )
675   )
676   if test "x$c_cv_have_nan_isoc" = "xyes"
677   then
678     nan_type="isoc99"
679   fi
680 fi
681 if test "x$nan_type" = "xnone"; then
682   SAVE_LDFLAGS=$LDFLAGS
683   LDFLAGS="$LDFLAGS -lm"
684   AC_CACHE_CHECK([whether NAN can be defined by 0/0],
685     [c_cv_have_nan_zero],
686     AC_RUN_IFELSE(
687       AC_LANG_PROGRAM(
688       [[
689 #include <stdlib.h>
690 #include <math.h>
691 #ifdef NAN
692 # undef NAN
693 #endif
694 #define NAN (0.0 / 0.0)
695 #ifndef isnan
696 # define isnan(f) ((f) != (f))
697 #endif
698 static float foo = NAN;
699       ]],
700       [[
701        if (isnan (foo))
702         return 0;
703        else
704         return 1;
705       ]]),
706       [c_cv_have_nan_zero="yes"],
707       [c_cv_have_nan_zero="no"]
708     )
709   )
710   LDFLAGS=$SAVE_LDFLAGS
711   if test "x$c_cv_have_nan_zero" = "xyes"
712   then
713     nan_type="zero"
714   fi
715 fi
717 if test "x$nan_type" = "xdefault"; then
718   AC_DEFINE(NAN_STATIC_DEFAULT, 1,
719     [Define if NAN is defined by default and can initialize static variables.])
720 else if test "x$nan_type" = "xisoc99"; then
721   AC_DEFINE(NAN_STATIC_ISOC, 1,
722     [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
723 else if test "x$nan_type" = "xzero"; then
724   AC_DEFINE(NAN_ZERO_ZERO, 1,
725     [Define if NAN can be defined as (0.0 / 0.0)])
726 else
727   AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
728 fi; fi; fi
730 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
732  if test "x$withval" = "xnothing"; then
733         fp_layout_type="nothing"
734  else if test "x$withval" = "xendianflip"; then
735         fp_layout_type="endianflip"
736  else if test "x$withval" = "xintswap"; then
737         fp_layout_type="intswap"
738  else
739         AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
740 fi; fi; fi
741 ],
742 [fp_layout_type="unknown"])
744 if test "x$fp_layout_type" = "xunknown"; then
745   AC_CACHE_CHECK([if doubles are stored in x86 representation],
746     [c_cv_fp_layout_need_nothing],
747     AC_RUN_IFELSE(
748       AC_LANG_PROGRAM(
749       [[[[
750 #include <stdlib.h>
751 #include <stdio.h>
752 #include <string.h>
753 #if HAVE_STDINT_H
754 # include <stdint.h>
755 #endif
756 #if HAVE_INTTYPES_H
757 # include <inttypes.h>
758 #endif
759 #if HAVE_STDBOOL_H
760 # include <stdbool.h>
761 #endif
762       ]]]],
763       [[[[
764         uint64_t i0;
765         uint64_t i1;
766         uint8_t c[8];
767         double d;
769         d = 8.642135e130; 
770         memcpy ((void *) &i0, (void *) &d, 8);
772         i1 = i0;
773         memcpy ((void *) c, (void *) &i1, 8);
775         if ((c[0] == 0x2f) && (c[1] == 0x25)
776                         && (c[2] == 0xc0) && (c[3] == 0xc7)
777                         && (c[4] == 0x43) && (c[5] == 0x2b)
778                         && (c[6] == 0x1f) && (c[7] == 0x5b))
779                 return (0);
780         else
781                 return (1);
782       ]]]]),
783       [c_cv_fp_layout_need_nothing="yes"],
784       [c_cv_fp_layout_need_nothing="no"]
785     )
786   )
787   if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
788     fp_layout_type="nothing"
789   fi
790 fi
791 if test "x$fp_layout_type" = "xunknown"; then
792   AC_CACHE_CHECK([if endianflip converts to x86 representation],
793     [c_cv_fp_layout_need_endianflip],
794     AC_RUN_IFELSE(
795       AC_LANG_PROGRAM(
796       [[[[
797 #include <stdlib.h>
798 #include <stdio.h>
799 #include <string.h>
800 #if HAVE_STDINT_H
801 # include <stdint.h>
802 #endif
803 #if HAVE_INTTYPES_H
804 # include <inttypes.h>
805 #endif
806 #if HAVE_STDBOOL_H
807 # include <stdbool.h>
808 #endif
809 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
810                        (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
811                        (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
812                        (((uint64_t)(A) & 0x000000ff00000000LL) >> 8)  | \
813                        (((uint64_t)(A) & 0x00000000ff000000LL) << 8)  | \
814                        (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
815                        (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
816                        (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
817       ]]]],
818       [[[[
819         uint64_t i0;
820         uint64_t i1;
821         uint8_t c[8];
822         double d;
824         d = 8.642135e130; 
825         memcpy ((void *) &i0, (void *) &d, 8);
827         i1 = endianflip (i0);
828         memcpy ((void *) c, (void *) &i1, 8);
830         if ((c[0] == 0x2f) && (c[1] == 0x25)
831                         && (c[2] == 0xc0) && (c[3] == 0xc7)
832                         && (c[4] == 0x43) && (c[5] == 0x2b)
833                         && (c[6] == 0x1f) && (c[7] == 0x5b))
834                 return (0);
835         else
836                 return (1);
837       ]]]]),
838       [c_cv_fp_layout_need_endianflip="yes"],
839       [c_cv_fp_layout_need_endianflip="no"]
840     )
841   )
842   if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
843     fp_layout_type="endianflip"
844   fi
845 fi
846 if test "x$fp_layout_type" = "xunknown"; then
847   AC_CACHE_CHECK([if intswap converts to x86 representation],
848     [c_cv_fp_layout_need_intswap],
849     AC_RUN_IFELSE(
850       AC_LANG_PROGRAM(
851       [[[[
852 #include <stdlib.h>
853 #include <stdio.h>
854 #include <string.h>
855 #if HAVE_STDINT_H
856 # include <stdint.h>
857 #endif
858 #if HAVE_INTTYPES_H
859 # include <inttypes.h>
860 #endif
861 #if HAVE_STDBOOL_H
862 # include <stdbool.h>
863 #endif
864 #define intswap(A)    ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
865                        (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
866       ]]]],
867       [[[[
868         uint64_t i0;
869         uint64_t i1;
870         uint8_t c[8];
871         double d;
873         d = 8.642135e130; 
874         memcpy ((void *) &i0, (void *) &d, 8);
876         i1 = intswap (i0);
877         memcpy ((void *) c, (void *) &i1, 8);
879         if ((c[0] == 0x2f) && (c[1] == 0x25)
880                         && (c[2] == 0xc0) && (c[3] == 0xc7)
881                         && (c[4] == 0x43) && (c[5] == 0x2b)
882                         && (c[6] == 0x1f) && (c[7] == 0x5b))
883                 return (0);
884         else
885                 return (1);
886       ]]]]),
887       [c_cv_fp_layout_need_intswap="yes"],
888       [c_cv_fp_layout_need_intswap="no"]
889     )
890   )
891   if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
892     fp_layout_type="intswap"
893   fi
894 fi
896 if test "x$fp_layout_type" = "xnothing"; then
897   AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
898   [Define if doubles are stored in x86 representation.])
899 else if test "x$fp_layout_type" = "xendianflip"; then
900   AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
901   [Define if endianflip is needed to convert to x86 representation.])
902 else if test "x$fp_layout_type" = "xintswap"; then
903   AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
904   [Define if intswap is needed to convert to x86 representation.])
905 else
906   AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
907 fi; fi; fi
909 have_getfsstat="no"
910 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
911 have_getvfsstat="no"
912 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
913 have_listmntent="no"
914 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
916 have_getmntent="no"
917 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
918 if test "x$have_getmntent" = "xno"; then
919         AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
920 fi
921 if test "x$have_getmntent" = "xno"; then
922         AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
923 fi
924 if test "x$have_getmntent" = "xno"; then
925         AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
926 fi
928 if test "x$have_getmntent" = "xc"; then
929         AC_CACHE_CHECK([whether getmntent takes one argument],
930                 [c_cv_have_one_getmntent],
931                 AC_COMPILE_IFELSE(
932                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
933 #include "$srcdir/src/utils_mount.h"]],
934                                 [[
935                                  FILE *fh;
936                                  struct mntent *me;
937                                  fh = setmntent ("/etc/mtab", "r");
938                                  me = getmntent (fh);
939                                 ]]
940                         ),
941                         [c_cv_have_one_getmntent="yes"],
942                         [c_cv_have_one_getmntent="no"]
943                 )
944         )
945         AC_CACHE_CHECK([whether getmntent takes two arguments],
946                 [c_cv_have_two_getmntent],
947                 AC_COMPILE_IFELSE(
948                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
949 #include "$srcdir/src/utils_mount.h"]],
950                                 [[
951                                  FILE *fh;
952                                  struct mnttab mt;
953                                  int status;
954                                  fh = fopen ("/etc/mnttab", "r");
955                                  status = getmntent (fh, &mt);
956                                 ]]
957                         ),
958                         [c_cv_have_two_getmntent="yes"],
959                         [c_cv_have_two_getmntent="no"]
960                 )
961         )
962 fi
964 # Check for different versions of `getmntent' here..
966 if test "x$have_getmntent" = "xc"; then
967         if test "x$c_cv_have_one_getmntent" = "xyes"; then
968                 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
969                           [Define if the function getmntent exists and takes one argument.])
970         fi
971         if test "x$c_cv_have_two_getmntent" = "xyes"; then
972                 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
973                           [Define if the function getmntent exists and takes two arguments.])
974         fi
975 fi
976 if test "x$have_getmntent" = "xsun"; then
977         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
978                   [Define if the function getmntent exists. It's the version from libsun.])
979 fi
980 if test "x$have_getmntent" = "xseq"; then
981         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
982                   [Define if the function getmntent exists. It's the version from libseq.])
983 fi
984 if test "x$have_getmntent" = "xgen"; then
985         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
986                   [Define if the function getmntent exists. It's the version from libgen.])
987 fi
989 # Check for htonll
990 AC_MSG_CHECKING([if have htonll defined])
992     have_htonll="no"
993     AC_LINK_IFELSE([
994        AC_LANG_PROGRAM([
995 #include <sys/types.h>
996 #include <netinet/in.h>
997 #if HAVE_INTTYPES_H
998 # include <inttypes.h>
999 #endif
1000        ], [
1001           return htonll(0);
1002        ])
1003     ], [
1004       have_htonll="yes"
1005       AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1006     ])
1007  
1008 AC_MSG_RESULT([$have_htonll])
1010 # Check for structures
1011 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1012         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1013         [],
1014         [
1015         #include <sys/types.h>
1016         #include <sys/socket.h>
1017         #include <net/if.h>
1018         ])
1019 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1020         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1021         [],
1022         [
1023         #include <sys/types.h>
1024         #include <sys/socket.h>
1025         #include <linux/if.h>
1026         #include <linux/netdevice.h>
1027         ])
1029 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1030         [],
1031         [
1032         #include <netinet/in.h>
1033         #include <net/if.h>
1034         ])
1036 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1037         [
1038                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1039                         [Define if struct kinfo_proc exists in the FreeBSD variant.])
1040                 have_struct_kinfo_proc_freebsd="yes"
1041         ],
1042         [
1043                 have_struct_kinfo_proc_freebsd="no"
1044         ],
1045         [
1046 #include <kvm.h>
1047 #include <sys/param.h>
1048 #include <sys/sysctl.h>
1049 #include <sys/user.h>
1050         ])
1052 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1053         [
1054                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1055                         [Define if struct kinfo_proc exists in the OpenBSD variant.])
1056                 have_struct_kinfo_proc_openbsd="yes"
1057         ],
1058         [
1059                 have_struct_kinfo_proc_openbsd="no"
1060         ],
1061         [
1062 #include <sys/param.h>
1063 #include <sys/sysctl.h>
1064 #include <kvm.h>
1065         ])
1067 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1068 [#define _BSD_SOURCE
1069 #if HAVE_STDINT_H
1070 # include <stdint.h>
1071 #endif
1072 #if HAVE_SYS_TYPES_H
1073 # include <sys/types.h>
1074 #endif
1075 #if HAVE_NETINET_IN_SYSTM_H
1076 # include <netinet/in_systm.h>
1077 #endif
1078 #if HAVE_NETINET_IN_H
1079 # include <netinet/in.h>
1080 #endif
1081 #if HAVE_NETINET_IP_H
1082 # include <netinet/ip.h>
1083 #endif
1084 #if HAVE_NETINET_UDP_H
1085 # include <netinet/udp.h>
1086 #endif
1087 ])
1088 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1089 [#define _BSD_SOURCE
1090 #if HAVE_STDINT_H
1091 # include <stdint.h>
1092 #endif
1093 #if HAVE_SYS_TYPES_H
1094 # include <sys/types.h>
1095 #endif
1096 #if HAVE_NETINET_IN_SYSTM_H
1097 # include <netinet/in_systm.h>
1098 #endif
1099 #if HAVE_NETINET_IN_H
1100 # include <netinet/in.h>
1101 #endif
1102 #if HAVE_NETINET_IP_H
1103 # include <netinet/ip.h>
1104 #endif
1105 #if HAVE_NETINET_UDP_H
1106 # include <netinet/udp.h>
1107 #endif
1108 ])
1110 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1111         [],
1112         [],
1113         [
1114 #if HAVE_KSTAT_H
1115 # include <kstat.h>
1116 #endif
1117         ])
1120 # Checks for libraries begin here
1122 with_libresolv="yes"
1123 AC_CHECK_LIB(resolv, res_search,
1125         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1126 ],
1127 [with_libresolv="no"])
1128 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1130 dnl Check for HAL (hardware abstraction library)
1131 with_libhal="yes"
1132 AC_CHECK_LIB(hal,libhal_device_property_exists,
1133              [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1134              [with_libhal="no"])
1135 if test "x$with_libhal" = "xyes"; then
1136         if test "x$PKG_CONFIG" != "x"; then
1137                 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1138                 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1139                 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1140                 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1141         fi
1142 fi
1144 m4_divert_once([HELP_WITH], [
1145 collectd additional packages:])
1147 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"]) 
1149 if test "x$ac_system" = "xAIX"
1150 then
1151         with_perfstat="yes"
1152         with_procinfo="yes"
1153 else
1154         with_perfstat="no (AIX only)"
1155         with_procinfo="no (AIX only)"
1156 fi
1158 if test "x$with_perfstat" = "xyes"
1159 then
1160         AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1161 #       AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1162 fi
1163 if test "x$with_perfstat" = "xyes"
1164 then
1165          AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1166 fi
1167 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1169 # Processes plugin under AIX.
1170 if test "x$with_procinfo" = "xyes"
1171 then
1172         AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1173 fi
1174 if test "x$with_procinfo" = "xyes"
1175 then
1176          AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1177 fi
1179 if test "x$ac_system" = "xSolaris"
1180 then
1181         with_kstat="yes"
1182         with_devinfo="yes"
1183 else
1184         with_kstat="no (Solaris only)"
1185         with_devinfo="no (Solaris only)"
1186 fi
1188 if test "x$with_kstat" = "xyes"
1189 then
1190         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1191 fi
1192 if test "x$with_kstat" = "xyes"
1193 then
1194         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1195         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1196 fi
1197 if test "x$with_kstat" = "xyes"
1198 then
1199         AC_DEFINE(HAVE_LIBKSTAT, 1,
1200                   [Define to 1 if you have the 'kstat' library (-lkstat)])
1201 fi
1202 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1203 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1205 with_libiokit="no"
1206 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1208         with_libiokit="yes"
1209 ], 
1211         with_libiokit="no"
1212 ])
1213 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1215 with_libkvm="no"
1216 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1217 if test "x$with_kvm_getprocs" = "xyes"
1218 then
1219         AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1220                   [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1221         with_libkvm="yes"
1222 fi
1223 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1225 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1226 if test "x$with_kvm_getswapinfo" = "xyes"
1227 then
1228         AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1229                   [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1230         with_libkvm="yes"
1231 fi
1232 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1234 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1235 if test "x$with_kvm_nlist" = "xyes"
1236 then
1237         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1238                   [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1239         with_libkvm="yes"
1240 fi
1241 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1243 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1244 if test "x$with_kvm_openfiles" = "xyes"
1245 then
1246         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1247                   [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1248         with_libkvm="yes"
1249 fi
1250 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1252 # --with-libcurl {{{
1253 with_curl_config="curl-config"
1254 with_curl_cflags=""
1255 with_curl_libs=""
1256 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1258         if test "x$withval" = "xno"
1259         then
1260                 with_libcurl="no"
1261         else if test "x$withval" = "xyes"
1262         then
1263                 with_libcurl="yes"
1264         else
1265                 if test -f "$withval" && test -x "$withval"
1266                 then
1267                         with_curl_config="$withval"
1268                         with_libcurl="yes"
1269                 else if test -x "$withval/bin/curl-config"
1270                 then
1271                         with_curl_config="$withval/bin/curl-config"
1272                         with_libcurl="yes"
1273                 fi; fi
1274                 with_libcurl="yes"
1275         fi; fi
1276 ],
1278         with_libcurl="yes"
1279 ])
1280 if test "x$with_libcurl" = "xyes"
1281 then
1282         with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1283         curl_config_status=$?
1285         if test $curl_config_status -ne 0
1286         then
1287                 with_libcurl="no ($with_curl_config failed)"
1288         else
1289                 SAVE_CPPFLAGS="$CPPFLAGS"
1290                 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1292                 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1294                 CPPFLAGS="$SAVE_CPPFLAGS"
1295         fi
1296 fi
1297 if test "x$with_libcurl" = "xyes"
1298 then
1299         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1300         curl_config_status=$?
1302         if test $curl_config_status -ne 0
1303         then
1304                 with_libcurl="no ($with_curl_config failed)"
1305         else
1306                 AC_CHECK_LIB(curl, curl_easy_init,
1307                  [with_libcurl="yes"],
1308                  [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1309                  [$with_curl_libs])
1310         fi
1311 fi
1312 if test "x$with_libcurl" = "xyes"
1313 then
1314         BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1315         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1316         AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1317         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1318 fi
1319 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1320 # }}}
1322 # --with-libdbi {{{
1323 with_libdbi_cppflags=""
1324 with_libdbi_ldflags=""
1325 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1327         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1328         then
1329                 with_libdbi_cppflags="-I$withval/include"
1330                 with_libdbi_ldflags="-L$withval/lib"
1331                 with_libdbi="yes"
1332         else
1333                 with_libdbi="$withval"
1334         fi
1335 ],
1337         with_libdbi="yes"
1338 ])
1339 if test "x$with_libdbi" = "xyes"
1340 then
1341         SAVE_CPPFLAGS="$CPPFLAGS"
1342         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1344         AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1346         CPPFLAGS="$SAVE_CPPFLAGS"
1347 fi
1348 if test "x$with_libdbi" = "xyes"
1349 then
1350         SAVE_CPPFLAGS="$CPPFLAGS"
1351         SAVE_LDFLAGS="$LDFLAGS"
1352         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1353         LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1355         AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1357         CPPFLAGS="$SAVE_CPPFLAGS"
1358         LDFLAGS="$SAVE_LDFLAGS"
1359 fi
1360 if test "x$with_libdbi" = "xyes"
1361 then
1362         BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1363         BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1364         BUILD_WITH_LIBDBI_LIBS="-ldbi"
1365         AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1366         AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1367         AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1368 fi
1369 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1370 # }}}
1372 # --with-libesmtp {{{
1373 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1375         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1376         then
1377                 LDFLAGS="$LDFLAGS -L$withval/lib"
1378                 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1379                 with_libesmtp="yes"
1380         else
1381                 with_libesmtp="$withval"
1382         fi
1383 ],
1385         with_libesmtp="yes"
1386 ])
1387 if test "x$with_libesmtp" = "xyes"
1388 then
1389         AC_CHECK_LIB(esmtp, smtp_create_session,
1390         [
1391                 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1392         ], [with_libesmtp="no (libesmtp not found)"])
1393 fi
1394 if test "x$with_libesmtp" = "xyes"
1395 then
1396         AC_CHECK_HEADERS(libesmtp.h,
1397         [
1398                 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1399         ], [with_libesmtp="no (libesmtp.h not found)"])
1400 fi
1401 if test "x$with_libesmtp" = "xyes"
1402 then
1403         collect_libesmtp=1
1404 else
1405         collect_libesmtp=0
1406 fi
1407 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1408         [Wether or not to use the esmtp library])
1409 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1410 # }}}
1412 # --with-libganglia {{{
1413 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1415  if test -f "$withval" && test -x "$withval"
1416  then
1417          with_libganglia_config="$withval"
1418          with_libganglia="yes"
1419  else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1420  then
1421          with_libganglia_config="$withval/bin/ganglia-config"
1422          with_libganglia="yes"
1423  else if test -d "$withval"
1424  then
1425          GANGLIA_CPPFLAGS="-I$withval/include"
1426          GANGLIA_LDFLAGS="-L$withval/lib"
1427          with_libganglia="yes"
1428  else
1429          with_libganglia_config="ganglia-config"
1430          with_libganglia="$withval"
1431  fi; fi; fi
1432 ],
1434  with_libganglia_config="ganglia-config"
1435  with_libganglia="yes"
1436 ])
1438 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1439 then
1440         if test "x$GANGLIA_CPPFLAGS" = "x"
1441         then
1442                 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1443         fi
1445         if test "x$GANGLIA_LDFLAGS" = "x"
1446         then
1447                 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1448         fi
1450         if test "x$GANGLIA_LIBS" = "x"
1451         then
1452                 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1453         fi
1454 fi
1456 SAVE_CPPFLAGS="$CPPFLAGS"
1457 SAVE_LDFLAGS="$LDFLAGS"
1458 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1459 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1461 if test "x$with_libganglia" = "xyes"
1462 then
1463         AC_CHECK_HEADERS(gm_protocol.h,
1464         [
1465                 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1466                           [Define to 1 if you have the <gm_protocol.h> header file.])
1467         ], [with_libganglia="no (gm_protocol.h not found)"])
1468 fi
1470 if test "x$with_libganglia" = "xyes"
1471 then
1472         AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1473         [
1474                 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1475                           [Define to 1 if you have the ganglia library (-lganglia).])
1476         ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1477 fi
1479 CPPFLAGS="$SAVE_CPPFLAGS"
1480 LDFLAGS="$SAVE_LDFLAGS"
1482 AC_SUBST(GANGLIA_CPPFLAGS)
1483 AC_SUBST(GANGLIA_LDFLAGS)
1484 AC_SUBST(GANGLIA_LIBS)
1485 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1486 # }}}
1488 # --with-libgcrypt {{{
1489 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1490 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1491 GCRYPT_LIBS="$GCRYPT_LIBS"
1492 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1494  if test -f "$withval" && test -x "$withval"
1495  then
1496          with_libgcrypt_config="$withval"
1497          with_libgcrypt="yes"
1498  else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1499  then
1500          with_libgcrypt_config="$withval/bin/gcrypt-config"
1501          with_libgcrypt="yes"
1502  else if test -d "$withval"
1503  then
1504          GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1505          GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1506          with_libgcrypt="yes"
1507  else
1508          with_libgcrypt_config="gcrypt-config"
1509          with_libgcrypt="$withval"
1510  fi; fi; fi
1511 ],
1513  with_libgcrypt_config="libgcrypt-config"
1514  with_libgcrypt="yes"
1515 ])
1517 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1518 then
1519         if test "x$GCRYPT_CPPFLAGS" = "x"
1520         then
1521                 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1522         fi
1524         if test "x$GCRYPT_LDFLAGS" = "x"
1525         then
1526                 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1527                 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1528         fi
1530         if test "x$GCRYPT_LIBS" = "x"
1531         then
1532                 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1533         fi
1534 fi
1536 SAVE_CPPFLAGS="$CPPFLAGS"
1537 SAVE_LDFLAGS="$LDFLAGS"
1538 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1539 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1541 if test "x$with_libgcrypt" = "xyes"
1542 then
1543         if test "x$GCRYPT_CPPFLAGS" != "x"
1544         then
1545                 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1546         fi
1547         AC_CHECK_HEADERS(gcrypt.h,
1548                 [with_libgcrypt="yes"],
1549                 [with_libgcrypt="no (gcrypt.h not found)"])
1550 fi
1552 if test "x$with_libgcrypt" = "xyes"
1553 then
1554         if test "x$GCRYPT_LDFLAGS" != "x"
1555         then
1556                 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1557         fi
1558         AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1559                 [with_libgcrypt="yes"],
1560                 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1562         if test "$with_libgcrypt" != "no"; then
1563                 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1564         fi
1565 fi
1567 CPPFLAGS="$SAVE_CPPFLAGS"
1568 LDFLAGS="$SAVE_LDFLAGS"
1570 if test "x$with_libgcrypt" = "xyes"
1571 then
1572         AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1573 fi
1575 AC_SUBST(GCRYPT_CPPFLAGS)
1576 AC_SUBST(GCRYPT_LDFLAGS)
1577 AC_SUBST(GCRYPT_LIBS)
1578 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1579 # }}}
1581 # --with-libiptc {{{
1582 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1584         if test "x$withval" = "xshipped"
1585         then
1586                 with_libiptc="own"
1587         else if test "x$withval" = "xyes"
1588         then
1589                 with_libiptc="pkgconfig"
1590         else if test "x$withval" = "xno"
1591         then
1592                 with_libiptc="no"
1593         else
1594                 with_libiptc="yes"
1595                 with_libiptc_cflags="-I$withval/include"
1596                 with_libiptc_libs="-L$withval/lib"
1597         fi; fi; fi
1598 ],
1600         if test "x$ac_system" = "xLinux"
1601         then
1602                 with_libiptc="pkgconfig"
1603         else
1604                 with_libiptc="no (Linux only)"
1605         fi
1606 ])
1608 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1609 then
1610         with_libiptc="no (Don't have pkg-config)"
1611 fi
1613 if test "x$with_libiptc" = "xpkgconfig"
1614 then
1615         $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1616         if test $? -ne 0
1617         then
1618                 with_libiptc="no (pkg-config doesn't know libiptc)"
1619         fi
1620 fi
1621 if test "x$with_libiptc" = "xpkgconfig"
1622 then
1623         with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1624         if test $? -ne 0
1625         then
1626                 with_libiptc="no ($PKG_CONFIG failed)"
1627         fi
1628         with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1629         if test $? -ne 0
1630         then
1631                 with_libiptc="no ($PKG_CONFIG failed)"
1632         fi
1633 fi
1635 SAVE_CPPFLAGS="$CPPFLAGS"
1636 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1638 # check whether the header file for libiptc is available.
1639 if test "x$with_libiptc" = "xpkgconfig"
1640 then
1641         AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1642                         [with_libiptc="no (header file missing)"])
1643 fi
1644 # If the header file is available, check for the required type declaractions.
1645 # They may be missing in old versions of libiptc. In that case, they will be
1646 # declared in the iptables plugin.
1647 if test "x$with_libiptc" = "xpkgconfig"
1648 then
1649         AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1650 fi
1651 # Check for the iptc_init symbol in the library.
1652 # This could be in iptc or ip4tc
1653 if test "x$with_libiptc" = "xpkgconfig"
1654 then
1655         AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1656                         [with_libiptc="pkgconfig"],
1657                         [with_libiptc="no"],
1658                         [$with_libiptc_libs])
1659 fi
1660 if test "x$with_libiptc" = "xpkgconfig"
1661 then
1662         with_libiptc="yes"
1663 fi
1665 CPPFLAGS="$SAVE_CPPFLAGS"
1667 if test "x$with_libiptc" = "xown"
1668 then
1669         with_libiptc_cflags=""
1670         with_libiptc_libs=""
1671 fi
1672 if test "x$with_libiptc" = "xown"
1673 then
1674         AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1675         [
1676                 with_libiptc="no (Linux iptables headers not found)"
1677         ],
1678         [
1679 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1680         ])
1681 fi
1682 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1683 if test "x$with_libiptc" = "xown"
1684 then
1685         AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1686         with_libiptc="yes"
1687 fi
1689 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1690 if test "x$with_libiptc" = "xyes"
1691 then
1692         BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1693         BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1694         AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1695         AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1696 fi
1697 # }}}
1699 # --with-java {{{
1700 with_java_home="$JAVA_HOME"
1701 with_java_vmtype="client"
1702 with_java_cflags=""
1703 with_java_libs=""
1704 JAVAC="$JAVAC"
1705 JAR="$JAR"
1706 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1708         if test "x$withval" = "xno"
1709         then
1710                 with_java="no"
1711         else if test "x$withval" = "xyes"
1712         then
1713                 with_java="yes"
1714         else
1715                 with_java_home="$withval"
1716                 with_java="yes"
1717         fi; fi
1718 ],
1719 [with_java="yes"])
1720 if test "x$with_java" = "xyes"
1721 then
1722         if test -d "$with_java_home"
1723         then
1724                 AC_MSG_CHECKING([for jni.h])
1725                 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1726                 if test "x$TMPDIR" != "x"
1727                 then
1728                         AC_MSG_RESULT([found in $TMPDIR])
1729                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1730                 else
1731                         AC_MSG_RESULT([not found])
1732                 fi
1734                 AC_MSG_CHECKING([for jni_md.h])
1735                 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1736                 if test "x$TMPDIR" != "x"
1737                 then
1738                         AC_MSG_RESULT([found in $TMPDIR])
1739                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1740                 else
1741                         AC_MSG_RESULT([not found])
1742                 fi
1744                 AC_MSG_CHECKING([for libjvm.so])
1745                 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1746                 if test "x$TMPDIR" != "x"
1747                 then
1748                         AC_MSG_RESULT([found in $TMPDIR])
1749                         JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1750                 else
1751                         AC_MSG_RESULT([not found])
1752                 fi
1754                 if test "x$JAVAC" = "x"
1755                 then
1756                         AC_MSG_CHECKING([for javac])
1757                         TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1758                         if test "x$TMPDIR" != "x"
1759                         then
1760                                 JAVAC="$TMPDIR"
1761                                 AC_MSG_RESULT([$JAVAC])
1762                         else
1763                                 AC_MSG_RESULT([not found])
1764                         fi
1765                 fi
1766                 if test "x$JAR" = "x"
1767                 then
1768                         AC_MSG_CHECKING([for jar])
1769                         TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1770                         if test "x$TMPDIR" != "x"
1771                         then
1772                                 JAR="$TMPDIR"
1773                                 AC_MSG_RESULT([$JAR])
1774                         else
1775                                 AC_MSG_RESULT([not found])
1776                         fi
1777                 fi
1778         else if test "x$with_java_home" != "x"
1779         then
1780                 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1781         fi; fi
1782 fi
1784 if test "x$JAVA_CPPFLAGS" != "x"
1785 then
1786         AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1787 fi
1788 if test "x$JAVA_CFLAGS" != "x"
1789 then
1790         AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1791 fi
1792 if test "x$JAVA_LDFLAGS" != "x"
1793 then
1794         AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1795 fi
1796 if test "x$JAVAC" = "x"
1797 then
1798         with_javac_path="$PATH"
1799         if test "x$with_java_home" != "x"
1800         then
1801                 with_javac_path="$with_java_home:with_javac_path"
1802                 if test -d "$with_java_home/bin"
1803                 then
1804                         with_javac_path="$with_java_home/bin:with_javac_path"
1805                 fi
1806         fi
1808         AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1809 fi
1810 if test "x$JAVAC" = "x"
1811 then
1812         with_java="no (javac not found)"
1813 fi
1814 if test "x$JAR" = "x"
1815 then
1816         with_jar_path="$PATH"
1817         if test "x$with_java_home" != "x"
1818         then
1819                 with_jar_path="$with_java_home:$with_jar_path"
1820                 if test -d "$with_java_home/bin"
1821                 then
1822                         with_jar_path="$with_java_home/bin:$with_jar_path"
1823                 fi
1824         fi
1826         AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1827 fi
1828 if test "x$JAR" = "x"
1829 then
1830         with_java="no (jar not found)"
1831 fi
1833 SAVE_CPPFLAGS="$CPPFLAGS"
1834 SAVE_CFLAGS="$CFLAGS"
1835 SAVE_LDFLAGS="$LDFLAGS"
1836 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1837 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1838 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1840 if test "x$with_java" = "xyes"
1841 then
1842         AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1843 fi
1844 if test "x$with_java" = "xyes"
1845 then
1846         AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1847         [with_java="yes"],
1848         [with_java="no (libjvm not found)"],
1849         [$JAVA_LIBS])
1850 fi
1851 if test "x$with_java" = "xyes"
1852 then
1853         JAVA_LIBS="$JAVA_LIBS -ljvm"
1854         AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1855 fi
1857 CPPFLAGS="$SAVE_CPPFLAGS"
1858 CFLAGS="$SAVE_CFLAGS"
1859 LDFLAGS="$SAVE_LDFLAGS"
1861 AC_SUBST(JAVA_CPPFLAGS)
1862 AC_SUBST(JAVA_CFLAGS)
1863 AC_SUBST(JAVA_LDFLAGS)
1864 AC_SUBST(JAVA_LIBS)
1865 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1866 # }}}
1868 # --with-libmemcached {{{
1869 with_libmemcached_cppflags=""
1870 with_libmemcached_ldflags=""
1871 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1873         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1874         then
1875                 with_libmemcached_cppflags="-I$withval/include"
1876                 with_libmemcached_ldflags="-L$withval/lib"
1877                 with_libmemcached="yes"
1878         else
1879                 with_libmemcached="$withval"
1880         fi
1881 ],
1883         with_libmemcached="yes"
1884 ])
1885 if test "x$with_libmemcached" = "xyes"
1886 then
1887         SAVE_CPPFLAGS="$CPPFLAGS"
1888         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1890         AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1892         CPPFLAGS="$SAVE_CPPFLAGS"
1893 fi
1894 if test "x$with_libmemcached" = "xyes"
1895 then
1896         SAVE_CPPFLAGS="$CPPFLAGS"
1897         SAVE_LDFLAGS="$LDFLAGS"
1898         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1899         LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1901         AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1903         CPPFLAGS="$SAVE_CPPFLAGS"
1904         LDFLAGS="$SAVE_LDFLAGS"
1905 fi
1906 if test "x$with_libmemcached" = "xyes"
1907 then
1908         BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1909         BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1910         BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1911         AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1912         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1913         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1914         AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1915 fi
1916 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1917 # }}}
1919 # --with-libmodbus {{{
1920 with_libmodbus_config=""
1921 with_libmodbus_cflags=""
1922 with_libmodbus_libs=""
1923 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
1925         if test "x$withval" = "xno"
1926         then
1927                 with_libmodbus="no"
1928         else if test "x$withval" = "xyes"
1929         then
1930                 with_libmodbus="use_pkgconfig"
1931         else if test -d "$with_libmodbus/lib"
1932         then
1933                 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
1934                 with_libmodbus_cflags="-I$withval/include"
1935                 with_libmodbus_libs="-L$withval/lib -lmodbus"
1936                 with_libmodbus="yes"
1937         fi; fi; fi
1938 ],
1939 [with_libmodbus="use_pkgconfig"])
1941 # configure using pkg-config
1942 if test "x$with_libmodbus" = "xuse_pkgconfig"
1943 then
1944         if test "x$PKG_CONFIG" = "x"
1945         then
1946                 with_libmodbus="no (Don't have pkg-config)"
1947         fi
1948 fi
1949 if test "x$with_libmodbus" = "xuse_pkgconfig"
1950 then
1951         AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
1952         $PKG_CONFIG --exists 'modbus' 2>/dev/null
1953         if test $? -ne 0
1954         then
1955                 with_libmodbus="no (pkg-config doesn't know library)"
1956         fi
1957 fi
1958 if test "x$with_libmodbus" = "xuse_pkgconfig"
1959 then
1960         with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
1961         if test $? -ne 0
1962         then
1963                 with_libmodbus="no ($PKG_CONFIG failed)"
1964         fi
1965         with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
1966         if test $? -ne 0
1967         then
1968                 with_libmodbus="no ($PKG_CONFIG failed)"
1969         fi
1970 fi
1971 if test "x$with_libmodbus" = "xuse_pkgconfig"
1972 then
1973         with_libmodbus="yes"
1974 fi
1976 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
1977 # the actual checks.
1978 if test "x$with_libmodbus" = "xyes"
1979 then
1980         SAVE_CPPFLAGS="$CPPFLAGS"
1981         CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1983         AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
1985         CPPFLAGS="$SAVE_CPPFLAGS"
1986 fi
1987 if test "x$with_libmodbus" = "xyes"
1988 then
1989         SAVE_CPPFLAGS="$CPPFLAGS"
1990         SAVE_LDFLAGS="$LDFLAGS"
1992         CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1993         LDFLAGS="$LDFLAGS $with_libmodbus_libs"
1995         AC_CHECK_LIB(modbus, modbus_init_tcp,
1996                      [with_libmodbus="yes"],
1997                      [with_libmodbus="no (symbol modbus_init_tcp not found)"])
1999         CPPFLAGS="$SAVE_CPPFLAGS"
2000         LDFLAGS="$SAVE_LDFLAGS"
2001 fi
2002 if test "x$with_libmodbus" = "xyes"
2003 then
2004         BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2005         BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2006         AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2007         AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2008 fi
2009 # }}}
2011 # --with-libmysql {{{
2012 with_mysql_config="mysql_config"
2013 with_mysql_cflags=""
2014 with_mysql_libs=""
2015 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2017         if test "x$withval" = "xno"
2018         then
2019                 with_libmysql="no"
2020         else if test "x$withval" = "xyes"
2021         then
2022                 with_libmysql="yes"
2023         else
2024                 if test -f "$withval" && test -x "$withval";
2025                 then
2026                         with_mysql_config="$withval"
2027                 else if test -x "$withval/bin/mysql_config"
2028                 then
2029                         with_mysql_config="$withval/bin/mysql_config"
2030                 fi; fi
2031                 with_libmysql="yes"
2032         fi; fi
2033 ],
2035         with_libmysql="yes"
2036 ])
2037 if test "x$with_libmysql" = "xyes"
2038 then
2039         with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2040         mysql_config_status=$?
2042         if test $mysql_config_status -ne 0
2043         then
2044                 with_libmysql="no ($with_mysql_config failed)"
2045         else
2046                 SAVE_CPPFLAGS="$CPPFLAGS"
2047                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2049                 have_mysql_h="no"
2050                 have_mysql_mysql_h="no"
2051                 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2053                 if test "x$have_mysql_h" = "xno"
2054                 then
2055                         AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2056                 fi
2058                 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2059                 then
2060                         with_libmysql="no (mysql.h not found)"
2061                 fi
2063                 CPPFLAGS="$SAVE_CPPFLAGS"
2064         fi
2065 fi
2066 if test "x$with_libmysql" = "xyes"
2067 then
2068         with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2069         mysql_config_status=$?
2071         if test $mysql_config_status -ne 0
2072         then
2073                 with_libmysql="no ($with_mysql_config failed)"
2074         else
2075                 AC_CHECK_LIB(mysqlclient, mysql_init,
2076                  [with_libmysql="yes"],
2077                  [with_libmysql="no (symbol 'mysql_init' not found)"],
2078                  [$with_mysql_libs])
2080                 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2081                  [with_libmysql="yes"],
2082                  [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2083                  [$with_mysql_libs])
2084         fi
2085 fi
2086 if test "x$with_libmysql" = "xyes"
2087 then
2088         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2089         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2090         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2091         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2092 fi
2093 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2094 # }}}
2096 # --with-libnetlink {{{
2097 with_libnetlink_cflags=""
2098 with_libnetlink_libs="-lnetlink"
2099 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2101  echo "libnetlink: withval = $withval"
2102  if test "x$withval" = "xyes"
2103  then
2104          with_libnetlink="yes"
2105  else if test "x$withval" = "xno"
2106  then
2107          with_libnetlink="no"
2108  else
2109          if test -d "$withval/include"
2110          then
2111                  with_libnetlink_cflags="-I$withval/include"
2112                  with_libnetlink_libs="-L$withval/lib -lnetlink"
2113                  with_libnetlink="yes"
2114          else
2115                  AC_MSG_ERROR("no such directory: $withval/include")
2116          fi
2117  fi; fi
2118 ],
2120  if test "x$ac_system" = "xLinux"
2121  then
2122          with_libnetlink="yes"
2123  else
2124          with_libnetlink="no (Linux only library)"
2125  fi
2126 ])
2127 if test "x$with_libnetlink" = "xyes"
2128 then
2129         SAVE_CFLAGS="$CFLAGS"
2130         CFLAGS="$CFLAGS $with_libnetlink_cflags"
2132         with_libnetlink="no (libnetlink.h not found)"
2134         AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2135         [
2136          with_libnetlink="yes"
2137          break
2138         ], [],
2139 [#include <stdio.h>
2140 #include <sys/types.h>
2141 #include <asm/types.h>
2142 #include <sys/socket.h>
2143 #include <linux/netlink.h>
2144 #include <linux/rtnetlink.h>])
2145         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2146 [#include <stdio.h>
2147 #include <sys/types.h>
2148 #include <asm/types.h>
2149 #include <sys/socket.h>])
2151         AC_COMPILE_IFELSE(
2152 [#include <stdio.h>
2153 #include <sys/types.h>
2154 #include <asm/types.h>
2155 #include <sys/socket.h>
2156 #include <linux/netlink.h>
2157 #include <linux/rtnetlink.h>
2159 int main (void)
2161         int retval = TCA_STATS2;
2162         return (retval);
2163 }],
2164         [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2165         []);
2167         AC_COMPILE_IFELSE(
2168 [#include <stdio.h>
2169 #include <sys/types.h>
2170 #include <asm/types.h>
2171 #include <sys/socket.h>
2172 #include <linux/netlink.h>
2173 #include <linux/rtnetlink.h>
2175 int main (void)
2177         int retval = TCA_STATS;
2178         return (retval);
2179 }],
2180         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2181         []);
2183         CFLAGS="$SAVE_CFLAGS"
2184 fi
2185 if test "x$with_libnetlink" = "xyes"
2186 then
2187         AC_CHECK_LIB(netlink, rtnl_open,
2188                      [with_libnetlink="yes"],
2189                      [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2190                      [$with_libnetlink_libs])
2191 fi
2192 if test "x$with_libnetlink" = "xyes"
2193 then
2194         BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2195         BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2196         AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2197         AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2198 fi
2199 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2200 # }}}
2202 # --with-libnetapp {{{
2203 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2204 AC_ARG_VAR([LIBNETAPP_LDFLAGS],  [Linker flags required to build with libnetapp])
2205 AC_ARG_VAR([LIBNETAPP_LIBS],     [Other libraries required to link against libnetapp])
2206 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2207 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2208 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2209 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2211  if test -d "$withval"
2212  then
2213          LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2214          LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2215          with_libnetapp="yes"
2216  else
2217          with_libnetapp="$withval"
2218  fi
2219 ],
2221  with_libnetapp="yes"
2222 ])
2224 SAVE_CPPFLAGS="$CPPFLAGS"
2225 SAVE_LDFLAGS="$LDFLAGS"
2226 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2227 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2229 if test "x$with_libnetapp" = "xyes"
2230 then
2231         if test "x$LIBNETAPP_CPPFLAGS" != "x"
2232         then
2233                 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2234         fi
2235         AC_CHECK_HEADERS(netapp_api.h,
2236                 [with_libnetapp="yes"],
2237                 [with_libnetapp="no (netapp_api.h not found)"])
2238 fi
2240 if test "x$with_libnetapp" = "xyes"
2241 then
2242         if test "x$LIBNETAPP_LDFLAGS" != "x"
2243         then
2244                 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2245         fi
2247         if test "x$LIBNETAPP_LIBS" = "x"
2248         then
2249                 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2250         fi
2251         AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2253         AC_CHECK_LIB(netapp, na_server_invoke_elem,
2254                 [with_libnetapp="yes"],
2255                 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2256                 [$LIBNETAPP_LIBS])
2257         LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2258 fi
2260 CPPFLAGS="$SAVE_CPPFLAGS"
2261 LDFLAGS="$SAVE_LDFLAGS"
2263 if test "x$with_libnetapp" = "xyes"
2264 then
2265         AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2266 fi
2268 AC_SUBST(LIBNETAPP_CPPFLAGS)
2269 AC_SUBST(LIBNETAPP_LDFLAGS)
2270 AC_SUBST(LIBNETAPP_LIBS)
2271 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2272 # }}}
2274 # --with-libnetsnmp {{{
2275 with_snmp_config="net-snmp-config"
2276 with_snmp_cflags=""
2277 with_snmp_libs=""
2278 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2280         if test "x$withval" = "xno"
2281         then
2282                 with_libnetsnmp="no"
2283         else if test "x$withval" = "xyes"
2284         then
2285                 with_libnetsnmp="yes"
2286         else
2287                 if test -x "$withval"
2288                 then
2289                         with_snmp_config="$withval"
2290                         with_libnetsnmp="yes"
2291                 else
2292                         with_snmp_config="$withval/bin/net-snmp-config"
2293                         with_libnetsnmp="yes"
2294                 fi
2295         fi; fi
2296 ],
2297 [with_libnetsnmp="yes"])
2298 if test "x$with_libnetsnmp" = "xyes"
2299 then
2300         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2301         snmp_config_status=$?
2303         if test $snmp_config_status -ne 0
2304         then
2305                 with_libnetsnmp="no ($with_snmp_config failed)"
2306         else
2307                 SAVE_CPPFLAGS="$CPPFLAGS"
2308                 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2309                 
2310                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2312                 CPPFLAGS="$SAVE_CPPFLAGS"
2313         fi
2314 fi
2315 if test "x$with_libnetsnmp" = "xyes"
2316 then
2317         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2318         snmp_config_status=$?
2320         if test $snmp_config_status -ne 0
2321         then
2322                 with_libnetsnmp="no ($with_snmp_config failed)"
2323         else
2324                 AC_CHECK_LIB(netsnmp, init_snmp,
2325                 [with_libnetsnmp="yes"],
2326                 [with_libnetsnmp="no (libnetsnmp not found)"],
2327                 [$with_snmp_libs])
2328         fi
2329 fi
2330 if test "x$with_libnetsnmp" = "xyes"
2331 then
2332         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2333         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2334         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2335         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2336 fi
2337 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2338 # }}}
2340 # --with-liboconfig {{{
2341 with_own_liboconfig="no"
2342 liboconfig_LDFLAGS="$LDFLAGS"
2343 liboconfig_CPPFLAGS="$CPPFLAGS"
2344 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2346         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2347         then
2348                 if test -d "$withval/lib"
2349                 then
2350                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2351                 fi
2352                 if test -d "$withval/include"
2353                 then
2354                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2355                 fi
2356         fi
2357         if test "x$withval" = "xno"
2358         then
2359                 AC_MSG_ERROR("liboconfig is required")
2360         fi
2361 ],
2363         with_liboconfig="yes"
2364 ])
2366 save_LDFLAGS="$LDFLAGS"
2367 save_CPPFLAGS="$CPPFLAGS"
2368 LDFLAGS="$liboconfig_LDFLAGS"
2369 CPPFLAGS="$liboconfig_CPPFLAGS"
2370 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2372         with_liboconfig="yes"
2373         with_own_liboconfig="no"
2374 ],
2376         with_liboconfig="yes"
2377         with_own_liboconfig="yes"
2378         LDFLAGS="$save_LDFLAGS"
2379         CPPFLAGS="$save_CPPFLAGS"
2380 ])
2382 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2383 if test "x$with_own_liboconfig" = "xyes"
2384 then
2385         with_liboconfig="yes (shipped version)"
2386 fi
2387 # }}}
2389 # --with-liboping {{{
2390 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2392  if test "x$withval" = "xyes"
2393  then
2394          with_liboping="yes"
2395  else if test "x$withval" = "xno"
2396  then
2397          with_liboping="no"
2398  else
2399          with_liboping="yes"
2400          LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2401          LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2402  fi; fi
2403 ],
2404 [with_liboping="yes"])
2406 SAVE_CPPFLAGS="$CPPFLAGS"
2407 SAVE_LDFLAGS="$LDFLAGS"
2409 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2410 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2412 if test "x$with_liboping" = "xyes"
2413 then
2414         if test "x$LIBOPING_CPPFLAGS" != "x"
2415         then
2416                 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2417         fi
2418         AC_CHECK_HEADERS(oping.h,
2419         [with_liboping="yes"],
2420         [with_liboping="no ('oping.h' not found)"])
2421 fi
2422 if test "x$with_liboping" = "xyes"
2423 then
2424         if test "x$LIBOPING_LDFLAGS" != "x"
2425         then
2426                 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2427         fi
2428         AC_CHECK_LIB(oping, ping_construct,
2429         [with_liboping="yes"],
2430         [with_liboping="no (symbol 'ping_construct' not found)"])
2431 fi
2433 CPPFLAGS="$SAVE_CPPFLAGS"
2434 LDFLAGS="$SAVE_LDFLAGS"
2436 if test "x$with_liboping" = "xyes"
2437 then
2438         BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2439         BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2440         AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2441         AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2442 fi
2443 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2444 # }}}
2446 # --with-oracle {{{
2447 with_oracle_cppflags=""
2448 with_oracle_libs=""
2449 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2451         if test "x$withval" = "xyes"
2452         then
2453                 if test "x$ORACLE_HOME" = "x"
2454                 then
2455                         AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2456                 fi
2457                 with_oracle="yes"
2458         else if test "x$withval" = "xno"
2459         then
2460                 with_oracle="no"
2461         else
2462                 with_oracle="yes"
2463                 ORACLE_HOME="$withval"
2464         fi; fi
2465 ],
2467         if test "x$ORACLE_HOME" = "x"
2468         then
2469                 with_oracle="no (ORACLE_HOME is not set)"
2470         else
2471                 with_oracle="yes"
2472         fi
2473 ])
2474 if test "x$ORACLE_HOME" != "x"
2475 then
2476         with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2478         if test -e "$ORACLE_HOME/lib/ldflags"
2479         then
2480                 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2481         fi
2482         #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2483         with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2484 fi
2485 if test "x$with_oracle" = "xyes"
2486 then
2487         SAVE_CPPFLAGS="$CPPFLAGS"
2488         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2490         AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2492         CPPFLAGS="$SAVE_CPPFLAGS"
2493 fi
2494 if test "x$with_oracle" = "xyes"
2495 then
2496         SAVE_CPPFLAGS="$CPPFLAGS"
2497         SAVE_LDFLAGS="$LDFLAGS"
2498         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2499         LDFLAGS="$LDFLAGS $with_oracle_libs"
2501         AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2503         CPPFLAGS="$SAVE_CPPFLAGS"
2504         LDFLAGS="$SAVE_LDFLAGS"
2505 fi
2506 if test "x$with_oracle" = "xyes"
2507 then
2508         BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2509         BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2510         AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2511         AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2512 fi
2513 # }}}
2515 # --with-libowcapi {{{
2516 with_libowcapi_cppflags=""
2517 with_libowcapi_libs="-lowcapi"
2518 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2520         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2521         then
2522                 with_libowcapi_cppflags="-I$withval/include"
2523                 with_libowcapi_libs="-L$withval/lib -lowcapi"
2524                 with_libowcapi="yes"
2525         else
2526                 with_libowcapi="$withval"
2527         fi
2528 ],
2530         with_libowcapi="yes"
2531 ])
2532 if test "x$with_libowcapi" = "xyes"
2533 then
2534         SAVE_CPPFLAGS="$CPPFLAGS"
2535         CPPFLAGS="$with_libowcapi_cppflags"
2536         
2537         AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2539         CPPFLAGS="$SAVE_CPPFLAGS"
2540 fi
2541 if test "x$with_libowcapi" = "xyes"
2542 then
2543         SAVE_LDFLAGS="$LDFLAGS"
2544         SAVE_CPPFLAGS="$CPPFLAGS"
2545         LDFLAGS="$with_libowcapi_libs"
2546         CPPFLAGS="$with_libowcapi_cppflags"
2547         
2548         AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2550         LDFLAGS="$SAVE_LDFLAGS"
2551         CPPFLAGS="$SAVE_CPPFLAGS"
2552 fi
2553 if test "x$with_libowcapi" = "xyes"
2554 then
2555         BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2556         BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2557         AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2558         AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2559 fi
2560 # }}}
2562 # --with-libpcap {{{
2563 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2565         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2566         then
2567                 LDFLAGS="$LDFLAGS -L$withval/lib"
2568                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2569                 with_libpcap="yes"
2570         else
2571                 with_libpcap="$withval"
2572         fi
2573 ],
2575         with_libpcap="yes"
2576 ])
2577 if test "x$with_libpcap" = "xyes"
2578 then
2579         AC_CHECK_LIB(pcap, pcap_open_live,
2580         [
2581                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2582         ], [with_libpcap="no (libpcap not found)"])
2583 fi
2584 if test "x$with_libpcap" = "xyes"
2585 then
2586         AC_CHECK_HEADERS(pcap.h,,
2587                          [with_libpcap="no (pcap.h not found)"])
2588 fi
2589 if test "x$with_libpcap" = "xyes"
2590 then
2591         AC_CHECK_HEADERS(pcap-bpf.h)
2592 fi
2593 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2594 # }}}
2596 # --with-libperl {{{
2597 perl_interpreter="perl"
2598 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2600         if test -x "$withval"
2601         then
2602                 perl_interpreter="$withval"
2603                 with_libperl="yes"
2604         else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2605         then
2606                 LDFLAGS="$LDFLAGS -L$withval/lib"
2607                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2608                 perl_interpreter="$withval/bin/perl"
2609                 with_libperl="yes"
2610         else
2611                 with_libperl="$withval"
2612         fi; fi
2613 ],
2615         with_libperl="yes"
2616 ])
2618 AC_MSG_CHECKING([for perl])
2619 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2620 if test -x "$perl_interpreter"
2621 then
2622         AC_MSG_RESULT([yes ($perl_interpreter)])
2623 else
2624         perl_interpreter=""
2625         AC_MSG_RESULT([no])
2626 fi
2628 AC_SUBST(PERL, "$perl_interpreter")
2630 if test "x$with_libperl" = "xyes" \
2631         && test -n "$perl_interpreter"
2632 then
2633   SAVE_CFLAGS="$CFLAGS"
2634   SAVE_LDFLAGS="$LDFLAGS"
2635 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2636   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2637   PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2638   CFLAGS="$CFLAGS $PERL_CFLAGS"
2639   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2641   AC_CACHE_CHECK([for libperl],
2642     [c_cv_have_libperl],
2643     AC_LINK_IFELSE(
2644       AC_LANG_PROGRAM(
2645       [[
2646 #define PERL_NO_GET_CONTEXT
2647 #include <EXTERN.h>
2648 #include <perl.h>
2649 #include <XSUB.h>
2650       ]],
2651       [[
2652        dTHX;
2653        load_module (PERL_LOADMOD_NOIMPORT,
2654                          newSVpv ("Collectd::Plugin::FooBar", 24),
2655                          Nullsv);
2656       ]]),
2657       [c_cv_have_libperl="yes"],
2658       [c_cv_have_libperl="no"]
2659     )
2660   )
2662   if test "x$c_cv_have_libperl" = "xyes"
2663   then
2664           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2665           AC_SUBST(PERL_CFLAGS)
2666           AC_SUBST(PERL_LDFLAGS)
2667   else
2668           with_libperl="no"
2669   fi
2671   CFLAGS="$SAVE_CFLAGS"
2672   LDFLAGS="$SAVE_LDFLAGS"
2673 else if test -z "$perl_interpreter"; then
2674   with_libperl="no (no perl interpreter found)"
2675   c_cv_have_libperl="no"
2676 fi; fi
2677 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2679 if test "x$with_libperl" = "xyes"
2680 then
2681         SAVE_CFLAGS="$CFLAGS"
2682         SAVE_LDFLAGS="$LDFLAGS"
2683         CFLAGS="$CFLAGS $PERL_CFLAGS"
2684         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2686         AC_CACHE_CHECK([if perl supports ithreads],
2687                 [c_cv_have_perl_ithreads],
2688                 AC_LINK_IFELSE(
2689                         AC_LANG_PROGRAM(
2690                         [[
2691 #include <EXTERN.h>
2692 #include <perl.h>
2693 #include <XSUB.h>
2695 #if !defined(USE_ITHREADS)
2696 # error "Perl does not support ithreads!"
2697 #endif /* !defined(USE_ITHREADS) */
2698                         ]],
2699                         [[ ]]),
2700                         [c_cv_have_perl_ithreads="yes"],
2701                         [c_cv_have_perl_ithreads="no"]
2702                 )
2703         )
2705         if test "x$c_cv_have_perl_ithreads" = "xyes"
2706         then
2707                 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2708         fi
2710         CFLAGS="$SAVE_CFLAGS"
2711         LDFLAGS="$SAVE_LDFLAGS"
2712 fi
2714 if test "x$with_libperl" = "xyes"
2715 then
2716         SAVE_CFLAGS="$CFLAGS"
2717         SAVE_LDFLAGS="$LDFLAGS"
2718         # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2719         # (see issues #41 and #42)
2720         CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2721         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2723         AC_CACHE_CHECK([for broken Perl_load_module()],
2724                 [c_cv_have_broken_perl_load_module],
2725                 AC_LINK_IFELSE(
2726                         AC_LANG_PROGRAM(
2727                         [[
2728 #define PERL_NO_GET_CONTEXT
2729 #include <EXTERN.h>
2730 #include <perl.h>
2731 #include <XSUB.h>
2732                         ]],
2733                         [[
2734                          dTHX;
2735                          load_module (PERL_LOADMOD_NOIMPORT,
2736                              newSVpv ("Collectd::Plugin::FooBar", 24),
2737                              Nullsv);
2738                         ]]),
2739                         [c_cv_have_broken_perl_load_module="no"],
2740                         [c_cv_have_broken_perl_load_module="yes"]
2741                 )
2742         )
2744         CFLAGS="$SAVE_CFLAGS"
2745         LDFLAGS="$SAVE_LDFLAGS"
2746 fi
2747 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2748                 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2750 if test "x$with_libperl" = "xyes"
2751 then
2752         SAVE_CFLAGS="$CFLAGS"
2753         SAVE_LDFLAGS="$LDFLAGS"
2754         CFLAGS="$CFLAGS $PERL_CFLAGS"
2755         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2757         AC_CHECK_MEMBER(
2758                 [struct mgvtbl.svt_local],
2759                 [have_struct_mgvtbl_svt_local="yes"],
2760                 [have_struct_mgvtbl_svt_local="no"],
2761                 [
2762 #include <EXTERN.h>
2763 #include <perl.h>
2764 #include <XSUB.h>
2765                 ])
2767         if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2768         then
2769                 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2770                                   [Define if Perl's struct mgvtbl has member svt_local.])
2771         fi
2773         CFLAGS="$SAVE_CFLAGS"
2774         LDFLAGS="$SAVE_LDFLAGS"
2775 fi
2776 # }}}
2778 # --with-libpq {{{
2779 with_pg_config="pg_config"
2780 with_libpq_includedir=""
2781 with_libpq_libdir=""
2782 with_libpq_cppflags=""
2783 with_libpq_ldflags=""
2784 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2785         [Path to libpq.])],
2787         if test "x$withval" = "xno"
2788         then
2789                 with_libpq="no"
2790         else if test "x$withval" = "xyes"
2791         then
2792                 with_libpq="yes"
2793         else
2794                 if test -f "$withval" && test -x "$withval";
2795                 then
2796                         with_pg_config="$withval"
2797                 else if test -x "$withval/bin/pg_config"
2798                 then
2799                         with_pg_config="$withval/bin/pg_config"
2800                 fi; fi
2801                 with_libpq="yes"
2802         fi; fi
2803 ],
2805         with_libpq="yes"
2806 ])
2807 if test "x$with_libpq" = "xyes"
2808 then
2809         with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2810         pg_config_status=$?
2812         if test $pg_config_status -eq 0
2813         then
2814                 if test -n "$with_libpq_includedir"; then
2815                         for dir in $with_libpq_includedir; do
2816                                 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2817                         done
2818                 fi
2819         else
2820                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2821         fi
2823         SAVE_CPPFLAGS="$CPPFLAGS"
2824         CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2826         AC_CHECK_HEADERS(libpq-fe.h, [],
2827                 [with_libpq="no (libpq-fe.h not found)"], [])
2829         CPPFLAGS="$SAVE_CPPFLAGS"
2830 fi
2831 if test "x$with_libpq" = "xyes"
2832 then
2833         with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2834         pg_config_status=$?
2836         if test $pg_config_status -eq 0
2837         then
2838                 if test -n "$with_libpq_libdir"; then
2839                         for dir in $with_libpq_libdir; do
2840                                 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2841                         done
2842                 fi
2843         else
2844                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2845         fi
2847         SAVE_LDFLAGS="$LDFLAGS"
2848         LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2850         AC_CHECK_LIB(pq, PQconnectdb,
2851                 [with_libpq="yes"],
2852                 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2854         AC_CHECK_LIB(pq, PQserverVersion,
2855                 [with_libpq="yes"],
2856                 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2858         LDFLAGS="$SAVE_LDFLAGS"
2859 fi
2860 if test "x$with_libpq" = "xyes"
2861 then
2862         BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2863         BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2864         AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2865         AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2866 fi
2867 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2868 # }}}
2870 # --with-libpthread {{{
2871 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2872 [       if test "x$withval" != "xno" \
2873                 && test "x$withval" != "xyes"
2874         then
2875                 LDFLAGS="$LDFLAGS -L$withval/lib"
2876                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2877                 with_libpthread="yes"
2878         else
2879                 if test "x$withval" = "xno"
2880                 then
2881                         with_libpthread="no (disabled)"
2882                 fi
2883         fi
2884 ], [with_libpthread="yes"])
2885 if test "x$with_libpthread" = "xyes"
2886 then
2887         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2888 fi
2890 if test "x$with_libpthread" = "xyes"
2891 then
2892         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2893 fi
2894 if test "x$with_libpthread" = "xyes"
2895 then
2896         collect_pthread=1
2897 else
2898         collect_pthread=0
2899 fi
2900 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2901         [Wether or not to use pthread (POSIX threads) library])
2902 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2903 # }}}
2905 # --with-python {{{
2906 with_python_prog=""
2907 with_python_path="$PATH"
2908 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
2910  if test "x$withval" = "xyes" || test "x$withval" = "xno"
2911  then
2912          with_python="$withval"
2913  else if test -x "$withval"
2914  then
2915          with_python_prog="$withval"
2916          with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
2917          with_python="yes"
2918  else if test -d "$withval"
2919  then
2920          with_python_path="$withval$PATH_SEPARATOR$with_python_path"
2921          with_python="yes"
2922  else
2923          AC_MSG_WARN([Argument not recognized: $withval])
2924  fi; fi; fi
2925 ], [with_python="yes"])
2927 SAVE_PATH="$PATH"
2928 SAVE_CPPFLAGS="$CPPFLAGS"
2929 SAVE_LDFLAGS="$LDFLAGS"
2930 SAVE_LIBS="$LIBS"
2932 PATH="$with_python_path"
2934 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
2935 then
2936         AC_MSG_CHECKING([for python])
2937         with_python_prog="`which python 2>/dev/null`"
2938         if test "x$with_python_prog" = "x"
2939         then
2940                 AC_MSG_RESULT([not found])
2941                 with_python="no (interpreter not found)"
2942         else
2943                 AC_MSG_RESULT([$with_python_prog])
2944         fi
2945 fi
2947 if test "x$with_python" = "xyes"
2948 then
2949         AC_MSG_CHECKING([for Python CPPFLAGS])
2950         python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
2951         python_config_status=$?
2953         if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
2954         then
2955                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
2956                 with_python="no"
2957         else
2958                 AC_MSG_RESULT([$python_include_path])
2959         fi
2960 fi
2962 if test "x$with_python" = "xyes"
2963 then
2964         CPPFLAGS="-I$python_include_path $CPPFLAGS"
2965         AC_CHECK_HEADERS(Python.h,
2966                          [with_python="yes"],
2967                          [with_python="no ('Python.h' not found)"])
2968 fi
2970 if test "x$with_python" = "xyes"
2971 then
2972         AC_MSG_CHECKING([for Python LDFLAGS])
2973         python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1`
2974         python_config_status=$?
2976         if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
2977         then
2978                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
2979                 with_python="no"
2980         else
2981                 AC_MSG_RESULT([$python_library_path])
2982         fi
2983 fi
2985 if test "x$with_python" = "xyes"
2986 then
2987         AC_MSG_CHECKING([for Python LIBS])
2988         python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1`
2989         python_config_status=$?
2991         if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
2992         then
2993                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
2994                 with_python="no"
2995         else
2996                 AC_MSG_RESULT([$python_library_flags])
2997         fi
2998 fi
3000 if test "x$with_python" = "xyes"
3001 then
3002         LDFLAGS="-L$python_library_path $LDFLAGS"
3003         LIBS="$python_library_flags $LIBS"
3005         AC_CHECK_FUNC(PyObject_CallFunction,
3006                       [with_python="yes"],
3007                       [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3008 fi
3010 PATH="$SAVE_PATH"
3011 CPPFLAGS="$SAVE_CPPFLAGS"
3012 LDFLAGS="$SAVE_LDFLAGS"
3013 LIBS="$SAVE_LIBS"
3015 if test "x$with_python" = "xyes"
3016 then
3017         BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3018         BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3019         BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3020         AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3021         AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3022         AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3023 fi
3024 # }}} --with-python
3026 # --with-librouteros {{{
3027 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3029  if test "x$withval" = "xyes"
3030  then
3031          with_librouteros="yes"
3032  else if test "x$withval" = "xno"
3033  then
3034          with_librouteros="no"
3035  else
3036          with_librouteros="yes"
3037          LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3038          LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3039  fi; fi
3040 ],
3041 [with_librouteros="yes"])
3043 SAVE_CPPFLAGS="$CPPFLAGS"
3044 SAVE_LDFLAGS="$LDFLAGS"
3046 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3047 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3049 if test "x$with_librouteros" = "xyes"
3050 then
3051         if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3052         then
3053                 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3054         fi
3055         AC_CHECK_HEADERS(routeros_api.h,
3056         [with_librouteros="yes"],
3057         [with_librouteros="no ('routeros_api.h' not found)"])
3058 fi
3059 if test "x$with_librouteros" = "xyes"
3060 then
3061         if test "x$LIBROUTEROS_LDFLAGS" != "x"
3062         then
3063                 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3064         fi
3065         AC_CHECK_LIB(routeros, ros_interface,
3066         [with_librouteros="yes"],
3067         [with_librouteros="no (symbol 'ros_interface' not found)"])
3068 fi
3070 CPPFLAGS="$SAVE_CPPFLAGS"
3071 LDFLAGS="$SAVE_LDFLAGS"
3073 if test "x$with_librouteros" = "xyes"
3074 then
3075         BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3076         BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3077         AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3078         AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3079 fi
3080 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3081 # }}}
3083 # --with-librrd {{{
3084 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3085 librrd_cflags=""
3086 librrd_ldflags=""
3087 librrd_threadsafe="yes"
3088 librrd_rrdc_update="no"
3089 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3090 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
3091         then
3092                 librrd_cflags="-I$withval/include"
3093                 librrd_ldflags="-L$withval/lib"
3094                 with_librrd="yes"
3095         else
3096                 with_librrd="$withval"
3097         fi
3098 ], [with_librrd="yes"])
3099 if test "x$with_librrd" = "xyes"
3100 then
3101         SAVE_CPPFLAGS="$CPPFLAGS"
3102         SAVE_LDFLAGS="$LDFLAGS"
3104         CPPFLAGS="$CPPFLAGS $librrd_cflags"
3105         LDFLAGS="$LDFLAGS $librrd_ldflags"
3107         AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3109         CPPFLAGS="$SAVE_CPPFLAGS"
3110         LDFLAGS="$SAVE_LDFLAGS"
3111 fi
3112 if test "x$with_librrd" = "xyes"
3113 then
3114         SAVE_CPPFLAGS="$CPPFLAGS"
3115         SAVE_LDFLAGS="$LDFLAGS"
3117         CPPFLAGS="$CPPFLAGS $librrd_cflags"
3118         LDFLAGS="$LDFLAGS $librrd_ldflags"
3120         AC_CHECK_LIB(rrd_th, rrd_update_r,
3121         [with_librrd="yes"
3122          librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3123         ],
3124         [librrd_threadsafe="no"
3125          AC_CHECK_LIB(rrd, rrd_update,
3126          [with_librrd="yes"
3127           librrd_ldflags="$librrd_ldflags -lrrd -lm"
3128          ],
3129          [with_librrd="no (symbol 'rrd_update' not found)"],
3130          [-lm])
3131         ],
3132         [-lm])
3134         if test "x$librrd_threadsafe" = "xyes"
3135         then
3136                 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3137         else
3138                 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3139         fi
3141         CPPFLAGS="$SAVE_CPPFLAGS"
3142         LDFLAGS="$SAVE_LDFLAGS"
3143 fi
3144 if test "x$with_librrd" = "xyes"
3145 then
3146         BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3147         BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3148         AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3149         AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3150 fi
3151 if test "x$librrd_threadsafe" = "xyes"
3152 then
3153         AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3154 fi
3155 # }}}
3157 # --with-libsensors {{{
3158 with_sensors_cflags=""
3159 with_sensors_ldflags=""
3160 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3162         if test "x$withval" = "xno"
3163         then
3164                 with_libsensors="no"
3165         else
3166                 with_libsensors="yes"
3167                 if test "x$withval" != "xyes"
3168                 then
3169                         with_sensors_cflags="-I$withval/include"
3170                         with_sensors_ldflags="-L$withval/lib"
3171                         with_libsensors="yes"
3172                 fi
3173         fi
3174 ],
3176         if test "x$ac_system" = "xLinux"
3177         then
3178                 with_libsensors="yes"
3179         else
3180                 with_libsensors="no (Linux only library)"
3181         fi
3182 ])
3183 if test "x$with_libsensors" = "xyes"
3184 then
3185         SAVE_CPPFLAGS="$CPPFLAGS"
3186         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3188 #       AC_CHECK_HEADERS(sensors/sensors.h,
3189 #       [
3190 #               AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3191 #       ],
3192 #       [with_libsensors="no (sensors/sensors.h not found)"])
3193         AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3195         CPPFLAGS="$SAVE_CPPFLAGS"
3196 fi
3197 if test "x$with_libsensors" = "xyes"
3198 then
3199         SAVE_CPPFLAGS="$CPPFLAGS"
3200         SAVE_LDFLAGS="$LDFLAGS"
3201         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3202         LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3204         AC_CHECK_LIB(sensors, sensors_init,
3205         [
3206                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3207         ],
3208         [with_libsensors="no (libsensors not found)"])
3210         CPPFLAGS="$SAVE_CPPFLAGS"
3211         LDFLAGS="$SAVE_LDFLAGS"
3212 fi
3213 if test "x$with_libsensors" = "xyes"
3214 then
3215         BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3216         BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3217         AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3218         AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3219 fi
3220 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3221 # }}}
3223 # --with-libstatgrab {{{
3224 with_libstatgrab_cflags=""
3225 with_libstatgrab_ldflags=""
3226 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3228  if test "x$withval" != "xno" \
3229    && test "x$withval" != "xyes"
3230  then
3231    with_libstatgrab_cflags="-I$withval/include"
3232    with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3233    with_libstatgrab="yes"
3234    with_libstatgrab_pkg_config="no"
3235  else
3236    with_libstatgrab="$withval"
3237    with_libstatgrab_pkg_config="yes"
3238  fi
3239  ],
3241  with_libstatgrab="yes"
3242  with_libstatgrab_pkg_config="yes"
3243 ])
3245 if test "x$with_libstatgrab" = "xyes" \
3246   && test "x$with_libstatgrab_pkg_config" = "xyes"
3247 then
3248   if test "x$PKG_CONFIG" != "x"
3249   then
3250     AC_MSG_CHECKING([pkg-config for libstatgrab])
3251     temp_result="found"
3252     $PKG_CONFIG --exists libstatgrab 2>/dev/null
3253     if test "$?" != "0"
3254     then
3255       with_libstatgrab_pkg_config="no"
3256       with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
3257       temp_result="not found"
3258     fi
3259     AC_MSG_RESULT([$temp_result])
3260   else
3261     AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3262     with_libstatgrab_pkg_config="no"
3263     with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3264   fi
3265 fi
3267 if test "x$with_libstatgrab" = "xyes" \
3268   && test "x$with_libstatgrab_pkg_config" = "xyes" \
3269   && test "x$with_libstatgrab_cflags" = "x"
3270 then
3271   AC_MSG_CHECKING([for libstatgrab CFLAGS])
3272   temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3273   if test "$?" = "0"
3274   then
3275     with_libstatgrab_cflags="$temp_result"
3276   else
3277     with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3278     temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3279   fi
3280   AC_MSG_RESULT([$temp_result])
3281 fi
3283 if test "x$with_libstatgrab" = "xyes" \
3284   && test "x$with_libstatgrab_pkg_config" = "xyes" \
3285   && test "x$with_libstatgrab_ldflags" = "x"
3286 then
3287   AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3288   temp_result="`$PKG_CONFIG --libs libstatgrab`"
3289   if test "$?" = "0"
3290   then
3291     with_libstatgrab_ldflags="$temp_result"
3292   else
3293     with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3294     temp_result="$PKG_CONFIG --libs libstatgrab failed"
3295   fi
3296   AC_MSG_RESULT([$temp_result])
3297 fi
3299 if test "x$with_libstatgrab" = "xyes"
3300 then
3301   SAVE_CPPFLAGS="$CPPFLAGS"
3302   CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3304   AC_CHECK_HEADERS(statgrab.h,
3305                    [with_libstatgrab="yes"],
3306                    [with_libstatgrab="no (statgrab.h not found)"])
3308   CPPFLAGS="$SAVE_CPPFLAGS"
3309 fi
3311 if test "x$with_libstatgrab" = "xyes"
3312 then
3313   SAVE_CFLAGS="$CFLAGS"
3314   SAVE_LDFLAGS="$LDFLAGS"
3316   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3317   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3319   AC_CHECK_LIB(statgrab, sg_init,
3320                [with_libstatgrab="yes"],
3321                [with_libstatgrab="no (symbol sg_init not found)"])
3323   CFLAGS="$SAVE_CFLAGS"
3324   LDFLAGS="$SAVE_LDFLAGS"
3325 fi
3327 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3328 if test "x$with_libstatgrab" = "xyes"
3329 then
3330   AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3331   BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3332   BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3333   AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3334   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3335 fi
3336 # }}}
3338 # --with-libtokyotyrant {{{
3339 with_libtokyotyrant_cppflags=""
3340 with_libtokyotyrant_ldflags=""
3341 with_libtokyotyrant_libs=""
3342 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3344   if test "x$withval" = "xno"
3345   then
3346     with_libtokyotyrant="no"
3347   else if test "x$withval" = "xyes"
3348   then
3349     with_libtokyotyrant="yes"
3350   else
3351     with_libtokyotyrant_cppflags="-I$withval/include"
3352     with_libtokyotyrant_ldflags="-L$withval/include"
3353     with_libtokyotyrant_libs="-ltokyotyrant"
3354     with_libtokyotyrant="yes"
3355   fi; fi
3356 ],
3358   with_libtokyotyrant="yes"
3359 ])
3361 if test "x$with_libtokyotyrant" = "xyes"
3362 then
3363   if $PKG_CONFIG --exists tokyotyrant
3364   then
3365     with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3366     with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3367     with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3368   fi
3369 fi
3371 SAVE_CPPFLAGS="$CPPFLAGS"
3372 SAVE_LDFLAGS="$LDFLAGS"
3373 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3374 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3376 if test "x$with_libtokyotyrant" = "xyes"
3377 then
3378   AC_CHECK_HEADERS(tcrdb.h,
3379   [
3380           AC_DEFINE(HAVE_TCRDB_H, 1,
3381                     [Define to 1 if you have the <tcrdb.h> header file.])
3382   ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3383 fi
3385 if test "x$with_libtokyotyrant" = "xyes"
3386 then
3387   AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3388   [
3389           AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3390                     [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3391   ],
3392   [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3393   [$with_libtokyotyrant_libs])
3394 fi
3396 CPPFLAGS="$SAVE_CPPFLAGS"
3397 LDFLAGS="$SAVE_LDFLAGS"
3399 if test "x$with_libtokyotyrant" = "xyes"
3400 then 
3401   BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3402   BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3403   BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3404   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3405   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3406   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3407 fi
3408 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3409 # }}}
3411 # --with-libupsclient {{{
3412 with_libupsclient_config=""
3413 with_libupsclient_cflags=""
3414 with_libupsclient_libs=""
3415 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3417         if test "x$withval" = "xno"
3418         then
3419                 with_libupsclient="no"
3420         else if test "x$withval" = "xyes"
3421         then
3422                 with_libupsclient="use_pkgconfig"
3423         else
3424                 if test -x "$withval"
3425                 then
3426                         with_libupsclient_config="$withval"
3427                         with_libupsclient="use_libupsclient_config"
3428                 else if test -x "$withval/bin/libupsclient-config"
3429                 then
3430                         with_libupsclient_config="$withval/bin/libupsclient-config"
3431                         with_libupsclient="use_libupsclient_config"
3432                 else
3433                         AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3434                         with_libupsclient_cflags="-I$withval/include"
3435                         with_libupsclient_libs="-L$withval/lib -lupsclient"
3436                         with_libupsclient="yes"
3437                 fi; fi
3438         fi; fi
3439 ],
3440 [with_libupsclient="use_pkgconfig"])
3442 # configure using libupsclient-config
3443 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3444 then
3445         AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3446         with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3447         if test $? -ne 0
3448         then
3449                 with_libupsclient="no ($with_libupsclient_config failed)"
3450         fi
3451         with_libupsclient_libs="`$with_libupsclient_config --libs`"
3452         if test $? -ne 0
3453         then
3454                 with_libupsclient="no ($with_libupsclient_config failed)"
3455         fi
3456 fi
3457 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3458 then
3459         with_libupsclient="yes"
3460 fi
3462 # configure using pkg-config
3463 if test "x$with_libupsclient" = "xuse_pkgconfig"
3464 then
3465         if test "x$PKG_CONFIG" = "x"
3466         then
3467                 with_libupsclient="no (Don't have pkg-config)"
3468         fi
3469 fi
3470 if test "x$with_libupsclient" = "xuse_pkgconfig"
3471 then
3472         AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3473         $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3474         if test $? -ne 0
3475         then
3476                 with_libupsclient="no (pkg-config doesn't know library)"
3477         fi
3478 fi
3479 if test "x$with_libupsclient" = "xuse_pkgconfig"
3480 then
3481         with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3482         if test $? -ne 0
3483         then
3484                 with_libupsclient="no ($PKG_CONFIG failed)"
3485         fi
3486         with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3487         if test $? -ne 0
3488         then
3489                 with_libupsclient="no ($PKG_CONFIG failed)"
3490         fi
3491 fi
3492 if test "x$with_libupsclient" = "xuse_pkgconfig"
3493 then
3494         with_libupsclient="yes"
3495 fi
3497 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3498 # the actual checks.
3499 if test "x$with_libupsclient" = "xyes"
3500 then
3501         SAVE_CPPFLAGS="$CPPFLAGS"
3502         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3504         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3506         CPPFLAGS="$SAVE_CPPFLAGS"
3507 fi
3508 if test "x$with_libupsclient" = "xyes"
3509 then
3510         SAVE_CPPFLAGS="$CPPFLAGS"
3511         SAVE_LDFLAGS="$LDFLAGS"
3513         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3514         LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3516         AC_CHECK_LIB(upsclient, upscli_connect,
3517                      [with_libupsclient="yes"],
3518                      [with_libupsclient="no (symbol upscli_connect not found)"])
3520         CPPFLAGS="$SAVE_CPPFLAGS"
3521         LDFLAGS="$SAVE_LDFLAGS"
3522 fi
3523 if test "x$with_libupsclient" = "xyes"
3524 then
3525         SAVE_CPPFLAGS="$CPPFLAGS"
3526         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3528         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3529 [#include <stdlib.h>
3530 #include <stdio.h>
3531 #include <upsclient.h>])
3533         CPPFLAGS="$SAVE_CPPFLAGS"
3534 fi
3535 if test "x$with_libupsclient" = "xyes"
3536 then
3537         BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3538         BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3539         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3540         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3541 fi
3542 # }}}
3544 # --with-libxmms {{{
3545 with_xmms_config="xmms-config"
3546 with_xmms_cflags=""
3547 with_xmms_libs=""
3548 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3550         if test "x$withval" != "xno" \
3551                 && test "x$withval" != "xyes"
3552         then
3553                 if test -f "$withval" && test -x "$withval";
3554                 then
3555                         with_xmms_config="$withval"
3556                 else if test -x "$withval/bin/xmms-config"
3557                 then
3558                         with_xmms_config="$withval/bin/xmms-config"
3559                 fi; fi
3560                 with_libxmms="yes"
3561         else if test "x$withval" = "xno"
3562         then
3563                 with_libxmms="no"
3564         else
3565                 with_libxmms="yes"
3566         fi; fi
3567 ],
3569         with_libxmms="yes"
3570 ])
3571 if test "x$with_libxmms" = "xyes"
3572 then
3573         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3574         xmms_config_status=$?
3576         if test $xmms_config_status -ne 0
3577         then
3578                 with_libxmms="no"
3579         fi
3580 fi
3581 if test "x$with_libxmms" = "xyes"
3582 then
3583         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3584         xmms_config_status=$?
3586         if test $xmms_config_status -ne 0
3587         then
3588                 with_libxmms="no"
3589         fi
3590 fi
3591 if test "x$with_libxmms" = "xyes"
3592 then
3593         AC_CHECK_LIB(xmms, xmms_remote_get_info,
3594         [
3595                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3596                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3597                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3598                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3599         ],
3600         [
3601                 with_libxmms="no"
3602         ],
3603         [$with_xmms_libs])
3604 fi
3605 with_libxmms_numeric=0
3606 if test "x$with_libxmms" = "xyes"
3607 then
3608         with_libxmms_numeric=1
3609 fi
3610 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3611 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3612 # }}}
3614 # --with-libyajl {{{
3615 with_libyajl_cppflags=""
3616 with_libyajl_ldflags=""
3617 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3619         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3620         then
3621                 with_libyajl_cppflags="-I$withval/include"
3622                 with_libyajl_ldflags="-L$withval/lib"
3623                 with_libyajl="yes"
3624         else
3625                 with_libyajl="$withval"
3626         fi
3627 ],
3629         with_libyajl="yes"
3630 ])
3631 if test "x$with_libyajl" = "xyes"
3632 then
3633         SAVE_CPPFLAGS="$CPPFLAGS"
3634         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3636         AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3637         AC_CHECK_HEADERS(yajl/yajl_version.h)
3639         CPPFLAGS="$SAVE_CPPFLAGS"
3640 fi
3641 if test "x$with_libyajl" = "xyes"
3642 then
3643         SAVE_CPPFLAGS="$CPPFLAGS"
3644         SAVE_LDFLAGS="$LDFLAGS"
3645         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3646         LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3648         AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3650         CPPFLAGS="$SAVE_CPPFLAGS"
3651         LDFLAGS="$SAVE_LDFLAGS"
3652 fi
3653 if test "x$with_libyajl" = "xyes"
3654 then
3655         BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3656         BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3657         BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3658         AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3659         AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3660         AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3661         AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3662 fi
3663 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3664 # }}}
3666 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3667 with_libxml2="no (pkg-config isn't available)"
3668 with_libxml2_cflags=""
3669 with_libxml2_ldflags=""
3670 with_libvirt="no (pkg-config isn't available)"
3671 with_libvirt_cflags=""
3672 with_libvirt_ldflags=""
3673 if test "x$PKG_CONFIG" != "x"
3674 then
3675         pkg-config --exists 'libxml-2.0' 2>/dev/null
3676         if test "$?" = "0"
3677         then
3678                 with_libxml2="yes"
3679         else
3680                 with_libxml2="no (pkg-config doesn't know library)"
3681         fi
3683         pkg-config --exists libvirt 2>/dev/null
3684         if test "$?" = "0"
3685         then
3686                 with_libvirt="yes"
3687         else
3688                 with_libvirt="no (pkg-config doesn't know library)"
3689         fi
3690 fi
3691 if test "x$with_libxml2" = "xyes"
3692 then
3693         with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3694         if test $? -ne 0
3695         then
3696                 with_libxml2="no"
3697         fi
3698         with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3699         if test $? -ne 0
3700         then
3701                 with_libxml2="no"
3702         fi
3703 fi
3704 if test "x$with_libxml2" = "xyes"
3705 then
3706         SAVE_CPPFLAGS="$CPPFLAGS"
3707         CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3709         AC_CHECK_HEADERS(libxml/parser.h, [],
3710                       [with_libxml2="no (libxml/parser.h not found)"])
3712         CPPFLAGS="$SAVE_CPPFLAGS"
3713 fi
3714 if test "x$with_libxml2" = "xyes"
3715 then
3716         SAVE_CFLAGS="$CFLAGS"
3717         SAVE_LDFLAGS="$LDFLAGS"
3719         CFLAGS="$CFLAGS $with_libxml2_cflags"
3720         LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3722         AC_CHECK_LIB(xml2, xmlXPathEval,
3723                      [with_libxml2="yes"],
3724                      [with_libxml2="no (symbol xmlXPathEval not found)"])
3726         CFLAGS="$SAVE_CFLAGS"
3727         LDFLAGS="$SAVE_LDFLAGS"
3728 fi
3729 dnl Add the right compiler flags and libraries.
3730 if test "x$with_libxml2" = "xyes"; then
3731         BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3732         BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3733         AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3734         AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3735 fi
3736 if test "x$with_libvirt" = "xyes"
3737 then
3738         with_libvirt_cflags="`pkg-config --cflags libvirt`"
3739         if test $? -ne 0
3740         then
3741                 with_libvirt="no"
3742         fi
3743         with_libvirt_ldflags="`pkg-config --libs libvirt`"
3744         if test $? -ne 0
3745         then
3746                 with_libvirt="no"
3747         fi
3748 fi
3749 if test "x$with_libvirt" = "xyes"
3750 then
3751         SAVE_CPPFLAGS="$CPPFLAGS"
3752         CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3754         AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3755                       [with_libvirt="no (libvirt/libvirt.h not found)"])
3757         CPPFLAGS="$SAVE_CPPFLAGS"
3758 fi
3759 if test "x$with_libvirt" = "xyes"
3760 then
3761         SAVE_CFLAGS="$CFLAGS"
3762         SAVE_LDFLAGS="$LDFLAGS"
3764         CFLAGS="$CFLAGS $with_libvirt_cflags"
3765         LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3767         AC_CHECK_LIB(virt, virDomainBlockStats,
3768                      [with_libvirt="yes"],
3769                      [with_libvirt="no (symbol virDomainBlockStats not found)"])
3771         CFLAGS="$SAVE_CFLAGS"
3772         LDFLAGS="$SAVE_LDFLAGS"
3773 fi
3774 dnl Add the right compiler flags and libraries.
3775 if test "x$with_libvirt" = "xyes"; then
3776         BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3777         BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3778         AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3779         AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3780 fi
3781 # }}}
3783 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3784 with_libopenipmipthread="yes"
3785 with_libopenipmipthread_cflags=""
3786 with_libopenipmipthread_libs=""
3788 AC_MSG_CHECKING([for pkg-config])
3789 temp_result="no"
3790 if test "x$PKG_CONFIG" = "x"
3791 then
3792         with_libopenipmipthread="no"
3793         temp_result="no"
3794 else
3795         temp_result="$PKG_CONFIG"
3796 fi
3797 AC_MSG_RESULT([$temp_result])
3799 if test "x$with_libopenipmipthread" = "xyes"
3800 then
3801         AC_MSG_CHECKING([for libOpenIPMIpthread])
3802         $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3803         if test "$?" != "0"
3804         then
3805                 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3806         fi
3807         AC_MSG_RESULT([$with_libopenipmipthread])
3808 fi
3810 if test "x$with_libopenipmipthread" = "xyes"
3811 then
3812         AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3813         temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3814         if test "$?" = "0"
3815         then
3816                 with_libopenipmipthread_cflags="$temp_result"
3817         else
3818                 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3819                 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3820         fi
3821         AC_MSG_RESULT([$temp_result])
3822 fi
3824 if test "x$with_libopenipmipthread" = "xyes"
3825 then
3826         AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3827         temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3828         if test "$?" = "0"
3829         then
3830                 with_libopenipmipthread_ldflags="$temp_result"
3831         else
3832                 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3833                 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3834         fi
3835         AC_MSG_RESULT([$temp_result])
3836 fi
3838 if test "x$with_libopenipmipthread" = "xyes"
3839 then
3840         SAVE_CPPFLAGS="$CPPFLAGS"
3841         CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3843         AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3844                          [with_libopenipmipthread="yes"],
3845                          [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3846 [#include <OpenIPMI/ipmiif.h>
3847 #include <OpenIPMI/ipmi_err.h>
3848 #include <OpenIPMI/ipmi_posix.h>
3849 #include <OpenIPMI/ipmi_conn.h>
3850 ])
3852         CPPFLAGS="$SAVE_CPPFLAGS"
3853 fi
3855 if test "x$with_libopenipmipthread" = "xyes"
3856 then
3857         BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3858         BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3859         AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3860         AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3861 fi
3862 # }}}
3864 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3865                 [with_libnotify="yes"],
3866                 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3868 # Check for enabled/disabled features
3871 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3872 # ------------------------------------------------------------
3873 dnl
3874 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3875 dnl
3876 AC_DEFUN(
3877         [AC_COLLECTD],
3878         [
3879         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3880         m4_if(
3881                 [$2],
3882                 [enable],
3883                 [dnl
3884                 m4_define([EnDis],[disabled])dnl
3885                 m4_define([YesNo],[no])dnl
3886                 ],dnl
3887                 [m4_if(
3888                         [$2],
3889                         [disable],
3890                         [dnl
3891                         m4_define([EnDis],[enabled])dnl
3892                         m4_define([YesNo],[yes])dnl
3893                         ],
3894                         [dnl
3895                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3896                         ]dnl
3897                 )]dnl
3898         )dnl
3899         m4_if([$3], [feature], [],
3900                 [m4_if(
3901                         [$3], [module], [],
3902                         [dnl
3903                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3904                         ]dnl
3905                 )]dnl
3906         )dnl
3907         AC_ARG_ENABLE(
3908                 [$1],
3909                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3910                 [],
3911                 enable_$1='[YesNo]'dnl
3912         )# AC_ARG_ENABLE
3913 if test "x$enable_$1" = "xno"
3914 then
3915         collectd_$1=0
3916 else
3917         if test "x$enable_$1" = "xyes"
3918         then
3919                 collectd_$1=1
3920         else
3921                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3922                 collectd_$1=1
3923                 enable_$1='yes'
3924         fi
3925 fi
3926         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3927         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3928         ]dnl
3929 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3931 # AC_PLUGIN(name, default, info)
3932 # ------------------------------------------------------------
3933 dnl
3934 AC_DEFUN(
3935   [AC_PLUGIN],
3936   [
3937     enable_plugin="no"
3938     force="no"
3939     AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3940     [
3941      if test "x$enableval" = "xyes"
3942      then
3943              enable_plugin="yes"
3944      else if test "x$enableval" = "xforce"
3945      then
3946              enable_plugin="yes"
3947              force="yes"
3948      else
3949              enable_plugin="no (disabled on command line)"
3950      fi; fi
3951     ],
3952     [
3953          if test "x$enable_all_plugins" = "xauto"
3954          then
3955              if test "x$2" = "xyes"
3956              then
3957                      enable_plugin="yes"
3958              else
3959                      enable_plugin="no"
3960              fi
3961          else
3962              enable_plugin="$enable_all_plugins"
3963          fi
3964     ])
3965     if test "x$enable_plugin" = "xyes"
3966     then
3967             if test "x$2" = "xyes" || test "x$force" = "xyes"
3968             then
3969                     AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3970                     if test "x$2" != "xyes"
3971                     then
3972                             dependency_warning="yes"
3973                     fi
3974             else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3975                     dependency_error="yes"
3976                     enable_plugin="no (dependency error)"
3977             fi
3978     fi
3979     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3980     enable_$1="$enable_plugin"
3981   ]
3982 )# AC_PLUGIN(name, default, info)
3984 m4_divert_once([HELP_ENABLE], [
3985 collectd features:])
3986 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3987 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
3988 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
3989 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
3991 dependency_warning="no"
3992 dependency_error="no"
3994 plugin_ascent="no"
3995 plugin_battery="no"
3996 plugin_bind="no"
3997 plugin_conntrack="no"
3998 plugin_contextswitch="no"
3999 plugin_cpu="no"
4000 plugin_cpufreq="no"
4001 plugin_curl_json="no"
4002 plugin_curl_xml="no"
4003 plugin_df="no"
4004 plugin_disk="no"
4005 plugin_entropy="no"
4006 plugin_interface="no"
4007 plugin_ipmi="no"
4008 plugin_ipvs="no"
4009 plugin_irq="no"
4010 plugin_libvirt="no"
4011 plugin_load="no"
4012 plugin_memory="no"
4013 plugin_multimeter="no"
4014 plugin_nfs="no"
4015 plugin_fscache="no"
4016 plugin_perl="no"
4017 plugin_processes="no"
4018 plugin_protocols="no"
4019 plugin_serial="no"
4020 plugin_swap="no"
4021 plugin_tape="no"
4022 plugin_tcpconns="no"
4023 plugin_ted="no"
4024 plugin_thermal="no"
4025 plugin_users="no"
4026 plugin_uptime="no"
4027 plugin_vmem="no"
4028 plugin_vserver="no"
4029 plugin_wireless="no"
4030 plugin_zfs_arc="no"
4032 # Linux
4033 if test "x$ac_system" = "xLinux"
4034 then
4035         plugin_battery="yes"
4036         plugin_conntrack="yes"
4037         plugin_contextswitch="yes"
4038         plugin_cpu="yes"
4039         plugin_cpufreq="yes"
4040         plugin_disk="yes"
4041         plugin_entropy="yes"
4042         plugin_interface="yes"
4043         plugin_irq="yes"
4044         plugin_load="yes"
4045         plugin_memory="yes"
4046         plugin_nfs="yes"
4047         plugin_fscache="yes"
4048         plugin_processes="yes"
4049         plugin_protocols="yes"
4050         plugin_serial="yes"
4051         plugin_swap="yes"
4052         plugin_tcpconns="yes"
4053         plugin_thermal="yes"
4054         plugin_uptime="yes"
4055         plugin_vmem="yes"
4056         plugin_vserver="yes"
4057         plugin_wireless="yes"
4059         if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4060         then
4061                 plugin_ipvs="yes"
4062         fi
4063 fi
4065 if test "x$ac_system" = "xOpenBSD"
4066 then
4067         plugin_tcpconns="yes"
4068 fi
4070 # Mac OS X devices
4071 if test "x$with_libiokit" = "xyes"
4072 then
4073         plugin_battery="yes"
4074         plugin_disk="yes"
4075 fi
4077 # AIX
4078 if test "x$with_perfstat" = "xyes"
4079 then
4080         plugin_cpu="yes"
4081         plugin_disk="yes"
4082         plugin_memory="yes"
4083         plugin_swap="yes"
4084         plugin_interface="yes"
4085         plugin_load="yes"
4086 fi
4088 if test "x$with_procinfo" = "xyes"
4089 then
4090         plugin_processes="yes"
4091 fi
4093 # Solaris
4094 if test "x$with_kstat" = "xyes"
4095 then
4096         plugin_uptime="yes"
4097         plugin_zfs_arc="yes"
4098 fi
4100 if test "x$with_devinfo$with_kstat" = "xyesyes"
4101 then
4102         plugin_cpu="yes"
4103         plugin_disk="yes"
4104         plugin_interface="yes"
4105         plugin_memory="yes"
4106         plugin_tape="yes"
4107 fi
4109 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
4110 then
4111         plugin_swap="yes"
4112 fi
4114 # libstatgrab
4115 if test "x$with_libstatgrab" = "xyes"
4116 then
4117         plugin_cpu="yes"
4118         plugin_disk="yes"
4119         plugin_interface="yes"
4120         plugin_load="yes"
4121         plugin_memory="yes"
4122         plugin_swap="yes"
4123         plugin_users="yes"
4124 fi
4126 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4127 then
4128         plugin_ascent="yes"
4129         plugin_bind="yes"
4130 fi
4132 if test "x$with_libopenipmipthread" = "xyes"
4133 then
4134         plugin_ipmi="yes"
4135 fi
4137 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4138 then
4139         plugin_curl_json="yes"
4140 fi
4142 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4143 then
4144         plugin_curl_xml="yes"
4145 fi
4147 if test "x$have_processor_info" = "xyes"
4148 then
4149         plugin_cpu="yes"
4150 fi
4151 if test "x$have_sysctl" = "xyes"
4152 then
4153         plugin_cpu="yes"
4154         plugin_memory="yes"
4155         plugin_swap="yes"
4156         plugin_uptime="yes"
4157 fi
4158 if test "x$have_sysctlbyname" = "xyes"
4159 then
4160         plugin_cpu="yes"
4161         plugin_memory="yes"
4162         plugin_tcpconns="yes"
4163 fi
4165 # Df plugin: Check if we know how to determine mount points first.
4166 #if test "x$have_listmntent" = "xyes"; then
4167 #       plugin_df="yes"
4168 #fi
4169 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4170 then
4171         plugin_df="yes"
4172 fi
4173 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4174 then
4175         plugin_df="yes"
4176 fi
4177 #if test "x$have_getmntent" = "xseq"
4178 #then
4179 #       plugin_df="yes"
4180 #fi
4181 if test "x$c_cv_have_one_getmntent" = "xyes"
4182 then
4183         plugin_df="yes"
4184 fi
4186 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4187 if test "x$plugin_df" = "xyes"
4188 then
4189         plugin_df="no"
4190         if test "x$have_statfs" = "xyes"
4191         then
4192                 plugin_df="yes"
4193         fi
4194         if test "x$have_statvfs" = "xyes"
4195         then
4196                 plugin_df="yes"
4197         fi
4198 fi
4200 if test "x$have_getifaddrs" = "xyes"
4201 then
4202         plugin_interface="yes"
4203 fi
4205 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4206 then
4207         plugin_libvirt="yes"
4208 fi
4210 if test "x$have_getloadavg" = "xyes"
4211 then
4212         plugin_load="yes"
4213 fi
4215 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4216 then
4217         plugin_perl="yes"
4218 fi
4220 # Mac OS X memory interface
4221 if test "x$have_host_statistics" = "xyes"
4222 then
4223         plugin_memory="yes"
4224 fi
4226 if test "x$have_termios_h" = "xyes"
4227 then
4228         plugin_multimeter="yes"
4229         plugin_ted="yes"
4230 fi
4232 if test "x$have_thread_info" = "xyes"
4233 then
4234         plugin_processes="yes"
4235 fi
4237 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4238 then
4239         plugin_processes="yes"
4240 fi
4242 if test "x$with_kvm_getswapinfo" = "xyes"
4243 then
4244         plugin_swap="yes"
4245 fi
4247 if test "x$have_swapctl" = "xyes"
4248 then
4249         plugin_swap="yes"
4250 fi
4252 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4253 then
4254         plugin_tcpconns="yes"
4255 fi
4257 if test "x$have_getutent" = "xyes"
4258 then
4259         plugin_users="yes"
4260 fi
4261 if test "x$have_getutxent" = "xyes"
4262 then
4263         plugin_users="yes"
4264 fi
4266 m4_divert_once([HELP_ENABLE], [
4267 collectd plugins:])
4269 AC_ARG_ENABLE([all-plugins],
4270                 AC_HELP_STRING([--enable-all-plugins],
4271                                 [enable all plugins (auto by def)]),
4272                 [
4273                  if test "x$enableval" = "xyes"
4274                  then
4275                          enable_all_plugins="yes"
4276                  else if test "x$enableval" = "xauto"
4277                  then
4278                          enable_all_plugins="auto"
4279                  else
4280                          enable_all_plugins="no"
4281                  fi; fi
4282                 ],
4283                 [enable_all_plugins="auto"])
4285 m4_divert_once([HELP_ENABLE], [])
4287 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
4288 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
4289 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
4290 AC_PLUGIN([ascent],      [$plugin_ascent],     [AscentEmu player statistics])
4291 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
4292 AC_PLUGIN([bind],        [$plugin_bind],       [ISC Bind nameserver statistics])
4293 AC_PLUGIN([conntrack],   [$plugin_conntrack],  [nf_conntrack statistics])
4294 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4295 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
4296 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
4297 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
4298 AC_PLUGIN([curl],        [$with_libcurl],      [CURL generic web statistics])
4299 AC_PLUGIN([curl_json],   [$plugin_curl_json],    [CouchDB statistics])
4300 AC_PLUGIN([curl_xml],   [$plugin_curl_xml],    [CURL generic xml statistics])
4301 AC_PLUGIN([dbi],         [$with_libdbi],       [General database statistics])
4302 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
4303 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
4304 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
4305 AC_PLUGIN([email],       [yes],                [EMail statistics])
4306 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
4307 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
4308 AC_PLUGIN([filecount],   [yes],                [Count files in directories])
4309 AC_PLUGIN([fscache],     [$plugin_fscache],    [fscache statistics])
4310 AC_PLUGIN([gmond],       [$with_libganglia],   [Ganglia plugin])
4311 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
4312 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
4313 AC_PLUGIN([ipmi],        [$plugin_ipmi],       [IPMI sensor statistics])
4314 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
4315 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
4316 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
4317 AC_PLUGIN([java],        [$with_java],         [Embed the Java Virtual Machine])
4318 AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
4319 AC_PLUGIN([load],        [$plugin_load],       [System load])
4320 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
4321 AC_PLUGIN([madwifi],     [$have_linux_wireless_h], [Madwifi wireless statistics])
4322 AC_PLUGIN([match_empty_counter], [yes],        [The empty counter match])
4323 AC_PLUGIN([match_hashed], [yes],               [The hashed match])
4324 AC_PLUGIN([match_regex], [yes],                [The regex match])
4325 AC_PLUGIN([match_timediff], [yes],             [The timediff match])
4326 AC_PLUGIN([match_value], [yes],                [The value match])
4327 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
4328 AC_PLUGIN([memcachec],   [$with_libmemcached], [memcachec statistics])
4329 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
4330 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
4331 AC_PLUGIN([modbus],      [$with_libmodbus],    [Modbus plugin])
4332 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
4333 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
4334 AC_PLUGIN([netapp],      [$with_libnetapp],    [NetApp plugin])
4335 AC_PLUGIN([netlink],     [$with_libnetlink],   [Enhanced Linux network statistics])
4336 AC_PLUGIN([network],     [yes],                [Network communication plugin])
4337 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
4338 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
4339 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4340 AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
4341 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
4342 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
4343 AC_PLUGIN([olsrd],       [yes],                [olsrd statistics])
4344 AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
4345 AC_PLUGIN([openvpn],     [yes],                [OpenVPN client statistics])
4346 AC_PLUGIN([oracle],      [$with_oracle],       [Oracle plugin])
4347 AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
4348 # FIXME: Check for libevent, too.
4349 AC_PLUGIN([pinba],       [$have_protoc_c],     [Pinba statistics])
4350 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
4351 AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
4352 AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
4353 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
4354 AC_PLUGIN([protocols],   [$plugin_protocols],  [Protocol (IP, TCP, ...) statistics])
4355 AC_PLUGIN([python],      [$with_python],       [Embed a Python interpreter])
4356 AC_PLUGIN([routeros],    [$with_librouteros],  [RouterOS plugin])
4357 AC_PLUGIN([rrdcached],   [$librrd_rrdc_update], [RRDTool output plugin])
4358 AC_PLUGIN([rrdtool],     [$with_librrd],       [RRDTool output plugin])
4359 AC_PLUGIN([sensors],     [$with_libsensors],   [lm_sensors statistics])
4360 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
4361 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
4362 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
4363 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
4364 AC_PLUGIN([table],       [yes],                [Parsing of tabular data])
4365 AC_PLUGIN([tail],        [yes],                [Parsing of logfiles])
4366 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
4367 AC_PLUGIN([target_notification], [yes],        [The notification target])
4368 AC_PLUGIN([target_replace], [yes],             [The replace target])
4369 AC_PLUGIN([target_scale],[yes],                [The scale target])
4370 AC_PLUGIN([target_set],  [yes],                [The set target])
4371 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
4372 AC_PLUGIN([teamspeak2],  [yes],                [TeamSpeak2 server statistics])
4373 AC_PLUGIN([ted],         [$plugin_ted],        [Read The Energy Detective values])
4374 AC_PLUGIN([thermal],     [$plugin_thermal],    [Linux ACPI thermal zone statistics])
4375 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant],  [TokyoTyrant database statistics])
4376 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
4377 AC_PLUGIN([uptime],      [$plugin_uptime],     [Uptime statistics])
4378 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
4379 AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
4380 AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
4381 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
4382 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
4383 AC_PLUGIN([write_http],  [$with_libcurl],      [HTTP output plugin])
4384 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
4385 AC_PLUGIN([zfs_arc],     [$plugin_zfs_arc],    [ZFS ARC statistics])
4387 dnl Default configuration file
4388 # Load either syslog or logfile
4389 LOAD_PLUGIN_SYSLOG=""
4390 LOAD_PLUGIN_LOGFILE=""
4392 AC_MSG_CHECKING([which default log plugin to load])
4393 default_log_plugin="none"
4394 if test "x$enable_syslog" = "xyes"
4395 then
4396         default_log_plugin="syslog"
4397 else
4398         LOAD_PLUGIN_SYSLOG="##"
4399 fi
4401 if test "x$enable_logfile" = "xyes"
4402 then
4403         if test "x$default_log_plugin" = "xnone"
4404         then
4405                 default_log_plugin="logfile"
4406         else
4407                 LOAD_PLUGIN_LOGFILE="#"
4408         fi
4409 else
4410         LOAD_PLUGIN_LOGFILE="##"
4411 fi
4412 AC_MSG_RESULT([$default_log_plugin])
4414 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4415 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4417 DEFAULT_LOG_LEVEL="info"
4418 if test "x$enable_debug" = "xyes"
4419 then
4420         DEFAULT_LOG_LEVEL="debug"
4421 fi
4422 AC_SUBST(DEFAULT_LOG_LEVEL)
4424 # Load only one of rrdtool, network, csv in the default config.
4425 LOAD_PLUGIN_RRDTOOL=""
4426 LOAD_PLUGIN_NETWORK=""
4427 LOAD_PLUGIN_CSV=""
4429 AC_MSG_CHECKING([which default write plugin to load])
4430 default_write_plugin="none"
4431 if test "x$enable_rrdtool" = "xyes"
4432 then
4433         default_write_plugin="rrdtool"
4434 else
4435         LOAD_PLUGIN_RRDTOOL="##"
4436 fi
4438 if test "x$enable_network" = "xyes"
4439 then
4440         if test "x$default_write_plugin" = "xnone"
4441         then
4442                 default_write_plugin="network"
4443         else
4444                 LOAD_PLUGIN_NETWORK="#"
4445         fi
4446 else
4447         LOAD_PLUGIN_NETWORK="##"
4448 fi
4450 if test "x$enable_csv" = "xyes"
4451 then
4452         if test "x$default_write_plugin" = "xnone"
4453         then
4454                 default_write_plugin="csv"
4455         else
4456                 LOAD_PLUGIN_CSV="#"
4457         fi
4458 else
4459         LOAD_PLUGIN_CSV="##"
4460 fi
4461 AC_MSG_RESULT([$default_write_plugin])
4463 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4464 AC_SUBST(LOAD_PLUGIN_NETWORK)
4465 AC_SUBST(LOAD_PLUGIN_CSV)
4467 dnl ip_vs.h
4468 if test "x$ac_system" = "xLinux" \
4469         && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4470 then
4471         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4472 fi
4474 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4475 then
4476         enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4477 fi
4479 dnl Perl bindings
4480 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4482         if test "x$withval" != "xno" && test "x$withval" != "xyes"
4483         then
4484                 PERL_BINDINGS_OPTIONS="$withval"
4485                 with_perl_bindings="yes"
4486         else
4487                 PERL_BINDINGS_OPTIONS=""
4488                 with_perl_bindings="$withval"
4489         fi
4490 ],
4492         PERL_BINDINGS_OPTIONS=""
4493         if test -n "$perl_interpreter"
4494         then
4495                 with_perl_bindings="yes"
4496         else
4497                 with_perl_bindings="no (no perl interpreter found)"
4498         fi
4499 ])
4500 if test "x$with_perl_bindings" = "xyes"
4501 then
4502         PERL_BINDINGS="perl"
4503 else
4504         PERL_BINDINGS=""
4505 fi
4506 AC_SUBST(PERL_BINDINGS)
4507 AC_SUBST(PERL_BINDINGS_OPTIONS)
4509 dnl libcollectdclient
4510 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4511 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4512 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4514 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4516 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4518 AC_SUBST(LCC_VERSION_MAJOR)
4519 AC_SUBST(LCC_VERSION_MINOR)
4520 AC_SUBST(LCC_VERSION_PATCH)
4521 AC_SUBST(LCC_VERSION_EXTRA)
4522 AC_SUBST(LCC_VERSION_STRING)
4524 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4526 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
4528 if test "x$with_librrd" = "xyes" \
4529         && test "x$librrd_threadsafe" != "xyes"
4530 then
4531         with_librrd="yes (warning: librrd is not thread-safe)"
4532 fi
4534 if test "x$with_libperl" = "xyes"
4535 then
4536         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4537 else
4538         enable_perl="no (needs libperl)"
4539 fi
4541 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4542 then
4543         enable_perl="no (libperl doesn't support ithreads)"
4544 fi
4546 if test "x$with_perl_bindings" = "xyes" \
4547         && test "x$PERL_BINDINGS_OPTIONS" != "x"
4548 then
4549         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4550 fi
4552 cat <<EOF;
4554 Configuration:
4555   Libraries:
4556     libcurl . . . . . . . $with_libcurl
4557     libdbi  . . . . . . . $with_libdbi
4558     libesmtp  . . . . . . $with_libesmtp
4559     libganglia  . . . . . $with_libganglia
4560     libgcrypt . . . . . . $with_libgcrypt
4561     libiokit  . . . . . . $with_libiokit
4562     libiptc . . . . . . . $with_libiptc
4563     libjvm  . . . . . . . $with_java
4564     libkstat  . . . . . . $with_kstat
4565     libkvm  . . . . . . . $with_libkvm
4566     libmemcached  . . . . $with_libmemcached
4567     libmodbus . . . . . . $with_libmodbus
4568     libmysql  . . . . . . $with_libmysql
4569     libnetapp . . . . . . $with_libnetapp
4570     libnetlink  . . . . . $with_libnetlink
4571     libnetsnmp  . . . . . $with_libnetsnmp
4572     libnotify . . . . . . $with_libnotify
4573     liboconfig  . . . . . $with_liboconfig
4574     libopenipmi . . . . . $with_libopenipmipthread
4575     liboping  . . . . . . $with_liboping
4576     libpcap . . . . . . . $with_libpcap
4577     libperfstat . . . . . $with_perfstat
4578     libperl . . . . . . . $with_libperl
4579     libpq . . . . . . . . $with_libpq
4580     libpthread  . . . . . $with_libpthread
4581     librouteros . . . . . $with_librouteros
4582     librrd  . . . . . . . $with_librrd
4583     libsensors  . . . . . $with_libsensors
4584     libstatgrab . . . . . $with_libstatgrab
4585     libtokyotyrant  . . . $with_libtokyotyrant
4586     libupsclient  . . . . $with_libupsclient
4587     libvirt . . . . . . . $with_libvirt
4588     libxml2 . . . . . . . $with_libxml2
4589     libxmms . . . . . . . $with_libxmms
4590     libyajl . . . . . . . $with_libyajl
4591     libevent  . . . . . . $with_libevent
4592     protobuf-c  . . . . . $have_protoc_c
4593     oracle  . . . . . . . $with_oracle
4594     python  . . . . . . . $with_python
4596   Features:
4597     daemon mode . . . . . $enable_daemon
4598     debug . . . . . . . . $enable_debug
4600   Bindings:
4601     perl  . . . . . . . . $with_perl_bindings
4603   Modules:
4604     apache  . . . . . . . $enable_apache
4605     apcups  . . . . . . . $enable_apcups
4606     apple_sensors . . . . $enable_apple_sensors
4607     ascent  . . . . . . . $enable_ascent
4608     battery . . . . . . . $enable_battery
4609     bind  . . . . . . . . $enable_bind
4610     conntrack . . . . . . $enable_conntrack
4611     contextswitch . . . . $enable_contextswitch
4612     cpu . . . . . . . . . $enable_cpu
4613     cpufreq . . . . . . . $enable_cpufreq
4614     csv . . . . . . . . . $enable_csv
4615     curl  . . . . . . . . $enable_curl
4616     curl_json . . . . . . $enable_curl_json
4617     curl_xml  . . . . . . $enable_curl_xml
4618     dbi . . . . . . . . . $enable_dbi
4619     df  . . . . . . . . . $enable_df
4620     disk  . . . . . . . . $enable_disk
4621     dns . . . . . . . . . $enable_dns
4622     email . . . . . . . . $enable_email
4623     entropy . . . . . . . $enable_entropy
4624     exec  . . . . . . . . $enable_exec
4625     filecount . . . . . . $enable_filecount
4626     fscache . . . . . . . $enable_fscache
4627     gmond . . . . . . . . $enable_gmond
4628     hddtemp . . . . . . . $enable_hddtemp
4629     interface . . . . . . $enable_interface
4630     ipmi  . . . . . . . . $enable_ipmi
4631     iptables  . . . . . . $enable_iptables
4632     ipvs  . . . . . . . . $enable_ipvs
4633     irq . . . . . . . . . $enable_irq
4634     java  . . . . . . . . $enable_java
4635     libvirt . . . . . . . $enable_libvirt
4636     load  . . . . . . . . $enable_load
4637     logfile . . . . . . . $enable_logfile
4638     madwifi . . . . . . . $enable_madwifi
4639     match_empty_counter . $enable_match_empty_counter
4640     match_hashed  . . . . $enable_match_hashed
4641     match_regex . . . . . $enable_match_regex
4642     match_timediff  . . . $enable_match_timediff
4643     match_value . . . . . $enable_match_value
4644     mbmon . . . . . . . . $enable_mbmon
4645     memcachec . . . . . . $enable_memcachec
4646     memcached . . . . . . $enable_memcached
4647     memory  . . . . . . . $enable_memory
4648     modbus  . . . . . . . $enable_modbus
4649     multimeter  . . . . . $enable_multimeter
4650     mysql . . . . . . . . $enable_mysql
4651     netapp  . . . . . . . $enable_netapp
4652     netlink . . . . . . . $enable_netlink
4653     network . . . . . . . $enable_network
4654     nfs . . . . . . . . . $enable_nfs
4655     nginx . . . . . . . . $enable_nginx
4656     notify_desktop  . . . $enable_notify_desktop
4657     notify_email  . . . . $enable_notify_email
4658     ntpd  . . . . . . . . $enable_ntpd
4659     nut . . . . . . . . . $enable_nut
4660     olsrd . . . . . . . . $enable_olsrd
4661     onewire . . . . . . . $enable_onewire
4662     openvpn . . . . . . . $enable_openvpn
4663     oracle  . . . . . . . $enable_oracle
4664     perl  . . . . . . . . $enable_perl
4665     pinba . . . . . . . . $enable_pinba
4666     ping  . . . . . . . . $enable_ping
4667     postgresql  . . . . . $enable_postgresql
4668     powerdns  . . . . . . $enable_powerdns
4669     processes . . . . . . $enable_processes
4670     protocols . . . . . . $enable_protocols
4671     python  . . . . . . . $enable_python
4672     routeros  . . . . . . $enable_routeros
4673     rrdcached . . . . . . $enable_rrdcached
4674     rrdtool . . . . . . . $enable_rrdtool
4675     sensors . . . . . . . $enable_sensors
4676     serial  . . . . . . . $enable_serial
4677     snmp  . . . . . . . . $enable_snmp
4678     swap  . . . . . . . . $enable_swap
4679     syslog  . . . . . . . $enable_syslog
4680     table . . . . . . . . $enable_table
4681     tail  . . . . . . . . $enable_tail
4682     tape  . . . . . . . . $enable_tape
4683     target_notification . $enable_target_notification
4684     target_replace  . . . $enable_target_replace
4685     target_scale  . . . . $enable_target_scale
4686     target_set  . . . . . $enable_target_set
4687     tcpconns  . . . . . . $enable_tcpconns
4688     teamspeak2  . . . . . $enable_teamspeak2
4689     ted . . . . . . . . . $enable_ted
4690     thermal . . . . . . . $enable_thermal
4691     tokyotyrant . . . . . $enable_tokyotyrant
4692     unixsock  . . . . . . $enable_unixsock
4693     uptime  . . . . . . . $enable_uptime
4694     users . . . . . . . . $enable_users
4695     uuid  . . . . . . . . $enable_uuid
4696     vmem  . . . . . . . . $enable_vmem
4697     vserver . . . . . . . $enable_vserver
4698     wireless  . . . . . . $enable_wireless
4699     write_http  . . . . . $enable_write_http
4700     xmms  . . . . . . . . $enable_xmms
4701     zfs_arc . . . . . . . $enable_zfs_arc
4703 EOF
4705 if test "x$dependency_error" = "xyes"; then
4706         AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4707 fi
4709 if test "x$dependency_warning" = "xyes"; then
4710         AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4711 fi
4713 # vim: set fdm=marker :