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