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