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