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