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