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