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