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